Skip to content
SSRF Write-up Intermediate

Hacking the Hackers: Leveraging an SSRF in HackerTarget

An SSRF vulnerability in HackerTarget's HTTP headers API allowed requests to internal services. The attacker bypassed a weak localhost blocklist and used a redirect to gopher:// to send commands to an internal SMTP server, sending an email from [redacted]

Corben Leo Follow

Published on corben.io

This is a write-up of an SSRF I accidentally found in HackerTarget and leveraged to get access to internal services! Please note that they don't have an active bug bounty program.

Corben Leo, on corben.io

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 API accepted user-supplied URLs without validating that the resolved IP address was not internal, and the initial fix only blocked the string '[redacted]'.

Impact

An attacker could access internal services and send emails from the internal SMTP server, though the API rate limit of 25 queries per IP restricted port scanning.

What the attacker needed

Access to the public API; Ability to host a redirect script; No authentication required

The fix

The vulnerability should be fixed by resolving the supplied domain and checking the resolved IP against local ranges, rather than using string-based checks.

How it was found

  1. Use the HTTP headers API with a target URL to fetch headers.
  2. Try querying [redacted] to see if internal requests are allowed.
  3. After a patch blocking [redacted], use alternative representations like 0177.1 to bypass.
  4. Scan internal ports using the API with a bypass address and port numbers.
  5. Create a PHP redirect to gopher:// to send multiline requests.
  6. Use the redirect to send SMTP commands to the internal mail server on port 25.

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.

Server-Side Request Forgery (SSRF) is when an attacker can make a server send requests to places it shouldn't, like internal services. Here, the HackerTarget API fetched HTTP headers for any address given, including internal ones. The attacker bypassed a simple block on '[redacted]' and then used a redirect to a special protocol to talk to an internal email 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 Corben Leo

View all

9 more disclosed reports, 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.