Fix RXSS in status_captiveportal.php : leveraging XSS to Remote root command execution#3288
Closed
yanncam wants to merge 2 commits into
Closed
Fix RXSS in status_captiveportal.php : leveraging XSS to Remote root command execution#3288yanncam wants to merge 2 commits into
yanncam wants to merge 2 commits into
Conversation
…s CSRF to Remote root command exec The $_GET['order'] param is reinjected without any sanitization in the status_captiveportal.php page.
Fix RXSS in status_captiveportal.php : leveraging XSS to Remote root command execution
|
Before this pull request can be accepted you must first sign a CLA as described at https://www.pfsense.org/about-pfsense/#cla. Please read for more details. |
Contributor
|
I committed a more complete version with better validation on several pages. In the future, please submit vulnerability information to security@pfsense.org for proper disclosure. |
netgate-git-updates
pushed a commit
that referenced
this pull request
Aug 10, 2023
There's no need to keep a separate target field, and now it's easier to implement #3288.
netgate-git-updates
pushed a commit
that referenced
this pull request
Aug 15, 2023
Also, show an asterisk in place of 'Any' for the source, and avoid generating oNAT rules with invalid aliases.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The status_captiveportal.php suffers from a Reflected Cross-Site Scripting vulnerability (RXSS).
tl;dr : Demonstration video of the exploitation of a RXSS to bypass all CSRF security and trigger a Remote root reverse-shell on pfSense 2.3.2 latest release : https://www.youtube.com/watch?v=IWtf6LlfP_c&t=4s
This simple RXSS is triggered on page loading with a specific URL (validated with Firefox latest version 50.1.0) on the latest pfSense 2.3.2 RELEASE.
Through this XSS in GET param, an attacker can benefit of the current pfSense context in a victim's browser already logged as administrator in pfSense web administration interface.
Via this XSS, the attacker can forge his own and hidden request in the victim browser, with :
So, an attacker can exploit this XSS to bypass all CSRF mechanisms enabled in pfSense, then run a specific shell command to gain a full Reverse-root-Shell on the pfSense distribution.
As proof-of-concept, I've made this x.js script (to be hosted on the attacker's website like http://attacker.com/x.js for example) :
The attacker have to place a listening port (to receive the reverse-root-shell) with netcat for example on his own computer.
Then, just trigger the RXSS with this script included in the context of an authenticated session as admin in pfSense :
Change the "lhost" and "lport" parameters in the URL with the corresponding attacker's IP and port (with a netcat in listen mode).
This final URL can be obfuscated and/or hidden in a bitly.com short-url then sent to the legitimate pfSense's administrator.
I have created some BeEF modules (private for the moment, while pfSense isn't fixed) to exploit the same vulnerability / scenario.
This full PoC can be seen in the not-referenced demonstration video here : https://www.youtube.com/watch?v=IWtf6LlfP_c&t=4s
pfSense 2.3.2 contains several security mechanisms like:
But just with a simple RXSS in GET, all these security best-practices can be bypassed to gain a full reverse root shell remotely.
I suggest to double-check all $_GET/$_POST params directly reflected in the pfSense PHP source code without sanitization.
Plus, some HTTP headers can be added in pfSense for a better security, like: