<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE bugzilla SYSTEM "https://bugs.webkit.org/page.cgi?id=bugzilla.dtd">

<bugzilla version="5.0.4.1"
          urlbase="https://bugs.webkit.org/"
          
          maintainer="admin@webkit.org"
>

    <bug>
          <bug_id>29278</bug_id>
          
          <creation_ts>2009-09-15 13:33:02 -0700</creation_ts>
          <short_desc>XSSAuditor bypasses from sla.ckers.org</short_desc>
          <delta_ts>2011-08-31 13:35:17 -0700</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>1</classification_id>
          <classification>Unclassified</classification>
          <product>WebKit</product>
          <component>WebCore Misc.</component>
          <version>528+ (Nightly build)</version>
          <rep_platform>All</rep_platform>
          <op_sys>All</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>WORKSFORME</resolution>
          
          
          <bug_file_loc>http://sla.ckers.org/forum/read.php?13,31377</bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords>InRadar, XSSAuditor</keywords>
          <priority>P2</priority>
          <bug_severity>Normal</bug_severity>
          <target_milestone>---</target_milestone>
          <dependson>29306</dependson>
    
    <dependson>29511</dependson>
    
    <dependson>29523</dependson>
          <blocked>66579</blocked>
          <everconfirmed>1</everconfirmed>
          <reporter name="Adam Barth">abarth</reporter>
          <assigned_to name="Nobody">webkit-unassigned</assigned_to>
          <cc>abarth</cc>
    
    <cc>ap</cc>
    
    <cc>dbates</cc>
    
    <cc>ddkilzer</cc>
    
    <cc>mario.heiderich</cc>
    
    <cc>sam</cc>
    
    <cc>tsepez</cc>
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>147368</commentid>
    <comment_count>0</comment_count>
    <who name="Adam Barth">abarth</who>
    <bug_when>2009-09-15 13:33:02 -0700</bug_when>
    <thetext>The good folks at sla.ckers.org are pouring over the XSSAuditor in this thread:

http://sla.ckers.org/forum/read.php?13,31377

So far, they&apos;ve found two bypasses:

http://eaea.sirdarckcat.net/xss.php?html_xss=&lt;iframe+src=&quot;javascript:&apos;1%25251&apos;;alert(document.domain)&quot;&gt;
http://eaea.sirdarckcat.net/xss.php?html_xss=&lt;img%20src=ä%20onerror=alert(&apos;ä&apos;)&gt;

The first one is a nice double-encoding issue.  I think we&apos;re only decoding once.  I don&apos;t quite understand the second one yet.  Something tricky with unicode.

Feel free to create spin-off bugs for fixing each issue.  I just wanted a central place to write them down for now.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>147391</commentid>
    <comment_count>1</comment_count>
    <who name="Daniel Bates">dbates</who>
    <bug_when>2009-09-15 15:06:11 -0700</bug_when>
    <thetext>The second attack is blocked with r46250 with proposed patch 1 of bug #27895 (*).

(*)This is my working copy on one of my machines. I will look into doing a clean checkout to confirm.

(In reply to comment #0)
&gt; The good folks at sla.ckers.org are pouring over the XSSAuditor in this thread:
&gt; 
&gt; http://sla.ckers.org/forum/read.php?13,31377
&gt; 
&gt; So far, they&apos;ve found two bypasses:
&gt; 
&gt; http://eaea.sirdarckcat.net/xss.php?html_xss=&lt;iframe+src=&quot;javascript:&apos;1%25251&apos;;alert(document.domain)&quot;&gt;
&gt; http://eaea.sirdarckcat.net/xss.php?html_xss=&lt;img%20src=ä%20onerror=alert(&apos;ä&apos;)&gt;
&gt; 
&gt; The first one is a nice double-encoding issue.  I think we&apos;re only decoding
&gt; once.  I don&apos;t quite understand the second one yet.  Something tricky with
&gt; unicode.
&gt; 
&gt; Feel free to create spin-off bugs for fixing each issue.  I just wanted a
&gt; central place to write them down for now.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>147411</commentid>
    <comment_count>2</comment_count>
    <who name="Mario Heiderich">mario.heiderich</who>
    <bug_when>2009-09-15 16:25:04 -0700</bug_when>
    <thetext>Reduced copy of the recent post with the UTF-7/ISO filter circumvention:

&lt;copy&gt;
Charset conversions are not handled right as it seems - and can be used to init the real payload. Will I get a cookie for this? ;)

&lt;img%20src=ä%20onerror=alert(&apos;ä&apos;)&gt; // alerts Ã¤ on a ISO-8859-1 encoded site

