Source Code Review: practice machines and key commands
By Daniel Dayan ยท Updated
Reading the application source is often faster than blind testing. When a box leaks code through a repository, backup, LFI or a readable share, look for hardcoded credentials, secret keys, unsafe functions and trust assumptions. In web code, trace user input from the request to dangerous sinks: database queries, file paths, command execution, template rendering and deserialisation. Grep for words like password, token, secret and eval first, then follow the routes that require no authentication. Git history deserves a pass because removed secrets often remain in earlier commits. Compare the behaviour you see in the browser with what the code does to spot logic gaps. The boxes below reward careful code reading. Time spent reading code is rarely wasted, even when a quick scan finds nothing at first.
Key commands
Placeholders in braces, such as {TARGET_IP}, are values you fill in for your target.
Exposed .git Source Code Extraction
Dump full repository commits and source code from misconfigured public /.git/ directory.
git-dumper http://{TARGET_IP}/.git/ ./git-dumpPHP Filter Base64 LFI Wrapper
Read source code of PHP scripts through base64 conversion filter.
http://{TARGET_IP}/index.php?page=php://filter/convert.base64-encode/resource=config.phpffuf Directory & Endpoint Fuzzing
High-speed directory enumeration with auto-calibrated filtering and extension recursion.
ffuf -w /usr/share/seclists/Discovery/Web-Content/raft-medium-directories.txt -u http://{TARGET_IP}/FUZZ -e .php,.html,.txt,.bak,.js -ac -mc 200,301,302,403
Keep going
- Methodology: Phase 04: Foothold Execution & Initial Access
- Cheatsheet: Web & Directory Fuzzing
Source Code Review machines (15)
6 of these are machines I solved myself and are listed first within each difficulty. 14 Linux, 1 Windows.
Listed when a machine has a catalog tag that is one of: source code review, source code analysis, code review. Capital letters, hyphens and underscores are ignored, and the tags that matched come first in each row. "Editor-mapped" marks machines assigned to this topic by hand because none of their tags match.
Source Code Review at a glance
- By platform: 10 Hack The Box, 5 TryHackMe.
- On these practice lists: CWEE (3), OSCP (1), HTB Active Directory (1), OSEP (1), OSWE (1).
- Tags that most often appear alongside it: Authentication-Bypass (2), XXE (2).
- Solved by me, with a page here: Blocky (Linux Easy), Corridor (Linux Easy), CyberHeroes (Linux Easy), MD2PDF (Linux Easy), W1seGuy (Linux Easy), Recruit (Linux Medium).
Easy (8)
| Machine | Platform | OS |
|---|---|---|
| Blocky IppSec | HTB | Linux |
| Corridor | THM | Linux |
| CyberHeroes | THM | Linux |
| MD2PDF | THM | Linux |
| W1seGuy | THM | Linux |
| BountyHunter IppSec | HTB | Linux |
| Horizontall IppSec | HTB | Linux |
| RedPanda IppSec | HTB | Linux |
Medium (6)
| Machine | Platform | OS |
|---|---|---|
| Recruit | THM | Linux |
| Devzat IppSec | HTB | Linux |
| Jewel IppSec | HTB | Linux |
| Obscurity IppSec | HTB | Linux |
| StreamIO IppSec | HTB | Windows |
| Waldo IppSec | HTB | Linux |
Insane (1)
| Machine | Platform | OS |
|---|---|---|
| Response IppSec | HTB | Linux |
Related techniques
Related guides: HTB Pro Labs guide, HTB CPTS exam guide, TJ Null OSCP list, OSCP exam scoring and time budget.
Practise it, then track it.
Log every box and the commands you used in ZeroBox.