Breaking NewsLow

NPM’s Shai-Hulud Supply Chain Defenses Bypassed via Git Dependencies

3 min readSource: BleepingComputer

Researchers reveal critical flaws in NPM’s post-Shai-Hulud security controls, enabling attackers to exploit Git dependencies in supply chain attacks.

NPM’s Shai-Hulud Security Measures Bypassed via Git Dependencies

Security researchers have identified critical weaknesses in NPM’s supply chain defenses, introduced after the high-profile Shai-Hulud attacks, which allow threat actors to bypass protections by exploiting Git dependencies. The findings highlight persistent risks in the JavaScript ecosystem’s dependency management.

Key Findings

In 2021, NPM implemented enhanced security controls following the Shai-Hulud supply-chain attacks, which involved malicious packages compromising downstream applications. However, researchers have now demonstrated that attackers can circumvent these defenses by leveraging Git-based dependencies—packages hosted directly in Git repositories rather than the NPM registry.

Unlike traditional NPM packages, Git dependencies are not subject to the same security scans, signature verifications, or metadata validations. This oversight creates a blind spot, enabling attackers to:

  • Inject malicious code into dependencies without detection.
  • Exploit trust relationships in open-source projects.
  • Bypass NPM’s automated security checks, including package signing and provenance verification.

Technical Details

NPM’s post-Shai-Hulud defenses include:

  • Package signing to verify publisher authenticity.
  • Provenance checks to validate package origins.
  • Automated malware scanning for registry-hosted packages.

However, Git dependencies—referenced via URLs in package.json (e.g., git+https://github.com/user/repo.git)—are not processed through these safeguards. Attackers can:

  1. Host malicious packages in public or private Git repositories.
  2. Trick developers into including them via typosquatting or social engineering.
  3. Execute arbitrary code during installation, compromising build environments.

Impact Analysis

The vulnerability exposes organizations to:

  • Supply chain attacks targeting CI/CD pipelines.
  • Data exfiltration or backdoor deployment via compromised dependencies.
  • Reputational damage for projects unknowingly distributing malicious code.

Git dependencies are widely used in enterprise and open-source projects, amplifying the risk. High-profile libraries or tools with transitive dependencies on Git-hosted packages could inadvertently propagate threats.

Recommendations

Security teams and developers should:

  1. Audit package.json files for Git dependencies and replace them with registry-hosted alternatives where possible.
  2. Implement dependency scanning tools (e.g., GitHub Dependabot, Snyk) to detect malicious Git references.
  3. Enforce strict code review policies for Git-based dependencies, including manual validation of repository sources.
  4. Use NPM’s --omit=dev flag during installation to exclude development dependencies that may hide risks.
  5. Monitor for anomalous behavior in build systems, such as unexpected network requests or file modifications.

Next Steps

NPM has not yet released a patch or mitigation for this issue. Organizations are urged to adopt defense-in-depth strategies, including:

  • Isolated build environments to limit the impact of compromised dependencies.
  • Software Bill of Materials (SBOM) generation to track dependency origins.
  • Zero-trust principles for dependency management, treating all external code as untrusted by default.

The discovery underscores the need for continuous vigilance in securing open-source supply chains, particularly as attackers shift tactics to exploit overlooked attack surfaces.

Share