Kiuwan logo

Defending Your Software Supply Chain: How to Use Kiuwan Against Shai-Hulud, Log4J, and Polyfill Attacks

Defending-Your-Software-Supply-Chain-How-to-Use-Kiuwan-Against-Shai-Hulud-Log4J,-and-Polyfill-Attacks-blog-image

A practical guide to detecting and responding to open source supply chain compromises using SAST, SCA, and proactive security monitoring.  

The threat landscape: When your dependencies become attack vectors 

Software supply chain attacks have evolved from theoretical risks to front-page news. The attacks keep coming, and they’re getting more sophisticated: 

Log4Shell (2021)

Log4Shell (2021) taught us that a single vulnerability in a ubiquitous logging library could expose millions of applications overnight. Organizations scrambled to answer one question: “Do we even use Log4j?” 

Polyfill.io (2024)

Polyfill.io (2024) showed how a trusted CDN service could be weaponized after acquisition, injecting malicious code into over 100,000 websites that thought they were loading a legitimate JavaScript polyfill library.

Shai-Hulud (2025) 

Shai-Hulud (2025) represents the next evolution—a self-replicating worm spreading through the node package manager (npm) ecosystem, compromising developer accounts and poisoning packages in a cascading chain of infections. Named after the giant sandworms of Frank Herbert’s Dune, this threat burrows through the open source landscape, consuming everything in its path. 

The question isn’t whether your organization will face a supply chain attack: The question is whether you’ll know about it before it’s too late.

Understanding Shai-Hulud: A new kind of supply chain threat 

Unlike vulnerability disclosures, where a CVE is published, and vendors rush to patch, Shai-Hulud operates differently, which makes it particularly dangerous. 

How Shai-Hulud Works 

Credential Theft

The worm exfiltrates GitHub tokens, CI/CD credentials, and cloud secrets from compromised developer machines. These stolen credentials become the keys to the next wave of infections. 

Package Poisoning

Using stolen credentials, attackers gain maintainer access to legitimate npm packages. They inject malicious preinstall scripts that execute during the build process—often before any security scanning occurs. 

Self-Replication

Each compromised package potentially compromises more developers, who maintain more packages, creating an exponential spread pattern. As of this writing, over 700 npm packages have been impacted, and that number continues to grow. 

Stealth Operations

The malicious code often executes during npm install , before your application even runs. Traditional runtime security tools never see it. 

Why Traditional Approaches Fall Short 

The challenge with Shai-Hulud and generally with supply chain attacks is that you’re not looking for a single CVE. You’re looking for: 

  • Packages that were legitimate but are now compromised 
  • Versions that were published with stolen credentials 
  • Code changes that don’t look obviously malicious 
  • An ever-growing list of affected packages (700+ and counting) 

No single tool or approach solves this completely but with the right combination of Kiuwan capabilities, you can significantly reduce your exposure and response time. 

Two Perspectives: Maintainers vs. Consumers 

Your defensive strategy depends on your relationship to the open source ecosystem. 

If you maintain open source packages 

You’re a potential target for credential theft and package hijacking. Your defenses should include: 

Vigilant Code Review: Block any pull requests from contributors you don’t recognize, especially those modifying build scripts, package.json, or CI/CD configurations.

SAST Scanning of Your Own Code: Use Kiuwan Code Security to scan your repository regularly. Look for: 

  • Unauthorized changes to build scripts 
  • New network calls or data exfiltration patterns 
  • Obfuscated code that wasn’t there before 
  • Changes to dependency specifications 

Credential Hygiene: Rotate your npm tokens regularly. Enable 2FA on npm and GitHub. Never store credentials in code—Kiuwan’s hardcoded credentials detection, coming in 2026, can help enforce this. 

If you consume open source packages 

This is most organizations. You depend on packages maintained by others, and you need visibility into what you’re actually using. 

Challenge 1: Do you even know what packages you’re using? 

Many organizations can’t answer this question with confidence. Transitive dependencies (dependencies of your dependencies) often outnumber direct dependencies 10:1.

Challenge 2: How do you know if a package is compromised? 

There’s no single authoritative list of Shai-Hulud-infected packages, and the list keeps growing. By the time a package is publicly identified, it may have been compromised for days or weeks. 

Challenge 3: What do you do when you find something? 

Pin to the last known-good version? Remove the dependency entirely? Wait for the package to be cleaned up? 

Let’s walk through how Kiuwan helps with each of these challenges.

Using Kiuwan Insights to map your exposure 

Kiuwan Insights, our Software Composition Analysis (SCA) solution, is your first line of defense for understanding what you’re actually using. 

Step 1: Generate your SBOM 

