Skip to content
RCE Write-up Beginner

Explorando Remote Code Execution (RCE) no WordPress

An authenticated WordPress user with theme-editing rights could inject PHP code into a theme template file, allowing arbitrary command execution on the server. The author demonstrates this by adding a system call to the 404 template and invoking it via a URL parameter.

medium.com

Published on medium.com

Hoje executaremos um código malicioso no servidor WordPress. Para isso, temos como pré-requisito:

Link, on medium.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 theme file was writable by the web user and the server executed PHP placed in it, so the editor feature allowed code injection.

Impact

An authenticated user with theme-editing rights could run arbitrary system commands on the server, leading to full compromise.

What the attacker needed

WordPress account with theme edit rights; Theme file writable by the web server

How it was found

  1. Log in to the WordPress dashboard with an account that can edit themes.
  2. Open Appearance -> Editor and look for a theme file that shows an Update File button.
  3. Select the 404.php template of the Classic theme.
  4. Insert PHP code that runs a command from a URL parameter into the file and save it.
  5. Visit the theme file URL with the cmd parameter set to a command such as ls to see output.

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.

WordPress lets administrators edit theme files from the dashboard. If those files can contain PHP code, and the server runs that code, then anyone with editing rights can make the server run commands. This is dangerous because it turns a content-management account into full control of the machine.

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.