Skip to content
SSRF Write-up Intermediate

Finding SSRF BY Full Automation

The author describes an automated method to find SSRF vulnerabilities by collecting URLs from the Wayback Machine and testing them with a cloud metadata address. In one case, the response contained a hostname indicating the server could reach internal metadata, potentially leaking cloud instance information.

Santosh Kumar Sha Follow

Published on notifybugme.medium.com

{{media:0}}

Santosh Kumar Sha (@killmongar1996), on notifybugme.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.

Written with AI from the full original report and checked against it passage by passage; anything it could not back up was removed or toned down. The original is the record. 4 min read.

Context

This write-up describes an approach to finding server-side request forgery (SSRF) through automation, using only curl and bash plus a small set of command-line tools. The author, Santosh Kumar Sha (@killmongar1996), a security researcher from India (Assam), explains how the technique was used to reach internal metadata, Amazon EC2 and cloud services, and says he has reported many SSRF issues on HackerOne using this process.

The article does not describe a single named target or product. Instead it uses a placeholder, targetme.com, to illustrate the workflow. The feature being abused is any parameter that causes the server to fetch a URL supplied by the user: when such a parameter exists, the server can be pointed at internal addresses instead of external ones.

Santosh Kumar Sha (@killmongar1996)
Santosh Kumar Sha (@killmongar1996) From the original on notifybugme.medium.com

Setup

The workflow starts from a target whose URLs carry parameters, collected from historical sources. The tools required, as listed in the article, are:

  1. gf (tomnomnom), https://github.com/tomnomnom/gf
  2. qsreplace (tomnomnom), https://github.com/tomnomnom/qsreplace
  3. ffuf, https://github.com/ffuf/ffuf
  4. gau (Corben), https://github.com/lc/gau
  5. waybackurls (tomnomnom), https://github.com/tomnomnom/waybackurls

The commands also use sort, anew, httpx, xargs, grep and tee, and for the blind variant a Burp Collaborator server or pingb.in is needed to receive DNS pingbacks. No versions are given.

Finding it

The reasoning is that SSRF candidates hide among the many URLs a site has exposed over time. The Wayback Machine and gau provide a large pool of historical URLs; filtering them to live hosts and to parameters that commonly carry URLs narrows the pool to a testable list. The author splits the work into two cases: one where the response can be read directly (non-blind SSRF, detected by looking for metadata content in the response) and one where only an out-of-band interaction is visible (blind SSRF, detected by DNS pingbacks).

Exploitation

Case #1: reading metadata with curl and bash

The goal here is to collect all URLs from the Wayback Machine and use them to reach internal metadata through SSRF. The target is assumed to be targetme.com.

Command for getting the URLs:

Bash
waybackurl targetme.com >> blindssrftesturl.txt
gau -subs targetme.com >> blindssrftesturl.txt

waybackurls and gau -subs both append historical URLs, including subdomains, to the same file.

Then the URLs are deduplicated, resolved, and each parameter value is replaced with the metadata URL:

What each part does:

  • sort -u | anew removes duplicates and keeps only new lines.
  • httpx resolves the hosts, which the author uses to remove false positives.
  • qsreplace substitutes every query-string value with http://[redacted]/latest/meta-data/hostname, the link-local metadata endpoint used by cloud instances.
  • xargs -I % -P 25 runs up to 25 requests in parallel, substituting each URL for %.
  • curl -ks fetches each URL silently, ignoring TLS certificate errors, with stderr merged into stdout.
  • grep "[redacted]" looks for the hostname suffix that the metadata endpoint returns on EC2 instances. A match prints SSRF VULN! followed by the URL that produced it.

A hit means the server fetched the metadata URL and returned its content, so the response contains the instance hostname ending in [redacted].

Case #2: blind SSRF with curl and bash

For blind SSRF the response cannot be read, so the detection relies on an out-of-band interaction. Again, URLs are collected from the Wayback Machine for the assumed target targetme.com.

Command for getting the URLs:

