Hunt: CI/CD Pipeline Attacks
Current emphasis (update on wiki harvest): pwn requests (pull_request_target / workflow_run) and OIDC trust-policy wildcard abuse over plain script- injection greps - models over-index on over-represented old methods; the newest harvested technique leads the checklist until superseded.
Assumes hunt-core for the scope gate, two-account rule, confirmation gate, enumeration limits, stop conditions, wiki protocol, FIND output, and Deadends. Do not re-derive any of that here.
Paths (binding - define once at the top of the run notes)
# seat side (wsl) - engagement tree is DOUBLE-NESTED in VMshare:
ENG_DIR=/mnt/c/Users/Lenovo/Desktop/VMshare/<eng>/<eng>
RUN=$ENG_DIR/hunt/cicd/<org-repo>
# VM side (WHERE gato/octoscan run, same tree through the share):
ENG_DIR=/mnt/VMshare/<eng>/<eng>
RUN=$ENG_DIR/hunt/cicd/<org-repo>
Corpus and probes live in the VMshare tree; the VM runs tools against the /mnt/VMshare spelling as user tz; the seat reads the same bytes at the /mnt/c/Users/Lenovo/Desktop/VMshare spelling. The repo tree targets/ is admin/ingest only - workflow dumps and probe artifacts NEVER land there.
Transport
Every VM-native command block ships through ONE documented transport:
cd /mnt/c/Users/Lenovo/Documents/ObisidianVaults/ZTorch/ZTorch && bash scripts/vm-ssh.sh '<command>'
- vm-ssh lands as user tz (NOT root): no root-only paths, no sudo.
- vm-ssh.sh takes the command as ONE argument; quotes ship as base64
(
echo <b64> | base64 -d | bashinside the vm-ssh argument). - Non-login shells do NOT source profile.d: target-facing fetches MUST use /opt/scope-shim/bin/{curl,httpx} by absolute path.
- Shim verdict semantics (verified live): out-of-scope dies rc 126 (never work around); in-scope passes; UNKNOWN gets an ADVISORY - not approval; verify against scope.md and self-deny.
- Workflow enumeration output is large: run detached (vm-bg.sh) and read logs back; the bridge drops at ~2min.
Entry gate
All four must pass; each is falsifiable:
Active engagement exists (repo tree targets//active.md) and the org/repo is on targets//scope.md in-scope. Scope-guard is the deny. (targets/ is the repo admin tree; $ENG_DIR holds corpus and run artifacts only - see Paths.)
hunt-core loaded (skills/exploit/hunt/hunt-core/SKILL.md).
Producer verified - at least ONE of: (a) $ENG_DIR/state.md asset table has a repo/pipeline row;
(b) hunt-secrets found committed keys or workflow leaks in the org;
(c) kickoff seeded $RUN/raw/workflow-inventory.md. None = dispatch the surface lane first.Toolchain preflight (fails LOUD; scanners optional with echoes):
for t in /usr/bin/jq /usr/bin/python3 /opt/scope-shim/bin/curl; do [ -x "$t" ] || { echo "MISSING TOOL: $t"; exit 1; } done # install-on-demand (operator rule); gato is DEPRECATED upstream - # superseded by Trajan; gato-x is the maintained scanner command -v gato-x >/dev/null || pip3 install --user --break-system-packages -q gato-x || echo "N/A: gato-x absent on VM (install failed)" command -v octoscan >/dev/null || { export HOME=/home/tz; go install -v github.com/kchorp/octoscan/cmd/octoscan@latest; } || echo "N/A: octoscan absent on VM (install failed)" command -v poutine >/dev/null || { export HOME=/home/tz; go install -v github.com/boostsecurityio/poutine@latest; } || echo "N/A: poutine absent on VM (install failed)"
Checklist (mandatory)
Copy checklist.md (this skill's dir) to
$ENG_DIR/hunt/cicd/<org-repo>/cicd-checklist.md at run start.
Unchecked at stop = UNCHECKED lane, re-run from the first unchecked
step. The SKILL.md text and the checklist header agree byte-for-byte
on that copy target.
Nudge
Review-skill re-injection text (pinned; NOTE: completion-gate emits its own generic nudge - both mean: resume at the first unchecked box):
Your work was just reviewed by the review skill and it was found
that you either missed a step of analysis, or didn't generate an
artifact of sufficient proof. Look at the markdown based checklist
and the output for each step, find what you missed, and complete
that step.
Wiki
Hub: [[cloud-moc]] - Primary page: [[cicd-github-actions]] - Payload arsenal: wiki/payloads/cicd.md
Anchors: [[supply-chain-attacks]], [[cloud-oidc-trust-abuse]], [[cicd-attacks]]
REFS: [[cicd-github-actions]], wiki/payloads/cicd.md
mcp__wiki-search__query (lex) "CI/CD GitHub Actions pull_request_target pwn request script injection self-hosted runner OIDC cache poisoning" via wiki-search MCP - ONLY when you have a concrete hint the map above doesn't cover (a specific sink/version/CVE, an observed escape); not a blanket first step.
Shared bypass arsenal (blocked implies research, but walk this first): skills/exploit/hunt/hunt-cicd/references/bypass-arsenal.md - event-context script injection (PR title/branch/body in run:), pull_request_target pwn request, artifact poisoning, tag-mutation (tj-actions CVE-2025-30066), redaction bypass.
Attack surface (ranked)
APPROACH: Rank pwn requests (pull_request_target/workflow_run checking out fork HEAD with secrets) first, then untrusted ${{ github.event.* }} script injection, self-hosted runner takeover, and OIDC-to-cloud token theft; read every workflow + called composite action end-to-end, inject a unique canary.
AVOID: A workflow that merely LOOKS injectable, a pull_request_target trigger in isolation, id-token: write without an assumed role, or "the PR ran" with no canary output is NOT confirmation - your code must execute in the trusted context (canary in the job log) or a secret/role must actually be exfiltrated/assumed.
- Pwn requests (
pull_request_target/workflow_run) - the highest-value bug. A workflow that runs onpull_request_target, checks out the fork HEAD, and holds secrets executes attacker code in the trusted (secret-bearing) context. Fork, inject a build step, open a PR, exfilenv/ secrets /GITHUB_TOKEN. - Script injection via untrusted
${{ }}-github.event.*values (PR title, branch name, issue body, review comment) interpolated directly into arun:step. Attacker controls the string, so the string becomes shell. - Self-hosted runner takeover - non-ephemeral runners persist state between jobs and are shared across a repo/org pool. A pwn request or script injection landing on one is persistence and cross-repo reach, not a one-shot.
- OIDC-to-cloud token theft -
permissions: id-token: writemints a cloud-assumable JWT. Weak trust-policysubscoping (wildcard repo/ref) lets a fork job assume the role off-box. Chains tohunt-cloud.
Signals to grep the repo for: .github/workflows with pull_request_target/workflow_run; untrusted ${{ github.event.* }} inside run:; self-hosted runner labels; id-token: write; actions/cache restored across trust boundaries.
Methodology
- Enumerate workflows + triggers - gato / Gato-X, octoscan, poutine. Read every workflow end-to-end (each
run:, each referenced action, each reusable-workflowuses:), not a keyword grep - the injectable sink hides in a called composite action. - Pwn request - a
pull_request_target(orworkflow_run) workflow that checks out the fork HEAD and holds secrets: fork, inject a build step, open a PR, exfilenv/ secrets /GITHUB_TOKENto your sink. - Script injection - inject
a"; <cmd>; #(or$(<cmd>)/ backticks per shell) into agithub.event.*value that lands in arun:step. Use a unique canary in the command output, per hunt-core marker discipline, so you can prove YOUR injection ran. - Self-hosted runner - non-ephemeral = persistence between jobs + cross-repo on a shared pool. Once you have execution, confirm the runner type (ephemeral vs long-lived) before claiming persistence.
- Cache poisoning - a fork job writes an
actions/cacheentry that a trusted base job later restores, moving attacker-controlled content across the trust boundary. - OIDC theft - pull
ACTIONS_ID_TOKEN_REQUEST_TOKEN/ACTIONS_ID_TOKEN_REQUEST_URL, request the JWT, assume the cloud role off-box; inspect trust-policysubscoping for over-broad repo/ref wildcards. Hand off tohunt-cloud. - PPE (poisoned pipeline execution) - modify a
Makefile/package.json/ build script the pipeline runs, bypassing CODEOWNERS that only guards the workflow files themselves. - Confirm - see the confirmation gate below.
- Distill (when confirmed) - reusable pwn-request / OIDC-theft / PPE technique, GENERIC, no client repo:
python3 scripts/wiki-stage.py --kind technique --slug <slug> --target-page techniques/cloud/cicd-github-actions.md.
Confirmation gate
NOT confirmation: a workflow that merely looks injectable; a pull_request_target trigger present in isolation; untrusted ${{ }} sitting in a run: step you have not shown executing; id-token: write declared without an assumed role; "the PR ran" with no output proving your code ran; a secret name visible in the workflow YAML.
IS confirmation: your injected code/command actually executed in the pipeline's trusted context (canary command output in the job log), OR a secret / GITHUB_TOKEN / OIDC token actually exfiltrated to your sink, OR a cloud role actually assumed off-box (STS identity returned) - reproduced from your written steps.
Stop condition
A pipeline compromise is high-impact and persistent (secret-bearing context, shared runners, cloud roles). Per hunt-core stop conditions, once the primitive is proven, stop. Prove execution with a benign canary echo or an OOB callback; prove exfil against your own sink. Do NOT tamper with production artifacts, publish a release, push to a protected branch, or leave content that outlives the run. The demonstrated primitive is the finding; escalation past it adds risk, not payout.
Chaining
OIDC token theft or secret exfil hands off to hunt-cloud (assume the role, enumerate the account) - the CI/CD bug is the delivery, the cloud access is the impact. A leaked GITHUB_TOKEN with contents:write/packages:write chains to supply-chain reach ([[supply-chain-attacks]]).
Evasion
CODEOWNERS and required reviews typically guard .github/workflows/** only; PPE (step 7) reaches execution through a build script they do not cover. Branch-name and PR-title injection sidesteps content review entirely (the trigger fires before merge). Prefer workflow_run and cache paths when pull_request_target is locked down.
Validation
- Proof = a pipeline RUN executing attacker-controlled steps: the build log shows the command and its output, or a secret lands in run output. A workflow FILE you can read is not execution.
- Negative control: PR from an untrusted fork without approval runs nothing (the approval gate holding).
False Positives
- Workflow readable but triggers restricted (workflow_dispatch by admin only).
- GITHUB_TOKEN scoped read-only: injection lands, exfil path dead.
- 'pwn request' path guarded by maintainer approval environments.
- Registry public pull: an image anyone may fetch is not a leak.
Cross-routing
- Load hunt-secrets when runner env/history leaks credentials.
- Load hunt-cloud when the runner identity is cloud IAM (keys to the kingdom).
- Load hunt-rce for the executed-step-to-shell continuation.
- Not this skill: vulns in the repo's own application code (route by class).
N/A escapes
- "N/A: octoscan absent on VM (install failed)"
- "N/A: poutine absent on VM (install failed)"
- "N/A: no workflows in repo" An N/A tick is a claim with a reason, never a silent pass. Identical strings in SKILL.md and checklist.md.
Bitter-pill variant
Freehand run: skip checklist + numbered steps, one freehand pass over the workflow inventory, output ONLY $RUN/analysis/bitter-pill.md (tried/found/dismissed, every claim carries evidence). The executed-in-trusted-context gate survives freehand. Declare with a _requests.md row (lane = hunt-cicd-bitterpill).
Depth walk (mandatory)
Walk EVERY applicable row of the payload arsenal page cited above.
Record each row in $RUN/coverage-depth.md as a table
| row | state | evidence | where state is probed, blocked, or
N/A, and evidence is a probe-pair path or a Deadends.md line. A bare
probed with no evidence reference fails the completion gate
(NEEDS-REVIEW). N/A rows cite why (surface shape forbids it).
Blocked implies research: before any Deadend is claimable on a blocked
row, (a) walk the arsenal page's bypass-ladder rows for that control
class, and (b) run one wiki query AND one mcp__wigolo__search for the
specific tech-plus-control bypass. Results, or a genuine null, land in
coverage-depth.md. "No research tried" is not a claimable state.
Exit artifact + handoff
ONE exit artifact set: $RUN/candidates.jsonl + candidates.md +
$ENG_DIR/hunt-cicd-.md (pointer with CICD-HUNT-DONE +
counts). Consumer (triage) finds at $RUN: raw/workflow-inventory.md,
probes/*.jsonl, probes/raw/, candidates.{jsonl,md}. Findings leave
ONLY through G1. Distill: python3 scripts/wiki-stage.py --kind technique --slug <slug> --target-page techniques/cloud/cicd-attacks.md.
Severity
CRITICAL if OIDC-to-cloud role assumption or GITHUB_TOKEN/secret exfil; HIGH if pwn-request / script-injection RCE on a runner; MEDIUM if cache poisoning with limited reach.