Skip to content
Go back

USCG Open Season 5: Burger Converter - XSS + CORS Admin Takeover

Published:  at  03:00 PM

By: mr_mph

image.png

The two vulnerabilities I found when poking around are that when we submit a conversion we get xss on the conversions page, and that the admin bot visits the link you set as reference url. I also noticed the website has a change password endpoint, which seems likely to be useful to gain access to the admin account.

Since the admin visits the page you set as reference url, I decided to host my own server and have the admin visit it. We can add a conversion with the reference url as our own ip, and watch what happens when we submit it:

image.png

we monitor our http server logs

image.png

nice! the admin sends a get request. at this point I had the idea of getting xss on the admin by serving up a script. I set index.html to be this:

<img
  src
  onerror=' fetch("https://xfytmuwy.web.ctf.uscybergames.com/api/change-password", { method: "PUT", headers: {
"Content-Type": "application/json", }, body: JSON.stringify({ new_password:
"password" }), credentials: "include", }); '
/>

the raw javscript:

fetch("https://xfytmuwy.web.ctf.uscybergames.com/api/change-password", {
  method: "PUT",
  headers: {
    "Content-Type": "application/json",
  },
  body: JSON.stringify({ new_password: "password" }),
  credentials: "include",
});

as I saw when testing the /change-password endpoint myself, all you need is for the cookie to be included in the request and your password is changed just like that!

image.png

not only that but Access-Control-Allow-Credentials is set to true, allowing us to use credentials: "include" and have the admin’s token be sent along.

So all we need to do is trigger the bot to view our self-hosted xss page by requesting validation:

image.png

it runs our payload, changes its password, and we can just log in as admin!

We log in with admin:password

image.png

and we got the flag!

flag: SVUSCG{HotDogs_and_CORS_lite}


Share this post on:

Previous Writeup
USCG Open Season 5: Leetcoder - Python Sandbox Escape
Next Writeup
USCG Open Season 5: Beg-o-Matic 3000 - Next.js CSRF with CSS Injection