Bash
waybackurl targetme.com >> blindssrftesturl.txt
gau -subs targetme.com >> blindssrftesturl.txt

After getting all URLs, sort them, resolve them and remove false positives:

Bash
cat blindssrftesturl.txt | sort -u |anew | httpx |tee -a prefinal_ssrftesturl.txt

httpx keeps only hosts that resolve, and tee -a writes the surviving list to prefinal_ssrftesturl.txt while also printing it.

Extract URLs whose parameters are likely SSRF candidates with gf:

Bash
cat prefinal_ssrftesturl.txt | gf ssrf >> final_ssrftesturl.txt

gf ssrf extracts the URLs whose parameters the author considers vulnerable to SSRF.

Finally, automate the test with ffuf and a Burp Collaborator server (or pingb.in):

Bash
cat final_ssrftesturl.txt |qsreplace “Burp collaborator server” >> ssrf_auto-ffuf.txt
ffuf -c -w ssrf_auto-ffuf.txt -u FUZZ

qsreplace puts the Collaborator address into every parameter value, and ffuf uses the resulting list as its wordlist, sending each entry as the URL to request (-u FUZZ, with -c for coloured output).

Then check the Collaborator server for any DNS pingback. A pingback indicates that the server made the request. If a pingback arrives, the author goes on to internal port scanning.

Root cause

The article does not analyse the vulnerable code. The article does not analyse the vulnerable code or state a cause. The report does not say which defences, if any, were present or why they failed.

Impact

The author states the technique was used to leak private information from Amazon metadata, EC2 and cloud services. Where the response is not reflected, a confirmed pingback still proves the server can be made to issue requests to attacker-chosen destinations, which the author follows up with internal port scanning. The impact depends on the privileges of the server and on what the metadata service exposes; the report gives no further detail on either.

Fix

The article does not describe any fix or remediation applied by a vendor.

Variants to test

  • Run the Case #1 pipeline against any host list and look for [redacted] in the response, which indicates the metadata hostname was fetched.
  • Run the Case #2 pipeline with a Collaborator or pingb.in address and watch for DNS pingbacks, which indicate blind SSRF.
  • After a pingback, try internal port scanning from the same parameter to map reachable services.

Written with AI from the full original report and checked against it passage by passage; anything it could not back up was removed or toned down. The original is the record. 12 min read.

What happened, in plain words

This article is a walkthrough by Santosh Kumar Sha (@killmongar1996), a security researcher from India (Assam), of a way to hunt for a class of bug called server-side request forgery, or SSRF, using automation. He says the technique was used to reach internal metadata, Amazon EC2 and cloud services, and that he has reported many SSRF issues on HackerOne using this process.

Before the details, a few ideas from zero, because everything below depends on them.

A server is the computer that runs a website. When you visit a page, your browser asks the server for it and the server sends it back. A request is that ask. Normally your browser makes the request and the server answers.

An API is a way for one piece of software to ask another for data or to do something, without a human clicking. Think of it as a service counter: you hand over a form with a request written on it, and the clerk behind the counter goes and fetches what you asked for. Many websites have features where the server itself fetches a URL for you: for example, a page that shows a preview of a link you paste, or an image importer that downloads a picture from a web address. The server is the clerk, and the URL you supply is the form.

SSRF is what happens when that clerk will fetch any address you write on the form, including addresses that only the server itself can reach. Those internal addresses are not meant to be visible from the outside internet. If you can make the server fetch one and hand the result back to you, you have used the server as a middleman to reach places you could not reach yourself. A simple comparison: you cannot walk into the staff-only back room of a shop, but if the person at the counter will go into the back room on your behalf and bring back whatever you name, you can see inside it anyway.

A parameter is a named value attached to a URL, usually after a question mark. In https://example.com/fetch?url=https://example.org, the parameter is url and its value is https://example.org. Parameters are exactly where SSRF tends to hide: a parameter whose value is a URL is a parameter the server may fetch.

