Hiking-Logbook

Security Audit Report: NPM Supply Chain Attack (Debug & Chalk)

Summary

This report documents a significant NPM supply chain attack that compromised 18 popular packages, including debug and chalk, through a phishing attack on a maintainer’s account. The attack resulted in malicious code being injected into legitimate packages, targeting crypto/web3 wallet activity.

1. What Caused the Supply Chain Attack? (Point of Failure)

The point of failure was the compromise of a maintainer’s NPM account through a phishing email:

2. List of Compromised Packages and Their Versions

According to the Aikido blog report, the following 18 packages were compromised:

Package Compromised Version
backslash 0.2.1
chalk-template 1.1.1
supports-hyperlinks 4.1.1
has-ansi 6.0.1
simple-swizzle 0.2.3
color-string 2.1.1
error-ex 1.3.3
color-name 2.0.1
is-arrayish 0.3.3
slice-ansi 7.1.1
color-convert 3.1.1
wrap-ansi 9.0.1
ansi-regex 6.2.1
supports-color 10.2.1
strip-ansi 7.1.1
chalk 5.6.1
debug 4.4.2
ansi-styles 6.2.2

3. Report of Our Packages

Frontend Audit Results

Status: NOT COMPROMISED by the supply chain attack

Audit Summary:

Current Vulnerabilities:

Backend Audit Results

Status: CLEAN - No vulnerabilities found

Audit Summary:

Overall Risk Assessment

4. Report of Our Packages’ Packages (Sub-dependencies)

Sub-dependency Analysis

Status: SAFE - No compromised packages found in sub-dependencies

Frontend Sub-dependency Check:

Backend Sub-dependency Check:

5. Measures to Avoid Being Infected by Upstream Packages (Protecting Against Supply Chain Attacks)

Immediate Actions

  1. Use Lock Files: Ensure package-lock.json files are committed and used to pin dependencies to exact versions
  2. Run Security Audits: Execute npm audit regularly and address all vulnerabilities
  3. Automated Scanning: Implement tools like:
    • Socket.dev for real-time monitoring
    • GitHub Dependabot for automated updates

Package Selection Criteria

Regular Monitoring

6. Measures to Avoid Your Product Being Infected (Protecting Your Own Project)

Development Security

  1. Dependency Review Policies: Implement mandatory review processes before adding new packages
  2. Static Analysis: Use tools to detect obfuscated or suspicious code in dependencies
  3. Sandbox Testing: Test new dependencies in isolated environments before production use
  4. Runtime Monitoring: Monitor application runtime for unexpected network calls or behavior

CI/CD Security Implementation

  1. Security Scans: Integrate security scanning into CI/CD pipelines
  2. Automated Testing: Run security tests as part of the build process
  3. Dependency Updates: Implement automated, controlled dependency updates

8. Conclusion

This supply chain attack highlights the critical importance of dependency security in software development.

The key takeaway is that security is not just about protecting your own code, but also about carefully managing and monitoring all external dependencies throughout their lifecycle.