Skip to content
RCE Write-up Intermediate

PhpWebGallery <= 1.7.2 (event_list.php) PHP Code Injection Vulnerability

PhpWebGallery 1.7.2 and earlier allowed remote authenticated administrators to execute arbitrary PHP code by supplying PHP sequences in the sort parameter of event_list.php, which was processed by create_function().

karmainsecurity.com

Published on karmainsecurity.com

plugins/eventtracer/eventlist.php in PhpWebGallery 1.7.2 and earlier allows remote authenticated administrators to execute arbitrary PHP code via PHP sequences in the sort parameter, which is processed by createfunction().

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 the sort parameter was passed directly into PHP's create_function(), which evaluates its argument as code, so crafted input became executable PHP.

Impact

An authenticated administrator could execute arbitrary PHP code on the server, potentially taking full control of the application and its data.

What the attacker needed

Valid administrator account

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.

An administrator-only page took a sorting choice from the web address and passed it into a PHP function that builds and runs code. Because the input was not treated as plain text, someone with admin rights could make the server run their own PHP commands. This is dangerous because it can lead to full 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.