Metadata in cloud computing means information the cloud platform makes available to a running server about itself: its hostname, its identity, configuration and more. Cloud providers expose this at a special internal address that only the server can reach. On Amazon's cloud (EC2), that address is [redacted]. It is a link-local address, meaning it is only meaningful on the local network segment and is not routable across the internet. If an attacker can make a server fetch that address, the server will happily answer with its own private details.

Blind SSRF is the same bug when the server does not show you the fetched content. You cannot read the reply, so you have to detect the bug another way: by making the server contact a machine you control and watching for that contact.

Automation here means writing a short chain of commands so that thousands of candidate URLs are tested without clicking through them by hand. The article uses the command line, a text-only way of giving instructions to a computer, and small programs that each do one job and pass their output to the next.

The article does not describe a single named target or product. It uses a placeholder, targetme.com, to stand in for whatever site you are testing. The feature being abused is any parameter that causes the server to fetch a URL supplied by the user: when such a parameter exists, the server can be pointed at internal addresses instead of external ones.

Santosh Kumar Sha (@killmongar1996)
Santosh Kumar Sha (@killmongar1996) From the original on notifybugme.medium.com

Setup

The workflow starts from a target whose URLs carry parameters, collected from historical sources. The tools required, as listed in the article, are:

  1. gf (tomnomnom), https://github.com/tomnomnom/gf
  2. qsreplace (tomnomnom), https://github.com/tomnomnom/qsreplace
  3. ffuf, https://github.com/ffuf/ffuf
  4. gau (Corben), https://github.com/lc/gau
  5. waybackurls (tomnomnom), https://github.com/tomnomnom/waybackurls

A word on each, because the names are not self-explanatory:

  • gf is a pattern matcher. You give it a named pattern (here, ssrf) and it keeps only the lines that look like that pattern. Think of it as a highlighter that only marks the sentences you care about.
  • qsreplace rewrites the value part of every parameter in a URL. If a URL has ?url=something, qsreplace can put your chosen value in place of something across a whole list at once.
  • ffuf is a fuzzer: it takes a list of inputs and sends a request for each one, substituting the input where you put the placeholder FUZZ.
  • gau fetches known URLs for a domain from public archives.
  • waybackurls does something similar, pulling URLs that the Internet Archive's Wayback Machine has recorded for a domain over time.

The commands also use sort, anew, httpx, xargs, grep and tee, and for the blind variant a Burp Collaborator server or pingb.in is needed to receive DNS pingbacks. No versions are given.

A few more plain definitions before the commands:

  • sort -u sorts lines and removes duplicates (-u means unique).
  • anew appends only lines it has not seen before, so a file does not fill up with repeats.
  • httpx takes a list of hostnames and resolves them, which the author uses to remove false positives.
  • xargs takes lines of input and turns them into arguments for another command, optionally several at a time.
  • grep searches text for a pattern and prints the lines that match.
  • tee writes its input to a file while also passing it along, like a pipe with a side branch.
  • curl fetches a URL from the command line.
  • DNS is the internet's address book: it turns a name like example.com into a numeric address. A DNS pingback is a lookup that arrives at a server you control, telling you that some machine tried to resolve a name you planted.
  • Burp Collaborator and pingb.in are services that give you a unique hostname and record any DNS lookups or connections made to it, so you can see when a target server reaches out.

Finding it

The reasoning is that SSRF candidates hide among the many URLs a site has exposed over time. The Wayback Machine and gau provide a large pool of historical URLs; filtering them to live hosts and to parameters that commonly carry URLs narrows the pool to a testable list. The author splits the work into two cases: one where the response can be read directly (non-blind SSRF, detected by looking for metadata content in the response) and one where only an out-of-band interaction is visible (blind SSRF, detected by DNS pingbacks).

Exploitation

Case #1: reading metadata with curl and bash

The goal here is to collect all URLs from the Wayback Machine and use them to reach internal metadata through SSRF. The target is assumed to be targetme.com.

