pfSense Security: Sensing Code Vulnerabilities with SonarCloud
pfSense's web admin interface contained two reflected XSS flaws and a command injection flaw. An attacker could trick an authenticated admin into clicking a crafted link, leading to arbitrary command execution as root on the firewall appliance.
Published on sonarsource.com
pfSense is a popular open-source firewall solution by Netgate. It is sold as pfSense Plus installed on ready-made firewall appliances to protect and manage office networks and also distributed for free as the pfSense Community Edition (CE).
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-controllable input was concatenated into a JavaScript string and into shell commands without encoding or escaping, because developers assumed certain variables were safe.
Impact
An attacker could execute arbitrary commands as root on the appliance, allowing them to manipulate the firewall, spy on local network traffic, or attack internal services; the victim must be an authenticated user with access to specific pages.
What the attacker needed
Victim is an authenticated pfSense user; victim has access to specific admin pages; victim clicks a crafted link
How it was found
- An attacker crafts a URL with a malicious query parameter for the firewall log filter page.
- The attacker sends this link to an authenticated pfSense user who has access to that page.
- The victim clicks the link and the JavaScript payload runs in their browser with their permissions.
- If the victim is an admin, the attacker uses the diag_command.php page to run arbitrary system commands as root.
- Alternatively, the attacker uses the XSS to reach the GIF or GRE interface edit page and submits a crafted form parameter.
- The unescaped parameter is passed to a shell command, allowing arbitrary command execution as root.
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 firewall's web admin page had places where user input was put into the page or into system commands without proper cleaning. An attacker could send a special link to an admin; if the admin clicked it, the attacker's code would run in the admin's browser and could then run commands on the firewall itself.
What is XSS?
Script an attacker supplies runs in another user's browser, on the target's origin, with that user's session.