Swamp CTF 2025
Hey, fellow hackers! ๐ดโโ ๏ธ
Last updated
Hey, fellow hackers! ๐ดโโ ๏ธ
Last updated
Droppin' some fresh writeups from Swamp CTF 2025! ๐๐ฅ Teamed up with my crew, sh3lldon3, and we dove deep into the swampy madness. Letโs get straight into the hacks and hijinksโno fluff, just flags. ๐
Analysing the source code provided, we get to know that
Application has reverse proxy build using Ruby and has endpoint /api?action='getInfo'.
Backend is build using Python which has two endpoints "/api?action='getFlag'" and "/api?action='getInfo'".
We have to send POST requests with some json data.
Now, in order to get flag we have to:
Hit the "/api?action='getFlag'" endpoint at backend, so somehow pass action='getFlag' as Reverse Proxy accepts only action='getInfo' and gives error otherwise.
Cause error in parsing json data so that environment variables containing flag get exposed.
Since the backend and reverse proxy is build using different languages, so there is difference in the handling parameters. Hence, we can do Parameter Pollution.
This payload is able to bypass because whenever there are duplicate variables then Ruby will consider the last one while Python considers the first one.
Again, due to difference in the method of parsing JSON data, there are characters that are treated differently in two languages.
Now, "\q" is not a valid special character.
When Ruby encounters it, then it simply consider it as two characters '\' and 'q' and therefore, pass it to the backend and gives no error.
Since, it is not a valid escape sequence, therefore it will cause parsing error in backend (JSONcode error by Python).
In this way, We successfully expose the environment variables and get the Flag.