claude-skill-antivirus 2.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 +353 -0
- package/README.zh-TW.md +346 -0
- package/examples/malicious-skill/SKILL.md +180 -0
- package/examples/safe-skill/SKILL.md +18 -0
- package/package.json +57 -0
- package/src/batch-scanner.js +399 -0
- package/src/i18n/en.js +1151 -0
- package/src/i18n/index.js +128 -0
- package/src/i18n/zh-TW.js +1151 -0
- package/src/index.js +178 -0
- package/src/scanner/dangerous-commands.js +313 -0
- package/src/scanner/data-exfiltration.js +472 -0
- package/src/scanner/dependency-scanner.js +380 -0
- package/src/scanner/external-connections.js +287 -0
- package/src/scanner/index.js +120 -0
- package/src/scanner/mcp-security.js +257 -0
- package/src/scanner/patterns.js +318 -0
- package/src/scanner/permissions.js +270 -0
- package/src/scanner/ssrf-scanner.js +343 -0
- package/src/scanner/subagent-scanner.js +315 -0
- package/src/utils/downloader.js +311 -0
- package/src/utils/installer.js +67 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Lucas
|
|
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,353 @@
|
|
|
1
|
+
# Claude Skill Antivirus
|
|
2
|
+
|
|
3
|
+
A security scanner and safe installer for Claude Code Skills. Detects malicious patterns, data exfiltration attempts, and dangerous operations before installing third-party skills.
|
|
4
|
+
|
|
5
|
+
[繁體中文說明](./README.zh-TW.md) | [SkillsMP Scan Report](./SCAN-REPORT.md)
|
|
6
|
+
|
|
7
|
+
## SkillsMP Platform Scan Results
|
|
8
|
+
|
|
9
|
+
We scanned all **71,577 skills** on SkillsMP:
|
|
10
|
+
|
|
11
|
+
| Risk Level | Count | Percentage |
|
|
12
|
+
|------------|-------|------------|
|
|
13
|
+
| CRITICAL | 91 | 0.13% |
|
|
14
|
+
| HIGH | 626 | 0.87% |
|
|
15
|
+
| MEDIUM | 1,310 | 1.83% |
|
|
16
|
+
| SAFE | **69,505** | **97.11%** |
|
|
17
|
+
|
|
18
|
+
**~3% of skills may have potential risks.** See [full report](./SCAN-REPORT.md) for details.
|
|
19
|
+
|
|
20
|
+
> **Note**: Some findings may be false positives (e.g., legitimate 1Password/Bitwarden integrations). Manual review is recommended for flagged skills.
|
|
21
|
+
|
|
22
|
+
## Features
|
|
23
|
+
|
|
24
|
+
- **9 Security Scanning Engines**:
|
|
25
|
+
- Dangerous Commands Scanner - Detects destructive shell commands
|
|
26
|
+
- Data Exfiltration Scanner - Identifies data theft patterns
|
|
27
|
+
- External Connections Scanner - Analyzes URLs and network calls
|
|
28
|
+
- Permission Scanner - Reviews tool permissions and access scope
|
|
29
|
+
- Pattern Scanner - Detects prompt injection and sensitive data
|
|
30
|
+
- MCP Security Scanner - Validates MCP server configurations
|
|
31
|
+
- SSRF Scanner - Identifies server-side request forgery patterns
|
|
32
|
+
- Dependency Scanner - Detects malicious packages and typosquatting
|
|
33
|
+
- Sub-agent Scanner - Detects Task tool abuse and agent chain attacks
|
|
34
|
+
|
|
35
|
+
- **Risk Assessment**: Critical, High, Medium, Low, and Info levels
|
|
36
|
+
- **Multilingual Support**: English and Traditional Chinese (繁體中文)
|
|
37
|
+
- **Install or Scan-Only Mode**: Review skills before installation
|
|
38
|
+
- **Interactive Prompts**: Guided decision-making for risky installations
|
|
39
|
+
|
|
40
|
+
## Installation
|
|
41
|
+
|
|
42
|
+
```bash
|
|
43
|
+
npm install -g claude-skill-antivirus
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
Or run directly with npx:
|
|
47
|
+
|
|
48
|
+
```bash
|
|
49
|
+
npx claude-skill-antivirus <skill-source>
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
## Usage
|
|
53
|
+
|
|
54
|
+
### Install a skill with security scanning
|
|
55
|
+
|
|
56
|
+
```bash
|
|
57
|
+
# Install to project level (./.claude/skills/) - default
|
|
58
|
+
skill-install ./path/to/skill
|
|
59
|
+
skill-install https://github.com/user/skill-repo
|
|
60
|
+
|
|
61
|
+
# Install to user level (~/.claude/skills/)
|
|
62
|
+
skill-install ./path/to/skill --global
|
|
63
|
+
skill-install @skillsmp/example-skill -g
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
**Installation paths:**
|
|
67
|
+
- Project level (default): `./.claude/skills/`
|
|
68
|
+
- User level (`--global`): `~/.claude/skills/`
|
|
69
|
+
|
|
70
|
+
### Scan only (without installing)
|
|
71
|
+
|
|
72
|
+
```bash
|
|
73
|
+
skill-install ./path/to/skill --scan-only
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
### Change language
|
|
77
|
+
|
|
78
|
+
```bash
|
|
79
|
+
# English (default)
|
|
80
|
+
skill-install ./path/to/skill --lang en
|
|
81
|
+
|
|
82
|
+
# Traditional Chinese
|
|
83
|
+
skill-install ./path/to/skill --lang zh-TW
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
### Alternative command
|
|
87
|
+
|
|
88
|
+
```bash
|
|
89
|
+
claude-skill-av ./path/to/skill --scan-only
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
### Batch scan all SkillsMP skills
|
|
93
|
+
|
|
94
|
+
```bash
|
|
95
|
+
# Scan all skills from SkillsMP (requires API key)
|
|
96
|
+
skill-batch-scan --api-key <your-api-key>
|
|
97
|
+
|
|
98
|
+
# Scan with options
|
|
99
|
+
skill-batch-scan --api-key <key> --max-pages 10 --verbose
|
|
100
|
+
skill-batch-scan --api-key <key> --output ./my-reports --lang zh-TW
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
Options:
|
|
104
|
+
- `-k, --api-key <key>` - SkillsMP API key (required)
|
|
105
|
+
- `-l, --limit <number>` - Skills per page (default: 100)
|
|
106
|
+
- `-p, --max-pages <number>` - Maximum pages to scan (default: all)
|
|
107
|
+
- `-o, --output <dir>` - Output directory for reports (default: ./scan-reports)
|
|
108
|
+
- `-v, --verbose` - Show verbose output
|
|
109
|
+
- `--lang <lang>` - Language (en, zh-TW)
|
|
110
|
+
|
|
111
|
+
## Scanning Engines
|
|
112
|
+
|
|
113
|
+
### 1. Dangerous Commands Scanner
|
|
114
|
+
|
|
115
|
+
Detects commands that can cause system damage:
|
|
116
|
+
|
|
117
|
+
| Risk Level | Detection Items |
|
|
118
|
+
|------------|-----------------|
|
|
119
|
+
| Critical | `rm -rf /`, `curl \| bash`, fork bombs |
|
|
120
|
+
| High | Reading `/etc/shadow`, reverse shells, credential theft |
|
|
121
|
+
| Medium | `rm -rf`, permission changes, service control |
|
|
122
|
+
| Low | `sudo`, global package installs |
|
|
123
|
+
|
|
124
|
+
### 2. Permission Scanner
|
|
125
|
+
|
|
126
|
+
Analyzes `allowed-tools` declarations:
|
|
127
|
+
|
|
128
|
+
- **Critical**: `Bash(*)` - Unrestricted shell access
|
|
129
|
+
- **High**: `Write`, `WebFetch`, broad bash permissions
|
|
130
|
+
- **Medium**: `Read`, `Glob`, `Grep`, version control tools
|
|
131
|
+
- **Dangerous Combinations**: e.g., `Read + WebFetch` = data exfiltration risk
|
|
132
|
+
|
|
133
|
+
### 3. External Connections Scanner
|
|
134
|
+
|
|
135
|
+
Identifies suspicious network activity:
|
|
136
|
+
|
|
137
|
+
- Direct IP URLs
|
|
138
|
+
- Webhook/data capture services
|
|
139
|
+
- Suspicious TLDs (.tk, .ml, etc.)
|
|
140
|
+
- Discord/Telegram webhooks
|
|
141
|
+
- URL shortening services
|
|
142
|
+
|
|
143
|
+
### 4. Pattern Scanner
|
|
144
|
+
|
|
145
|
+
Detects:
|
|
146
|
+
|
|
147
|
+
- Prompt injection attacks
|
|
148
|
+
- Hardcoded credentials/API keys
|
|
149
|
+
- Obfuscated code (base64, hex encoding)
|
|
150
|
+
- Social engineering language
|
|
151
|
+
|
|
152
|
+
### 5. Data Exfiltration Scanner
|
|
153
|
+
|
|
154
|
+
Specifically detects malicious behavior of reading local data and sending it externally:
|
|
155
|
+
|
|
156
|
+
| Category | Detection Items |
|
|
157
|
+
|----------|-----------------|
|
|
158
|
+
| Data Collection | Reading `.ssh`, `.aws`, `.env`, browser passwords, password managers |
|
|
159
|
+
| Data Exfiltration | `curl -d`, netcat transfers, DNS tunneling, email exfiltration |
|
|
160
|
+
| Combined Attacks | `cat \| base64 \| curl`, `tar \| nc`, `find -exec curl` |
|
|
161
|
+
| Env Variable Theft | `env \| curl`, `printenv` exfiltration |
|
|
162
|
+
| System Recon | `whoami`, `hostname`, network config exfiltration |
|
|
163
|
+
| Persistence | Modifying `.bashrc`, scheduled cron exfiltration |
|
|
164
|
+
|
|
165
|
+
### 6. MCP Security Scanner
|
|
166
|
+
|
|
167
|
+
Detects security risks in MCP Server configurations:
|
|
168
|
+
|
|
169
|
+
| Category | Detection Items |
|
|
170
|
+
|----------|-----------------|
|
|
171
|
+
| Untrusted Sources | Non-official MCP servers, direct URL execution |
|
|
172
|
+
| Dangerous Permissions | Unrestricted filesystem access, shell execution, database access |
|
|
173
|
+
| Sensitive Config | Environment variables with credentials, exposed config |
|
|
174
|
+
| Dangerous Combinations | Filesystem + Fetch, Shell + Network |
|
|
175
|
+
|
|
176
|
+
### 7. SSRF Scanner
|
|
177
|
+
|
|
178
|
+
Detects Server-Side Request Forgery and cloud attacks:
|
|
179
|
+
|
|
180
|
+
| Category | Detection Items |
|
|
181
|
+
|----------|-----------------|
|
|
182
|
+
| Cloud Metadata | AWS/GCP/Azure 169.254.169.254, IAM credential theft |
|
|
183
|
+
| Internal Network | 10.x.x.x, 192.168.x.x, 172.16-31.x.x probing |
|
|
184
|
+
| SSRF Bypass | Hex IP, URL encoding, file://, gopher:// |
|
|
185
|
+
| Kubernetes | API access, secrets theft, serviceaccount |
|
|
186
|
+
| Docker | docker.sock access, privileged containers, container escape |
|
|
187
|
+
|
|
188
|
+
### 8. Dependency Scanner
|
|
189
|
+
|
|
190
|
+
Detects malicious or vulnerable dependencies:
|
|
191
|
+
|
|
192
|
+
| Category | Detection Items |
|
|
193
|
+
|----------|-----------------|
|
|
194
|
+
| Known Malicious | event-stream, ua-parser-js, colors, faker |
|
|
195
|
+
| Typosquatting | crossenv, lodash-, mongose, reqeusts |
|
|
196
|
+
| Suspicious Install | URL installs, insecure registry, HTTP index |
|
|
197
|
+
| postinstall Risks | Install scripts with curl, wget, eval |
|
|
198
|
+
|
|
199
|
+
### 9. Sub-agent Scanner
|
|
200
|
+
|
|
201
|
+
Detects Task tool and sub-agent abuse:
|
|
202
|
+
|
|
203
|
+
| Category | Detection Items |
|
|
204
|
+
|----------|-----------------|
|
|
205
|
+
| Privilege Escalation | Task spawning Bash agent, requesting all permissions |
|
|
206
|
+
| Prompt Injection | Sub-agent prompts with malicious commands |
|
|
207
|
+
| Agent Chain Attacks | Nested Task calls, recursive agents |
|
|
208
|
+
| DoS Attacks | Loop Task calls, infinite recursion |
|
|
209
|
+
| Data Theft | Read + WebFetch combinations, accessing sensitive data |
|
|
210
|
+
|
|
211
|
+
## Output Examples
|
|
212
|
+
|
|
213
|
+
### Safe Skill
|
|
214
|
+
|
|
215
|
+
```
|
|
216
|
+
🔧 Claude Skill Installer v2.0.0
|
|
217
|
+
|
|
218
|
+
📦 Skill loaded: example-safe-skill
|
|
219
|
+
|
|
220
|
+
🔍 Starting security scan...
|
|
221
|
+
|
|
222
|
+
===========================================
|
|
223
|
+
SECURITY SCAN REPORT
|
|
224
|
+
===========================================
|
|
225
|
+
Risk Level: ✅ SAFE
|
|
226
|
+
|
|
227
|
+
📊 Findings Summary:
|
|
228
|
+
🟢 CRITICAL: 0
|
|
229
|
+
🟢 HIGH: 0
|
|
230
|
+
🟢 MEDIUM: 0
|
|
231
|
+
🟢 LOW: 0
|
|
232
|
+
ℹ️ INFO: 2
|
|
233
|
+
|
|
234
|
+
✅ Recommendation: Safe to install
|
|
235
|
+
```
|
|
236
|
+
|
|
237
|
+
### Malicious Skill Detected
|
|
238
|
+
|
|
239
|
+
```
|
|
240
|
+
🔧 Claude Skill Installer v2.0.0
|
|
241
|
+
|
|
242
|
+
📦 Skill loaded: suspicious-skill
|
|
243
|
+
|
|
244
|
+
🔍 Starting security scan...
|
|
245
|
+
|
|
246
|
+
===========================================
|
|
247
|
+
SECURITY SCAN REPORT
|
|
248
|
+
===========================================
|
|
249
|
+
Risk Level: ☠️ CRITICAL
|
|
250
|
+
|
|
251
|
+
📊 Findings Summary:
|
|
252
|
+
🔴 CRITICAL: 5
|
|
253
|
+
🟠 HIGH: 3
|
|
254
|
+
🟡 MEDIUM: 2
|
|
255
|
+
🟢 LOW: 1
|
|
256
|
+
ℹ️ INFO: 4
|
|
257
|
+
|
|
258
|
+
🔴 CRITICAL Findings:
|
|
259
|
+
• [Data Collection] Reading sensitive credential files
|
|
260
|
+
Attempts to read environment variables, private keys or credential files
|
|
261
|
+
• [Data Exfiltration] curl sending command output
|
|
262
|
+
Using curl to send command execution results to external server
|
|
263
|
+
...
|
|
264
|
+
|
|
265
|
+
❌ Recommendation: DO NOT INSTALL - Contains critical security risks
|
|
266
|
+
```
|
|
267
|
+
|
|
268
|
+
## Risk Levels
|
|
269
|
+
|
|
270
|
+
| Level | Score Impact | Action |
|
|
271
|
+
|-------|--------------|--------|
|
|
272
|
+
| CRITICAL | -30/item | Block installation |
|
|
273
|
+
| HIGH | -20/item | Require explicit confirmation |
|
|
274
|
+
| MEDIUM | -10/item | Show warning |
|
|
275
|
+
| LOW | -5/item | Show in verbose mode |
|
|
276
|
+
| INFO | 0 | Always show |
|
|
277
|
+
|
|
278
|
+
## API
|
|
279
|
+
|
|
280
|
+
You can also use the scanner programmatically:
|
|
281
|
+
|
|
282
|
+
```javascript
|
|
283
|
+
import { SecurityScanner, loadSkill } from 'claude-skill-antivirus';
|
|
284
|
+
|
|
285
|
+
const scanner = new SecurityScanner();
|
|
286
|
+
const skill = await loadSkill('./path/to/skill');
|
|
287
|
+
const findings = await scanner.scan(skill);
|
|
288
|
+
|
|
289
|
+
console.log(findings);
|
|
290
|
+
// {
|
|
291
|
+
// critical: [...],
|
|
292
|
+
// high: [...],
|
|
293
|
+
// medium: [...],
|
|
294
|
+
// low: [...],
|
|
295
|
+
// info: [...]
|
|
296
|
+
// }
|
|
297
|
+
```
|
|
298
|
+
|
|
299
|
+
## Project Structure
|
|
300
|
+
|
|
301
|
+
```
|
|
302
|
+
claude-skill-antivirus/
|
|
303
|
+
├── src/
|
|
304
|
+
│ ├── index.js # CLI entry point
|
|
305
|
+
│ ├── i18n/ # Internationalization
|
|
306
|
+
│ │ ├── index.js
|
|
307
|
+
│ │ ├── en.js # English translations
|
|
308
|
+
│ │ └── zh-TW.js # Traditional Chinese translations
|
|
309
|
+
│ ├── scanner/
|
|
310
|
+
│ │ ├── index.js # Main scanner (integrates 9 engines)
|
|
311
|
+
│ │ ├── dangerous-commands.js # Dangerous command detection
|
|
312
|
+
│ │ ├── permissions.js # Permission checking
|
|
313
|
+
│ │ ├── external-connections.js # External connection analysis
|
|
314
|
+
│ │ ├── patterns.js # Pattern matching
|
|
315
|
+
│ │ ├── data-exfiltration.js # Data exfiltration detection
|
|
316
|
+
│ │ ├── mcp-security.js # MCP Server security check
|
|
317
|
+
│ │ ├── ssrf-scanner.js # SSRF/cloud attack detection
|
|
318
|
+
│ │ ├── dependency-scanner.js # Dependency security check
|
|
319
|
+
│ │ └── subagent-scanner.js # Sub-agent attack detection
|
|
320
|
+
│ └── utils/
|
|
321
|
+
│ ├── downloader.js # Skill downloader
|
|
322
|
+
│ └── installer.js # Skill installer
|
|
323
|
+
├── examples/
|
|
324
|
+
│ ├── safe-skill/ # Safe example
|
|
325
|
+
│ └── malicious-skill/ # Malicious example (tests all engines)
|
|
326
|
+
├── package.json
|
|
327
|
+
└── README.md
|
|
328
|
+
```
|
|
329
|
+
|
|
330
|
+
## Contributing
|
|
331
|
+
|
|
332
|
+
Contributions are welcome! Please feel free to submit issues and pull requests.
|
|
333
|
+
|
|
334
|
+
### Adding New Detection Patterns
|
|
335
|
+
|
|
336
|
+
Each scanner is modular. To add new patterns:
|
|
337
|
+
|
|
338
|
+
1. Find the appropriate scanner in `src/scanner/`
|
|
339
|
+
2. Add your pattern to the relevant array
|
|
340
|
+
3. Include: `pattern`, `risk`, `title`, `description`
|
|
341
|
+
|
|
342
|
+
## License
|
|
343
|
+
|
|
344
|
+
MIT
|
|
345
|
+
|
|
346
|
+
## Author
|
|
347
|
+
|
|
348
|
+
Lucas Wang <support@claude-world.com>
|
|
349
|
+
|
|
350
|
+
## Links
|
|
351
|
+
|
|
352
|
+
- [GitHub Repository](https://github.com/claude-world/claude-skill-antivirus)
|
|
353
|
+
- [Report Issues](https://github.com/claude-world/claude-skill-antivirus/issues)
|
package/README.zh-TW.md
ADDED
|
@@ -0,0 +1,346 @@
|
|
|
1
|
+
# Claude Skill Antivirus
|
|
2
|
+
|
|
3
|
+
一個安全的 Claude Skills 安裝器,內建完整的惡意行為偵測引擎。
|
|
4
|
+
|
|
5
|
+
**Skills Installer + Antivirus for Claude**
|
|
6
|
+
|
|
7
|
+
[English](./README.md) | [SkillsMP 掃描報告](./SCAN-REPORT.md)
|
|
8
|
+
|
|
9
|
+
## SkillsMP 平台掃描結果
|
|
10
|
+
|
|
11
|
+
我們掃描了 SkillsMP 上所有 **71,577 個 skills**:
|
|
12
|
+
|
|
13
|
+
| 風險等級 | 數量 | 百分比 |
|
|
14
|
+
|----------|------|--------|
|
|
15
|
+
| 嚴重 | 91 | 0.13% |
|
|
16
|
+
| 高 | 626 | 0.87% |
|
|
17
|
+
| 中 | 1,310 | 1.83% |
|
|
18
|
+
| 安全 | **69,505** | **97.11%** |
|
|
19
|
+
|
|
20
|
+
**約 3% 的 skills 可能存在潛在風險。** 詳見[完整報告](./SCAN-REPORT.md)。
|
|
21
|
+
|
|
22
|
+
> **注意**:部分發現可能是誤判(例如:合法的 1Password/Bitwarden 整合工具)。建議對標記的 skills 進行人工審查。
|
|
23
|
+
|
|
24
|
+
## 功能特色
|
|
25
|
+
|
|
26
|
+
- **🛡️ 九大掃描引擎**: 全方位偵測惡意 Skills
|
|
27
|
+
- **⚠️ 風險評估**: 將發現分類為 Critical、High、Medium、Low、Info
|
|
28
|
+
- **📊 視覺化報告**: 彩色安全報告與分數
|
|
29
|
+
- **🚫 自動阻擋**: 預設阻擋 CRITICAL 風險的 Skills
|
|
30
|
+
- **🌐 支援多來源**: SkillsMP、GitHub、本機檔案
|
|
31
|
+
- **🌍 多語言支援**: 英文和繁體中文
|
|
32
|
+
|
|
33
|
+
## 安裝
|
|
34
|
+
|
|
35
|
+
```bash
|
|
36
|
+
npm install -g claude-skill-antivirus
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
或使用 npx 直接執行:
|
|
40
|
+
|
|
41
|
+
```bash
|
|
42
|
+
npx claude-skill-antivirus <skill-source>
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
## 使用方式
|
|
46
|
+
|
|
47
|
+
### 安裝 Skill(含安全掃描)
|
|
48
|
+
|
|
49
|
+
```bash
|
|
50
|
+
# 安裝到專案層級 (./.claude/skills/) - 預設
|
|
51
|
+
skill-install ./path/to/skill
|
|
52
|
+
skill-install https://github.com/user/skill-repo
|
|
53
|
+
|
|
54
|
+
# 安裝到使用者層級 (~/.claude/skills/)
|
|
55
|
+
skill-install ./path/to/skill --global
|
|
56
|
+
skill-install @skillsmp/example-skill -g
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
**安裝路徑:**
|
|
60
|
+
- 專案層級(預設):`./.claude/skills/`
|
|
61
|
+
- 使用者層級(`--global`):`~/.claude/skills/`
|
|
62
|
+
|
|
63
|
+
### 僅掃描(不安裝)
|
|
64
|
+
|
|
65
|
+
```bash
|
|
66
|
+
skill-install ./path/to/skill --scan-only
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
### 變更語言
|
|
70
|
+
|
|
71
|
+
```bash
|
|
72
|
+
# 英文(預設)
|
|
73
|
+
skill-install ./path/to/skill --lang en
|
|
74
|
+
|
|
75
|
+
# 繁體中文
|
|
76
|
+
skill-install ./path/to/skill --lang zh-TW
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
### 替代指令
|
|
80
|
+
|
|
81
|
+
```bash
|
|
82
|
+
claude-skill-av ./path/to/skill --scan-only
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
### 批量掃描所有 SkillsMP 技能
|
|
86
|
+
|
|
87
|
+
```bash
|
|
88
|
+
# 掃描 SkillsMP 上的所有技能(需要 API 金鑰)
|
|
89
|
+
skill-batch-scan --api-key <your-api-key>
|
|
90
|
+
|
|
91
|
+
# 使用選項掃描
|
|
92
|
+
skill-batch-scan --api-key <key> --max-pages 10 --verbose
|
|
93
|
+
skill-batch-scan --api-key <key> --output ./my-reports --lang zh-TW
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
選項:
|
|
97
|
+
- `-k, --api-key <key>` - SkillsMP API 金鑰(必填)
|
|
98
|
+
- `-l, --limit <number>` - 每頁技能數(預設:100)
|
|
99
|
+
- `-p, --max-pages <number>` - 最大掃描頁數(預設:全部)
|
|
100
|
+
- `-o, --output <dir>` - 報告輸出目錄(預設:./scan-reports)
|
|
101
|
+
- `-v, --verbose` - 顯示詳細輸出
|
|
102
|
+
- `--lang <lang>` - 語言(en, zh-TW)
|
|
103
|
+
|
|
104
|
+
## 掃描引擎
|
|
105
|
+
|
|
106
|
+
### 1. 危險指令偵測 (DangerousCommandScanner)
|
|
107
|
+
|
|
108
|
+
偵測可能造成系統損害的指令:
|
|
109
|
+
|
|
110
|
+
| 風險等級 | 偵測項目 |
|
|
111
|
+
|----------|----------|
|
|
112
|
+
| Critical | `rm -rf /`、`curl \| bash`、fork bomb |
|
|
113
|
+
| High | 讀取 `/etc/shadow`、reverse shell、憑證竊取 |
|
|
114
|
+
| Medium | `rm -rf`、權限變更、服務控制 |
|
|
115
|
+
| Low | `sudo`、全域安裝 |
|
|
116
|
+
|
|
117
|
+
### 2. 權限範圍檢查 (PermissionScanner)
|
|
118
|
+
|
|
119
|
+
分析 `allowed-tools` 宣告:
|
|
120
|
+
|
|
121
|
+
- **Critical**: `Bash(*)` - 無限制 shell 存取
|
|
122
|
+
- **High**: `Write`、`WebFetch`、廣泛的 bash 權限
|
|
123
|
+
- **Medium**: `Read`、`Glob`、`Grep`、版本控制工具
|
|
124
|
+
- **危險組合偵測**: 例如 `Read + WebFetch` = 資料外洩風險
|
|
125
|
+
|
|
126
|
+
### 3. 外部連線分析 (ExternalConnectionScanner)
|
|
127
|
+
|
|
128
|
+
識別可疑的網路活動:
|
|
129
|
+
|
|
130
|
+
- IP 直連 URL
|
|
131
|
+
- Webhook/資料擷取服務
|
|
132
|
+
- 可疑 TLD (.tk、.ml 等)
|
|
133
|
+
- Discord/Telegram webhook
|
|
134
|
+
- URL 縮短服務
|
|
135
|
+
|
|
136
|
+
### 4. 模式匹配 (PatternScanner)
|
|
137
|
+
|
|
138
|
+
偵測:
|
|
139
|
+
|
|
140
|
+
- Prompt injection 攻擊
|
|
141
|
+
- 硬編碼的憑證/API 金鑰
|
|
142
|
+
- 混淆程式碼 (base64、hex 編碼)
|
|
143
|
+
- 社交工程語言
|
|
144
|
+
|
|
145
|
+
### 5. 資料外洩偵測 (DataExfiltrationScanner)
|
|
146
|
+
|
|
147
|
+
**專門偵測讀取本機資料並傳送到外部的惡意行為**:
|
|
148
|
+
|
|
149
|
+
| 類別 | 偵測項目 |
|
|
150
|
+
|------|----------|
|
|
151
|
+
| 資料收集 | 讀取 `.ssh`、`.aws`、`.env`、瀏覽器密碼、密碼管理器 |
|
|
152
|
+
| 資料外洩 | `curl -d`、`nc` 傳送、DNS tunneling、郵件外洩 |
|
|
153
|
+
| 組合攻擊 | `cat \| base64 \| curl`、`tar \| nc`、`find -exec curl` |
|
|
154
|
+
| 環境變數竊取 | `env \| curl`、`printenv` 外洩 |
|
|
155
|
+
| 系統偵察 | `whoami`、`hostname`、網路設定外洩 |
|
|
156
|
+
| 持久化機制 | 修改 `.bashrc`、cron 定時外洩 |
|
|
157
|
+
|
|
158
|
+
### 6. MCP Server 安全檢查 (MCPSecurityScanner)
|
|
159
|
+
|
|
160
|
+
**偵測 MCP Server 設定中的安全風險**:
|
|
161
|
+
|
|
162
|
+
| 類別 | 偵測項目 |
|
|
163
|
+
|------|----------|
|
|
164
|
+
| 不受信任來源 | 非官方 MCP server、從 URL 直接執行 |
|
|
165
|
+
| 危險權限 | Filesystem 無限制存取、Shell 執行、資料庫存取 |
|
|
166
|
+
| 敏感設定 | 環境變數含憑證、設定檔暴露 |
|
|
167
|
+
| 危險組合 | Filesystem + Fetch、Shell + 網路 |
|
|
168
|
+
|
|
169
|
+
### 7. SSRF/雲端攻擊偵測 (SSRFScanner)
|
|
170
|
+
|
|
171
|
+
**偵測 Server-Side Request Forgery 和雲端攻擊**:
|
|
172
|
+
|
|
173
|
+
| 類別 | 偵測項目 |
|
|
174
|
+
|------|----------|
|
|
175
|
+
| 雲端 Metadata | AWS/GCP/Azure 169.254.169.254、IAM 憑證竊取 |
|
|
176
|
+
| 內部網路 | 10.x.x.x、192.168.x.x、172.16-31.x.x 探測 |
|
|
177
|
+
| SSRF 繞過 | Hex IP、URL 編碼、file://、gopher:// |
|
|
178
|
+
| Kubernetes | API 存取、secrets 竊取、serviceaccount |
|
|
179
|
+
| Docker | docker.sock 存取、特權容器、容器逃逸 |
|
|
180
|
+
|
|
181
|
+
### 8. 依賴安全檢查 (DependencyScanner)
|
|
182
|
+
|
|
183
|
+
**偵測惡意或有漏洞的依賴套件**:
|
|
184
|
+
|
|
185
|
+
| 類別 | 偵測項目 |
|
|
186
|
+
|------|----------|
|
|
187
|
+
| 已知惡意套件 | event-stream、ua-parser-js、colors、faker |
|
|
188
|
+
| Typosquatting | crossenv、lodash-、mongose、reqeusts |
|
|
189
|
+
| 可疑安裝 | 從 URL 安裝、不安全 registry、HTTP index |
|
|
190
|
+
| postinstall 風險 | install 腳本含 curl、wget、eval |
|
|
191
|
+
|
|
192
|
+
### 9. Sub-agent 攻擊偵測 (SubAgentScanner)
|
|
193
|
+
|
|
194
|
+
**偵測 Task 工具和 Sub-agent 的濫用**:
|
|
195
|
+
|
|
196
|
+
| 類別 | 偵測項目 |
|
|
197
|
+
|------|----------|
|
|
198
|
+
| 權限升級 | Task 派生 Bash agent、要求所有權限 |
|
|
199
|
+
| Prompt Injection | Sub-agent prompt 含惡意指令 |
|
|
200
|
+
| Agent 鏈攻擊 | 嵌套 Task 呼叫、遞迴 agent |
|
|
201
|
+
| DoS 攻擊 | 迴圈呼叫 Task、無限遞迴 |
|
|
202
|
+
| 資料竊取 | Read + WebFetch 組合、存取敏感資料 |
|
|
203
|
+
|
|
204
|
+
## 輸出範例
|
|
205
|
+
|
|
206
|
+
### 安全的 Skill
|
|
207
|
+
|
|
208
|
+
```
|
|
209
|
+
🔧 Claude Skill Installer v2.0.0
|
|
210
|
+
|
|
211
|
+
📦 已載入 Skill: example-safe-skill
|
|
212
|
+
|
|
213
|
+
🔍 開始安全掃描...
|
|
214
|
+
|
|
215
|
+
===========================================
|
|
216
|
+
安全掃描報告
|
|
217
|
+
===========================================
|
|
218
|
+
風險等級: ✅ 安全
|
|
219
|
+
|
|
220
|
+
📊 發現摘要:
|
|
221
|
+
🟢 嚴重: 0
|
|
222
|
+
🟢 高: 0
|
|
223
|
+
🟢 中: 0
|
|
224
|
+
🟢 低: 0
|
|
225
|
+
ℹ️ 資訊: 2
|
|
226
|
+
|
|
227
|
+
✅ 建議: 可以安全安裝
|
|
228
|
+
```
|
|
229
|
+
|
|
230
|
+
### 偵測到惡意 Skill
|
|
231
|
+
|
|
232
|
+
```
|
|
233
|
+
🔧 Claude Skill Installer v2.0.0
|
|
234
|
+
|
|
235
|
+
📦 已載入 Skill: suspicious-skill
|
|
236
|
+
|
|
237
|
+
🔍 開始安全掃描...
|
|
238
|
+
|
|
239
|
+
===========================================
|
|
240
|
+
安全掃描報告
|
|
241
|
+
===========================================
|
|
242
|
+
風險等級: ☠️ 嚴重
|
|
243
|
+
|
|
244
|
+
📊 發現摘要:
|
|
245
|
+
🔴 嚴重: 5
|
|
246
|
+
🟠 高: 3
|
|
247
|
+
🟡 中: 2
|
|
248
|
+
🟢 低: 1
|
|
249
|
+
ℹ️ 資訊: 4
|
|
250
|
+
|
|
251
|
+
🔴 嚴重發現:
|
|
252
|
+
• [資料收集] 讀取敏感憑證檔案
|
|
253
|
+
嘗試讀取環境變數、私鑰或憑證檔案
|
|
254
|
+
• [資料外洩] curl 傳送指令輸出
|
|
255
|
+
使用 curl 將指令執行結果傳送到外部伺服器
|
|
256
|
+
...
|
|
257
|
+
|
|
258
|
+
❌ 建議: 請勿安裝 - 包含嚴重安全風險
|
|
259
|
+
```
|
|
260
|
+
|
|
261
|
+
## 風險等級
|
|
262
|
+
|
|
263
|
+
| 等級 | 分數影響 | 動作 |
|
|
264
|
+
|------|----------|------|
|
|
265
|
+
| CRITICAL | -30/項 | 阻止安裝 |
|
|
266
|
+
| HIGH | -20/項 | 需明確確認 |
|
|
267
|
+
| MEDIUM | -10/項 | 顯示警告 |
|
|
268
|
+
| LOW | -5/項 | 詳細模式顯示 |
|
|
269
|
+
| INFO | 0 | 總是顯示 |
|
|
270
|
+
|
|
271
|
+
## API
|
|
272
|
+
|
|
273
|
+
您也可以程式化使用掃描器:
|
|
274
|
+
|
|
275
|
+
```javascript
|
|
276
|
+
import { SecurityScanner, loadSkill } from 'claude-skill-antivirus';
|
|
277
|
+
|
|
278
|
+
const scanner = new SecurityScanner();
|
|
279
|
+
const skill = await loadSkill('./path/to/skill');
|
|
280
|
+
const findings = await scanner.scan(skill);
|
|
281
|
+
|
|
282
|
+
console.log(findings);
|
|
283
|
+
// {
|
|
284
|
+
// critical: [...],
|
|
285
|
+
// high: [...],
|
|
286
|
+
// medium: [...],
|
|
287
|
+
// low: [...],
|
|
288
|
+
// info: [...]
|
|
289
|
+
// }
|
|
290
|
+
```
|
|
291
|
+
|
|
292
|
+
## 專案結構
|
|
293
|
+
|
|
294
|
+
```
|
|
295
|
+
claude-skill-antivirus/
|
|
296
|
+
├── src/
|
|
297
|
+
│ ├── index.js # CLI 入口
|
|
298
|
+
│ ├── i18n/ # 國際化
|
|
299
|
+
│ │ ├── index.js
|
|
300
|
+
│ │ ├── en.js # 英文翻譯
|
|
301
|
+
│ │ └── zh-TW.js # 繁體中文翻譯
|
|
302
|
+
│ ├── scanner/
|
|
303
|
+
│ │ ├── index.js # 主掃描器(整合 9 個引擎)
|
|
304
|
+
│ │ ├── dangerous-commands.js # 危險指令偵測
|
|
305
|
+
│ │ ├── permissions.js # 權限檢查
|
|
306
|
+
│ │ ├── external-connections.js # 外部連線分析
|
|
307
|
+
│ │ ├── patterns.js # 模式匹配
|
|
308
|
+
│ │ ├── data-exfiltration.js # 資料外洩偵測
|
|
309
|
+
│ │ ├── mcp-security.js # MCP Server 安全檢查
|
|
310
|
+
│ │ ├── ssrf-scanner.js # SSRF/雲端攻擊偵測
|
|
311
|
+
│ │ ├── dependency-scanner.js # 依賴安全檢查
|
|
312
|
+
│ │ └── subagent-scanner.js # Sub-agent 攻擊偵測
|
|
313
|
+
│ └── utils/
|
|
314
|
+
│ ├── downloader.js # Skill 下載器
|
|
315
|
+
│ └── installer.js # Skill 安裝器
|
|
316
|
+
├── examples/
|
|
317
|
+
│ ├── safe-skill/ # 安全範例
|
|
318
|
+
│ └── malicious-skill/ # 惡意範例(測試所有引擎)
|
|
319
|
+
├── package.json
|
|
320
|
+
└── README.md
|
|
321
|
+
```
|
|
322
|
+
|
|
323
|
+
## 貢獻
|
|
324
|
+
|
|
325
|
+
歡迎貢獻!請隨時提交 issues 和 pull requests。
|
|
326
|
+
|
|
327
|
+
### 新增偵測模式
|
|
328
|
+
|
|
329
|
+
每個掃描器都是模組化的。要新增模式:
|
|
330
|
+
|
|
331
|
+
1. 在 `src/scanner/` 找到適當的掃描器
|
|
332
|
+
2. 將您的模式新增到相關陣列
|
|
333
|
+
3. 包含:`pattern`、`risk`、`title`、`description`
|
|
334
|
+
|
|
335
|
+
## License
|
|
336
|
+
|
|
337
|
+
MIT
|
|
338
|
+
|
|
339
|
+
## 作者
|
|
340
|
+
|
|
341
|
+
Lucas Wang <support@claude-world.com>
|
|
342
|
+
|
|
343
|
+
## 連結
|
|
344
|
+
|
|
345
|
+
- [GitHub Repository](https://github.com/claude-world/claude-skill-antivirus)
|
|
346
|
+
- [回報問題](https://github.com/claude-world/claude-skill-antivirus/issues)
|