User Input Passed Directly to PhantomJS Command Arguments
Express applications construct PhantomJS command-line invocations using child_process.exec() or spawn() with user-controlled input directly in arguments. Code concatenates user input into PhantomJS commands: exec('phantomjs render.js ' + userUrl) or spawn('phantomjs', ['script.js', req.query.url]). Attackers inject shell metacharacters (semicolons, pipes, backticks) or PhantomJS-specific arguments to execute arbitrary commands. PhantomJS command injection allows attackers to read files using --local-to-remote-url-access=yes flag, execute JavaScript through injected page URLs, or chain with other PhantomJS options for code execution.