http://sla.ckers.org/forum/read.php?13,31377,31440#msg-31438
&lt;/copy&gt;</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>147416</commentid>
    <comment_count>3</comment_count>
    <who name="Mario Heiderich">mario.heiderich</who>
    <bug_when>2009-09-15 16:32:09 -0700</bug_when>
    <thetext>(In reply to comment #2)
&gt; Reduced copy of the recent post with the UTF-7/ISO filter circumvention:
&gt; 
&gt; &lt;copy&gt;
&gt; Charset conversions are not handled right as it seems - and can be used to init
&gt; the real payload. Will I get a cookie for this? ;)
&gt; 
&gt; &lt;img%20src=ä%20onerror=alert(&apos;ä&apos;)&gt; // alerts Ã¤ on a ISO-8859-1 encoded site
&gt; 
&gt; http://sla.ckers.org/forum/read.php?13,31377,31440#msg-31438
&gt; &lt;/copy&gt;

Sry - UTF-8</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>147443</commentid>
    <comment_count>4</comment_count>
      <attachid>39628</attachid>
    <who name="Daniel Bates">dbates</who>
    <bug_when>2009-09-15 18:21:02 -0700</bug_when>
    <thetext>Created attachment 39628
temp. workaround with test case for IFrame JavaScript URL issue

For the IFrame JavaScript URL example:

Notice the source code portion of the JavaScript URL is URL decoded on line 745 (*) of FrameLoader.cpp &lt;http://trac.webkit.org/browser/trunk/WebCore/loader/FrameLoader.cpp#L745&gt; before it is passed to FrameLoader::executeScript which eventually passes it to the XSSAuditor.

Consider the example URL: http://eaea.sirdarckcat.net/xss.php?html_xss=&lt;iframe+src=&quot;javascript:&apos;1%25251&apos;;alert(document.domain)&quot;&gt; which echos in the HTTP response the string &lt;iframe src=&quot;javascript:&apos;1%251&apos;;alert(document.domain)&quot;&gt;. Looking at the source code portion of the JavaScript URL: &apos;1%251&apos;;alert(document.domain) and applying (*), we see that |script| is set to the string &quot;&apos;1%1&apos;;alert(document.domain)&quot;.

The XSSAuditor compares this to the URL-decoded URL of the page &lt;http://trac.webkit.org/browser/trunk/WebCore/page/XSSAuditor.cpp#L274&gt;, which is: http://eaea.sirdarckcat.net/xss.php?html_xss=&lt;iframe+src=&quot;javascript:&apos;1%251&apos;;alert(document.domain)&quot;&gt;.

Another issue, since the FrameLoader reuses the same pipeline for JavaScript URLs as JavaScript scripts, we are losing information on the origin of the script code (that is, was it extracted from a JavaScript URL or an inline JavaScript script).

The workaround calls the XSSAuditor::canEvaluateJavaScriptURL on the string source code portion of the JavaScript URL (i.e. url.string().substring(javascriptSchemeLength)) before it is decoded. So, XSSAuditor will be comparing &quot;&apos;1%251&apos;;alert(document.domain)&quot; to http://eaea.sirdarckcat.net/xss.php?html_xss=&lt;iframe+src=&quot;javascript:&apos;1%251&apos;;alert(document.domain)&quot;&gt;.

I am not happy with this workaround, because it calls the XSSAuditor twice (via XSSAuditor::canEvaluateJavaScriptURL and via FrameLoader::executeScript) and I have not fully vented it to my satisfaction.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>147623</commentid>
    <comment_count>5</comment_count>
    <who name="Adam Barth">abarth</who>
    <bug_when>2009-09-16 14:25:00 -0700</bug_when>
    <thetext>Here are some more examples:

http://eaea.sirdarckcat.net/xss.php?html_xss=%3Cimg+src=%220%22+onerror=%22/%80/;alert(document.domain)%22%3E

http://eaea.sirdarckcat.net/xss.php?html_xss=%3Cimg+src=&apos;%80&apos;+onerror=%27alert(document.domain)%27

The poster thinks these might be dups of https://bugs.webkit.org/show_bug.cgi?id=29306.  In any case, we might as well add test cases for them.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>261250</commentid>
    <comment_count>6</comment_count>
    <who name="Mario Heiderich">mario.heiderich</who>
    <bug_when>2010-08-06 07:47:39 -0700</bug_when>
    <thetext>I am not sure if this ticket should be resurrected but there&apos;s a new bypass on Safari 5 I just stumbled upon: 

urlencoded:
%22%3E%3Cscript%20src=%0adata:%01;base64,YWxlcnQoMSkNCg==%20/%3E

