<html>
    <head>
      <base href="https://bugs.webkit.org/" />
    </head>
    <body><table border="1" cellspacing="0" cellpadding="8">
        <tr>
          <th>Bug ID</th>
          <td><a class="bz_bug_link 
          bz_status_NEW "
   title="NEW - Origin HTTP header not set to null after following cross-origin redirect"
   href="https://bugs.webkit.org/show_bug.cgi?id=144817">144817</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>Origin HTTP header not set to null after following cross-origin redirect
          </td>
        </tr>

        <tr>
          <th>Classification</th>
          <td>Unclassified
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>WebKit
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>528+ (Nightly build)
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>Unspecified
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>All
          </td>
        </tr>

        <tr>
          <th>Status</th>
          <td>NEW
          </td>
        </tr>

        <tr>
          <th>Severity</th>
          <td>Normal
          </td>
        </tr>

        <tr>
          <th>Priority</th>
          <td>P2
          </td>
        </tr>

        <tr>
          <th>Component</th>
          <td>Page Loading
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>webkit-unassigned&#64;lists.webkit.org
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>hillbrad&#64;fb.com
          </td>
        </tr></table>
      <p>
        <div>
        <pre>The HTTP Origin header, described by <a href="https://tools.ietf.org/html/rfc6454">https://tools.ietf.org/html/rfc6454</a>, allows a server to determine a user agent's view of where a request originated from.

RFC6454 allows this header to be multi-valued on redirects, but CORS (<a href="http://w3.org/TR/cors">http://w3.org/TR/cors</a>) implicitly requires it to be single-valued (because it specifies an exact string match comparison).
All major user agents implement single-valued behavior, and because of this must set the header to 'null' when a redirect crosses same-origin boundaries.  If the value of the original Origin is preserved after a 3xx redirect, it may result in a confused deputy vulnerability that allows bypass of CSRF protections.

For example, the issue described at the following post is enabled by this incorrect behavior:

<a href="http://sakurity.com/blog/2015/03/05/RECONNECT.html">http://sakurity.com/blog/2015/03/05/RECONNECT.html</a>

Test cases are available at the following URLs:

<a href="https://www.webappsec-test.info/~bhill2/OriginRedir/test.php?redircode=302">https://www.webappsec-test.info/~bhill2/OriginRedir/test.php?redircode=302</a>
<a href="https://www.webappsec-test.info/~bhill2/OriginRedir/test.php?redircode=303">https://www.webappsec-test.info/~bhill2/OriginRedir/test.php?redircode=303</a>
<a href="https://www.webappsec-test.info/~bhill2/OriginRedir/test.php?redircode=307">https://www.webappsec-test.info/~bhill2/OriginRedir/test.php?redircode=307</a>
<a href="https://www.webappsec-test.info/~bhill2/OriginRedir/test.php?redircode=308">https://www.webappsec-test.info/~bhill2/OriginRedir/test.php?redircode=308</a>

WebKit is vulnerable by not setting Origin to null on cross-origin redirects on any 3xx status code which preserves the GET/POST payload.

A similar issue was reported to Blink for status code 308, and has since been patched, see:

<a href="https://code.google.com/p/chromium/issues/detail?id=465517">https://code.google.com/p/chromium/issues/detail?id=465517</a></pre>
        </div>
      </p>
      <hr>
      <span>You are receiving this mail because:</span>
      
      <ul>
          <li>You are the assignee for the bug.</li>
      </ul>
    </body>
</html>