CWE-78 · CWE-74 · GHA013 · GHA014 · GHA015

Fix GitHub Actions Script Injection (${{ github.event.* }} RCE)

Stop remote code execution from untrusted PR titles, issue bodies, comments, and branch names (GHA013) and $GITHUB_ENV poisoning (GHA014) by moving expressions into safe env: variables. Audit private YAML locally—0 bytes uploaded.

Scan Workflow (0 Upload) Pro CLI + SARIF $49 →

0 bytes uploaded · 0 GitHub OAuth · One-time local CLI & GitHub Code Scanning SARIF via Polar.sh.

CWE-78 Shell Injection (GHA013) CWE-74 $GITHUB_ENV Poisoning (GHA014) CWE-426 $GITHUB_PATH Hijack (GHA015) 0 Network Requests During Scan
Drop private .github/workflows/*.yml files here or paste YAML below to audit for untrusted expression interpolation locally.
Deterministic YAML AST · 0 bytes sent

Offline Hardened YAML Diff Preview


      

Vulnerable vs. Safe env: Pattern (Before & After)

GitHub expands ${{ ... }} expressions as raw text before launching the shell. Quoting "${{ github.event.pull_request.title }}" does not sanitize shell metacharacters like $(...), backticks, or double quotes. Always bind untrusted context fields into a step-level env: map and reference the quoted environment variable inside run:.

Vulnerable · GHA013 · GHA014 · CWE-78
name: PR Title Check
on:
  pull_request_target:
    types: [opened, edited]

permissions:
  pull-requests: write

jobs:
  check-title:
    runs-on: ubuntu-latest
    steps:
      - name: Validate PR title
        run: |
          echo "Checking PR: ${{ github.event.pull_request.title }}"
          echo "HEAD_REF=${{ github.head_ref }}" >> "$GITHUB_ENV"
Hardened · 100/100 (Grade A · 0 Findings)
name: PR Title Check
on:
  pull_request:
    types: [opened, edited]

permissions:
  contents: read

concurrency:
  group: ${{ github.workflow }}-${{ github.ref }}
  cancel-in-progress: true

jobs:
  check-title:
    runs-on: ubuntu-latest
    timeout-minutes: 10
    permissions:
      contents: read
    steps:
      - name: Validate PR title safely via env
        env:
          PR_TITLE: ${{ github.event.pull_request.title }}
        run: |
          printf "Checking PR: %s\n" "$PR_TITLE"

High-Risk Untrusted Contexts & Remediation Matrix

Rule Attacker-Controlled Context / Sink Exploit Impact Safe Pattern
GHA013 github.event.pull_request.title, .body, issue.title, comment.body, github.head_ref Direct command execution (RCE) on runner, secret exfiltration, write-token abuse Bind in step env: and reference quoted "$VAR" (never inline ${{ ... }} in run:).
GHA014 Unvalidated writes to $GITHUB_ENV Newline injection sets NODE_OPTIONS, LD_PRELOAD, or BASH_ENV for later steps Pass values via heredoc with random delimiter or avoid writing untrusted fields to $GITHUB_ENV.
GHA015 Unvalidated writes to $GITHUB_PATH Prepends attacker directory so subsequent git/node calls run trojan binaries Only append static, trusted absolute paths to $GITHUB_PATH.
GHA011 pull_request_target + PR head checkout Executes fork code with base repo secrets and write GITHUB_TOKEN Switch to pull_request or split untrusted build and privileged comment jobs.

Block Script Injection Automatically in Every Pull Request

Run runnerproof-cli in CI with SARIF 2.1.0 output to annotate unsafe ${{ github.event.* }} interpolations directly on GitHub PR diffs—zero subscriptions, zero GitHub App OAuth:

Buy RunnerProof Solo CLI ($49 One-Time) Buy RunnerProof Team & CRA/SOC 2 Pack ($99 One-Time)

Frequently Asked Questions

Why are ${{ github.event.* }} expressions vulnerable even inside double quotes?

GitHub Actions substitutes expressions as raw text before the shell parses the command. Any double quote, backtick, or $(command) inside a PR title breaks out and runs arbitrary code.

How does passing ${{ github.event.* }} via env: stop script injection?

The value is stored in a process environment variable rather than concatenated into the script text. Reading "$PR_TITLE" keeps shell metacharacters inert.

Why is writing untrusted input to $GITHUB_ENV dangerous?

An attacker can embed newline characters to declare extra variables like NODE_OPTIONS or BASH_ENV that execute code in downstream steps.

Related GitHub Actions Remediation Guides

CVE-2025-30066 & reviewdog Fix

Detect compromised tj-actions/changed-files and reviewdog/action-setup SHAs and auto-pin workflows.

Read CVE-2025-30066 Guide

permissions: write-all Fix

Lock down GITHUB_TOKEN scope and add persist-credentials: false on every checkout step.

Read Permissions Fix Guide

pull_request_target RCE Checker

Pre-loaded browser auditor for Pwn Request checkouts (GHA011) and workflow_run artifact RCE (GHA012).

Open PR Target RCE Checker

Oriancy Local Security Quartet

4 Zero-Upload Scanners · 1 One-Time Bundle
DevSecOps Quartet Bundle — All 4 local CLIs & auditor packs on one-time Polar licenses · oriancy.com