Join our Newsletter — 33% off our NHI Course
Home› Glossary› Cyber Security› Curl to Bash
Cyber Security

Curl to Bash

← Back to Glossary
By NHI Mgmt Group Updated September 29, 2026 Domain: Cyber Security

Curl to Bash is a software delivery pattern where a script is downloaded from the internet and executed immediately in a shell. It is convenient, but risky, because the downloading step and the execution step happen with little or no validation. In CI environments, that can turn a supply chain compromise into credential theft.

What Curl to Bash Means in Practice

Curl to bash is not just a convenience pattern, it is a trust shortcut. The user asks a shell to execute code at the same moment it retrieves it, so the real security question is whether the download source, transport, and script contents are trustworthy enough to run immediately.

The pattern is common in quick-start installers, bootstrap scripts, and CI setup steps because it removes friction. That speed is also why it deserves scrutiny: the command collapses retrieval and execution into one action, which makes it easy to overlook what was actually fetched, whether it changed, and whether the content was ever reviewed.

Why It Is So Dangerous in Delivery Pipelines

In CI and automation contexts, curl to bash often runs with broad token access, repository write rights, package publishing permissions, or cloud credentials already present on the runner. A compromise at the download point can therefore become immediate code execution under a privileged automation context.

The risk is not limited to a malicious script. A benign script can become unsafe if DNS, hosting, CDN content, or upstream distribution is compromised, because the shell executes whatever arrived rather than what was intended.

When this pattern appears in build or release automation, it can also blur accountability. The pipeline may faithfully execute a command that no one ever reviewed in its final form, which makes later incident analysis harder.

How the Pattern Commonly Fails

Curl to bash fails through substitution, tampering, and drift. An attacker can alter the remote file, redirect the request, exploit a compromised hosting account, or swap content after a script was published and before the next run.

It also fails through assumption reuse. Teams often treat a known project, familiar domain, or README snippet as proof of safety, even though the trust boundary is the fetched content itself, not the name attached to it.

SLSA helps explain why this is a delivery integrity problem, while CIS Benchmarks reinforce the broader value of secure defaults and controlled execution environments.

Safer Ways to Handle Script-Based Installation

Safer delivery patterns separate retrieval from execution. That means inspecting the content first, pinning versions or checksums where possible, and preferring installation methods that preserve provenance and integrity over one-line convenience.

When a script must be used, the operational goal is to make the downloaded artifact observable and repeatable, not opaque and ephemeral. In automation, that usually means reducing the blast radius of the runner and limiting the privileges available to the process that performs the fetch.

NIST SP 800-53 Rev 5 Security and Privacy Controls is useful here because it frames controlled execution, configuration management, and integrity monitoring as first-class protections. NIST SP 800-207 Zero Trust Architecture also aligns with the core idea that trust should be verified, not assumed, before code is executed.

What Practitioners Should Remember

A curl to bash command is not automatically malicious, but it is always a high-trust action. The convenience comes from skipping validation, so the practitioner question is whether the speed gain is worth the loss of control at the exact moment code enters the environment.

That judgment matters most in CI, ephemeral build systems, and automated provisioning, where the same shortcut can expose secrets, alter artifacts, or establish persistence before anyone notices the request was unsafe.

SLSA and NIST Cybersecurity Framework 2.0 both support the same practical takeaway: strengthen software delivery so integrity is verified before execution, not after compromise.

Risk and Threat Considerations

Curl to bash creates a direct exposure path from remote content to local execution, so any compromise in the source, transport, or delivery path can become code execution with the permissions of the caller. In CI, that can turn a supply chain event into secret theft, artifact tampering, or lateral movement.

Failure mechanism: An attacker or compromised upstream service replaces or redirects the fetched content, and the shell executes it immediately without a meaningful opportunity for inspection, pinning, or provenance verification.

Impact: The result can be unauthorized code execution, credential exposure, build contamination, or persistent compromise of automation systems that were expected to be trusted.

Standards & Framework Alignment

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

SLSA, NIST SP 800-53 Rev 5, NIST CSF 2.0, CIS Controls v8 and OWASP ASVS set the governance and control requirements practitioners need to meet.

FrameworkControl / ReferenceRelevance
SLSASupply-chain integrity and provenanceCurl to Bash is a software delivery integrity problem that depends on artifact provenance.
Recommendation — Verify provenance and integrity before executing downloaded installer scripts.
NIST SP 800-53 Rev 5SI-7 — Software, Firmware, and Information IntegrityThis pattern hinges on validating code integrity before execution.
CM-3 — Configuration Change ControlRemote scripts often change system state without controlled review or approval.
AC-6 — Least PrivilegeCI runners executing remote scripts should not have unnecessary access or credentials.
Recommendation — Apply integrity checks before allowing downloaded scripts to run. Require controlled approval for changes introduced by bootstrap scripts. Minimize runner privileges before permitting script execution.
NIST CSF 2.0PR.DS-08 — Integrity mechanisms are implementedThe practice directly depends on verifying content integrity before execution.
PR.AA-05 — Least privilege is managed for identities and assetsAutomation that runs curl to bash often inherits access that should be tightly constrained.
Recommendation — Use integrity mechanisms to validate downloaded content before running it. Restrict automation privileges before executing remote scripts.
CIS Controls v8CIS-4 — Secure Configuration of Enterprise Assets and SoftwareScript-based bootstrap actions can undermine secure baseline configuration.
CIS-6 — Access Control ManagementThe impact of a risky script depends heavily on the permissions available to the process.
Recommendation — Standardize approved installation paths instead of ad hoc remote execution. Limit script execution rights to only the access required.
OWASP ASVSV15 — Secure Coding and ArchitectureThe pattern reflects a design choice that bypasses safer software delivery architecture.
Recommendation — Prefer architectures that separate acquisition, verification, and execution.

Practitioner Guidance

Why practitioners should care: Treat any fetch-and-execute pattern as an integrity-sensitive control point, especially when the command runs in a build, deploy, or provisioning context. The security question is not whether the script is convenient, but whether the system can prove what it ran and why it was allowed to run.

Common misunderstanding: A familiar domain name, popular project, or one-line install instruction does not make the command safe. The risk sits in the live content path, so the decision should be based on validated artifacts, not on trust in the surrounding documentation.

Practitioner takeaway: If the script matters enough to execute, it matters enough to verify first.

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 29, 2026.
    NHI Mgmt Group — the #1 independent authority on Non-Human Identity, IAM, and Agentic AI security. nhimg.org