CCE 2021 GS 25 Write Up
Summary⌗
On the 25th, there was a CCE held by the National Intelligence Service, and at 11:10 pm, a few tens of minutes before the end of the competition, someone I knew asked me to solve it, so I tried to solve the GS 25 problem for a while, and it was very easy.
GS 25 [2** pts]⌗
This GS 25 challenge is to pollute Jquery gadget with Prototype Pollution to trigger XSS.
The challenge code is given above. So many :(
If you look at the conditions for obtaining the flag, you can steal the cookie of the admin bot, and you need to trigger XSS to steal it.
While checking the source code, I found a function called loadGame() in tetris.js. The loadGame() function sends a request for a unique Code value to /loadGame to get game information (object) corresponding to the Code value, and uses the merge() function to overwrite the GameInfo object.
Also, since I’m using Jquery 3.3.1 on that issue, I decided to look for an XSS gadget, and pollute that gadget to trigger XSS.
If you look closely at the loadGame() function, you can see that there is an XSS gadget inside.
The loadGame() function was not called automatically, but L, l had to be entered with the keyboard to execute it.
But, since the admin bot uses the keyboard method to input l, the admin bot also eventually executes the loadGame() function, so I thought that I could just try it.
First, to check if XSS works well, I tried to execute the loadGame() function after saving the game as above.
As expected, I was able to confirm that the XSS trigger works well.
The cookie stealing POC is as above.
- Scenario
- Save the PoC of Prototype Pollution in the /saveGame
- Send the code number including the filename and PoC in the report logic.
Based on the above scenario, i were able to steal the flag by trying the exploit.