Skip to main content
Blog
Blog

Supply Chain Risk Doesn't End At NPM

By only checking NPM (or another registry), you're not protected from attacks through third-party scripts.

May 30, 2024 3 min read
Client-side security is not just npm illustration
Table of Contents

TL;DR: browser-fetched third-party scripts outside registry scanning coverage

  • Green scan is not done: Everyone treats a green Socket scan as supply-chain done, but US supply-chain attacks rose 115% between 2022 and 2023 and 95% of browser-fetched scripts have no protection against DNS hijack, so the registry is one layer of many.
  • Full-code checks: cside checks the full code of every third-party source 100% of the time before it renders in a user's browser, monitors over 60 attributes with AI, and takes historical context into account, which is what a registry scanner cannot do once code is delivered dynamically to production sessions.
  • The unwatched slice: Socket handles the install step, Cloudflare's WAF handles inbound, Hadrian and Cycognito handle the outside surface, so the decision is not which of them to keep, it is whether the browser-runtime slice between install and inbound is monitored the same way or left to trust.

Short on time? See cside's in-browser Magecart and skimmer blocking. It covers everything below in one deployment.

Supply Chain attacks are a top of mind problem today. The number of these attacks in the US increased by 115% between 2022 and 2023, according to Statista. Tools like Socket and Coana detect harmful code in registries like NPM. But the supply chain risk doesn't end there.

Diagram of client-side security risks from dynamically injected third-party content

Some tools are 3rd party scripts that get fetched by the browser of the user. By only checking NPM (or another registry), you're not protected from attacks through these scripts.

These scripts, used for marketing tracking, ads, captchas, and much more, are frequently implemented across entire sites for convenience. These scripts are powerful and can things like rewrite code, redirect users, exfiltrate data, and even mine crypto in your browser.

The delivery method of these scripts allows for dynamic behavior. Any user can get a different delivery each time, especially when a script has been compromised.

As more people adopt better dependency security approaches, dynamic scripts that get fetched browser-side are an increasingly interesting and substantial attack vector. This makes checking sources alone a risky game. The better approach, is checking the full code every time it gets delivered, which is what cside does.

Many of these scripts also aren't maintained by tech-centric companies. Tools may become neglected as companies dissolve or are acquired, leaving them susceptible to hijacks. Even reputable, widely-used services are not without their faults, as evidenced by cdnjs issues in 2021 or this person who bought expired police and social services domain in Belgium and got access to private info that way.

Finally, 95% of these scripts lack protections against DNS hijacks. Even the network you are on may impact the script you get.

What to do about all of this

Here's what we recommend:

Use a tool like Socket (or alternatives) for supply chain risk on the registry and use cside to monitor the behavior by 3rd party scripts browser-side. We check the full code of 3rd party sources, 100% of the time, before it get's delivered to the browser of your user. Securing this side of the supply chain fully.

Lastly, you should protect your infrastructure against inbound attacks. For that use something like Cloudflare's Web Application Firewall.

More niche things like form uploads and bot detection may require specialist tooling.

Use proactive monitoring tools like Hadrian or Cycognito to monitor the threat surface.

Diagram showing the layers of supply chain risk beyond npm packages

Simon Wijckmans
Founder & CEO

Founder and CEO of cside. Previously a product manager on Cloudflare Page Shield (now Cloudflare Client-Side Security). Co-chair of the W3C Anti-Fraud Community Group and a Forbes 30 Under 30 honoree. Building accessible security against client-side attacks, web security is not an enterprise-only problem.

FAQ

Frequently Asked Questions

Build-time dependencies are one source of risk, but runtime third-party scripts, CDNs, and dynamically-loaded content all execute in the browser too. An attacker only needs to compromise one of those layers to reach your users.

Cover CDNs, tag managers, A/B testing tools, analytics, payment SDKs, and any script that loads scripts. Client-side monitoring like cside watches each of these at runtime instead of only at the install step.

Monitor and Secure Your Third-Party Scripts

Gain full visibility and control over every script delivered to your users to enhance site security and performance.

Start free, or try Business with a 14-day trial.

cside dashboard interface showing script monitoring and security analytics
Related Articles
Book a demo

Want to walk through this with an engineer?

Thirty minutes, on your own site. Not a slide deck.

We'll show you:

Which third-party scripts are running on your site right now
Where you stand on PCI DSS 6.4.3 and 11.6.1
How much of your traffic is bots and AI agents

Rather just send a question?

Finding open slots…

Real humans only. We'd know.

Having trouble booking? Open scheduler in a new tab

What are you trying to solve?

Tell us in a line and we'll come back with something useful, not a generic pitch.

We usually help with:

Seeing which third-party scripts run on your site
PCI DSS 6.4.3 and 11.6.1 evidence
Bots, AI agents and account takeover

Prefer to just book a time? Pick a slot instead