Skip to main content
Malicious PostCSS Packages on npm: A Supply Chain Attack TeardownIncident
4 min readFor Security Engineers

Malicious PostCSS Packages on npm: A Supply Chain Attack Teardown

What Happened

A user named 'abdrizak' published three malicious npm packages disguised as legitimate PostCSS tools: aes-decode-runner-pro, postcss-minify-selector, and postcss-minify-selector-parser. These packages delivered a Windows-based remote access trojan through a multi-stage payload chain. The attack used a JavaScript dropper to execute PowerShell scripts that downloaded additional malware from nvidiadriver[.]net, enabling credential theft and remote command execution on compromised developer machines.

The packages exploited trust in the PostCSS ecosystem—a widely-used CSS processing library with millions of weekly downloads. Developers searching for PostCSS utilities could easily mistake these packages for legitimate tools due to their convincing naming.

Timeline

While specific discovery and publication dates aren't available, JFrog's security research team identified and analyzed the attack chain. The packages remained available on npm until detection and removal, potentially exposing any developer who installed them during that window.

This timeline gap highlights a critical problem: you might install a malicious package today and not realize it until weeks later when the compromise becomes evident through credential theft or unauthorized access.

Which Controls Failed or Were Missing

No Pre-Installation Verification

Organizations lacked automated scanning of dependencies before installation. The JavaScript dropper and PowerShell execution chain should have triggered alerts during any security review. These were straightforward malicious scripts that static analysis tools can detect.

Missing Runtime Monitoring

Developer workstations allowed npm install scripts to write files to disk and execute PowerShell without triggering security alerts. The malware downloaded a payload from an external domain (nvidiadriver[.]net) and established command-and-control communications—all activities that endpoint detection should flag immediately.

No Dependency Attestation

Teams installed packages without verifying publisher identity or checking for npm provenance attestations. The 'abdrizak' account had no established reputation, no verified organization backing, and published packages with names similar to legitimate tools. None of these red flags stopped the installation.

Absent Network Egress Controls

Developer machines could reach out to arbitrary external domains without restriction. Once the PowerShell script executed, it downloaded the next-stage payload with no network-level blocking or alerting.

What the Standards Require

PCI DSS v4.0.1 Requirement 6.3.2 mandates that custom software undergoes security review before deployment. This includes a review of custom code to identify potential vulnerabilities. Your npm dependencies are part of your build process—they execute code on developer machines that often have access to production secrets and customer data.

NIST 800-53 Rev 5 Control SA-12 (Supply Chain Protection) requires organizations to employ supply chain risk management processes and assess supply chain risks associated with organizational systems. Installing npm packages without verification violates this control. You need documented processes for vetting third-party code before it enters your environment.

ISO 27001 Control 5.19 (Information Security in Supplier Relationships) demands that you define and document information security requirements for mitigating risks associated with supplier access to your assets. When you run npm install, that package supplier gains code execution on your machines. Treat it accordingly.

SOC 2 Type II CC6.6 requires monitoring of system components, including the deployment of new software. Your auditor will ask how you validate the integrity of third-party code before it runs in your environment. "We trust npm" isn't an acceptable answer.

Lessons and Action Items for Your Team

Implement Automated Dependency Scanning

Deploy tools like Socket Security, Snyk, or GitHub Dependency Review in your CI/CD pipeline. Configure them to fail builds when they detect packages with suspicious install scripts, network activity, or filesystem access. Don't just scan for known vulnerabilities—scan for malicious behavior patterns.

Set up alerts for new dependencies added to your package.json. Every new package should require approval from someone on your security team who can verify the publisher's identity and review the package contents.

Lock Down Developer Workstations

Configure endpoint detection to alert on PowerShell execution initiated by Node.js processes. Use application allowlisting to prevent npm install scripts from writing executables outside of node_modules. Restrict network egress from developer machines to known-good domains using your firewall or DNS filtering.

Your developers may complain that this slows them down. They're right—it does. But the time spent reviewing a dependency is far less than the time spent responding to a credential theft incident.

Verify Package Provenance

Enable npm's provenance attestation checking by running npm config set fetch-provenance true. This won't catch all malicious packages, but it helps verify that packages actually came from the claimed source repository. Reject packages without provenance data unless you've manually reviewed them.

Create an internal allowlist of approved npm packages. For packages outside that list, require a security review before use. Yes, this creates friction. That friction is your defense against supply chain attacks.

Monitor for Typosquatting

The PostCSS packages used convincing names that could easily fool a developer in a hurry. Set up alerts for package names that closely match your commonly-used dependencies. Tools like npm-diff can help you compare package contents before upgrading.

Review your package.json files quarterly for packages you don't recognize. Developers add dependencies constantly; security teams need to audit them regularly.

Incident Response Planning

Document what you'll do when you discover a malicious package in your environment. Who investigates? How do you determine the blast radius? What credentials need rotation? Which systems need reimaging?

The 'abdrizak' packages could steal credentials and execute arbitrary commands. If you installed one, assume full workstation compromise. Your incident response plan needs to account for that scope.

Supply chain attacks succeed because we've trained developers to trust package managers implicitly. Breaking that trust—and building verification processes to replace it—is how you prevent the next one.

PowerShell Security Best Practices

Topics:Incident

You Might Also Like