Skip to content
SSRF Write-up Advanced

SSRF to RCE

A web application allowed users to supply a URL that the server would fetch, and the HTTP library mishandled carriage-return and line-feed characters in the URL, letting an attacker inject arbitrary HTTP requests. This was chained with a default-configured HashiCorp Consul agent on localhost to register a check that executed a shell command, achieving remote code execution.

Peter Adkins Follow

Published on kernelpicnic.net

This post details an example of chaining three relatively trivial vulnerabilities to achieve remote code execution on a Bug Bounty target. These vulnerabilities alone would have likely been of low severity, but when used together they were scored and rewarded together as a High Priority (P1) issue.

Peter Adkins (@darkarnium), on kernelpicnic.net

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

Impact

An attacker could execute arbitrary shell commands on the server, leading to remote code execution, though the report notes the Consul agent was only potentially present and the exploit relied on default ACL settings.

What the attacker needed

A logged-in user account; ability to supply an external URL; Consul agent on localhost with default ACLs

The fix

The vulnerability was fixed by the provider after being reported, as stated in the text.

How it was found

  1. Provide a URL to the external web service feature that includes carriage-return and line-feed characters to inject a follow-on HTTP request.
  2. Use the injected request to send an HTTP PUT to the Consul check registration endpoint on localhost port 8500.
  3. Register an HTTP check pointing to an attacker-controlled server to confirm Consul is present and ACLs are absent.
  4. Replace the HTTP check with a script check that runs a shell command and sends output to the attacker's server.
  5. Wait for the check interval to elapse and observe the command output arriving at the attacker's server.

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 application let you give it a web address to fetch. The tool it used to fetch that address did not properly clean up special newline characters in the address, so an attacker could sneak in extra requests. One of those extra requests talked to a local service called Consul, which by default lets anyone register a command to run, leading to code execution on the server.

What is SSRF?

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

More by Peter Adkins

View all

1 more disclosed report, best first.

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.