Room: Web SQLi traces
Room scenario. The online shop shop.example.uz noticed a strange increase in database queries at night. There is no WAF and the application log has been deleted — only the nginx access.log (combined format) remains. The attacker extracted data from the database through a boolean-based blind SQL injection in the product.php?id= parameter. Your task is to recover exactly what he took from the log itself.
You are given incident.zip: access.log (~3000 lines, a lot of noise) and the application's app_schema.sql schema (a list of tables and users, without keys).
In a blind SQLi the server does not return data directly: the attacker asks questions such as ORD(MID((SELECT ...),N,1))>K and tells "yes/no" apart by the response size (bytes). The character code is found by binary search (bisection).
Tasks (answers are not submitted, each builds on the previous one):
- Task 1. Find the attacker's IP and the tools used (User-Agent). What are the response sizes of a normal page and of the
AND 1=1andAND 1=2requests? Which size is "true" and which is "false"? - Task 2. How many different values did the attacker extract? What are the table, column and condition inside each
SELECT? Usingapp_schema.sql, determine which one belongs to theapi_keyvalue of the admin user (note:admin_oldis a different role). - Task 3. For each position of the admin key, analyse the binary search requests (URL-encoded, a mix of
+,/**/) and recover the character code. Only HTTP 200 responses whose size matches true/false are counted (watch out for rate-limit, "maintenance" pages and retries). - Task 4. The recovered string is the admin's
api_keyvalue. It is the flag:BAYROQ{...}(the last 16 characters are lowercase hexadecimal).