T1677 Poisoned Pipeline Execution
High-Level Description
Adversaries may manipulate continuous integration / continuous development (CI/CD) processes by injecting malicious code into the build process. There are several mechanisms for poisoning pipelines:
- In a Direct Pipeline Execution scenario, the threat actor directly modifies the CI configuration file (e.g.,
gitlab-ci.yml in GitLab). They may include a command to exfiltrate credentials leveraged in the build process to a remote server, or to export them as a workflow artifact.
- In an Indirect Pipeline Execution scenario, the threat actor injects malicious code into files referenced by the CI configuration file. These may include makefiles, scripts, unit tests, and linters.
- In a Public Pipeline Execution scenario, the threat actor does not have direct access to the repository but instead creates a malicious pull request from a fork that triggers a part of the CI/CD pipeline. For example, in GitHub Actions, the
pull_request_target trigger allows workflows running from forked repositories to access secrets. If this trigger is combined with an explicit pull request checkout and a location for a threat actor to insert malicious code (e.g., an npm build command), a threat actor may be able to leak pipeline credentials. Similarly, threat actors may craft pull requests with malicious inputs (such as branch names) if the build pipeline treats those inputs as trusted. Finally, if a pipeline leverages a self-hosted runner, a threat actor may be able to execute arbitrary code on a host inside the organization’s network.
By poisoning CI/CD pipelines, threat actors may be able to gain access to credentials, laterally move to additional hosts, or input malicious components to be shipped further down the pipeline (i.e., Supply Chain Compromise).
Kill Chain Phase
Platforms: SaaS
What to Check
How to Test
Manual Testing
Identify Attack Surface: Determine if the target environment is susceptible to Poisoned Pipeline Execution by examining the target platforms (SaaS).
Assess Existing Defenses: Review whether mitigations for T1677 are in place. If defenses are absent or misconfigured, this technique may be exploitable.
Execute Test: Use tools and methods described in the MITRE ATT&CK page and external references below.
Note: No Atomic Red Team tests available for this technique. See Atomic Red Team GitHub for updates.
Remediation Guide
M1018 User Account Management
Ensure that CI/CD pipelines only have permissions they require to complete their operations. Additionally, limit the number of users who have write access to internal repositories to only those necessary.
M1054 Software Configuration
Where possible, avoid allowing pipelines to run unreviewed code. Where this is necessary, ensure that these pipelines are executed on isolated nodes without access to secrets. In GitHub, avoid using the pull_request_target trigger if possible, do not treat user-controlled inputs (such as branch names) as trusted, and do not use self-hosted runners on public repositories.
Detection
Detection Strategy for Poisoned Pipeline Execution via SaaS CI/CD Workflows
Risk Assessment
| Finding |
Severity |
Impact |
| Poisoned Pipeline Execution technique applicable |
High |
Execution |
CWE Categories
| CWE ID |
Title |
| CWE-94 |
Improper Control of Generation of Code |
References
1---2name: t1677-poisoned-pipeline-execution3description: Adversaries may manipulate continuous integration / continuous development (CI/CD) processes by injecting malicious code into the build process.4---56# T1677 Poisoned Pipeline Execution78## High-Level Description910Adversaries may manipulate continuous integration / continuous development (CI/CD) processes by injecting malicious code into the build process. There are several mechanisms for poisoning pipelines:1112- In a <b>Direct Pipeline Execution</b> scenario, the threat actor directly modifies the CI configuration file (e.g., `gitlab-ci.yml` in GitLab). They may include a command to exfiltrate credentials leveraged in the build process to a remote server, or to export them as a workflow artifact.13- In an <b>Indirect Pipeline Execution</b> scenario, the threat actor injects malicious code into files referenced by the CI configuration file. These may include makefiles, scripts, unit tests, and linters.14- In a <b>Public Pipeline Execution</b> scenario, the threat actor does not have direct access to the repository but instead creates a malicious pull request from a fork that triggers a part of the CI/CD pipeline. For example, in GitHub Actions, the `pull_request_target` trigger allows workflows running from forked repositories to access secrets. If this trigger is combined with an explicit pull request checkout and a location for a threat actor to insert malicious code (e.g., an `npm build` command), a threat actor may be able to leak pipeline credentials. Similarly, threat actors may craft pull requests with malicious inputs (such as branch names) if the build pipeline treats those inputs as trusted. Finally, if a pipeline leverages a self-hosted runner, a threat actor may be able to execute arbitrary code on a host inside the organization’s network.1516By poisoning CI/CD pipelines, threat actors may be able to gain access to credentials, laterally move to additional hosts, or input malicious components to be shipped further down the pipeline (i.e., Supply Chain Compromise).1718## Kill Chain Phase1920- Execution (TA0002)2122**Platforms:** SaaS2324## What to Check2526- [ ] Identify if Poisoned Pipeline Execution technique is applicable to target environment27- [ ] Check SaaS systems for indicators of Poisoned Pipeline Execution28- [ ] Verify mitigations are bypassed or absent (2 known mitigations)29- [ ] Assess detection coverage (1 detection strategies)3031## How to Test3233### Manual Testing34351. **Identify Attack Surface**: Determine if the target environment is susceptible to Poisoned Pipeline Execution by examining the target platforms (SaaS).36372. **Assess Existing Defenses**: Review whether mitigations for T1677 are in place. If defenses are absent or misconfigured, this technique may be exploitable.38393. **Execute Test**: Use tools and methods described in the MITRE ATT&CK page and external references below.4041> **Note**: No Atomic Red Team tests available for this technique. See [Atomic Red Team GitHub](https://github.com/redcanaryco/atomic-red-team) for updates.4243## Remediation Guide4445### M1018 User Account Management4647Ensure that CI/CD pipelines only have permissions they require to complete their operations. Additionally, limit the number of users who have write access to internal repositories to only those necessary.4849### M1054 Software Configuration5051Where possible, avoid allowing pipelines to run unreviewed code. Where this is necessary, ensure that these pipelines are executed on isolated nodes without access to secrets. In GitHub, avoid using the `pull_request_target` trigger if possible, do not treat user-controlled inputs (such as branch names) as trusted, and do not use self-hosted runners on public repositories.5253## Detection5455### Detection Strategy for Poisoned Pipeline Execution via SaaS CI/CD Workflows5657## Risk Assessment5859| Finding | Severity | Impact |60| ------------------------------------------------ | -------- | --------- |61| Poisoned Pipeline Execution technique applicable | High | Execution |6263## CWE Categories6465| CWE ID | Title |66| ------ | -------------------------------------- |67| CWE-94 | Improper Control of Generation of Code |6869## References7071- [Synactiv Hijacking GitHub Runners](https://www.synacktiv.com/en/publications/hijacking-github-runners-to-compromise-the-organization)72- [GitHub Security Lab GitHub Actions Security 2021](https://securitylab.github.com/resources/github-actions-preventing-pwn-requests/)73- [GitHub Security Labs GitHub Actions Security Part 2 2021](https://securitylab.github.com/resources/github-actions-untrusted-input/)74- [John Stawinski PyTorch Supply Chain Attack 2024](https://johnstawinski.com/2024/01/11/playing-with-fire-how-we-executed-a-critical-supply-chain-attack-on-pytorch/)75- [Unit 42 Palo Alto GitHub Actions Supply Chain Attack 2025](https://unit42.paloaltonetworks.com/github-actions-supply-chain-attack)76- [OWASP CICD-SEC-4](https://owasp.org/www-project-top-10-ci-cd-security-risks/CICD-SEC-04-Poisoned-Pipeline-Execution)77- [Wiz Ultralytics AI Library Hijack 2024](https://www.wiz.io/blog/ultralytics-ai-library-hacked-via-github-for-cryptomining)78- [Atomic Red Team - T1677](https://github.com/redcanaryco/atomic-red-team/tree/master/atomics/T1677)79- [MITRE ATT&CK - T1677](https://attack.mitre.org/techniques/T1677)