cicd
它能做什么
这份目录指向关于攻击构建和部署流水线的指南。适合审查流水线如何处理外部代码和机密的安全团队。
适用场景
- ✓当公司的构建流水线运行来自外部贡献者的代码,并需要审查时。
- ✓当你想检查自托管构建机器是否暴露时。
- ✓当你需要找出哪种流水线弱点适用于某个特定的 CI 提供商时。
技能链接
https://github.com/BitterSecurity/Decepticon/blob/main/packages/decepticon/decepticon/skills/standard/exploit/cicd/SKILL.md复制后粘贴给你的 AI(Claude、ChatGPT 或 Cursor),让它按照说明操作。
使用方法
最简单的方法:复制下面的消息,粘贴给你的 AI。它会读取这个技能并按说明操作。
可直接粘贴的消息
适用于 Claude Code、Codex 或 Cursor:在项目文件夹中运行,即可安装该技能。
下载 SKILL.md,放进智能体的技能文件夹。
可以这样问 AI
“我们的 CI 流水线会构建外部贡献者提交的拉取请求。请帮我检查这样做是否安全?”
每周 5 个新技能,1 分钟读完。
工作原理
智能体识别 CI 提供商和工作流设置,然后加载适用于该类流水线弱点的对应指南。
技术内容(原始 SKILL.md)
作者在 GitHub 上的英文原文。
CI/CD Pipeline Exploitation — Category Overview
Routing skill for attacks against build / deployment pipelines. Pipelines run attacker-influenced code (PRs, dependencies, build scripts) with privileged tokens, cloud OIDC, and write access to artifacts that downstream consumers trust. Compromise of a single pipeline often equals compromise of every release built by it.
Sub-Skills
| Sub-Skill | Covers | When to Load |
|---|---|---|
| poisoned-pipeline-execution | Direct + Indirect PPE: injecting commands via attacker-controllable build files (Makefile, package.json scripts, build.gradle, Dangerfile, .pre-commit-config.yaml), pull_request_target abuse, fork-PR build triggers, dependency/test-script execution. |
Target builds untrusted PR code; you can land a malicious file or dependency. |
| github-actions-injection | ${{ }} template injection via untrusted context (issue/PR title, body, branch name, commit message) into run: steps, pull_request_target + PR-head checkout, GITHUB_TOKEN permission abuse, artifact/cache poisoning, action pinning (tag vs SHA). |
Target uses GitHub Actions and accepts external contributors. |
| self-hosted-runner-abuse | Non-ephemeral runner persistence, fork-PR job execution on self-hosted, runner-label targeting, secret theft from runner env, lateral movement into internal network / cloud metadata. | Target advertises self-hosted runners (workflow runs-on: label or public job logs). |
| cicd-secrets-exfil | Extracting CI secrets / OIDC tokens: echo / printenv exfil, masking bypass (base64, char-split), OIDC -> cloud role assumption, GITHUB_TOKEN / CI_JOB_TOKEN scope abuse, cache / artifact secret leakage. |
You already have code execution in a CI job; need to convert it into durable cloud / registry access. |
Provider fingerprinting
# GitHub Actions
ls -la <REPO>/.github/workflows/ 2>/dev/null
gh api "repos/<OWNER>/<REPO>/actions/workflows" --jq '.workflows[] | {name,path,state}'
# GitLab CI
test -f <REPO>/.gitlab-ci.yml && echo "GitLab CI"
ls <REPO>/.gitlab/ci/ 2>/dev/null
# Jenkins
test -f <REPO>/Jenkinsfile && echo "Jenkins"; find <REPO> -name 'Jenkinsfile*' -type f
# CircleCI / Buildkite / Drone / Azure / Travis
for f in .circleci/config.yml .buildkite/pipeline.yml .drone.yml azure-pipelines.yml .travis.yml; do
test -f "<REPO>/$f" && echo "$f"
done
# Provider hints in README / badges
grep -RhoE 'github\.com/[^/]+/[^/]+/actions|gitlab\.com/[^/]+/[^/]+/-/pipelines|circleci\.com/gh/|app\.travis-ci\.com' <REPO> 2>/dev/null | sort -u
Workflow file recon (GitHub Actions example)
# Local checkout
find <REPO>/.github/workflows -type f \( -name '*.yml' -o -name '*.yaml' \) -print
# Remote, no clone needed
gh api "repos/<OWNER>/<REPO>/contents/.github/workflows" --jq '.[].name'
# Pull every workflow at HEAD
for wf in $(gh api "repos/<OWNER>/<REPO>/contents/.github/workflows" --jq '.[].path'); do
echo "=== $wf ==="
gh api "repos/<OWNER>/<REPO>/contents/$wf" --jq '.content' | base64 -d
done
Risky-surface triage
| Signal | Why it matters | Grep |
|---|---|---|
pull_request_target: trigger |
Runs with write GITHUB_TOKEN + secrets while checking out attacker code |
grep -rE '^\s*pull_request_target\s*:' .github/workflows/ |
actions/checkout with ref: ${{ github.event.pull_request.head.sha }} under pull_request_target |
Pulls attacker code with privileged context | grep -rE 'pull_request\.head' .github/workflows/ |
${{ github.event.* }} interpolated into a run: block |
Expression injection sink (issue/PR body, title, branch name, commit msg) | grep -rE '\$\{\{\s*github\.event\.(issue|pull_request|comment|head_commit)' .github/workflows/ |
runs-on: [self-hosted, ...] on public repo |
Self-hosted runner reachable from fork PRs | grep -rE 'runs-on:\s*(\[\s*self-hosted|self-hosted)' .github/workflows/ |
Third-party action pinned by tag (@v3) instead of SHA |
Action repo / tag retargeting → silent supply-chain | grep -rE 'uses:\s*[^/]+/[^@]+@v?[0-9]' .github/workflows/ |
permissions: block missing or write-all |
Token over-scoped; abuse |
常见问题
为什么流水线是有价值的目标?
目录指出,它们持有特权令牌,并产生被下游用户信任的产物。
涵盖哪些流水线弱点?
不可信的构建文件、工作流表达式注入、自托管运行器滥用以及机密暴露。
它涵盖 GitHub Actions 吗?
是的。它包含一份关于 GitHub Actions 表达式注入的指南。
详情
作者的原始描述
CI/CD pipeline attack category — poisoned pipeline execution, GitHub Actions expression injection, self-hosted runner abuse, secrets/OIDC exfil. Routing skill: fingerprint the CI provider + workflow surface, then load the matching leaf.
热度
- GitHub 星标
- 6.5k
- 排名
- #14028
- 许可证
- Apache-2.0
- 更新时间
- 2026/11/1
评论
- …