As I don’t have a CTF team of my own yet, I decided to join the John Hammond Discord Server team. As I am new to the team I started tackling challenges on my own at first. I successfully was able to solve 6 challenges by myself, all related to my strongest skill in web exploitation and programming. This post is just to summarize things I have learned from this CTF.
MySQL C-Style comments
I think everyone has seen something like the following type of comment in a MySQL database dump /*!50110 KEY_BLOCK_SIZE=1024 */
. I never looked into what it does or anything until I was attempting “Execute No Evil”. In the source code of the page it had the following SQL.
|
|
As you can see the injection point was inside the comment. I didn’t understand what the MySQL documentation meant by “C-Style comments”. So I hopped onto DB Fiddler and started playing with the SQL and found out was able to full inject anything into the SQL just by adding a !
to the beginning of the injection. After playing with the SQL to gather the database information this was my payload and the SQL that ran.
|
|
HTTP Parameter Pollution
I never knew HTTP Parameter Pollution was a thing or that is what it was called. In the Roboworld challenge, you needed to bypass the captcha by setting privKey
to the testing private key. When you attempt to login, it checks the captcha by requesting to an endpoint that can only be accessed from 127.0.0.1
.
|
|
Since you are able to control captchaToken
parameter you can pollute it with the testing private key.
Server Side Template Injection
I took part of the tuctf and was introduced to SSTI with flask. There wasn’t any blacklisting so it was easy to just print out the flag. This time while doing “Mercenary Hat Factory” the last step to get the flag was exploiting SSTI but there was a long list of blacklisted characters.
|
|
To bypass everything was really difficult to do but with the help of someone I met through discord we were able to complete the payload. I had an idea of how to exploit it but couldn’t figure out a way to bypass the _
filter. After going back and forth with the person on discord I totally gave up on the CTF as it’s the last challenge I was thinking I could solve. Randomly that person messaged me a payload to get __class__
and I was completely intrested again. Going back and forth we were able to complete a full payload to have RCE and found the file with the flag.
|
|
CSS Exfiltration
On the ‘Free as in Freedom’ Challenge I started going down the wrong path. Mr.Stallan was able to run Javascript but didn’t run any on the challenge page. After going down the wrong rabbit hole, I stumble upon CSS Exfiltration. Not something I thought was possible but in theory is’s possible with the right querying. The way I confirmed it was a CSS Exfiltration I needed to use to solve it was I noticed something weird. When you posted a suggestion it would put it as the value
of a div
.
|
|
The way I tested it to confirm I was on the right track finally was the following injection. Which caused a HTTP request to my server if div.suggestion
was a real element. Knowning that now all you had to do was write a script to “brute force” the flag from the div.suggestion
element.
|
|