Dev.to Security 🔐 Cybersecurity 👁 2 📖 1 min read

PicoCTF logon Writeup — Become Admin by Editing a Cookie

Log in with any username and password. The server sets a cookie admin=False; change it to True in DevTools and reload — the flag appears. Platform: picoGym Verified against: thomasbui's picoCTF 2019 writeup Category

Log in with any username and password. The server sets a cookie admin=False; change it to True in DevTools and reload — the flag appears.

  • Platform: picoGym
  • Verified against: thomasbui's picoCTF 2019 writeup
  • Category: Web Exploitation
  • Difficulty: Beginner
  • Tools: Browser DevToolscurl

Challenge description

The site belongs to a company that "doesn't seem to care about security". The login works for any name except Joe, but a normal user is told there's no flag for them.

Provided: a link to a login page

Step 1 — Log in with anything

Enter any username and password (avoid Joe, which is rejected). You get in, but the page says there's no flag for you.

If a login accepts arbitrary credentials, the decision about what you can see must be made somewhere else — usually a cookie.

Step 2 — Inspect the cookies

Open DevTools (F12) → Application (Chrome) or Storage (Firefox) → Cookies. Alongside your username and password, there's one more:

admin    False

The server stores your authorization level on the client, in plain text, with no signature.

Step 3 — Flip it to True

Double-click the value, change it to True, and reload the page. The flag is shown.

From the command line, send the cookie yourself:

$ curl -b 'admin=True' http://CHALLENGE/flag

🚩 picoCTF{ flag intentionally hidden }

The flag is deliberately hidden — follow the method, you've earned it. 💪

Key takeaways

Anything stored on the client can be changed by the client:

  • Cookies are user input — a server must never trust them for authorization
  • DevTools lets you read and edit cookies directly
  • Signed or server-side sessions are the fix for this class of bug

Originally published on CTFdojo — join the CTFdojo Discord to discuss writeups and get notified about new ones.

📰 Read the original article on Dev.to Security

Originally published by Dev.to Security. Aggregated on AIWithGhost for educational purposes — full credit and traffic to the original publisher.