supply-scan 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/LICENSE +21 -0
- package/README.md +148 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.js +1017 -0
- package/dist/index.js.map +1 -0
- package/package.json +64 -0
- package/rules/axios-2026.json +31 -0
- package/rules/chalk-debug-2025.json +40 -0
- package/rules/coa-rc-2021.json +25 -0
- package/rules/colors-faker-2022.json +20 -0
- package/rules/eslint-scope-2018.json +21 -0
- package/rules/event-stream-2018.json +22 -0
- package/rules/glassworm-2026.json +25 -0
- package/rules/lottie-player-2024.json +19 -0
- package/rules/node-ipc-2022.json +28 -0
- package/rules/shai-hulud-2025.json +25 -0
- package/rules/solana-web3-2024.json +20 -0
- package/rules/ua-parser-js-2021.json +24 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Asyraf Hussin
|
|
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/README.md
ADDED
|
@@ -0,0 +1,148 @@
|
|
|
1
|
+
# supply-scan
|
|
2
|
+
|
|
3
|
+
Universal npm supply chain attack scanner. Detects compromised packages from **12 known attacks** spanning 2018-2026. Zero runtime dependencies.
|
|
4
|
+
|
|
5
|
+
```bash
|
|
6
|
+
npx supply-scan
|
|
7
|
+
```
|
|
8
|
+
|
|
9
|
+
## What It Detects
|
|
10
|
+
|
|
11
|
+
| Attack | Date | Severity | Type |
|
|
12
|
+
|--------|------|----------|------|
|
|
13
|
+
| **Axios** (plain-crypto-js) | 2026-03 | Critical | RAT (North Korea) |
|
|
14
|
+
| **GlassWorm** (invisible Unicode) | 2026-03 | Critical | Stealer via Solana C2 |
|
|
15
|
+
| **Shai-Hulud 2.0** (npm worm) | 2025-11 | Critical | Self-replicating worm |
|
|
16
|
+
| **Chalk/Debug** (18 packages) | 2025-09 | Critical | Crypto wallet stealer |
|
|
17
|
+
| **@solana/web3.js** | 2024-12 | Critical | Private key stealer |
|
|
18
|
+
| **Lottie Player** | 2024-10 | High | Wallet drainer |
|
|
19
|
+
| **node-ipc** (peacenotwar) | 2022-03 | Critical | Geotargeted file wiper |
|
|
20
|
+
| **colors/faker** | 2022-01 | Medium | Sabotage / infinite loop |
|
|
21
|
+
| **coa/rc** (Danabot) | 2021-11 | Critical | Password stealer |
|
|
22
|
+
| **ua-parser-js** | 2021-10 | Critical | Cryptominer + stealer |
|
|
23
|
+
| **event-stream** (flatmap-stream) | 2018-11 | High | Bitcoin wallet stealer |
|
|
24
|
+
| **eslint-scope** | 2018-07 | High | npm token stealer |
|
|
25
|
+
|
|
26
|
+
## 5 Check Categories
|
|
27
|
+
|
|
28
|
+
1. **Compromised Packages** — Scans `node_modules` and lockfiles for known bad versions
|
|
29
|
+
2. **Malware Files** — Checks for RAT payloads, droppers, and artifacts on disk
|
|
30
|
+
3. **Network Connections** — Detects active connections to C2 servers
|
|
31
|
+
4. **Suspicious Processes** — Identifies running malware and persistence mechanisms
|
|
32
|
+
5. **NPM Cache** — Scans npm cache for malicious packages
|
|
33
|
+
|
|
34
|
+
## Usage
|
|
35
|
+
|
|
36
|
+
### Interactive Mode (default)
|
|
37
|
+
|
|
38
|
+
```bash
|
|
39
|
+
npx supply-scan
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
Prompts you to select which attacks to scan for and which directories to scan.
|
|
43
|
+
|
|
44
|
+
### Scan All Attacks
|
|
45
|
+
|
|
46
|
+
```bash
|
|
47
|
+
npx supply-scan --all
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
### Scan Specific Attacks
|
|
51
|
+
|
|
52
|
+
```bash
|
|
53
|
+
npx supply-scan --rule axios-2026
|
|
54
|
+
npx supply-scan --rule axios-2026 --rule chalk-debug-2025
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
### Scan Specific Directory
|
|
58
|
+
|
|
59
|
+
```bash
|
|
60
|
+
npx supply-scan --path ~/projects/my-app
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
### CI Mode
|
|
64
|
+
|
|
65
|
+
```bash
|
|
66
|
+
npx supply-scan --ci
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
Non-interactive, outputs "OK" on clean scan. Exit codes:
|
|
70
|
+
- `0` — All clear
|
|
71
|
+
- `1` — Compromise detected
|
|
72
|
+
- `2` — Warnings found
|
|
73
|
+
|
|
74
|
+
### List Available Rules
|
|
75
|
+
|
|
76
|
+
```bash
|
|
77
|
+
npx supply-scan --list
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
## Adding New Rules
|
|
81
|
+
|
|
82
|
+
Each attack is defined as a JSON file in the `rules/` directory. To add a new attack, create a new `.json` file:
|
|
83
|
+
|
|
84
|
+
```json
|
|
85
|
+
{
|
|
86
|
+
"id": "my-attack-2026",
|
|
87
|
+
"name": "My Attack Name",
|
|
88
|
+
"date": "2026-01-01",
|
|
89
|
+
"severity": "critical",
|
|
90
|
+
"description": "Description of the attack",
|
|
91
|
+
"references": ["https://example.com/advisory"],
|
|
92
|
+
"packages": {
|
|
93
|
+
"compromised": {
|
|
94
|
+
"package-name": ["1.0.0", "1.0.1"]
|
|
95
|
+
},
|
|
96
|
+
"malicious": {
|
|
97
|
+
"evil-package": ["0.1.0"]
|
|
98
|
+
}
|
|
99
|
+
},
|
|
100
|
+
"ioc": {
|
|
101
|
+
"files": {
|
|
102
|
+
"darwin": ["/path/to/malware"],
|
|
103
|
+
"linux": ["/tmp/malware"],
|
|
104
|
+
"win32": ["%TEMP%\\malware.exe"]
|
|
105
|
+
},
|
|
106
|
+
"domains": ["evil-c2.com"],
|
|
107
|
+
"ips": ["1.2.3.4"],
|
|
108
|
+
"ports": [8080],
|
|
109
|
+
"processes": ["malware-process"],
|
|
110
|
+
"strings": ["suspicious-string"]
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
```
|
|
114
|
+
|
|
115
|
+
No code changes needed — the scanner automatically picks up new rule files.
|
|
116
|
+
|
|
117
|
+
## Architecture
|
|
118
|
+
|
|
119
|
+
```
|
|
120
|
+
supply-scan/
|
|
121
|
+
├── bin/supply-scan.js # CLI entry point
|
|
122
|
+
├── src/ # TypeScript source
|
|
123
|
+
│ ├── index.ts # Main orchestrator + CLI
|
|
124
|
+
│ ├── scanner.ts # Scan engine
|
|
125
|
+
│ ├── ui.ts # Terminal UI (zero deps)
|
|
126
|
+
│ ├── utils.ts # Utilities
|
|
127
|
+
│ ├── types.ts # TypeScript interfaces
|
|
128
|
+
│ └── checks/
|
|
129
|
+
│ ├── packages.ts # Package/lockfile scanner
|
|
130
|
+
│ ├── files.ts # Malware file detector
|
|
131
|
+
│ ├── network.ts # C2 connection checker
|
|
132
|
+
│ ├── processes.ts # Process scanner
|
|
133
|
+
│ └── cache.ts # npm cache scanner
|
|
134
|
+
├── rules/ # Attack definitions (JSON)
|
|
135
|
+
└── dist/ # Compiled JavaScript
|
|
136
|
+
```
|
|
137
|
+
|
|
138
|
+
**Zero runtime dependencies.** This is a security scanner — we don't depend on packages that could themselves be compromised.
|
|
139
|
+
|
|
140
|
+
## Contributing
|
|
141
|
+
|
|
142
|
+
1. Fork the repository
|
|
143
|
+
2. Add a new rule JSON file in `rules/`
|
|
144
|
+
3. Submit a pull request with a reference link to the attack advisory
|
|
145
|
+
|
|
146
|
+
## License
|
|
147
|
+
|
|
148
|
+
MIT
|
package/dist/index.d.ts
ADDED