How to Decrypt Manage Engine PMP Passwords for Fun and Domain Admin - a Red Teaming Tale
An internet-exposed ManageEngine Password Manager Pro instance was vulnerable to a pre-authentication deserialisation flaw, allowing remote code execution. After gaining a shell, the authors reverse-engineered the password encryption to decrypt stored credentials and escalate to Domain Admin.
Published on shielder.com
During a recent Red Teaming assessment we have found an internet-exposed instance of ManageEngine’s Password Manager Pro which was vulnerable to a pre-authentication Remote Code Execution (CVE-2022-35405). After gaining code execution we reverse engineered the password encryption/decryption routine to decrypt all the…
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 XML-RPC handler accepted Java serialised objects and deserialised them without validation, and the password manager used a hardcoded key and a server-side decryption design that exposed all secrets to anyone with code execution.
Impact
An attacker could execute arbitrary code on the server and decrypt all stored passwords, potentially leading to full domain compromise.
What the attacker needed
Internet-exposed PMP instance; vulnerable version (pre-patch); network access to the XML-RPC endpoint
How it was found
- Identify the ManageEngine Password Manager Pro version and find a known vulnerability.
- Craft a serialised payload using ysoserial and send it to the XML-RPC endpoint to test gadgets.
- Use the working gadget to obtain a reverse shell on the server.
- Read the database_params.conf file and the pmp_key.key file from the server.
- Decrypt the database password and connect to the PostgreSQL database.
- Retrieve the master key from the Ptrx_NotesInfo table and decrypt stored passwords.
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 password manager stores many passwords in encrypted form. The bug let an attacker run commands on the server without logging in. Once on the server, the attacker could read the keys used to encrypt the passwords and decrypt them all.
What is RCE?
Running the attacker's code on the target's servers: through command or code injection, unsafe deserialisation or template injection.