A vulnerability where attacker-controlled input is interpreted as shell syntax or executable command text inside a build or automation job. It is especially dangerous in CI/CD because the job may already have access to source code, secrets, and release permissions.
Expanded Definition
command injection in pipelines occurs when build scripts, workflow steps, or automation jobs pass attacker-controlled values into a shell, interpreter, or command runner without strict validation and quoting. In NHI environments, the danger is amplified because CI/CD runners often operate with privileged service accounts, deployment tokens, and broad access to source control and production tooling. The concept is closely related to NIST Cybersecurity Framework 2.0 concerns around secure execution and access control, but no single standard names this pipeline-specific abuse pattern as a standalone control domain. Definitions vary across vendors, especially when the same weakness is described as shell injection, workflow injection, or unsafe job parameter handling.
The practical distinction is that the attacker is not merely altering data; they are causing the automation system to execute unintended commands in a trusted environment. That makes the issue more severe than a generic input-validation bug because the impact can include secret theft, artifact tampering, lateral movement, or release compromise. The most common misapplication is treating pipeline variables as harmless metadata, which occurs when teams interpolate untrusted branch names, commit messages, or PR fields directly into shell commands.
Examples and Use Cases
Implementing pipeline automation safely often introduces friction, because strong input handling can limit dynamic scripting and require more explicit escaping, allowlisting, and job design.
- A pull request title is inserted into a shell command that runs test labels, and a malicious title breaks out of the intended argument context.
- A release workflow uses branch names in command construction, allowing a crafted branch reference to execute unintended code during packaging.
- A self-hosted runner executes a script that concatenates environment variables with deployment commands, exposing the runner’s credentials to theft or misuse. See the CI/CD pipeline exploitation case study for a real-world pattern.
- A third-party action or build helper processes repository input unsafely, creating a supply chain path similar to the Reviewdog GitHub Action supply chain attack.
- A pipeline step reads secret-bearing config and then prints command output to logs, turning a command injection into a broader secret exposure event.
For a deeper NHI-focused view of how secrets and automation failures cascade, see the Guide to the Secret Sprawl Challenge and the NIST Cybersecurity Framework 2.0 guidance on reducing exposure through disciplined control design.
Why It Matters in NHI Security
Command injection in pipelines is an NHI problem because the compromised execution context is usually not a human user account but a service account, runner identity, deployment token, or secrets-bearing automation principal. Once that identity is abused, the attacker may move from a single job to broader environments, especially where secrets are reused or overprivileged. NHIMG research shows that 96% of organisations store secrets outside of secrets managers in vulnerable locations including code, config files, and CI/CD tools, which makes pipeline exploitation far more likely to cascade into credential compromise.
The security impact is not limited to one failed build. A successful injection can rewrite artifacts, alter release logic, leak tokens, or create persistence in the delivery chain. That is why command injection in pipelines should be treated as both an application security defect and an NHI governance failure. Organisations typically encounter the full consequence only after a suspicious deployment, secret leak, or unexpected code execution event, at which point command injection in pipelines becomes operationally unavoidable to address.
Standards & Framework Alignment
This section maps relevant standards and security frameworks to the operational risks and controls described in this guidance.
OWASP Non-Human Identity Top 10 and OWASP Agentic AI Top 10 address the attack and risk surface, while NIST CSF 2.0, NIST Zero Trust (SP 800-207) and NIST AI RMF set the governance and control requirements practitioners need to meet.
| Framework | Control / Reference | Relevance |
|---|---|---|
| OWASP Non-Human Identity Top 10 | NHI-02 | Unsafe pipeline command execution often leads to secret exposure and privilege misuse. |
| NIST CSF 2.0 | PR.AC-3 | Pipeline identities and tokens must be managed as access assets with limited trust. |
| NIST Zero Trust (SP 800-207) | SC-7 | Zero Trust requires each pipeline step to be isolated and evaluated, not implicitly trusted. |
| NIST AI RMF | AI-managed pipelines still need governance over unsafe tool execution and prompt-to-command flows. | |
| OWASP Agentic AI Top 10 | Agentic workflows can turn untrusted input into tool or shell execution without proper guardrails. |
Treat any AI-to-shell handoff as a high-risk boundary and apply explicit human or policy controls.