0sec-cli 0.15.0 → 0.18.0
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/0sec.js +327 -0
- package/README.md +68 -48
- package/attacks/data-exfiltration/pii-leakage.yaml +27 -0
- package/attacks/encoding-bypass/base64-encoding.yaml +24 -0
- package/attacks/jailbreak/dan-roleplay.yaml +27 -0
- package/attacks/jailbreak/hypothetical-scenario.yaml +25 -0
- package/attacks/jailbreak/multilingual-bypass.yaml +22 -0
- package/attacks/output-manipulation/harmful-content.yaml +25 -0
- package/attacks/prompt-injection/context-manipulation.yaml +32 -0
- package/attacks/prompt-injection/direct-injection.yaml +28 -0
- package/attacks/prompt-injection/indirect-injection.yaml +33 -0
- package/attacks/system-prompt-extraction/direct-ask.yaml +30 -0
- package/attacks/system-prompt-extraction/markdown-exfil.yaml +26 -0
- package/attacks/tool-misuse/ssrf-via-tools.yaml +27 -0
- package/chunks/adapt-loop-SMH6V4PD.js +18 -0
- package/chunks/adgraph-JLGA6RYI.js +54 -0
- package/chunks/agent/skills/frameworks/entra-id.yaml +63 -0
- package/chunks/agent/skills/frameworks/graphql-introspection.yaml +116 -0
- package/chunks/agent/skills/frameworks/nextjs.yaml +82 -0
- package/chunks/agent/skills/frameworks/python-web.yaml +85 -0
- package/chunks/agent/skills/frameworks/supabase.yaml +83 -0
- package/chunks/agent/skills/frameworks/wordpress-deep.yaml +122 -0
- package/chunks/agent/skills/techniques/ad-attack-paths.yaml +57 -0
- package/chunks/agent/skills/techniques/advisory-disclosure.yaml +59 -0
- package/chunks/agent/skills/techniques/assumption-mining.yaml +53 -0
- package/chunks/agent/skills/techniques/blind-exploitation.yaml +143 -0
- package/chunks/agent/skills/techniques/crypto-misuse.yaml +88 -0
- package/chunks/agent/skills/techniques/cve-poc-adaptation.yaml +82 -0
- package/chunks/agent/skills/techniques/entra-attack-paths.yaml +55 -0
- package/chunks/agent/skills/techniques/http-conformance-diff.yaml +48 -0
- package/chunks/agent/skills/techniques/jwt-attacks.yaml +137 -0
- package/chunks/agent/skills/techniques/kernel-weaponization.yaml +53 -0
- package/chunks/agent/skills/techniques/llm-excessive-agency.yaml +55 -0
- package/chunks/agent/skills/techniques/llm-insecure-output-handling.yaml +56 -0
- package/chunks/agent/skills/techniques/llm-prompt-injection.yaml +54 -0
- package/chunks/agent/skills/techniques/llm-prompt-layer-write.yaml +68 -0
- package/chunks/agent/skills/techniques/llm-rag-poisoning.yaml +57 -0
- package/chunks/agent/skills/techniques/llm-safety-eval.yaml +51 -0
- package/chunks/agent/skills/techniques/npm-ecosystem.yaml +51 -0
- package/chunks/agent/skills/techniques/poc-verification.yaml +55 -0
- package/chunks/agent/skills/techniques/race-condition.yaml +122 -0
- package/chunks/agent/skills/techniques/scoped-fix.yaml +49 -0
- package/chunks/agent/skills/techniques/seedless-depth-review.yaml +59 -0
- package/chunks/agent/skills/techniques/spec-differential.yaml +48 -0
- package/chunks/agent/skills/techniques/variant-hunting.yaml +55 -0
- package/chunks/agent/skills/vulnerabilities/cardano-eutxo-validators.yaml +72 -0
- package/chunks/agent/skills/vulnerabilities/command-injection.yaml +99 -0
- package/chunks/agent/skills/vulnerabilities/deserialization-chains.yaml +106 -0
- package/chunks/agent/skills/vulnerabilities/native-memory-safety.yaml +93 -0
- package/chunks/agent/skills/vulnerabilities/path-traversal.yaml +78 -0
- package/chunks/agent/skills/vulnerabilities/prototype-pollution.yaml +132 -0
- package/chunks/agent/skills/vulnerabilities/request-smuggling.yaml +129 -0
- package/chunks/agent/skills/vulnerabilities/sqli-advanced.yaml +102 -0
- package/chunks/agent/skills/vulnerabilities/ssrf-bypass.yaml +84 -0
- package/chunks/agent/skills/vulnerabilities/ssti-exploitation.yaml +112 -0
- package/chunks/agent/skills/vulnerabilities/structural-sqli.yaml +91 -0
- package/chunks/appsec-catalog-CBWHGTEL.js +24 -0
- package/chunks/artifact-scraper-HQ7HLP6V.js +34 -0
- package/chunks/assumption-mining-5SNIVVDN.js +79 -0
- package/chunks/chunk-242TMK6G.js +110 -0
- package/chunks/chunk-2JCCA2JL.js +381 -0
- package/chunks/chunk-2RMLOJVB.js +47 -0
- package/chunks/chunk-3KPWWJCI.js +1422 -0
- package/chunks/chunk-3MOLBTLS.js +953 -0
- package/chunks/chunk-53G27VPS.js +136 -0
- package/chunks/chunk-57ZENEX2.js +169 -0
- package/chunks/chunk-5G3ZXFBW.js +182 -0
- package/chunks/chunk-5JI7L7KV.js +74240 -0
- package/chunks/chunk-6L26OBWI.js +1094 -0
- package/chunks/chunk-6LKRLK2R.js +542 -0
- package/chunks/chunk-72CISA2D.js +2597 -0
- package/chunks/chunk-7DQEV5QI.js +287 -0
- package/chunks/chunk-AD7WXDH6.js +3250 -0
- package/chunks/chunk-ADOLI6DT.js +102 -0
- package/chunks/chunk-AHTBZC3E.js +596 -0
- package/chunks/chunk-ASUR522M.js +518 -0
- package/chunks/chunk-ATATQACO.js +471 -0
- package/chunks/chunk-BATRQBOR.js +1732 -0
- package/chunks/chunk-BFR2CDV5.js +5735 -0
- package/chunks/chunk-BFRB6HB2.js +235 -0
- package/chunks/chunk-BKZFDZ23.js +361 -0
- package/chunks/chunk-BVAZO4WA.js +193 -0
- package/chunks/chunk-BZNEY2ZS.js +33225 -0
- package/chunks/chunk-C2WXWFBB.js +1070 -0
- package/chunks/chunk-CMKXP5RR.js +917 -0
- package/chunks/chunk-DW5UWPFY.js +275 -0
- package/chunks/chunk-F3WBKITT.js +687 -0
- package/chunks/chunk-GMT2AZKM.js +2439 -0
- package/chunks/chunk-H2FFLZNK.js +3 -0
- package/chunks/chunk-IOL7D5YV.js +515 -0
- package/chunks/chunk-IR537GON.js +49 -0
- package/chunks/chunk-JQHOLLTD.js +3729 -0
- package/chunks/chunk-KLTNTE2Z.js +121 -0
- package/chunks/chunk-LP3HHYQU.js +245 -0
- package/chunks/chunk-MYVT64FN.js +16 -0
- package/chunks/chunk-N7BOUYEV.js +852 -0
- package/chunks/chunk-OEFNRYI2.js +150 -0
- package/chunks/chunk-P6WKNFWX.js +1968 -0
- package/chunks/chunk-QI233I24.js +333 -0
- package/chunks/chunk-RJWOYEOG.js +271 -0
- package/chunks/chunk-RRMJC3ZE.js +105 -0
- package/chunks/chunk-RWONANDA.js +973 -0
- package/chunks/chunk-SAFFWQW4.js +5921 -0
- package/chunks/chunk-SF4KZ4O3.js +502 -0
- package/chunks/chunk-SVJEDVYK.js +808 -0
- package/chunks/chunk-TSK2AG6J.js +5108 -0
- package/chunks/chunk-U5FLXGHT.js +2010 -0
- package/chunks/chunk-UCYRA73C.js +662 -0
- package/chunks/chunk-UR4ELX2Y.js +4784 -0
- package/chunks/chunk-VQG4FT5D.js +685 -0
- package/chunks/chunk-WEBMRWEG.js +9337 -0
- package/chunks/chunk-WU6AFRAZ.js +1167 -0
- package/chunks/chunk-WVTBZEQO.js +1531 -0
- package/chunks/chunk-WXQ6BJ6A.js +596 -0
- package/chunks/chunk-XM5NLHYU.js +600 -0
- package/chunks/chunk-YLMN3N25.js +4054 -0
- package/chunks/chunk-YYRBQVFE.js +2572 -0
- package/chunks/chunk-Z5FA2XOX.js +2798 -0
- package/chunks/commands-TBC2F5CE.js +16999 -0
- package/chunks/corpus-v1.json +403 -0
- package/chunks/cost-ledger-NU63MYZM.js +13 -0
- package/chunks/data/appsec-archetypes.json +102 -0
- package/chunks/data/chromium-archetypes.json +204 -0
- package/chunks/data/freebsd-archetypes.json +171 -0
- package/chunks/data/kernel-archetypes.json +611 -0
- package/chunks/db-KFWOAUUB.js +16 -0
- package/chunks/disclose-EKTWSCGW.js +132 -0
- package/chunks/dist-4MAW5X6L.js +74 -0
- package/chunks/dist-4YICS2J2.js +2776 -0
- package/chunks/dist-FMGSR3DW.js +159 -0
- package/chunks/eval-runner-7ZF472KV.js +27 -0
- package/chunks/example-manifest.json +95 -0
- package/chunks/exploit-agent-45YQOHPJ.js +98 -0
- package/chunks/exploit-autoclimb-UZGEMGYT.js +81 -0
- package/chunks/exploit-climb-SG23KB2G.js +358 -0
- package/chunks/fix-IG7LYXH3.js +12 -0
- package/chunks/github-issues-MJ6OYOOU.js +157 -0
- package/chunks/harness-7ODOLOWU.js +22 -0
- package/chunks/http-conformance-DU66MZIU.js +11 -0
- package/chunks/http-sender-GWH2IYEA.js +10 -0
- package/chunks/hunt-scan-MMKUOETU.js +38 -0
- package/chunks/identity-6ZAIIWOR.js +191 -0
- package/chunks/kernel-primitive-7U6CWHXD.js +44 -0
- package/chunks/kernel-vm-runner-3JAU4O6J.js +62 -0
- package/chunks/memsafety-scan-J7SECV5W.js +16 -0
- package/chunks/native-loop-RJCJPOUS.js +54 -0
- package/chunks/npm-detectors-KB5Y5ZFX.js +69 -0
- package/chunks/npm-dynamic-discovery-AHROOZDB.js +13 -0
- package/chunks/orchestrate-OC2VZN2X.js +62 -0
- package/chunks/pipeline-BZK5BLJR.js +14 -0
- package/chunks/pre-recon-cve-66EB6G4M.js +351 -0
- package/chunks/prepare-MYY743TK.js +13 -0
- package/chunks/process-LQRCS5OY.js +13 -0
- package/chunks/replay-runner-45G3VU7X.js +39 -0
- package/chunks/run-D56MPDKY.js +32716 -0
- package/chunks/runtime-G7YWIO3B.js +43 -0
- package/chunks/runtime-J7PLXZNM.js +12 -0
- package/chunks/scan-stream-FHI2FYZE.js +96 -0
- package/chunks/scope-BI7BF4ZY.js +18 -0
- package/chunks/session-store-GZ4A4KYT.js +28 -0
- package/chunks/source-files-PWRQR6LY.js +12 -0
- package/chunks/specdrift-WCLH6TTQ.js +19 -0
- package/chunks/variant-candidates-YERCYMPD.js +13 -0
- package/chunks/web-recon-prepass-JJGPEOLE.js +1148 -0
- package/dashboard/assets/0sec-icon-66SreztZ.gif +0 -0
- package/dashboard/assets/bot-yILPnRgD.js +1 -0
- package/dashboard/assets/chevron-down-BeDJ-Vka.js +1 -0
- package/dashboard/assets/circle-alert-BEnMBMT-.js +1 -0
- package/dashboard/assets/client-DRYsuOGl.js +9 -0
- package/dashboard/assets/copy-Bi5vzoF9.js +1 -0
- package/dashboard/assets/desktop-CXTQonNm.js +32 -0
- package/dashboard/assets/desktop-NOekk4QS.css +1 -0
- package/dashboard/assets/dist-CmX-h7a4.js +1 -0
- package/dashboard/assets/dist-DAwYQmf_.js +45 -0
- package/dashboard/assets/findings-page-CACW9nw2.js +5 -0
- package/dashboard/assets/format-PoISqsES.js +1 -0
- package/dashboard/assets/geist-cyrillic-ext-wght-normal-DjL33-gN.woff2 +0 -0
- package/dashboard/assets/geist-cyrillic-wght-normal-BEAKL7Jp.woff2 +0 -0
- package/dashboard/assets/geist-latin-ext-wght-normal-DC-KSUi6.woff2 +0 -0
- package/dashboard/assets/geist-latin-wght-normal-BgDaEnEv.woff2 +0 -0
- package/dashboard/assets/geist-vietnamese-wght-normal-6IgcOCM7.woff2 +0 -0
- package/dashboard/assets/ibm-plex-mono-cyrillic-400-normal-BSMlKf0J.woff2 +0 -0
- package/dashboard/assets/ibm-plex-mono-cyrillic-400-normal-CEL4l2ZJ.woff +0 -0
- package/dashboard/assets/ibm-plex-mono-cyrillic-ext-400-normal-DMdlQ8Kv.woff +0 -0
- package/dashboard/assets/ibm-plex-mono-cyrillic-ext-400-normal-xuaO2J-f.woff2 +0 -0
- package/dashboard/assets/ibm-plex-mono-latin-400-normal-CvHOgSBP.woff +0 -0
- package/dashboard/assets/ibm-plex-mono-latin-400-normal-DMJ8VG8y.woff2 +0 -0
- package/dashboard/assets/ibm-plex-mono-latin-ext-400-normal-BmRBH3aV.woff2 +0 -0
- package/dashboard/assets/ibm-plex-mono-latin-ext-400-normal-D3D2R8hC.woff +0 -0
- package/dashboard/assets/ibm-plex-mono-vietnamese-400-normal-BulugwFq.woff2 +0 -0
- package/dashboard/assets/ibm-plex-mono-vietnamese-400-normal-DDuiU_S-.woff +0 -0
- package/dashboard/assets/jsx-runtime-C7oxC63R.js +1 -0
- package/dashboard/assets/live-page-DrgQqQK5.js +1 -0
- package/dashboard/assets/meta-tile-CcskIV_o.js +1 -0
- package/dashboard/assets/operations-BKE8T-vY.css +2 -0
- package/dashboard/assets/operations-D8nUP5_m.js +4 -0
- package/dashboard/assets/operations-app-CQQhG54n.js +2 -0
- package/dashboard/assets/overview-page-DTGS8dPo.js +1 -0
- package/dashboard/assets/page-header-MFVvEtZW.js +1 -0
- package/dashboard/assets/play-Dwo-9xt6.js +1 -0
- package/dashboard/assets/scans-page-ChVtq8Us.js +1 -0
- package/dashboard/assets/search-CiooTLck.js +1 -0
- package/dashboard/assets/siren-CCBwTSuk.js +1 -0
- package/dashboard/assets/table-BYS-nIVA.js +1 -0
- package/dashboard/assets/tabs-DivxbhQy.js +1 -0
- package/dashboard/desktop.html +21 -0
- package/dashboard/index.html +15 -0
- package/package.json +30 -18
- package/bin/0sec.cjs +0 -361
|
@@ -0,0 +1,351 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { createRequire as __0secCreateRequire } from "node:module";
|
|
3
|
+
const require = __0secCreateRequire(import.meta.url);
|
|
4
|
+
import {
|
|
5
|
+
runWpFingerprint
|
|
6
|
+
} from "./chunk-3MOLBTLS.js";
|
|
7
|
+
import "./chunk-IR537GON.js";
|
|
8
|
+
|
|
9
|
+
// packages/core/dist/pre-recon-cve.js
|
|
10
|
+
import { execFileSync } from "node:child_process";
|
|
11
|
+
import { existsSync, readdirSync, statSync } from "node:fs";
|
|
12
|
+
import { join, relative } from "node:path";
|
|
13
|
+
function findManifests(repoPath, kinds, maxDepth = 4) {
|
|
14
|
+
const SKIP_DIRS = /* @__PURE__ */ new Set([
|
|
15
|
+
"node_modules",
|
|
16
|
+
".git",
|
|
17
|
+
"dist",
|
|
18
|
+
"build",
|
|
19
|
+
".next",
|
|
20
|
+
".nuxt",
|
|
21
|
+
".svelte-kit",
|
|
22
|
+
"target",
|
|
23
|
+
"vendor",
|
|
24
|
+
"venv",
|
|
25
|
+
".venv",
|
|
26
|
+
"__pycache__",
|
|
27
|
+
".pytest_cache",
|
|
28
|
+
"out",
|
|
29
|
+
".cache",
|
|
30
|
+
"coverage"
|
|
31
|
+
]);
|
|
32
|
+
const found = [];
|
|
33
|
+
function walk(dir, depth) {
|
|
34
|
+
if (depth > maxDepth)
|
|
35
|
+
return;
|
|
36
|
+
let entries;
|
|
37
|
+
try {
|
|
38
|
+
entries = readdirSync(dir);
|
|
39
|
+
} catch {
|
|
40
|
+
return;
|
|
41
|
+
}
|
|
42
|
+
for (const entry of entries) {
|
|
43
|
+
if (SKIP_DIRS.has(entry))
|
|
44
|
+
continue;
|
|
45
|
+
const abs = join(dir, entry);
|
|
46
|
+
let st;
|
|
47
|
+
try {
|
|
48
|
+
st = statSync(abs);
|
|
49
|
+
} catch {
|
|
50
|
+
continue;
|
|
51
|
+
}
|
|
52
|
+
if (st.isDirectory()) {
|
|
53
|
+
walk(abs, depth + 1);
|
|
54
|
+
} else if (st.isFile()) {
|
|
55
|
+
for (const kind of kinds) {
|
|
56
|
+
if (entry === kind.filename) {
|
|
57
|
+
found.push({
|
|
58
|
+
kind,
|
|
59
|
+
absPath: abs,
|
|
60
|
+
relPath: relative(repoPath, abs)
|
|
61
|
+
});
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
walk(repoPath, 0);
|
|
68
|
+
return found;
|
|
69
|
+
}
|
|
70
|
+
function runNpmAudit(manifestPath, manifestRel) {
|
|
71
|
+
const dir = manifestPath.replace(/\/(?:package-lock\.json|package\.json)$/, "");
|
|
72
|
+
let output;
|
|
73
|
+
try {
|
|
74
|
+
output = execFileSync("npm", ["audit", "--json"], {
|
|
75
|
+
cwd: dir,
|
|
76
|
+
timeout: 3e4,
|
|
77
|
+
encoding: "utf8",
|
|
78
|
+
stdio: ["ignore", "pipe", "ignore"]
|
|
79
|
+
});
|
|
80
|
+
} catch (err) {
|
|
81
|
+
output = (err && typeof err.stdout === "string" ? err.stdout : "") || "";
|
|
82
|
+
if (!output)
|
|
83
|
+
return [];
|
|
84
|
+
}
|
|
85
|
+
let parsed;
|
|
86
|
+
try {
|
|
87
|
+
parsed = JSON.parse(output);
|
|
88
|
+
} catch {
|
|
89
|
+
return [];
|
|
90
|
+
}
|
|
91
|
+
const advisories = [];
|
|
92
|
+
const vulns = parsed.vulnerabilities ?? {};
|
|
93
|
+
for (const [pkgName, vuln] of Object.entries(vulns)) {
|
|
94
|
+
const sev = vuln.severity;
|
|
95
|
+
if (sev !== "high" && sev !== "critical")
|
|
96
|
+
continue;
|
|
97
|
+
const via = Array.isArray(vuln.via) ? vuln.via : [];
|
|
98
|
+
let advisoryAdded = false;
|
|
99
|
+
for (const v of via) {
|
|
100
|
+
if (typeof v === "object" && v !== null && v.title) {
|
|
101
|
+
advisories.push({
|
|
102
|
+
manifest: manifestRel,
|
|
103
|
+
tool: "npm-audit",
|
|
104
|
+
package: pkgName,
|
|
105
|
+
version: typeof vuln.range === "string" ? vuln.range : void 0,
|
|
106
|
+
vulnerableRange: typeof v.range === "string" ? v.range : void 0,
|
|
107
|
+
id: String(v.source ?? v.url ?? v.title),
|
|
108
|
+
title: String(v.title),
|
|
109
|
+
severity: sev,
|
|
110
|
+
url: typeof v.url === "string" ? v.url : void 0
|
|
111
|
+
});
|
|
112
|
+
advisoryAdded = true;
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
if (!advisoryAdded) {
|
|
116
|
+
advisories.push({
|
|
117
|
+
manifest: manifestRel,
|
|
118
|
+
tool: "npm-audit",
|
|
119
|
+
package: pkgName,
|
|
120
|
+
severity: sev,
|
|
121
|
+
id: `npm-audit:${pkgName}`,
|
|
122
|
+
title: `Transitive ${sev} advisory in ${pkgName} (see npm audit for chain)`
|
|
123
|
+
});
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
return advisories;
|
|
127
|
+
}
|
|
128
|
+
function runPipAudit(manifestPath, manifestRel) {
|
|
129
|
+
const dir = manifestPath.replace(/\/requirements\.txt$/, "");
|
|
130
|
+
let output;
|
|
131
|
+
try {
|
|
132
|
+
output = execFileSync("pip-audit", ["--requirement", "requirements.txt", "--format", "json"], {
|
|
133
|
+
cwd: dir,
|
|
134
|
+
timeout: 6e4,
|
|
135
|
+
encoding: "utf8",
|
|
136
|
+
stdio: ["ignore", "pipe", "ignore"]
|
|
137
|
+
});
|
|
138
|
+
} catch (err) {
|
|
139
|
+
if (err && err.code === "ENOENT")
|
|
140
|
+
return [];
|
|
141
|
+
output = (err && typeof err.stdout === "string" ? err.stdout : "") || "";
|
|
142
|
+
if (!output)
|
|
143
|
+
return [];
|
|
144
|
+
}
|
|
145
|
+
let parsed;
|
|
146
|
+
try {
|
|
147
|
+
parsed = JSON.parse(output);
|
|
148
|
+
} catch {
|
|
149
|
+
return [];
|
|
150
|
+
}
|
|
151
|
+
const advisories = [];
|
|
152
|
+
const dependencies = Array.isArray(parsed.dependencies) ? parsed.dependencies : [];
|
|
153
|
+
for (const dep of dependencies) {
|
|
154
|
+
const pkgName = dep.name;
|
|
155
|
+
const version = dep.version;
|
|
156
|
+
const vulns = Array.isArray(dep.vulns) ? dep.vulns : [];
|
|
157
|
+
for (const v of vulns) {
|
|
158
|
+
const id = String(v.id ?? "");
|
|
159
|
+
const isCveOrGhsa = /^(CVE-|GHSA-)/i.test(id);
|
|
160
|
+
if (!isCveOrGhsa)
|
|
161
|
+
continue;
|
|
162
|
+
advisories.push({
|
|
163
|
+
manifest: manifestRel,
|
|
164
|
+
tool: "pip-audit",
|
|
165
|
+
package: String(pkgName),
|
|
166
|
+
version: typeof version === "string" ? version : void 0,
|
|
167
|
+
id,
|
|
168
|
+
title: String(v.description ?? v.id ?? "pip-audit advisory"),
|
|
169
|
+
severity: "high",
|
|
170
|
+
url: typeof v.aliases?.[0] === "string" ? v.aliases[0] : void 0
|
|
171
|
+
});
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
return advisories;
|
|
175
|
+
}
|
|
176
|
+
var MANIFEST_KINDS = [
|
|
177
|
+
{ filename: "package-lock.json", tool: "npm-audit", run: runNpmAudit },
|
|
178
|
+
{ filename: "requirements.txt", tool: "pip-audit", run: runPipAudit }
|
|
179
|
+
// Future: bundle-audit (Gemfile.lock), composer audit (composer.lock),
|
|
180
|
+
// cargo audit (Cargo.lock), govulncheck (go.sum). Each goes here as a
|
|
181
|
+
// new ManifestKind entry. Out of scope for the initial Phase 4 patch.
|
|
182
|
+
];
|
|
183
|
+
function runPreReconCveCheck(repoPath) {
|
|
184
|
+
const start = Date.now();
|
|
185
|
+
const advisories = [];
|
|
186
|
+
const scanned = [];
|
|
187
|
+
const skipped = [];
|
|
188
|
+
if (!existsSync(repoPath)) {
|
|
189
|
+
return { advisories, manifestsScanned: scanned, manifestsSkipped: skipped, durationMs: 0 };
|
|
190
|
+
}
|
|
191
|
+
const manifests = findManifests(repoPath, MANIFEST_KINDS);
|
|
192
|
+
for (const { kind, absPath, relPath } of manifests) {
|
|
193
|
+
try {
|
|
194
|
+
const found = kind.run(absPath, relPath);
|
|
195
|
+
scanned.push(relPath);
|
|
196
|
+
advisories.push(...found);
|
|
197
|
+
} catch (err) {
|
|
198
|
+
skipped.push({
|
|
199
|
+
manifest: relPath,
|
|
200
|
+
reason: err instanceof Error ? err.message : String(err)
|
|
201
|
+
});
|
|
202
|
+
}
|
|
203
|
+
}
|
|
204
|
+
return {
|
|
205
|
+
advisories,
|
|
206
|
+
manifestsScanned: scanned,
|
|
207
|
+
manifestsSkipped: skipped,
|
|
208
|
+
durationMs: Date.now() - start
|
|
209
|
+
};
|
|
210
|
+
}
|
|
211
|
+
function formatPreReconForPrompt(report) {
|
|
212
|
+
if (report.advisories.length === 0)
|
|
213
|
+
return null;
|
|
214
|
+
const seen = /* @__PURE__ */ new Set();
|
|
215
|
+
const uniqueLines = [];
|
|
216
|
+
for (const a of report.advisories) {
|
|
217
|
+
const key = `${a.package}::${a.id}`;
|
|
218
|
+
if (seen.has(key))
|
|
219
|
+
continue;
|
|
220
|
+
seen.add(key);
|
|
221
|
+
const range = a.vulnerableRange ? ` (vulnerable: ${a.vulnerableRange})` : "";
|
|
222
|
+
const url = a.url ? ` \u2014 ${a.url}` : "";
|
|
223
|
+
uniqueLines.push(`- \`${a.package}\`${a.version ? `@${a.version}` : ""}: **${a.severity}** \u2014 ${a.title} [${a.id}]${range}${url}`);
|
|
224
|
+
}
|
|
225
|
+
const limited = uniqueLines.slice(0, 30);
|
|
226
|
+
const more = uniqueLines.length > limited.length ? `
|
|
227
|
+
|
|
228
|
+
_(${uniqueLines.length - limited.length} more advisories suppressed; see npm audit / pip-audit on the source tree for the full list)_` : "";
|
|
229
|
+
return [
|
|
230
|
+
"## Priority CVE leads from source-tree audit",
|
|
231
|
+
"",
|
|
232
|
+
"The following high/critical advisories were found by running `npm audit` / `pip-audit` against the package manifests in the source tree before this scan started. The vulnerable versions are confirmed installed. **Investigate these as your first priority** \u2014 the running target almost certainly inherits at least one of them, and the exploit chain may already be public.",
|
|
233
|
+
"",
|
|
234
|
+
...limited,
|
|
235
|
+
more,
|
|
236
|
+
""
|
|
237
|
+
].join("\n");
|
|
238
|
+
}
|
|
239
|
+
async function detectWordPressCheap(target, fetchImpl, timeoutMs, headers) {
|
|
240
|
+
const base = target.replace(/\/+$/, "");
|
|
241
|
+
const paths = ["wp-login.php", "readme.html", "wp-includes/version.php"];
|
|
242
|
+
const evidence = [];
|
|
243
|
+
const results = await Promise.all(paths.map(async (p) => {
|
|
244
|
+
try {
|
|
245
|
+
const controller = new AbortController();
|
|
246
|
+
const timer = setTimeout(() => controller.abort(), timeoutMs);
|
|
247
|
+
const res = await fetchImpl(`${base}/${p}`, {
|
|
248
|
+
method: "GET",
|
|
249
|
+
headers: headers ?? {}
|
|
250
|
+
}).finally(() => clearTimeout(timer));
|
|
251
|
+
const body = await res.text().catch(() => "");
|
|
252
|
+
return { path: p, ok: res.ok, status: res.status, body };
|
|
253
|
+
} catch {
|
|
254
|
+
return void 0;
|
|
255
|
+
}
|
|
256
|
+
}));
|
|
257
|
+
for (const r of results) {
|
|
258
|
+
if (!r)
|
|
259
|
+
continue;
|
|
260
|
+
if (r.path === "wp-login.php" && r.ok && /wp-submit|user_login|wp-login/i.test(r.body)) {
|
|
261
|
+
evidence.push("wp-login.php");
|
|
262
|
+
}
|
|
263
|
+
if (r.path === "readme.html" && r.ok && /wordpress/i.test(r.body)) {
|
|
264
|
+
evidence.push("readme.html");
|
|
265
|
+
}
|
|
266
|
+
if (r.path === "wp-includes/version.php" && r.ok && /\$wp_version/.test(r.body)) {
|
|
267
|
+
evidence.push("wp-includes/version.php");
|
|
268
|
+
}
|
|
269
|
+
}
|
|
270
|
+
return evidence;
|
|
271
|
+
}
|
|
272
|
+
async function runPreReconWordPress(opts) {
|
|
273
|
+
const start = Date.now();
|
|
274
|
+
const fetchImpl = opts.fetchImpl ?? globalThis.fetch;
|
|
275
|
+
const timeoutMs = opts.timeoutMs ?? 8e3;
|
|
276
|
+
try {
|
|
277
|
+
const evidence = await detectWordPressCheap(opts.target, fetchImpl, timeoutMs, opts.headers);
|
|
278
|
+
if (evidence.length === 0) {
|
|
279
|
+
return {
|
|
280
|
+
isWordPress: false,
|
|
281
|
+
detectionEvidence: [],
|
|
282
|
+
durationMs: Date.now() - start
|
|
283
|
+
};
|
|
284
|
+
}
|
|
285
|
+
const fingerprint = await runWpFingerprint({
|
|
286
|
+
target: opts.target,
|
|
287
|
+
fetchImpl,
|
|
288
|
+
timeoutMs,
|
|
289
|
+
skipOsv: opts.skipOsv,
|
|
290
|
+
headers: opts.headers
|
|
291
|
+
});
|
|
292
|
+
return {
|
|
293
|
+
isWordPress: true,
|
|
294
|
+
detectionEvidence: evidence,
|
|
295
|
+
fingerprint,
|
|
296
|
+
durationMs: Date.now() - start
|
|
297
|
+
};
|
|
298
|
+
} catch (err) {
|
|
299
|
+
return {
|
|
300
|
+
isWordPress: false,
|
|
301
|
+
detectionEvidence: [],
|
|
302
|
+
durationMs: Date.now() - start,
|
|
303
|
+
error: err instanceof Error ? err.message : String(err)
|
|
304
|
+
};
|
|
305
|
+
}
|
|
306
|
+
}
|
|
307
|
+
function formatPreReconWordPressForPrompt(report) {
|
|
308
|
+
if (!report.isWordPress || !report.fingerprint)
|
|
309
|
+
return null;
|
|
310
|
+
const fp = report.fingerprint;
|
|
311
|
+
if (fp.plugins.length === 0 && fp.themes.length === 0 && fp.findings.length === 0) {
|
|
312
|
+
return null;
|
|
313
|
+
}
|
|
314
|
+
const lines = [];
|
|
315
|
+
lines.push("## WordPress pre-recon");
|
|
316
|
+
lines.push("");
|
|
317
|
+
lines.push(`Phase-4 auto-detected WordPress at the target before the attack agent started. Core version: ${fp.coreVersion ?? "unknown"}. Detection evidence: ${report.detectionEvidence.join(", ")}.`);
|
|
318
|
+
lines.push("");
|
|
319
|
+
lines.push(`Enumerated **${fp.plugins.length} plugin${fp.plugins.length === 1 ? "" : "s"}** and **${fp.themes.length} theme${fp.themes.length === 1 ? "" : "s"}**.`);
|
|
320
|
+
const withCves = fp.findings.filter((f) => f.cves.length > 0);
|
|
321
|
+
if (withCves.length > 0) {
|
|
322
|
+
lines.push("");
|
|
323
|
+
lines.push(`### Priority WP CVE leads (${withCves.length} affected components)`);
|
|
324
|
+
lines.push("");
|
|
325
|
+
lines.push("**Investigate these first** \u2014 the WP fingerprinter confirmed each slug/version pair against the OSV advisory database, so every entry below is a concrete lead, not a guess.");
|
|
326
|
+
lines.push("");
|
|
327
|
+
for (const f of withCves.slice(0, 20)) {
|
|
328
|
+
const ids = f.cves.slice(0, 5).map((c) => c.id).join(", ");
|
|
329
|
+
const more = f.cves.length > 5 ? ` (+${f.cves.length - 5} more)` : "";
|
|
330
|
+
lines.push(`- **${f.kind}** \`${f.slug}\`${f.version ? `@${f.version}` : ""}: ${ids}${more}`);
|
|
331
|
+
for (const hint of f.exploitHints.slice(0, 2)) {
|
|
332
|
+
lines.push(` - hint: ${hint}`);
|
|
333
|
+
}
|
|
334
|
+
}
|
|
335
|
+
if (withCves.length > 20) {
|
|
336
|
+
lines.push("");
|
|
337
|
+
lines.push(`_(${withCves.length - 20} more affected components suppressed for brevity.)_`);
|
|
338
|
+
}
|
|
339
|
+
} else {
|
|
340
|
+
lines.push("");
|
|
341
|
+
lines.push("No OSV advisory matches for the enumerated plugin/theme versions.");
|
|
342
|
+
}
|
|
343
|
+
lines.push("");
|
|
344
|
+
return lines.join("\n");
|
|
345
|
+
}
|
|
346
|
+
export {
|
|
347
|
+
formatPreReconForPrompt,
|
|
348
|
+
formatPreReconWordPressForPrompt,
|
|
349
|
+
runPreReconCveCheck,
|
|
350
|
+
runPreReconWordPress
|
|
351
|
+
};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { createRequire as __0secCreateRequire } from "node:module";
|
|
3
|
+
const require = __0secCreateRequire(import.meta.url);
|
|
4
|
+
import {
|
|
5
|
+
detectTargetType,
|
|
6
|
+
prepare
|
|
7
|
+
} from "./chunk-WU6AFRAZ.js";
|
|
8
|
+
import "./chunk-DW5UWPFY.js";
|
|
9
|
+
import "./chunk-IR537GON.js";
|
|
10
|
+
export {
|
|
11
|
+
detectTargetType,
|
|
12
|
+
prepare
|
|
13
|
+
};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { createRequire as __0secCreateRequire } from "node:module";
|
|
3
|
+
const require = __0secCreateRequire(import.meta.url);
|
|
4
|
+
import {
|
|
5
|
+
ProcessRuntime
|
|
6
|
+
} from "./chunk-ATATQACO.js";
|
|
7
|
+
import "./chunk-ADOLI6DT.js";
|
|
8
|
+
import "./chunk-6L26OBWI.js";
|
|
9
|
+
import "./chunk-YLMN3N25.js";
|
|
10
|
+
import "./chunk-IR537GON.js";
|
|
11
|
+
export {
|
|
12
|
+
ProcessRuntime
|
|
13
|
+
};
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { createRequire as __0secCreateRequire } from "node:module";
|
|
3
|
+
const require = __0secCreateRequire(import.meta.url);
|
|
4
|
+
import {
|
|
5
|
+
DEFAULT_DOCKER_HTTP_IMAGE,
|
|
6
|
+
DEFAULT_DOCKER_SHELL_IMAGE,
|
|
7
|
+
DEFAULT_STEP_TIMEOUT_MS,
|
|
8
|
+
DockerRunner,
|
|
9
|
+
LocalShellRunner,
|
|
10
|
+
MAX_STREAM_CAPTURE_BYTES,
|
|
11
|
+
QemuRunner,
|
|
12
|
+
STREAM_EXCERPT_BYTES,
|
|
13
|
+
argvForStep,
|
|
14
|
+
assertionFromStepExpect,
|
|
15
|
+
evaluateAssertion,
|
|
16
|
+
excerpt,
|
|
17
|
+
persistArtifact,
|
|
18
|
+
runDeterministicReplay
|
|
19
|
+
} from "./chunk-C2WXWFBB.js";
|
|
20
|
+
import "./chunk-KLTNTE2Z.js";
|
|
21
|
+
import "./chunk-6L26OBWI.js";
|
|
22
|
+
import "./chunk-YLMN3N25.js";
|
|
23
|
+
import "./chunk-IR537GON.js";
|
|
24
|
+
export {
|
|
25
|
+
DEFAULT_DOCKER_HTTP_IMAGE,
|
|
26
|
+
DEFAULT_DOCKER_SHELL_IMAGE,
|
|
27
|
+
DEFAULT_STEP_TIMEOUT_MS,
|
|
28
|
+
DockerRunner,
|
|
29
|
+
LocalShellRunner,
|
|
30
|
+
MAX_STREAM_CAPTURE_BYTES,
|
|
31
|
+
QemuRunner,
|
|
32
|
+
STREAM_EXCERPT_BYTES,
|
|
33
|
+
argvForStep,
|
|
34
|
+
assertionFromStepExpect,
|
|
35
|
+
evaluateAssertion,
|
|
36
|
+
excerpt,
|
|
37
|
+
persistArtifact,
|
|
38
|
+
runDeterministicReplay
|
|
39
|
+
};
|