Skip to content
RCE Write-up Advanced

OpenPNE <= 3.8.9 (opSecurityUser.class.php) PHP Object Injection Vulnerability

The getRememberLoginCookie() method in OpenPNE takes a cookie value and passes it through base64_decode() and unserialize() without sanitising it. An attacker who can set a cookie on the victim's browser could therefore inject a serialised PHP object and trigger magic methods during deserialisation.

karmainsecurity.com

Published on karmainsecurity.com

The vulnerable code is located in the getRememberLoginCookie() method defined in /lib/user/opSecurityUser.class.php:

The author, on karmainsecurity.com

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

What the attacker needed

Ability to set a cookie for the target site

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.

When a PHP application stores data, it can turn an object into a text string with serialize() and turn it back with unserialize(). If an attacker controls that text, they can craft a fake object whose special methods (called magic methods) run code when it is rebuilt. Here the text comes from a cookie, so a malicious cookie can make the server rebuild an attacker-chosen object.

What is RCE?

Running the attacker's code on the target's servers: through command or code injection, unsafe deserialisation or template injection.

Similar reports

View all

Same bug class and techniques, clearest first.

Remote code execution

The lesson behind this report.

Running the attacker's code on the target's servers: through command or code injection, unsafe deserialisation or template injection.