Command for getting the URLs:

Bash
waybackurl targetme.com >> blindssrftesturl.txt
gau -subs targetme.com >> blindssrftesturl.txt

Line by line:

  1. waybackurl targetme.com >> blindssrftesturl.txt asks the Wayback Machine for URLs recorded for targetme.com and appends them to a file called blindssrftesturl.txt. The >> means append, so the file grows rather than being overwritten.
  2. gau -subs targetme.com >> blindssrftesturl.txt does the same with gau. The -subs flag includes subdomains, so URLs from blog.targetme.com, api.targetme.com and so on are collected too.

Why this step: you cannot test what you do not know exists. Historical archives remember URLs that may no longer be linked from the site but still work, and those forgotten URLs often carry parameters nobody has audited.

Then the URLs are deduplicated, resolved, and each parameter value is replaced with the metadata URL:

What each part does:

  • cat blindssrftesturl.txt prints the contents of the file, feeding the rest of the chain.
  • sort -u | anew removes duplicates and keeps only new lines, so the same URL is not tested twice.
  • httpx resolves the hosts and keeps the live ones, dropping URLs whose host no longer exists. This avoids wasting requests on dead sites.
  • qsreplace substitutes every query-string value with http://[redacted]/latest/meta-data/hostname, the link-local metadata endpoint used by cloud instances. In plain terms, every parameter that used to hold some value now holds the internal metadata address. If the server fetches parameter values, it will now fetch the metadata address.
  • xargs -I % -P 25 runs up to 25 requests in parallel, substituting each URL for %. Parallelism matters because testing thousands of URLs one at a time would take hours.
  • curl -ks fetches each URL silently (-s), ignoring TLS certificate errors (-k), with stderr merged into stdout (2>&1) so error messages are also searched.
  • grep "[redacted]" looks for the hostname suffix that the metadata endpoint returns on EC2 instances. A match prints SSRF VULN! followed by the URL that produced it.

A hit means the server fetched the metadata URL and returned its content, so the response contains the instance hostname ending in [redacted]. In everyday terms: you asked the clerk to fetch a document from the back room, and the clerk handed it back to you with the back room's label still on it.

Case #2: blind SSRF with curl and bash

For blind SSRF the response cannot be read, so the detection relies on an out-of-band interaction. Again, URLs are collected from the Wayback Machine for the assumed target targetme.com.

Command for getting the URLs:

Bash
waybackurl targetme.com >> blindssrftesturl.txt
gau -subs targetme.com >> blindssrftesturl.txt

These two lines are identical to Case #1: gather historical URLs, including subdomains, into one file. The reason is the same: the more candidate URLs you have, the better your chance of finding one whose parameter the server fetches.

After getting all URLs, sort them, resolve them and remove false positives:

Bash
cat blindssrftesturl.txt | sort -u |anew | httpx |tee -a prefinal_ssrftesturl.txt

Here httpx keeps only hosts that resolve, and tee -a writes the surviving list to prefinal_ssrftesturl.txt while also printing it. The -a means append. The point of this step is to throw away dead hosts early, so later steps do not waste time on them.

Extract URLs whose parameters are likely SSRF candidates with gf:

Bash
cat prefinal_ssrftesturl.txt | gf ssrf >> final_ssrftesturl.txt

gf ssrf extracts the URLs whose parameters the author considers vulnerable to SSRF. The result is appended to final_ssrftesturl.txt. The reason for this filter is that most parameters are not URLs at all, so testing all of them would be noise; gf narrows the list to the ones worth trying.

Finally, automate the test with ffuf and a Burp Collaborator server (or pingb.in):

Bash
cat final_ssrftesturl.txt |qsreplace “Burp collaborator server” >> ssrf_auto-ffuf.txt
ffuf -c -w ssrf_auto-ffuf.txt -u FUZZ

