xss

Does HTML encoding prevent XSS security exploits?

纵饮孤独 提交于 2020-08-01 10:45:14
问题 By simply converting the following ("the big 5"): & -> & < -> < > -> > " -> " ' -> ' Will you prevent XSS attacks? I think you need to white list at a character level too, to prevent certain attacks, but the following answer states it overcomplicates matters. EDIT This page details it does not prevent more elaborate injections, does not help with "out of range characters = question marks" when outputting Strings to Writers with single byte encodings, nor prevents character reinterpretation

Does HTML encoding prevent XSS security exploits?

我只是一个虾纸丫 提交于 2020-08-01 10:43:05
问题 By simply converting the following ("the big 5"): & -> & < -> < > -> > " -> " ' -> ' Will you prevent XSS attacks? I think you need to white list at a character level too, to prevent certain attacks, but the following answer states it overcomplicates matters. EDIT This page details it does not prevent more elaborate injections, does not help with "out of range characters = question marks" when outputting Strings to Writers with single byte encodings, nor prevents character reinterpretation

Prevent XMLHttpRequest request to another domain?

非 Y 不嫁゛ 提交于 2020-07-28 04:03:04
问题 I want to administratively prevent a whole class of XSS attacks by not allowing anything on my page to send XHR/XMLHttpRequest (or other?) requests to other domains than the domain hosting the page. Is that possible? I thought I could do that with Cross-Origin Resource Sharing (CORS), but it seems I was wrong. If a page hosted on domain-a.com tries to make an XHR request to domain-b.com, CORS can be used on domain-b.com pages to control whether or not that is allowed. So if something on the

.setinterval and XSS

被刻印的时光 ゝ 提交于 2020-07-18 17:15:01
问题 In the OWASP XSS prevention cheat sheet it says that untrusted data cannot be safely put inside the .setinterval JS function. Even if escaped/encoded, XSS is still possible. But if I have something like this: setInterval(function(){ alert('<%=UNTRUSTED_DATA%>'); }, 3000); And if I JS encode "UNTRUSTED_DATA", how would XSS be possible? 回答1: There is an overload of setInterval that accepts a string of code instead of a function, which is basically exec on an interval. I believe that is what the

.setinterval and XSS

本小妞迷上赌 提交于 2020-07-18 17:14:29
问题 In the OWASP XSS prevention cheat sheet it says that untrusted data cannot be safely put inside the .setinterval JS function. Even if escaped/encoded, XSS is still possible. But if I have something like this: setInterval(function(){ alert('<%=UNTRUSTED_DATA%>'); }, 3000); And if I JS encode "UNTRUSTED_DATA", how would XSS be possible? 回答1: There is an overload of setInterval that accepts a string of code instead of a function, which is basically exec on an interval. I believe that is what the