muaddib-scanner 1.0.5 → 1.0.6
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 +109 -22
- package/package.json +1 -1
- package/src/scanner/ast.js +1 -1
- package/src/scanner/dataflow.js +1 -1
- package/src/scanner/obfuscation.js +1 -1
package/README.md
CHANGED
|
@@ -9,10 +9,18 @@
|
|
|
9
9
|
</p>
|
|
10
10
|
|
|
11
11
|
<p align="center">
|
|
12
|
-
<img src="https://img.shields.io/
|
|
12
|
+
<img src="https://img.shields.io/npm/v/muaddib-scanner" alt="npm version">
|
|
13
|
+
<img src="https://img.shields.io/npm/dt/muaddib-scanner" alt="npm downloads">
|
|
13
14
|
<img src="https://img.shields.io/badge/license-MIT-green" alt="License">
|
|
14
15
|
<img src="https://img.shields.io/badge/node-%3E%3D18-brightgreen" alt="Node">
|
|
15
|
-
|
|
16
|
+
</p>
|
|
17
|
+
|
|
18
|
+
<p align="center">
|
|
19
|
+
<a href="#installation">Installation</a> |
|
|
20
|
+
<a href="#utilisation">Utilisation</a> |
|
|
21
|
+
<a href="#features">Features</a> |
|
|
22
|
+
<a href="#vs-code">VS Code</a> |
|
|
23
|
+
<a href="#discord">Discord</a>
|
|
16
24
|
</p>
|
|
17
25
|
|
|
18
26
|
---
|
|
@@ -28,14 +36,26 @@ MUAD'DIB detecte ET guide la reponse.
|
|
|
28
36
|
| Detection IOCs | Oui | Oui | Oui |
|
|
29
37
|
| Analyse AST | Oui | Oui | Non |
|
|
30
38
|
| Analyse Dataflow | Oui | Non | Non |
|
|
39
|
+
| Detection Typosquatting | Oui | Oui | Non |
|
|
31
40
|
| Playbooks reponse | Oui | Non | Non |
|
|
41
|
+
| Score de risque | Oui | Oui | Oui |
|
|
32
42
|
| SARIF / GitHub Security | Oui | Oui | Oui |
|
|
33
43
|
| MITRE ATT&CK mapping | Oui | Non | Non |
|
|
44
|
+
| Webhook Discord/Slack | Oui | Non | Non |
|
|
45
|
+
| Extension VS Code | Oui | Oui | Oui |
|
|
46
|
+
| Mode daemon | Oui | Non | Non |
|
|
34
47
|
| 100% Open Source | Oui | Non | Non |
|
|
35
48
|
|
|
36
49
|
---
|
|
37
50
|
|
|
38
51
|
## Installation
|
|
52
|
+
|
|
53
|
+
### npm (recommande)
|
|
54
|
+
```bash
|
|
55
|
+
npm install -g muaddib-scanner
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
### Depuis les sources
|
|
39
59
|
```bash
|
|
40
60
|
git clone https://github.com/DNSZLSK/muad-dib.git
|
|
41
61
|
cd muad-dib
|
|
@@ -48,13 +68,20 @@ npm install
|
|
|
48
68
|
|
|
49
69
|
### Scan basique
|
|
50
70
|
```bash
|
|
51
|
-
|
|
52
|
-
|
|
71
|
+
muaddib scan .
|
|
72
|
+
muaddib scan /chemin/vers/projet
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
### Score de risque
|
|
76
|
+
|
|
77
|
+
Chaque scan affiche un score de risque 0-100 :
|
|
78
|
+
```
|
|
79
|
+
[SCORE] 58/100 [███████████░░░░░░░░░] HIGH
|
|
53
80
|
```
|
|
54
81
|
|
|
55
82
|
### Mode explain (details complets)
|
|
56
83
|
```bash
|
|
57
|
-
|
|
84
|
+
muaddib scan . --explain
|
|
58
85
|
```
|
|
59
86
|
|
|
60
87
|
Affiche pour chaque detection :
|
|
@@ -63,41 +90,62 @@ Affiche pour chaque detection :
|
|
|
63
90
|
- References (articles, CVEs)
|
|
64
91
|
- Playbook de reponse
|
|
65
92
|
|
|
66
|
-
### Export
|
|
93
|
+
### Export
|
|
67
94
|
```bash
|
|
68
|
-
|
|
95
|
+
muaddib scan . --json > results.json # JSON
|
|
96
|
+
muaddib scan . --html rapport.html # HTML
|
|
97
|
+
muaddib scan . --sarif results.sarif # SARIF (GitHub Security)
|
|
69
98
|
```
|
|
70
99
|
|
|
71
|
-
###
|
|
100
|
+
### Seuil de severite
|
|
72
101
|
```bash
|
|
73
|
-
|
|
102
|
+
muaddib scan . --fail-on critical # Fail seulement sur CRITICAL
|
|
103
|
+
muaddib scan . --fail-on high # Fail sur HIGH et CRITICAL (defaut)
|
|
104
|
+
muaddib scan . --fail-on medium # Fail sur MEDIUM, HIGH, CRITICAL
|
|
74
105
|
```
|
|
75
106
|
|
|
76
|
-
###
|
|
107
|
+
### Webhook Discord/Slack
|
|
77
108
|
```bash
|
|
78
|
-
|
|
109
|
+
muaddib scan . --webhook "https://discord.com/api/webhooks/..."
|
|
79
110
|
```
|
|
80
111
|
|
|
81
|
-
|
|
112
|
+
Envoie une alerte avec le score et les menaces sur Discord ou Slack.
|
|
113
|
+
|
|
114
|
+
### Surveillance temps reel
|
|
82
115
|
```bash
|
|
83
|
-
|
|
84
|
-
node bin/muaddib.js scan . --fail-on high # Fail sur HIGH et CRITICAL (defaut)
|
|
85
|
-
node bin/muaddib.js scan . --fail-on medium # Fail sur MEDIUM, HIGH, CRITICAL
|
|
116
|
+
muaddib watch .
|
|
86
117
|
```
|
|
87
118
|
|
|
88
|
-
###
|
|
119
|
+
### Mode daemon
|
|
89
120
|
```bash
|
|
90
|
-
|
|
121
|
+
muaddib daemon
|
|
122
|
+
muaddib daemon --webhook "https://discord.com/api/webhooks/..."
|
|
91
123
|
```
|
|
92
124
|
|
|
125
|
+
Surveille automatiquement tous les `npm install` et scanne les nouveaux packages.
|
|
126
|
+
|
|
93
127
|
### Mise a jour des IOCs
|
|
94
128
|
```bash
|
|
95
|
-
|
|
129
|
+
muaddib update
|
|
96
130
|
```
|
|
97
131
|
|
|
98
132
|
---
|
|
99
133
|
|
|
100
|
-
##
|
|
134
|
+
## Features
|
|
135
|
+
|
|
136
|
+
### Detection typosquatting
|
|
137
|
+
|
|
138
|
+
MUAD'DIB detecte les packages dont le nom ressemble a un package populaire :
|
|
139
|
+
```
|
|
140
|
+
[HIGH] Package "lodahs" ressemble a "lodash" (swapped_chars). Possible typosquatting.
|
|
141
|
+
```
|
|
142
|
+
|
|
143
|
+
### Analyse dataflow
|
|
144
|
+
|
|
145
|
+
Detecte quand du code lit des credentials ET les envoie sur le reseau :
|
|
146
|
+
```
|
|
147
|
+
[CRITICAL] Flux suspect: lecture credentials (readFileSync, GITHUB_TOKEN) + envoi reseau (fetch)
|
|
148
|
+
```
|
|
101
149
|
|
|
102
150
|
### Attaques detectees
|
|
103
151
|
|
|
@@ -121,10 +169,36 @@ node bin/muaddib.js update
|
|
|
121
169
|
| Reverse shell | T1059.004 | Pattern |
|
|
122
170
|
| Dead man's switch | T1485 | Pattern |
|
|
123
171
|
| Code obfusque | T1027 | Heuristiques |
|
|
172
|
+
| Typosquatting | T1195.002 | Levenshtein |
|
|
124
173
|
| Supply chain compromise | T1195.002 | IOC matching |
|
|
125
174
|
|
|
126
175
|
---
|
|
127
176
|
|
|
177
|
+
## VS Code
|
|
178
|
+
|
|
179
|
+
L'extension VS Code scanne automatiquement vos projets npm.
|
|
180
|
+
|
|
181
|
+
### Installation
|
|
182
|
+
|
|
183
|
+
Le dossier `vscode-extension/` contient l'extension. Pour tester :
|
|
184
|
+
|
|
185
|
+
1. Ouvrir le dossier `vscode-extension` dans VS Code
|
|
186
|
+
2. Appuyer sur F5
|
|
187
|
+
3. Dans la nouvelle fenetre, ouvrir un projet npm
|
|
188
|
+
|
|
189
|
+
### Commandes
|
|
190
|
+
|
|
191
|
+
- `MUAD'DIB: Scan Project` - Scanner tout le projet
|
|
192
|
+
- `MUAD'DIB: Scan Current File` - Scanner le fichier actuel
|
|
193
|
+
|
|
194
|
+
### Configuration
|
|
195
|
+
|
|
196
|
+
- `muaddib.autoScan` - Scanner automatiquement a l'ouverture (defaut: true)
|
|
197
|
+
- `muaddib.webhookUrl` - URL webhook Discord/Slack
|
|
198
|
+
- `muaddib.failLevel` - Niveau d'alerte (critical/high/medium/low)
|
|
199
|
+
|
|
200
|
+
---
|
|
201
|
+
|
|
128
202
|
## Integration CI/CD
|
|
129
203
|
|
|
130
204
|
### GitHub Actions
|
|
@@ -144,8 +218,8 @@ jobs:
|
|
|
144
218
|
- uses: actions/setup-node@v4
|
|
145
219
|
with:
|
|
146
220
|
node-version: '20'
|
|
147
|
-
- run: npm install
|
|
148
|
-
- run:
|
|
221
|
+
- run: npm install -g muaddib-scanner
|
|
222
|
+
- run: muaddib scan . --sarif results.sarif
|
|
149
223
|
- uses: github/codeql-action/upload-sarif@v3
|
|
150
224
|
with:
|
|
151
225
|
sarif_file: results.sarif
|
|
@@ -155,6 +229,15 @@ Les alertes apparaissent dans Security > Code scanning alerts.
|
|
|
155
229
|
|
|
156
230
|
---
|
|
157
231
|
|
|
232
|
+
## Discord
|
|
233
|
+
|
|
234
|
+
Rejoignez le serveur Discord pour :
|
|
235
|
+
- Recevoir les alertes de scan
|
|
236
|
+
- Partager des IOCs
|
|
237
|
+
- Contribuer au projet
|
|
238
|
+
|
|
239
|
+
---
|
|
240
|
+
|
|
158
241
|
## Architecture
|
|
159
242
|
```
|
|
160
243
|
MUAD'DIB Scanner
|
|
@@ -162,12 +245,16 @@ MUAD'DIB Scanner
|
|
|
162
245
|
+-- IOC Match (YAML DB)
|
|
163
246
|
+-- AST Parse (acorn)
|
|
164
247
|
+-- Pattern Matching (shell, scripts)
|
|
248
|
+
+-- Typosquat Detection (Levenshtein)
|
|
165
249
|
|
|
|
166
250
|
v
|
|
167
251
|
Dataflow Analysis (credential read -> network send)
|
|
168
252
|
|
|
|
169
253
|
v
|
|
170
254
|
Threat Enrichment (rules, MITRE ATT&CK, playbooks)
|
|
255
|
+
|
|
|
256
|
+
v
|
|
257
|
+
Output (CLI, JSON, HTML, SARIF, Webhook)
|
|
171
258
|
```
|
|
172
259
|
|
|
173
260
|
---
|
|
@@ -195,7 +282,7 @@ Editez les fichiers YAML dans `iocs/` :
|
|
|
195
282
|
git clone https://github.com/DNSZLSK/muad-dib.git
|
|
196
283
|
cd muad-dib
|
|
197
284
|
npm install
|
|
198
|
-
|
|
285
|
+
npm test
|
|
199
286
|
```
|
|
200
287
|
|
|
201
288
|
---
|
package/package.json
CHANGED
package/src/scanner/ast.js
CHANGED
|
@@ -11,7 +11,7 @@ const EXCLUDED_FILES = [
|
|
|
11
11
|
'src/response/playbooks.js'
|
|
12
12
|
];
|
|
13
13
|
|
|
14
|
-
const EXCLUDED_DIRS = ['test', 'tests', 'node_modules', '.git', 'src'];
|
|
14
|
+
const EXCLUDED_DIRS = ['test', 'tests', 'node_modules', '.git', 'src', 'vscode-extension'];
|
|
15
15
|
|
|
16
16
|
const DANGEROUS_CALLS = [
|
|
17
17
|
'eval',
|
package/src/scanner/dataflow.js
CHANGED
|
@@ -3,7 +3,7 @@ const path = require('path');
|
|
|
3
3
|
const acorn = require('acorn');
|
|
4
4
|
const walk = require('acorn-walk');
|
|
5
5
|
|
|
6
|
-
const EXCLUDED_DIRS = ['test', 'tests', 'node_modules', '.git', 'src'];
|
|
6
|
+
const EXCLUDED_DIRS = ['test', 'tests', 'node_modules', '.git', 'src', 'vscode-extension'];
|
|
7
7
|
|
|
8
8
|
async function analyzeDataFlow(targetPath) {
|
|
9
9
|
const threats = [];
|
|
@@ -66,7 +66,7 @@ function detectObfuscation(targetPath) {
|
|
|
66
66
|
return threats;
|
|
67
67
|
}
|
|
68
68
|
|
|
69
|
-
const EXCLUDED_DIRS = ['test', 'tests', 'node_modules', '.git', 'src'];
|
|
69
|
+
const EXCLUDED_DIRS = ['test', 'tests', 'node_modules', '.git', 'src', 'vscode-extension'];
|
|
70
70
|
|
|
71
71
|
function findJsFiles(dir) {
|
|
72
72
|
const results = [];
|