Combining Hadoop and MCollective for total network compromise
An unauthenticated Hadoop ResourceManager REST API allowed remote command execution, and a sudoers blacklist plus an ActiveMQ misconfiguration let the attackers escalate to root and then control over 12,000 MCollective-managed instances.
medium.com
Published on medium.com
This is the story of how only two insecure configurations allowed us to take down an entire cloud hosted company. It was a gray box pentest for a relatively big client, in which we were tasked with assessing the security of about 5 development endpoints, accessible only using a client certificate.
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 Hadoop ResourceManager REST API lacked authentication, the sudoers rule used a blacklist instead of a whitelist, and the ActiveMQ user had write access to the MCollective queue.
Impact
The attackers gained root on the Hadoop cluster and could execute commands on over 12,000 MCollective-managed instances, though the cluster was segmented and SSH used public-key authentication.
What the attacker needed
Access to the development endpoints; client certificate for the endpoints; Hadoop ResourceManager API reachable; MCollective credentials from config
The fix
The ideal fix would be to restrict ActiveMQ permissions so the mcollective user has read-only access, and to migrate to Choria with an action policy that denies by default.
How it was found
- Scan the development endpoints with Nessus, which found an exploitable Hadoop vulnerability.
- Use a Metasploit module to exploit the unauthenticated Hadoop ResourceManager REST API and gain a low-privileged shell.
- Run sudo -l and find a blacklist-based sudoers entry for the service command.
- Escalate to root using the service command with a path traversal to run a shell.
- Read the MCollective configuration and find shared credentials for the ActiveMQ queue.
- Install MCollective, copy the server configuration, and use the shellcmd plugin to run commands on many instances.
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 Hadoop cluster is a group of computers that store and process large amounts of data. Its management API was left open without a password, so anyone who could reach it could run commands on the machines. Separately, a messaging service used by a management tool let a low-privilege account send commands to thousands of servers.
What is RCE?
Running the attacker's code on the target's servers: through command or code injection, unsafe deserialisation or template injection.