Run a Kiuwan Insights scan against your codebase to generate a complete Software Bill of Materials (SBOM). This gives you: 

  • Every direct dependency you’ve declared 
  • Every transitive dependency pulled in automatically 
  • Version information for each component 
  • License data (useful for compliance, but that’s another blog post) 

For a Node.js project, Kiuwan analyzes your package.json and package-lock.json (or yarn.lock) to build the complete dependency tree. 

Pro Tip: Run this scan regularly, not just once. Your dependency tree changes with every npm install or npm update. Set up automated scans in your CI/CD pipeline to maintain current visibility.

Step 2: Export and analyze 

Once you have your SBOM, you can export it for analysis. For a threat like Shai-Hulud where the list of affected packages keeps growing, you’ll want to: 

  1. Get the latest threat intelligence: Monitor security advisories, npm security announcements, and community resources tracking Shai-Hulud infections. 
  2. Cross-reference your SBOM: Write a simple script or use a spreadsheet to compare your dependencies against the known-compromised list. 
  3. Identify direct vs. transitive exposure: A direct dependency gives you control—you can pin the version or remove it. A transitive dependency requires understanding which of your direct dependencies pulls it in. 

Here’s a simple approach using exported SBOM data:

# Example: Cross-reference SBOM against compromised packages 
compromised_packages = load_compromised_list()   
# Your threat intel source 
sbom_components = load_sbom_export()   
# Kiuwan Insights export 
 
for component in sbom_components: 
	if component.name in compromised_packages: 
    	print(f"ALERT: {component.name}@{component.version} is potentially compromised") 
    	print(f"  - Introduced by: {component.parent_dependency}") 

Step 3: Continuous monitoring 

Set up Kiuwan to scan on every commit or at least daily. When the compromised package list updates, your next scan will flag any new exposures. 

Using Kiuwan SAST to hunt for specific threats 

While SCA tells you what packages you’re using, SAST (Static Application Security Testing) can look for specific patterns in your code—including patterns associated with known attacks. 

Custom rules for known threats 

Kiuwan Code Security supports custom rules that let you hunt for specific strings, patterns, or code constructs. You can observe this being implemented with the Log4j and Polyfill detection

For a short list of known threats

Create a custom rule that searches for the package name or malicious pattern. For example, here’s a guide to adding a rule that flags any import of  polyfill.io.

For Log4j

We have rules that detect Log4j usage and flag versions vulnerable to Log4Shell (CVE-2021-44228). The rule triggers on the presence of vulnerable Log4j patterns, allowing you to catch exposure even in projects where dependency management is incomplete. 

The Shai-Hulud challenge: Scale 

Here’s where Shai-Hulud gets tricky. With 700+ compromised packages and counting, creating individual rules for each package name isn’t practical. Instead, consider these approaches: 

Option A: Consolidated Pattern Rule 

Create a single rule with a large pattern set that matches known compromised package names. Update the rule as the threat intelligence updates.

// Conceptual approach 
Patterns: [ 
	"compromised-package-1", 
	"compromised-package-2", 
	// ... hundreds more 
] 

Reference this Polyfil.io blog post to learn how to add a custom rule. The downside: maintaining this list requires ongoing effort, and the rule file becomes unwieldy. 

Option B: Targeted high-risk rule + SCA coverage 

Create SAST rules for the most critical or commonly-used compromised packages (the “greatest hits”), while relying on SCA for comprehensive coverage. This gives you: 

  • SAST rules with Audit enforcement for high-priority packages 
  • SCA scanning for the complete dependency tree 
  • Manageable rule maintenance 

Option C: Dedicated detection model 

Create a Kiuwan Model that contains only your supply chain threat rules. Run this model in a separate scan, perhaps daily via Jenkins, with aggressive Kiuwan Audit settings. If anything triggers, break the build or send alerts. 

This approach lets you: 

  • Run supply chain checks frequently without full scan overhead 
  • Set Audit rules to fail on any positive hit (zero tolerance) 
  • Maintain separation between supply chain checks and broader code quality scans

Practical implementation: A defense-in-depth workflow 

Here’s how to put it all together: 

Daily operations 

  1. Automated SCA scans: Kiuwan Insights runs on every commit to main/master, generating current SBOM data and flagging known-vulnerable dependencies. 
  2. SAST integration:Kiuwan Code Security runs in your CI/CD pipeline, checking for:
    1. Hardcoded credentials (prevents credential theft from your repo) 
    2. Insecure coding practices 
    3. Custom rules for high-priority supply chain threats 
  3. Policy Enforcement: Configure Kiuwan Audit policies to block builds that:
    1. Introduce dependencies with critical vulnerabilities 
    2. Reference known-compromised packages 
    3. Add new dependencies without review 

