Lab: Remote code execution via polyglot web shell upload
Summary: PortSwigger's lab presents an image upload function that verifies a file's contents are a genuine image but still allows server-side code to be uploaded and executed. The solution is a polyglot PHP/JPG file with the PHP payload placed in the image's Comment metadata via ExifTool, saved with a .php extension and retrieved through the GET /files/avatars/polyglot.php request to exfiltrate the contents of /home/carlos/secret.
What's compelling: The control here checked that the file was a real image and still let a working PHP shell through, because the payload sat in metadata the check never inspected - a reminder that content-type validation alone does not stop executable uploads.
Read the original at PortSwigger Research ↗
- Topics
- Vulnerabilities & Patching
- Related
- Attackers Exploit UnrealIRCd Flaw That Enables Server-Level Command Injection Cyber Risks · Nov 14, 2026U.S. CISA adds Check Point and UnrealIRCd flaws to its Known Exploited Vulnerabilities catalog Cyber Risks · Nov 14, 2026PostgreSQL Patches 52 Flaws, Including 22-Year-Old Bug Enabling Authenticated RCE Cyber Risks · Nov 13, 2026