PandoraFMS - Pre-Auth Remote Code Execution
PandoraFMS contained an authentication bypass using hardcoded secrets, an unauthenticated file upload, and a path traversal leading to local file inclusion. An attacker could chain these to upload a web shell and execute commands as the web server user without logging in.
Published on 3sjay.github.io
While chaining three primitives together I was able to achieve pre-auth remote code execution as apache user on the PandoraFMS appliance. Further on it was possible to elevate the priviliges to root and also take over any connected client (Not discussed in this blog post).
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 used hardcoded secrets for authentication, allowed unauthenticated file uploads, and included user-controlled paths without proper validation.
Impact
An unauthenticated attacker could execute arbitrary commands as the apache user, and potentially escalate to root, though SELinux may limit some actions.
What the attacker needed
Network access to the PandoraFMS web interface; no authentication required
How it was found
- Send a POST request with a file to the upload endpoint to upload a PHP web shell.
- Send a POST request to ajax.php with the hardcoded auth_hash and a page parameter pointing to the uploaded file to execute commands.
- Alternatively, use the upload endpoint with the 'up' parameter and a crafted UP-FILENAME header to write a web shell to a chosen path.
- Access the uploaded web shell via a GET request to execute commands.
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 software had a secret key hardcoded in its code, so anyone could pretend to be logged in. It also let anyone upload files without logging in, and a page parameter could be tricked into running an uploaded file. Together, an attacker could run their own commands on the server without any password.
What is RCE?
Running the attacker's code on the target's servers: through command or code injection, unsafe deserialisation or template injection.