agent-security-scanner-mcp 1.1.2 → 1.3.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 +145 -15
- package/analyzer.py +7 -0
- package/index.js +508 -1
- package/package.json +7 -3
- package/rules/agent-attacks.security.yaml +791 -0
- package/rules/c.security.yaml +459 -0
- package/rules/php.security.yaml +461 -0
- package/rules/prompt-injection.security.yaml +684 -0
- package/rules/ruby.security.yaml +400 -0
- package/rules/terraform.security.yaml +505 -0
package/README.md
CHANGED
|
@@ -2,13 +2,29 @@
|
|
|
2
2
|
|
|
3
3
|
A powerful MCP (Model Context Protocol) server for real-time security vulnerability scanning. Integrates with Claude Desktop, Claude Code, OpenCode.ai, Kilo Code, and any MCP-compatible client to automatically detect and fix security issues as you code.
|
|
4
4
|
|
|
5
|
-
**
|
|
5
|
+
**275+ Semgrep-aligned security rules | 105 auto-fix templates | 100% fix coverage | Package hallucination detection | AI Agent prompt security**
|
|
6
|
+
|
|
7
|
+
## What's New in v1.3.0
|
|
8
|
+
|
|
9
|
+
- **AI Agent Prompt Security** - New `scan_agent_prompt` tool to detect malicious prompts before execution
|
|
10
|
+
- **56 prompt attack detection rules** - Exfiltration, backdoor requests, social engineering, jailbreaks
|
|
11
|
+
- **Risk scoring engine** - BLOCK/WARN/LOG/ALLOW actions with 0-100 risk scores
|
|
12
|
+
- **Prompt injection detection** - 39 rules for LLM prompt injection patterns
|
|
13
|
+
|
|
14
|
+
## What's New in v1.2.0
|
|
15
|
+
|
|
16
|
+
- **110 new security rules** - Now covering 10 languages and IaC
|
|
17
|
+
- **PHP support** - SQL injection, XSS, command injection, deserialization, file inclusion
|
|
18
|
+
- **Ruby/Rails support** - Mass assignment, CSRF, unsafe eval, YAML deserialization
|
|
19
|
+
- **C/C++ support** - Buffer overflow, format strings, memory safety, use-after-free
|
|
20
|
+
- **Terraform support** - AWS S3, IAM, RDS, security groups, CloudTrail
|
|
21
|
+
- **Kubernetes support** - Privileged containers, RBAC, network policies, secrets
|
|
6
22
|
|
|
7
23
|
## Features
|
|
8
24
|
|
|
9
25
|
- **Real-time scanning** - Detect vulnerabilities instantly as you write code
|
|
10
26
|
- **Auto-fix suggestions** - Get actionable fixes for every security issue
|
|
11
|
-
- **Multi-language support** - JavaScript, TypeScript, Python, Java, Go, Dockerfile
|
|
27
|
+
- **Multi-language support** - JavaScript, TypeScript, Python, Java, Go, PHP, Ruby, C/C++, Dockerfile, Terraform, Kubernetes
|
|
12
28
|
- **Semgrep-compatible** - Rules aligned with Semgrep registry format
|
|
13
29
|
- **CWE & OWASP mapped** - Every rule includes CWE and OWASP references
|
|
14
30
|
- **Hallucination detection** - Detect AI-invented package names (Dart, Perl, Raku)
|
|
@@ -206,6 +222,89 @@ List all 105 available auto-fix templates.
|
|
|
206
222
|
|
|
207
223
|
---
|
|
208
224
|
|
|
225
|
+
## AI Agent Prompt Security
|
|
226
|
+
|
|
227
|
+
Protect AI coding agents (Claude Code, Cursor, Copilot, etc.) from malicious prompts before execution. Detects exfiltration attempts, backdoor requests, social engineering, and obfuscated attacks.
|
|
228
|
+
|
|
229
|
+
### `scan_agent_prompt`
|
|
230
|
+
|
|
231
|
+
Scan a prompt for malicious intent before allowing an AI agent to execute it.
|
|
232
|
+
|
|
233
|
+
```
|
|
234
|
+
Parameters:
|
|
235
|
+
prompt_text (string): The prompt text to analyze
|
|
236
|
+
context (object, optional):
|
|
237
|
+
- sensitivity_level: "high" | "medium" | "low" (default: "medium")
|
|
238
|
+
|
|
239
|
+
Returns:
|
|
240
|
+
- action: "BLOCK" | "WARN" | "LOG" | "ALLOW"
|
|
241
|
+
- risk_score: 0-100
|
|
242
|
+
- risk_level: "CRITICAL" | "HIGH" | "MEDIUM" | "LOW" | "NONE"
|
|
243
|
+
- findings: Array of detected issues
|
|
244
|
+
- explanation: Human-readable summary
|
|
245
|
+
- recommendations: Suggested actions
|
|
246
|
+
```
|
|
247
|
+
|
|
248
|
+
**Risk Thresholds:**
|
|
249
|
+
|
|
250
|
+
| Risk Level | Score Range | Action |
|
|
251
|
+
|------------|-------------|--------|
|
|
252
|
+
| CRITICAL | 85-100 | BLOCK |
|
|
253
|
+
| HIGH | 70-84 | BLOCK |
|
|
254
|
+
| MEDIUM | 50-69 | WARN |
|
|
255
|
+
| LOW | 25-49 | LOG |
|
|
256
|
+
| NONE | 0-24 | ALLOW |
|
|
257
|
+
|
|
258
|
+
**Example - Malicious prompt (BLOCKED):**
|
|
259
|
+
```json
|
|
260
|
+
{
|
|
261
|
+
"action": "BLOCK",
|
|
262
|
+
"risk_score": 100,
|
|
263
|
+
"risk_level": "CRITICAL",
|
|
264
|
+
"findings": [
|
|
265
|
+
{
|
|
266
|
+
"rule_id": "agent.injection.security.backdoor-request",
|
|
267
|
+
"category": "malicious-injection",
|
|
268
|
+
"severity": "error",
|
|
269
|
+
"message": "Request to add backdoor or hidden access mechanism",
|
|
270
|
+
"matched_text": "add a hidden backdoor",
|
|
271
|
+
"confidence": "high"
|
|
272
|
+
}
|
|
273
|
+
],
|
|
274
|
+
"explanation": "Detected 1 potential security issue(s) in prompt",
|
|
275
|
+
"recommendations": [
|
|
276
|
+
"Do not execute this prompt",
|
|
277
|
+
"Review the flagged patterns",
|
|
278
|
+
"Report if this appears to be an attack attempt"
|
|
279
|
+
]
|
|
280
|
+
}
|
|
281
|
+
```
|
|
282
|
+
|
|
283
|
+
**Example - Safe prompt (ALLOWED):**
|
|
284
|
+
```json
|
|
285
|
+
{
|
|
286
|
+
"action": "ALLOW",
|
|
287
|
+
"risk_score": 0,
|
|
288
|
+
"risk_level": "NONE",
|
|
289
|
+
"findings": [],
|
|
290
|
+
"explanation": "No security issues detected in prompt",
|
|
291
|
+
"recommendations": []
|
|
292
|
+
}
|
|
293
|
+
```
|
|
294
|
+
|
|
295
|
+
**Attack Categories Detected (56 rules):**
|
|
296
|
+
|
|
297
|
+
| Category | Rules | Examples |
|
|
298
|
+
|----------|-------|----------|
|
|
299
|
+
| Exfiltration | 10 | Send code to webhook, read .env files, push to external repo |
|
|
300
|
+
| Malicious Injection | 11 | Add backdoor, create reverse shell, disable authentication |
|
|
301
|
+
| System Manipulation | 9 | rm -rf /, modify /etc/passwd, add cron persistence |
|
|
302
|
+
| Social Engineering | 6 | Fake authorization claims, fake debug mode, urgency pressure |
|
|
303
|
+
| Obfuscation | 4 | Base64 encoded commands, ROT13, fragmented instructions |
|
|
304
|
+
| Agent Manipulation | 3 | Ignore previous instructions, override safety, DAN jailbreaks |
|
|
305
|
+
|
|
306
|
+
---
|
|
307
|
+
|
|
209
308
|
## Package Hallucination Detection
|
|
210
309
|
|
|
211
310
|
Detect AI-hallucinated package names that don't exist in official registries. Prevents supply chain attacks where attackers register fake package names suggested by AI.
|
|
@@ -313,7 +412,7 @@ Package lists are sourced from:
|
|
|
313
412
|
|
|
314
413
|
---
|
|
315
414
|
|
|
316
|
-
## Security Rules (
|
|
415
|
+
## Security Rules (275 total)
|
|
317
416
|
|
|
318
417
|
### By Language
|
|
319
418
|
|
|
@@ -323,6 +422,10 @@ Package lists are sourced from:
|
|
|
323
422
|
| Python | 36 | Injection, deserialization, crypto, XXE |
|
|
324
423
|
| Java | 27 | Injection, XXE, crypto, deserialization |
|
|
325
424
|
| Go | 22 | Injection, crypto, race conditions |
|
|
425
|
+
| **PHP** | 25 | SQL injection, XSS, command injection, deserialization |
|
|
426
|
+
| **Ruby/Rails** | 25 | Mass assignment, CSRF, eval, YAML deserialization |
|
|
427
|
+
| **C/C++** | 25 | Buffer overflow, format string, memory safety |
|
|
428
|
+
| **Terraform/K8s** | 35 | AWS misconfig, IAM, privileged containers, RBAC |
|
|
326
429
|
| Dockerfile | 18 | Secrets, permissions, best practices |
|
|
327
430
|
| Generic (Secrets) | 31 | API keys, tokens, passwords |
|
|
328
431
|
|
|
@@ -330,18 +433,18 @@ Package lists are sourced from:
|
|
|
330
433
|
|
|
331
434
|
| Category | Rules | Auto-Fix |
|
|
332
435
|
|----------|-------|----------|
|
|
333
|
-
| **Injection (SQL, Command, XSS)** |
|
|
334
|
-
| **Hardcoded Secrets** |
|
|
335
|
-
| **Weak Cryptography** |
|
|
336
|
-
| **Insecure Deserialization** |
|
|
337
|
-
| **
|
|
338
|
-
| **
|
|
339
|
-
| **
|
|
340
|
-
| **
|
|
341
|
-
| **
|
|
342
|
-
| **
|
|
343
|
-
| **
|
|
344
|
-
| **Other** |
|
|
436
|
+
| **Injection (SQL, Command, XSS)** | 55 | Yes |
|
|
437
|
+
| **Hardcoded Secrets** | 50 | Yes |
|
|
438
|
+
| **Weak Cryptography** | 25 | Yes |
|
|
439
|
+
| **Insecure Deserialization** | 18 | Yes |
|
|
440
|
+
| **Memory Safety (C/C++)** | 20 | Yes |
|
|
441
|
+
| **Infrastructure as Code** | 35 | Yes |
|
|
442
|
+
| **Path Traversal** | 10 | Yes |
|
|
443
|
+
| **SSRF** | 8 | Yes |
|
|
444
|
+
| **XXE** | 8 | Yes |
|
|
445
|
+
| **SSL/TLS Issues** | 12 | Yes |
|
|
446
|
+
| **CSRF** | 6 | Yes |
|
|
447
|
+
| **Other** | 28 | Yes |
|
|
345
448
|
|
|
346
449
|
## Auto-Fix Templates (105 total)
|
|
347
450
|
|
|
@@ -425,6 +528,30 @@ Claude will use `fix_security` to:
|
|
|
425
528
|
- Open Redirects
|
|
426
529
|
- CORS Misconfiguration
|
|
427
530
|
|
|
531
|
+
### Memory Safety (C/C++)
|
|
532
|
+
- Buffer Overflow (strcpy, strcat, sprintf, gets)
|
|
533
|
+
- Format String Vulnerabilities
|
|
534
|
+
- Use-After-Free
|
|
535
|
+
- Double-Free
|
|
536
|
+
- Integer Overflow in malloc
|
|
537
|
+
- Insecure memset (optimized away)
|
|
538
|
+
- Unsafe temp files (mktemp, tmpnam)
|
|
539
|
+
|
|
540
|
+
### Infrastructure as Code
|
|
541
|
+
- AWS S3 Public Access
|
|
542
|
+
- Security Groups Open to World (SSH, RDP)
|
|
543
|
+
- IAM Admin Policies (Action:*, Resource:*)
|
|
544
|
+
- RDS Public Access / Unencrypted
|
|
545
|
+
- CloudTrail Disabled
|
|
546
|
+
- KMS Key Rotation Disabled
|
|
547
|
+
- EBS Unencrypted
|
|
548
|
+
- EC2 IMDSv1 Enabled
|
|
549
|
+
- Kubernetes Privileged Containers
|
|
550
|
+
- K8s Run as Root
|
|
551
|
+
- K8s Host Network/PID
|
|
552
|
+
- RBAC Wildcard Permissions
|
|
553
|
+
- Cluster Admin Bindings
|
|
554
|
+
|
|
428
555
|
### Other
|
|
429
556
|
- Path Traversal
|
|
430
557
|
- XXE (XML External Entities)
|
|
@@ -433,6 +560,9 @@ Claude will use `fix_security` to:
|
|
|
433
560
|
- Prototype Pollution
|
|
434
561
|
- ReDoS (Regex DoS)
|
|
435
562
|
- Race Conditions
|
|
563
|
+
- Open Redirects
|
|
564
|
+
- Mass Assignment (Rails)
|
|
565
|
+
- Unsafe Eval/Constantize
|
|
436
566
|
|
|
437
567
|
## Contributing
|
|
438
568
|
|
package/analyzer.py
CHANGED
|
@@ -32,6 +32,13 @@ EXTENSION_MAP = {
|
|
|
32
32
|
'.json': 'json',
|
|
33
33
|
'.tf': 'terraform',
|
|
34
34
|
'.hcl': 'terraform',
|
|
35
|
+
# Prompt/text file extensions for prompt injection scanning
|
|
36
|
+
'.txt': 'generic',
|
|
37
|
+
'.md': 'generic',
|
|
38
|
+
'.prompt': 'generic',
|
|
39
|
+
'.jinja': 'generic',
|
|
40
|
+
'.jinja2': 'generic',
|
|
41
|
+
'.j2': 'generic',
|
|
35
42
|
}
|
|
36
43
|
|
|
37
44
|
def detect_language(file_path):
|