@@ -4,7 +4,7 @@ title: "TryHackMe Light Walkthrough - SQL Injection Challenge"
44description : " Complete step-by-step walkthrough for TryHackMe's Light room featuring SQLite injection techniques, database enumeration, and admin credential extraction. Perfect for beginners learning SQL injection fundamentals."
55date : 2025-08-15 10:00:00 +0000
66categories : [Cybersecurity, Writeups, Tryhackme]
7- tags : [tryhackme, thm, sql-injection, sqlite, database, enumeration, ctf, beginner-friendly ]
7+ tags : [tryhackme, thm, sql-injection, sqlite, database, enumeration, ctf, easy ]
88image : https://tryhackme-images.s3.amazonaws.com/room-icons/618b3fa52f0acc0061fb0172-1737140605838
99sitemap :
1010 priority : 0.8
@@ -26,12 +26,12 @@ Lets start the machine and wait for 2-3 minutes, let the machine get fully funct
2626
2727As usual running a full port scan for identifying potential entry points.
2828` nmap -p- -T4 MACHINE-IP -vv `
29- ![ [ _ posts/attachments/Pasted image 20250816001828 .png]]
29+ ![ Nmap scan results ] ( / _posts/attachments/Pasted%20image%2020250816001828 .png)
3030
3131Meanwhile lets try connecting to the port 1337
3232` nc MACHINE-IP 1337 `
3333Lets try the username provided ` smokey `
34- ![ [ _ posts/attachments/Pasted image 20250816002133 .png]]
34+ ![ Testing with username smokey ] ( / _posts/attachments/Pasted%20image%2020250816002133 .png)
3535Alright!
3636
3737So, I guess we can try brute-forcing a wordlist of usernames, but we cannot use ffuf...
@@ -72,28 +72,28 @@ for user in usernames:
7272I tried few wordlists but didn't find anything.
7373
7474Got back to the nmap scan and LOL!, its gonna take forever so its not the way in for sure!
75- ![ [ _ posts/attachments/Pasted image 20250816003201 .png]]
75+ ![ Nmap scan taking too long ] ( / _posts/attachments/Pasted%20image%2020250816003201 .png)
7676
7777What else can we do? Found no ` http ` pages, where can we even use the credentials we've got earlier?
7878Lets try to change the approach.
7979
8080Lets try putting in some random input, my mind is getting a little idea of where it is going _ maybe_ .
81- ![ [ _ posts/attachments/Pasted image 20250816003925 .png]]
81+ ![ Testing random input ] ( / _posts/attachments/Pasted%20image%2020250816003925 .png)
8282Its more of an Injection vulnerability I see
8383Its been a long I have not dealt with a SQLi, now quickly digging through my notes for revising required methods.
8484
8585From the responses below
86- ![ [ _ posts/attachments/Pasted image 20250816004841 .png]]
86+ ![ SQL injection response ] ( / _posts/attachments/Pasted%20image%2020250816004841 .png)
8787I can imagine of a SQL query
8888` select pass from users where user='<input>' limit 30 `
8989
9090Now we'll try creating some SQL payloads based on the payloads I already have in my notes.
9191` 'union select 1' `
92- ![ [ _ posts/attachments/Pasted image 20250816005530 .png]]
92+ ![ Union select blocked ] ( / _posts/attachments/Pasted%20image%2020250816005530 .png)
9393Okhayy!
9494They might be blocking some keywords most probably as an easy way out.
9595Here might be a logic error lets try ` 'UnIOn sElecT 1' `
96- ![ [ _ posts/attachments/Pasted image 20250816005739 .png]]
96+ ![ Bypassing keyword filter ] ( / _posts/attachments/Pasted%20image%2020250816005739 .png)
9797as a developer I would also blacklist these keywords as its an easy fix(not a fix really). Laziness is a problem frr.
9898I love these kinda logic based errors!
9999
@@ -106,35 +106,35 @@ Refer this https://github.com/swisskyrepo/PayloadsAllTheThings/blob/master/SQL%2
106106This one worked
107107` 'Union Select sqlite_version()' `
108108Its sqlite database version: 3.31.1
109- ![ [ _ posts/attachments/Pasted image 20250816010644 .png]]
109+ ![ SQLite version ] ( / _posts/attachments/Pasted%20image%2020250816010644 .png)
110110
111111Using the [ PayloadsAllTheThings] ( https://github.com/swisskyrepo/PayloadsAllTheThings/blob/master/SQL%20Injection/SQLite%20Injection.md#sqlite-enumeration ) Repository for reference!
112112
113113` 'Union Select sql from sqlite_master' `
114- ![ [ _ posts/attachments/Pasted image 20250816010906 .png]]
114+ ![ Database schema ] ( / _posts/attachments/Pasted%20image%2020250816010906 .png)
115115
116116Now we know the table name, column names.
117117Enough to craft useful payloads.
118118
119- > You can use [ PayloadsAllTheThings] ( https://github.com/swisskyrepo/PayloadsAllTheThings/blob/master/SQL%20Injection/SQLite%20Injection.md#sqlite-enumeration ) and suitable LLM for crafting payloads
119+ > You can use [ PayloadsAllTheThings] ( https://github.com/swisskyrepo/PayloadsAllTheThings/blob/master/SQL%20Injection/SQLite%20Injection.md#sqlite-enumeration ) and suitable LLM for crafting payloads
120120
121121` 'Union Select username from admintable where id='1 `
122- ![ [ _ posts/attachments/Pasted image 20250816011619 .png]]
122+ ![ Admin username ] ( / _posts/attachments/Pasted%20image%2020250816011619 .png)
123123If needed we could've dumped all but in this case we don't need the whole database.
124124
125- ![ [ _ posts/attachments/Pasted image 20250816011809 .png]]
125+ ![ Question 1 answer ] ( / _posts/attachments/Pasted%20image%2020250816011809 .png)
126126
127127` Q2 What is the password to the username mentioned in question 1? `
128128` 'Union Select password from admintable where username='<admin-user> `
129- ![ [ _ posts/attachments/Pasted image 20250816012001 .png]]
129+ ![ Admin password ] ( / _posts/attachments/Pasted%20image%2020250816012001 .png)
130130
131- ![ [ _ posts/attachments/Pasted image 20250816012439 .png]]
131+ ![ Question 2 answer ] ( / _posts/attachments/Pasted%20image%2020250816012439 .png)
132132
133133` Q3 What is the flag? `
134134Till now you could've figured it out, we have already got the id for the user flag, so most probably its password will be the final flag.
135135Little modifications to the previous payload will get you the flag.
136136
137- ![ [ _ posts/attachments/Pasted image 20250816012516 .png]]
137+ ![ Question 3 flag ] ( / _posts/attachments/Pasted%20image%2020250816012516 .png)
138138
139139
140140
0 commit comments