canonical:
&quot;&gt;&lt;script src= data:;base64,YWxlcnQoMSkNCg== /&gt;

The problem seems to be that Safari 5 automatically deals with self-closing script tags - which for example Chrome doesn&apos;t. 

&quot;XML self-closing tag syntax used on &lt;script&gt;.  The tag will be closed by WebKit, but not all browsers do this.  Change to &lt;script&gt;&lt;/script&gt; instead for best cross-browser compatibility.&quot;

I am not sure if this is a WebKit issue or a Safari only problem.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>261314</commentid>
    <comment_count>7</comment_count>
    <who name="Adam Barth">abarth</who>
    <bug_when>2010-08-06 09:57:16 -0700</bug_when>
    <thetext>Does this work with a nightly build?  We no longer support self-closing script tags.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>261320</commentid>
    <comment_count>8</comment_count>
    <who name="Mario Heiderich">mario.heiderich</who>
    <bug_when>2010-08-06 10:03:54 -0700</bug_when>
    <thetext>I just tested again - it bypasses the filter with a regular closing script tag too

%22%3E%3Cscript%20src=%0adata:%01;base64,YWxlcnQoMSkNCg==%20%3E%3C/script%3E

&quot;&gt;&lt;script src=
data:;base64,YWxlcnQoMSkNCg== &gt;&lt;/script&gt;

The script execution is being blocked as soon as the %0A before data: is being left away. Maybe that helps to locate the filter bug.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>262366</commentid>
    <comment_count>9</comment_count>
    <who name="Adam Barth">abarth</who>
    <bug_when>2010-08-09 15:47:09 -0700</bug_when>
    <thetext>*** Bug 43751 has been marked as a duplicate of this bug. ***</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>262372</commentid>
    <comment_count>10</comment_count>
    <who name="David Kilzer (:ddkilzer)">ddkilzer</who>
    <bug_when>2010-08-09 15:52:37 -0700</bug_when>
    <thetext>&lt;rdar://problem/8281296&gt;</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>454035</commentid>
    <comment_count>11</comment_count>
    <who name="Adam Barth">abarth</who>
    <bug_when>2011-08-19 13:37:24 -0700</bug_when>
    <thetext>We should close this bug and replace it with specific bugs about the remaining false negatives.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>459863</commentid>
    <comment_count>12</comment_count>
    <who name="Thomas Sepez">tsepez</who>
    <bug_when>2011-08-31 13:35:17 -0700</bug_when>
    <thetext>I&apos;m no longer reproducing any of these with chrome 14 or later.  Cases like this are covered by the new bugs:
https://bugs.webkit.org/show_bug.cgi?id=67134
https://bugs.webkit.org/show_bug.cgi?id=67134</thetext>
  </long_desc>
      
          <attachment
              isobsolete="1"
              ispatch="1"
              isprivate="0"
          >
            <attachid>39628</attachid>
            <date>2009-09-15 18:21:02 -0700</date>
            <delta_ts>2009-09-19 14:53:48 -0700</delta_ts>
            <desc>temp. workaround with test case for IFrame JavaScript URL issue</desc>
            <filename>workaround_iframe_javascript_url_double_encode.diff</filename>
            <type>text/plain</type>
            <size>2072</size>
            <attacher name="Daniel Bates">dbates</attacher>
            
              <data encoding="base64">SW5kZXg6IFdlYkNvcmUvbG9hZGVyL0ZyYW1lTG9hZGVyLmNwcAo9PT09PT09PT09PT09PT09PT09
PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09Ci0tLSBXZWJD
b3JlL2xvYWRlci9GcmFtZUxvYWRlci5jcHAJKHJldmlzaW9uIDQ4NDAyKQorKysgV2ViQ29yZS9s
b2FkZXIvRnJhbWVMb2FkZXIuY3BwCSh3b3JraW5nIGNvcHkpCkBAIC03NDMsNyArNzQzLDggQEAK
ICAgICBjb25zdCBpbnQgamF2YXNjcmlwdFNjaGVtZUxlbmd0aCA9IHNpemVvZigiamF2YXNjcmlw
dDoiKSAtIDE7CiAKICAgICBTdHJpbmcgc2NyaXB0ID0gZGVjb2RlVVJMRXNjYXBlU2VxdWVuY2Vz
KHVybC5zdHJpbmcoKS5zdWJzdHJpbmcoamF2YXNjcmlwdFNjaGVtZUxlbmd0aCkpOwotICAgIFNj
cmlwdFZhbHVlIHJlc3VsdCA9IGV4ZWN1dGVTY3JpcHQoc2NyaXB0LCB1c2VyR2VzdHVyZSk7Cisg
ICAgU2Nya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

</bugzilla>