# CI/CD Pipeline Attacks
> Attacks that turn the build-and-release path (SCM, CI servers, runners, scanners, artifact registries, developer workstations) into the execution point, harvesting the credentials it holds and shipping tampered artifacts downstream with legitimate authority.
## How it works
The pipeline is a high-frequency, highly privileged code-execution primitive: anything that runs inside a job inherits the job's role, environment variables, mounted credential files and deploy rights. OWASP's Top 10 CI/CD Security Risks frames the attack surface:
| ID | Risk | Attacker angle |
|---|---|---|
| CICD-SEC-1 | Insufficient flow control | push/merge to protected branch or release without review |
| CICD-SEC-2 | Inadequate IAM | stale/overprivileged human and machine identities |
| CICD-SEC-3 | Dependency chain abuse | [[Dependency Confusion]], [[Typosquatting]], [[Malicious Packages]] executing on runners |
| CICD-SEC-4 | Poisoned Pipeline Execution (PPE) | modify pipeline config, scripts, tests or any file the build executes, gaining the job's permissions |
| CICD-SEC-5 | Insufficient PBAC | one pipeline/stage can reach other pipelines' secrets and environments |
| CICD-SEC-6 | Insufficient credential hygiene | secrets in code, logs, image layers, env vars; long-lived tokens |
| CICD-SEC-7 | Insecure system configuration | unpatched/EOL CI servers, exposed services, Docker socket mounts |
| CICD-SEC-8 | Ungoverned 3rd-party services | actions, plugins, apps with inherited org access |
| CICD-SEC-9 | Improper artifact integrity validation | unverified scripts/images pulled and run |
| CICD-SEC-10 | Insufficient logging | no audit across SCM, CI, registry |
GitGuardian's point is that CICD-SEC-6 is the multiplier: a poisoned dependency or PPE is only as bad as the credentials the job can reach. Since 2025 worms ([[Shai-Hulud Worm]], Miasma, ChainDrop) target runners directly; GitGuardian reports 59% of machines compromised in one early wave were CI/CD runners. Mercari's Common Threat Matrix for CI/CD (ATT&CK-style) enumerates the post-foothold techniques: read credential files mounted in the job, access the secret manager from a pipeline triggered by a *different* repository, implant CI runner images for persistence, deploy modified container/function/VM images to production with stolen deploy credentials.
GitHub-specific vectors (workflow triggers, mutable action tags, `GITHUB_TOKEN` scope) are on [[GitHub Actions Security]], [[Pwn Requests]] and [[tj-actions changed-files Compromise]].
## Techniques / payloads
### Poisoned pipeline execution
- **Direct PPE**: commit to `.gitlab-ci.yml`, `Jenkinsfile`, Makefile, test scripts or package `scripts` that the pipeline runs.
- **GitLab incoming-email token → push to main**: the "Email a new issue to this project" address embeds a `glimt-` token that is account-wide, never expires, and is identical across every project the user can access. GitLab does not verify the sender. Swap `-issue@` for `-merge-request@` and attach a `.patch`; GitLab applies it to the source branch, and if the patch touches `.gitlab-ci.yml` and the owner's role allows, the pipeline runs attacker code with access to CI secrets.
```
incoming+project-id-glimt-XXXXXXXXXXXXXX-issue@incoming.gitlab.com # leaks token
incoming+project-id-glimt-XXXXXXXXXXXXXX-merge-request@incoming.gitlab.com # + .patch attachment
```
Hunt: grep repos/docs/help centers for `@incoming.gitlab.com` with a token before `-issue`; remediation is resetting the Incoming email token under Personal access tokens.
### Compromising the CI server
- **Jenkins** (Wiz): present in over a third of cloud environments; 59% of those have instances with critical core vulns, >87% run EOL instances, 48% run on compute with highly privileged service accounts. Most compromises abuse misconfiguration not 0-days: exposed **script console** / build functionality for direct command execution (cryptojacking campaigns), secrets in plaintext or env vars, Docker socket mounted into builds, shared host namespaces. Agent compromise yields tokens/SSH keys and a pivot to the controller; controllers on cloud VMs are queried for [[Cloud Metadata Service Exploitation|IMDS]] credentials to reach the cloud control plane.
- **Artifact registry**: CVE-2026-82329 in JFrog Artifactory/JFrog Access lets an unauthenticated network attacker mint **admin tokens** via a "phantom" join key; exploited in the wild (fixed 7.161.20; affected branches include 7.161.0–7.161.19, 7.146.0–7.146.36). Admin on the registry = tamper with every downstream build.
- **Build engine escapes** ("Leaky Vessels"): runC CVE-2024-21626 (leaked fd → host filesystem) and BuildKit CVE-2024-23651/23652/23653 (mount race, host file deletion, `security.insecure` entitlement abuse). A malicious Dockerfile or image in a shared build host escapes to the runner.
### Tampering with tools the pipeline trusts
- **Codecov Bash Uploader (2021)**: a cloud-storage credential exposed in a Docker image layer let attackers modify the uploader; one added Bash line shipped all CI environment variables to the attacker. Pipelines across thousands of orgs `curl | bash`'d it from January to April 2021. Detected only when a customer compared the script's SHA-256 against the published hash.
- **SolarWinds Orion (SUNBURST)**: attackers tested injection into the Orion build in October 2019, inserted SUNBURST about four months later, and shipped trojanized signed updates from March 26, 2020.
- **TeamPCP cascade (2026)**: Trivy compromise (CVE-2026-33634 / GHSA-69fq-xp46-6x23, exposure window March 19–23, 2026) via forced tag swaps; LiteLLM ran Trivy unpinned in CI, so the scanner stole LiteLLM's publishing credentials → litellm 1.82.7/1.82.8 on PyPI → telnyx 4.87.1/4.87.2. Same crew overwrote Docker Hub tags on `checkmarx/kics` (`v2.1.20`, `alpine`, new `v2.1.21`) with a KICS binary that encrypted and exfiltrated scan reports (IaC often holds secrets), trojanized Checkmarx VS Code/Open VSX extensions (`ast-results` 2.53, `cx-dev-assist`) that fetched `mcpAddon.js`, then published a malicious Checkmarx **Jenkins AST plugin** to the Jenkins Marketplace (last good 2.0.13-829.vc72453fa_1c16) using credentials from the earlier breach. Lesson: incomplete rotation after the first incident enabled the second.
- **Build-time execution in packages**: crates.io `arrayref` 0.3.10, `internment` 0.8.7, `append-only-vec` 0.1.9 (compromised maintainer) added the typosquat dependency `proc-macro1`, whose `build.rs` downloaded and ran a payload at compile time: no crate code had to be called. `proc-macro1` was live for 107 minutes. Sleeper Ruby gems (`knot-date-utils-rb`, `knot-simple-formatter`) and Go modules (`github.com/BufferZoneCorp/log-core`, `.../go-envconfig`) targeted CI to steal credentials, tamper with GitHub Actions and add SSH persistence.
### Developer workstation as pipeline entry point
Developer machines hold the same tokens as CI (`.env`, shell history, cloud profiles, CLI caches, MCP configs) and sit outside most EDR/proxy visibility.
- **Trojanized Nx Console** VS Code extension led to exfiltration of GitHub's internal repositories.
- **Cursor marketplace "Claude Code" extension**: a stolen Fireworks AI vendor key gave access to Cursor storage; attackers shipped a malicious extension build (~5,000 potential installs) that planted an SSH backdoor.
- **Leaked publisher tokens** (Wiz): >550 validated secrets leaked by VS Code/Open VSX publishers, including >100 tokens granting extension **update** rights, enough to push malware to hundreds of thousands of installs.
- **GlassWorm**: 73 further fake Open VSX extensions with benign initial code and bundled native binaries acting as loaders.
## Defenses
- Treat CI identity as production identity: short-lived OIDC-federated credentials, per-pipeline/per-stage scoping, CI (build) must not hold CD (deploy) credentials; don't put secrets in env vars where avoidable; rotate on any suspicion, including secrets reachable via CI OIDC trust.
- Pin everything the job executes by digest/SHA (actions, scanner images, uploader scripts) and verify hashes/signatures before running; see [[SBOM and Provenance]].
- Protect pipeline-definition files with CODEOWNERS/required review; require reviewers on publish environments; never expose signing certs to manually dispatched workflows.
- Patch and inventory CI servers and registries; never mount the Docker socket into builds; isolate runners (ephemeral, no shared namespaces).
- Treat IDE extensions as dependencies: allowlist/internal marketplace, disable auto-update; VS Code 1.123 adds a two-hour update delay (trusted publishers exempt). Apply cooldowns/minimum-age policies to packages too.
- Centralize audit logs across SCM, CI, registry; hunt for `.gitlab-ci.yml`/workflow changes and pipeline runs nobody remembers.
- Scan for credentials in repos, logs and image layers ([[Secret Scanning]]); the Codecov root cause was a credential in an image layer.
## Related
- [[Software Supply Chain Security]]
- [[GitHub Actions Security]] · [[Pwn Requests]] · [[tj-actions changed-files Compromise]]
- [[Malicious Packages]] · [[Shai-Hulud Worm]] · [[XZ Utils Backdoor]]
- [[SBOM and Provenance]]
- [[Secret Scanning]] · [[Leaked Cloud Credentials]] · [[Vaults and Secret Stores]]
- [[Cloud Metadata Service Exploitation]]
- [[AI Coding Assistant Risks]]
## Sources
- [[raw/blog.gitguardian.com/owasp-top-10-ci-cd-security-risks-explained-why-credential-hygiene-dec-11895|OWASP Top 10 CI/CD Security Risks Explained]]
- [[raw/github.com/common-threat-matrix-for-ci-cd-pipeline-6931|Common Threat Matrix for CI/CD Pipeline]]
- [[raw/wiz.io/the-jenkins-threat-landscape-8699|The Jenkins Threat Landscape]]
- [[raw/aikido.dev/send-gitlab-an-email-push-to-main-12084|Send GitLab an email, push to main]]
- [[raw/thehackernews.com/attackers-exploit-critical-jfrog-artifactory-flaw-to-mint-admin-tokens-11853|Attackers Exploit Critical JFrog Artifactory Flaw to Mint Admin Tokens]]
- [[raw/wiz.io/leaky-vessels-runc-and-buildkit-container-escape-vulnerabilities-every-9724|Leaky Vessels: runC and BuildKit container escape vulnerabilities]]
- [[raw/netlas.io/supply-chain-attack-how-attackers-weaponize-software-3757|Supply Chain Attack: How Attackers Weaponize Software]]
- [[raw/fortinet.com/solarwinds-supply-chain-attack-fortinet-4466|SolarWinds Supply Chain Attack (Fortinet)]]
- [[raw/intelligentliving.co/trivy-supply-chain-attack-trusted-scanner-compromised-rotate-ci-cd-sec-6791|Trivy Supply-Chain Attack: Trusted Scanner Compromised]]
- [[raw/reversinglabs.com/inside-the-teampcp-cascading-supply-chain-attack-6846|Inside the TeamPCP cascading supply chain attack]]
- [[raw/thehackernews.com/malicious-kics-docker-images-and-vs-code-extensions-hit-checkmarx-supp-6761|Malicious KICS Docker Images and VS Code Extensions Hit Checkmarx]]
- [[raw/thehackernews.com/teampcp-compromises-checkmarx-jenkins-ast-plugin-weeks-after-kics-supp-7857|TeamPCP Compromises Checkmarx Jenkins AST Plugin]]
- [[raw/thehackernews.com/rust-supply-chain-attack-puts-build-time-malware-in-crates-with-245-mi-11596|Rust Supply Chain Attack Puts Build-Time Malware in Crates]]
- [[raw/thehackernews.com/poisoned-ruby-gems-and-go-modules-exploit-ci-pipelines-for-credential-7742|Poisoned Ruby Gems and Go Modules Exploit CI Pipelines]]
- [[raw/cyberscoop.com/github-says-internal-repositories-were-taken-in-poisoned-vs-code-exten-8148|GitHub says internal repositories were taken in poisoned VS Code extension attack]]
- [[raw/thehackernews.com/cursor-says-stolen-fireworks-ai-key-led-to-trojanized-claude-code-exte-15244|Cursor Says Stolen Fireworks AI Key Led to Trojanized Claude Code Extension]]
- [[raw/wiz.io/dismantling-a-critical-supply-chain-risk-in-vscode-extension-marketpla-9170|Dismantling a Critical Supply Chain Risk in VSCode Extension Marketplaces]]
- [[raw/csoonline.com/more-fake-extensions-linked-to-glassworm-found-in-open-vsx-code-market-7380|More fake extensions linked to GlassWorm found in Open VSX]]
- [[raw/infoq.com/vs-code-1-123-adds-two-hour-extension-update-delay-to-limit-supply-cha-9565|VS Code 1.123 Adds Two-Hour Extension Update Delay]]