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-dump

PHP 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.php

ffuf 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

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

Easy (8)

MachinePlatformOSTags
Blocky IppSecCVE-2017-6074Decompiling-JAR-filesHTBLinuxEditor-mapped, CVE-2017-6074, Decompiling-JAR-files
CorridorIDORHashingMD5THMLinuxEditor-mapped, IDOR, Hashing, MD5
CyberHeroesReverse-EngineeringAuthentication-BypassJavaScriptTHMLinuxEditor-mapped, Reverse-Engineering, Authentication-Bypass, JavaScript
MD2PDFXSSSSRFPDF-ConversionTHMLinuxEditor-mapped, XSS, SSRF, PDF-Conversion
W1seGuyCryptographyXORPythonTHMLinuxEditor-mapped, Cryptography, XOR, Python
BountyHunter IppSecSource-Code-ReviewXXEHTBLinuxSource-Code-Review, XXE
Horizontall IppSecSource-Code-ReviewCVE-2019-18818CVE-2019-19609CVE-2021-3129HTBLinuxSource-Code-Review, CVE-2019-18818, CVE-2019-19609, CVE-2021-3129
RedPanda IppSecSource-Code-ReviewXXEHTBLinuxSource-Code-Review, XXE

Medium (6)

MachinePlatformOSTags
RecruitTHMLinuxEditor-mapped
Devzat IppSecSource-Code-ReviewCVE-2019-20933Command-InjectionHTBLinuxSource-Code-Review, CVE-2019-20933, Command-Injection
Jewel IppSecSource-Code-ReviewCVE-2020-8165HTBLinuxSource-Code-Review, CVE-2020-8165
Obscurity IppSecSource-Code-ReviewPlaintext-AttackHTBLinuxSource-Code-Review, Plaintext-Attack
StreamIO IppSecSource-Code-ReviewAutomatic-LDAPLFI-using-PHP-wrappersHTBWindowsSource-Code-Review, Automatic-LDAP, LFI-using-PHP-wrappers
Waldo IppSecSource-Code-ReviewLinux-CapabilitiesRbash-escape-techniquesHTBLinuxSource-Code-Review, Linux-Capabilities, Rbash-escape-techniques

Insane (1)

MachinePlatformOSTags
Response IppSecSource-Code-ReviewAuthentication-BypassDirectory-TraversalHTBLinuxSource-Code-Review, Authentication-Bypass, Directory-Traversal

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.