Books Gallery
Challenge Description
Author : anakmamah
Lately, Pak Vincent has enjoyed reading books, but when he tried to search for a specific book, he realized that a feature was missing. He wondered why it had disappeared, especially since he was about to use it to find the book he wanted to read.
Flag
HOLOGY7{8uKu_@d41ah_J3nd3la_dUn1A_uW4W}
Analysis
We are given a full source-code of a website written in Go. Looking at the docker-compose.yml
file, we can see that the flag is stored on the database container meaning that we could use an SQL injection to solve this challenge. And also, the database for this challenge is using MySQL, so that could be important later on.
From the ShowBooks
controller, we can see that the parameters are concatenated to the query meaning that we could inject SQL statements to it. But, there is a SanitizeData
function that implement some sort of blacklisting.
One problem with the sanitization is that the replacement does not account for capitalization. Since SQL does not check for capitalization, the statement blacklists are useless. But, we still cannot use flag
or txt
as our input. Therefore, we can use encoding to bypass this blacklist.
Solution
The payload is a basic union-based SQL injection but we will open the flag.txt
file and output it on one of the rows.
Then we just use that as our query
and the flag will be printed out!
Last updated