Case Study - XSS-GPT

Challenge created by skrctf.me

<div id="user-input-container">
  <div id="user-input-icon">&#x1F4AC;</div>
  <input type="text" id="user-input" placeholder="Type your message...">
  <button onclick="reportAdmin()">Report Admin</button>
</div>

Viewing the webpage source code , looks like its not submitting through form and "Report Admin" button calls the reportAdmin() javascript function

Submit is triggered when we press enter and it calls sendRequest() function

sendRequest() function then checks for value of apiKey in the url parameter , if it works you get chatgpt's response

reportAdmin() will be triggered when the report admin button is pressed where it search for apiKey in url parameter and pass to /reportAdmin (we can assume it trigger the admin bot)

bot.js (admin)

The bot will contain flag and it will open the page with user supplied apiKey

Objective (Remote Reflected XSS) :

  • steal admin cookie when admin visit

Exploitation :

Attempting on GET request

Running GET request and we get error throw back

Error indicate that we might need to escape "); and close the script tag

Successfully loaded an image with xss

After adding escape , xss was successfully executed

Now we report to admin (to summon bot)

Burp post request

Checking webhook and we see flag=SKR{R3flec73D_1n_API_k3y_ebb2fb}

Last updated

Was this helpful?