Miasma Campaign Poisons ImmobiliareLabs npm Packages via CI/CD Privilege Escalation
The Miasma Mini Shai-Hulud campaign demonstrates how attackers can weaponize legitimate software distribution channels by compromising maintainer infrastructure and injecting malicious payloads into trusted npm packages. By exploiting a privilege escalation flaw in GitHub Actions deployment workflows and a compromised third-party action (codfish/semantic-release-action), attackers gained the ability to publish malicious package versions without raising immediate suspicion. Developer and CI/CD secrets were silently exfiltrated, meaning downstream consumers of these packages were exposed without any visible indicators of compromise. This attack underscores the cascading trust problem in modern software supply chains: one compromised maintainer or third-party action can propagate malicious code to thousands of dependent projects.
Tactical Insight
Immediate actions
- Audit all npm packages published under your organization's scope for unexpected version releases or modified package contents.
- Rotate all npm publishing tokens, CI/CD secrets, and deployment credentials that may have been exposed through compromised GitHub Actions workflows.
- Pin third-party GitHub Actions to specific commit SHAs rather than mutable tags to prevent silent substitution of malicious versions.
Long-term improvements
- Implement mandatory code signing and provenance attestation (e.g., npm provenance, Sigstore) for all published packages to verify authorship integrity.
- Enforce least-privilege permissions on GitHub Actions workflows, restricting `id-token: write` and deployment permissions to only workflows that explicitly require them.
- Establish a vetted allowlist of approved third-party GitHub Actions and require security review before any new external action is introduced into CI/CD pipelines.
Detection measures
- Enable npm publish audit logging and alert on any package version release that was not initiated through a known, approved CI/CD pipeline.
- Deploy software composition analysis (SCA) tools in CI/CD pipelines to detect unexpected changes in transitive dependencies or package checksums.
- Monitor GitHub Actions workflow logs for anomalous secret access patterns or unexpected interactions with npm registries.