Hadoop YARN RCE
The YARN ResourceManager REST API (port 8088) accepts application submissions without authentication by default. By submitting a new YARN application with an arbitrary command, an attacker gets remote code execution on any node in the Hadoop cluster. Confirm ResourceManager access through Hadoop enumeration first.
Application Submission RCE
YARN applications are submitted in two steps: create a new application ID, then submit the application with the command to execute.
{
"application-id": "application_1694000000000_0001",
"maximum-resource-capability": {
"memory": 8192,
"vCores": 4
}
}
Save the application-id for the submission step. If this returns 200, the ResourceManager accepts unauthenticated submissions.
Replace the application-id with the one from step 1. The command runs on a NodeManager as the hadoop/yarn user. Start nc -lvnp on your listener first.
Verifying Execution
Check the application status to confirm it was accepted and is running.
Check the "state" field. ACCEPTED/RUNNING means execution started. FAILED may indicate the command errored or the node lacks connectivity.
HDFS File Write
With WebHDFS access (port 9870), write files directly to the HDFS filesystem. Useful for planting SSH keys or cron jobs if HDFS paths map to local filesystem mounts.
Explain command
| -L | Follow the 307 redirect to the DataNode for the actual write. |
| op=CREATE | Create a new file at the specified path. |
WebHDFS writes go through a redirect: the NameNode responds with 307 pointing to a DataNode. The -L flag follows it. Verify with op=OPEN on the same path.
Automated Exploitation
Public exploit scripts automate the two-step submission process. Multiple tools available on GitHub for YARN RCE.
References
-
Hadoop: ResourceManager REST APIDOCS: Hadoop: ResourceManager REST API, hadoop.apache.org/docs/current/hadoop-yarn/hadoop-yarn-site/ResourceManagerRest.html (opens in new tab)
Official YARN API docs for application submission.
-
Vulhub: Hadoop YARN Unauthorized RCEREPO: Vulhub: Hadoop YARN Unauthorized RCE, github.com/vulhub/vulhub/tree/master/hadoop/unauthorized-yarn (opens in new tab)
Docker lab environment and PoC for YARN RCE.