Join our Newsletter — 33% off our NHI Course
Home› FAQ› Threats, Abuse & Incident Response› Why do unexpected code executions in CI/CD pipelines…
Threats, Abuse & Incident Response

Why do unexpected code executions in CI/CD pipelines create such a high supply chain risk?

← Back to all FAQ
By NHI Mgmt Group Editorial Team Updated September 26, 2026 Domain: Threats, Abuse & Incident Response

Unexpected code execution is risky because the build environment often has access to source code, credentials, and deployment steps. If an attacker hijacks a fetched artifact or injects a malicious process, the pipeline can become a trusted path into software delivery. Runtime monitoring helps expose those deviations before compromised code is shipped downstream.

Why unexpected execution is so dangerous inside a pipeline

Unexpected code execution in CI/CD is not just “another runtime issue,” because the pipeline often sits at a privileged point in the software factory. It can read source, pull dependencies, use signing material, publish artifacts, and trigger deployment. When code runs there without being expected or reviewed, the attacker is no longer touching one host, but the path that produces trusted software.

That makes the blast radius larger than a single compromised workstation or runner. A malicious process in the build path can alter what is built, observe what should have stayed private, and turn normal automation into a delivery mechanism for malicious changes.

In practice, the risk comes from trust inheritance. If the pipeline is trusted to fetch, compile, test, package, and deploy, then any code that executes inside that environment may inherit access to the same systems and secrets that legitimate build steps use.

How build-time execution becomes a supply chain path

CI/CD pipelines are attractive because they concentrate sensitive actions in one place. A single injected step can see source repositories, environment variables, signing keys, deployment tokens, and sometimes production-adjacent credentials. That is why a malicious dependency, compromised action, poisoned artifact, or tampered build script can become a supply chain event rather than an isolated execution bug.

The core failure is that the pipeline is designed to trust code enough to run it. If that trust boundary is weak, the attacker can move from “code execution” to “code influence,” then to “artifact influence,” and finally to downstream compromise. The most damaging outcomes are usually not immediate crashes, but integrity loss and unauthorized release of software that appears legitimate.

Build systems also amplify secrecy problems. Even a brief execution window can expose cached secrets, temporary credentials, signing workflows, or repository-scoped tokens. Once those materials are captured, the attacker may not need to stay in the pipeline at all, because the stolen access can be reused elsewhere in the delivery chain. See also GitHub Action supply chain attack that leaked CI/CD secrets and Nx package attack leaking thousands of credentials.

What actually makes the risk systemic

The risk becomes systemic when unexpected execution can influence trusted outputs at scale. A build pipeline is often a shared choke point for many repositories, teams, or environments, so one compromised workflow can affect many artifacts or deployments. That is why supply chain attacks frequently target package managers, actions, build plugins, and other execution surfaces that seem operationally convenient but are also deeply trusted.

Another reason the risk is high is that the pipeline may execute code from multiple origins in a single run. Source code, fetched dependencies, helper tools, test fixtures, and automation hooks can all participate. If any one of those origins is tampered with, the pipeline can still complete successfully while producing an artifact that is no longer the one developers intended.

The most dangerous pattern is stealthy deviation. If the malicious process blends into normal build noise, the result can look like a successful release while quietly leaking secrets, modifying outputs, or inserting backdoors. That is why runtime monitoring and provenance checks matter most when the pipeline is both privileged and automated. SLSA and NIST SSDF (SP 800-218) are useful reference points for build integrity, while OpenSSF provides broader supply chain security guidance.

Risk and Threat Considerations

Unexpected execution in CI/CD is risky because it can convert a trusted automation path into an attacker-controlled control plane. The usual consequence is not just one bad build, but secret exposure, artifact tampering, and unauthorized release activity that can propagate to downstream systems and users.

Failure mechanism: A malicious or unexpected process inherits pipeline privileges, then uses fetched code, tokens, cached credentials, or signing steps to alter outputs or exfiltrate material before the build completes.

Impact: The organisation may ship compromised software, lose trust in release integrity, and expose credentials or deployment access that can be reused for later compromise.

Standards & Framework Alignment

This section maps relevant standards and security frameworks to the operational risks and controls described in this guidance.

OWASP API Security Top 10 addresses the attack and risk surface, while SLSA, NIST SP 800-53 Rev 5, CIS Controls v8 and OWASP ASVS set the governance and control requirements practitioners need to meet.

FrameworkControl / ReferenceRelevance
SLSASupply-chain Levels for Software ArtifactsBuild integrity and provenance are central to unexpected CI/CD code execution.
Recommendation — Adopt provenance and integrity controls to prevent untrusted build steps from influencing released artifacts.
NIST SP 800-53 Rev 5SI-7 — Software, Firmware, and Information IntegrityUnexpected execution can tamper with build outputs and trusted delivery steps.
IA-5 — Authenticator ManagementCI/CD attacks often abuse leaked or long-lived credentials inside the pipeline.
AU-6 — Audit Record Review, Analysis, and ReportingRuntime monitoring is needed to detect unexpected code execution in build environments.
Recommendation — Verify build-step integrity and block unauthorized changes to software production pipelines. Rotate and tightly manage pipeline credentials so build steps cannot reuse exposed authenticators. Review build and runner telemetry to detect suspicious execution and secret access during pipelines.
CIS Controls v8CIS-16 — Application Software SecuritySoftware delivery pipelines are a primary software security control surface.
Recommendation — Harden build and release workflows to reduce the chance of malicious code entering production.
OWASP ASVSV15 — Secure Coding and ArchitectureUnexpected execution in pipelines reflects insecure trust boundaries and build architecture.
Recommendation — Design build flows so untrusted code cannot reach privileged release paths.
OWASP API Security Top 10API8 — Security MisconfigurationPipeline misconfiguration can expose secrets, tokens, and release permissions to untrusted code.
Recommendation — Remove excessive pipeline permissions and misconfigurations that let build steps reach sensitive resources.

Practitioner Guidance

What to prioritise: Treat any build step that can execute fetched code, third-party actions, plugins, or generated scripts as a high-risk trust boundary. The first question is not whether the pipeline “worked,” but whether the executed code was expected, provenance-checked, and constrained to the minimum privilege needed for that stage.

What to verify: Confirm that build jobs cannot reach long-lived secrets unnecessarily, that signing or deployment credentials are isolated from untrusted steps, and that unexpected child processes or network calls are observable. If a build can publish artifacts and also read broad credentials, the pipeline needs stronger segmentation before it needs more logging.

Practitioner takeaway: The key judgment is to separate “automation that runs code” from “automation that can affect trust.” If a pipeline step can both execute unreviewed input and touch release authority, it should be treated as a supply chain control point, not a convenience feature.

Deepen Your Knowledge

Sign up to our weekly newsletter — get 33% off our NHI Foundation Level Course

    NHIMG Editorial Note
    Reviewed and updated by the NHIMG editorial team on September 26, 2026.
    NHI Mgmt Group — the #1 independent authority on Non-Human Identity, IAM, and Agentic AI security. nhimg.org