Skip to content
CORS Disclosed report Advanced CVE-2022-45411

Generic CORS bypass that enables Cross-Site-Tracing (XST)

A server reflected the Access-Control-Request-Headers value back in its CORS allow-headers response, so a page could send an X-Http-Method-Override header set to TRACE and reach the TRACE method despite browser restrictions. This let an attacker combine it with an existing XSS to read authorisation headers and cookies marked HttpOnly.

scarlet Follow

Originally disclosed on Mozilla

  • Fixed in 43 days
  • Paid in 44 days
  • Disclosed after 43 days
Text
Steps to reproduce:

Cross Site Tracing (XST) used to be an effective way to bypass local controls and gain access to authorization headers and cookies protected by httponly attributes. However, for many years the main browsers have implemented limits on fetch and XMLHttpRequest that stop the direct use of the TRACE method.

Out in the real world, some servers that implement CORS simply echo back the contents of the Access-Control-Request-Headers request header in the Access-Control-Allow-Headers response header. This means that it is possible to add an X-Http-Method-Override: TRACE header, which will bypass CORS protections.

The result being that if certain conditions are met (a server has lax CORS, implements the TRACE method and the X-Http-Method-Override header), then fetch and XMLHttpRequest can still be used to bypass CORS and deliver an XST attack.

This will allow any functional XSS on the site to gain access to authorization headers and cookies protected by httponly attributes.

An example of a server with CORS that echos back the Access-Control-Request-Headers header:

fetch( 'https://realtime.www.linkedin.com/realtime/connect', {
   method: 'GET',
   mode: 'cors',
   headers: {
      'x-http-method-override': 'TRACE'
   }
} );


Actual results:

The combination of issues allows an XST attack to be delivered.


Expected results:

The TRACE method should be blocked in requests from fetch and XMLHttpRequest, whether it is in the main method parameter, or in common override headers ( 'x-http-method-override, x-http-method, x-http-override )

The original report as published on Mozilla's Bugzilla, by scarlet. Images and videos are our own copies; raw HTML is shown as text. View it on Mozilla's Bugzilla.

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 server reflected the client-supplied Access-Control-Request-Headers value into Access-Control-Allow-Headers without an allowlist, and also honoured the X-Http-Method-Override header to switch to TRACE.

Impact

If a server has lax CORS, supports TRACE and honours the override header, an attacker who already has XSS on the site could read authorisation headers and HttpOnly cookies.

What the attacker needed

Server echoes requested CORS headers; server supports TRACE method; server honours method-override header; existing XSS on the site

The fix

The TRACE method should be blocked for fetch and XMLHttpRequest requests, including when it is requested through common method-override headers, and CORS allow-headers should not blindly reflect client input.

How it was found

  1. Send a cross-origin fetch request to the target endpoint with an x-http-method-override header set to TRACE.
  2. Observe that the server echoes the requested header back in its CORS allow-headers response.
  3. Observe that the request is processed as TRACE, returning the request contents including headers and cookies.

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.

CORS is a browser rule that stops one website from reading responses from another site unless that site explicitly allows it. Some servers allow whatever request headers the browser asks about, and here that let a page sneak in a header that switches the request to the TRACE method, which echoes the request back. If an attacker already has a way to run script on the site, they could use this to read sensitive headers and cookies that are normally hidden from scripts.

What is CORS?

A permissive cross-origin policy lets another site read responses with the user's credentials.

More by scarlet

View all

2 more disclosed reports, best first.

More from Mozilla

View all

The newest disclosed reports for this program.

Similar reports

View all

Same bug class and techniques, clearest first.

CORS misconfiguration

The lesson behind this report.

A permissive cross-origin policy lets another site read responses with the user's credentials.