-
Notifications
You must be signed in to change notification settings - Fork 14
Canonicalization should take care of EOF as it would lead to XSS in IE8 or below. #42
Comments
How did your canalization logic handle the case without EOF? i.e. Could you show me the code that you handle |
Short answer: No canonicalization needed. tl;dr Our current canonicalization categorizations The step-by-step process I check whether and how something is canonicalized:
In case really a char is found resulting in parse error (note, none in this sample), a further check is to see the corresponding 1:1 mapping of state-specific cases at https://github.com/yahoo/context-parser/blob/master/tests/unit/run-strict-context-parser.js#L338 and we can quickly tell how it's corrected from the example case. Further check the source code if details are needed. also note that the sample ends in DATA state, where EOF at there is valid. |
Let me repeat my question in another form: Have you check if IE7 and 8 exploitable with the following?
|
I think (a) should be "Null byte parse error correction" instead of all types of parse error, right? |
Checked. Surely non-exploitable.
No. Here're some non-NULL kind of parse error corrections:
It may not be appropriate to immediately jump to a title like using canonicalization to handle EOF before any discussions on the mitigation side. My two cents:
|
The current implementation of canonicalization is unfit to handle EOF, and it does not necessarily mean it should not be in scope of canonicalization. Indeed this should give you some hints that the way |
Here's a sample of an EOF in Attribute value (double-quoted) state:
According to the spec, when the EOF is encountered. It says it's a parse error, and that compliant browser will switch to DATA state. If rendered in latest browsers like Chrome and Firefox, only hello will get rendered, and ended in DATA state. the incomplete tag is actually NOT emitted to the DOM/output.
But unfortunately older browsers like IE7-8 behaved differently, the incomplete tag gets rendered, and that the string
<a href="<script>{{untrusted}}</script>
is considered as begun in DATA state, and somehow transitioned into SCRIPT state.Context parser now considers the placeholder
{{untrusted}}
as placed in attribute value (double-quoted) state. But it ignored the consequence of EOF. That leads the downstream project secure-handlebars to simply insert a filter equiv. touriInDoubleQuotedAttr()
for that placeholder. An attacker usingalert(1)
will be able to launch XSS.The EOF problem was marked as TODO inside the source code.
@neraliu @yukinying @maditya
The text was updated successfully, but these errors were encountered: