@profullstack/threatcrush 0.16.0 → 0.17.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/dist/av-worker.js +318 -1
- package/dist/av-worker.js.map +1 -1
- package/dist/index.js +318 -1
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/av-worker.js
CHANGED
|
@@ -328,6 +328,34 @@ var RULES = [
|
|
|
328
328
|
return /(?:navigator\.clipboard\.writeText|document\.execCommand\(\s*["']copy)/.test(t) && /(?:powershell|mshta|cmd(?:\.exe)?\s*\/c|curl\s[^\n]{0,200}\|\s*(?:ba|z)?sh|osascript)/i.test(t) && /(?:Win(?:dows)?\s*(?:key\s*)?\+\s*R|Windows\s+key|Ctrl\s*\+\s*V|Cmd\s*\+\s*Space|verify\s+you\s+are\s+(?:a\s+)?human|I(?:'|')?m\s+not\s+a\s+robot)/i.test(t);
|
|
329
329
|
}
|
|
330
330
|
},
|
|
331
|
+
{
|
|
332
|
+
id: "CrushAV.Web.PhishKitExfil",
|
|
333
|
+
name: "Phishing page that sends passwords to a chat bot",
|
|
334
|
+
severity: "critical",
|
|
335
|
+
impact: "malicious",
|
|
336
|
+
description: "A login page that sends whatever you type, including your password, to a Telegram bot or a Discord webhook. Real sites never do this: it is how phishing kits deliver stolen credentials. Do not enter anything on this page.",
|
|
337
|
+
test: (c) => {
|
|
338
|
+
if (!(WEB_EXTS.has(c.ext) || c.ext === "js" || c.ext === "mjs" || c.ext === "php")) return false;
|
|
339
|
+
const t = c.text;
|
|
340
|
+
const exfil = /api\.telegram\.org\/bot[\w$`'"+{}.:-]{0,80}\/send(?:Message|Document)/i.test(t) || /discord(?:app)?\.com\/api\/webhooks\/\d{5,}\//i.test(t);
|
|
341
|
+
if (!exfil) return false;
|
|
342
|
+
return /<input\b[^>]*\btype\s*=\s*["']?password\b/i.test(t) || /(?:getElementById|querySelector|getElementsByName)\s*\(\s*["'`][#.]?[\w-]*(?:pass(?:word|wd|code)?|pwd|otp|pin)[\w-]*["'`]/i.test(t) || /\$_(?:POST|REQUEST)\s*\[\s*["'][\w-]*(?:pass(?:word|wd)?|pwd)[\w-]*["']\s*\]/i.test(t);
|
|
343
|
+
}
|
|
344
|
+
},
|
|
345
|
+
{
|
|
346
|
+
id: "CrushAV.Web.BrowserMiner",
|
|
347
|
+
name: "Web page that mines cryptocurrency in your browser",
|
|
348
|
+
severity: "high",
|
|
349
|
+
impact: "malicious",
|
|
350
|
+
description: "This page loads a cryptocurrency miner that runs in the visitor's browser and uses their CPU for someone else's profit, usually without asking. Close it.",
|
|
351
|
+
test: (c) => {
|
|
352
|
+
if (!(WEB_EXTS.has(c.ext) || c.ext === "js" || c.ext === "mjs")) return false;
|
|
353
|
+
const t = c.text;
|
|
354
|
+
const started = /\b(?:CoinHive|CoinImp|Client|CRLT|WMP|deepMiner|Minero)\.(?:Anonymous|User|Init)\s*\(\s*["'`][\w$]{8,}["'`][\s\S]{0,400}?\.start\s*\(/.test(t);
|
|
355
|
+
const poolScript = /<script\b[^>]*\bsrc\s*=\s*["']?(?:https?:)?\/\/(?:[\w-]+\.)*(?:coinhive\.com|coin-hive\.com|authedmine\.com|crypto-loot\.(?:com|org)|cryptoloot\.pro|webminepool\.com|coinimp\.com|www\.hostingcloud\.racing|minero\.cc|jsecoin\.com|monerominer\.rocks|webmine\.cz)\//i.test(t);
|
|
356
|
+
return started || poolScript;
|
|
357
|
+
}
|
|
358
|
+
},
|
|
331
359
|
{
|
|
332
360
|
id: "CrushAV.Web.HtmlSmuggling",
|
|
333
361
|
name: "Web page that builds a hidden download",
|
|
@@ -347,8 +375,62 @@ var RULES = [
|
|
|
347
375
|
impact: "suspicious",
|
|
348
376
|
description: 'This SVG "image" contains a script that redirects you or decodes hidden content. Phishing emails use SVG attachments like this to send you to fake login pages.',
|
|
349
377
|
test: (c) => c.ext === "svg" && /<script\b/i.test(c.text) && /(?:location(?:\.href)?\s*=|location\.replace\(|window\.open\(|atob\s*\()/.test(c.text)
|
|
378
|
+
},
|
|
379
|
+
{
|
|
380
|
+
// Seen 2026-11-22: "futures-trader", a Go Gate.io futures CLI (UPX, saved
|
|
381
|
+
// as .txt). `save-key` stores your API key locally AND, in a goroutine,
|
|
382
|
+
// runs `INSERT INTO api_keys (key_val, secret_val, exchange_name)` on the
|
|
383
|
+
// author's free public MySQL (mysql5.sqlpub.com) with the DSN in plain text.
|
|
384
|
+
id: "CrushAV.Stealer.SecretsToHardcodedDatabase",
|
|
385
|
+
name: "Sends your secrets to someone else's database",
|
|
386
|
+
severity: "critical",
|
|
387
|
+
impact: "malicious",
|
|
388
|
+
description: `This program carries the login for a remote database baked into it and writes API keys, passwords, tokens or wallet seeds into it. That is how fake trading bots and "tools" steal keys: whatever you give it ends up in the author's database. Delete it, and revoke any key or password you entered into it.`,
|
|
389
|
+
test: (c) => isStealerHost(c) && findRemoteDsn(allText(c)) !== null && SECRET_INSERT.test(allText(c))
|
|
390
|
+
},
|
|
391
|
+
{
|
|
392
|
+
id: "CrushAV.Stealer.ExchangeKeyHarvester",
|
|
393
|
+
name: "Crypto exchange tool that leaks your API key",
|
|
394
|
+
severity: "critical",
|
|
395
|
+
impact: "malicious",
|
|
396
|
+
description: "A crypto-exchange trading tool that also contains the password for someone's remote database. A real trading tool only talks to the exchange; one that also logs in to a private database is copying your exchange API key and secret there. Delete it, revoke the key on the exchange now and check for withdrawals.",
|
|
397
|
+
test: (c) => isStealerHost(c) && EXCHANGE_API.test(allText(c)) && findRemoteDsn(allText(c)) !== null
|
|
398
|
+
},
|
|
399
|
+
{
|
|
400
|
+
id: "CrushAV.Suspicious.FreePublicDatabase",
|
|
401
|
+
name: "Logs in to a free public database",
|
|
402
|
+
severity: "medium",
|
|
403
|
+
impact: "suspicious",
|
|
404
|
+
description: "This program has the password for a database on a free, anonymous hosting service built in. Real software almost never does this; data thieves use these services as a drop box. If you did not write it, do not give it any keys or passwords.",
|
|
405
|
+
test: (c) => {
|
|
406
|
+
if (!isStealerHost(c)) return false;
|
|
407
|
+
const dsn = findRemoteDsn(allText(c));
|
|
408
|
+
return dsn !== null && FREE_DB_HOSTS.test(dsn.host);
|
|
409
|
+
}
|
|
350
410
|
}
|
|
351
411
|
];
|
|
412
|
+
var isStealerHost = (c) => EXECUTABLE_KINDS.has(c.kind) || isScript(c) && !NON_RUNNABLE_SOURCE_EXTS.has(c.ext);
|
|
413
|
+
var EXCHANGE_API = /\b(?:api\.gateio\.ws|api\.gate\.io|(?:f|d)?api\.binance\.(?:com|us)|api\.bybit\.com|www\.okx\.com\/api|api\.mexc\.com|contract\.mexc\.com|api\.bitget\.com|api(?:-futures)?\.kucoin\.com|api\.kraken\.com|futures\.kraken\.com|api\.huobi\.pro|api\.htx\.com|api\.coinbase\.com|api\.exchange\.coinbase\.com|api\.bitfinex\.com|api\.hyperliquid\.xyz|api\.bingx\.com|open-api\.bingx\.com|api\.phemex\.com|api\.lbkex\.com|api\.bitmart\.com)\b/i;
|
|
414
|
+
var SECRET_INSERT = /\b(?:INSERT|REPLACE)\s+INTO\s+[`"[]?(?:\w+[`"\]]?\.)?[`"[]?\w*(?:api_?keys?|secrets?|passw\w*|credentials?|wallets?|seeds?|mnemonics?|tokens?|cookies?|private_?keys?)\w*[`"\]]?\s*\(|\b(?:INSERT|REPLACE)\s+INTO\s+[`"[]?\w+[`"\]]?\s*\([^)]{0,200}\b\w*(?:secret|passw|private_?key|seed|mnemonic|api_?key|access_?token|cookie)\w*\b[^)]{0,200}\)/i;
|
|
415
|
+
var FREE_DB_HOSTS = /(?:^|\.)(?:sqlpub\.com|db4free\.net|freesqldatabase\.com|freemysqlhosting\.net|remotemysql\.com|freedb\.tech|filess\.io)$/i;
|
|
416
|
+
var PLACEHOLDER_SECRET = /^(?:pass(?:word|wd)?|pwd|secret|changeme|example|xxx+|\*+|<[^>]*>|\{[^}]*\}|\$\{?\w+\}?|%[sv]|your_?\w*|user(?:name)?|root|test)$/i;
|
|
417
|
+
var LOCAL_HOST = /^(?:localhost|127\.\d+\.\d+\.\d+|0\.0\.0\.0|::1|host|hostname|db|database|mysql|postgres|redis|mongo|example\.(?:com|org|net)|[\w.-]*\.example\.(?:com|org|net)|[\w-]*\.local|[\w-]*\.internal|10\.\d+\.\d+\.\d+|192\.168\.\d+\.\d+|172\.(?:1[6-9]|2\d|3[01])\.\d+\.\d+)$/i;
|
|
418
|
+
function findRemoteDsn(t) {
|
|
419
|
+
const res = [
|
|
420
|
+
/([\w.-]{1,64}):([^\s@:/'"`()]{4,128})@tcp\(([a-z0-9.-]+)(?::\d{2,5})?\)\/[\w-]{0,64}/gi,
|
|
421
|
+
/(?:mysql|mariadb|postgres(?:ql)?|mongodb(?:\+srv)?|rediss?|mssql|sqlserver):\/\/([\w.%-]{1,64}):([^\s@/'"`]{4,128})@([a-z0-9.-]+)(?::\d{2,5})?(?:\/|\b)/gi,
|
|
422
|
+
/([\w.-]{1,64}):([^\s@:/'"`()]{4,128})@([a-z0-9-]+(?:\.[a-z0-9-]+)*\.[a-z]{2,24}):(?:3306|3307|3308|3309|3310|3311|5432|5433|6379|27017|1433)\/[\w-]{1,64}/gi
|
|
423
|
+
];
|
|
424
|
+
for (const re of res) {
|
|
425
|
+
for (const m of t.matchAll(re)) {
|
|
426
|
+
const [, user, pass, host] = m;
|
|
427
|
+
if (PLACEHOLDER_SECRET.test(pass)) continue;
|
|
428
|
+
if (LOCAL_HOST.test(host) || !/\.[a-z]{2,24}$|^\d+\.\d+\.\d+\.\d+$/i.test(host)) continue;
|
|
429
|
+
return { user, host: host.toLowerCase() };
|
|
430
|
+
}
|
|
431
|
+
}
|
|
432
|
+
return null;
|
|
433
|
+
}
|
|
352
434
|
function buildContext(name, bytes, kind, size) {
|
|
353
435
|
let text = "";
|
|
354
436
|
const NodeBuffer = globalThis.Buffer;
|
|
@@ -568,6 +650,219 @@ async function sha256Hex(bytes) {
|
|
|
568
650
|
}
|
|
569
651
|
var SHA256_RE = /^[0-9a-f]{64}$/;
|
|
570
652
|
|
|
653
|
+
// ../../packages/av/src/upx.ts
|
|
654
|
+
var UPX_MAX_OUTPUT = 64 * 1024 * 1024;
|
|
655
|
+
var MAGIC = [85, 80, 88, 33];
|
|
656
|
+
function methodName(id) {
|
|
657
|
+
if (id === 2 || id === 3 || id === 4) return "nrv2b";
|
|
658
|
+
if (id === 5 || id === 6 || id === 7) return "nrv2d";
|
|
659
|
+
if (id === 8 || id === 9 || id === 10) return "nrv2e";
|
|
660
|
+
if (id === 14) return "lzma";
|
|
661
|
+
return "unknown";
|
|
662
|
+
}
|
|
663
|
+
var le32 = (b, o) => (b[o] | b[o + 1] << 8 | b[o + 2] << 16 | b[o + 3] << 24) >>> 0;
|
|
664
|
+
function findUpxHeader(b) {
|
|
665
|
+
const windows = [
|
|
666
|
+
[0, Math.min(b.length, 8192)],
|
|
667
|
+
[Math.max(0, b.length - 8192), b.length]
|
|
668
|
+
];
|
|
669
|
+
for (const [from, to] of windows) {
|
|
670
|
+
for (let i = from; i + 32 <= to; i++) {
|
|
671
|
+
if (b[i] !== MAGIC[0] || b[i + 1] !== MAGIC[1] || b[i + 2] !== MAGIC[2] || b[i + 3] !== MAGIC[3]) continue;
|
|
672
|
+
const version = b[i + 4];
|
|
673
|
+
const format = b[i + 5];
|
|
674
|
+
const methodId = b[i + 6];
|
|
675
|
+
const level = b[i + 7];
|
|
676
|
+
if (version < 10 || version > 20 || level > 10 || format === 0) continue;
|
|
677
|
+
const uLen = le32(b, i + 16);
|
|
678
|
+
const cLen = le32(b, i + 20);
|
|
679
|
+
if (cLen === 0 || uLen === 0 || cLen >= uLen || uLen > 2147483647) continue;
|
|
680
|
+
return { headerOffset: i, version, format, method: methodName(methodId), methodId, level, uLen, cLen };
|
|
681
|
+
}
|
|
682
|
+
}
|
|
683
|
+
return null;
|
|
684
|
+
}
|
|
685
|
+
var Bits = class {
|
|
686
|
+
constructor(src, pos) {
|
|
687
|
+
this.src = src;
|
|
688
|
+
this.pos = pos;
|
|
689
|
+
}
|
|
690
|
+
src;
|
|
691
|
+
pos;
|
|
692
|
+
bb = 0;
|
|
693
|
+
bc = 0;
|
|
694
|
+
bit() {
|
|
695
|
+
if (this.bc > 0) return this.bb >>> --this.bc & 1;
|
|
696
|
+
if (this.pos + 4 > this.src.length) throw new RangeError("upx: input overrun");
|
|
697
|
+
this.bb = le32(this.src, this.pos);
|
|
698
|
+
this.pos += 4;
|
|
699
|
+
this.bc = 31;
|
|
700
|
+
return this.bb >>> 31 & 1;
|
|
701
|
+
}
|
|
702
|
+
byte() {
|
|
703
|
+
if (this.pos >= this.src.length) throw new RangeError("upx: input overrun");
|
|
704
|
+
return this.src[this.pos++];
|
|
705
|
+
}
|
|
706
|
+
};
|
|
707
|
+
function nrvDecompress(method, src, start, maxOut) {
|
|
708
|
+
const out = new Uint8Array(Math.min(maxOut, UPX_MAX_OUTPUT));
|
|
709
|
+
const r = new Bits(src, start);
|
|
710
|
+
let o = 0;
|
|
711
|
+
let lastOff = 1;
|
|
712
|
+
for (; ; ) {
|
|
713
|
+
while (r.bit()) {
|
|
714
|
+
if (o >= out.length) return out;
|
|
715
|
+
out[o++] = r.byte();
|
|
716
|
+
}
|
|
717
|
+
let off = 1;
|
|
718
|
+
let len;
|
|
719
|
+
if (method === "nrv2b") {
|
|
720
|
+
do {
|
|
721
|
+
off = off * 2 + r.bit();
|
|
722
|
+
if (off > 16777218) throw new RangeError("upx: bad offset");
|
|
723
|
+
} while (!r.bit());
|
|
724
|
+
if (off === 2) off = lastOff;
|
|
725
|
+
else {
|
|
726
|
+
off = (off - 3) * 256 + r.byte() >>> 0;
|
|
727
|
+
if (off === 4294967295) break;
|
|
728
|
+
lastOff = ++off;
|
|
729
|
+
}
|
|
730
|
+
len = r.bit();
|
|
731
|
+
len = len * 2 + r.bit();
|
|
732
|
+
if (len === 0) {
|
|
733
|
+
len = 1;
|
|
734
|
+
do {
|
|
735
|
+
len = len * 2 + r.bit();
|
|
736
|
+
if (len > out.length) throw new RangeError("upx: bad length");
|
|
737
|
+
} while (!r.bit());
|
|
738
|
+
len += 2;
|
|
739
|
+
}
|
|
740
|
+
len += off > 3328 ? 1 : 0;
|
|
741
|
+
} else {
|
|
742
|
+
for (; ; ) {
|
|
743
|
+
off = off * 2 + r.bit();
|
|
744
|
+
if (r.bit()) break;
|
|
745
|
+
off = (off - 1) * 2 + r.bit();
|
|
746
|
+
if (off > 16777218) throw new RangeError("upx: bad offset");
|
|
747
|
+
}
|
|
748
|
+
if (off === 2) {
|
|
749
|
+
off = lastOff;
|
|
750
|
+
len = r.bit();
|
|
751
|
+
} else {
|
|
752
|
+
off = (off - 3) * 256 + r.byte() >>> 0;
|
|
753
|
+
if (off === 4294967295) break;
|
|
754
|
+
len = (off ^ 4294967295) & 1;
|
|
755
|
+
off >>>= 1;
|
|
756
|
+
lastOff = ++off;
|
|
757
|
+
}
|
|
758
|
+
if (method === "nrv2d") {
|
|
759
|
+
len = len * 2 + r.bit();
|
|
760
|
+
if (len === 0) {
|
|
761
|
+
len = 1;
|
|
762
|
+
do {
|
|
763
|
+
len = len * 2 + r.bit();
|
|
764
|
+
if (len > out.length) throw new RangeError("upx: bad length");
|
|
765
|
+
} while (!r.bit());
|
|
766
|
+
len += 2;
|
|
767
|
+
}
|
|
768
|
+
} else if (len) {
|
|
769
|
+
len = 1 + r.bit();
|
|
770
|
+
} else if (r.bit()) {
|
|
771
|
+
len = 3 + r.bit();
|
|
772
|
+
} else {
|
|
773
|
+
len = 1;
|
|
774
|
+
do {
|
|
775
|
+
len = len * 2 + r.bit();
|
|
776
|
+
if (len > out.length) throw new RangeError("upx: bad length");
|
|
777
|
+
} while (!r.bit());
|
|
778
|
+
len += 3;
|
|
779
|
+
}
|
|
780
|
+
len += off > 1280 ? 1 : 0;
|
|
781
|
+
}
|
|
782
|
+
if (off > o) throw new RangeError("upx: back-reference before start");
|
|
783
|
+
const n = len + 1;
|
|
784
|
+
for (let k = 0; k < n; k++) {
|
|
785
|
+
if (o >= out.length) return out;
|
|
786
|
+
out[o] = out[o - off];
|
|
787
|
+
o++;
|
|
788
|
+
}
|
|
789
|
+
}
|
|
790
|
+
return out.subarray(0, o);
|
|
791
|
+
}
|
|
792
|
+
function candidateStarts(b, info) {
|
|
793
|
+
const starts2 = [info.headerOffset + 32];
|
|
794
|
+
if (b[0] === 77 && b[1] === 90 && b.length > 64) {
|
|
795
|
+
const pe = le32(b, 60);
|
|
796
|
+
if (pe + 24 < b.length && le32(b, pe) === 17744) {
|
|
797
|
+
const nSec = b[pe + 6] | b[pe + 7] << 8;
|
|
798
|
+
const optSize = b[pe + 20] | b[pe + 21] << 8;
|
|
799
|
+
const sec = pe + 24 + optSize;
|
|
800
|
+
for (let s = 0; s < nSec && s < 16; s++) {
|
|
801
|
+
const e = sec + s * 40;
|
|
802
|
+
if (e + 40 > b.length) break;
|
|
803
|
+
const rawSize = le32(b, e + 16);
|
|
804
|
+
const rawPtr = le32(b, e + 20);
|
|
805
|
+
if (rawSize >= info.cLen && rawPtr < b.length) starts2.push(rawPtr);
|
|
806
|
+
}
|
|
807
|
+
}
|
|
808
|
+
}
|
|
809
|
+
for (let i = 0; i + 12 <= b.length; i += 4) {
|
|
810
|
+
if (le32(b, i) === info.uLen && le32(b, i + 4) === info.cLen && b[i + 8] === info.methodId) starts2.push(i + 12);
|
|
811
|
+
}
|
|
812
|
+
return starts2;
|
|
813
|
+
}
|
|
814
|
+
function upxUnpack(b) {
|
|
815
|
+
const info = findUpxHeader(b);
|
|
816
|
+
if (!info) return null;
|
|
817
|
+
if (info.method !== "nrv2b" && info.method !== "nrv2d" && info.method !== "nrv2e") return { info, bytes: null };
|
|
818
|
+
if (info.uLen > UPX_MAX_OUTPUT) return { info, bytes: null };
|
|
819
|
+
for (const start of candidateStarts(b, info)) {
|
|
820
|
+
try {
|
|
821
|
+
const out = nrvDecompress(info.method, b, start, info.uLen);
|
|
822
|
+
if (out.length === info.uLen) return { info, bytes: out };
|
|
823
|
+
} catch {
|
|
824
|
+
}
|
|
825
|
+
}
|
|
826
|
+
const blocks = decodeBlockChain(b, info);
|
|
827
|
+
return { info, bytes: blocks };
|
|
828
|
+
}
|
|
829
|
+
function decodeBlockChain(b, info) {
|
|
830
|
+
const method = info.method;
|
|
831
|
+
const parts = [];
|
|
832
|
+
let total = 0;
|
|
833
|
+
for (let i = 0; i + 12 <= b.length; ) {
|
|
834
|
+
const unc = le32(b, i);
|
|
835
|
+
const cpr = le32(b, i + 4);
|
|
836
|
+
if (parts.length && cpr === unc && unc > 0 && unc <= info.uLen && i + 12 + cpr <= b.length && total + unc <= UPX_MAX_OUTPUT) {
|
|
837
|
+
parts.push(b.subarray(i + 12, i + 12 + cpr));
|
|
838
|
+
total += unc;
|
|
839
|
+
i += 12 + cpr;
|
|
840
|
+
continue;
|
|
841
|
+
}
|
|
842
|
+
if (b[i + 8] === info.methodId && b[i + 11] === 0 && cpr > 0 && cpr < unc && unc <= info.uLen && i + 12 + cpr <= b.length && total + unc <= UPX_MAX_OUTPUT) {
|
|
843
|
+
try {
|
|
844
|
+
const out = nrvDecompress(method, b, i + 12, unc);
|
|
845
|
+
if (out.length === unc) {
|
|
846
|
+
parts.push(out);
|
|
847
|
+
total += unc;
|
|
848
|
+
i += 12 + cpr;
|
|
849
|
+
continue;
|
|
850
|
+
}
|
|
851
|
+
} catch {
|
|
852
|
+
}
|
|
853
|
+
}
|
|
854
|
+
i++;
|
|
855
|
+
}
|
|
856
|
+
if (!total) return null;
|
|
857
|
+
const all = new Uint8Array(total);
|
|
858
|
+
let o = 0;
|
|
859
|
+
for (const p of parts) {
|
|
860
|
+
all.set(p, o);
|
|
861
|
+
o += p.length;
|
|
862
|
+
}
|
|
863
|
+
return all;
|
|
864
|
+
}
|
|
865
|
+
|
|
571
866
|
// ../../packages/av/src/engine.ts
|
|
572
867
|
var DEFAULT_HEURISTIC_BYTES = 16 * 1024 * 1024;
|
|
573
868
|
var SignatureSet = class {
|
|
@@ -631,11 +926,33 @@ async function scanBytes(input, opts = {}) {
|
|
|
631
926
|
description: known.startsWith("EICAR") ? "The harmless standard antivirus test file. Seeing this means the scanner works." : `This exact file is known malware (${known}). Quarantine or delete it.`
|
|
632
927
|
});
|
|
633
928
|
}
|
|
929
|
+
const rules = opts.rules ?? RULES;
|
|
634
930
|
const ctx = buildContext(input.name, input.bytes, kind, size);
|
|
635
|
-
for (const d of runRules(ctx,
|
|
931
|
+
for (const d of runRules(ctx, rules)) {
|
|
636
932
|
if (known && d.id === "CrushAV.Test.EICAR") continue;
|
|
637
933
|
detections.push(d);
|
|
638
934
|
}
|
|
935
|
+
if (EXECUTABLE_KINDS.has(kind)) {
|
|
936
|
+
const upx = upxUnpack(input.bytes);
|
|
937
|
+
if (upx) {
|
|
938
|
+
detections.push({
|
|
939
|
+
engine: "heuristic",
|
|
940
|
+
id: "CrushAV.Packer.UPX",
|
|
941
|
+
name: "Compressed with UPX",
|
|
942
|
+
severity: "info",
|
|
943
|
+
impact: "info",
|
|
944
|
+
description: upx.bytes ? `This program is compressed with UPX (${upx.info.method}). Some legitimate tools are; malware uses it to hide its contents. CrushAV unpacked it and scanned the inside too.` : `This program is compressed with UPX (${upx.info.method}) and CrushAV could not unpack it, so its contents were not inspected. Treat it with care if you do not know where it came from.`
|
|
945
|
+
});
|
|
946
|
+
if (upx.bytes) {
|
|
947
|
+
const seen = new Set(detections.map((d) => d.id));
|
|
948
|
+
const inner = buildContext(input.name, upx.bytes, kind, upx.bytes.length);
|
|
949
|
+
for (const d of runRules(inner, rules)) {
|
|
950
|
+
if (seen.has(d.id)) continue;
|
|
951
|
+
detections.push({ ...d, description: `${d.description} (Found inside the UPX-packed program.)` });
|
|
952
|
+
}
|
|
953
|
+
}
|
|
954
|
+
}
|
|
955
|
+
}
|
|
639
956
|
return {
|
|
640
957
|
path: input.name,
|
|
641
958
|
size,
|