Network-wide security flaw discovered in NPM package

“Pac-resolver” vulnerability could lead to remote code execution

Software code downloaded almost three million times a week could enable hackers to remotely execute code on a victim’s system.

The code in question is the popular NPM package "pac-resolver." The flaw, which could allow hackers on a local network to execute arbitrary code within a Node.js process whenever it tries to make an HTTP request, was discovered by developer Tim Perry.

The package is used for PAC file support in Pac-Proxy-Agent, which is used in Proxy-Agent. This is the standard for HTTP proxy auto-detection and configuration in Node.js. The package is used extensively, from AWS's CDK toolkit to the Mailgun SDK to the Firebase CLI, and it racks up to three million downloads every week.

Perry found the bug while adding proxy support to HTTP Toolkit. The flaw affects software that depends on Pac-Resolver before v5.0.0 (even transitively) in a Node.js application. 

The flaw affects any code using PAC files for proxy configuration or whatever proxy configuration is used by the target operating system that uses the WPAD protocol or a  proxy configuration from an untrusted source.

“In any of those cases, an attacker (by configuring a malicious PAC URL, intercepting PAC file requests with a malicious file, or using WPAD [Web Proxy Auto-Discovery Protocol]) can remotely run arbitrary code on your computer any time you send an HTTP request using this proxy configuration,” Perry added.

The Pac-Proxy-Agent doesn't sandbox PAC scripts correctly, according to Perry. Internally, it uses two modules — Pac-Resolver and Degenerator — from the same author to build the PAC function. This means code running in one JavaScript virtual machine could access external data in the main node.js application, hence a remote code execution bug in the proxy configuration process.

“If you're in this situation, you need to update (to Pac-Resolver v5 and/or Proxy-Agent v5) right now,” said Perry.

When it comes to so-called supply chain bugs of this sort, “you can outsource the coding, but you can’t outsource the responsibility” wrote Paul Ducklin, principal research scientist at Sophos

“Some bugs are only found because someone decided to take a careful look, as Tim Perry did here,” he added.

The vulnerability, formally named  CVE-2021-23406, has since been fixed in v5.0.0 of all those packages.

Featured Resources

How virtual desktop infrastructure enables digital transformation

Challenges and benefits of VDI

Free download

The Okta digital trust index

Exploring the human edge of trust

Free download

Optimising workload placement in your hybrid cloud

Deliver increased IT agility with the cloud

Free Download

Modernise endpoint protection and leave your legacy challenges behind

The risk of keeping your legacy endpoint security tools

Download now

Recommended

Russia's "politically motivated" REvil raid could be used as leverage, experts warn
ransomware

Russia's "politically motivated" REvil raid could be used as leverage, experts warn

17 Jan 2022
Meta files lawsuit to uncover hackers targeting Facebook, WhatsApp
phishing

Meta files lawsuit to uncover hackers targeting Facebook, WhatsApp

21 Dec 2021
Five things to consider before choosing an MFA solution
Security

Five things to consider before choosing an MFA solution

17 Dec 2021
Australia and US sign CLOUD Act data-sharing deal to support criminal investigations
cyber crime

Australia and US sign CLOUD Act data-sharing deal to support criminal investigations

16 Dec 2021

Most Popular

How to move Microsoft's Windows 11 from a hard drive to an SSD
Microsoft Windows

How to move Microsoft's Windows 11 from a hard drive to an SSD

4 Jan 2022
Microsoft Exchange servers break thanks to 'Y2K22' bug
email delivery

Microsoft Exchange servers break thanks to 'Y2K22' bug

4 Jan 2022
Synology DiskStation DS2422+ review: A cube of great capacity
network attached storage (NAS)

Synology DiskStation DS2422+ review: A cube of great capacity

10 Jan 2022