RGS-006: Curl-Pipe-Bash Remote Code Execution
Severity: Critical
Rule: RGS-006 — Untrusted input flows into a curl | bash (or equivalent) pattern, enabling remote code execution
Detected: 2026-04-29 | Run 25130700074
Findings: 1 in copilot-token-audit.lock.yml
Affected Workflow
copilot-token-audit.lock.yml — 1 finding
Taint flow pattern:
- Source: Untrusted event payload or workflow input (e.g.,
github.event.inputs.*, github.event.pull_request.*, etc.)
- Sink: Shell command that downloads and executes a script (e.g.,
curl <url> | bash, wget -O- <url> | sh, eval $(curl ...))
- Risk: An attacker who can control the source URL or inject into the command can execute arbitrary code within the runner
Example of vulnerable pattern:
- run: |
curl -fsSL "${{ github.event.inputs.script_url }}" | bash
Attack Scenario
- Attacker triggers the workflow (via
workflow_dispatch, PR, or comment) with a malicious input
- Attacker controls or poisons the URL used in the curl command
- Runner downloads and executes attacker-controlled script
- Attacker gains arbitrary code execution within the GitHub Actions runner
- Runner has access to all workflow secrets, repository contents, and any tokens granted to the job
This is particularly dangerous in copilot-token-audit.lock.yml because the workflow likely handles GitHub tokens/credentials as part of its function.
Remediation
Option 1 — Pin to a specific verified commit SHA (preferred):
- run: |
# Download and verify before executing
curl -fsSL (internal.example.com/redacted) -o /tmp/script.sh
# Verify checksum
echo "expected-sha256 /tmp/script.sh" | sha256sum -c
bash /tmp/script.sh
Option 2 — Vendor the script into the repository:
- run: bash scripts/audit-tokens.sh
Option 3 — Use a pinned GitHub Action instead:
- uses: owner/action@<full-commit-sha>
General guidance:
- Never pass
github.event.* or github.event.inputs.* values directly into curl commands
- If a remote URL must be used, validate it against a strict allowlist before downloading
- Always separate download from execution — inspect the script before running
- Use
GITHUB_ENV output capture carefully if passing results from such scripts
Remediation Checklist
Note on Co-Located RGS-008
copilot-token-audit.lock.yml also has an RGS-008 finding (secret directly interpolated in run: block), tracked in #29159. Both vulnerabilities should be remediated together.
References
Generated by Static Analysis Report · ● 452.4K · ◷
RGS-006: Curl-Pipe-Bash Remote Code Execution
Severity: Critical
Rule: RGS-006 — Untrusted input flows into a
curl | bash(or equivalent) pattern, enabling remote code executionDetected: 2026-04-29 | Run 25130700074
Findings: 1 in
copilot-token-audit.lock.ymlAffected Workflow
copilot-token-audit.lock.yml— 1 findingTaint flow pattern:
github.event.inputs.*,github.event.pull_request.*, etc.)curl <url> | bash,wget -O- <url> | sh,eval $(curl ...))Example of vulnerable pattern:
Attack Scenario
workflow_dispatch, PR, or comment) with a malicious inputThis is particularly dangerous in
copilot-token-audit.lock.ymlbecause the workflow likely handles GitHub tokens/credentials as part of its function.Remediation
Option 1 — Pin to a specific verified commit SHA (preferred):
Option 2 — Vendor the script into the repository:
Option 3 — Use a pinned GitHub Action instead:
General guidance:
github.event.*orgithub.event.inputs.*values directly into curl commandsGITHUB_ENVoutput capture carefully if passing results from such scriptsRemediation Checklist
curl | bashpattern incopilot-token-audit.lock.ymlNote on Co-Located RGS-008
copilot-token-audit.lock.ymlalso has an RGS-008 finding (secret directly interpolated inrun:block), tracked in #29159. Both vulnerabilities should be remediated together.References