For example, say there is a website where the user input is not properly sanitized, but these filters are still active. Anything typed is inserted into between two div tags.
If the input is "hello
", it shows up in the source as "<div>hello</div>
"
Tags also work. If the input is "<!--
", then it would turn into
"<div><!--</div>
", turning much of the HTML on the page into a comment, breaking part of it.
However, script tags are filtered out. Inputting "<script>alert('xss')</script>
" will return "<div>alert('xss')</div>
", obviously not executing any javascript.
"javascript:" is filtered and turned into "nojavascript" if used as a source.
input:
<img src=javascript:alert('hi'); />
output:
<img src=nojavascript...alert('hi'); />
Another part of the filter protects it from "onload=
" and other HTML event-based XSS attacks. If "onload=alert('xss')
" is the input, it will not show up at all in the source.
So, my question is, would this website still be vulnerable to cross-site scripting, or is it safe due to the filter it uses?