Skip to main content

01. Overview, Architecture & Supply Chain Threat Landscape

Modern software development relies heavily on Continuous Integration and Continuous Deployment (CI/CD) pipelines to automate building, testing, packaging, and deploying applications. While automation accelerates deployment velocity, it also consolidates high-value operational secrets and deployment privileges into build environments.

Attackers have shifted their focus from target production environments to the software supply chainβ€”hijacking build runners, manipulating dependencies, and poisoning pipelines to compromise downstream consumers.


1. CI/CD Pipeline Architecture & Attack Surface​

A typical automated delivery pipeline connects version control repositories, ephemeral build runners, secrets stores, third-party plugin registries, and target cloud environments.

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚ CI/CD ATTACK SURFACE MAP β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

[ Developer ] ──► ( 1. Source Code Repositories )
β”‚
β–Ό
[ Pull Request ] ──► ( 2. Pipeline Trigger / PPE )
β”‚
β–Ό
( 3. Build Runner Node ) ──► [ Exfiltrate Secrets ]
β”‚ β”‚
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β” └──► [ Malicious Dependency ]
β–Ό β–Ό
( 4. Secrets Vault / OIDC ) ( 5. Build & Sign )
β”‚
β–Ό
( 6. Container Registry )
β”‚
β–Ό
[ Production Cluster ]

The 6 Primary Attack Vectors​

VectorsTarget AreaDescription
1. Source ControlGit Repository / PRsMalicious PRs, unauthorized commits, bypassed branch protection rules.
2. Pipeline TriggersEvent HandlersPoisoned Pipeline Execution (PPE) via untrusted event contexts (e.g. pull_request_target).
3. Runner EnvironmentEphemeral / Self-HostedHost execution escape, unisolated shared memory, persistent backdoors on self-hosted runners.
4. Secrets AccessEnvironment VariablesUnauthorized reading of cloud API keys, SSH keys, or database credentials stored in pipeline configs.
5. Build & SignCompiler / BundlerCode modification during compilation without altering git source code (Compiler-level injection).
6. Artifact DistributionImage Registries / Package ReposPublishing unsigned binaries, dependency confusion, or compromised container images to public/private registries.

2. OWASP Top 10 for CI/CD Security Risks​

The OWASP Foundation established a dedicated security framework for CI/CD pipelines to classify vulnerabilities specific to delivery pipelines:

