Gadget chains in Wordpress
A new PHP object injection gadget chain was found in WordPress core versions 6.4 and later, using the WP_HTML_Token class. An attacker who can trigger an unserialize call could execute arbitrary code.
fenrisk.com
Published on fenrisk.com
Exploiting an unserialization vulnerability in WordPress never was a small issue. Unlike other PHP frameworks, and until very recently, WordPress was not known for hosting gadget chains.
The full write-up lives on its author's site
It belongs to its author, so we link to it rather than copy it. The other two tabs are our own rewrites, checked against it.
Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.
How it worked
Root cause
The WP_HTML_Token class has a __destruct method that calls call_user_func on user-controlled properties, allowing arbitrary function execution during unserialization.
Impact
An attacker could execute arbitrary code if they can trigger an unserialize call, but the report does not specify how that trigger is achieved.
What the attacker needed
Ability to trigger unserialize; WordPress 6.4 or later
The fix
The report does not state a fix for this new chain; it notes that the class is loaded by the WordPress class loader.
Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.
Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.
PHP unserialization is when a program turns stored data back into objects. If an attacker can control that data, they can create objects that trigger dangerous code when destroyed. This report found a simple way to do that in WordPress, leading to code execution.
What is RCE?
Running the attacker's code on the target's servers: through command or code injection, unsafe deserialisation or template injection.