Skip to content
SSRF Write-up Advanced

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.

Demon Follow

Published on medium.com

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.

Demon, on medium.com

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

  1. Send a request to the Elasticsearch Watcher execute endpoint with a JSON payload that makes an HTTP request to an internal IP.
  2. Use the SSRF to sweep the internal subnet and identify a responding PHP management interface.
  3. Craft a payload that makes the internal PHP app request a URL on the attacker's server to confirm out-of-band connectivity.
  4. Modify the payload to make the internal PHP app download a binary from the attacker's server.
  5. Send a final payload to execute the downloaded binary with parameters for a reverse shell.
  6. 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.

Similar reports

View all

Same bug class and techniques, clearest first.

Server-side request forgery (SSRF)

The lesson behind this report.

The server can be made to fetch an address the attacker chooses, reaching internal services, cloud metadata or other customers' data.