RCE in Cdnjs and What It Means to You
Last week, a researcher named RyotaK shared a clever supply chain vulnerability in Cloudflare’s highly popular hosted module called cdnjs, which runs on around 12% of all sites on the web. The module helps developers consume other popular packages and integrate them safely into their sites.
The vulnerability was in the cdnjs library update server and could have led to remote code execution on both Cloudflare’s servers and run malicious code on the scripts themselves which are consumed by all end users, bypassing WAFs and any other filtering mechanisms as it runs directly on the browser itself.
You can read a detailed description of the vulnerability here
How 3rd party scripts facilitate supply-chain attacks
3rd parties are becoming extremely common and most sites use them today. In this case, the attacker could use a supply-chain attack to modify 3rd party scripts. In other cases, like magecart (add link to something about magecart) – an attacker modified the script directly and injected code into the end users browsers.
Essentially, the cause and effect in both cases are the same: blindly running untrusted code on your end-users browsers.
How to minimize your attack surface
These require some legwork, but are available freely:
- Use Subresource Integrity hashes for all external content, and demand those from your 3rd party script vendor. You can also generate your own by using openssl or SRI Hash Generator
- Collect CSP reports, whitelist 3rd parties and enforce strict Hash/Nonce-based CSP – https://web.dev/strict-csp/
In GlobalDots, we’re in a unique position to offer holistic web security solutions that prevent and intercept supply chain attacks, as well as other forms of web-borne attacks. Our solutions offer autonomous monitoring, detection and prevention of client side attacks.
While solutions differ in their modus operandi, the end result is the same: They allow you to monitor your end users’ requests and permissions, how your 3rd party scripts are run, and what they are allowed and not allowed to do, in <1 day deployment.
Your ideal solution depends on your business and risk profile. It’s our job to analyze them, implement the best choice, and configure it for utmost protection and flexibility at work.
Contact us for effortless, worriless security of your web assets.