Brute-forcing a stay-logged-in cookie
Last updated
Was this helpful?
Last updated
Was this helpful?
Upon accessing the login page we find that there's a stay logged in checker
When logging in as the user wiener
with the password peter
, I checked the "Stay logged in" option.
After successfully logging in, I observed the following in the GET request:
A cookie named stay-logged-in
was present:
This token appeared Base64 encoded, so I decoded it to see its contents.
Decoding the stay-logged-in
token with Base64 gave the following result:
From this, I identified:
wiener
is the username.
51dc30ddc473d43a6011e9ebba6ca770
is an MD5 hash.
To confirm, I cracked the hash using an online MD5 cracker, and the plaintext was:
The token follows a predictable pattern:
The goal is to access Carlos's account using this flaw. Since I know the token structure, I need to:
Generate carlos:MD5(password)
for each password in the candidate password list.
Encode the result with Base64.
Replace the token in the cookie and send the request to identify the correct password.
To automate this, I used Burp Suite Intruder.
Sending the Request to Intruder:
I sent the GET request (containing the stay-logged-in
cookie) to Burp Suite Intruder.
I highlighted the stay-logged-in
token for brute-forcing.
Configuring Payloads:
I loaded the candidate password list as my payload source.
In the Payload Processing section, I added the following rules to generate the required token format:
Rule 1: Hash each password using MD5.
Rule 2: Add the prefix carlos:
to the hashed value.
Rule 3: Encode the result using Base64.
Running the Attack:
I started the Intruder attack and monitored the response status codes.
Among the responses, I identified a request with a 200 OK status code, indicating the correct password was found. The payload looked like this:
Right-click on the successful request.
Choose Request in browser > In original session.
This action sends the request in my active browser session, and as a result, I successfully accessed Carlos's account page:
To confirm Carlos's password, I extracted the stay-logged-in token from the request payload and decoded it using BASE64. This revealed the following format: