Skip to content
RCE Write-up Intermediate

PmWiki <= 2.2.34 (pagelist.php) PHP Code Injection Vulnerability

The PageListSort() function in PmWiki's pagelist.php passes a crafted 'order' parameter into create_function(), allowing an attacker to inject and execute arbitrary PHP code. A remote attacker could run code on the server.

karmainsecurity.com

Published on karmainsecurity.com

PmWiki contains a vulnerability that allows a remote attacker to inject and execute arbitrary PHP code. The PageListSort() function defined in the scripts/pagelist.php script allows to inject arbitrary PHP code in a call to the createfunction() PHP function via a crafted ‘order’ parameter of a pagelist directive.

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

Root cause

Likely, user-controlled input from the 'order' parameter was passed unsanitised into create_function(), which evaluates it as PHP code.

Impact

A remote attacker could execute arbitrary PHP code on the server, potentially leading to full compromise.

What the attacker needed

Access to a pagelist directive; ability to supply an order parameter

The fix

The vulnerability was fixed in PmWiki version 2.2.35 according to the changelog reference.

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.

PmWiki is a wiki software written in PHP. A feature that sorts page lists built a piece of PHP code from user input without cleaning it, so someone could sneak their own PHP commands into that input and the server would run them. This means an attacker could take control of the website's server.

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.