> For the complete documentation index, see [llms.txt](https://s3328070.gitbook.io/jclel/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://s3328070.gitbook.io/jclel/readme/day2.md).

# Day 2

Today we're hacking for good, taking back the interdepartmental monitoring dashboard from The Grinch's attack:

> McSkidy needs to check if any other employee elves have left/been affected by Grinch Industries attack, but the systems that hold the employee information have been hacked. Can you hack them back to determine if the other teams in the Best Festival Company have been affected?

We're gonna bypassing a login page using cookies. A wonderful demonstration of why handling authorisation on the client side isn't a good idea.

> Register an account, and verify the cookies using the Developer Tools in your browser. What is the name of the new cookie that was created for your account?

Once we register an account, we get told:

![](/files/6FJvAkywdn5PcqqeVxPP)

Dang. Let's see if we can change this. We can press F12 to open our browser developer tools and go to the Storage tab. This is where our cookies are held. The site has created one called "user-auth":

```
user-auth: 7b636f6d70616e793a2022546865204265737420466573746976616c20436f6d70616e79222c206973726567697374657265643a2254727565222c20757365726e616d653a2262696e67626f6e67227d
```

Sometimes these cookies are just randomly generated strings. This isn't especially secure, but it does provide a barrier at least; if you want to impersonate an admin via a cookie, you have to guess or find that specific string. In our case though, the "user-auth" cookie is actually encoded data.

If we put the string into CyberChef, we decode it from hexadecimal to a JSON string:

```
https://gchq.github.io/CyberChef/

{company: "The Best Festival Company", isregistered:"True", username:"bingbong"}
```

This data is formatted in JSON (JavaScript Object Notation), a standardised way of presenting data on the web, and that's the username I put in when I registered. Let's alter the "username" field and re-encode it back to hexadecimal:

```
{company: "The Best Festival Company", isregistered:"True", username:"admin"}

7b636f6d70616e793a2022546865204265737420466573746976616c20436f6d70616e79222c206973726567697374657265643a2254727565222c20757365726e616d653a2261646d696e227d
```

If I go back to the website and paste this string into the user-auth cookie using the developer tools, the website will read it and believe I'm the "admin" user now. So if we log in with the email and password we registered before we should...

![](/files/cJZPhHRDr8l8zSWntAcw)

...now have access to the admin dashboard.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://s3328070.gitbook.io/jclel/readme/day2.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
