Lab: Using PHAR deserialization to deploy a custom gadget chain
Summary: A PortSwigger Web Security Academy lab demonstrates achieving remote code execution without explicit deserialization by combining PHAR deserialization with a custom gadget chain. The lab's website uses the Twig template engine, and the technique passes a server-side template injection payload through a phar:// stream to delete the morale.txt file from Carlos's home directory.
Bottom line: The exercise shows that PHAR deserialization can turn a file-handling path into code execution even where no deserialization call is visible, so a single phar:// stream reaching a filesystem function is the stake a security leader should weigh.
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