muaddib-scanner 1.0.21 → 1.1.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 CHANGED
@@ -1,350 +1,363 @@
1
- <p align="center">
2
- <img src="MUADDIBLOGO.png" alt="MUAD'DIB Logo" width="200">
3
- </p>
4
-
5
- <h1 align="center">MUAD'DIB</h1>
6
-
7
- <p align="center">
8
- <strong>Supply-chain threat detection and response for npm</strong>
9
- </p>
10
-
11
- <p align="center">
12
- <img src="https://img.shields.io/npm/v/muaddib-scanner" alt="npm version">
13
- <img src="https://img.shields.io/badge/license-MIT-green" alt="License">
14
- <img src="https://img.shields.io/badge/node-%3E%3D18-brightgreen" alt="Node">
15
- <img src="https://img.shields.io/badge/IOCs-930%2B-red" alt="IOCs">
16
- </p>
17
-
18
- <p align="center">
19
- <a href="#installation">Installation</a> |
20
- <a href="#usage">Usage</a> |
21
- <a href="#features">Features</a> |
22
- <a href="#vs-code">VS Code</a> |
23
- <a href="#ci-cd">CI/CD</a>
24
- </p>
25
-
26
- <p align="center">
27
- <a href="README.fr.md">Version francaise</a>
28
- </p>
29
-
30
- ---
31
-
32
- ## Why MUAD'DIB?
33
-
34
- npm supply-chain attacks are exploding. Shai-Hulud compromised 25K+ repos in 2025. Existing tools detect threats but don't help you respond.
35
-
36
- MUAD'DIB detects AND guides your response.
37
-
38
- | Feature | MUAD'DIB | Socket | Snyk | Opengrep |
39
- |---------|----------|--------|------|----------|
40
- | IOC Detection | Yes | Yes | Yes | No |
41
- | AST Analysis | Yes | Yes | Yes | Yes |
42
- | Dataflow Analysis | Yes | No | No | Yes |
43
- | Typosquatting Detection | Yes | Yes | Yes | No |
44
- | Response Playbooks | Yes | No | No | No |
45
- | Risk Score | Yes | Yes | Yes | No |
46
- | SARIF / GitHub Security | Yes | Yes | Yes | Yes |
47
- | MITRE ATT&CK Mapping | Yes | No | No | No |
48
- | Discord/Slack Webhooks | Yes | No | No | No |
49
- | VS Code Extension | Yes | Yes | Yes | No |
50
- | Paranoid Mode | Yes | No | No | No |
51
- | Daemon Mode | Yes | No | No | No |
52
- | 100% Open Source | Yes | No | No | Yes |
53
-
54
- ---
55
-
56
- ## Installation
57
-
58
- ### npm (recommended)
59
-
60
- ```bash
61
- npm install -g muaddib-scanner
62
- ```
63
-
64
- ### From source
65
-
66
- ```bash
67
- git clone https://github.com/music-muse/muad-dib.git
68
- cd muad-dib
69
- npm install
70
- npm link
71
- ```
72
-
73
- ---
74
-
75
- ## Usage
76
-
77
- ### Basic scan
78
-
79
- ```bash
80
- muaddib scan .
81
- muaddib scan /path/to/project
82
- ```
83
-
84
- ### Risk score
85
-
86
- Each scan displays a 0-100 risk score:
87
-
88
- ```
89
- [SCORE] 58/100 [***********---------] HIGH
90
- ```
91
-
92
- ### Explain mode (full details)
93
-
94
- ```bash
95
- muaddib scan . --explain
96
- ```
97
-
98
- Shows for each detection:
99
- - Rule ID
100
- - MITRE ATT&CK technique
101
- - References (articles, CVEs)
102
- - Response playbook
103
-
104
- ### Export
105
-
106
- ```bash
107
- muaddib scan . --json > results.json # JSON
108
- muaddib scan . --html report.html # HTML
109
- muaddib scan . --sarif results.sarif # SARIF (GitHub Security)
110
- ```
111
-
112
- ### Severity threshold
113
-
114
- ```bash
115
- muaddib scan . --fail-on critical # Fail only on CRITICAL
116
- muaddib scan . --fail-on high # Fail on HIGH and CRITICAL (default)
117
- muaddib scan . --fail-on medium # Fail on MEDIUM, HIGH, CRITICAL
118
- ```
119
-
120
- ### Paranoid mode
121
-
122
- ```bash
123
- muaddib scan . --paranoid
124
- ```
125
-
126
- Ultra-strict detection with lower tolerance. Useful for critical projects. Detects any network access, subprocess execution, dynamic code evaluation, and sensitive file access.
127
-
128
- ### Discord/Slack webhook
129
-
130
- ```bash
131
- muaddib scan . --webhook "https://discord.com/api/webhooks/..."
132
- ```
133
-
134
- Sends an alert with score and threats to Discord or Slack.
135
-
136
- ### Real-time monitoring
137
-
138
- ```bash
139
- muaddib watch .
140
- ```
141
-
142
- ### Daemon mode
143
-
144
- ```bash
145
- muaddib daemon
146
- muaddib daemon --webhook "https://discord.com/api/webhooks/..."
147
- ```
148
-
149
- Automatically monitors all `npm install` commands and scans new packages.
150
-
151
- ### Update IOCs
152
-
153
- ```bash
154
- muaddib update
155
- ```
156
-
157
- ### Scrape new IOCs
158
-
159
- ```bash
160
- muaddib scrape
161
- ```
162
-
163
- Fetches latest malicious packages from multiple threat intelligence sources:
164
- - Shai-Hulud 2.0 Detector (GitHub)
165
- - Datadog Security Labs
166
- - OSV.dev
167
- - Socket.dev reports
168
- - Phylum Research
169
- - AlienVault OTX
170
- - Aikido Intel
171
-
172
- ---
173
-
174
- ## Features
175
-
176
- ### Typosquatting detection
177
-
178
- MUAD'DIB detects packages with names similar to popular packages:
179
-
180
- ```
181
- [HIGH] Package "lodahs" looks like "lodash" (swapped_chars). Possible typosquatting.
182
- ```
183
-
184
- ### Dataflow analysis
185
-
186
- Detects when code reads credentials AND sends them over the network:
187
-
188
- ```
189
- [CRITICAL] Suspicious flow: credential read (readFileSync, GITHUB_TOKEN) + network send (fetch)
190
- ```
191
-
192
- ### Detected attacks
193
-
194
- | Campaign | Packages | Status |
195
- |----------|----------|--------|
196
- | Shai-Hulud v1 (Sept 2025) | @ctrl/tinycolor, ng2-file-upload | Detected |
197
- | Shai-Hulud v2 (Nov 2025) | @asyncapi/specs, posthog-node, kill-port | Detected |
198
- | Shai-Hulud v3 (Dec 2025) | @vietmoney/react-big-calendar | Detected |
199
- | event-stream (2018) | flatmap-stream, event-stream | Detected |
200
- | eslint-scope (2018) | eslint-scope | Detected |
201
- | Protestware | node-ipc, colors, faker | Detected |
202
- | Typosquats | crossenv, mongose, babelcli | Detected |
203
-
204
- ### Detected techniques
205
-
206
- | Technique | MITRE | Detection |
207
- |-----------|-------|-----------|
208
- | Credential theft (.npmrc, .ssh) | T1552.001 | AST |
209
- | Env var exfiltration | T1552.001 | AST |
210
- | Remote code execution | T1105 | Pattern |
211
- | Reverse shell | T1059.004 | Pattern |
212
- | Dead man's switch | T1485 | Pattern |
213
- | Obfuscated code | T1027 | Heuristics |
214
- | Typosquatting | T1195.002 | Levenshtein |
215
- | Supply chain compromise | T1195.002 | IOC matching |
216
-
217
- ---
218
-
219
- ## VS Code
220
-
221
- The VS Code extension automatically scans your npm projects.
222
-
223
- ### Installation
224
-
225
- Search "MUAD'DIB" in VS Code Extensions, or:
226
-
227
- ```bash
228
- ext install music-music.muaddib-security
229
- ```
230
-
231
- ### Commands
232
-
233
- - `MUAD'DIB: Scan Project` - Scan entire project
234
- - `MUAD'DIB: Scan Current File` - Scan current file
235
-
236
- ### Settings
237
-
238
- - `muaddib.autoScan` - Auto-scan on project open (default: true)
239
- - `muaddib.webhookUrl` - Discord/Slack webhook URL
240
- - `muaddib.failLevel` - Alert level (critical/high/medium/low)
241
-
242
- ---
243
-
244
- ## CI/CD
245
-
246
- ### GitHub Actions
247
-
248
- ```yaml
249
- name: Security Scan
250
-
251
- on: [push, pull_request]
252
-
253
- jobs:
254
- scan:
255
- runs-on: ubuntu-latest
256
- permissions:
257
- security-events: write
258
- contents: read
259
- steps:
260
- - uses: actions/checkout@v4
261
- - uses: actions/setup-node@v4
262
- with:
263
- node-version: '20'
264
- - run: npm install -g muaddib-scanner
265
- - run: muaddib scan . --sarif results.sarif
266
- - uses: github/codeql-action/upload-sarif@v3
267
- with:
268
- sarif_file: results.sarif
269
- ```
270
-
271
- Alerts appear in Security > Code scanning alerts.
272
-
273
- ---
274
-
275
- ## Architecture
276
-
277
- ```
278
- MUAD'DIB Scanner
279
- |
280
- +-- IOC Match (930+ packages, YAML/JSON DB)
281
- +-- AST Parse (acorn)
282
- +-- Pattern Matching (shell, scripts)
283
- +-- Typosquat Detection (Levenshtein)
284
- +-- Paranoid Mode (ultra-strict)
285
- |
286
- v
287
- Dataflow Analysis (credential read -> network send)
288
- |
289
- v
290
- Threat Enrichment (rules, MITRE ATT&CK, playbooks)
291
- |
292
- v
293
- Output (CLI, JSON, HTML, SARIF, Webhook)
294
- ```
295
-
296
- ---
297
-
298
- ## Contributing
299
-
300
- ### Add IOCs
301
-
302
- Edit YAML files in `iocs/`:
303
-
304
- ```yaml
305
- - id: NEW-MALWARE-001
306
- name: "malicious-package"
307
- version: "*"
308
- severity: critical
309
- confidence: high
310
- source: community
311
- description: "Threat description"
312
- references:
313
- - https://example.com/article
314
- mitre: T1195.002
315
- ```
316
-
317
- ### Development
318
-
319
- ```bash
320
- git clone https://github.com/music-muse/muad-dib.git
321
- cd muad-dib
322
- npm install
323
- npm test
324
- ```
325
-
326
- ---
327
-
328
- ## Community
329
-
330
- - Discord: https://discord.gg/y8zxSmue
331
- - Issues: https://github.com/music-muse/muad-dib/issues
332
-
333
- ---
334
-
335
- ## Documentation
336
-
337
- - [Threat Model](docs/threat-model.md) - What MUAD'DIB detects and doesn't detect
338
- - [IOCs YAML](iocs/) - Threat database
339
-
340
- ---
341
-
342
- ## License
343
-
344
- MIT
345
-
346
- ---
347
-
348
- <p align="center">
349
- <strong>The spice must flow. The worms must die.</strong>
350
- </p>
1
+ <p align="center">
2
+ <img src="MUADDIBLOGO.png" alt="MUAD'DIB Logo" width="200">
3
+ </p>
4
+
5
+ <h1 align="center">MUAD'DIB</h1>
6
+
7
+ <p align="center">
8
+ <strong>Supply-chain threat detection and response for npm</strong>
9
+ </p>
10
+
11
+ <p align="center">
12
+ <img src="https://img.shields.io/npm/v/muaddib-scanner" alt="npm version">
13
+ <img src="https://img.shields.io/badge/license-MIT-green" alt="License">
14
+ <img src="https://img.shields.io/badge/node-%3E%3D18-brightgreen" alt="Node">
15
+ <img src="https://img.shields.io/badge/IOCs-930%2B-red" alt="IOCs">
16
+ </p>
17
+
18
+ <p align="center">
19
+ <a href="#installation">Installation</a> |
20
+ <a href="#usage">Usage</a> |
21
+ <a href="#features">Features</a> |
22
+ <a href="#vs-code">VS Code</a> |
23
+ <a href="#ci-cd">CI/CD</a>
24
+ </p>
25
+
26
+ <p align="center">
27
+ <a href="README.fr.md">Version francaise</a>
28
+ </p>
29
+
30
+ ---
31
+
32
+ ## Why MUAD'DIB?
33
+
34
+ npm supply-chain attacks are exploding. Shai-Hulud compromised 25K+ repos in 2025. Existing tools detect threats but don't help you respond.
35
+
36
+ MUAD'DIB detects AND guides your response.
37
+
38
+ | Feature | MUAD'DIB | Socket | Snyk | Opengrep |
39
+ |---------|----------|--------|------|----------|
40
+ | IOC Detection | Yes | Yes | Yes | No |
41
+ | AST Analysis | Yes | Yes | Yes | Yes |
42
+ | Dataflow Analysis | Yes | No | No | Yes |
43
+ | Typosquatting Detection | Yes | Yes | Yes | No |
44
+ | Response Playbooks | Yes | No | No | No |
45
+ | Risk Score | Yes | Yes | Yes | No |
46
+ | SARIF / GitHub Security | Yes | Yes | Yes | Yes |
47
+ | MITRE ATT&CK Mapping | Yes | No | No | No |
48
+ | Discord/Slack Webhooks | Yes | No | No | No |
49
+ | VS Code Extension | Yes | Yes | Yes | No |
50
+ | Paranoid Mode | Yes | No | No | No |
51
+ | Daemon Mode | Yes | No | No | No |
52
+ | 100% Open Source | Yes | No | No | Yes |
53
+
54
+ ---
55
+
56
+ ## Installation
57
+
58
+ ### npm (recommended)
59
+
60
+ ```bash
61
+ npm install -g muaddib-scanner
62
+ ```
63
+
64
+ ### From source
65
+
66
+ ```bash
67
+ git clone https://github.com/DNSZLSK/muad-dib
68
+ cd muad-dib
69
+ npm install
70
+ npm link
71
+ ```
72
+
73
+ ---
74
+
75
+ ## Usage
76
+
77
+ ### Basic scan
78
+
79
+ ```bash
80
+ muaddib scan .
81
+ muaddib scan /path/to/project
82
+ ```
83
+ ### Interactive mode
84
+ ```bash
85
+ muaddib
86
+ ```
87
+
88
+ Launches an interactive menu to guide you through all features.
89
+
90
+ ### Safe install
91
+ ```bash
92
+ muaddib install <package>
93
+ muaddib install lodash axios --save-dev
94
+ muaddib i express -g
95
+ ```
96
+
97
+ Scans packages for threats BEFORE installing. Blocks known malicious packages.
98
+
99
+ ### Risk score
100
+
101
+ Each scan displays a 0-100 risk score:
102
+
103
+ ```
104
+ [SCORE] 58/100 [***********---------] HIGH
105
+ ```
106
+
107
+ ### Explain mode (full details)
108
+
109
+ ```bash
110
+ muaddib scan . --explain
111
+ ```
112
+
113
+ Shows for each detection:
114
+ - Rule ID
115
+ - MITRE ATT&CK technique
116
+ - References (articles, CVEs)
117
+ - Response playbook
118
+
119
+ ### Export
120
+
121
+ ```bash
122
+ muaddib scan . --json > results.json # JSON
123
+ muaddib scan . --html report.html # HTML
124
+ muaddib scan . --sarif results.sarif # SARIF (GitHub Security)
125
+ ```
126
+
127
+ ### Severity threshold
128
+
129
+ ```bash
130
+ muaddib scan . --fail-on critical # Fail only on CRITICAL
131
+ muaddib scan . --fail-on high # Fail on HIGH and CRITICAL (default)
132
+ muaddib scan . --fail-on medium # Fail on MEDIUM, HIGH, CRITICAL
133
+ ```
134
+
135
+ ### Paranoid mode
136
+
137
+ ```bash
138
+ muaddib scan . --paranoid
139
+ ```
140
+
141
+ Ultra-strict detection with lower tolerance. Useful for critical projects. Detects any network access, subprocess execution, dynamic code evaluation, and sensitive file access.
142
+
143
+ ### Discord/Slack webhook
144
+
145
+ ```bash
146
+ muaddib scan . --webhook "https://discord.com/api/webhooks/..."
147
+ ```
148
+
149
+ Sends an alert with score and threats to Discord or Slack.
150
+
151
+ ### Real-time monitoring
152
+
153
+ ```bash
154
+ muaddib watch .
155
+ ```
156
+
157
+ ### Daemon mode
158
+
159
+ ```bash
160
+ muaddib daemon
161
+ muaddib daemon --webhook "https://discord.com/api/webhooks/..."
162
+ ```
163
+
164
+ Automatically monitors all `npm install` commands and scans new packages.
165
+
166
+ ### Update IOCs
167
+
168
+ ```bash
169
+ muaddib update
170
+ ```
171
+
172
+ ### Scrape new IOCs
173
+
174
+ ```bash
175
+ muaddib scrape
176
+ ```
177
+
178
+ Fetches latest malicious packages from multiple threat intelligence sources:
179
+ - Shai-Hulud 2.0 Detector (GitHub)
180
+ - Datadog Security Labs
181
+ - OSV.dev
182
+ - Socket.dev reports
183
+ - Phylum Research
184
+ - AlienVault OTX
185
+ - Aikido Intel
186
+
187
+ ---
188
+
189
+ ## Features
190
+
191
+ ### Typosquatting detection
192
+
193
+ MUAD'DIB detects packages with names similar to popular packages:
194
+
195
+ ```
196
+ [HIGH] Package "lodahs" looks like "lodash" (swapped_chars). Possible typosquatting.
197
+ ```
198
+
199
+ ### Dataflow analysis
200
+
201
+ Detects when code reads credentials AND sends them over the network:
202
+
203
+ ```
204
+ [CRITICAL] Suspicious flow: credential read (readFileSync, GITHUB_TOKEN) + network send (fetch)
205
+ ```
206
+
207
+ ### Detected attacks
208
+
209
+ | Campaign | Packages | Status |
210
+ |----------|----------|--------|
211
+ | Shai-Hulud v1 (Sept 2025) | @ctrl/tinycolor, ng2-file-upload | Detected |
212
+ | Shai-Hulud v2 (Nov 2025) | @asyncapi/specs, posthog-node, kill-port | Detected |
213
+ | Shai-Hulud v3 (Dec 2025) | @vietmoney/react-big-calendar | Detected |
214
+ | event-stream (2018) | flatmap-stream, event-stream | Detected |
215
+ | eslint-scope (2018) | eslint-scope | Detected |
216
+ | Protestware | node-ipc, colors, faker | Detected |
217
+ | Typosquats | crossenv, mongose, babelcli | Detected |
218
+
219
+ ### Detected techniques
220
+
221
+ | Technique | MITRE | Detection |
222
+ |-----------|-------|-----------|
223
+ | Credential theft (.npmrc, .ssh) | T1552.001 | AST |
224
+ | Env var exfiltration | T1552.001 | AST |
225
+ | Remote code execution | T1105 | Pattern |
226
+ | Reverse shell | T1059.004 | Pattern |
227
+ | Dead man's switch | T1485 | Pattern |
228
+ | Obfuscated code | T1027 | Heuristics |
229
+ | Typosquatting | T1195.002 | Levenshtein |
230
+ | Supply chain compromise | T1195.002 | IOC matching |
231
+
232
+ ---
233
+
234
+ ## VS Code
235
+
236
+ The VS Code extension automatically scans your npm projects.
237
+
238
+ ### Installation
239
+
240
+ search "MUAD'DIB" in Extensions VS Code, or :
241
+ ```bash
242
+ marketplace.visualstudio.com/items?itemName=dnszlsk.muaddib-vscode
243
+ ```
244
+
245
+ ### Commands
246
+
247
+ - `MUAD'DIB: Scan Project` - Scan entire project
248
+ - `MUAD'DIB: Scan Current File` - Scan current file
249
+
250
+ ### Settings
251
+
252
+ - `muaddib.autoScan` - Auto-scan on project open (default: true)
253
+ - `muaddib.webhookUrl` - Discord/Slack webhook URL
254
+ - `muaddib.failLevel` - Alert level (critical/high/medium/low)
255
+
256
+ ---
257
+
258
+ ## CI/CD
259
+
260
+ ### GitHub Actions
261
+
262
+ ```yaml
263
+ name: Security Scan
264
+
265
+ on: [push, pull_request]
266
+
267
+ jobs:
268
+ scan:
269
+ runs-on: ubuntu-latest
270
+ permissions:
271
+ security-events: write
272
+ contents: read
273
+ steps:
274
+ - uses: actions/checkout@v4
275
+ - uses: actions/setup-node@v4
276
+ with:
277
+ node-version: '20'
278
+ - run: npm install -g muaddib-scanner
279
+ - run: muaddib scan . --sarif results.sarif
280
+ - uses: github/codeql-action/upload-sarif@v3
281
+ with:
282
+ sarif_file: results.sarif
283
+ ```
284
+
285
+ Alerts appear in Security > Code scanning alerts.
286
+
287
+ ---
288
+
289
+ ## Architecture
290
+
291
+ ```
292
+ MUAD'DIB Scanner
293
+ |
294
+ +-- IOC Match (930+ packages, YAML/JSON DB)
295
+ +-- AST Parse (acorn)
296
+ +-- Pattern Matching (shell, scripts)
297
+ +-- Typosquat Detection (Levenshtein)
298
+ +-- Paranoid Mode (ultra-strict)
299
+ |
300
+ v
301
+ Dataflow Analysis (credential read -> network send)
302
+ |
303
+ v
304
+ Threat Enrichment (rules, MITRE ATT&CK, playbooks)
305
+ |
306
+ v
307
+ Output (CLI, JSON, HTML, SARIF, Webhook)
308
+ ```
309
+
310
+ ---
311
+
312
+ ## Contributing
313
+
314
+ ### Add IOCs
315
+
316
+ Edit YAML files in `iocs/`:
317
+
318
+ ```yaml
319
+ - id: NEW-MALWARE-001
320
+ name: "malicious-package"
321
+ version: "*"
322
+ severity: critical
323
+ confidence: high
324
+ source: community
325
+ description: "Threat description"
326
+ references:
327
+ - https://example.com/article
328
+ mitre: T1195.002
329
+ ```
330
+
331
+ ### Development
332
+
333
+ ```bash
334
+ git clone https://github.com/DNSZLSK/muad-dib
335
+ cd muad-dib
336
+ npm install
337
+ npm test
338
+ ```
339
+
340
+ ---
341
+
342
+ ## Community
343
+
344
+ - Discord: https://discord.gg/y8zxSmue
345
+
346
+ ---
347
+
348
+ ## Documentation
349
+
350
+ - [Threat Model](docs/threat-model.md) - What MUAD'DIB detects and doesn't detect
351
+ - [IOCs YAML](iocs/) - Threat database
352
+
353
+ ---
354
+
355
+ ## License
356
+
357
+ MIT
358
+
359
+ ---
360
+
361
+ <p align="center">
362
+ <strong>The spice must flow. The worms must die.</strong>
363
+ </p>