Shadow in the Index: Escalating Elasticsearch SSRF to Full System
A publicly exposed Elasticsearch Watcher API allowed server-side request forgery, which the attacker used to reach an internal PHP management interface with an unauthenticated JSON-RPC command execution flaw. This chain let the attacker download and run a binary, resulting in a reverse shell and remote code execution as a domain user.
The glow of the monitor was the only thing cutting through the 2:00 AM silence of the operations center. What began as a routine perimeter sweep had turned into a hunt.
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 Elasticsearch Watcher API was exposed without authentication and allowed arbitrary outbound HTTP requests, while the internal PHP application trusted requests from inside the network and passed user input to a command execution function.
Impact
The attacker achieved remote code execution as a domain user, which could lead to full domain takeover.
What the attacker needed
Publicly exposed Elasticsearch Watcher API; No authentication on Watcher API; Internal PHP app with JSON-RPC command execution; Internal PHP app can reach attacker server
The fix
The text does not state that the issue was fixed; it recommends never exposing management APIs publicly, enforcing authentication and RBAC, restricting Watcher actions, applying zero trust to internal APIs, sanitising execution sinks, and implementing strict egress filtering.
How it was found
- Send a request to the Elasticsearch Watcher execute endpoint with a JSON payload that makes an HTTP request to an internal IP.
- Use the SSRF to sweep the internal subnet and identify a responding PHP management interface.
- Craft a payload that makes the internal PHP app request a URL on the attacker's server to confirm out-of-band connectivity.
- Modify the payload to make the internal PHP app download a binary from the attacker's server.
- Send a final payload to execute the downloaded binary with parameters for a reverse shell.
- Start a listener and receive the reverse shell connection.
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 Elasticsearch server had a feature that lets it make web requests to other servers, and it was reachable from the internet. The attacker abused this to make the server contact an internal PHP application that could run commands without proper checks. By chaining these two weaknesses, the attacker got a remote shell on the internal machine.
What is SSRF?
The server can be made to fetch an address the attacker chooses, reaching internal services, cloud metadata or other customers' data.