CVE-2024-4254: Gradio: secrets exfiltration via unsafe fork PR workflow
UNKNOWN PoC AVAILABLE CISA: TRACK*Any team using Gradio in their ML stack should treat this as a supply chain integrity event: an attacker could have exfiltrated HuggingFace (HF_TOKEN) and AWS credentials from Gradio's CI/CD, enabling downstream poisoning of Gradio releases or HuggingFace Spaces. Audit your pinned Gradio versions against known-good release hashes and rotate any credentials shared with or derived from Gradio's build pipeline. If your team mirrors or caches Gradio packages internally, verify integrity before the next deployment.
Risk Assessment
Risk is HIGH despite the missing CVSS score. The exploit requires only submitting a GitHub PR from a fork — a trivial action open to any public contributor. The blast radius is supply-chain-wide: compromised HF_TOKEN and AWS keys could allow an adversary to tamper with Gradio packages, HuggingFace model artifacts, or Vercel-hosted deployments before the vulnerability was disclosed. The absence of active KEV listing does not reduce urgency given Gradio's ubiquity across AI/ML pipelines.
Affected Systems
| Package | Ecosystem | Vulnerable Range | Patched |
|---|---|---|---|
| gradio | pip | — | No patch |
Do you use gradio? You're affected.
Severity & Risk
Recommended Action
6 steps-
Pin Gradio to a specific release hash in requirements files and verify against PyPI checksums — avoid range pinning.
-
Audit HuggingFace Spaces and any internal deployments that consume Gradio packages released around the vulnerability window (prior to 2024-06-04).
-
If your CI/CD inherits HF_TOKEN, AWS credentials, or Vercel tokens from a Gradio-derived workflow, rotate them immediately.
-
Scan your GitHub Actions workflows for the same anti-pattern:
pull_request_targetcombined with checkout of fork code — this is detectable with tools like actionlint or Semgrep (rule: github-actions-pull-request-target-code-execution). -
Enable GitHub Actions dependency review and Dependabot for workflow files.
-
For detection: monitor PyPI and HuggingFace model cards for unexpected version bumps or author changes on Gradio-related packages.
CISA SSVC Assessment
Source: CISA Vulnrichment (SSVC v2.0). Decision based on the CISA Coordinator decision tree.
Classification
Compliance Impact
This CVE is relevant to:
Frequently Asked Questions
What is CVE-2024-4254?
Any team using Gradio in their ML stack should treat this as a supply chain integrity event: an attacker could have exfiltrated HuggingFace (HF_TOKEN) and AWS credentials from Gradio's CI/CD, enabling downstream poisoning of Gradio releases or HuggingFace Spaces. Audit your pinned Gradio versions against known-good release hashes and rotate any credentials shared with or derived from Gradio's build pipeline. If your team mirrors or caches Gradio packages internally, verify integrity before the next deployment.
Is CVE-2024-4254 actively exploited?
Proof-of-concept exploit code is publicly available for CVE-2024-4254, increasing the risk of exploitation.
How to fix CVE-2024-4254?
1. Pin Gradio to a specific release hash in requirements files and verify against PyPI checksums — avoid range pinning. 2. Audit HuggingFace Spaces and any internal deployments that consume Gradio packages released around the vulnerability window (prior to 2024-06-04). 3. If your CI/CD inherits HF_TOKEN, AWS credentials, or Vercel tokens from a Gradio-derived workflow, rotate them immediately. 4. Scan your GitHub Actions workflows for the same anti-pattern: `pull_request_target` combined with checkout of fork code — this is detectable with tools like actionlint or Semgrep (rule: github-actions-pull-request-target-code-execution). 5. Enable GitHub Actions dependency review and Dependabot for workflow files. 6. For detection: monitor PyPI and HuggingFace model cards for unexpected version bumps or author changes on Gradio-related packages.
What systems are affected by CVE-2024-4254?
This vulnerability affects the following AI/ML architecture patterns: ML UI deployments, CI/CD pipelines, Model serving, HuggingFace Spaces, Training pipelines.
What is the CVSS score for CVE-2024-4254?
No CVSS score has been assigned yet.
Technical Details
NVD Description
The 'deploy-website.yml' workflow in the gradio-app/gradio repository, specifically in the 'main' branch, is vulnerable to secrets exfiltration due to improper authorization. The vulnerability arises from the workflow's explicit checkout and execution of code from a fork, which is unsafe as it allows the running of untrusted code in an environment with access to push to the base repository and access secrets. This flaw could lead to the exfiltration of sensitive secrets such as GITHUB_TOKEN, HF_TOKEN, VERCEL_ORG_ID, VERCEL_PROJECT_ID, COMMENT_TOKEN, AWSACCESSKEYID, AWSSECRETKEY, and VERCEL_TOKEN. The vulnerability is present in the workflow file located at https://github.com/gradio-app/gradio/blob/72f4ca88ab569aae47941b3fb0609e57f2e13a27/.github/workflows/deploy-website.yml.
Exploitation Scenario
An adversary identifies that Gradio's `deploy-website.yml` uses the `pull_request_target` trigger (which inherits base-repo secrets) but explicitly checks out code from the fork's HEAD. The adversary forks gradio-app/gradio, modifies the workflow or a build script to include a secrets exfiltration payload — e.g., a Python script that reads environment variables and POSTs them to an attacker-controlled endpoint via a DNS tunnel or HTTPS callback. They open a PR targeting the main branch. GitHub executes the workflow with full secret access. Within minutes, GITHUB_TOKEN, HF_TOKEN, AWSACCESSKEYID, AWSSECRETKEY, VERCEL_TOKEN, and COMMENT_TOKEN are in adversary hands. The adversary then uses HF_TOKEN to push a trojanized Gradio component to HuggingFace, which is pulled by downstream model deployments and HuggingFace Spaces at next update.
Weaknesses (CWE)
References
- huntr.com/bounties/59873fbd-5698-4ec3-87f9-5d70c6055d01 Exploit 3rd Party
Timeline
Related Vulnerabilities
CVE-2024-39236 9.8 Gradio: code injection via component metadata (CVSS 9.8)
Same package: gradio CVE-2024-47167 9.8 Gradio: unauthenticated SSRF in /queue/join, internal pivot
Same package: gradio CVE-2023-25823 9.8 Gradio: hardcoded SSH key leaks via share=True demos
Same package: gradio CVE-2024-0964 9.4 Gradio: unauthenticated LFI exposes full server filesystem
Same package: gradio CVE-2024-4253 9.1 Gradio: CI/CD command injection enables secrets exfiltration
Same package: gradio
AI Threat Alert