Safeguard
Vulnerability Analysis•

CVE-2024-1540: High Command Injection in Gradio CI Workflow

CVE-2024-1540 is a command injection in the gradio repository's deploy+test-visual.yml workflow. Pass untrusted input through env variables.

Safeguard Security Team
3 min read

CVE-2024-1540 is a high severity (CVSS 8.2) command injection in the deploy+test-visual.yml workflow of the gradio-app/gradio repository. Untrusted GitHub context values were used inside a run step, so attackers could run commands and potentially modify the repository or exfiltrate secrets. The fix is to pass untrusted input through environment variables.

What's affected

This is a flaw in the project's own continuous integration workflow, not in the Gradio package that users install. The record names the deploy+test-visual.yml workflow in the gradio-app/gradio repository, and lists a fix commit and a huntr report.

The record gives no package versions. If you consume Gradio as a library, the record does not say your installation is affected. The lesson applies to anyone writing GitHub Actions workflows, including your own.

How to check if you're exposed

Search your own repositories for the same pattern. Look in the workflows directory for run steps that insert GitHub context values directly, especially fields an outsider controls such as pull request titles, branch names and issue text:

grep -rn "github.event" .github/workflows/

Review every hit that sits inside a run block. Also check which workflows run on pull requests from forks and which have access to secrets or write tokens.

To check a whole codebase at once, run the free in-browser dependency scan at gold.safeguard.sh/scan. You can also look up the CVE in the Gold directory, and use reachability analysis to see whether your code calls the affected path.

What to do now

  1. List workflows that use github context values inside run steps.
  2. Move each untrusted value into an environment variable and refer to the variable in the script.
  3. Reduce the default token permissions of each workflow to the minimum.
  4. Avoid giving secrets to workflows triggered by outside contributors.
  5. Add a pull request gate that reviews workflow changes.

Why it matters

The record classes this as CWE-77, command injection. In GitHub Actions, expressions inside the template syntax are replaced with their values before the shell script runs. If an outsider controls the value, the text becomes part of the script itself.

The remedy in the record is simple: put untrusted values into intermediate environment variables, so the shell reads them as data. CI compromise is serious because workflows hold tokens that can change code and releases. The record's KEV flag is false.

Try it yourself

Click through it at your own pace, or open it full screen.

Quick check

Does this affect people who install Gradio?

The record describes the repository workflow, not an installed package version.

What is the safe pattern?

Assign the untrusted value to an environment variable and refer to it from the script, as the record describes.

Sources

Last reviewed: 19 October 2026.

Never miss an update

Weekly insights on software supply chain security, delivered to your inbox.

Self-healing security runs on Safeguard.

Your first fix PR is minutes away.

No sales call required, even your agent can complete the purchase over MCP.