Line by line:

  1. cat final_ssrftesturl.txt | qsreplace "Burp collaborator server" >> ssrf_auto-ffuf.txt puts the Collaborator address into every parameter value and writes the resulting URLs to ssrf_auto-ffuf.txt. In practice you would replace the quoted text with the unique hostname the Collaborator service gave you.
  2. ffuf -c -w ssrf_auto-ffuf.txt -u FUZZ uses the resulting list as its wordlist (-w), sending each entry as the URL to request (-u FUZZ, with -c for coloured output).

Then check the Collaborator server for any DNS pingback. A pingback indicates that the server made the request. In everyday terms: you left a note in the back room saying "call this number", and when your phone rings you know someone in the back room read the note. If a pingback arrives, the author goes on to internal port scanning, which means trying to see which internal services the server can reach through the same parameter.

Root cause

The article does not analyse the vulnerable code. The article does not analyse the vulnerable code or state a cause. The report does not say which defences, if any, were present or why they failed.

Impact

The author states the technique was used to leak private information from Amazon metadata, EC2 and cloud services. Where the response is not reflected, a confirmed pingback still proves the server can be made to issue requests to attacker-chosen destinations, which the author follows up with internal port scanning. The impact depends on the privileges of the server and on what the metadata service exposes; the report gives no further detail on either.

Fix

The article does not describe any fix or remediation applied by a vendor.

Variants to test

  • Run the Case #1 pipeline against any host list and look for [redacted] in the response, which indicates the metadata hostname was fetched.
  • Run the Case #2 pipeline with a Collaborator or pingb.in address and watch for DNS pingbacks, which indicate blind SSRF.
  • After a pingback, try internal port scanning from the same parameter to map reachable services.

Glossary

  • API: a way for one piece of software to ask another for data or to perform an action, without a human clicking.
  • anew: a command-line tool that appends only lines it has not seen before.
  • blind SSRF: an SSRF bug where the server does not return the fetched content, so detection relies on an out-of-band signal such as a DNS lookup.
  • Burp Collaborator: a service that gives you a unique hostname and records any DNS lookups or connections made to it.
  • cloud: remote computers rented over the internet, such as Amazon's EC2, that run your software.
  • curl: a command-line tool for fetching URLs.
  • DNS: the internet's address book, turning names into numeric addresses.
  • DNS pingback: a DNS lookup that arrives at a server you control, proving some machine tried to resolve a name you planted.
  • EC2: Amazon's cloud computing service for running servers.
  • ffuf: a fuzzer that sends a request for each entry in a wordlist, substituting it where FUZZ appears.
  • gau: a tool that fetches known URLs for a domain from public archives.
  • gf: a pattern matcher that keeps only lines matching a named pattern, such as ssrf.
  • grep: a command that searches text for a pattern and prints matching lines.
  • httpx: a tool that checks which hostnames in a list actually respond.
  • link-local address: an address such as [redacted] that is only meaningful on the local network segment and is not routable across the internet.
  • metadata: information a cloud platform exposes to a running server about itself, such as its hostname and configuration.
  • parameter: a named value attached to a URL, usually after a question mark, such as ?url=....
  • pingb.in: a service similar to Burp Collaborator that records DNS lookups and connections to a hostname it gives you.
  • qsreplace: a tool that replaces the value part of every parameter in a list of URLs.
  • request: an ask sent from one computer to another, for example a browser asking a server for a page.
  • server: the computer that runs a website and answers requests.
  • sort -u: a command that sorts lines and removes duplicates.
  • SSRF (server-side request forgery): a bug where an attacker can make a server fetch a URL of the attacker's choosing, including internal addresses the attacker cannot reach directly.
  • tee: a command that writes its input to a file while also passing it along.
  • URL: a web address, such as https://example.com/page?x=1.
  • waybackurls: a tool that pulls URLs recorded by the Internet Archive's Wayback Machine for a domain.
  • Wayback Machine: an archive of web pages and URLs collected over time.
  • xargs: a command that turns lines of input into arguments for another command, optionally running several at once.

More by Santosh Kumar Sha

View all

16 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.