Authorization disclaimer. This walkthrough is limited to the intentionally vulnerable PortSwigger Web Security Academy lab linked below. Test only systems you own or are explicitly authorized to assess.
Overview
The persistent-login token is base64(username + ':' + md5(password)). Decoding my own cookie exposed an unsalted password hash, making it possible to calculate candidate cookies for Carlos and test them against GET /my-account.

Lab objective/setup
Use the supplied account to inspect a legitimate stay-logged-in cookie. The objective is to forge Carlos’s cookie, open his account, and use the lab’s synthetic delete-account action.
What I observed
Selecting Stay logged in produced a long encoded value. Base64 decoding revealed username:hash; comparison with the known password established that the second component was MD5. No server secret or random token contributed to the credential.


![Base64 decoding the cookie yields `wiener:[md5-digest]`, exposing a username followed by a digest.](/images/portswigger/authentication/lab-brute-forcing-a-stay-logged-in-cookie/step-4.png)
Why it is vulnerable
The server accepts a cookie containing only a public username and a fast, unsalted password digest. Weak passwords can therefore be converted directly into valid persistent-login tokens, while the account endpoint acts as a response oracle for each guess.
Walkthrough in the authorized PortSwigger lab
- Log in with Stay logged in enabled, copy the cookie, and decode it to confirm
base64(user:md5(password)). - Send
GET /my-accountto Intruder and mark only thestay-logged-invalue as the payload position. - Load the Academy password list. Apply MD5, add the prefix
carlos:, and Base64-encode the combined value for every candidate. - Run the attack and identify the response with the distinctive
302redirect, which indicates that the generated cookie authenticated as Carlos. - Open that response in the browser and use the lab’s delete-account control to complete the objective.




Verification
The decisive Intruder result is the single 302 response among rejected guesses. Following that response opens Carlos’s account, and the Academy solved banner appears after the synthetic account is deleted.

Impact and defensive lesson
Persistent-login cookies should be random, revocable server-side tokens, never encodings of passwords or password hashes. Use modern password hashing for stored credentials, rate-limit authentication attempts, rotate persistent sessions after use, and invalidate them on password changes or logout.