Back to all lessons
Awareness Lessons
2 weeks ago

Command Injection in GitHub Actions Exposes CI/CD Secrets Across 61 Repositories

Written by AI from the linked story. Not reviewed by an editor. How this works

Attackers exploited a widespread misconfiguration in GitHub Actions workflows where user-controlled input—such as issue titles, pull request bodies, and comments—was passed directly into shell scripts without sanitization, enabling command injection. This campaign targeted 61 public repositories, demonstrating that insecure CI/CD pipeline design is a systemic, not isolated, problem. The attack vector is particularly dangerous because CI/CD environments often hold highly privileged secrets such as API keys, deployment credentials, and cloud access tokens. Compromising these secrets can cascade into full supply chain attacks, potentially affecting downstream users of the targeted software.

Tactical Insight

Immediate actions

  • Audit all GitHub Actions workflow files to identify any steps that interpolate user-controlled input (e.g., `${{ github.event.issue.title }}`) directly into `run:` shell commands and replace them with safe environment variable assignments.
  • Rotate all CI/CD secrets stored in GitHub repository or organization secrets that may have been exposed to vulnerable workflows.

Long-term improvements

  • Enforce a policy of using intermediate environment variables (e.g., `env:` blocks) to pass user-controlled data into shell steps, never direct expression interpolation.
  • Restrict GitHub Actions workflow trigger permissions by applying the `permissions:` key with least-privilege scopes, and require pull request approvals before workflows execute on external contributor code.
  • Implement secret scanning tools (e.g., GitHub Advanced Security, truffleHog) as mandatory pipeline gates to detect accidental or injected secret exposure.

Detection measures

  • Enable GitHub audit logs and ship them to a SIEM to alert on unexpected workflow runs, secret access events, or unusual pull request activity from external contributors.
  • Implement runtime monitoring of CI/CD jobs to detect anomalous outbound network connections that may indicate secret exfiltration.

Back this up with a control

All controls and vendors

Training helps people spot this. These controls make the attack fail even on the day someone does not.