HttpRequestValidationException and cross-site scri

2019-04-14 02:07发布

问题:

By using HttpRequestValidationException, does it necessarily protect you against all cross-scripting threats?

Are there situations where a potentially dangerous script might manage to go undetected?

回答1:

No, in short it doesn't. Please decompile it using reflector and see what it does. An attack on an html attribute could be: " onfocus=alert(1) autofocus There are no < or > in this yet it still works. Please use AntiXss and check the OWASP XSS prevention cheat sheet. So you need to pay attention especially whenever you are using unescaped attributes like Literal.



回答2:

Yes, in short it does. It can't do everything related to XSS, like control what you are doing with JavaScript(eval()...etc). As far as request being processed by your ASP.NET applications, it does a good job, there are always exceptions.