Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CORS-safelisted request headers should be restricted according to RFC 7231 #382

Closed
johnwilander opened this issue Sep 6, 2016 · 3 comments
Labels
security/privacy There are security or privacy implications topic: cors

Comments

@johnwilander
Copy link

Fetch only restricts Content-Type request values beyond field-content token production: https://fetch.spec.whatwg.org/#cors-safelisted-request-header

This means simple CORS requests can send unexpected characters in Accept, Accept-Language, and Content-Language header values. As an example, header value "() { :;};" could exploit the infamous Shellshock server vulnerability from 2014 (http://www.cvedetails.com/cve/cve-2014-6271).

RFC 7231 does not allow "() { :;};" as a value for these headers from what I can tell:
Accept https://tools.ietf.org/html/rfc7231#section-5.3.2
Accept-Language https://tools.ietf.org/html/rfc7231#section-5.3.5
Content-Language https://tools.ietf.org/html/rfc7231#section-3.1.3.2

So far browsers have not restricted these headers and so server backends have to do the validation. I suggest we close this payload delivery mechanism in the Fetch spec.

This was briefly discussed at the W3C WebAppSec meeting May 17, 2016: https://www.w3.org/2011/webappsec/minutes/2016-05-17-webappsec-minutes.html#item08

@annevk annevk added the security/privacy There are security or privacy implications label Sep 7, 2016
@annevk
Copy link
Member

annevk commented Sep 7, 2016

Did you see #313? Also, wouldn't this potentially break a ton of deployed content?

@johnwilander
Copy link
Author

I did not see #313. My GitHub account was set up with an old email address which is why I didn't react on the ping in June. Sorry about that.

As for risk of breakage, yes, things will break. That's why we want to do this in a coordinated way.

From what I hear the decision to field-content token production for these headers was never really specified.

Should we have the security discussion here or in #313?

@annevk
Copy link
Member

annevk commented Sep 7, 2016

The other issue is probably better since it has more folks copied. (And yeah, the definition of a header value needs work: #332.)

annevk added a commit that referenced this issue May 25, 2018
This should reduce the attack surface of non-preflighted requests quite a bit.

Fixes #382. Closes #313.
annevk added a commit that referenced this issue May 30, 2018
This should reduce the attack surface of non-preflighted requests quite a bit.

Fixes #382. Closes #313.
annevk added a commit that referenced this issue May 30, 2018
This should reduce the attack surface of non-preflighted requests quite a bit.

Fixes #382. Closes #313.
annevk added a commit that referenced this issue Jun 18, 2018
This should reduce the attack surface of non-preflighted requests quite a bit.

Tests: web-platform-tests/wpt#11432.

Fixes #382. Closes #313.
annevk added a commit that referenced this issue Aug 16, 2018
This should reduce the attack surface of non-preflighted requests quite a bit.

Tests: web-platform-tests/wpt#11432.

Fixes #382. Closes #313.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
security/privacy There are security or privacy implications topic: cors
Development

No branches or pull requests

2 participants