⚙️ 09. — Brute-forcing a Stay-Logged-In Cookie
The stay-logged-in cookie was built as Base64 of the username plus an unsalted MD5 hash of the password, so it could be decoded and regenerated for any user. An attacker with a password wordlist could brute-force another user's cookie and access their account.
medium.com
Published on medium.com
5. 🖱️ Click on the GET /my-account?id=wiener request → Inspector panel → expand "Request Cookies" → click stay-logged-in
The full write-up lives on its author's site
It belongs to its author, so we link to it rather than copy it. The other two tabs are our own rewrites, checked against it.
Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.
How it worked
Root cause
Likely the application used a predictable, client-side cookie format of Base64(username:MD5(password)) instead of an opaque random token stored server-side.
Impact
An attacker could brute-force another user's stay-logged-in cookie from a password list and access that user's account.
What the attacker needed
A free account; victim has a guessable password; attacker can send requests to the site
The fix
The cookie should be replaced with an opaque random token stored server-side, and any password hashing should use a slow salted algorithm such as bcrypt or argon2.
How it was found
- Log in with the stay-logged-in option ticked and inspect the cookie in Burp.
- Decode the cookie and confirm the format is username:MD5(password).
- Log out, send the account request to Intruder and mark the cookie value as the payload position.
- Add payload processing rules: MD5 hash, add the username prefix, then Base64-encode.
- Test the rules with your own password and a Grep Match for the account page text.
- Change the URL to the victim, change the prefix, load the password wordlist and run the attack.
Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.
Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.
When you tick 'stay logged in', the site gives your browser a cookie so it remembers you. Here the cookie was not a random secret: it was just your username and a fingerprint (hash) of your password, encoded in a reversible way. Because that fingerprint is quick to compute, someone could try many passwords offline and build a valid cookie for another person.
What is Account takeover?
Getting into someone else's account through a flaw in sign-in, password reset, second factor, single sign-on or session handling.