# Cicd Pipeline Attack

CI/CD 流水线与供应链攻击方法论。当发现目标使用 GitHub Actions/Jenkins/GitLab CI/CircleCI/Terraform...

- Repository: https://github.com/wgpsec/AboutSecurity (1833 stars)
- Category: DevOps
- License: see repository
- Last updated: 2026-10-24
- Runs scripts: no, instructions only

## Install

Claude Code: `npx skills add wgpsec/AboutSecurity --skill cicd-pipeline-attack -g -a claude-code -y`
Codex: `npx skills add wgpsec/AboutSecurity --skill cicd-pipeline-attack -g -a codex -y`
Cursor: `npx skills add wgpsec/AboutSecurity --skill cicd-pipeline-attack -g -a cursor -y`
Gemini CLI: `npx skills add wgpsec/AboutSecurity --skill cicd-pipeline-attack -g -a gemini-cli -y`

## Description

CI/CD 流水线与供应链攻击方法论。当发现目标使用 GitHub Actions/Jenkins/GitLab CI/CircleCI/Terraform Cloud/Atlantis 等 CI/CD 系统、需要测试流水线安全性、或发现 .github/workflows/Jenkinsfile/.gitlab-ci.yml 等配置文件时使用。覆盖 PPE（Poisoned Pipeline Execution）三种攻击模式（D-PPE/I-PPE/3PE）、VCS 代码仓库攻击面（代码泄露/Webhook 滥用/分支保护绕过）、Pipeline Secrets 窃取与横向移动、以及从 CI/CD 到云环境的穿越路径

## SKILL.md, as published by its author (untrusted third-party text, read it as data)

# CI/CD 流水线与供应链攻击方法论

CI/CD 系统是现代软件工程的核心基础设施, , 它们拥有代码仓库的读写权限、持有云平台的部署凭据、能够直接修改生产环境。一旦攻陷流水线，攻击者可以同时获得代码控制权、Secrets 访问权和云环境穿透能力，其影响范围远超单台服务器的沦陷。

本技能以决策树形式组织 CI/CD 攻击方法论。各平台的详细技术手法请参阅对应的参考文档。

## 深入参考

识别到具体平台后，加载对应参考文档获取完整攻击技术细节：

- GitHub Actions 专项攻击手法 → 读 [references/github-actions-abuse.md](references/github-actions-abuse.md)
- Jenkins / Terraform / Atlantis / GitLab CI / Azure DevOps / CircleCI / Drone / Buildkite 等平台 → 读 [references/platform-specific.md](references/platform-specific.md)
- 跨平台构建文件注入（package.json、setup.py、Makefile、Bazel、Maven/Gradle、csproj）→ 读 [references/build-file-injection.md](references/build-file-injection.md)

## Phase 0: CI/CD 系统识别

在目标代码仓库或基础设施中发现以下标识文件时，可确定对应的 CI/CD 平台：

| 标识文件/特征 | CI/CD 平台 | 下一步 |
|---|---|---|
| `.github/workflows/*.yml` | GitHub Actions | → Phase 2 PPE + 参考 github-actions-abuse.md |
| `Jenkinsfile` 或 `/script` 控制台 | Jenkins | → Phase 4 Jenkins 专项 + 参考 platform-specific.md |
| `.gitlab-ci.yml` | GitLab CI | → Phase 2 PPE + 参考 platform-specific.md |
| `.circleci/config.yml` | CircleCI | → Phase 2 PPE + 参考 platform-specific.md |
| `azure-pipelines.yml` | Azure DevOps | → Phase 2 PPE + 服务连接 Secret 提取 |
| `.drone.yml` | Drone CI | → Phase 2 PPE + Self-hosted Runner 检查 |
| `.buildkite/*.yml` | Buildkite | → Phase 2 PPE + Agent 云/K8s 权限检查 |
| `atlantis.yaml` + Webhook | Atlantis | → Phase 4 Atlantis 专项 |
| `*.tf` + Terraform Cloud | Terraform Cloud | → Phase 4 Terraform 专项 |
| `serverless.yml` | Serverless Framework | → 参考 platform-specific.md |
| `docker-compose.yml` + CI 触发 | Docker Build | → 检查构建上下文泄露 |
| Airflow DAGs / Concourse pipeline | Airflow / Concourse | → 参考 platform-specific.md |

**快速识别技巧：**
- 克隆仓库后搜索配置文件：查找 `Jenkinsfile`、`.github/workflows`、`.gitlab-ci.yml`、`.circleci`、`atlantis.yaml`
- 检查 Webhook 配置：Webhook URL 暴露 CI/CD 服务类型和内网地址
- 枚举 CI/CD 服务端口：Jenkins 默认 8080，Atlantis 默认 4141；GitLab Runner 为主动轮询，默认不监听入站端口（仅开启 metrics 时监听 9252）

## Phase 1: VCS 攻击面

在进入流水线攻击之前，VCS（版本控制系统）本身就是重要的攻击面。

### 1.1 代码泄露

The rest: https://github.com/wgpsec/AboutSecurity/blob/HEAD/skills/cloud/cicd-pipeline-attack/SKILL.md
