Skip to content
RCE Write-up Advanced

Remote Code Execution in pfSense <= 2.5.2

An authenticated user could inject sed-specific code through the route information endpoint, which executes netstat and parses output with sed, allowing arbitrary file writes. The endpoint was also vulnerable to CSRF, so the issue could be exploited without authentication.

shielder.com

Published on shielder.com

pfSense allows authenticated users to get information about the routes set in the firewall. The information are retrieved by executing the netstat utility and then its output is parsed via the sed utility.

The author, on shielder.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 application passed user-controlled input into a sed script without properly restricting sed-specific syntax, even though shell argument escaping was used.

Impact

An attacker could write an arbitrary file in an arbitrary location, which could lead to remote code execution, and the endpoint could also be triggered via CSRF pre-authentication.

What the attacker needed

Authenticated user; or CSRF pre-authentication

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.

The firewall runs a command-line tool called sed to clean up the output of another tool. The report says a logged-in user could sneak extra instructions into that sed command, which let them write a file anywhere on the system. Because the same page could be triggered from another website, an attacker might not even need to be logged in.

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.