Install-time code execution exposes build credentials when a package, installer, or setup script runs with the privileges and network access of the build environment, letting attacker-controlled code read environment variables, files, or secret stores. CI tokens, signing keys, cloud credentials, and npm, pip, or container registry secrets can then be exfiltrated or used to tamper with downstream artefacts.
Why install-time code execution is such a credential exposure point
Install-time code execution is dangerous because the build or setup process often runs with broad trust: it can see environment variables, mounted files, package manager settings, and network paths that normal application code never needs. If an attacker can get code to execute during install, they are not just running logic, they are running inside a privileged automation context that already holds secrets needed to build, sign, publish, or deploy artefacts.
That makes the install step a high-value target in supply chain attacks. A malicious package, post-install script, or setup hook can read credentials intended for the pipeline rather than the package itself, then use them to move from a single poisoned dependency to broader repository, registry, or cloud access.
What secrets are usually exposed during installation?
The most exposed items are usually build-time secrets rather than end-user credentials. Common examples include CI tokens, signing keys, cloud access keys, package registry credentials, and secret values injected into the pipeline for testing, publishing, or deployment. These are often present because the installer needs network access, write access, or trust to fetch dependencies and publish outputs.
The exposure often happens through ordinary runtime surfaces: environment variables, config files, secret mounts, credential helpers, cached tokens, or mounted workspace paths. If the install script can read the same context that your build jobs use, it can often collect more than one secret in a single execution path and reuse them outside the original trust boundary.
- Build credentials are especially dangerous when they can reach signing or publish workflows.
- Secrets stored in files or environment variables are easy to collect if install code runs with the same user context as the build agent.
- Long-lived credentials increase the chance that a one-time install compromise becomes repeated abuse.
How does that turn into downstream artefact tampering?
Once an attacker obtains build credentials, the issue is no longer just secret theft. They may be able to publish altered packages, swap artefacts in a registry, sign malicious releases, or inject changes into later stages of the pipeline. In other words, install-time execution can become a control-plane compromise for the software supply chain rather than a single compromised job.
The downstream risk is highest when the same credential can both read and write across environments, or when one token unlocks multiple systems such as source control, artefact storage, and cloud deployment. SLSA is relevant here because it pushes teams to treat build provenance and artefact integrity as first-class controls, which is exactly where install-time abuse causes the most damage.
Risk and Threat Considerations
Install-time execution creates a compact attack path: malicious code lands through a dependency or installer, then immediately inherits the build environment’s trust, secrets, and outbound access. The attacker does not need interactive access to the builder if the install step can already read and transmit credentials.
Failure mechanism: Install hooks, post-install scripts, or setup commands execute before the team has a chance to inspect the package’s behaviour, and the code can exfiltrate secrets from the build context or use them to alter later pipeline stages.
Impact: A single compromised installation can expose signing keys, CI tokens, cloud credentials, or registry secrets, then let the attacker tamper with artefacts, publish poisoned packages, or persist through trusted release channels.
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, CIS Controls v8 and OWASP ASVS set the governance and control requirements practitioners need to meet.
| Framework | Control / Reference | Relevance |
|---|---|---|
| SLSA | Supply Chain Levels for Software Artifacts | Build-time code execution threatens artefact provenance and integrity. |
| Recommendation — Harden build provenance and isolate install steps from signing and publish credentials. | ||
| NIST SP 800-53 Rev 5 | SI-7 — Software, Firmware, and Information Integrity | Install-time scripts can alter trusted software and pipeline outputs. |
| IA-5 — Authenticator Management | Build credentials, tokens, and keys exposed during install need tight lifecycle control. | |
| Recommendation — Validate installation sources and block untrusted code paths from modifying protected artefacts. Rotate, scope, and revoke pipeline credentials that installation code could access. | ||
| CIS Controls v8 | CIS-16 — Application Software Security | Package installation scripts are part of software acquisition and execution risk. |
| Recommendation — Restrict or review install-time execution in software acquisition and deployment workflows. | ||
| OWASP ASVS | V15 — Secure Coding and Architecture | Install-time execution is a software supply-chain and execution-boundary concern. |
| Recommendation — Design deployment pipelines so untrusted install code cannot reach sensitive build secrets. | ||
Practitioner Guidance
What to verify: Treat every install-time execution path as a secret exposure point. Check whether package installation is allowed to run arbitrary scripts, whether build jobs inherit broad environment variables, and whether the installer can reach secret mounts or cached credentials it does not truly need.
Decision rule: If installation must run code, constrain it so the install step cannot access signing material, publish tokens, or cloud credentials unless those secrets are strictly required for that job. If a package does not need network or write access during install, remove both.
What practitioners underestimate: The main hazard is often not the package manager itself, but the privilege and secret scope of the surrounding pipeline. A build credential that is “only for automation” is still a high-value secret if malicious install code can read it once and reuse it elsewhere.
Practitioner takeaway: The safest assumption is that install-time code can see everything the build runner can see, so the control objective is to narrow what the runner can access before you trust any dependency install.
Related resources from NHI Mgmt Group
Deepen Your Knowledge
Free weekly newsletter
Subscribe to the NHI & AI Identity Journal
The latest on NHI and Agentic AI security – articles, research, breaches, news and events every week.
Bonus 33% off our NHI Course when you subscribe.
Reviewed and updated by the NHIMG editorial team on November 25, 2026.
NHI Mgmt Group — the #1 independent authority on Non-Human Identity, IAM, and Agentic AI security. nhimg.org