🚩 Challenge Overview
- Platform/Event: HTB Cyber Apocalypse 2025
- Difficulty: Hard
- Points: 482
- Solves: 22
- Category: Web
- Tags: PHP Deserialization, PHAR, POP Chain, RCE
📝 Description
PHP PHAR deserialization attack via a file manager. Upload a PHAR disguised as an image, trigger deserialization via a custom POP chain to achieve RCE.
💡 Solution / Approach
-
Source review:
file_exists("phar://...")call is reachable. -
Build POP chain:
Logger::__destruct()→FileWriter::write()→ writes webshell. -
Generate PHAR with forged GIF header:
GIF89aprefix passes MIME check. -
Upload file → trigger via
file_exists('phar://uploads/evil.gif/test'). -
Webshell dropped → RCE → flag at
/flag.