Risk IDTitleSummary & Technical Impact
CICD-SEC-01Insufficient Flow ControlLack of mandatory human reviews or status checks allowing unverified code directly into production.
CICD-SEC-02Inadequate Identity & Access (IAM)Over-privileged build tokens (GITHUB_TOKEN write access) or static cloud keys shared across jobs.
CICD-SEC-03Dependency Chain AbuseIngestion of malicious upstream packages, typosquatting, or dependency confusion attacks.
CICD-SEC-04Poisoned Pipeline Execution (PPE)Attackers injecting commands into workflow definitions (.github/workflows/*.yml) via PRs.
CICD-SEC-05Insufficient Pipeline VerificationDeploying software artifacts without verifying signatures, checksums, or SLSA provenance metadata.
CICD-SEC-06Arbitrary Code ExecutionExecuting untrusted code inside privileged pipeline steps (e.g., executing code from PR forks).
CICD-SEC-07Ungoverned Third-Party ServicesUsing unvetted external build actions or SaaS integrations with broad access permissions.
CICD-SEC-08Improper Environment HygieneReusing non-ephemeral build agents across jobs without cleanup, leading to cross-build contamination.
CICD-SEC-09Secrets Ungoverned UsageHardcoding static secrets in repo files, printing credentials in build logs, or leaking secrets to forks.
CICD-SEC-10Inadequate Logging & VisibilityLack of execution auditing, audit log collection, or anomaly detection on build runners.

3. High-Profile Real-World Supply Chain Incidents​

[!IMPORTANT] Supply chain attacks bypass traditional network perimeters and web application firewalls (WAFs) because the payload originates from a trusted, cryptographically signed internal build process.

Case Study 1: SolarWinds SUNBURST (2020)​

  • Vector: Compromise of internal build infrastructure (MSBuild compilation pipeline).
  • Mechanism: Attackers deployed a lightweight implant (Solorigate) on build servers. During the build process of SolarWinds Orion software, the implant monitored memory for active compilation of target source files and dynamically inserted backdoor code into SolarWinds.Orion.Core.BusinessLayer.dll right before code signing.
  • Impact: The malicious DLL was signed with legitimate SolarWinds digital certificates and distributed as an official software update to 18,000+ public and private organizations worldwide.

Case Study 2: Codecov Bash Uploader Compromise (2021)​

  • Vector: Modification of public bash uploader script (codecov.sh) hosted on Google Cloud Storage.
  • Mechanism: Attackers obtained GCS credentials due to a misconfigured Docker image creation process. They modified codecov.sh to extract all environment variables passed into the runner environment (including git tokens, cloud keys, database URLs) and send them to an external attacker-controlled server.
  • Impact: Hundreds of enterprise CI/CD pipelines executing curl -s https://codecov.io/bash | bash leaked secret tokens silently for over 2 months.

Case Study 3: XZ Utils Backdoor (CVE-2024-3094)​

  • Vector: Multi-year social engineering + build-system M4 macro & tarball script injection.
  • Mechanism: A malicious contributor ("Jia Tan") spent over two years gaining maintainer trust on the xz compression library. Malicious test files containing obfuscated binary payloads were committed. During release tarball generation (outside git repository commit logs), modified build-to-host.m4 build scripts extracted and injected a backdoor into liblzma during compilation.
  • Impact: The backdoor intercepted OpenSSH RSA_public_decrypt calls, allowing attackers possessing a specific private key to achieve Remote Code Execution (RCE) on affected Linux distributions (Debian, Fedora, Arch).

4. The SLSA Framework (Supply-chain Levels for Software Artifacts v1.0)​

SLSA (pronounced salsa) is an OpenSSF open standard defining actionable security requirements to prevent supply chain tampering across software builds.

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚ SLSA BUILD LEVELS & REQUIREMENTS β”‚
β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
β”‚ Level 1 β”‚ Build process is fully automated. Build tool generates build β”‚
β”‚ β”‚ provenance metadata detailing how the artifact was created. β”‚
β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
β”‚ Level 2 β”‚ Build runs on a dedicated hosted build service (e.g. GitHub β”‚
β”‚ β”‚ Actions). Provenance is cryptographically signed by the platform.β”‚
β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
β”‚ Level 3 β”‚ Build environment is isolated and ephemeral. Hardened against β”‚
β”‚ β”‚ cross-build contamination, host tamper attempts, and secret leaks.β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

SLSA Provenance Structure​

A SLSA provenance document is an in-toto attestation (.intoto.json) containing cryptographic hashes of source commits, build parameters, runner environment identity, and output artifacts:

{
"_type": "https://in-toto.io/Statement/v1",
"subject": [
{
"name": "registry.example.com/appsec/api-service",
"digest": {
"sha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855"
}
}
],
"predicateType": "https://slsa.dev/provenance/v1",
"predicate": {
"buildDefinition": {
"buildType": "https://actions.github.com/buildtypes/v1",
"externalParameters": {
"repository": "https://github.com/techcorp/api-service",
"ref": "refs/heads/main"
},
"resolvedDependencies": [
{
"uri": "git+https://github.com/techcorp/api-service@refs/heads/main",
"digest": {
"gitCommit": "8f8b0569bc539a4891cb09c4d9fa2e413009a25b"
}
}
]
},
"runDetails": {
"builder": {
"id": "https://github.com/actions/runner/github-hosted"
}
}
}
}

[!TIP] Key Takeaway: Securing a CI/CD pipeline requires enforcing identity isolation, pinning all inputs, scanning for secrets before execution, and signing generated artifacts with immutable provenance.


Next Chapter: 02. GitHub Actions & Runner Security Hardening β†’