DEV Community

CTFDojo
CTFDojo

Posted on Originally published at ctfdojo.com

PicoCTF GET aHEAD Writeup — Get the Flag with an HTTP HEAD Request

The two buttons send GET and POST. The challenge name hints at a third method: HEAD. curl -I sends one, and the flag appears as a response header.

  • Platform: picoGym
  • Verified against: vivian-dai's picoCTF 2021 writeups
  • Category: Web Exploitation
  • Difficulty: Beginner
  • Tools: curlBurp Suite

Challenge description

A page with two buttons, "Choose Red" and "Choose Blue", that change the background colour. The name of the challenge is the real hint.

Provided: a link to the challenge page

Step 1 — See which methods the page uses

View the page source (Ctrl+U). The two forms differ only in their method:

<form action="index.php" method="GET">  ... Choose Red
<form action="index.php" method="POST"> ... Choose Blue
Enter fullscreen mode Exit fullscreen mode

So the server reacts to the HTTP method. "aHEAD" points at another one: HEAD, which asks for a response's headers without the body.

Step 2 — Send a HEAD request

curl -I sends a HEAD request and prints the response headers:

$ curl -I http://CHALLENGE/index.php
HTTP/1.1 200 OK
flag: picoCTF{***}
Content-type: text/html; charset=UTF-8
Enter fullscreen mode Exit fullscreen mode

The flag comes back as a custom header. In Burp Suite, the same works by changing GET to HEAD in Repeater.

🚩 picoCTF{ flag intentionally hidden }

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

Key takeaways

HTTP methods are part of the request you control:

  • Browsers only send GET and POST from forms — other methods need curl, Burp or code
  • curl -I sends HEAD; curl -X METHOD sends any method
  • Always look at response headers, not just the page body

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

Top comments (0)