Skip to content
RCE Write-up Intermediate

CVE-2021-4128: PfSense 2.5.2 Shell Upload

An authenticated user with the 'WebCfg - Diagnostics: Routing tables' privilege can exploit an arbitrary file creation vulnerability in pfSense's diag_routes.php to upload a PHP web shell and execute commands with root privileges.

packetstormsecurity.com

Published on packetstormsecurity.com

pfSense 2.5.2 Shell Upload

The author, on packetstormsecurity.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

Impact

An attacker with the necessary privilege can execute arbitrary commands as root, leading to full compromise of the pfSense device.

What the attacker needed

Authenticated user; WebCfg - Diagnostics: Routing tables privilege

How it was found

  1. Authenticate to the pfSense web interface with a user having the required privilege.
  2. Send a request to diag_routes.php with a crafted filter parameter to write a PHP web shell to /usr/local/www/.
  3. Access the uploaded web shell to execute commands with root privileges.

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.

A user who is allowed to view routing tables in pfSense can trick the web interface into writing a file anywhere on the server. They write a small program (a web shell) that lets them run commands as the root user, giving full control of the device.

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.