> For the complete documentation index, see [llms.txt](https://kunalwalavalkar.gitbook.io/write-ups/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://kunalwalavalkar.gitbook.io/write-ups/picoctf/web-exploitation/cookies.md).

# Cookies

> Who doesn't love cookies? Try to figure out the best one. <http://mercury.picoctf.net:6418/>

<figure><img src="https://1586847736-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FtSZ40gLWhBDTzPEgHsVB%2Fuploads%2FlxpZgsMfb52fRI53bZEt%2F1.png?alt=media&amp;token=cfe47151-57e8-48aa-9e66-18bee6db5805" alt=""><figcaption></figcaption></figure>

Let's proxy the traffic through Burpsuite and provide `snickerdoodle` as the input.

<figure><img src="https://1586847736-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FtSZ40gLWhBDTzPEgHsVB%2Fuploads%2F5U4Q96rLcsy1kXzmFnEb%2F2.png?alt=media&amp;token=cd4463d7-437d-4665-a199-ad188ebe159f" alt=""><figcaption></figcaption></figure>

We can see that the application redirects us to `/check`.

Now let's send the request that is sent to `/check` to the `Intruder`.&#x20;

<figure><img src="https://1586847736-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FtSZ40gLWhBDTzPEgHsVB%2Fuploads%2Fy1QiATab2qbC8dMwsiXl%2F3.png?alt=media&amp;token=3a669e73-7802-42a7-a5e6-f3d3fd8966a0" alt=""><figcaption></figcaption></figure>

Then we can configure the payload position to be the cookie.

Next we have to craft the payloads.

<figure><img src="https://1586847736-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FtSZ40gLWhBDTzPEgHsVB%2Fuploads%2FQUZs1b6lPHQdcGRpHZCo%2F4.png?alt=media&amp;token=d68f37c6-1572-41e5-b446-733f0a233217" alt=""><figcaption></figcaption></figure>

The payload type is a `Simple list` with numbers from 1 to 20.

Let's start the attack and sort the responses by their length in ascending order.

<figure><img src="https://1586847736-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FtSZ40gLWhBDTzPEgHsVB%2Fuploads%2F2kULusb67uxqfUx0gIjl%2F5.png?alt=media&amp;token=d1c03eaf-44cf-441b-bdc3-4a9c2aa9b134" alt=""><figcaption></figcaption></figure>

We can see that the response with the shortest length is the one with the cookie set to 18.

That is also same the response in which the flag is present.

## Flag

```
picoCTF{3v3ry1_l0v3s_c00k135_88acab36}
```
