blitzstrike 2.4.81 → 2.4.83
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +31 -0
- package/dist/index.js +567 -35
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -5,6 +5,37 @@ All notable changes to Blitz Strike are documented here.
|
|
|
5
5
|
The format follows [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
|
6
6
|
and this project adheres to [Semantic Versioning](https://semver.org/).
|
|
7
7
|
|
|
8
|
+
## [2.4.83] — 2026-09-17
|
|
9
|
+
|
|
10
|
+
### Added — Web3 / Solidity audit (10 bug classes + Foundry PoC)
|
|
11
|
+
|
|
12
|
+
- New `web3_audit(code|path)` — a deterministic, pattern-based Solidity auditor for
|
|
13
|
+
the 10 highest-value smart-contract bug classes: reentrancy, unchecked return
|
|
14
|
+
value, unchecked arithmetic, tx.origin auth, signature replay, unprotected
|
|
15
|
+
selfdestruct, delegatecall-to-user-input, missing access control, timestamp
|
|
16
|
+
dependence, spot-price oracle manipulation, and unbounded loops. Returns ranked
|
|
17
|
+
findings (class / CWE / severity / line / evidence).
|
|
18
|
+
- New `foundry_poc(class, contract)` — generates an executable Foundry (forge) test
|
|
19
|
+
template that proves a finding class. A web3 hit is a HYPOTHESIS until the
|
|
20
|
+
Foundry PoC reproduces it.
|
|
21
|
+
- `.sol` added to the scan extensions.
|
|
22
|
+
|
|
23
|
+
Competitive analysis source: Awarexone/Agentic-Bug-Hunter (web3-audit + Foundry PoC).
|
|
24
|
+
|
|
25
|
+
## [2.4.82] — 2026-09-17
|
|
26
|
+
|
|
27
|
+
### Added — out-of-band (OOB) listener for blind vuln proof
|
|
28
|
+
|
|
29
|
+
- New `oob_start` / `oob_poll` / `oob_stop` / `oob_list` tools give deterministic
|
|
30
|
+
proof for BLIND SSRF/XXE/SQLi/command-injection that never reflect in the HTTP
|
|
31
|
+
response. `oob_start` prefers the installed `interactsh-client` (unique *.oast.*
|
|
32
|
+
domain streaming DNS/HTTP interactions — the standard for public targets) and
|
|
33
|
+
falls back to a local HTTP listener for local labs. `oob_poll(id)` reports a hit
|
|
34
|
+
ONLY when an interaction for the session's unique id actually arrives. Handles
|
|
35
|
+
interactsh's ANSI-colored `[INF]` banner + JSONL interaction parsing.
|
|
36
|
+
|
|
37
|
+
Competitive analysis source: Awarexone/Agentic-Bug-Hunter (interactsh OOB).
|
|
38
|
+
|
|
8
39
|
## [2.4.81] — 2026-09-17
|
|
9
40
|
|
|
10
41
|
### Added — impact-first prioritization via typical bounty payout
|
package/dist/index.js
CHANGED
|
@@ -7291,6 +7291,7 @@ var init_scanner = __esm(() => {
|
|
|
7291
7291
|
".hpp",
|
|
7292
7292
|
".sh",
|
|
7293
7293
|
".bash",
|
|
7294
|
+
".sol",
|
|
7294
7295
|
".conf",
|
|
7295
7296
|
".config",
|
|
7296
7297
|
".nginx",
|
|
@@ -17358,10 +17359,10 @@ var init_update = __esm(() => {
|
|
|
17358
17359
|
});
|
|
17359
17360
|
|
|
17360
17361
|
// src/release.ts
|
|
17361
|
-
import { readFileSync as readFileSync28, existsSync as
|
|
17362
|
+
import { readFileSync as readFileSync28, existsSync as existsSync15 } from "node:fs";
|
|
17362
17363
|
import { join as join25 } from "node:path";
|
|
17363
17364
|
import { fileURLToPath as fileURLToPath14 } from "node:url";
|
|
17364
|
-
import { execSync as
|
|
17365
|
+
import { execSync as execSync3 } from "node:child_process";
|
|
17365
17366
|
function validateRelease() {
|
|
17366
17367
|
const checks = [];
|
|
17367
17368
|
checks.push({ name: "package.json version", ok: true, detail: VERSION });
|
|
@@ -17378,13 +17379,13 @@ function validateRelease() {
|
|
|
17378
17379
|
checks.push({ name: "CHANGELOG version", ok: false, detail: "CHANGELOG.md not found" });
|
|
17379
17380
|
}
|
|
17380
17381
|
try {
|
|
17381
|
-
const tag =
|
|
17382
|
+
const tag = execSync3("git describe --tags --abbrev=0", { cwd: ROOT8, encoding: "utf8", stdio: ["ignore", "pipe", "ignore"] }).trim();
|
|
17382
17383
|
checks.push({ name: "Git tag", ok: tag === `v${VERSION}`, detail: tag, soft: true });
|
|
17383
17384
|
} catch {
|
|
17384
17385
|
checks.push({ name: "Git tag", ok: true, detail: "unavailable (no git/tags)", soft: true });
|
|
17385
17386
|
}
|
|
17386
17387
|
try {
|
|
17387
|
-
const published =
|
|
17388
|
+
const published = execSync3("npm view blitzstrike version", { encoding: "utf8", timeout: 8000, stdio: ["ignore", "pipe", "ignore"] }).trim();
|
|
17388
17389
|
checks.push({ name: "npm registry version", ok: published === VERSION, detail: published, soft: true });
|
|
17389
17390
|
} catch {
|
|
17390
17391
|
checks.push({ name: "npm registry version", ok: true, detail: "unavailable (offline)", soft: true });
|
|
@@ -17398,7 +17399,7 @@ function validateRelease() {
|
|
|
17398
17399
|
return { version: VERSION, checks, consistent: checks.filter((c) => !c.soft).every((c) => c.ok) };
|
|
17399
17400
|
}
|
|
17400
17401
|
function lockfilePresent() {
|
|
17401
|
-
return
|
|
17402
|
+
return existsSync15(join25(ROOT8, "package-lock.json")) || existsSync15(join25(ROOT8, "bun.lock")) || existsSync15(join25(ROOT8, "bun.lockb"));
|
|
17402
17403
|
}
|
|
17403
17404
|
var ROOT8;
|
|
17404
17405
|
var init_release = __esm(() => {
|
|
@@ -17440,7 +17441,7 @@ var init_dependency = __esm(() => {
|
|
|
17440
17441
|
});
|
|
17441
17442
|
|
|
17442
17443
|
// src/cli.ts
|
|
17443
|
-
import { readFileSync as readFileSync30, existsSync as
|
|
17444
|
+
import { readFileSync as readFileSync30, existsSync as existsSync16, writeFileSync as writeFileSync9, mkdirSync as mkdirSync10 } from "node:fs";
|
|
17444
17445
|
import { join as join27, dirname as dirname6 } from "node:path";
|
|
17445
17446
|
import { homedir as homedir11 } from "node:os";
|
|
17446
17447
|
import { fileURLToPath as fileURLToPath16 } from "node:url";
|
|
@@ -17486,7 +17487,7 @@ async function runDoctor() {
|
|
|
17486
17487
|
detail: h1 ? `X-HackerOne-Research: ${h1}` : "H1_USERNAME not set",
|
|
17487
17488
|
fix: h1 ? undefined : "export H1_USERNAME=<your-hackerone-username> (adds X-HackerOne-Research to outbound requests)"
|
|
17488
17489
|
});
|
|
17489
|
-
const dataOk =
|
|
17490
|
+
const dataOk = existsSync16(join27(ROOT10, "chains.json")) && existsSync16(join27(ROOT10, "tools-catalog.json"));
|
|
17490
17491
|
issues.push({
|
|
17491
17492
|
name: "Data layers (chains + tools-catalog)",
|
|
17492
17493
|
status: dataOk ? "ok" : "fail",
|
|
@@ -17538,14 +17539,14 @@ function resolveCommand() {
|
|
|
17538
17539
|
if (which("blitzstrike"))
|
|
17539
17540
|
return { command: "blitzstrike", args: ["serve", "--mcp"] };
|
|
17540
17541
|
const src = join27(ROOT10, "src", "index.ts");
|
|
17541
|
-
if (which("bun") &&
|
|
17542
|
+
if (which("bun") && existsSync16(src))
|
|
17542
17543
|
return { command: "bun", args: ["run", src, "serve", "--mcp"] };
|
|
17543
17544
|
if (which("npx"))
|
|
17544
17545
|
return { command: "npx", args: ["-y", "blitzstrike", "serve", "--mcp"] };
|
|
17545
17546
|
if (which("bunx"))
|
|
17546
17547
|
return { command: "bunx", args: ["blitzstrike", "serve", "--mcp"] };
|
|
17547
17548
|
const dist = join27(ROOT10, "dist", "index.js");
|
|
17548
|
-
if (
|
|
17549
|
+
if (existsSync16(dist))
|
|
17549
17550
|
return { command: "bun", args: [dist, "serve", "--mcp"] };
|
|
17550
17551
|
return { command: "npx", args: ["-y", "blitzstrike", "serve", "--mcp"] };
|
|
17551
17552
|
}
|
|
@@ -17559,7 +17560,7 @@ function readJson(p) {
|
|
|
17559
17560
|
function jsonMcpServersWrite(p) {
|
|
17560
17561
|
return (command, args) => {
|
|
17561
17562
|
const dir = dirname6(p);
|
|
17562
|
-
if (!
|
|
17563
|
+
if (!existsSync16(dir))
|
|
17563
17564
|
mkdirSync10(dir, { recursive: true });
|
|
17564
17565
|
const existing = readJson(p) ?? {};
|
|
17565
17566
|
existing.mcpServers = {
|
|
@@ -17572,7 +17573,7 @@ function jsonMcpServersWrite(p) {
|
|
|
17572
17573
|
function opencodeWrite(p) {
|
|
17573
17574
|
return (command, args) => {
|
|
17574
17575
|
const dir = dirname6(p);
|
|
17575
|
-
if (!
|
|
17576
|
+
if (!existsSync16(dir))
|
|
17576
17577
|
mkdirSync10(dir, { recursive: true });
|
|
17577
17578
|
const existing = readJson(p) ?? {};
|
|
17578
17579
|
existing.mcp = {
|
|
@@ -17586,14 +17587,14 @@ function opencodeWrite(p) {
|
|
|
17586
17587
|
function copyOpenCodeAgents() {
|
|
17587
17588
|
const srcDir = join27(ROOT10, "opencode-agents");
|
|
17588
17589
|
const dstDir = join27(homedir11(), ".config", "opencode", "agents");
|
|
17589
|
-
if (!
|
|
17590
|
+
if (!existsSync16(srcDir))
|
|
17590
17591
|
return;
|
|
17591
|
-
if (!
|
|
17592
|
+
if (!existsSync16(dstDir))
|
|
17592
17593
|
mkdirSync10(dstDir, { recursive: true });
|
|
17593
17594
|
for (const f of ["Blitz Strike.md", "Blitz.md", "Eagle Eye.md", "Strike.md"]) {
|
|
17594
17595
|
const src = join27(srcDir, f);
|
|
17595
17596
|
const dst = join27(dstDir, f);
|
|
17596
|
-
if (
|
|
17597
|
+
if (existsSync16(src)) {
|
|
17597
17598
|
writeFileSync9(dst, readFileSync30(src, "utf8"));
|
|
17598
17599
|
}
|
|
17599
17600
|
}
|
|
@@ -17601,9 +17602,9 @@ function copyOpenCodeAgents() {
|
|
|
17601
17602
|
function codexWrite(p) {
|
|
17602
17603
|
return (command, args) => {
|
|
17603
17604
|
const dir = dirname6(p);
|
|
17604
|
-
if (!
|
|
17605
|
+
if (!existsSync16(dir))
|
|
17605
17606
|
mkdirSync10(dir, { recursive: true });
|
|
17606
|
-
let existing =
|
|
17607
|
+
let existing = existsSync16(p) ? readFileSync30(p, "utf8") : "";
|
|
17607
17608
|
if (!existing.trimEnd().endsWith(`
|
|
17608
17609
|
`))
|
|
17609
17610
|
existing += `
|
|
@@ -17620,9 +17621,9 @@ args = ${JSON.stringify(args)}
|
|
|
17620
17621
|
function hermesWrite(p) {
|
|
17621
17622
|
return (command, args) => {
|
|
17622
17623
|
const dir = dirname6(p);
|
|
17623
|
-
if (!
|
|
17624
|
+
if (!existsSync16(dir))
|
|
17624
17625
|
mkdirSync10(dir, { recursive: true });
|
|
17625
|
-
let existing =
|
|
17626
|
+
let existing = existsSync16(p) ? readFileSync30(p, "utf8") : "";
|
|
17626
17627
|
existing = existing.replace(/^ blitzstrike:\n(?: .*\n?)*/m, "");
|
|
17627
17628
|
if (!existing.trimEnd().endsWith(`
|
|
17628
17629
|
`))
|
|
@@ -17653,70 +17654,70 @@ function detectAgents() {
|
|
|
17653
17654
|
agents.push({
|
|
17654
17655
|
name: "Claude Code",
|
|
17655
17656
|
detectPath: claudeJson,
|
|
17656
|
-
installed: () =>
|
|
17657
|
+
installed: () => existsSync16(claudeJson) || which("claude"),
|
|
17657
17658
|
write: jsonMcpServersWrite(claudeJson)
|
|
17658
17659
|
});
|
|
17659
17660
|
const claudeDesktop = join27(home, ".config", "Claude", "claude_desktop_config.json");
|
|
17660
17661
|
agents.push({
|
|
17661
17662
|
name: "Claude Desktop",
|
|
17662
17663
|
detectPath: claudeDesktop,
|
|
17663
|
-
installed: () =>
|
|
17664
|
+
installed: () => existsSync16(claudeDesktop),
|
|
17664
17665
|
write: jsonMcpServersWrite(claudeDesktop)
|
|
17665
17666
|
});
|
|
17666
17667
|
const cursor = join27(home, ".cursor", "mcp.json");
|
|
17667
17668
|
agents.push({
|
|
17668
17669
|
name: "Cursor",
|
|
17669
17670
|
detectPath: cursor,
|
|
17670
|
-
installed: () =>
|
|
17671
|
+
installed: () => existsSync16(join27(home, ".cursor")) || which("cursor"),
|
|
17671
17672
|
write: jsonMcpServersWrite(cursor)
|
|
17672
17673
|
});
|
|
17673
17674
|
const opencode = join27(home, ".config", "opencode", "opencode.jsonc");
|
|
17674
17675
|
agents.push({
|
|
17675
17676
|
name: "OpenCode",
|
|
17676
17677
|
detectPath: opencode,
|
|
17677
|
-
installed: () =>
|
|
17678
|
+
installed: () => existsSync16(join27(home, ".config", "opencode")) || which("opencode"),
|
|
17678
17679
|
write: opencodeWrite(opencode)
|
|
17679
17680
|
});
|
|
17680
17681
|
const codex = join27(home, ".codex", "config.toml");
|
|
17681
17682
|
agents.push({
|
|
17682
17683
|
name: "Codex",
|
|
17683
17684
|
detectPath: codex,
|
|
17684
|
-
installed: () =>
|
|
17685
|
+
installed: () => existsSync16(join27(home, ".codex")) || which("codex"),
|
|
17685
17686
|
write: codexWrite(codex)
|
|
17686
17687
|
});
|
|
17687
17688
|
const hermes = join27(home, ".hermes", "config.yaml");
|
|
17688
17689
|
agents.push({
|
|
17689
17690
|
name: "Hermes",
|
|
17690
17691
|
detectPath: hermes,
|
|
17691
|
-
installed: () =>
|
|
17692
|
+
installed: () => existsSync16(join27(home, ".hermes")) || which("hermes"),
|
|
17692
17693
|
write: hermesWrite(hermes)
|
|
17693
17694
|
});
|
|
17694
17695
|
const gemini = join27(home, ".gemini", "settings.json");
|
|
17695
17696
|
agents.push({
|
|
17696
17697
|
name: "Gemini CLI",
|
|
17697
17698
|
detectPath: gemini,
|
|
17698
|
-
installed: () =>
|
|
17699
|
+
installed: () => existsSync16(join27(home, ".gemini")) || which("gemini"),
|
|
17699
17700
|
write: jsonMcpServersWrite(gemini)
|
|
17700
17701
|
});
|
|
17701
17702
|
const windsurf = join27(home, ".codeium", "windsurf", "mcp_config.json");
|
|
17702
17703
|
agents.push({
|
|
17703
17704
|
name: "Windsurf",
|
|
17704
17705
|
detectPath: windsurf,
|
|
17705
|
-
installed: () =>
|
|
17706
|
+
installed: () => existsSync16(join27(home, ".codeium")) || which("windsurf"),
|
|
17706
17707
|
write: jsonMcpServersWrite(windsurf)
|
|
17707
17708
|
});
|
|
17708
17709
|
const copilot = join27(home, ".copilot", "mcp.json");
|
|
17709
17710
|
agents.push({
|
|
17710
17711
|
name: "Copilot",
|
|
17711
17712
|
detectPath: copilot,
|
|
17712
|
-
installed: () =>
|
|
17713
|
+
installed: () => existsSync16(join27(home, ".copilot")),
|
|
17713
17714
|
write: jsonMcpServersWrite(copilot)
|
|
17714
17715
|
});
|
|
17715
17716
|
const cline = join27(home, ".cline", "mcp_settings.json");
|
|
17716
17717
|
agents.push({
|
|
17717
17718
|
name: "Cline",
|
|
17718
17719
|
detectPath: cline,
|
|
17719
|
-
installed: () =>
|
|
17720
|
+
installed: () => existsSync16(join27(home, ".cline")),
|
|
17720
17721
|
write: jsonMcpServersWrite(cline)
|
|
17721
17722
|
});
|
|
17722
17723
|
return agents;
|
|
@@ -60177,8 +60178,476 @@ function analyzeJwt(token, opts = {}) {
|
|
|
60177
60178
|
};
|
|
60178
60179
|
}
|
|
60179
60180
|
|
|
60181
|
+
// src/oob.ts
|
|
60182
|
+
import { spawn as spawn3, execSync as execSync2 } from "node:child_process";
|
|
60183
|
+
import { createServer } from "node:http";
|
|
60184
|
+
import { randomUUID } from "node:crypto";
|
|
60185
|
+
import { networkInterfaces } from "node:os";
|
|
60186
|
+
import { existsSync as existsSync13 } from "node:fs";
|
|
60187
|
+
var sessions = new Map;
|
|
60188
|
+
function sleep(ms) {
|
|
60189
|
+
return new Promise((r) => setTimeout(r, ms));
|
|
60190
|
+
}
|
|
60191
|
+
function findInteractsh() {
|
|
60192
|
+
try {
|
|
60193
|
+
const p = execSync2("which interactsh-client 2>/dev/null", { encoding: "utf8", timeout: 3000 }).trim();
|
|
60194
|
+
if (p)
|
|
60195
|
+
return p;
|
|
60196
|
+
} catch {}
|
|
60197
|
+
const home = process.env.HOME ?? "/root";
|
|
60198
|
+
const candidates = [`${home}/go/bin/interactsh-client`, "/usr/local/bin/interactsh-client", "/usr/bin/interactsh-client"];
|
|
60199
|
+
for (const c of candidates)
|
|
60200
|
+
if (existsSync13(c))
|
|
60201
|
+
return c;
|
|
60202
|
+
return null;
|
|
60203
|
+
}
|
|
60204
|
+
function stripAnsi(s) {
|
|
60205
|
+
return s.replace(/\u001b\[[0-9;]*m/g, "");
|
|
60206
|
+
}
|
|
60207
|
+
function extractDomain(buffer) {
|
|
60208
|
+
const m = stripAnsi(buffer).match(/\[INF\]\s+([a-z0-9]{20,}\.[a-z0-9.-]+)/i);
|
|
60209
|
+
return m ? m[1] : null;
|
|
60210
|
+
}
|
|
60211
|
+
function parseInteractions(buffer) {
|
|
60212
|
+
const out = [];
|
|
60213
|
+
for (const raw of stripAnsi(buffer).split(`
|
|
60214
|
+
`)) {
|
|
60215
|
+
const line = raw.trim();
|
|
60216
|
+
if (!line.startsWith("{"))
|
|
60217
|
+
continue;
|
|
60218
|
+
try {
|
|
60219
|
+
const j = JSON.parse(line);
|
|
60220
|
+
if (j && j.protocol && j.timestamp) {
|
|
60221
|
+
const req = typeof j["raw-request"] === "string" ? j["raw-request"].split(/\r?\n/)[0] : null;
|
|
60222
|
+
out.push({
|
|
60223
|
+
protocol: j.protocol,
|
|
60224
|
+
remote_address: j["remote-address"] ?? null,
|
|
60225
|
+
request_line: req,
|
|
60226
|
+
timestamp: j.timestamp,
|
|
60227
|
+
unique_id: j["unique-id"] ?? null
|
|
60228
|
+
});
|
|
60229
|
+
}
|
|
60230
|
+
} catch {}
|
|
60231
|
+
}
|
|
60232
|
+
return out;
|
|
60233
|
+
}
|
|
60234
|
+
function localIP() {
|
|
60235
|
+
const ifaces = networkInterfaces();
|
|
60236
|
+
for (const name of Object.keys(ifaces)) {
|
|
60237
|
+
for (const iface of ifaces[name] ?? []) {
|
|
60238
|
+
if (iface.family === "IPv4" && !iface.internal)
|
|
60239
|
+
return iface.address;
|
|
60240
|
+
}
|
|
60241
|
+
}
|
|
60242
|
+
return "127.0.0.1";
|
|
60243
|
+
}
|
|
60244
|
+
function result(s, extra = {}) {
|
|
60245
|
+
return {
|
|
60246
|
+
id: s.id,
|
|
60247
|
+
mode: s.mode,
|
|
60248
|
+
domain: s.domain ?? null,
|
|
60249
|
+
url: s.url ?? null,
|
|
60250
|
+
payload_url: s.url ? `\${oob_url}` : null,
|
|
60251
|
+
payload_dns: s.domain ? `\${oob_dns}` : null,
|
|
60252
|
+
templates: s.domain ? {
|
|
60253
|
+
dns: `\${oob_dns}`,
|
|
60254
|
+
http: `http://\${oob_dns}`,
|
|
60255
|
+
ssrf_xxe: `http://\${oob_dns}/<marker>`,
|
|
60256
|
+
sql_blind: `http://\${oob_dns}/<marker>`
|
|
60257
|
+
} : { http: `http://${s.url}/<marker>` },
|
|
60258
|
+
...extra
|
|
60259
|
+
};
|
|
60260
|
+
}
|
|
60261
|
+
async function oobStart() {
|
|
60262
|
+
const bin = findInteractsh();
|
|
60263
|
+
if (bin) {
|
|
60264
|
+
const id = randomUUID().slice(0, 8);
|
|
60265
|
+
const session = { id, mode: "interactsh", buffer: "", hits: [], startedAt: Date.now() };
|
|
60266
|
+
session.proc = spawn3(bin, ["-json"], { stdio: ["ignore", "pipe", "pipe"] });
|
|
60267
|
+
session.proc.stdout?.on("data", (d) => session.buffer += d.toString());
|
|
60268
|
+
session.proc.stderr?.on("data", (d) => session.buffer += d.toString());
|
|
60269
|
+
sessions.set(id, session);
|
|
60270
|
+
const deadline = Date.now() + 25000;
|
|
60271
|
+
while (Date.now() < deadline) {
|
|
60272
|
+
const domain = extractDomain(session.buffer);
|
|
60273
|
+
if (domain) {
|
|
60274
|
+
session.domain = domain;
|
|
60275
|
+
session.url = `http://${domain}`;
|
|
60276
|
+
return result(session, { status: "listening" });
|
|
60277
|
+
}
|
|
60278
|
+
await sleep(300);
|
|
60279
|
+
}
|
|
60280
|
+
return result(session, { status: "timeout", note: "interactsh-client did not register a domain within 15s — check network / oast server reachability" });
|
|
60281
|
+
}
|
|
60282
|
+
return startSelfHost();
|
|
60283
|
+
}
|
|
60284
|
+
function startSelfHost() {
|
|
60285
|
+
const id = randomUUID().slice(0, 8);
|
|
60286
|
+
const session = { id, mode: "selfhost", buffer: "", hits: [], startedAt: Date.now() };
|
|
60287
|
+
const server = createServer((req, res) => {
|
|
60288
|
+
let body = "";
|
|
60289
|
+
req.on("data", (c) => body += c);
|
|
60290
|
+
req.on("end", () => {
|
|
60291
|
+
session.hits.push({
|
|
60292
|
+
protocol: "http",
|
|
60293
|
+
method: req.method,
|
|
60294
|
+
path: req.url,
|
|
60295
|
+
remote_address: req.socket.remoteAddress,
|
|
60296
|
+
headers: req.headers,
|
|
60297
|
+
body: body.slice(0, 2000),
|
|
60298
|
+
timestamp: new Date().toISOString()
|
|
60299
|
+
});
|
|
60300
|
+
res.writeHead(200, { "Content-Type": "text/plain" });
|
|
60301
|
+
res.end("oob-ok");
|
|
60302
|
+
});
|
|
60303
|
+
});
|
|
60304
|
+
server.listen(0, "0.0.0.0");
|
|
60305
|
+
const port = server.address().port;
|
|
60306
|
+
session.server = server;
|
|
60307
|
+
session.port = port;
|
|
60308
|
+
session.url = `http://${localIP()}:${port}`;
|
|
60309
|
+
sessions.set(id, session);
|
|
60310
|
+
return result(session, {
|
|
60311
|
+
status: "listening",
|
|
60312
|
+
note: "local listener (target must reach this host); for a remote target, expose it via a tunnel (e.g. pinggy) and re-point the payload"
|
|
60313
|
+
});
|
|
60314
|
+
}
|
|
60315
|
+
function oobPoll(id) {
|
|
60316
|
+
const s = sessions.get(id);
|
|
60317
|
+
if (!s)
|
|
60318
|
+
return { error: "unknown session id (was it stopped or did the server restart?)" };
|
|
60319
|
+
if (s.mode === "selfhost") {
|
|
60320
|
+
const fresh = s.hits.slice(0);
|
|
60321
|
+
s.hits.length = 0;
|
|
60322
|
+
return { id, mode: s.mode, url: s.url, found: fresh.length > 0, hits: fresh, total_hits_seen: fresh.length };
|
|
60323
|
+
}
|
|
60324
|
+
const interactions = parseInteractions(s.buffer);
|
|
60325
|
+
const known = new Set(s.hits.map((h) => `${h.timestamp}|${h.protocol}|${h.request_line ?? ""}`));
|
|
60326
|
+
const fresh = interactions.filter((i) => !known.has(`${i.timestamp}|${i.protocol}|${i.request_line ?? ""}`));
|
|
60327
|
+
s.hits.push(...fresh);
|
|
60328
|
+
return { id, mode: s.mode, domain: s.domain, url: s.url, found: fresh.length > 0, hits: fresh, total_hits_seen: s.hits.length };
|
|
60329
|
+
}
|
|
60330
|
+
function oobStop(id) {
|
|
60331
|
+
const s = sessions.get(id);
|
|
60332
|
+
if (!s)
|
|
60333
|
+
return { error: "unknown session id" };
|
|
60334
|
+
try {
|
|
60335
|
+
s.proc?.kill("SIGTERM");
|
|
60336
|
+
} catch {}
|
|
60337
|
+
try {
|
|
60338
|
+
s.server?.close();
|
|
60339
|
+
} catch {}
|
|
60340
|
+
sessions.delete(id);
|
|
60341
|
+
return { id, stopped: true, total_hits_seen: s.hits.length };
|
|
60342
|
+
}
|
|
60343
|
+
function oobList() {
|
|
60344
|
+
return { active: [...sessions.values()].map((s) => ({ id: s.id, mode: s.mode, domain: s.domain, url: s.url, age_sec: Math.round((Date.now() - s.startedAt) / 1000) })) };
|
|
60345
|
+
}
|
|
60346
|
+
|
|
60347
|
+
// src/web3.ts
|
|
60348
|
+
var SEVERITY = {
|
|
60349
|
+
reentrancy: { severity: "critical", cwe: "CWE-841", category: "Reentrancy (state change after external call)" },
|
|
60350
|
+
unchecked_return: { severity: "high", cwe: "CWE-252", category: "Unchecked return value of low-level call" },
|
|
60351
|
+
unchecked_arithmetic: { severity: "high", cwe: "CWE-190", category: "Unchecked arithmetic (overflow/underflow)" },
|
|
60352
|
+
tx_origin_auth: { severity: "high", cwe: "CWE-284", category: "tx.origin authentication (phishing)" },
|
|
60353
|
+
signature_replay: { severity: "high", cwe: "CWE-294", category: "Signature replay (no nonce/chainId/deadline)" },
|
|
60354
|
+
unprotected_selfdestruct: { severity: "critical", cwe: "CWE-284", category: "Unprotected selfdestruct" },
|
|
60355
|
+
delegatecall_user_input: { severity: "critical", cwe: "CWE-284", category: "delegatecall to user-controlled address" },
|
|
60356
|
+
missing_access_control: { severity: "high", cwe: "CWE-284", category: "Privileged function missing access control" },
|
|
60357
|
+
timestamp_dependence: { severity: "medium", cwe: "CWE-1164", category: "block.timestamp / block.number dependence" },
|
|
60358
|
+
oracle_manipulation: { severity: "high", cwe: "CWE-1235", category: "Spot-price oracle (DEX pair) manipulation" },
|
|
60359
|
+
unbounded_loop: { severity: "medium", cwe: "CWE-834", category: "Unbounded loop over user-controlled length" }
|
|
60360
|
+
};
|
|
60361
|
+
function lines3(code) {
|
|
60362
|
+
return code.split(`
|
|
60363
|
+
`);
|
|
60364
|
+
}
|
|
60365
|
+
function lineNo4(code, idx) {
|
|
60366
|
+
let n = 1;
|
|
60367
|
+
for (let i = 0;i < idx; i++)
|
|
60368
|
+
if (code.charCodeAt(i) === 10)
|
|
60369
|
+
n++;
|
|
60370
|
+
return n;
|
|
60371
|
+
}
|
|
60372
|
+
function stripComments2(code) {
|
|
60373
|
+
let out = "";
|
|
60374
|
+
let i = 0;
|
|
60375
|
+
const n = code.length;
|
|
60376
|
+
while (i < n) {
|
|
60377
|
+
const c = code[i];
|
|
60378
|
+
const nx = code[i + 1];
|
|
60379
|
+
if (c === "/" && nx === "/") {
|
|
60380
|
+
while (i < n && code[i] !== `
|
|
60381
|
+
`)
|
|
60382
|
+
i++;
|
|
60383
|
+
out += `
|
|
60384
|
+
`;
|
|
60385
|
+
} else if (c === "/" && nx === "*") {
|
|
60386
|
+
i += 2;
|
|
60387
|
+
let closed = false;
|
|
60388
|
+
while (i < n) {
|
|
60389
|
+
if (code[i] === "*" && code[i + 1] === "/") {
|
|
60390
|
+
i += 2;
|
|
60391
|
+
closed = true;
|
|
60392
|
+
break;
|
|
60393
|
+
}
|
|
60394
|
+
if (code[i] === `
|
|
60395
|
+
`)
|
|
60396
|
+
out += `
|
|
60397
|
+
`;
|
|
60398
|
+
i++;
|
|
60399
|
+
}
|
|
60400
|
+
if (!closed)
|
|
60401
|
+
break;
|
|
60402
|
+
} else {
|
|
60403
|
+
out += c;
|
|
60404
|
+
i++;
|
|
60405
|
+
}
|
|
60406
|
+
}
|
|
60407
|
+
return out;
|
|
60408
|
+
}
|
|
60409
|
+
function push(out, file, code, idx, cls, evidence, detail) {
|
|
60410
|
+
const meta = SEVERITY[cls];
|
|
60411
|
+
out.push({ file, line: lineNo4(code, idx), class_: cls, category: meta.category, severity: meta.severity, cwe: meta.cwe, evidence, detail });
|
|
60412
|
+
}
|
|
60413
|
+
function functionBody3(code, name) {
|
|
60414
|
+
const re = new RegExp(`function\\s+${name}\\s*\\([^)]*\\)[^{]*\\{`);
|
|
60415
|
+
const m = re.exec(code);
|
|
60416
|
+
if (!m)
|
|
60417
|
+
return null;
|
|
60418
|
+
const open = code.indexOf("{", m.index);
|
|
60419
|
+
let depth = 0;
|
|
60420
|
+
for (let i = open;i < code.length; i++) {
|
|
60421
|
+
if (code[i] === "{")
|
|
60422
|
+
depth++;
|
|
60423
|
+
else if (code[i] === "}") {
|
|
60424
|
+
depth--;
|
|
60425
|
+
if (depth === 0)
|
|
60426
|
+
return code.slice(open, i + 1);
|
|
60427
|
+
}
|
|
60428
|
+
}
|
|
60429
|
+
return code.slice(open);
|
|
60430
|
+
}
|
|
60431
|
+
function web3Audit(code, file) {
|
|
60432
|
+
const out = [];
|
|
60433
|
+
const clean = stripComments2(code);
|
|
60434
|
+
const ls = lines3(code);
|
|
60435
|
+
const callRe = /\.call\{value:|\.call\(|\.send\(|\.transfer\(/g;
|
|
60436
|
+
let m;
|
|
60437
|
+
while ((m = callRe.exec(clean)) !== null) {
|
|
60438
|
+
const ln = lineNo4(code, m.index);
|
|
60439
|
+
const bodyEnd = clean.indexOf(`
|
|
60440
|
+
}`, m.index);
|
|
60441
|
+
const tail = clean.slice(m.index, bodyEnd === -1 ? clean.length : bodyEnd);
|
|
60442
|
+
if (/\b[a-z_][a-z0-9_]*\s*(\[[^\]]*\])?\s*[-+]?=/.test(tail.slice(tail.indexOf(")") + 1))) {
|
|
60443
|
+
push(out, file, code, m.index, "reentrancy", (ls[ln - 1] ?? "").trim(), "An external call is followed by a state mutation in the same function — a classic reentrancy window (the callee can re-enter before state is settled). Apply the checks-effects-interactions pattern: update state FIRST, then make the external call; or use a reentrancy guard (OpenZeppelin ReentrancyGuard).");
|
|
60444
|
+
}
|
|
60445
|
+
}
|
|
60446
|
+
const lowCallRe = /(?:\(bool\s+\w+\s*,\s*\)\s*=\s*)?([\w.\[\]()]+)\.(?:call|send)\s*(?:\{|\(|;)/g;
|
|
60447
|
+
while ((m = lowCallRe.exec(clean)) !== null) {
|
|
60448
|
+
const ln = lineNo4(code, m.index);
|
|
60449
|
+
const line = ls[ln - 1] ?? "";
|
|
60450
|
+
if (/\.call\{value:/.test(line))
|
|
60451
|
+
continue;
|
|
60452
|
+
if (/require\s*\(|if\s*\(/.test(line))
|
|
60453
|
+
continue;
|
|
60454
|
+
push(out, file, code, m.index, "unchecked_return", line.trim(), "A low-level `.call`/`.send` return value is not checked — the call can silently fail (e.g. out-of-gas) while execution continues. Check the boolean success and revert on failure.");
|
|
60455
|
+
}
|
|
60456
|
+
const uncheckedRe = /\bunchecked\s*\{/g;
|
|
60457
|
+
while ((m = uncheckedRe.exec(clean)) !== null) {
|
|
60458
|
+
push(out, file, code, m.index, "unchecked_arithmetic", (ls[lineNo4(code, m.index) - 1] ?? "").trim(), "An `unchecked { }` block disables overflow/underflow checks (Solidity ≥0.8) — arithmetic inside can wrap. Verify each operation is provably safe, or remove the block.");
|
|
60459
|
+
}
|
|
60460
|
+
const txOriginRe = /\btx\.origin\b/g;
|
|
60461
|
+
while ((m = txOriginRe.exec(clean)) !== null) {
|
|
60462
|
+
push(out, file, code, m.index, "tx_origin_auth", (ls[lineNo4(code, m.index) - 1] ?? "").trim(), "`tx.origin` is used for authorization — it can be a phishing victim's address when called through a malicious intermediary contract. Use `msg.sender` for auth.");
|
|
60463
|
+
}
|
|
60464
|
+
const ecRe = /\becrecover\s*\(/g;
|
|
60465
|
+
while ((m = ecRe.exec(clean)) !== null) {
|
|
60466
|
+
const ln = lineNo4(code, m.index);
|
|
60467
|
+
const scope = clean.slice(Math.max(0, m.index - 600), m.index);
|
|
60468
|
+
if (/\bnonce\b/i.test(scope) && (/\bchainId\b|\bblock\.chainid\b/i.test(scope) || /\bdeadline\b/i.test(scope)))
|
|
60469
|
+
continue;
|
|
60470
|
+
push(out, file, code, m.index, "signature_replay", (ls[ln - 1] ?? "").trim(), "`ecrecover` validates a signature without binding it to a nonce / chainId / deadline — the same signature can be replayed on another chain or re-submitted. Include a nonce, the chain id, and an expiry in the signed digest.");
|
|
60471
|
+
}
|
|
60472
|
+
const selfRe = /\bselfdestruct\s*\(/g;
|
|
60473
|
+
while ((m = selfRe.exec(clean)) !== null) {
|
|
60474
|
+
const ln = lineNo4(code, m.index);
|
|
60475
|
+
const scope = clean.slice(Math.max(0, m.index - 800), m.index);
|
|
60476
|
+
if (/onlyOwner|require\s*\(\s*msg\.sender|Ownable|onlyRole|_checkOwner/.test(scope))
|
|
60477
|
+
continue;
|
|
60478
|
+
push(out, file, code, m.index, "unprotected_selfdestruct", (ls[ln - 1] ?? "").trim(), "`selfdestruct` is reachable without an ownership/role check — an attacker can destroy the contract and force-send its balance. Gate it behind the owner and emit an event.");
|
|
60479
|
+
}
|
|
60480
|
+
const delRe = /\.delegatecall\s*\(/g;
|
|
60481
|
+
while ((m = delRe.exec(clean)) !== null) {
|
|
60482
|
+
push(out, file, code, m.index, "delegatecall_user_input", (ls[lineNo4(code, m.index) - 1] ?? "").trim(), "`delegatecall` to a user-controlled address executes the target's code in the caller's storage context — arbitrary storage overwrite / selfdestruct. Never delegatecall to an address derived from user input.");
|
|
60483
|
+
}
|
|
60484
|
+
const fnRe = /function\s+([a-zA-Z_][a-zA-Z0-9_]*)\s*\([^)]*\)/g;
|
|
60485
|
+
const privileged = /\b(mint|burn|setOwner|transferOwnership|setPrice|setFee|pause|unpause|upgrade|initialize|claim|withdrawAll|drain|rescue)\b/i;
|
|
60486
|
+
while ((m = fnRe.exec(clean)) !== null) {
|
|
60487
|
+
const name = m[1];
|
|
60488
|
+
if (!privileged.test(name))
|
|
60489
|
+
continue;
|
|
60490
|
+
const body = functionBody3(code, name);
|
|
60491
|
+
if (!body)
|
|
60492
|
+
continue;
|
|
60493
|
+
const authRe = /\bonlyOwner\b|\brequire\s*\(\s*msg\.sender|Ownable|onlyRole|_checkOwner|_onlyOwner|\bowner\b\s*==/.test(body) || /\bmodifier\b/.test(body);
|
|
60494
|
+
if (authRe)
|
|
60495
|
+
continue;
|
|
60496
|
+
push(out, file, code, m.index, "missing_access_control", (ls[lineNo4(code, m.index) - 1] ?? "").trim(), `Privileged function \`${name}()\` has no visible access control (onlyOwner / require(msg.sender==owner) / role check) — anyone can call it. Add an ownership/role modifier.`);
|
|
60497
|
+
}
|
|
60498
|
+
const tsRe = /\bblock\.(timestamp|number|hash|difficulty|coinbase)\b/g;
|
|
60499
|
+
while ((m = tsRe.exec(clean)) !== null) {
|
|
60500
|
+
push(out, file, code, m.index, "timestamp_dependence", (ls[lineNo4(code, m.index) - 1] ?? "").trim(), "`block.timestamp`/`block.number` is used in critical logic — miners can manipulate it within a range, and it must never be a source of randomness or a payout/auction boundary. Use an oracle (Chainlink VRF) for randomness and tolerate timestamp skew.");
|
|
60501
|
+
}
|
|
60502
|
+
const oracleRe = /\bgetReserves\s*\(|\bspotPrice\b|\bgetAmountsOut\s*\(|\bgetAmountOut\s*\(/g;
|
|
60503
|
+
while ((m = oracleRe.exec(clean)) !== null) {
|
|
60504
|
+
push(out, file, code, m.index, "oracle_manipulation", (ls[lineNo4(code, m.index) - 1] ?? "").trim(), "A DEX pair's spot price (`getReserves`/`getAmountOut`) is used as a price oracle — it can be manipulated with a flash loan. Use a time-weighted average price (TWAP) or a Chainlink price feed.");
|
|
60505
|
+
}
|
|
60506
|
+
const loopRe = /for\s*\([^;]*;[^;]*;\s*[^)]*\)/g;
|
|
60507
|
+
while ((m = loopRe.exec(clean)) !== null) {
|
|
60508
|
+
const ln = lineNo4(code, m.index);
|
|
60509
|
+
const line = ls[ln - 1] ?? "";
|
|
60510
|
+
if (!/\.length\b/.test(line))
|
|
60511
|
+
continue;
|
|
60512
|
+
if (/require\s*\([^)]*\.length\s*[<]=?\s*\d+/.test(line))
|
|
60513
|
+
continue;
|
|
60514
|
+
push(out, file, code, m.index, "unbounded_loop", line.trim(), "A loop iterates over a user-controlled array length with no bound — an attacker can grow the array to force an out-of-gas DoS. Cap the iteration or use a pull-based pattern.");
|
|
60515
|
+
}
|
|
60516
|
+
const seen = new Set;
|
|
60517
|
+
return out.filter((f) => {
|
|
60518
|
+
const k = `${f.class_}:${f.line}`;
|
|
60519
|
+
if (seen.has(k))
|
|
60520
|
+
return false;
|
|
60521
|
+
seen.add(k);
|
|
60522
|
+
return true;
|
|
60523
|
+
});
|
|
60524
|
+
}
|
|
60525
|
+
function web3Rank(findings) {
|
|
60526
|
+
const order = { critical: 0, high: 1, medium: 2 };
|
|
60527
|
+
const agg = new Map;
|
|
60528
|
+
for (const f of findings) {
|
|
60529
|
+
const e = agg.get(f.class_) ?? { count: 0, severity: f.severity, cwe: f.cwe };
|
|
60530
|
+
e.count++;
|
|
60531
|
+
agg.set(f.class_, e);
|
|
60532
|
+
}
|
|
60533
|
+
return [...agg.entries()].map(([class_, v]) => ({ class_, ...v })).sort((a, b) => order[a.severity] - order[b.severity] || b.count - a.count);
|
|
60534
|
+
}
|
|
60535
|
+
function foundryPoc(cls, contractName = "Vulnerable") {
|
|
60536
|
+
const base = `// SPDX-License-Identifier: MIT
|
|
60537
|
+
pragma solidity ^0.8.20;
|
|
60538
|
+
|
|
60539
|
+
import "forge-std/Test.sol";
|
|
60540
|
+
import "../src/${contractName}.sol";
|
|
60541
|
+
|
|
60542
|
+
contract ${contractName}Poc is Test {
|
|
60543
|
+
${contractName} internal target;
|
|
60544
|
+
address internal attacker = address(0xBEEF);
|
|
60545
|
+
address internal victim = address(0xCAFE);
|
|
60546
|
+
|
|
60547
|
+
function setUp() public {
|
|
60548
|
+
target = new ${contractName}();
|
|
60549
|
+
// fund the target / victim as needed
|
|
60550
|
+
}
|
|
60551
|
+
`;
|
|
60552
|
+
const exploit = {
|
|
60553
|
+
reentrancy: ` function testReentrancy() public {
|
|
60554
|
+
// Attacker contract re-enters before state is settled
|
|
60555
|
+
ReentrantAttacker a = new ReentrantAttacker(address(target));
|
|
60556
|
+
a.attack{value: 1 ether}();
|
|
60557
|
+
assertGt(address(a).balance, 1 ether, "attacker drained more than deposited");
|
|
60558
|
+
}
|
|
60559
|
+
}
|
|
60560
|
+
|
|
60561
|
+
contract ReentrantAttacker {
|
|
60562
|
+
Vulnerable t;
|
|
60563
|
+
constructor(address _t) { t = Vulnerable(_t); }
|
|
60564
|
+
function attack() external payable {
|
|
60565
|
+
t.deposit{value: msg.value}();
|
|
60566
|
+
t.withdraw(msg.value);
|
|
60567
|
+
}
|
|
60568
|
+
receive() external payable {
|
|
60569
|
+
if (address(t).balance > 0) t.withdraw(msg.value);
|
|
60570
|
+
}
|
|
60571
|
+
}`,
|
|
60572
|
+
unchecked_return: ` function testUncheckedReturn() public {
|
|
60573
|
+
// force the low-level call to fail, observe the contract keeps going
|
|
60574
|
+
(bool ok, ) = address(target).call{value: 0}(abi.encodeWithSignature("fail()"));
|
|
60575
|
+
assertFalse(ok, "call should fail");
|
|
60576
|
+
}`,
|
|
60577
|
+
unchecked_arithmetic: ` function testUncheckedArithmetic() public {
|
|
60578
|
+
// trigger the wrap that the unchecked block allowed
|
|
60579
|
+
vm.expectRevert(); // replace with a concrete overflow/underflow assertion
|
|
60580
|
+
target.triggerOverflow();
|
|
60581
|
+
}`,
|
|
60582
|
+
tx_origin_auth: ` function testTxOriginAuth() public {
|
|
60583
|
+
// a malicious intermediary makes the victim (tx.origin) call the target
|
|
60584
|
+
Phisher p = new Phisher(address(target));
|
|
60585
|
+
vm.prank(victim, victim);
|
|
60586
|
+
p.forward();
|
|
60587
|
+
}
|
|
60588
|
+
}
|
|
60589
|
+
|
|
60590
|
+
contract Phisher {
|
|
60591
|
+
Vulnerable t;
|
|
60592
|
+
constructor(address _t) { t = Vulnerable(_t); }
|
|
60593
|
+
function forward() external { t.restricted(); }
|
|
60594
|
+
}`,
|
|
60595
|
+
signature_replay: ` function testSignatureReplay() public {
|
|
60596
|
+
// replay the same signature on a second chain / a second time
|
|
60597
|
+
(uint8 v, bytes32 r, bytes32 s) = vm.sign(attackerPk, digest);
|
|
60598
|
+
target.claim(attacker, 1 ether, deadline, v, r, s);
|
|
60599
|
+
// replay it — should revert if nonce/chainId bound
|
|
60600
|
+
vm.expectRevert();
|
|
60601
|
+
target.claim(attacker, 1 ether, deadline, v, r, s);
|
|
60602
|
+
}`,
|
|
60603
|
+
unprotected_selfdestruct: ` function testUnprotectedSelfdestruct() public {
|
|
60604
|
+
vm.prank(attacker);
|
|
60605
|
+
target.kill(); // should revert — only owner may selfdestruct
|
|
60606
|
+
assertEq(address(target).code.length, 0, "contract destroyed by non-owner");
|
|
60607
|
+
}`,
|
|
60608
|
+
delegatecall_user_input: ` function testDelegatecallUserInput() public {
|
|
60609
|
+
// attacker supplies a malicious implementation that selfdestructs
|
|
60610
|
+
Evil impl = new Evil();
|
|
60611
|
+
vm.prank(attacker);
|
|
60612
|
+
target.setImplementation(address(impl));
|
|
60613
|
+
vm.expectRevert();
|
|
60614
|
+
target.exec();
|
|
60615
|
+
}
|
|
60616
|
+
}
|
|
60617
|
+
|
|
60618
|
+
contract Evil {
|
|
60619
|
+
function kill() external { selfdestruct(payable(tx.origin)); }
|
|
60620
|
+
}`,
|
|
60621
|
+
missing_access_control: ` function testMissingAccessControl() public {
|
|
60622
|
+
vm.prank(attacker);
|
|
60623
|
+
target.mint(attacker, 1_000_000 ether); // should require owner
|
|
60624
|
+
assertEq(target.balanceOf(attacker), 0, "attacker minted without auth");
|
|
60625
|
+
}`,
|
|
60626
|
+
timestamp_dependence: ` function testTimestampDependence() public {
|
|
60627
|
+
// warp the timestamp to a favorable value and observe the payout/randomness
|
|
60628
|
+
vm.warp(block.timestamp + 1000);
|
|
60629
|
+
target.resolve();
|
|
60630
|
+
}`,
|
|
60631
|
+
oracle_manipulation: ` function testOracleManipulation() public {
|
|
60632
|
+
// swap a large amount to move the spot price, then exploit the target
|
|
60633
|
+
pool.swap(attacker, 1_000_000 ether); // move spot price
|
|
60634
|
+
target.trade();
|
|
60635
|
+
assertGt(target.balanceOf(attacker), 0, "spot-price oracle was manipulated");
|
|
60636
|
+
}`,
|
|
60637
|
+
unbounded_loop: ` function testUnboundedLoop() public {
|
|
60638
|
+
// grow the array past the gas limit to force a DoS
|
|
60639
|
+
for (uint i = 0; i < 100_000; i++) target.add(address(uint160(i)));
|
|
60640
|
+
vm.expectRevert(); // or assert gas consumption
|
|
60641
|
+
target.processAll();
|
|
60642
|
+
}`
|
|
60643
|
+
};
|
|
60644
|
+
return base + (exploit[cls] ?? exploit.missing_access_control) + `
|
|
60645
|
+
}
|
|
60646
|
+
`;
|
|
60647
|
+
}
|
|
60648
|
+
|
|
60180
60649
|
// src/enterprise-benchmark.ts
|
|
60181
|
-
import { existsSync as
|
|
60650
|
+
import { existsSync as existsSync14, readFileSync as readFileSync25, readdirSync as readdirSync6, statSync as statSync3 } from "node:fs";
|
|
60182
60651
|
import { join as join23, resolve } from "node:path";
|
|
60183
60652
|
init_complex_bugs();
|
|
60184
60653
|
var ROOT6 = resolve(process.cwd(), "bench", "enterprise");
|
|
@@ -60239,7 +60708,7 @@ function detectFixture(dir) {
|
|
|
60239
60708
|
function runEnterpriseBenchmark() {
|
|
60240
60709
|
const fixtures = [];
|
|
60241
60710
|
for (const fx of ENTERPRISE_FIXTURES) {
|
|
60242
|
-
if (!
|
|
60711
|
+
if (!existsSync14(fx.dir)) {
|
|
60243
60712
|
fixtures.push({ id: fx.id, available: false, detected: 0, expected: fx.expected_vulns, recall: 0 });
|
|
60244
60713
|
continue;
|
|
60245
60714
|
}
|
|
@@ -60421,7 +60890,7 @@ function coverageMatrix() {
|
|
|
60421
60890
|
// src/server.ts
|
|
60422
60891
|
init_update();
|
|
60423
60892
|
init_version();
|
|
60424
|
-
function
|
|
60893
|
+
function createServer2() {
|
|
60425
60894
|
const server = new McpServer({
|
|
60426
60895
|
name: "blitzstrike",
|
|
60427
60896
|
version: VERSION
|
|
@@ -60434,7 +60903,7 @@ function createServer() {
|
|
|
60434
60903
|
` + `- A hard block (Cloudflare/WAF/IP-block/captcha) is NOT the end: mark the finding blocked + note the required vantage (residential / authorized / correct-SNI / --resolve direct-to-origin), then CONTINUE to the next lead (origin bypass, non-prod cluster, mobile APK, subdomain).
|
|
60435
60904
|
` + `- Keep trying every lead AND every chain step until each is verified/executed or blocked, THEN generate_report. Never deliver a bare surface map, and never stop at 'found X' when X enables more.
|
|
60436
60905
|
|
|
60437
|
-
` + "TWO PATHS:\\n" + "- Source path on disk -> blitz_scan / taint_file / eagle_eye2 (static).\\n" + "- Live URL -> live_recon / active_scan / strike_verify (web-hunting).\\n\\n" + "DEEPEN A FINDING: attack_plan(target, tech, params) to get the prioritized vector plan (decide what to test next with data); list_chains (escalation), chain_links (compose), technique_lookup(cls), payload_lookup, bypass_lookup (blocked). Ground any detector hit empirically with pattern_lookup(id) — it returns the class's CWE, real-world signature, escalation chains, citable references, per-class bypass techniques, and the high-value assets (crown jewels) that class hits, so a raw hit becomes a class-aware finding. Resolve free-form terminology first with synonym_lookup(term) (IDOR/BOLA/SQLi/prompt-injection → canonical id). For an llm_injection hit, its pattern carries a validation discipline — the RUN-TWICE RULE (reproduce token-for-token across two fresh sessions), NON-GUESSABLE ANCHOR (must leak a real key/URL, not a plausible guess), and OOB PROOF (a verifiable callback log) — apply all three before reporting. BEFORE generating a report, run submission_gate(...) and only ship a finding that passes all 7 questions (reproducible, in-scope, real-impact, no-privileged-assumption, verified-live, evidence-redacted, severity-derived); one false = kill it. Calibrate severity with severity_calibrate(type, cvss) to get a P1–P5 tier + VRT-style category. Start each engagement with engagement_scaffold(target, scope) for the folder + scope.md structure, and check data_refresh() to confirm the data layers are consistent. Phase doctrine: read_skill(bs-orchestrate-engagement | bs-web-hunting | bs-source-audit | bs-verify-finding). Campaign plan: read_playbook(target-type). On any failure call retry_guidance(signal) / model_fallback(signal) before giving up.\n" + "KNOWLEDGE BASE (discover, don't guess): skillLookup(topic) / listSkills for the 40 attack-path + hunting skills (ap-*, hp-*, bs-*); list_attack_vectors / attack_vectors(cat) for the 34-category vector taxonomy; taxonomy(kind) for OWASP/CWE/ASVS/API-top-10; read_playbook(type) for the 17 campaign playbooks; list_manuals / read_tool_manual for 317 tool references; list_tools / run_catalog_tool for the 141-tool catalog. Every tool, skill, and data layer is reachable from these. CROSS-TARGET INTELLIGENCE: strike_resolve auto-records confirmed/false_positive verdicts into the empirical ledger; query it with intelligence(action=hit_rates/top_vectors/recall) so a new target on a known tech inherits historical hit-rates (attack_plan already blends them into success_probability). intelligence(action=recall, tech, target) is the per-engagement pattern recall — it returns which patterns historically CONFIRMED on that tech (prioritize them) versus which only ever produced false positives (avoid them), so a new engagement starts from the empirical playbook of past ones. LIVE PENTEST + TARGETING (black-box, WAF-safe): cache_gap(base_url, endpoint) fuzzes path-normalization + static-extension variants for cache deception/poisoning; blind_oracle(base_url, param, value) detects which SINK a param reaches (sql/ssti/xss) via benign arithmetic (id=1+0, test${7*7}) WITHOUT a malicious payload; param_precedence(base_url, param, A, B) maps duplicate-parameter precedence (first/last-wins) for WAF-bypass. SOURCE TARGETING: action_surface(code) maps every wp_ajax_* action to its vuln class + DERIVED priority (what to look for WHERE); security_state(sanitizers, sink) gives a wrong-context sanitization verdict; framework_knowledge(framework) returns auth/nonce primitives for 9 frameworks; variant_scan(root, signature) mass-sweeps an install base for ONE bug family; patch_analyze(old, new) REVERSES a security patch into the 0-day, and its mine_signature feeds variant_scan to sweep unpatched copies. All of these are DETECTION HINTS — verify each live (strike_verify / browser_validate) before it enters the report. NEWEST DETECTORS — understand AND try them: variant_scan also emits priv_esc (privilege escalation — a role/capability/user change fed by request input, traced cross-file via reverse call-graph, e.g. set_role($id, sanitize_key($_POST['um-role'])) or update_user_meta(...,'wp_capabilities', $_POST[...])) and flags uploadAllow=>array('all') unrestricted-upload configs as file_upload (the file-manager/connector shape). TO TRY a priv_esc hit: submit the role field with 'administrator' (or send wp_capabilities meta) and confirm the account actually gains admin. TO TRY an unrestricted-upload hit: POST a .php/.phtml and confirm it lands web-reachable + executes. variant_scan also emits hardcoded_secret (CWE-798) in three tiers: a secret field (api_key/db_password/access_token/aws_*) assigned a literal (HIGH), a known secret FORMAT (JWT eyJ…/AWS AKIA…/GitHub ghp_…/Slack xoxb-…/…) regardless of name (HIGH), or a high-entropy suspect token (MEDIUM — verify before reporting). Verify a frontend/JS secret live via drive_devtools (inspect the JS bundle / network response and confirm the key is actually exposed), and for a backend secret confirm it is reachable/valid. A static hit is a HYPOTHESIS until verified live — never report unverified. For a repo, also scan_git_history(root) — secrets DELETED from HEAD still live in .git history (the removed-later-is-not-fixed trap), and it feeds every recovered pre-deletion blob through the same secret detector. Once you recover a credential, prove it is still ACTIVE with validate_leaked_key(apiBase, endpoints, key|blobUrl) — a READ-ONLY differential test (401-without-key vs 200-with-key = auth bypass PROVEN). Two supply-chain detectors: dependency_confusion (a manifest/build file resolving a package from a public registry — pypi.org/npmjs.org --extra-index-url, or a scoped @company/pkg with no private registry) and ml_supply_chain (torch.load without weights_only=True / joblib.load / np.load(allow_pickle=True) / keras load_model on an untrusted model → pickle RCE). Rust is supported end-to-end: the taint engine (blitz_scan / taint_file) maps Rust sinks (std::process::Command, sqlx/diesel, reqwest/hyper, std::fs, serde/bincode) to the classic classes, plus two Rust-specific detectors — rust_unsafe (transmute / assume_init / from_raw_parts / ptr::* — memory-unsafety surface, CWE-119) and rust_format_string (println!/format! with a variable as the format string — CWE-134). The sqlx query! compile-time macro is treated as safe (suppressed). Two more web-class detectors: jwt_alg_confusion (a JWT verifier that dispatches on the token's alg header and accepts BOTH RS256 and HS256, with the HS256 HMAC secret derived from public/shared key material — CWE-347; the attacker sets alg=HS256 and signs with the public key to forge admin tokens) and cache_deception (a reverse proxy caching static-extension URLs with a cache key that omits the session cookie, over a session-authenticated backend — CWE-525; the victim's cached private response is re-fetched anonymously). TO TRY a jwt_alg_confusion hit: fetch the public key (/.well-known/jwks.json), forge an HS256 token signed with that public key, and confirm admin access. TO TRY a cache_deception hit: request an authenticated path with a static extension appended (.css/.js) and re-fetch it anonymously.\n" + `PRECISION ANALYSIS — chrome-devtools MCP is MANDATORY, not optional:
|
|
60906
|
+
` + "TWO PATHS:\\n" + "- Source path on disk -> blitz_scan / taint_file / eagle_eye2 (static).\\n" + "- Live URL -> live_recon / active_scan / strike_verify (web-hunting).\\n\\n" + "DEEPEN A FINDING: attack_plan(target, tech, params) to get the prioritized vector plan (decide what to test next with data); list_chains (escalation), chain_links (compose), technique_lookup(cls), payload_lookup, bypass_lookup (blocked). Ground any detector hit empirically with pattern_lookup(id) — it returns the class's CWE, real-world signature, escalation chains, citable references, per-class bypass techniques, and the high-value assets (crown jewels) that class hits, so a raw hit becomes a class-aware finding. Resolve free-form terminology first with synonym_lookup(term) (IDOR/BOLA/SQLi/prompt-injection → canonical id). For an llm_injection hit, its pattern carries a validation discipline — the RUN-TWICE RULE (reproduce token-for-token across two fresh sessions), NON-GUESSABLE ANCHOR (must leak a real key/URL, not a plausible guess), and OOB PROOF (a verifiable callback log) — apply all three before reporting. BEFORE generating a report, run submission_gate(...) and only ship a finding that passes all 7 questions (reproducible, in-scope, real-impact, no-privileged-assumption, verified-live, evidence-redacted, severity-derived); one false = kill it. Calibrate severity with severity_calibrate(type, cvss) to get a P1–P5 tier + VRT-style category. Start each engagement with engagement_scaffold(target, scope) for the folder + scope.md structure, and check data_refresh() to confirm the data layers are consistent. Phase doctrine: read_skill(bs-orchestrate-engagement | bs-web-hunting | bs-source-audit | bs-verify-finding). Campaign plan: read_playbook(target-type). On any failure call retry_guidance(signal) / model_fallback(signal) before giving up.\n" + "KNOWLEDGE BASE (discover, don't guess): skillLookup(topic) / listSkills for the 40 attack-path + hunting skills (ap-*, hp-*, bs-*); list_attack_vectors / attack_vectors(cat) for the 34-category vector taxonomy; taxonomy(kind) for OWASP/CWE/ASVS/API-top-10; read_playbook(type) for the 17 campaign playbooks; list_manuals / read_tool_manual for 317 tool references; list_tools / run_catalog_tool for the 141-tool catalog. Every tool, skill, and data layer is reachable from these. CROSS-TARGET INTELLIGENCE: strike_resolve auto-records confirmed/false_positive verdicts into the empirical ledger; query it with intelligence(action=hit_rates/top_vectors/recall) so a new target on a known tech inherits historical hit-rates (attack_plan already blends them into success_probability). intelligence(action=recall, tech, target) is the per-engagement pattern recall — it returns which patterns historically CONFIRMED on that tech (prioritize them) versus which only ever produced false positives (avoid them), so a new engagement starts from the empirical playbook of past ones. LIVE PENTEST + TARGETING (black-box, WAF-safe): cache_gap(base_url, endpoint) fuzzes path-normalization + static-extension variants for cache deception/poisoning; blind_oracle(base_url, param, value) detects which SINK a param reaches (sql/ssti/xss) via benign arithmetic (id=1+0, test${7*7}) WITHOUT a malicious payload; param_precedence(base_url, param, A, B) maps duplicate-parameter precedence (first/last-wins) for WAF-bypass. OOB (out-of-band) PROOF for BLIND vulns: oob_start() spins an interactsh listener (unique *.oast.* domain, streams DNS/HTTP interactions — the standard for public targets) or a local HTTP listener for local labs; inject the canary, then oob_poll(id) until the hit arrives; oob_stop(id) to clean up. A blind SSRF/XXE/SQLi/command-injection is CONFIRMED only when the canary actually arrives — never from a guess. SOURCE TARGETING: action_surface(code) maps every wp_ajax_* action to its vuln class + DERIVED priority (what to look for WHERE); security_state(sanitizers, sink) gives a wrong-context sanitization verdict; framework_knowledge(framework) returns auth/nonce primitives for 9 frameworks; variant_scan(root, signature) mass-sweeps an install base for ONE bug family; patch_analyze(old, new) REVERSES a security patch into the 0-day, and its mine_signature feeds variant_scan to sweep unpatched copies. All of these are DETECTION HINTS — verify each live (strike_verify / browser_validate) before it enters the report. NEWEST DETECTORS — understand AND try them: variant_scan also emits priv_esc (privilege escalation — a role/capability/user change fed by request input, traced cross-file via reverse call-graph, e.g. set_role($id, sanitize_key($_POST['um-role'])) or update_user_meta(...,'wp_capabilities', $_POST[...])) and flags uploadAllow=>array('all') unrestricted-upload configs as file_upload (the file-manager/connector shape). TO TRY a priv_esc hit: submit the role field with 'administrator' (or send wp_capabilities meta) and confirm the account actually gains admin. TO TRY an unrestricted-upload hit: POST a .php/.phtml and confirm it lands web-reachable + executes. variant_scan also emits hardcoded_secret (CWE-798) in three tiers: a secret field (api_key/db_password/access_token/aws_*) assigned a literal (HIGH), a known secret FORMAT (JWT eyJ…/AWS AKIA…/GitHub ghp_…/Slack xoxb-…/…) regardless of name (HIGH), or a high-entropy suspect token (MEDIUM — verify before reporting). Verify a frontend/JS secret live via drive_devtools (inspect the JS bundle / network response and confirm the key is actually exposed), and for a backend secret confirm it is reachable/valid. A static hit is a HYPOTHESIS until verified live — never report unverified. For a repo, also scan_git_history(root) — secrets DELETED from HEAD still live in .git history (the removed-later-is-not-fixed trap), and it feeds every recovered pre-deletion blob through the same secret detector. Once you recover a credential, prove it is still ACTIVE with validate_leaked_key(apiBase, endpoints, key|blobUrl) — a READ-ONLY differential test (401-without-key vs 200-with-key = auth bypass PROVEN). Two supply-chain detectors: dependency_confusion (a manifest/build file resolving a package from a public registry — pypi.org/npmjs.org --extra-index-url, or a scoped @company/pkg with no private registry) and ml_supply_chain (torch.load without weights_only=True / joblib.load / np.load(allow_pickle=True) / keras load_model on an untrusted model → pickle RCE). Rust is supported end-to-end: the taint engine (blitz_scan / taint_file) maps Rust sinks (std::process::Command, sqlx/diesel, reqwest/hyper, std::fs, serde/bincode) to the classic classes, plus two Rust-specific detectors — rust_unsafe (transmute / assume_init / from_raw_parts / ptr::* — memory-unsafety surface, CWE-119) and rust_format_string (println!/format! with a variable as the format string — CWE-134). The sqlx query! compile-time macro is treated as safe (suppressed). Two more web-class detectors: jwt_alg_confusion (a JWT verifier that dispatches on the token's alg header and accepts BOTH RS256 and HS256, with the HS256 HMAC secret derived from public/shared key material — CWE-347; the attacker sets alg=HS256 and signs with the public key to forge admin tokens) and cache_deception (a reverse proxy caching static-extension URLs with a cache key that omits the session cookie, over a session-authenticated backend — CWE-525; the victim's cached private response is re-fetched anonymously). TO TRY a jwt_alg_confusion hit: fetch the public key (/.well-known/jwks.json), forge an HS256 token signed with that public key, and confirm admin access. TO TRY a cache_deception hit: request an authenticated path with a static extension appended (.css/.js) and re-fetch it anonymously. WEB3: for Solidity/EVM, call web3_audit(code|path) — a deterministic 10-class smart-contract audit (reentrancy, unchecked return, unchecked arithmetic, tx.origin auth, signature replay, unprotected selfdestruct, delegatecall-to-user-input, missing access control, timestamp dependence, spot-price oracle manipulation, unbounded loop) returning ranked findings (class/CWE/severity/line), then foundry_poc(class, contract) to generate an executable Foundry test that PROVES the bug. A web3 hit is a HYPOTHESIS until the Foundry PoC reproduces it.\n" + `PRECISION ANALYSIS — chrome-devtools MCP is MANDATORY, not optional:
|
|
60438
60907
|
` + `- When a lead needs DOM/JS precision — DOM-XSS sink execution, AJAX endpoint + payload interception, JS runtime errors, redirect chains, SSO/token flow, or anything a static HTML glance cannot prove — call drive_devtools(target). It spawns chrome-devtools-mcp and drives a REAL headless browser (navigate -> list_network_requests -> list_console_messages -> evaluate_script), giving reproducible evidence instead of a guess.
|
|
60439
60908
|
` + `- Before calling it, check_mcp() to confirm the browser MCP is available; if not, blitzstrike install-tools or npm i -g chrome-devtools-mcp. Never substitute eyeballing minified JS or a static sink guess when a live browser can PROVE it. This is the precision + consistency layer.
|
|
60440
60909
|
` + "EXTERNAL MCP SERVERS (verified, connect them — NOT one-shot CLIs): chrome-devtools-mcp (29 tools: list_network_requests/get_network_request for raw HTTP interception, list_console_messages for JS errors + DOM-XSS, evaluate_script to run JS, take_screenshot) -> stdio chrome-devtools-mcp --headless --chromeArg=--no-sandbox --chromeArg=--disable-gpu (as root/container this is MANDATORY or the browser crashes; add --proxyServer http://127.0.0.1:8080 to route through Burp, --acceptInsecureCerts for bad TLS). burp-suite-mcp (proxy history + active scan + repeater) -> NOT npm: build the JAR (git clone https://github.com/PortSwigger/mcp-server.git && cd mcp-server && ./gradlew embedProxyJar), load it in Burp Extensions, then connect the client to http://127.0.0.1:9876 (SSE) or the stdio proxy java -jar mcp-proxy-all.jar --sse-url http://127.0.0.1:9876."
|
|
@@ -61353,6 +61822,69 @@ ${statusLine}` : statusLine },
|
|
|
61353
61822
|
}
|
|
61354
61823
|
return { content: [{ type: "text", text: JSON.stringify(await blindOracle(base_url, param, value, { sinks: s })) }] };
|
|
61355
61824
|
});
|
|
61825
|
+
server.registerTool("oob_start", {
|
|
61826
|
+
title: "Out-of-band callback listener (blind SSRF/XXE/SQLi/RCE proof)",
|
|
61827
|
+
description: "Start a deterministic out-of-band (OOB) listener to PROVE a blind vuln (SSRF/XXE/SQLi/command injection) that does not reflect in the HTTP response. Uses interactsh-client when installed (unique *.oast.* domain, streams DNS/HTTP interactions) — the standard for public targets; falls back to a local HTTP listener for local labs. Returns the callback URL/domain + payload templates. Pair oob_start -> inject the canary -> oob_poll(id) until the hit arrives -> oob_stop(id). A hit is reported ONLY when an interaction actually arrives for the session's unique id — never a guess.",
|
|
61828
|
+
inputSchema: {}
|
|
61829
|
+
}, async () => {
|
|
61830
|
+
return { content: [{ type: "text", text: JSON.stringify(await oobStart()) }] };
|
|
61831
|
+
});
|
|
61832
|
+
server.registerTool("oob_poll", {
|
|
61833
|
+
title: "Poll an OOB listener for incoming interactions",
|
|
61834
|
+
description: "Check a live OOB session (from oob_start) for incoming DNS/HTTP interactions. Returns found:true + the hits (protocol, remote address, request line, timestamp) when the canary was actually fetched. Poll repeatedly (e.g. every 2-3s) for up to ~60s after injecting the payload; a blind vuln is CONFIRMED only when your marker arrives.",
|
|
61835
|
+
inputSchema: {
|
|
61836
|
+
id: string2().describe("Session id returned by oob_start")
|
|
61837
|
+
}
|
|
61838
|
+
}, async ({ id }) => {
|
|
61839
|
+
return { content: [{ type: "text", text: JSON.stringify(oobPoll(id)) }] };
|
|
61840
|
+
});
|
|
61841
|
+
server.registerTool("oob_stop", {
|
|
61842
|
+
title: "Stop an OOB listener",
|
|
61843
|
+
description: "Stop an OOB session and free its resources (kill the interactsh child / close the listener). Returns the total hits seen.",
|
|
61844
|
+
inputSchema: {
|
|
61845
|
+
id: string2().describe("Session id returned by oob_start")
|
|
61846
|
+
}
|
|
61847
|
+
}, async ({ id }) => {
|
|
61848
|
+
return { content: [{ type: "text", text: JSON.stringify(oobStop(id)) }] };
|
|
61849
|
+
});
|
|
61850
|
+
server.registerTool("oob_list", {
|
|
61851
|
+
title: "List active OOB listeners",
|
|
61852
|
+
description: "List active OOB sessions (id, mode, domain/url, age) for introspection.",
|
|
61853
|
+
inputSchema: {}
|
|
61854
|
+
}, async () => {
|
|
61855
|
+
return { content: [{ type: "text", text: JSON.stringify(oobList()) }] };
|
|
61856
|
+
});
|
|
61857
|
+
server.registerTool("web3_audit", {
|
|
61858
|
+
title: "Solidity / smart-contract audit (10 bug classes + Foundry PoC)",
|
|
61859
|
+
description: "WEB3: deterministic Solidity audit for the 10 highest-value smart-contract bug classes — reentrancy, unchecked return value, unchecked arithmetic, tx.origin auth, signature replay, unprotected selfdestruct, delegatecall-to-user-input, missing access control, timestamp dependence, spot-price oracle manipulation, and unbounded loops. Pass raw Solidity source (or a path) to get ranked findings (class, CWE, severity, line, evidence). Then call foundry_poc(class, contract) to generate an executable Foundry test template that proves the bug. A hit is a HYPOTHESIS until the Foundry PoC reproduces it.",
|
|
61860
|
+
inputSchema: {
|
|
61861
|
+
code: string2().optional().describe("Raw Solidity source"),
|
|
61862
|
+
path: string2().optional().describe("Path to a .sol file")
|
|
61863
|
+
}
|
|
61864
|
+
}, async ({ code, path }) => {
|
|
61865
|
+
let src = code;
|
|
61866
|
+
if (!src && path) {
|
|
61867
|
+
try {
|
|
61868
|
+
src = readFileSync27(path, "utf8");
|
|
61869
|
+
} catch {
|
|
61870
|
+
return { content: [{ type: "text", text: JSON.stringify({ error: "unreadable path" }) }] };
|
|
61871
|
+
}
|
|
61872
|
+
}
|
|
61873
|
+
if (!src)
|
|
61874
|
+
return { content: [{ type: "text", text: JSON.stringify({ error: "provide code or path" }) }] };
|
|
61875
|
+
const findings = web3Audit(src, path ?? "contract.sol");
|
|
61876
|
+
return { content: [{ type: "text", text: JSON.stringify({ file: path ?? "contract.sol", findings, ranked: web3Rank(findings) }) }] };
|
|
61877
|
+
});
|
|
61878
|
+
server.registerTool("foundry_poc", {
|
|
61879
|
+
title: "Generate a Foundry PoC test for a Web3 finding",
|
|
61880
|
+
description: "Generate an executable Foundry (forge) test template that proves a Web3 finding class (reentrancy / unchecked-return / signature-replay / missing-access-control / oracle-manipulation / …). Pass the class + the vulnerable contract name. Fill in the contract-specific details and run `forge test` to reproduce.",
|
|
61881
|
+
inputSchema: {
|
|
61882
|
+
class_: string2().describe("Web3 finding class (reentrancy, missing_access_control, signature_replay, …)"),
|
|
61883
|
+
contract: string2().optional().describe("Vulnerable contract name (default 'Vulnerable')")
|
|
61884
|
+
}
|
|
61885
|
+
}, async ({ class_, contract }) => {
|
|
61886
|
+
return { content: [{ type: "text", text: foundryPoc(class_, contract ?? "Vulnerable") }] };
|
|
61887
|
+
});
|
|
61356
61888
|
server.registerTool("param_precedence", {
|
|
61357
61889
|
title: "Duplicate parameter precedence fuzzer (WAF-bypass oracle)",
|
|
61358
61890
|
description: "LIVE (black-box): determine how the app resolves duplicate parameters + alternate delimiters (; , %26 %3b | [] %00 + #). Reveals the WAF-bypass vector — if the WAF validates one value and the app binds another, inject via the disagreement. Deterministic: baseline A/B + differential per variant.",
|
|
@@ -62275,21 +62807,21 @@ ${out}${gate}` }] };
|
|
|
62275
62807
|
return server;
|
|
62276
62808
|
}
|
|
62277
62809
|
async function serve() {
|
|
62278
|
-
const server =
|
|
62810
|
+
const server = createServer2();
|
|
62279
62811
|
const transport = new StdioServerTransport;
|
|
62280
62812
|
await server.connect(transport);
|
|
62281
62813
|
}
|
|
62282
62814
|
|
|
62283
62815
|
// src/index.ts
|
|
62284
62816
|
init_cli();
|
|
62285
|
-
import { readFileSync as readFileSync31, existsSync as
|
|
62817
|
+
import { readFileSync as readFileSync31, existsSync as existsSync17 } from "node:fs";
|
|
62286
62818
|
import { join as join28 } from "node:path";
|
|
62287
62819
|
import { fileURLToPath as fileURLToPath17 } from "node:url";
|
|
62288
62820
|
var ROOT11 = join28(fileURLToPath17(new URL(".", import.meta.url)), "..");
|
|
62289
62821
|
function readVersion() {
|
|
62290
62822
|
try {
|
|
62291
62823
|
const p = join28(ROOT11, "package.json");
|
|
62292
|
-
if (
|
|
62824
|
+
if (existsSync17(p))
|
|
62293
62825
|
return JSON.parse(readFileSync31(p, "utf8")).version ?? "1.0.0";
|
|
62294
62826
|
} catch {}
|
|
62295
62827
|
return "1.0.0";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "blitzstrike",
|
|
3
|
-
"version": "2.4.
|
|
3
|
+
"version": "2.4.83",
|
|
4
4
|
"description": "Blitz Strike — a universal MCP security-audit toolbelt. BLITZ sweeps the attack surface, EAGLE-EYE traces source-to-sink, STRIKE verifies live. 57 attack chains, 130-tool catalog, intelligence data layer. One server, every agent.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|