nodejs-exploit

This project will demonstrate how an imported npm package (mocked within the exploit directory), acting as Express middleware, can spawn a child process and execute arbitrary commands sent from an attacker. The result of the executed command will be sent back to the client in the http response.

To start

  • npm install in both server and exploit.
  • npm start in server
  • Construct a GET request with a header called secret containing the value testP@ss123
  • Send GET request to http://localhost:3000/ with your desired command set as a query string param (e.g. http://localhost:3000/?cmd=ls ~)
  • Inspect http response