New issue
Advanced search Search tips

Issue 669519 link

Starred by 1 user

Issue metadata

Status: WontFix
Owner: ----
Closed: Nov 2016
EstimatedDays: ----
NextAction: ----
OS: ----
Pri: ----
Type: Bug-Security



Sign in to add a comment

Security: Incomplete handling for Preflighted Cross-Origin XMLHttpRequests

Reported by eranw...@gmail.com, Nov 29 2016

Issue description

VULNERABILITY DETAILS
When making a Cross-Origin XMLHttpRequest POST request that has 'withCredentials' set to true as well as 'Content-Type: application/json', Google Chrome fails to interpret the server's Access-Control-Request-Methods header in its response to the Preflight request. That is, Google Chrome will send a subsequent 'POST' request EVEN IF the server responds with 'Access-Control-Request-Methods: GET' in its response to the browser's Preflight.

VERSION
Chrome Version: 54.0.2840.99 m + stable
Operating System: Windows 7 SP1

REPRODUCTION CASE
Let's say that our server responds like so to an OPTIONS preflight request:
Access-Control-Allow-Credentials: true
Access-Control-Allow-Headers: Origin,Accept,Content-Type,...
Access-Control-Allow-Methods: GET
Access-Control-Allow-Origin: <some origin>
Access-Control-Expose-Headers: Range
Access-Control-Max-Age: 3600

The below JavaScript that will make Google Chrome create an XMLHttpRequest that I believe SHOULD fail:
var xhr = new XMLHttpRequest();
xhr.open('POST', 'https://some-domain-that-supports-cors');
xhr.withCredentials = true;
xhr.setRequestHeader('content-type','application/json');
xhr.send(JSON.stringify({'test':'payload'});

 
Status: WontFix (was: Unconfirmed)
The issue reproduces as described, but Firefox 53a1 shows the same behavior.

In https://fetch.spec.whatwg.org/#http-cors-protocol, section "4.7. CORS-preflight fetch" algorithm step 7.7, the spec says:

"If request’s method is not in methods, is not a CORS-safelisted method, and methods does not contain `*`, then return a network error."

Elsewhere in the spec, it says:
A CORS-safelisted method is a method that is `GET`, `HEAD`, or `POST`.

Indeed, if you change the repro to use `PUT` instead of `POST`, Firefox fails the request silently while Chrome fails the request and adds the console message: "XMLHttpRequest cannot load http://some-domain-that-supports-cors/. Method PUT is not allowed by Access-Control-Allow-Methods in preflight response."
Labels: -Restrict-View-SecurityTeam

Comment 3 by eranw...@gmail.com, Nov 30 2016

Okay. Is it okay if I speak about this publically then?

‏בתאריך יום שלישי, 29 בנובמבר 2016, elawre… via monorail <
monorail+v2.271331812@chromium.org> כתב:

Sign in to add a comment