-
Notifications
You must be signed in to change notification settings - Fork 0
/
bad_sample.html
73 lines (64 loc) · 2.08 KB
/
bad_sample.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>XSS Examples</title>
</head>
<body>
<h1>XSS Demonstration</h1>
<!-- Simple XSS through user input -->
<div>
<h2>Simple XSS</h2>
<p id="simple-xss">Hello, <script>document.write("<b>world</b>");</script></p>
</div>
<!-- XSS through image error -->
<div>
<h2>Image Error XSS</h2>
<img src="invalid.jpg" onerror="alert('XSS through image error!');">
</div>
<!-- XSS in URL -->
<div>
<h2>URL Parameter XSS</h2>
<a href="javascript:alert('XSS in URL!')">Click me</a>
</div>
<!-- XSS through user-controlled input -->
<div>
<h2>User Input XSS</h2>
<form id="xssForm">
<label for="name">Enter your name:</label>
<input type="text" id="name" name="name">
<button type="button" onclick="submitForm()">Submit</button>
</form>
<p id="userInput"></p>
<script>
function submitForm() {
var userInput = document.getElementById('name').value;
document.getElementById('userInput').innerHTML = "Hello, " + userInput;
}
</script>
</div>
<!-- XSS through CSS expressions -->
<div>
<h2>CSS Expression XSS (Deprecated in modern browsers)</h2>
<div style="width: expression(alert('XSS through CSS!'));">
Hover over this div
</div>
</div>
<!-- XSS through Event Handlers -->
<div>
<h2>Event Handler XSS</h2>
<button onclick="alert('XSS through event handler!')">Click me</button>
</div>
<!-- XSS through href attribute -->
<div>
<h2>Href Attribute XSS</h2>
<a href="javascript:alert('XSS through href!')">Click me</a>
</div>
<!-- XSS through SVG -->
<div>
<h2>SVG XSS</h2>
<svg onload="alert('XSS through SVG!')"></svg>
</div>
</body>
</html>