Web Shell Upload Techniques
You'll learn the common tricks attackers use to sneak malicious web shells past file upload defenses.
What is a Web Shell Upload Technique?
When attackers exploit unrestricted file upload vulnerabilities, they need to get a web shell (a script that gives them remote control) onto the server. However, many applications have basic defenses like checking file extensions or MIME types. Web shell upload techniques are the methods attackers use to bypass these defenses and successfully upload executable code disguised as harmless files.
Common Upload Bypass Methods
Extension Manipulation
Attackers exploit how servers handle file extensions:
- Double extensions:
shell.php.jpg(server might process as PHP but pass extension check) - Case variation:
shell.PHPorshell.PhP(if checks are case-sensitive) - Null byte injection:
shell.php%00.jpg(legacy vulnerability where null byte truncates filename) - Alternative extensions:
.php5,.phtml,.pharinstead of.php
Think of it like: Wearing a disguise that only changes your hat when the bouncer only checks hats.
MIME Type Spoofing
The attacker manipulates the Content-Type header in the HTTP request to claim a malicious file is harmless:
Content-Type: image/jpeg
...while the actual file content is PHP code. If the server only validates MIME type from the header (not file contents), it accepts the upload.
Polyglot Files
A polyglot file is valid in multiple formats simultaneously—it's both a working image AND executable code. For example, a file that displays as a valid JPEG but also contains PHP code in its metadata or appended to the image data.
Key Takeaway: Web shell upload techniques exploit weak validation by manipulating extensions, spoofing MIME types, or creating polyglot files that satisfy superficial checks while remaining executable.