muaddib-scanner 1.0.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/.github/workflows/scan.yml +33 -0
- package/LICENSE +21 -0
- package/MUADDIBLOGO.png +0 -0
- package/README.md +218 -0
- package/action/action.yml +28 -0
- package/bin/muaddib.js +84 -0
- package/data/iocs.json +38 -0
- package/docs/threat-model.md +116 -0
- package/iocs/hashes.yaml +220 -0
- package/iocs/packages.yaml +265 -0
- package/package.json +43 -0
- package/results.sarif +379 -0
- package/src/index.js +142 -0
- package/src/ioc/feeds.js +42 -0
- package/src/ioc/updater.js +244 -0
- package/src/ioc/yaml-loader.js +96 -0
- package/src/report.js +152 -0
- package/src/response/playbooks.js +115 -0
- package/src/rules/index.js +197 -0
- package/src/sarif.js +74 -0
- package/src/scanner/ast.js +175 -0
- package/src/scanner/dataflow.js +167 -0
- package/src/scanner/dependencies.js +110 -0
- package/src/scanner/hash.js +68 -0
- package/src/scanner/obfuscation.js +99 -0
- package/src/scanner/package.js +60 -0
- package/src/scanner/shell.js +63 -0
- package/src/watch.js +37 -0
- package/test/samples/malicious.js +20 -0
- package/tests/run-tests.js +363 -0
- package/tests/samples/ast/malicious.js +20 -0
- package/tests/samples/clean/safe.js +14 -0
- package/tests/samples/dataflow/exfiltration.js +20 -0
- package/tests/samples/edge/empty/empty.js +0 -0
- package/tests/samples/edge/invalid-syntax/broken.js +5 -0
- package/tests/samples/edge/large-file/large.js +6 -0
- package/tests/samples/edge/non-js/readme.txt +3 -0
- package/tests/samples/markers/shai-hulud.js +10 -0
- package/tests/samples/obfuscation/obfuscated.js +1 -0
- package/tests/samples/package/package.json +9 -0
- package/tests/samples/shell/malicious.sh +13 -0
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
name: MUADDIB Security Scan
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
branches: [master, main]
|
|
6
|
+
pull_request:
|
|
7
|
+
branches: [master, main]
|
|
8
|
+
|
|
9
|
+
jobs:
|
|
10
|
+
scan:
|
|
11
|
+
runs-on: ubuntu-latest
|
|
12
|
+
permissions:
|
|
13
|
+
security-events: write
|
|
14
|
+
contents: read
|
|
15
|
+
steps:
|
|
16
|
+
- name: Checkout code
|
|
17
|
+
uses: actions/checkout@v4
|
|
18
|
+
|
|
19
|
+
- name: Setup Node.js
|
|
20
|
+
uses: actions/setup-node@v4
|
|
21
|
+
with:
|
|
22
|
+
node-version: '20'
|
|
23
|
+
|
|
24
|
+
- name: Install dependencies
|
|
25
|
+
run: npm install
|
|
26
|
+
|
|
27
|
+
- name: Run MUADDIB scan
|
|
28
|
+
run: node bin/muaddib.js scan . --sarif results.sarif || true
|
|
29
|
+
|
|
30
|
+
- name: Upload SARIF to GitHub Security
|
|
31
|
+
uses: github/codeql-action/upload-sarif@v3
|
|
32
|
+
with:
|
|
33
|
+
sarif_file: results.sarif
|
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 MUAD'DIB Contributors
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/MUADDIBLOGO.png
ADDED
|
Binary file
|
package/README.md
ADDED
|
@@ -0,0 +1,218 @@
|
|
|
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 & response for npm</strong>
|
|
9
|
+
</p>
|
|
10
|
+
|
|
11
|
+
<p align="center">
|
|
12
|
+
<img src="https://img.shields.io/badge/version-1.0.0-blue" alt="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-58%2B%20packages-red" alt="IOCs">
|
|
16
|
+
</p>
|
|
17
|
+
|
|
18
|
+
---
|
|
19
|
+
|
|
20
|
+
## Pourquoi MUAD'DIB ?
|
|
21
|
+
|
|
22
|
+
Les attaques supply chain npm explosent. Shai-Hulud a compromis 25K+ repos en 2025. Les outils existants detectent, mais n'aident pas a repondre.
|
|
23
|
+
|
|
24
|
+
MUAD'DIB detecte ET guide la reponse.
|
|
25
|
+
|
|
26
|
+
| Feature | MUAD'DIB | Socket | Snyk |
|
|
27
|
+
|---------|----------|--------|------|
|
|
28
|
+
| Detection IOCs | Oui | Oui | Oui |
|
|
29
|
+
| Analyse AST | Oui | Oui | Non |
|
|
30
|
+
| Analyse Dataflow | Oui | Non | Non |
|
|
31
|
+
| Playbooks reponse | Oui | Non | Non |
|
|
32
|
+
| SARIF / GitHub Security | Oui | Oui | Oui |
|
|
33
|
+
| MITRE ATT&CK mapping | Oui | Non | Non |
|
|
34
|
+
| 100% Open Source | Oui | Non | Non |
|
|
35
|
+
|
|
36
|
+
---
|
|
37
|
+
|
|
38
|
+
## Installation
|
|
39
|
+
```bash
|
|
40
|
+
git clone https://github.com/DNSZLSK/muad-dib.git
|
|
41
|
+
cd muad-dib
|
|
42
|
+
npm install
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
---
|
|
46
|
+
|
|
47
|
+
## Utilisation
|
|
48
|
+
|
|
49
|
+
### Scan basique
|
|
50
|
+
```bash
|
|
51
|
+
node bin/muaddib.js scan .
|
|
52
|
+
node bin/muaddib.js scan /chemin/vers/projet
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
### Mode explain (details complets)
|
|
56
|
+
```bash
|
|
57
|
+
node bin/muaddib.js scan . --explain
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
Affiche pour chaque detection :
|
|
61
|
+
- Rule ID
|
|
62
|
+
- MITRE ATT&CK technique
|
|
63
|
+
- References (articles, CVEs)
|
|
64
|
+
- Playbook de reponse
|
|
65
|
+
|
|
66
|
+
### Export JSON
|
|
67
|
+
```bash
|
|
68
|
+
node bin/muaddib.js scan . --json > results.json
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
### Rapport HTML
|
|
72
|
+
```bash
|
|
73
|
+
node bin/muaddib.js scan . --html rapport.html
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
### Rapport SARIF (GitHub Security)
|
|
77
|
+
```bash
|
|
78
|
+
node bin/muaddib.js scan . --sarif results.sarif
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
### Seuil de severite
|
|
82
|
+
```bash
|
|
83
|
+
node bin/muaddib.js scan . --fail-on critical # Fail seulement sur CRITICAL
|
|
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
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
### Surveillance temps reel
|
|
89
|
+
```bash
|
|
90
|
+
node bin/muaddib.js watch .
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
### Mise a jour des IOCs
|
|
94
|
+
```bash
|
|
95
|
+
node bin/muaddib.js update
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
---
|
|
99
|
+
|
|
100
|
+
## Detection
|
|
101
|
+
|
|
102
|
+
### Attaques detectees
|
|
103
|
+
|
|
104
|
+
| Campagne | Packages | Status |
|
|
105
|
+
|----------|----------|--------|
|
|
106
|
+
| Shai-Hulud v1 | @ctrl/tinycolor, ng2-file-upload | Detecte |
|
|
107
|
+
| Shai-Hulud v2 | @asyncapi/specs, posthog-node, kill-port | Detecte |
|
|
108
|
+
| Shai-Hulud v3 | @vietmoney/react-big-calendar | Detecte |
|
|
109
|
+
| event-stream (2018) | flatmap-stream, event-stream | Detecte |
|
|
110
|
+
| eslint-scope (2018) | eslint-scope | Detecte |
|
|
111
|
+
| Protestware | node-ipc, colors, faker | Detecte |
|
|
112
|
+
| Typosquats | crossenv, mongose, babelcli | Detecte |
|
|
113
|
+
|
|
114
|
+
### Techniques detectees
|
|
115
|
+
|
|
116
|
+
| Technique | MITRE | Detection |
|
|
117
|
+
|-----------|-------|-----------|
|
|
118
|
+
| Vol credentials (.npmrc, .ssh) | T1552.001 | AST |
|
|
119
|
+
| Exfiltration env vars | T1552.001 | AST |
|
|
120
|
+
| Execution code distant | T1105 | Pattern |
|
|
121
|
+
| Reverse shell | T1059.004 | Pattern |
|
|
122
|
+
| Dead man's switch | T1485 | Pattern |
|
|
123
|
+
| Code obfusque | T1027 | Heuristiques |
|
|
124
|
+
| Supply chain compromise | T1195.002 | IOC matching |
|
|
125
|
+
|
|
126
|
+
---
|
|
127
|
+
|
|
128
|
+
## Integration CI/CD
|
|
129
|
+
|
|
130
|
+
### GitHub Actions
|
|
131
|
+
```yaml
|
|
132
|
+
name: Security Scan
|
|
133
|
+
|
|
134
|
+
on: [push, pull_request]
|
|
135
|
+
|
|
136
|
+
jobs:
|
|
137
|
+
scan:
|
|
138
|
+
runs-on: ubuntu-latest
|
|
139
|
+
permissions:
|
|
140
|
+
security-events: write
|
|
141
|
+
contents: read
|
|
142
|
+
steps:
|
|
143
|
+
- uses: actions/checkout@v4
|
|
144
|
+
- uses: actions/setup-node@v4
|
|
145
|
+
with:
|
|
146
|
+
node-version: '20'
|
|
147
|
+
- run: npm install
|
|
148
|
+
- run: node bin/muaddib.js scan . --sarif results.sarif
|
|
149
|
+
- uses: github/codeql-action/upload-sarif@v3
|
|
150
|
+
with:
|
|
151
|
+
sarif_file: results.sarif
|
|
152
|
+
```
|
|
153
|
+
|
|
154
|
+
Les alertes apparaissent dans Security > Code scanning alerts.
|
|
155
|
+
|
|
156
|
+
---
|
|
157
|
+
|
|
158
|
+
## Architecture
|
|
159
|
+
```
|
|
160
|
+
MUAD'DIB Scanner
|
|
161
|
+
|
|
|
162
|
+
+-- IOC Match (YAML DB)
|
|
163
|
+
+-- AST Parse (acorn)
|
|
164
|
+
+-- Pattern Matching (shell, scripts)
|
|
165
|
+
|
|
|
166
|
+
v
|
|
167
|
+
Dataflow Analysis (credential read -> network send)
|
|
168
|
+
|
|
|
169
|
+
v
|
|
170
|
+
Threat Enrichment (rules, MITRE ATT&CK, playbooks)
|
|
171
|
+
```
|
|
172
|
+
|
|
173
|
+
---
|
|
174
|
+
|
|
175
|
+
## Contribuer
|
|
176
|
+
|
|
177
|
+
### Ajouter des IOCs
|
|
178
|
+
|
|
179
|
+
Editez les fichiers YAML dans `iocs/` :
|
|
180
|
+
```yaml
|
|
181
|
+
- id: NEW-MALWARE-001
|
|
182
|
+
name: "malicious-package"
|
|
183
|
+
version: "*"
|
|
184
|
+
severity: critical
|
|
185
|
+
confidence: high
|
|
186
|
+
source: community
|
|
187
|
+
description: "Description de la menace"
|
|
188
|
+
references:
|
|
189
|
+
- https://example.com/article
|
|
190
|
+
mitre: T1195.002
|
|
191
|
+
```
|
|
192
|
+
|
|
193
|
+
### Developper
|
|
194
|
+
```bash
|
|
195
|
+
git clone https://github.com/DNSZLSK/muad-dib.git
|
|
196
|
+
cd muad-dib
|
|
197
|
+
npm install
|
|
198
|
+
node bin/muaddib.js scan test/samples --explain
|
|
199
|
+
```
|
|
200
|
+
|
|
201
|
+
---
|
|
202
|
+
|
|
203
|
+
## Documentation
|
|
204
|
+
|
|
205
|
+
- [Threat Model](docs/threat-model.md) - Ce que MUAD'DIB detecte et ne detecte pas
|
|
206
|
+
- [IOCs YAML](iocs/) - Base de donnees des menaces
|
|
207
|
+
|
|
208
|
+
---
|
|
209
|
+
|
|
210
|
+
## Licence
|
|
211
|
+
|
|
212
|
+
MIT
|
|
213
|
+
|
|
214
|
+
---
|
|
215
|
+
|
|
216
|
+
<p align="center">
|
|
217
|
+
<strong>The spice must flow. The worms must die.</strong>
|
|
218
|
+
</p>
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
name: 'MUADDIB Scanner'
|
|
2
|
+
description: 'Detection et reponse aux attaques supply chain npm'
|
|
3
|
+
author: 'MUADDIB Contributors'
|
|
4
|
+
|
|
5
|
+
inputs:
|
|
6
|
+
path:
|
|
7
|
+
description: 'Chemin du projet a scanner'
|
|
8
|
+
required: false
|
|
9
|
+
default: '.'
|
|
10
|
+
|
|
11
|
+
runs:
|
|
12
|
+
using: 'composite'
|
|
13
|
+
steps:
|
|
14
|
+
- name: Setup Node.js
|
|
15
|
+
uses: actions/setup-node@v4
|
|
16
|
+
with:
|
|
17
|
+
node-version: '20'
|
|
18
|
+
|
|
19
|
+
- name: Install MUADDIB
|
|
20
|
+
shell: bash
|
|
21
|
+
run: |
|
|
22
|
+
cd ${{ github.action_path }}
|
|
23
|
+
npm install
|
|
24
|
+
|
|
25
|
+
- name: Run MUADDIB scan
|
|
26
|
+
shell: bash
|
|
27
|
+
run: |
|
|
28
|
+
node ${{ github.action_path }}/bin/muaddib.js scan ${{ inputs.path }}
|
package/bin/muaddib.js
ADDED
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
const { run } = require('../src/index.js');
|
|
4
|
+
const { updateIOCs } = require('../src/ioc/updater.js');
|
|
5
|
+
const { watch } = require('../src/watch.js');
|
|
6
|
+
|
|
7
|
+
const args = process.argv.slice(2);
|
|
8
|
+
const command = args[0];
|
|
9
|
+
const options = args.slice(1);
|
|
10
|
+
|
|
11
|
+
let target = '.';
|
|
12
|
+
let jsonOutput = false;
|
|
13
|
+
let htmlOutput = null;
|
|
14
|
+
let sarifOutput = null;
|
|
15
|
+
let explainMode = false;
|
|
16
|
+
let failLevel = 'high'; // Par defaut, fail sur HIGH et CRITICAL
|
|
17
|
+
|
|
18
|
+
for (let i = 0; i < options.length; i++) {
|
|
19
|
+
if (options[i] === '--json') {
|
|
20
|
+
jsonOutput = true;
|
|
21
|
+
} else if (options[i] === '--html') {
|
|
22
|
+
htmlOutput = options[i + 1] || 'muaddib-report.html';
|
|
23
|
+
i++;
|
|
24
|
+
} else if (options[i] === '--sarif') {
|
|
25
|
+
sarifOutput = options[i + 1] || 'muaddib-results.sarif';
|
|
26
|
+
i++;
|
|
27
|
+
} else if (options[i] === '--explain') {
|
|
28
|
+
explainMode = true;
|
|
29
|
+
} else if (options[i] === '--fail-on') {
|
|
30
|
+
failLevel = options[i + 1] || 'high';
|
|
31
|
+
i++;
|
|
32
|
+
} else if (!options[i].startsWith('-')) {
|
|
33
|
+
target = options[i];
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
if (!command) {
|
|
38
|
+
console.log(`
|
|
39
|
+
MUAD'DIB - Chasseur de vers npm
|
|
40
|
+
|
|
41
|
+
Usage:
|
|
42
|
+
muaddib scan [path] [options] Analyse un projet
|
|
43
|
+
muaddib watch [path] Surveille un projet en temps reel
|
|
44
|
+
muaddib update Met a jour les IOCs
|
|
45
|
+
muaddib help Affiche l'aide
|
|
46
|
+
|
|
47
|
+
Options:
|
|
48
|
+
--json Sortie au format JSON
|
|
49
|
+
--html [file] Genere un rapport HTML
|
|
50
|
+
--sarif [file] Genere un rapport SARIF (GitHub Security)
|
|
51
|
+
--explain Affiche les details de chaque detection
|
|
52
|
+
--fail-on [level] Niveau de severite pour exit code (critical|high|medium|low)
|
|
53
|
+
Defaut: high (fail sur HIGH et CRITICAL)
|
|
54
|
+
`);
|
|
55
|
+
process.exit(0);
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
if (command === 'scan') {
|
|
59
|
+
run(target, {
|
|
60
|
+
json: jsonOutput,
|
|
61
|
+
html: htmlOutput,
|
|
62
|
+
sarif: sarifOutput,
|
|
63
|
+
explain: explainMode,
|
|
64
|
+
failLevel: failLevel
|
|
65
|
+
}).then(exitCode => {
|
|
66
|
+
process.exit(exitCode);
|
|
67
|
+
});
|
|
68
|
+
} else if (command === 'watch') {
|
|
69
|
+
watch(target);
|
|
70
|
+
} else if (command === 'update') {
|
|
71
|
+
updateIOCs().then(() => {
|
|
72
|
+
process.exit(0);
|
|
73
|
+
}).catch(err => {
|
|
74
|
+
console.error('[ERREUR]', err.message);
|
|
75
|
+
process.exit(1);
|
|
76
|
+
});
|
|
77
|
+
} else if (command === 'help') {
|
|
78
|
+
console.log('muaddib scan [path] [--json] [--html file] [--sarif file] [--explain] [--fail-on level]');
|
|
79
|
+
console.log('muaddib watch [path] - Surveille un projet en temps reel');
|
|
80
|
+
console.log('muaddib update - Met a jour les IOCs');
|
|
81
|
+
} else {
|
|
82
|
+
console.log(`Commande inconnue: ${command}`);
|
|
83
|
+
process.exit(1);
|
|
84
|
+
}
|
package/data/iocs.json
ADDED
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": "1.1.0",
|
|
3
|
+
"updated": "2026-01-01",
|
|
4
|
+
"description": "IOCs communautaires MUAD'DIB - Contribuez via PR",
|
|
5
|
+
"packages": [
|
|
6
|
+
{ "name": "ua-parser-js", "version": "0.7.29", "source": "community", "description": "Compromis octobre 2021 - crypto miner" },
|
|
7
|
+
{ "name": "coa", "version": "2.0.3", "source": "community", "description": "Compromis novembre 2021" },
|
|
8
|
+
{ "name": "coa", "version": "2.0.4", "source": "community", "description": "Compromis novembre 2021" },
|
|
9
|
+
{ "name": "rc", "version": "1.2.9", "source": "community", "description": "Compromis novembre 2021" },
|
|
10
|
+
{ "name": "rc", "version": "1.3.9", "source": "community", "description": "Compromis novembre 2021" },
|
|
11
|
+
{ "name": "left-pad", "version": "*", "source": "community", "description": "Incident 2016 - supply chain" },
|
|
12
|
+
{ "name": "lodash-merge", "version": "*", "source": "typosquat", "description": "Typosquat de lodash.merge" },
|
|
13
|
+
{ "name": "loadash", "version": "*", "source": "typosquat", "description": "Typosquat de lodash" },
|
|
14
|
+
{ "name": "electorn", "version": "*", "source": "typosquat", "description": "Typosquat de electron" },
|
|
15
|
+
{ "name": "discord.js-selfbot-v11", "version": "*", "source": "community", "description": "Token stealer Discord" },
|
|
16
|
+
{ "name": "discord-selfbot-tools", "version": "*", "source": "community", "description": "Token stealer Discord" },
|
|
17
|
+
{ "name": "discordsystem", "version": "*", "source": "community", "description": "Token stealer Discord" },
|
|
18
|
+
{ "name": "discord-lofy", "version": "*", "source": "community", "description": "Token stealer Discord" },
|
|
19
|
+
{ "name": "prerequests", "version": "*", "source": "typosquat", "description": "Typosquat de prerequests" },
|
|
20
|
+
{ "name": "requstes", "version": "*", "source": "typosquat", "description": "Typosquat de requests" }
|
|
21
|
+
],
|
|
22
|
+
"hashes": [
|
|
23
|
+
"8f3c4e2a1b5d6c7e9f0a1b2c3d4e5f6a7b8c9d0e1f2a3b4c5d6e7f8a9b0c1d2e",
|
|
24
|
+
"1a2b3c4d5e6f7a8b9c0d1e2f3a4b5c6d7e8f9a0b1c2d3e4f5a6b7c8d9e0f1a2b"
|
|
25
|
+
],
|
|
26
|
+
"files": [
|
|
27
|
+
"discord-webhook.js",
|
|
28
|
+
"token-grabber.js",
|
|
29
|
+
"stealer.js",
|
|
30
|
+
"inject.js"
|
|
31
|
+
],
|
|
32
|
+
"markers": [
|
|
33
|
+
"discord.com/api/webhooks",
|
|
34
|
+
"token grabber",
|
|
35
|
+
"crypto miner",
|
|
36
|
+
"xmrig"
|
|
37
|
+
]
|
|
38
|
+
}
|
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
# MUAD'DIB Threat Model
|
|
2
|
+
|
|
3
|
+
## Ce que MUAD'DIB detecte
|
|
4
|
+
|
|
5
|
+
### Attaques Supply Chain npm
|
|
6
|
+
|
|
7
|
+
| Technique | Detection | Confidence |
|
|
8
|
+
|-----------|-----------|------------|
|
|
9
|
+
| Packages malveillants connus | Hash SHA256 + nom | HIGH |
|
|
10
|
+
| Shai-Hulud v1/v2/v3 | Marqueurs + fichiers + comportements | HIGH |
|
|
11
|
+
| event-stream (2018) | Nom + version | HIGH |
|
|
12
|
+
| Typosquatting | Liste de packages connus | MEDIUM |
|
|
13
|
+
| Protestware (node-ipc, colors) | Nom + version | HIGH |
|
|
14
|
+
|
|
15
|
+
### Comportements malveillants
|
|
16
|
+
|
|
17
|
+
| Technique | Detection | Confidence |
|
|
18
|
+
|-----------|-----------|------------|
|
|
19
|
+
| Vol de credentials (.npmrc, .ssh) | Analyse AST | HIGH |
|
|
20
|
+
| Exfiltration via env vars (GITHUB_TOKEN) | Analyse AST | HIGH |
|
|
21
|
+
| Execution de code distant (curl \| sh) | Pattern matching | HIGH |
|
|
22
|
+
| Reverse shell | Pattern matching | HIGH |
|
|
23
|
+
| Dead man's switch (rm -rf $HOME) | Pattern matching | HIGH |
|
|
24
|
+
| Code obfusque | Heuristiques | MEDIUM |
|
|
25
|
+
|
|
26
|
+
### Flux de donnees suspects
|
|
27
|
+
|
|
28
|
+
| Technique | Detection | Confidence |
|
|
29
|
+
|-----------|-----------|------------|
|
|
30
|
+
| Lecture credential + envoi reseau | Analyse dataflow | HIGH |
|
|
31
|
+
| Acces process.env + fetch/request | Analyse dataflow | HIGH |
|
|
32
|
+
|
|
33
|
+
## Ce que MUAD'DIB NE detecte PAS
|
|
34
|
+
|
|
35
|
+
### Limitations connues
|
|
36
|
+
|
|
37
|
+
| Technique | Raison |
|
|
38
|
+
|-----------|--------|
|
|
39
|
+
| Malware polymorphe | Pas d'analyse dynamique |
|
|
40
|
+
| Obfuscation avancee | Heuristiques limitees |
|
|
41
|
+
| Zero-day (packages inconnus) | Base IOC reactive |
|
|
42
|
+
| Attaques via binaires natifs | Pas d'analyse binaire |
|
|
43
|
+
| Backdoors subtiles | Pas de review de code semantique |
|
|
44
|
+
| Time bombs (declenchement differe) | Pas d'analyse temporelle |
|
|
45
|
+
|
|
46
|
+
### Faux negatifs potentiels
|
|
47
|
+
|
|
48
|
+
- Code malveillant dans des fichiers non-JS (WASM, binaires)
|
|
49
|
+
- Exfiltration via DNS ou autres canaux couverts
|
|
50
|
+
- Malware qui detecte l'environnement d'analyse
|
|
51
|
+
- Attaques multi-etapes avec payload distant
|
|
52
|
+
|
|
53
|
+
## Hypotheses
|
|
54
|
+
|
|
55
|
+
1. **Le code source est disponible** — MUAD'DIB analyse le code, pas les binaires
|
|
56
|
+
2. **Les IOCs sont a jour** — La detection depend de la base IOC
|
|
57
|
+
3. **L'attaquant utilise des techniques connues** — Zero-days passent a travers
|
|
58
|
+
4. **Le scan est execute avant l'installation** — Apres `npm install`, c'est trop tard si preinstall a execute
|
|
59
|
+
|
|
60
|
+
## Architecture de detection
|
|
61
|
+
```
|
|
62
|
+
┌─────────────────────────────────────────────────────────────┐
|
|
63
|
+
│ MUAD'DIB Scanner │
|
|
64
|
+
├─────────────────────────────────────────────────────────────┤
|
|
65
|
+
│ ┌─────────────┐ ┌─────────────┐ ┌─────────────────────┐ │
|
|
66
|
+
│ │ IOC Match │ │ AST Parse │ │ Pattern Matching │ │
|
|
67
|
+
│ │ (hashes, │ │ (acorn) │ │ (shell, scripts) │ │
|
|
68
|
+
│ │ packages) │ │ │ │ │ │
|
|
69
|
+
│ └──────┬──────┘ └──────┬──────┘ └──────────┬──────────┘ │
|
|
70
|
+
│ │ │ │ │
|
|
71
|
+
│ v v v │
|
|
72
|
+
│ ┌─────────────────────────────────────────────────────────┐│
|
|
73
|
+
│ │ Dataflow Analysis ││
|
|
74
|
+
│ │ (credential read -> network send) ││
|
|
75
|
+
│ └─────────────────────────────────────────────────────────┘│
|
|
76
|
+
│ │ │ │ │
|
|
77
|
+
│ v v v │
|
|
78
|
+
│ ┌─────────────────────────────────────────────────────────┐│
|
|
79
|
+
│ │ Threat Enrichment ││
|
|
80
|
+
│ │ (rules, MITRE ATT&CK, playbooks) ││
|
|
81
|
+
│ └─────────────────────────────────────────────────────────┘│
|
|
82
|
+
└─────────────────────────────────────────────────────────────┘
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
## Mapping MITRE ATT&CK
|
|
86
|
+
|
|
87
|
+
| Technique | ID | Detection MUAD'DIB |
|
|
88
|
+
|-----------|----|--------------------|
|
|
89
|
+
| Credentials in Files | T1552.001 | AST analysis |
|
|
90
|
+
| Command and Scripting Interpreter | T1059 | Pattern matching |
|
|
91
|
+
| Supply Chain Compromise | T1195.002 | IOC matching |
|
|
92
|
+
| Obfuscated Files | T1027 | Heuristics |
|
|
93
|
+
| Exfiltration Over C2 Channel | T1041 | Dataflow analysis |
|
|
94
|
+
| Data Destruction | T1485 | Pattern matching |
|
|
95
|
+
| Ingress Tool Transfer | T1105 | Pattern matching |
|
|
96
|
+
|
|
97
|
+
## Recommandations
|
|
98
|
+
|
|
99
|
+
### Pour les utilisateurs
|
|
100
|
+
|
|
101
|
+
1. Executer `muaddib scan .` AVANT `npm install`
|
|
102
|
+
2. Mettre a jour les IOCs regulierement (`muaddib update`)
|
|
103
|
+
3. Utiliser le mode `--explain` pour comprendre les detections
|
|
104
|
+
4. Integrer dans CI/CD avec sortie SARIF
|
|
105
|
+
|
|
106
|
+
### Pour les equipes securite
|
|
107
|
+
|
|
108
|
+
1. Completer avec une analyse dynamique (sandbox)
|
|
109
|
+
2. Monitorer les nouveaux packages avant adoption
|
|
110
|
+
3. Utiliser `--sarif` pour integration SIEM
|
|
111
|
+
4. Contribuer des IOCs via PR sur le repo
|
|
112
|
+
|
|
113
|
+
## Contacts
|
|
114
|
+
|
|
115
|
+
- Repository: https://github.com/DNSZLSK/muad-dib
|
|
116
|
+
- Issues: https://github.com/DNSZLSK/muad-dib/issues
|