Supply-chain reality check: package-squatting + CI/OIDC abuse are the fastest routes into your cloud
By Ash K
Two converging attack paths
- Package squatting / dependency confusion: Adversaries publish near-name or higher-version packages to public registries (npm/PyPI). CI/dev machines resolve to the malicious package, executing install scripts that exfiltrate tokens or modify build output.
- CI OIDC abuse: With repo takeover (stolen token, maintainer account, or dependency hijack), attackers request cloud creds
via OIDC federation (e.g., GitHub → AWS/GCP/Azure). Misconfigured trust policies (broad
aud/subjectclaims) let arbitrary workflows assume powerful roles.
Red flags in telemetry
- Build time anomalies: unexplained
preinstall/postinstallscripts; outbound connections duringnpm i/pip install. - Registry resolution: packages sourced from public registry when an internal mirror is expected.
- OIDC claims: Cloud STS logs showing issuers like
https://token.actions.githubusercontent.comwith overly broadsubpatterns (e.g., repo wildcard) or missingaudpinning.
Hunting starters
# Cloud audit (AWS example) CloudTrail | filter eventName = "AssumeRoleWithWebIdentity" | fields eventTime, requestParameters.roleArn, requestParameters.audience, requestParameters.subjectFromWebIdentityToken, sourceIPAddress
# GitHub Actions "Workflow job run attempted to access OIDC token" events with unexpected repository, environment, or branch.
# Egress during package install (EDR/Proxy)
NetworkEvents
| where InitiatingProcessCommandLine has_any ("npm install","pip install","python -m pip")
| where RemoteUrl not in AllowListedRepos
Hardening that actually works
- Private registries & pinning: Route builds through an internal artifact proxy; require namespace/owner allow-lists; pin by digest (SRI/lockfiles).
- Provenance & signing: Enforce Sigstore/cosign for release artifacts; verify provenance in CI (SLSA level targets).
- Deny default OIDC: Cloud roles must restrict
issto GitHub’s issuer,audto a custom value, andsubto the exactrepo:org/name:ref:branch:environment. - Least-privilege CI roles: Separate read-only build roles from deploy roles; use short-lived credentials and environment-level approvals.
- Dependency policy: Ban install scripts by default; require security review to enable. Alert on new maintainers/owners for critical packages.
- SBOM everywhere: Generate SBOMs for each build (SPDX/CycloneDX) and scan for unapproved packages before promotion.
30-day engineering plan
- Days 1–7: Turn on private registry proxy; freeze lockfiles; block install scripts; audit top 50 packages for maintainer churn.
- Days 8–15: Tighten OIDC trust policies; add
audpinning; restrictsubto exact repo+env; rotate CI secrets. - Days 16–23: Add provenance checks (cosign, SLSA provenance); enforce signature verification in pipelines.
- Days 24–30: Split deploy roles; implement break-glass process; add detections for
AssumeRoleWithWebIdentityspikes and unapproved registry egress.
Bottom line: Treat your build system as production. If a stranger can publish your dependencies or mint your cloud tokens, they can ship to your customers.
Ash K
Ashton is a seasoned Cybersecurity Professional with over 25 years of experience in Cybersecurity Research, Cybersecurity Incident response, Products and Security Solutions architecture.