Skip to main content
File upload functionality is a common attack vector. Misconfigured upload handlers can lead to RCE, XSS, XXE, SSRF, and more.

Dangerous File Extensions

.php, .php2, .php3, .php4, .php5, .php6, .php7, .phps, .pht, .phtm, .phtml, .pgif, .shtml, .htaccess, .phar, .inc, .hphp, .ctp, .moduleWorking in PHPv8: .php, .php4, .php5, .phtml, .module, .inc, .hphp, .ctp
.asp, .aspx, .config, .ashx, .asmx, .aspq, .axd, .cshtm, .cshtml, .rem, .soap, .vbhtm, .vbhtml, .asa, .cer, .shtml
.jsp, .jspx, .jsw, .jsv, .jspf, .wss, .do, .action
Coldfusion: .cfm, .cfml, .cfc, .dbm
Perl: .pl, .cgi
Erlang Yaws: .yaws

Bypass Extension Checks

1

Uppercase Variations

Try uppercase: .pHp, .PHP5, .PhAr
2

Double Extensions

  • file.png.php
  • file.png.Php5
3

Special Characters at End

4

Null Bytes / Junk Data Between Extensions

5

Reverse Extension Order

Some Apache misconfigurations execute anything with .php anywhere in the name:
6

NTFS Alternate Data Streams (Windows)

Bypass Content-Type and Magic Bytes

Trailing Dot Bypass (CVE-2024-21546 - UniSharp LFM)

In UniSharp Laravel Filemanager < 2.9.1, uploading shell.php. causes the server to strip the trailing dot and save shell.php:

ZIP/Archive Attacks

GZIP Upload + Path Traversal (Tomcat JSP)

Then trigger:

uWSGI Configuration File RCE

If you can upload a .ini file to a uWSGI server:

Content-Type Confusion → Arbitrary File Read

Some upload handlers trust parsed request body and copy file.filepath without enforcing multipart:

wget Filename Truncation Bypass

wget truncates filenames at 236 characters. Name your file A*232 + ".php" + ".gif" to bypass extension checks while wget saves it as .php:

Polyglot Files

Polyglot files are valid in multiple formats simultaneously (e.g., GIFAR = GIF + RAR). They bypass MIME type checks while containing malicious code.

Vulnerability Chaining

Path Traversal

Set filename to ../../../tmp/lol.png

SQL Injection

Set filename to sleep(10)-- -.jpg

XSS

Set filename to <svg onload=alert(document.domain)>

Command Injection

Set filename to ; sleep 10;

XXE via SVG

Upload SVG with external entity references

SSRF

Upload files that trigger server-side URL fetches

Magic Header Bytes Reference

Tools