@q32/signal-scanner 0.1.0 → 0.1.1

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.
Files changed (75) hide show
  1. package/dist/dynamic.d.ts +43 -0
  2. package/dist/dynamic.d.ts.map +1 -0
  3. package/{src/dynamic.ts → dist/dynamic.js} +133 -156
  4. package/dist/dynamic.js.map +1 -0
  5. package/dist/feeds.d.ts +66 -0
  6. package/dist/feeds.d.ts.map +1 -0
  7. package/dist/feeds.js +259 -0
  8. package/dist/feeds.js.map +1 -0
  9. package/dist/index.d.ts +110 -0
  10. package/dist/index.d.ts.map +1 -0
  11. package/dist/index.js +1251 -0
  12. package/dist/index.js.map +1 -0
  13. package/dist/intel.d.ts +72 -0
  14. package/dist/intel.d.ts.map +1 -0
  15. package/dist/intel.js +480 -0
  16. package/dist/intel.js.map +1 -0
  17. package/dist/node-tls.d.ts +8 -0
  18. package/dist/node-tls.d.ts.map +1 -0
  19. package/dist/node-tls.js +48 -0
  20. package/dist/node-tls.js.map +1 -0
  21. package/dist/render.d.ts +26 -0
  22. package/dist/render.d.ts.map +1 -0
  23. package/dist/render.js +248 -0
  24. package/dist/render.js.map +1 -0
  25. package/dist/rules/packs/binary.d.ts +4 -0
  26. package/dist/rules/packs/binary.d.ts.map +1 -0
  27. package/dist/rules/packs/binary.js +101 -0
  28. package/dist/rules/packs/binary.js.map +1 -0
  29. package/dist/rules/packs/css.d.ts +3 -0
  30. package/dist/rules/packs/css.d.ts.map +1 -0
  31. package/dist/rules/packs/css.js +43 -0
  32. package/dist/rules/packs/css.js.map +1 -0
  33. package/dist/rules/packs/decoders.d.ts +3 -0
  34. package/dist/rules/packs/decoders.d.ts.map +1 -0
  35. package/dist/rules/packs/decoders.js +46 -0
  36. package/dist/rules/packs/decoders.js.map +1 -0
  37. package/dist/rules/packs/html.d.ts +4 -0
  38. package/dist/rules/packs/html.d.ts.map +1 -0
  39. package/dist/rules/packs/html.js +227 -0
  40. package/dist/rules/packs/html.js.map +1 -0
  41. package/dist/rules/packs/index.d.ts +24 -0
  42. package/dist/rules/packs/index.d.ts.map +1 -0
  43. package/dist/rules/packs/index.js +75 -0
  44. package/dist/rules/packs/index.js.map +1 -0
  45. package/dist/rules/packs/script-risk.d.ts +4 -0
  46. package/dist/rules/packs/script-risk.d.ts.map +1 -0
  47. package/dist/rules/packs/script-risk.js +231 -0
  48. package/dist/rules/packs/script-risk.js.map +1 -0
  49. package/dist/rules/packs/source-code.d.ts +3 -0
  50. package/dist/rules/packs/source-code.d.ts.map +1 -0
  51. package/dist/rules/packs/source-code.js +179 -0
  52. package/dist/rules/packs/source-code.js.map +1 -0
  53. package/dist/rules/packs/urls.d.ts +3 -0
  54. package/dist/rules/packs/urls.d.ts.map +1 -0
  55. package/dist/rules/packs/urls.js +123 -0
  56. package/dist/rules/packs/urls.js.map +1 -0
  57. package/dist/rules/types.d.ts +34 -0
  58. package/dist/rules/types.d.ts.map +1 -0
  59. package/dist/rules/types.js +2 -0
  60. package/dist/rules/types.js.map +1 -0
  61. package/package.json +18 -14
  62. package/src/feeds.ts +0 -334
  63. package/src/index.ts +0 -1366
  64. package/src/intel.ts +0 -561
  65. package/src/node-tls.ts +0 -55
  66. package/src/render.ts +0 -233
  67. package/src/rules/packs/binary.ts +0 -103
  68. package/src/rules/packs/css.ts +0 -44
  69. package/src/rules/packs/decoders.ts +0 -47
  70. package/src/rules/packs/html.ts +0 -255
  71. package/src/rules/packs/index.ts +0 -76
  72. package/src/rules/packs/script-risk.ts +0 -236
  73. package/src/rules/packs/source-code.ts +0 -180
  74. package/src/rules/packs/urls.ts +0 -138
  75. package/src/rules/types.ts +0 -56
