muaddib-scanner 2.5.16 → 2.6.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/README.md +37 -20
- package/evaluate-output.json +20766 -0
- package/evaluate-text-output.txt +2799 -0
- package/evaluate-v2-output.json +19390 -0
- package/package.json +1 -1
- package/src/index.js +21 -3
- package/src/intent-graph.js +233 -0
- package/src/response/playbooks.js +9 -0
- package/src/rules/index.js +27 -2
- package/src/scanner/ast-detectors.js +96 -10
- package/src/scanner/dataflow.js +76 -2
- package/src/scanner/deobfuscate.js +46 -6
- package/src/scanner/obfuscation.js +4 -1
- package/src/scoring.js +25 -13
package/README.md
CHANGED
|
@@ -30,7 +30,7 @@
|
|
|
30
30
|
|
|
31
31
|
npm and PyPI supply-chain attacks are exploding. Shai-Hulud compromised 25K+ repos in 2025. Existing tools detect threats but don't help you respond.
|
|
32
32
|
|
|
33
|
-
MUAD'DIB combines static analysis + **deobfuscation engine** (v2.2.5) + **inter-module dataflow** (v2.2.6) + **per-file max scoring** (v2.2.11) + dynamic analysis (Docker sandbox with **monkey-patching preload** for time-bomb detection, v2.4.9) + **behavioral anomaly detection** (v2.0) + **ground truth validation** (v2.1) + **security audit** (41 issues remediated, v2.5.0–v2.5.6) to detect threats AND guide your response — even before they appear in any IOC database.
|
|
33
|
+
MUAD'DIB combines static analysis + **deobfuscation engine** (v2.2.5) + **inter-module dataflow** (v2.2.6) + **per-file max scoring** (v2.2.11) + dynamic analysis (Docker sandbox with **monkey-patching preload** for time-bomb detection, v2.4.9) + **behavioral anomaly detection** (v2.0) + **ground truth validation** (v2.1) + **security audit** (41 issues remediated, v2.5.0–v2.5.6) + **audit hardening** (v2.5.13–v2.5.14) + **FP reduction P5/P6** (v2.5.15–v2.5.16) to detect threats AND guide your response — even before they appear in any IOC database.
|
|
34
34
|
|
|
35
35
|
---
|
|
36
36
|
|
|
@@ -286,7 +286,7 @@ Add to `.pre-commit-config.yaml`:
|
|
|
286
286
|
```yaml
|
|
287
287
|
repos:
|
|
288
288
|
- repo: https://github.com/DNSZLSK/muad-dib
|
|
289
|
-
rev: v2.5.
|
|
289
|
+
rev: v2.5.17
|
|
290
290
|
hooks:
|
|
291
291
|
- id: muaddib-scan # Scan all threats
|
|
292
292
|
# - id: muaddib-diff # Or: only new threats
|
|
@@ -335,7 +335,7 @@ muaddib replay
|
|
|
335
335
|
muaddib ground-truth
|
|
336
336
|
```
|
|
337
337
|
|
|
338
|
-
Replay real-world supply-chain attacks against the scanner to validate detection coverage. Current results: **
|
|
338
|
+
Replay real-world supply-chain attacks against the scanner to validate detection coverage. Current results: **46/49 detected (93.9% TPR)** from 51 samples (49 active).
|
|
339
339
|
|
|
340
340
|
4 out-of-scope misses: lottie-player, polyfill-io, trojanized-jquery (browser-only DOM attacks), websocket-rat (FP-risky pattern).
|
|
341
341
|
|
|
@@ -642,7 +642,7 @@ Alerts appear in Security > Code scanning alerts.
|
|
|
642
642
|
## Architecture
|
|
643
643
|
|
|
644
644
|
```
|
|
645
|
-
MUAD'DIB 2.5.
|
|
645
|
+
MUAD'DIB 2.5.17 Scanner
|
|
646
646
|
|
|
|
647
647
|
+-- IOC Match (225,000+ packages, JSON DB)
|
|
648
648
|
| +-- OSV.dev npm dump (200K+ MAL-* entries)
|
|
@@ -664,7 +664,12 @@ MUAD'DIB 2.5.8 Scanner
|
|
|
664
664
|
| +-- 3-hop re-export chains, class method analysis
|
|
665
665
|
| +-- Cross-file credential read -> network sink detection
|
|
666
666
|
|
|
|
667
|
-
+--
|
|
667
|
+
+-- Intent Coherence Analysis (v2.6.0)
|
|
668
|
+
| +-- Intra-file source-sink pairing (credential read + eval/network in same file)
|
|
669
|
+
| +-- Cross-file detection delegated to module-graph (proven taint paths only)
|
|
670
|
+
| +-- LOW severity threats excluded (respects FP reductions)
|
|
671
|
+
|
|
|
672
|
+
+-- 14 Parallel Scanners (129 rules)
|
|
668
673
|
| +-- AST Parse (acorn) — eval/Function, credential CLI theft, binary droppers, prototype hooks
|
|
669
674
|
| +-- Pattern Matching (shell, scripts)
|
|
670
675
|
| +-- Obfuscation Detection (skip .min.js, ignore hex/unicode alone)
|
|
@@ -685,20 +690,22 @@ MUAD'DIB 2.5.8 Scanner
|
|
|
685
690
|
|
|
|
686
691
|
+-- Validation & Observability (v2.1)
|
|
687
692
|
| +-- Datadog 17K Benchmark (88.2% raw, ~100% JS/Node.js adjusted)
|
|
688
|
-
| +-- Ground Truth Dataset (51 real-world attacks,
|
|
693
|
+
| +-- Ground Truth Dataset (51 real-world attacks, 93.9% TPR)
|
|
689
694
|
| +-- Detection Time Logging (first_seen tracking, lead time metrics)
|
|
690
695
|
| +-- FP Rate Tracking (daily stats, false positive rate)
|
|
691
696
|
| +-- Score Breakdown (explainable per-rule scoring)
|
|
692
697
|
| +-- Threat Feed API (HTTP server, JSON feed for SIEM)
|
|
693
698
|
|
|
|
694
|
-
+-- FP Reduction Post-processing (v2.2.8-v2.
|
|
699
|
+
+-- FP Reduction Post-processing (v2.2.8-v2.3.1, v2.5.7-v2.5.8, v2.5.15-v2.5.16)
|
|
695
700
|
| +-- Count-based severity downgrade (dynamic_require, dataflow, module_compile, etc.)
|
|
696
701
|
| +-- Framework prototype scoring cap + HTTP client whitelist
|
|
697
|
-
| +-- Obfuscation in dist/build/.cjs/.mjs → LOW
|
|
698
|
-
| +-- Safe env var + prefix filtering
|
|
702
|
+
| +-- Obfuscation in dist/build/.cjs/.mjs/.js >100KB → LOW
|
|
703
|
+
| +-- Safe env var + prefix filtering + DATAFLOW_SAFE_ENV_VARS
|
|
699
704
|
| +-- Dataflow telemetry source categorization (os.platform/arch → telemetry_read)
|
|
700
705
|
| +-- DEP whitelist (es5-ext, bootstrap-sass) + npm alias skip
|
|
701
706
|
| +-- IOC wildcard audit (v2.5.8): FPR 10.8% → 6.0%
|
|
707
|
+
| +-- P5 heuristic precision (v2.5.15): 7 fixes
|
|
708
|
+
| +-- P6 compound detection precision (v2.5.16): 6 fixes
|
|
702
709
|
|
|
|
703
710
|
+-- Per-File Max Scoring (v2.2.11)
|
|
704
711
|
| +-- Score = max(file_scores) + package_level_score
|
|
@@ -714,6 +721,14 @@ MUAD'DIB 2.5.8 Scanner
|
|
|
714
721
|
| +-- 41 issues remediated (14 CRITICAL, 18 HIGH, 9 MEDIUM)
|
|
715
722
|
| +-- Native addon path traversal, atomic writes, AST bypasses
|
|
716
723
|
|
|
|
724
|
+
+-- Audit Hardening (v2.5.13-v2.5.14)
|
|
725
|
+
| +-- Scoring: plugin loader threshold, lifecycle CRITICAL floor, percentage guard 40%
|
|
726
|
+
| +-- AST: eval alias, globalThis indirect, require(obj.prop), variable reassignment
|
|
727
|
+
| +-- Dataflow: Promise .then() tainting, JSON taint propagation
|
|
728
|
+
| +-- Shell: mkfifo+nc, base64|bash, wget+base64 (3 new patterns)
|
|
729
|
+
| +-- Entropy: fragment cluster, windowed analysis
|
|
730
|
+
| +-- 8 new rules (SHELL-013 to 015, ENTROPY-004, +4 audit fixes)
|
|
731
|
+
|
|
|
717
732
|
+-- Paranoid Mode (ultra-strict)
|
|
718
733
|
+-- Docker Sandbox (behavioral analysis, network capture, canary tokens, CI-aware, preload)
|
|
719
734
|
+-- Zero-Day Monitor (internal: npm + PyPI RSS polling, Discord alerts, daily report)
|
|
@@ -735,9 +750,9 @@ Output (CLI, JSON, HTML, SARIF, Webhook, Threat Feed)
|
|
|
735
750
|
| Metric | Result | Details |
|
|
736
751
|
|--------|--------|---------|
|
|
737
752
|
| **Wild TPR** (Datadog 17K) | **88.2%** raw · **~100%** adjusted | 17,922 real malware samples. 2,077 misses are all out-of-scope (see below) |
|
|
738
|
-
| **TPR** (Ground Truth) | **
|
|
739
|
-
| **FPR** (Benign, global) | **
|
|
740
|
-
| **ADR** (Adversarial + Holdout) | **
|
|
753
|
+
| **TPR** (Ground Truth) | **93.9%** (46/49) | 51 real-world attacks (49 active). 3 out-of-scope: browser-only (3) |
|
|
754
|
+
| **FPR** (Benign, global) | **12.3%** (65/532) | 532 npm packages, real source code via `npm pack`, threshold > 20 |
|
|
755
|
+
| **ADR** (Adversarial + Holdout) | **97.3%** (73/75) | 53 adversarial + 40 holdout evasive samples (75 available on disk). 2 misses: `require-cache-poison` (P3 trade-off), `getter-defineProperty-exfil` |
|
|
741
756
|
|
|
742
757
|
**Datadog 17K benchmark** — [DataDog Malicious Software Packages Dataset](https://github.com/DataDog/malicious-software-packages-dataset), 17,922 real malware samples (npm). Raw TPR: 88.2% (15,810/17,922). The 2,077 misses (score=0) were manually categorized:
|
|
743
758
|
|
|
@@ -758,7 +773,9 @@ All 2,077 misses lack Node.js malware patterns. MUAD'DIB performs AST-based Node
|
|
|
758
773
|
| Large (50-100 JS files) | 40 | 10 | 25.0% |
|
|
759
774
|
| Very large (100+ JS files) | 62 | 25 | 40.3% |
|
|
760
775
|
|
|
761
|
-
**FPR progression**: 0% (invalid, empty dirs, v2.2.0-v2.2.6) → 38% (first real measurement, v2.2.7) → 19.4% (v2.2.8) → 17.5% (v2.2.9) → ~13% (v2.2.11, per-file max scoring) → 8.9% (v2.3.0, P2) → 7.4% (v2.3.1, P3) →
|
|
776
|
+
**FPR progression**: 0% (invalid, empty dirs, v2.2.0-v2.2.6) → 38% (first real measurement, v2.2.7) → 19.4% (v2.2.8) → 17.5% (v2.2.9) → ~13% (v2.2.11, per-file max scoring) → 8.9% (v2.3.0, P2) → 7.4% (v2.3.1, P3) → 6.0% (v2.5.8, P4 + IOC wildcard audit) → ~13.6% (v2.5.14, audit hardening added stricter detection) → **12.3%** (v2.5.16, P5 + P6) → **12.3%** (v2.6.0, intent graph v2 — zero FP added)
|
|
777
|
+
|
|
778
|
+
> **Note on FPR evolution:** The historic 6.0% FPR (v2.5.8) relied on a `BENIGN_PACKAGE_WHITELIST` that excluded certain known packages from scoring — a data leakage bias removed in v2.5.10. The current 12.3% FPR is an honest measurement without whitelisting, against 532 real benign packages. The intent graph (v2.6.0) adds zero false positives by using intra-file pairing only and excluding LOW-severity threats.
|
|
762
779
|
|
|
763
780
|
**Holdout progression** (pre-tuning scores, rules frozen):
|
|
764
781
|
|
|
@@ -771,12 +788,12 @@ All 2,077 misses lack Node.js malware patterns. MUAD'DIB performs AST-based Node
|
|
|
771
788
|
| v5 | 50% (5/10) | Inter-module dataflow (new scanner) |
|
|
772
789
|
|
|
773
790
|
- **Wild TPR** (Datadog Benchmark): detection rate on 17,922 real malware packages from the [DataDog Malicious Software Packages Dataset](https://github.com/DataDog/malicious-software-packages-dataset). Raw 88.2% (15,810/17,922). Adjusted ~100% on JS/Node.js malware when excluding out-of-scope samples (1,233 phishing HTML pages, 824 native binaries, 20 corrected libraries). See [Evaluation Methodology](docs/EVALUATION_METHODOLOGY.md#14-datadog-17k-benchmark).
|
|
774
|
-
- **TPR** (True Positive Rate): detection rate on 49 real-world supply-chain attacks (event-stream, ua-parser-js, coa, flatmap-stream, eslint-scope, solana-web3js, and 43 more).
|
|
791
|
+
- **TPR** (True Positive Rate): detection rate on 49 real-world supply-chain attacks (event-stream, ua-parser-js, coa, flatmap-stream, eslint-scope, solana-web3js, and 43 more). 3 misses are browser-only (lottie-player, polyfill-io, trojanized-jquery) — see [Threat Model](docs/threat-model.md).
|
|
775
792
|
- **FPR** (False Positive Rate): packages scoring > 20 out of 529 real npm packages (source code scanned, not empty dirs).
|
|
776
|
-
- **ADR** (Adversarial Detection Rate): detection rate on
|
|
793
|
+
- **ADR** (Adversarial Detection Rate): detection rate on 120 evasive malicious samples — 53 adversarial + 40 holdout (6 adversarial waves + 4 holdout batches). 75 available on disk. 2 misses on available samples: `require-cache-poison` (P3 trade-off), `getter-defineProperty-exfil`.
|
|
777
794
|
- **Holdout** (pre-tuning): detection rate on 10 unseen samples with rules frozen (measures generalization)
|
|
778
795
|
|
|
779
|
-
Datasets: 17,922 Datadog malware samples,
|
|
796
|
+
Datasets: 17,922 Datadog malware samples, 532 npm + 132 PyPI benign packages, 120 adversarial/holdout samples (75 available on disk), 51 ground-truth attacks (65 documented malware packages). **1905 tests**, 86% code coverage.
|
|
780
797
|
|
|
781
798
|
See [Evaluation Methodology](docs/EVALUATION_METHODOLOGY.md) for the full experimental protocol.
|
|
782
799
|
|
|
@@ -812,12 +829,12 @@ npm test
|
|
|
812
829
|
|
|
813
830
|
### Testing
|
|
814
831
|
|
|
815
|
-
- **
|
|
832
|
+
- **1905 unit/integration tests** across 44 modular test files - 86% code coverage via [Codecov](https://codecov.io/gh/DNSZLSK/muad-dib)
|
|
816
833
|
- **56 fuzz tests** - Malformed YAML, invalid JSON, binary files, ReDoS, unicode, 10MB inputs
|
|
817
834
|
- **Datadog 17K benchmark** - 17,922 real malware samples, 88.2% raw TPR, ~100% on JS/Node.js malware (2,077 out-of-scope misses: phishing, binaries, corrected libs)
|
|
818
|
-
- **
|
|
819
|
-
- **Ground truth validation** - 51 real-world attacks (
|
|
820
|
-
- **False positive validation** -
|
|
835
|
+
- **120 adversarial/holdout samples** - 53 adversarial + 40 holdout (75 available on disk), 73/75 detection rate (97.3% ADR). 2 misses: `require-cache-poison` (P3 trade-off), `getter-defineProperty-exfil`
|
|
836
|
+
- **Ground truth validation** - 51 real-world attacks (46/49 detected = 93.9% TPR). 3 out-of-scope: browser-only (lottie-player, polyfill-io, trojanized-jquery)
|
|
837
|
+
- **False positive validation** - 12.3% FPR global (65/532) on real npm source code via `npm pack`
|
|
821
838
|
- **ESLint security audit** - `eslint-plugin-security` with 14 rules enabled
|
|
822
839
|
|
|
823
840
|
---
|