
This is a cookie overflow challenge.
Before you read this writeup, be sure to register a user and get familiar with the webpages and how they work.
app.py
/personal_messages: Allows you to post messages you can see.
/message_admin_bot: Allows you to send a message to the admins
- There is a
/fire_bot route

Things to note in bot.js

By just going to http://ctf.local:9000/fire_bot the bot will:
- Log in
- View any admin messages, which we can send as a new user.
- Visit personal messages.
- Post the flag to the admin’s personal messages page.
The idea is this:
- Web browsers only hold a limited number of cookies.
- Once the maximum number of cookies has been loaded, old cookies are pushed out of the ‘cookie jar.’
- The attack looks like this:
- We will create an XSS script that will overflow the bot’s cookie jar after it has logged in by creating 999 garbage cookies.
- This will force the browser to discard its current session cookie and replace it with meaningless garbage cookies.
- We will then write one last cookie to the admin bot’s cookie jar that contains the session cookie of the currently logged-in user.
- When the admin bot then visits the
/personal_messages endpoint, it will have a different session cookie loaded, which is that of the user we are logged in as.
- When it posts the flag, it will post it to the current user’s personal messages rather than its own.
First, open development tools and copy your session cookie once you are logged in.
