The discovery, revealed during the DownUnderCTF 2025 capture-the-flag competition, demonstrates how attackers can exploit PDO’s query parsing mechanism to achieve code injection in seemingly bulletproof applications.
Discovery Emerges from DownUnderCTF 2025 Competition
The vulnerability was first demonstrated in a challenging web exploitation problem called ‘legendary’ during the sixth edition of DownUnderCTF, which took place over the weekend.
The challenge, created by security researcher hashkitten, was solved by only a single team, highlighting its sophisticated nature.
The technique leverages a previously unknown weakness in how PHP’s PDO library handles prepared statement emulation, particularly when parsing SQL queries containing null bytes.
The researcher explained that PDO doesn’t use MySQL’s native prepared statement API by default.
Instead, it emulates prepared statements by implementing its own SQL parser to identify bound parameters while avoiding interference from comments, strings, and table names.
This parser, however, contains critical flaws that can be exploited under specific circumstances.
Technical Vulnerability Exploits Parser Weaknesses
The attack works by exploiting how PDO’s parser handles null bytes (
