On 13 December, SolarWinds disclosed that versions of its Orion network management software released between March and June 2020 contained malicious code, now known as SUNBURST. The trojanised updates were distributed through SolarWinds' normal update channel, digitally signed, to thousands of customers, including government agencies and major companies. FireEye, which discovered the campaign while investigating a breach of its own systems, has described a highly sophisticated attacker.
Investigations are ongoing, but one aspect is already clear: the attackers appear to have inserted their code into the software during the vendor's build process, so that what customers received was malicious even though it was built and signed by the vendor.
This is a supply-chain attack through the CI/CD pipeline, and it should change how every software organisation thinks about its build systems.
Why pipelines are prime targets
A modern CI/CD system typically has access to:
- all of your source code,
- secrets: cloud credentials, database passwords, API keys,
- code-signing keys and package publishing credentials,
- the ability to deploy to production, and
- third-party plugins and build tools with the same access.
Compromise the pipeline and you can steal secrets, alter source or artefacts, and ship malicious code that carries your organisation's signature and reaches every customer through trusted channels. Build servers are often less closely monitored and hardened than production, despite having comparable or greater power.
How pipelines get compromised
flowchart TB A1[Stolen developer<br/>credentials] --> P[CI/CD system] A2[Vulnerable CI server<br/>or plugin] --> P A3[Malicious dependency<br/>or build tool] --> P A4[Untrusted pull request<br/>running with secrets] --> P P --> I1[Secrets exfiltrated] P --> I2[Source or artefact<br/>tampered] P --> I3[Malicious release<br/>signed & shipped]
- Stolen credentials for source control or CI administrators.
- Vulnerable CI servers and plugins, often exposed to the internet and rarely patched.
- Malicious or compromised dependencies and build tools pulled during builds.
- Untrusted code (for example, pull requests from forks) running in jobs that have access to secrets.
- Tampering with the build environment itself, as SUNBURST appears to have done.
Controls that protect the pipeline
Treat CI/CD as production
- Keep CI servers patched, minimise plugins and remove unused ones.
- Do not expose CI administration interfaces to the internet.
- Require SSO and MFA for source control and CI access.
- Monitor CI systems with the same rigour as production: logins, configuration changes, new jobs and unusual network connections.
Control who can change what
- Protect main branches: required reviews and status checks before merge.
- Restrict who can modify pipeline definitions and build scripts, and review those changes like code, because they are code.
- Separate duties: the people who can change the pipeline should not be the only reviewers of their own changes.
Protect secrets
- Store secrets in the CI system's secret store or a vault, never in repositories.
- Scope secrets to the jobs and branches that need them. In GitLab, for example, protected variables are only exposed to pipelines running on protected branches and tags.
- Never expose secrets to jobs that run untrusted code, such as pull requests from forks.
- Rotate secrets regularly, and immediately after any suspected compromise.
# .gitlab-ci.yml (illustrative): deploy credentials only on protected branches
deploy_production:
stage: deploy
script:
- ./scripts/deploy.sh
rules:
- if: '$CI_COMMIT_BRANCH == "main"'
environment: production
# DEPLOY_TOKEN is defined as a *protected, masked* variable in project settings,
# so it is not available to feature branches or merge requests from forks.Isolate builds
- Use ephemeral build agents that are created fresh for each job and destroyed afterwards, so compromises do not persist.
- Restrict network access from build agents to what builds need.
- Avoid sharing build agents between projects with different trust levels.
Control dependencies
- Pin dependency versions with lock files and verify checksums.
- Pull packages through an internal proxy or mirror.
- Scan dependencies for known vulnerabilities and watch for suspicious new versions.
Verify what you build and ship
- Make builds reproducible where possible, so independent rebuilds can confirm artefacts match source.
- Sign artefacts and verify signatures at deployment.
- Record what went into each build (source commit, dependencies, build environment) so you can investigate later.
- For critical software, consider independent verification of release artefacts, comparing them against what the source should produce.
Questions to ask this week
- Who can change our build pipelines, and would we notice if they did?
- Which secrets can a build job reach, and could untrusted code access them?
- Are our CI servers and plugins patched, and are they exposed to the internet?
- Could we tell whether a released artefact matches the source it claims to be built from?
The bottom line
SolarWinds is a reminder that trust flows through build systems. If an attacker controls your pipeline, they control what your customers install. Treat CI/CD as the critical production system it is: harden it, restrict and review changes to it, protect its secrets, isolate its builds and verify its outputs.
Our application security testing and secure code review services include CI/CD pipeline security reviews, and our managed detection and response team can check build infrastructure for signs of tampering.