package/dist/render.js ADDED
@@ -0,0 +1,248 @@
1
+ // Render-and-scan: build a REAL DOM (linkedom), run the page's inline AND
2
+ // external scripts against it with our behavioral surfaces instrumented, then
3
+ // hand back the rendered HTML (to re-scan with the static rules) plus a
4
+ // BehaviorReport (exfil endpoints, runtime redirects, eval'd code, surfaced
5
+ // URLs). This closes the gap where a credential form is injected by an external
6
+ // JS bundle — invisible to inline-only analysis.
7
+ //
8
+ // linkedom replaces only the DOM; the instrumentation (fetch/XHR/sendBeacon/
9
+ // location/eval/Function/atob/cookie) is layered ON the linkedom window so both
10
+ // `fetch(...)` and `window.fetch(...)`/`window.location.href=` are recorded.
11
+ //
12
+ // linkedom + new Function run in any JS isolate (Node + workerd). For UNTRUSTED
13
+ // pages the caller supplies a `run` that executes in a real sandbox (node:vm with
14
+ // a timeout in the CLI; a globalOutbound:null Dynamic Worker in the Worker). The
15
+ // default in-process runner is for trusted/synthetic use (tests).
16
+ import { parseHTML } from "linkedom";
17
+ import { extractInlineScripts, extractScriptSources } from "./dynamic.js";
18
+ const MAX_EXTERNAL_SCRIPTS = 8;
19
+ const MAX_SCRIPT_BYTES = 512 * 1024;
20
+ function emptyReport() {
21
+ return { redirects: [], network: [], writes: [], evals: [], decoded: [], cookies: [], errors: [] };
22
+ }
23
+ // Host orchestrator: pre-fetch external scripts (IO stays on the host — the
24
+ // isolate has no network), then run the pure renderDom core inside the caller's
25
+ // isolate (or in-process by default).
26
+ export async function renderAndScan(html, options = {}) {
27
+ let externalScripts = [];
28
+ if (options.fetchScript) {
29
+ const sources = extractScriptSources(html).slice(0, options.maxExternalScripts ?? MAX_EXTERNAL_SCRIPTS);
30
+ externalScripts = (await Promise.all(sources.map(async (src) => {
31
+ let absolute;
32
+ try {
33
+ absolute = new URL(src, options.url ?? "https://invalid.example/").toString();
34
+ }
35
+ catch {
36
+ return "";
37
+ }
38
+ if (!/^https?:/i.test(absolute))
39
+ return "";
40
+ try {
41
+ const body = await options.fetchScript(absolute);
42
+ return (body ?? "").slice(0, MAX_SCRIPT_BYTES);
43
+ }
44
+ catch {
45
+ return "";
46
+ }
47
+ }))).filter(Boolean);
48
+ }
49
+ const invoke = options.invoke ?? renderDom;
50
+ return await invoke({ html, url: options.url, externalScripts });
51
+ }
52
+ // The pure, self-contained core: build a real DOM, run inline + provided external
53
+ // scripts against it with instrumented surfaces, return rendered HTML + behaviors.
54
+ // No IO, no host-global mutation — safe to run in-process or bundled into an
55
+ // isolate (isolated-vm / CF Dynamic Worker).
56
+ export function renderDom(input) {
57
+ const report = emptyReport();
58
+ let parsed;
59
+ try {
60
+ parsed = parseHTML(input.html);
61
+ }
62
+ catch {
63
+ report.errors.push("linkedom parse failed");
64
+ return { html: input.html, report };
65
+ }
66
+ const globals = instrument(parsed.window, parsed.document, input.url, report);
67
+ const scripts = [...extractInlineScripts(input.html), ...(input.externalScripts ?? [])];
68
+ for (const body of scripts) {
69
+ try {
70
+ // eslint-disable-next-line no-new-func
71
+ new Function(...Object.keys(globals), body)(...Object.values(globals));
72
+ }
73
+ catch (error) {
74
+ report.errors.push(error instanceof Error ? error.message : "script error");
75
+ }
76
+ }
77
+ let rendered = input.html;
78
+ try {
79
+ rendered = parsed.document.toString();
80
+ }
81
+ catch {
82
+ /* keep raw html */
83
+ }
84
+ return { html: rendered, report };
85
+ }
86
+ // Install instrumented behavioral surfaces on the linkedom window AND return the
87
+ // matching bare globals (so `fetch(...)` and `window.fetch(...)` both record).
88
+ function instrument(window, document, url, report) {
89
+ const resolve = (value) => {
90
+ const raw = String(value ?? "");
91
+ try {
92
+ return url ? new URL(raw, url).toString() : raw;
93
+ }
94
+ catch {
95
+ return raw;
96
+ }
97
+ };
98
+ const pushNet = (kind, target) => report.network.push({ kind, url: resolve(target) });
99
+ const fetchStub = (input) => {
100
+ pushNet("fetch", typeof input === "object" && input ? input.url ?? input : input);
101
+ return Promise.resolve({ ok: true, status: 200, text: () => Promise.resolve(""), json: () => Promise.resolve({}), headers: { get: () => null } });
102
+ };
103
+ const XHRStub = function () {
104
+ this.open = (_method, target) => { this._url = target; };
105
+ this.send = () => { if (this._url)
106
+ pushNet("xhr", this._url); };
107
+ this.setRequestHeader = () => { };
108
+ this.addEventListener = () => { };
109
+ };
110
+ const beacon = (target) => { pushNet("beacon", target); return true; };
111
+ const recordEval = (code) => { report.evals.push(String(code)); return undefined; };
112
+ const FunctionStub = function (...args) { report.evals.push(String(args[args.length - 1] ?? "")); return function () { }; };
113
+ const safeAtob = (value) => {
114
+ let out;
115
+ try {
116
+ out = atob(String(value));
117
+ }
118
+ catch {
119
+ out = String(value);
120
+ }
121
+ report.decoded.push(out);
122
+ return out;
123
+ };
124
+ const safeBtoa = (value) => { try {
125
+ return btoa(String(value));
126
+ }
127
+ catch {
128
+ return String(value);
129
+ } };
130
+ // Expose the URL's real components — page JS routinely builds its redirect
131
+ // target from window.location.search / pathname / origin (a cloaking bouncer
132
+ // does `dest + location.search`). Missing them yields "undefined" in the URL
133
+ // and we'd follow the wrong destination.
134
+ let parsedLocation = null;
135
+ try {
136
+ parsedLocation = url ? new URL(url) : null;
137
+ }
138
+ catch {
139
+ parsedLocation = null;
140
+ }
141
+ const location = new Proxy({
142
+ href: url ?? "",
143
+ origin: parsedLocation?.origin ?? "",
144
+ protocol: parsedLocation?.protocol ?? "",
145
+ host: parsedLocation?.host ?? "",
146
+ hostname: parsedLocation?.hostname ?? "",
147
+ port: parsedLocation?.port ?? "",
148
+ pathname: parsedLocation?.pathname ?? "/",
149
+ search: parsedLocation?.search ?? "",
150
+ hash: parsedLocation?.hash ?? "",
151
+ assign: (u) => report.redirects.push(resolve(u)),
152
+ replace: (u) => report.redirects.push(resolve(u)),
153
+ reload: () => { },
154
+ toString: () => url ?? ""
155
+ }, { set: (target, prop, value) => { if (prop === "href")
156
+ report.redirects.push(resolve(value)); target[prop] = value; return true; } });
157
+ // Override the surfaces the page reaches via the window object.
158
+ try {
159
+ Object.defineProperty(window, "location", { value: location, configurable: true, writable: true });
160
+ }
161
+ catch { /* non-configurable */ }
162
+ try {
163
+ window.fetch = fetchStub;
164
+ }
165
+ catch { }
166
+ try {
167
+ window.XMLHttpRequest = XHRStub;
168
+ }
169
+ catch { }
170
+ try {
171
+ if (window.navigator)
172
+ window.navigator.sendBeacon = beacon;
173
+ }
174
+ catch { }
175
+ try {
176
+ Object.defineProperty(document, "cookie", { configurable: true, get: () => "", set: (v) => { report.cookies.push(String(v)); } });
177
+ }
178
+ catch { }
179
+ // document.write/writeln: linkedom doesn't implement them, yet phishing kits
180
+ // routinely inject their credential form this way. Materialize the markup into
181
+ // the real DOM so the rendered output (re-scanned by the static rules) contains
182
+ // the injected form/script — not just a string buried in a <script>.
183
+ const writeMarkup = (markup) => {
184
+ const target = document.body ?? document.documentElement;
185
+ try {
186
+ target?.insertAdjacentHTML("beforeend", String(markup ?? ""));
187
+ }
188
+ catch { }
189
+ };
190
+ try {
191
+ document.write = writeMarkup;
192
+ }
193
+ catch { }
194
+ try {
195
+ document.writeln = (markup) => writeMarkup(String(markup ?? "") + "\n");
196
+ }
197
+ catch { }
198
+ const noop = () => { };
199
+ const timerRun = (fn) => { try {
200
+ if (typeof fn === "function")
201
+ fn();
202
+ }
203
+ catch { } return 0; };
204
+ return {
205
+ window,
206
+ document,
207
+ self: window,
208
+ globalThis: window,
209
+ top: window,
210
+ parent: window,
211
+ location,
212
+ fetch: fetchStub,
213
+ XMLHttpRequest: XHRStub,
214
+ navigator: window.navigator ?? { userAgent: "Mozilla/5.0", language: "en-US", platform: "Win32", sendBeacon: beacon },
215
+ screen: { width: 1920, height: 1080 },
216
+ history: { pushState: noop, replaceState: noop },
217
+ atob: safeAtob,
218
+ btoa: safeBtoa,
219
+ eval: recordEval,
220
+ Function: FunctionStub,
221
+ setTimeout: timerRun,
222
+ setInterval: () => 0,
223
+ clearTimeout: noop,
224
+ clearInterval: noop,
225
+ requestAnimationFrame: timerRun,
226
+ queueMicrotask: (fn) => { try {
227
+ fn();
228
+ }
229
+ catch { } },
230
+ console: { log: noop, warn: noop, error: noop, info: noop, debug: noop },
231
+ MutationObserver: function () { this.observe = noop; this.disconnect = noop; },
232
+ IntersectionObserver: function () { this.observe = noop; this.disconnect = noop; }
233
+ };
234
+ }
235
+ function defaultRun(scripts, globals) {
236
+ const names = Object.keys(globals);
237
+ const values = names.map((name) => globals[name]);
238
+ for (const body of scripts) {
239
+ try {
240
+ // eslint-disable-next-line no-new-func
241
+ new Function(...names, body)(...values);
242
+ }
243
+ catch {
244
+ /* malformed/strict-mode-conflicting script — skip, best effort */
245
+ }
246
+ }
247
+ }
248
+ //# sourceMappingURL=render.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"render.js","sourceRoot":"","sources":["../src/render.ts"],"names":[],"mappings":"AAAA,0EAA0E;AAC1E,8EAA8E;AAC9E,wEAAwE;AACxE,4EAA4E;AAC5E,gFAAgF;AAChF,iDAAiD;AACjD,EAAE;AACF,6EAA6E;AAC7E,gFAAgF;AAChF,6EAA6E;AAC7E,EAAE;AACF,gFAAgF;AAChF,kFAAkF;AAClF,iFAAiF;AACjF,kEAAkE;AAElE,OAAO,EAAE,SAAS,EAAE,MAAM,UAAU,CAAC;AACrC,OAAO,EAAE,oBAAoB,EAAE,oBAAoB,EAA4C,MAAM,cAAc,CAAC;AAEpH,MAAM,oBAAoB,GAAG,CAAC,CAAC;AAC/B,MAAM,gBAAgB,GAAG,GAAG,GAAG,IAAI,CAAC;AA4BpC,SAAS,WAAW;IAClB,OAAO,EAAE,SAAS,EAAE,EAAE,EAAE,OAAO,EAAE,EAAE,EAAE,MAAM,EAAE,EAAE,EAAE,KAAK,EAAE,EAAE,EAAE,OAAO,EAAE,EAAE,EAAE,OAAO,EAAE,EAAE,EAAE,MAAM,EAAE,EAAE,EAAE,CAAC;AACrG,CAAC;AAED,4EAA4E;AAC5E,gFAAgF;AAChF,sCAAsC;AACtC,MAAM,CAAC,KAAK,UAAU,aAAa,CAAC,IAAY,EAAE,UAAyB,EAAE;IAC3E,IAAI,eAAe,GAAa,EAAE,CAAC;IACnC,IAAI,OAAO,CAAC,WAAW,EAAE,CAAC;QACxB,MAAM,OAAO,GAAG,oBAAoB,CAAC,IAAI,CAAC,CAAC,KAAK,CAAC,CAAC,EAAE,OAAO,CAAC,kBAAkB,IAAI,oBAAoB,CAAC,CAAC;QACxG,eAAe,GAAG,CAChB,MAAM,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AC;YACP,kEAAkE;QACpE,CAAC;IACH,CAAC;AACH,CAAC"}
@@ -0,0 +1,4 @@
1
+ import type { PatternRule, RuleDefinition } from "../types.js";
2
+ export declare const binaryRules: Record<"elf_executable_magic" | "content_type_magic_mismatch" | "elf_writable_executable_stack", RuleDefinition>;
3
+ export declare const binaryStringRules: PatternRule[];
4
+ //# sourceMappingURL=binary.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"binary.d.ts","sourceRoot":"","sources":["../../../src/rules/packs/binary.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAE/D,eAAO,MAAM,WAAW,EAAE,MAAM,CAAC,sBAAsB,GAAG,6BAA6B,GAAG,+BAA+B,EAAE,cAAc,CA+BxI,CAAC;AAEF,eAAO,MAAM,iBAAiB,EAAE,WAAW,EAmE1C,CAAC"}
@@ -0,0 +1,101 @@
1
+ export const binaryRules = {
2
+ elf_executable_magic: {
3
+ id: "elf_executable_magic",
4
+ pack: "binary-static",
5
+ severity: "high",
6
+ confidence: "high",
7
+ title: "ELF executable",
8
+ description: "Content begins with ELF executable magic bytes.",
9
+ locationType: "binary",
10
+ score: { base: 55, tags: ["binary"] }
11
+ },
12
+ content_type_magic_mismatch: {
13
+ id: "content_type_magic_mismatch",
14
+ pack: "binary-static",
15
+ severity: "high",
16
+ confidence: "high",
17
+ title: "Content type does not match magic bytes",
18
+ description: "Declared content type conflicts with executable magic bytes.",
19
+ locationType: "binary",
20
+ score: { base: 45, tags: ["binary", "obfuscation"] }
21
+ },
22
+ elf_writable_executable_stack: {
23
+ id: "elf_writable_executable_stack",
24
+ pack: "binary-static",
25
+ severity: "high",
26
+ confidence: "medium",
27
+ title: "ELF requests writable executable stack",
28
+ description: "ELF program headers include a GNU_STACK segment with write and execute permissions.",
29
+ locationType: "binary",
30
+ score: { base: 32, tags: ["binary"] }
31
+ }
32
+ };
33
+ export const binaryStringRules = [
34
+ {
35
+ id: "iot_botnet_family_strings",
36
+ pack: "binary-static",
37
+ severity: "high",
38
+ confidence: "high",
39
+ title: "IoT botnet family strings",
40
+ description: "Binary strings reference IoT botnet family names or architecture payload naming.",
41
+ locationType: "binary",
42
+ pattern: /\b(?:Mozi|mirai|gafgyt|boatnet|Mozi\.[a-z0-9])\b/i,
43
+ score: { base: 70, tags: ["binary"] }
44
+ },
45
+ {
46
+ id: "iot_device_exploit_strings",
47
+ pack: "binary-static",
48
+ severity: "high",
49
+ confidence: "medium",
50
+ title: "IoT device exploit strings",
51
+ description: "Binary strings reference common router, camera, TR-064, HNAP, GPON, or Realtek exploitation paths.",
52
+ locationType: "binary",
53
+ pattern: /\b(?:gpon8080|gpon80|realtek|netgear8080|netgear80|huawei|tr064|hnap|camcrossweb|camjaws|dlink|vacron|setup\.cgi|SOAPAction:|AddPortMapping|SetNTPServers)\b/i,
54
+ score: { base: 42, tags: ["binary"] }
55
+ },
56
+ {
57
+ id: "iot_payload_dropper_commands",
58
+ pack: "binary-static",
59
+ severity: "high",
60
+ confidence: "high",
61
+ title: "IoT payload dropper commands",
62
+ description: "Binary strings contain wget/curl, chmod, temporary directory, and shell execution payload chains.",
63
+ locationType: "binary",
64
+ pattern: /(?:wget|curl|busybox wget)[\s\S]{0,160}(?:chmod|\/tmp|\/var\/tmp|\/dev\/shm)[\s\S]{0,160}(?:\/bin\/sh|sh\s|\.\/|Mozi\.)/i,
65
+ score: { base: 64, tags: ["binary", "source"] }
66
+ },
67
+ {
68
+ id: "router_management_hijack_commands",
69
+ pack: "binary-static",
70
+ severity: "high",
71
+ confidence: "high",
72
+ title: "Router management hijack commands",
73
+ description: "Binary strings contain TR-069 or router management-server hijack commands.",
74
+ locationType: "binary",
75
+ pattern: /(?:cfgtool|sendcmd)[\s\S]{0,240}(?:ManagementServer|MgtServer|Tr069Enable|ConnectionRequestPassword|acsMozi|127\.0\.0\.1)/i,
76
+ score: { base: 58, tags: ["binary"] }
77
+ },
78
+ {
79
+ id: "firewall_lockout_commands",
80
+ pack: "binary-static",
81
+ severity: "medium",
82
+ confidence: "high",
83
+ title: "Firewall lockout commands",
84
+ description: "Binary strings contain iptables rules that block management, TR-069, telnet, or SSH ports.",
85
+ locationType: "binary",
86
+ pattern: /iptables[\s\S]{0,120}(?:DROP|--dport|--sport|--destination-port|--source-port)[\s\S]{0,80}\b(?:22|23|2323|35000|50023|7547|58000)\b/i,
87
+ score: { base: 34, tags: ["binary"] }
88
+ },
89
+ {
90
+ id: "dht_cnc_protocol_strings",
91
+ pack: "binary-static",
92
+ severity: "medium",
93
+ confidence: "high",
94
+ title: "DHT/CNC protocol strings",
95
+ description: "Binary strings contain DHT peer protocol and command-and-control markers.",
96
+ locationType: "binary",
97
+ pattern: /(?:\[cnc\]|\[atk\]|\[ud\]|\[dip\]|1:q9:find_node|1:q9:get_peers|1:q13:announce_peer|info_hash20|nodes6)/i,
98
+ score: { base: 34, tags: ["binary"] }
99
+ }
100
+ ];
101
+ //# sourceMappingURL=binary.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"binary.js","sourceRoot":"","sources":["../../../src/rules/packs/binary.ts"],"names":[],"mappings":"AAEA,MAAM,CAAC,MAAM,WAAW,GAAqH;IAC3I,oBAAoB,EAAE;QACpB,EAAE,EAAE,sBAAsB;QAC1B,IAAI,EAAE,eAAe;QACrB,QAAQ,EAAE,MAAM;QAChB,UAAU,EAAE,MAAM;QAClB,KAAK,EAAE,gBAAgB;QACvB,WAAW,EAAE,iDAAiD;QAC9D,YAAY,EAAE,QAAQ;QACtB,KAAK,EAAE,EAAE,IAAI,EAAE,EAAE,EAAE,IAAI,EAAE,CAAC,QAAQ,CAAC,EAAE;KACtC;IACD,2BAA2B,EAAE;QAC3B,EAAE,EAAE,6BAA6B;QACjC,IAAI,EAAE,eAAe;QACrB,QAAQ,EAAE,MAAM;QAChB,UAAU,EAAE,MAAM;QAClB,KAAK,EAAE,yCAAyC;QAChD,WAAW,EAAE,8DAA8D;QAC3E,YAAY,EA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EAAE,QAAQ;QACtB,OAAO,EAAE,0HAA0H;QACnI,KAAK,EAAE,EAAE,IAAI,EAAE,EAAE,EAAE,IAAI,EAAE,CAAC,QAAQ,EAAE,QAAQ,CAAC,EAAE;KAChD;IACD;QACE,EAAE,EAAE,mCAAmC;QACvC,IAAI,EAAE,eAAe;QACrB,QAAQ,EAAE,MAAM;QAChB,UAAU,EAAE,MAAM;QAClB,KAAK,EAAE,mCAAmC;QAC1C,WAAW,EAAE,4EAA4E;QACzF,YAAY,EAAE,QAAQ;QACtB,OAAO,EAAE,4HAA4H;QACrI,KAAK,EAAE,EAAE,IAAI,EAAE,EAAE,EAAE,IAAI,EAAE,CAAC,QAAQ,CAAC,EAAE;KACtC;IACD;QACE,EAAE,EAAE,2BAA2B;QAC/B,IAAI,EAAE,eAAe;QACrB,QAAQ,EAAE,QAAQ;QAClB,UAAU,EAAE,MAAM;QAClB,KAAK,EAAE,2BAA2B;QAClC,WAAW,EAAE,4FAA4F;QACzG,YAAY,EAAE,QAAQ;QACtB,OAAO,EAAE,sIAAsI;QAC/I,KAAK,EAAE,EAAE,IAAI,EAAE,EAAE,EAAE,IAAI,EAAE,CAAC,QAAQ,CAAC,EAAE;KACtC;IACD;QACE,EAAE,EAAE,0BAA0B;QAC9B,IAAI,EAAE,eAAe;QACrB,QAAQ,EAAE,QAAQ;QAClB,UAAU,EAAE,MAAM;QAClB,KAAK,EAAE,0BAA0B;QACjC,WAAW,EAAE,2EAA2E;QACxF,YAAY,EAAE,QAAQ;QACtB,OAAO,EAAE,0GAA0G;QACnH,KAAK,EAAE,EAAE,IAAI,EAAE,EAAE,EAAE,IAAI,EAAE,CAAC,QAAQ,CAAC,EAAE;KACtC;CACF,CAAC"}
@@ -0,0 +1,3 @@
1
+ import type { RuleDefinition } from "../types.js";
2
+ export declare const cssRules: Record<"hidden_link_cluster" | "unicode_bidi_trick" | "css_imports_suspicious_domain" | "invisible_form_overlay", RuleDefinition>;
3
+ //# sourceMappingURL=css.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"css.d.ts","sourceRoot":"","sources":["../../../src/rules/packs/css.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAElD,eAAO,MAAM,QAAQ,EAAE,MAAM,CAAC,qBAAqB,GAAG,oBAAoB,GAAG,+BAA+B,GAAG,wBAAwB,EAAE,cAAc,CAyCtJ,CAAC"}
@@ -0,0 +1,43 @@
1
+ export const cssRules = {
2
+ hidden_link_cluster: {
3
+ id: "hidden_link_cluster",
4
+ pack: "seo-spam",
5
+ severity: "low",
6
+ confidence: "medium",
7
+ title: "Hidden CSS content",
8
+ description: "CSS contains hidden or offscreen content patterns.",
9
+ locationType: "css",
10
+ score: { base: 4, tags: ["seo"] }
11
+ },
12
+ unicode_bidi_trick: {
13
+ id: "unicode_bidi_trick",
14
+ pack: "obfuscation",
15
+ severity: "medium",
16
+ confidence: "high",
17
+ title: "Unicode bidi CSS trick",
18
+ description: "CSS uses bidi override, which can hide or reorder visible text.",
19
+ locationType: "css",
20
+ score: { base: 20, tags: ["obfuscation"] }
21
+ },
22
+ css_imports_suspicious_domain: {
23
+ id: "css_imports_suspicious_domain",
24
+ pack: "script-risk",
25
+ severity: "medium",
26
+ confidence: "medium",
27
+ title: "CSS imports off-site resource",
28
+ description: "CSS imports or loads an off-site URL.",
29
+ locationType: "url",
30
+ score: { base: 12, tags: ["script", "url"] }
31
+ },
32
+ invisible_form_overlay: {
33
+ id: "invisible_form_overlay",
34
+ pack: "phishing",
35
+ severity: "medium",
36
+ confidence: "medium",
37
+ title: "Invisible form overlay style",
38
+ description: "CSS contains fixed/absolute overlay and invisibility patterns that can hide or intercept form input.",
39
+ locationType: "css",
40
+ score: { base: 24, tags: ["credential", "phishing"] }
41
+ }
42
+ };
43
+ //# sourceMappingURL=css.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"css.js","sourceRoot":"","sources":["../../../src/rules/packs/css.ts"],"names":[],"mapp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F,CAAC"}
@@ -0,0 +1,3 @@
1
+ import type { RuleDefinition } from "../types.js";
2
+ export declare const decodedArtifactRules: Record<"large_base64_blob" | "javascript_hex_escapes" | "javascript_unicode_escapes" | "fromcharcode_decoded_string", RuleDefinition>;
3
+ //# sourceMappingURL=decoders.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"decoders.d.ts","sourceRoot":"","sources":["../../../src/rules/packs/decoders.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAElD,eAAO,MAAM,oBAAoB,EAAE,MAAM,CAAC,mBAAmB,GAAG,wBAAwB,GAAG,4BAA4B,GAAG,6BAA6B,EAAE,cAAc,CA4CtK,CAAC"}
@@ -0,0 +1,46 @@
1
+ export const decodedArtifactRules = {
2
+ large_base64_blob: {
3
+ id: "large_base64_blob",
4
+ pack: "obfuscation",
5
+ severity: "medium",
6
+ confidence: "medium",
7
+ title: "Decoded base64 artifact",
8
+ description: "Scanner decoded a base64 artifact and rescanned it.",
9
+ locationType: "decoded_artifact",
10
+ score: { base: 14, tags: ["decoded", "obfuscation"] }
11
+ },
12
+ javascript_hex_escapes: {
13
+ id: "javascript_hex_escapes",
14
+ pack: "obfuscation",
15
+ severity: "medium",
16
+ confidence: "medium",
17
+ title: "Decoded JavaScript hex escapes",
18
+ description: "Scanner decoded JavaScript hex escapes and rescanned the artifact.",
19
+ locationType: "decoded_artifact",
20
+ score: { base: 18, tags: ["decoded", "obfuscation"] }
21
+ },
22
+ javascript_unicode_escapes: {
23
+ id: "javascript_unicode_escapes",
24
+ pack: "obfuscation",
25
+ severity: "low",
26
+ confidence: "medium",
27
+ title: "Decoded JavaScript unicode escapes",
28
+ description: "Scanner decoded JavaScript unicode escapes and rescanned the artifact.",
29
+ locationType: "decoded_artifact",
30
+ // Unicode escapes are ubiquitous in legitimate minified/i18n JS. The mere
31
+ // presence is weak — the conviction comes from rescanning the DECODED
32
+ // artifact (whose own findings fire separately), not from this marker.
33
+ score: { base: 8, tags: ["decoded", "obfuscation"] }
34
+ },
35
+ fromcharcode_decoded_string: {
36
+ id: "fromcharcode_decoded_string",
37
+ pack: "obfuscation",
38
+ severity: "medium",
39
+ confidence: "medium",
40
+ title: "Decoded String.fromCharCode artifact",
41
+ description: "Scanner decoded a literal String.fromCharCode artifact and rescanned it.",
42
+ locationType: "decoded_artifact",
43
+ score: { base: 22, tags: ["decoded", "obfuscation"] }
44
+ }
45
+ };
46
+ //# sourceMappingURL=decoders.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"decoders.js","sourceRoot":"","sources":["../../../src/rules/packs/decoders.ts"],"names":[],"mappings":"AAEA,MAAM,CAAC,MAAM,oBAAoB,GAA0I;IACzK,iBAAiB,EAAE;QACjB,EAAE,EAAE,mBAAmB;QACvB,IAAI,EAAE,aAAa;QACnB,QAAQ,EAAE,QAAQ;QAClB,UAAU,EAAE,QAAQ;QACpB,KAAK,EAAE,yBAAyB;QAChC,WAAW,EAAE,qDAAqD;QAClE,YAAY,EAAE,kBAAkB;QAChC,KAAK,EAAE,EAAE,IAAI,EAAE,EAAE,EAAE,IAAI,EAAE,CAAC,SAAS,EAAE,aAAa,CAAC,EAAE;KACtD;IACD,sBAAsB,EAAE;QACtB,EAAE,EAAE,wBAAwB;QAC5B,IAAI,EAAE,aAAa;QACnB,QAAQ,EAAE,QAAQ;QAClB,UAAU,EAAE,QAAQ;QACpB,KAAK,EAAE,gCAAgC;QACvC,WAAW,EAAE,oEAAoE;QACjF,YAAY,EAAE,kBAAkB;QAChC,KAAK,EAAE,EAAE,IAAI,EAAE,EAAE,EAAE,IAAI,EAAE,CAAC,SAAS,EAAE,aAAa,CAAC,EAAE;KACtD;IACD,0BAA0B,EAAE;QAC1B,EAAE,EAAE,4BAA4B;QAChC,IAAI,EAAE,aAAa;QACnB,QAAQ,EAAE,KAAK;QACf,UAAU,EAAE,QAAQ;QACpB,KAAK,EAAE,oCAAoC;QAC3C,WAAW,EAAE,wEAAwE;QACrF,YAAY,EAAE,kBAAkB;QAChC,0EAA0E;QAC1E,sEAAsE;QACtE,uEAAuE;QACvE,KAAK,EAAE,EAAE,IAAI,EAAE,CAAC,EAAE,IAAI,EAAE,CAAC,SAAS,EAAE,aAAa,CAAC,EAAE;KACrD;IACD,2BAA2B,EAAE;QAC3B,EAAE,EAAE,6BAA6B;QACjC,IAAI,EAAE,aAAa;QACnB,QAAQ,EAAE,QAAQ;QAClB,UAAU,EAAE,QAAQ;QACpB,KAAK,EAAE,sCAAsC;QAC7C,WAAW,EAAE,0EAA0E;QACvF,YAAY,EAAE,kBAAkB;QAChC,KAAK,EAAE,EAAE,IAAI,EAAE,EAAE,EAAE,IAAI,EAAE,CAAC,SAAS,EAAE,aAAa,CAAC,EAAE;KACtD;CACF,CAAC"}
@@ -0,0 +1,4 @@
1
+ import type { RuleDefinition } from "../types.js";
2
+ export declare const htmlRules: Record<"external_script_from_unrelated_domain" | "mixed_content_script" | "hidden_iframe_off_origin" | "meta_refresh_external" | "password_form_without_https" | "credential_form_posts_off_origin" | "card_fields_plus_external_script" | "excessive_external_scripts_on_login_page" | "login_page_with_punycode_links" | "credential_ui_rendered_as_image" | "crypto_wallet_login_language" | "crypto_trading_landing_language" | "seo_trademark_stuffing" | "credential_form_on_suspicious_host" | "brand_impersonation_content", RuleDefinition>;
3
+ export declare const htmlTechnologyRules: Record<"legacy_jquery_reference" | "legacy_angularjs_reference" | "legacy_bootstrap_reference" | "legacy_lodash_reference" | "wordpress_surface_reference" | "drupal_surface_reference" | "phpmyadmin_surface_reference", RuleDefinition>;
4
+ //# sourceMappingURL=html.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"html.d.ts","sourceRoot":"","sources":["../../../src/rules/packs/html.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAElD,eAAO,MAAM,SAAS,EAAE,MAAM,CAC1B,uCAAuC,GACvC,sBAAsB,GACtB,0BAA0B,GAC1B,uBAAuB,GACvB,6BAA6B,GAC7B,kCAAkC,GAClC,kCAAkC,GAClC,0CAA0C,GAC1C,gCAAgC,GAChC,iCAAiC,GACjC,8BAA8B,GAC9B,iCAAiC,GACjC,wBAAwB,GACxB,oCAAoC,GACpC,6BAA6B,EAC/B,cAAc,CA0Jf,CAAC;AAEF,eAAO,MAAM,mBAAmB,EAAE,MAAM,CACpC,yBAAyB,GACzB,4BAA4B,GAC5B,4BAA4B,GAC5B,yBAAyB,GACzB,6BAA6B,GAC7B,0BAA0B,GAC1B,8BAA8B,EAChC,cAAc,CAwEf,CAAC"}