Cross site scripting (XSS)
Labs and practical examples
1
2
3
4
5
6
7
8
9
10
11
12
XSS into JavaScript contexts (breaking out of or strings)When user input is reflected inside a script block, an attacker can terminate the existing script or string and inject new HTML/JS:Example: </script><img src=1 onerror=alert(document.domain)>Browser first parses HTML, then executes scripts — this can allow closing existing script tags and inserting new ones.
</script><img src=1 onerror=alert(document.domain)>Browser first parses HTML, then executes scripts — this can allow closing existing script tags and inserting new ones.Lab: Reflected XSS into a JavaScript string (single quote/backslash escaped)
13
14
15
16
17
18
19
20