AAK-GHA-SECRET-DUMP-001
Workflow step prints secrets through an encoder
| Field | Value |
|---|---|
| Severity | HIGH; CRITICAL when the workflow carries a published Gheist marker |
| Category | SECRET_EXPOSURE |
| Shipped | v0.6.28 |
| Scanner | agent_audit_kit/scanners/gha_hardening.py |
| OWASP MCP | MCP01:2025 (Token Mismanagement & Secret Exposure) |
| OWASP Agentic | ASI03 (Identity and Privilege Abuse), ASI04 (Agentic Supply Chain Vulnerabilities) |
| Incident | Gheist (Wiz, 2026-10-25) |
What it catches
GitHub masks a secret in a job log only where its exact value appears. Pass it through an encoder first and the log prints it in full:
- run: |
env | base32 -w 120
echo -n '${{ toJSON(secrets) }}' | base32 -w 120
That is the step the Gheist campaign planted with stolen tokens: a branch named
ci-sync- plus six characters, adding .github/workflows/sync-check.yml with the
commit message ci: sync config. The push ran the workflow, the tool downloaded
the log through the API, and deleted the run seconds later.
The rule reports a run: command that expands the secrets context
(toJSON(secrets), secrets.X, or an env var set from a secret) or the whole
environment (env, printenv, set, export -p, declare -p) and feeds it to
an encoder or transformer (base32, base64, xxd, od, rev, gzip, openssl enc and
the like) whose output reaches the log. It is raised to CRITICAL when the
workflow carries one of Wiz's published markers: the file sync-check.yml with
the step toJSON(secrets) }}' | base32 -w 120, or the string ===== gdmp-pivot:.
What it leaves alone
- A secret given to a tool as an env var or on stdin.
- A secret decoded into a file (
echo "${{ secrets.CERT }}" | base64 -d > cert.p12) or piped into a program that consumes it (docker login --password-stdin,gpg --import). - An encoder that reads no secret (
base64 -d assets/logo.b64 > logo.png).
Hunt
The rule reads the workflows in your checkout. A planted workflow lives on its own branch, and its run is usually deleted, so look on GitHub as well:
- Branches. List remote branches named like the campaign's:
git ls-remote --heads origin 'refs/heads/ci-sync-*'. Wiz's pattern is^ci-sync-[0-9a-z]{6}$; the only change on one is a new.github/workflows/sync-check.yml, committed asci: sync config. - Deleted runs. In the organization or enterprise audit log, look for
workflows.delete_workflow_runonci-sync-*branches soon after aworkflows.completed_workflow_run, and for requests with the user agentgheist.workflows.prepared_workflow_joblists the secrets each job was given, which tells you what to rotate. - Cloud credentials. If your workflows authenticate to a cloud with OIDC,
look for role assumptions or token exchanges whose subject names a
ci-sync-branch. - Self-hosted runners. Look for the files
.gdmp_pat,.gdmp_patgand.gdmp_sweep, and forgdmp-pivotin job logs.
How to fix
Remove the step. If you did not write it, rotate every repository, organization and environment secret the workflow could read, revoke the token that pushed the commit, and check its owner's machine. Require reviewers on environments that hold production secrets.
Registry reference
This section is generated from the rule registry (agent_audit_kit/rules/builtin.py) when the documentation is built, so it follows the scanner. The rest of the page is hand-written; where the two disagree, the registry is what runs.
- Severity
- HIGH
- Category
- Secret Exposure (
secret-exposure) - Scanner
agent_audit_kit/scanners/gha_hardening.py- Auto-fixable
- No.
- SARIF name
GhaSecretDumpThroughEncoder
What it detects
A run: step in a GitHub Actions workflow expands the secrets context (toJSON(secrets), secrets.X, or an env var set from a secret) or the whole environment (env, printenv, set) and passes it through an encoder or transformer (base32, base64, xxd, od, rev, gzip, openssl enc and the like) whose output reaches the job log. GitHub masks a secret in the log only where its exact value appears, so an encoded copy prints in full, and anyone who can read the log can decode it. The Gheist campaign (Wiz, 2026-10-25) pushed exactly this step, echo -n '${{ toJSON(secrets) }}' | base32 -w 120, on ci-sync-* branches of every repository stolen tokens could reach, then downloaded the log and deleted the run.
How to fix (registry)
Remove the step. If you did not write it, treat every repository, organization and environment secret the workflow could read as exposed: rotate them, revoke the token that pushed the commit, and look for ci-sync-* branches and for workflow runs deleted soon after they finished (workflows.delete_workflow_run in the audit log). To give a tool a secret, pass it as an env var or on stdin; never print it, encoded or not.
To confirm the finding is gone, report only this rule:
agent-audit-kit scan . --rules AAK-GHA-SECRET-DUMP-001
Limitations
Reads the run: steps of the workflow files directly inside .github/workflows; a composite action, a reusable workflow kept elsewhere and the code of an action are not read. A command line is joined across backslash continuations, split at ;, && and ||, and its pipeline at |; secret material reaches an encoder through a pipe, a here-string, a heredoc or a process substitution. Secret material is a secrets expression (toJSON(secrets), secrets.X, secrets['X']), an env var that a workflow, job or step env: sets from one, or a whole-environment dump (env without a command, printenv, set without arguments, export -p, declare -p or -x). A step is reported only when the encoded output reaches the log: the pipeline ends in a program that prints (an encoder, cat, tee, tr, sed, jq and the like) and redirects it nowhere but stdout, stderr or $GITHUB_STEP_SUMMARY. A secret written to a file, to $GITHUB_OUTPUT or $GITHUB_ENV, or piped into a program that consumes it (docker login --password-stdin, gpg --import) is not reported, and neither is a dump made by a script the step calls or through a variable the step builds. CRITICAL when the workflow carries a published Gheist marker: the file sync-check.yml with the step toJSON(secrets) }}' | base32 -w 120, or the string ===== gdmp-pivot:. A workflow file over 1 MB is not read.
References
- OWASP MCP Top 10: MCP01:2025 (Token Mismanagement & Secret Exposure)
- OWASP Agentic Top 10: ASI03 (Identity and Privilege Abuse), ASI04 (Agentic Supply Chain Vulnerabilities)
- Adversa AI MCP Top 25 (AAK-defined ids): ADV-TOKEN-06 (Generic Secret Exposure)
- Incidents and advisories: WIZ-GHEIST-2026-10-25
- CSA AI Controls Matrix (AICM): DSP-17, STA-08