In this CTF, we explore a database application called "Light" reachable via a TCP socket. The main challenge is to perform an SQL Injection to retrieve the administrator's credentials and the flag.
Connection
First, we establish a TCP socket connection to the target service on port 1337: nc MACHINE_IP 1337
Once connected, we interact with the login prompt.
Step 1: SQL Injection Discovery
we write smokey the example in the THM and then after we see the password , We try to see if the application is vulnerable to SQL Injection by inputting a single quote ': Please enter your username: ' UniOn SeLeCt 1 ' Password: 1
This confirmed that we can execute SQL queries.
Step 2: Database Enumeration
We need to find the database tables. We use sqlite_master to retrieve the database schema: Please enter your username: ' UniOn SeLeCt group_concat(name) FROM sqlite_master ' Password: usertable,admintable
Explanation:
. UniOn SeLeCt: We use mixed casing to bypass potential input filters.
.…