Weekly operations 

  1. SBOM export and analysis: Export your SBOM and cross-reference against the latest compromised package lists. Automate this if possible. 
  2. Dependency review: Review any pending dependency updates. For Shai-Hulud specifically, consider rejecting all npm package updates until you can verify the update is legitimate. This is conservative but effective. 
  3. Threat intelligence update: Check for updates to the compromised package list. Update your custom rules if using the targeted rule approach.

Incident response 

When you identify a compromised package in your dependency tree: 

  1. Assess exposure: Is it a direct dependency (you control it) or transitive (pulled in by something else)? 
  2. Check version: Is the specific version you’re using affected? Some packages have compromised versions alongside clean ones. 
  3. Pin or remove: Pin to the last known-good version, or remove the dependency entirely if an alternative exists. 
  4. Scan for impact: Run a full Kiuwan scan to check for any indicators of compromise in your codebase. Look for: 
    • Unexplained credential exposure 
    • New outbound network calls 
    • Modified build scripts 
  5. Rotate credentials: If you’ve built with a compromised package, assume your CI/CD credentials may be exposed. Rotate tokens, API keys, and cloud credentials. 

Lessons from Log4j and Polyfill 

These previous incidents taught us valuable lessons that apply directly to Shai-Hulud: 

Log4j lesson: Know your dependencies 

The biggest challenge during Log4Shell wasn’t patching—it was finding all the places Log4j was used. Organizations with mature SCA practices and current SBOMs responded in hours. Those without spent weeks hunting. 

Apply to Shai-Hulud: Your SBOM is your inventory. If you don’t have one, start now. If you have one, make sure it’s current. 

Polyfill lesson: Trust is fragile 

Polyfill.io was a trusted service for years. Developers included it without a second thought. When it was compromised, the trust model broke completely. 

Apply to Shai-Hulud: Even “trusted” packages can be compromised. The npm ecosystem’s trust model—where a maintainer’s credentials grant publishing rights—is exactly what Shai-Hulud exploits. 

Lessons from both incidents: Speed matters 

In both cases, the organizations that responded fastest were those with: 

  • Automated scanning already in place 
  • Clear visibility into their dependency tree 
  • Established processes for emergency patching 
  • Pre-configured policies that could block risky builds

Apply to Shai-Hulud: Don’t wait for the next incident to set up your defenses. The infrastructure you build today is the response capability you’ll have tomorrow.

Getting Started with Kiuwan 

If you’re not already using Kiuwan, here’s how to begin protecting yourself against supply chain threats: 

Step 1: Baseline scan 

Run Kiuwan Insights against your main codebase to generate your first SBOM. Understand what you’re working with. 

Step 2: Identify known vulnerabilities 

Review the Kiuwan dashboard for any dependencies with known CVEs. Prioritize critical and high-severity findings. 

Step 3: Integrate into CI/CD 

Connect Kiuwan to your build pipeline. Start with monitoring mode (scan and report) before enabling blocking policies. 

Step 4: Configure policies 

Set up Audit rules that match your risk tolerance. At a minimum, consider blocking builds that introduce critical vulnerabilities. 

Step 5: Establish ongoing monitoring 

Schedule regular scans, export SBOMs for threat intelligence cross-referencing, and keep your custom rules updated.

Bottom line: The worm keeps moving 

Shai-Hulud is a reminder that software supply chain security isn’t a one-time project—it’s an ongoing practice. The worm is still spreading, the compromised package list is still growing, and the attackers are still finding new maintainer accounts to compromise. 

You can’t control the npm ecosystem. You can’t prevent packages from being compromised. But you can control what enters your codebase, and you can know what you’re using at any given moment. 

That visibility, combined with automated scanning, policy enforcement, and rapid response capabilities, is the difference between finding out about a supply chain attack from your security tools versus finding out from your customers. 

The sandworm is out there. Make sure you can see it coming.

Ready to secure your software supply chain? Start your free Kiuwan trial and get visibility into your dependencies today.


Resources 


About the author 

JD Burke is the Director of Security Products at Sembi with more than 20 years of experience in product management and application security. He has held senior technical roles at Snyk, CyberRes/Fortify, and Kiuwan, with expertise across SAST, SCA, and DevOps integration. JD combines hands-on security knowledge with product leadership, guiding cross-functional teams through planning, feature development, and market positioning while maintaining deep expertise in vulnerability assessment and compliance frameworks.

In This Article:

Request Your Free Kiuwan Demo Today!

Get Your FREE Demo of Kiuwan Application Security Today!

Identify and remediate vulnerabilities with fast and efficient scanning and reporting. We are compliant with all security standards and offer tailored packages to mitigate your cyber risk within the SDLC.

Related Posts

Defending Your Software Supply Chain How to Use Kiuwan Against Shai-Hulud, Log4J, and Polyfill Attacks
© 2025 Kiuwan. All Rights Reserved.