Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>\u003c and similar codes are perfectly valid for JS. You can obfuscate whole JS files using this syntax, if you so choose. Essentially, you're seeing an escape character \, u for unicode, and then a 4-character Hex code which relates to a symbol.</p> <p><a href="http://javascript.about.com/library/blunicode.htm" rel="nofollow">http://javascript.about.com/library/blunicode.htm</a></p> <p>\u003c - as you've noted, is the &lt; character.</p> <p>One approach to "fixing" this on the MVC side would be to write a RegEx which looks for the pattern \u - and then captures the next 4 characters. You could then un-encode them into actual unicode characters - and run the resultant text through your XSS prevention algorithms.</p> <p>As you've noted in your question - just looking for "&lt;" doesn't help. You also can't just look for "\u003cscript" - because this assumes the potential hacker hasn't simply unicode-encoded the entire "script" tag word. The safer approach is to un-escape all of these kinds of codes and then cleanse your HTML in plain-text.</p> <p>Incidentally, it might make you feel better to note that this is one of the common (and thusfar poorly resolved) issues in XSS prevention. So you aren't alone in wanting a better solution...</p> <p>You might check out the following libraries to assist in the actual html cleansing:</p> <p><a href="http://wpl.codeplex.com/" rel="nofollow">http://wpl.codeplex.com/</a> (Microsoft's attempt at a solution - though very bad user feedback) <a href="https://www.owasp.org/index.php/Category:OWASP_AntiSamy_Project_.NET" rel="nofollow">https://www.owasp.org/index.php/Category:OWASP_AntiSamy_Project_.NET</a> (A private project which is designed to do a lot of this kind of prevention. I find it hard to use, and poorly implemented in .NET)</p> <p>Both are good references, though.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload