Bug #17056
closedAuthenticated Command Execution via ``xmlrpc.php`` remote authentication privilege check
100%
Description
If pfSense software is configured to perform remote authentication via LDAP/RADIUS for the system itself, then the privilege check in xmlrpc.php can improperly test privileges in certain cases.
When xmlrpc.php attempts to check privileges it gathers account information via getUserEntry($username). This function returns an associative array that is missing the uid parameter if there is no matching local account. When checking privileges, a logic error causes this condition to not trigger the code that detects a lack of privileges to deny access.
This can allow a user with valid LDAP credentials, but no matching local account, to execute XMLRPC methods when they do not have the appropriate system-xmlrpc-ha-sync privilege. The available XMLRPC methods include exec_php which allows running arbitrary PHP code and by consequence, arbitrary shell commands.
POC script is attached that tests a variety of account types/privilege states. Read the comments and code for more info, but the accounts and infrastructure must already be setup for it to be of any use.
Files
JP Updated by Jim Pingle 22 days ago
- File 17056.patch 17056.patch added
- Status changed from New to Feedback
Fixed in commit 889905ba4db8e1b873da28ae115a10b9f0fd0b05
Corrected the privilege check to use an existing helper function that doesn't have the same logic error.
Patch is attached.
JP Updated by Jim Pingle 22 days ago
- % Done changed from 0 to 100
JP Updated by Jim Pingle 2 days ago
- Status changed from Feedback to Resolved
- Private changed from Yes to No
New version of the System Patches package includes a recommended patch entry for this.