hackmyagent 0.4.3 → 0.5.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 CHANGED
@@ -1,154 +1,192 @@
1
- # HackMyAgent CLI
1
+ # HackMyAgent
2
2
 
3
3
  [![npm version](https://img.shields.io/npm/v/hackmyagent.svg)](https://www.npmjs.com/package/hackmyagent)
4
4
  [![License: Apache-2.0](https://img.shields.io/badge/License-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)
5
+ [![Tests](https://img.shields.io/badge/tests-501%20passing-brightgreen)](https://github.com/opena2a-org/hackmyagent)
5
6
 
6
- **Part of [OpenA2A](https://opena2a.org)** open-source security for AI agents
7
+ Security scanner for AI agents. 147+ checks across 31 categories. Auto-fix. Extensible plugin architecture.
7
8
 
8
- **Website:** [hackmyagent.com](https://hackmyagent.com) Scan external infrastructure for exposed MCP endpoints, configs, and credentials
9
+ Scans Claude Code, Cursor, VS Code, Windsurf, and any MCP server setup for credential leaks, misconfigurations, prompt injection vectors, supply chain risks, and more.
9
10
 
10
- ## What's New v0.4.3
11
+ [Website](https://hackmyagent.com) | [Docs](https://hackmyagent.com/docs) | [OpenA2A](https://opena2a.org) | [Security Checks Reference](docs/SECURITY_CHECKS.md)
11
12
 
12
- **First scanner for [CVE-2026-25253](https://hackmyagent.com/blog/cve-2026-25253-detection)** (CVSS 8.8) — the OpenClaw WebSocket hijacking RCE.
13
-
14
- - **CVE-001:** Detect vulnerable OpenClaw versions (before v2026.1.29)
15
- - **CVE-002:** Control UI origin restrictions (defense-in-depth hardening)
16
- - **CVE-003:** CVE-2026-25157 — OS command injection via SSH path (CVSS 7.8)
17
- - **CVE-004:** CVE-2026-24763 — Docker PATH command injection (CVSS 8.8)
18
- - **SUPPLY-005–008:** ClawHavoc campaign IOCs (C2 IPs, malware filenames, ClickFix patterns)
19
- - **GATEWAY-007–008, CONFIG-007–009:** Config hardening (open DM wildcards, disabled sandbox, weak tokens)
20
-
21
- 13 new checks. 147+ total.
22
-
23
- ## Disclaimer
13
+ ---
24
14
 
25
- HackMyAgent performs passive reconnaissance only (port checks and HTTP requests) — it does not exploit vulnerabilities. However, please only scan systems you own or have permission to test. The authors assume no liability for misuse of this tool.
15
+ ## Quick Start
26
16
 
27
17
  ```bash
28
- npx hackmyagent check @publisher/skill # verify a skill before installing
29
- npx hackmyagent secure # harden your agent setup (147+ checks)
30
- npx hackmyagent secure --fix # auto-fix security issues
31
- npx hackmyagent scan example.com # scan for exposed infrastructure
32
- npx hackmyagent attack --local # red team with 55 attack payloads
33
- npx hackmyagent secure --benchmark oasb-1 # run OASB-1 security benchmark
18
+ npx hackmyagent secure # scan current directory (147+ checks)
19
+ npx hackmyagent secure --fix # auto-fix what it finds
20
+ npx hackmyagent fix-all --with-aim # run all plugins with identity + audit
34
21
  ```
35
22
 
36
- ## Two Ways to Scan
23
+ No config files required. Works out of the box.
37
24
 
38
- | Tool | Use Case |
39
- |------|----------|
40
- | **[hackmyagent.com](https://hackmyagent.com)** | Scan external targets — check if your MCP servers, configs, or credentials are exposed on the internet |
41
- | **`npx hackmyagent secure`** | Scan local projects — harden your agent setup before deploying |
42
-
43
- ## Why HackMyAgent?
25
+ ---
44
26
 
45
- CVE-2026-25253 turned every OpenClaw installation into a remote code execution target. 341 malicious skills were distributed through ClawHub. AI agent security is no longer theoretical — HackMyAgent helps you:
27
+ ## Table of Contents
28
+
29
+ - [Installation](#installation)
30
+ - [Commands](#commands)
31
+ - [secure](#hackmyagent-secure) — local agent hardening (147+ checks)
32
+ - [fix-all](#hackmyagent-fix-all) — run all OpenA2A security plugins
33
+ - [check](#hackmyagent-check) — verify a skill before installing
34
+ - [scan](#hackmyagent-scan) — scan external infrastructure
35
+ - [attack](#hackmyagent-attack) — red team with adversarial payloads
36
+ - [secure --benchmark](#hackmyagent-secure---benchmark) — OASB-1 compliance benchmark
37
+ - [secure-openclaw](#hackmyagent-secure-openclaw) — OpenClaw-specific scanning
38
+ - [rollback](#hackmyagent-rollback) — undo auto-fix changes
39
+ - [Plugin Architecture](#plugin-architecture)
40
+ - [CI/CD Integration](#cicd-integration)
41
+ - [Exit Codes](#exit-codes)
42
+ - [Contributing](#contributing)
46
43
 
47
- - **Check** skills before installing (publisher verification, permission analysis)
48
- - **Secure** your agent setup (147+ security checks with auto-remediation)
49
- - **Scan** external infrastructure (exposed MCP endpoints, leaked configs)
44
+ ---
50
45
 
51
46
  ## Installation
52
47
 
53
48
  ```bash
54
- # Use directly with npx
49
+ # Run directly (no install needed)
55
50
  npx hackmyagent secure
56
51
 
57
- # Or install globally
52
+ # Install globally
58
53
  npm install -g hackmyagent
59
54
 
60
- # Or add to your project
55
+ # Add to project devDependencies
61
56
  npm install --save-dev hackmyagent
62
57
  ```
63
58
 
59
+ **Requirements:** Node.js 18+
60
+
61
+ ---
62
+
64
63
  ## Commands
65
64
 
66
65
  ### `hackmyagent secure`
67
66
 
68
- Scan and harden your local agent setup with 147+ security checks across 31 categories.
67
+ Scan and harden your local agent setup. 147+ checks across 31 categories with auto-remediation.
69
68
 
70
69
  ```bash
71
- # Basic scan
72
- hackmyagent secure
70
+ hackmyagent secure # basic scan
71
+ hackmyagent secure ./my-project # scan specific directory
72
+ hackmyagent secure --fix # auto-fix issues
73
+ hackmyagent secure --fix --dry-run # preview fixes before applying
74
+ hackmyagent secure --ignore CRED-001,GIT-002 # skip specific checks
75
+ hackmyagent secure --json # JSON output for CI/CD
76
+ hackmyagent secure --verbose # show all checks including passed
77
+ ```
78
+
79
+ <details>
80
+ <summary>All 31 security categories</summary>
81
+
82
+ | Category | Checks | What it detects |
83
+ |----------|--------|-----------------|
84
+ | CRED | 4 | Hardcoded API keys, tokens, passwords |
85
+ | MCP | 12 | MCP server misconfigurations |
86
+ | CLAUDE | 8 | Claude Code security issues |
87
+ | NET | 6 | Network exposure, open ports |
88
+ | PROMPT | 4 | Prompt injection vectors |
89
+ | INJ | 4 | XSS, SQL injection, command injection |
90
+ | ENCRYPT | 4 | Missing encryption at rest |
91
+ | SESSION | 4 | Session management flaws |
92
+ | AUDIT | 4 | Missing audit trails |
93
+ | SANDBOX | 4 | Process isolation gaps |
94
+ | TOOL | 4 | Tool permission boundaries |
95
+ | AUTH | 4 | Authentication weaknesses |
96
+ | DEPS | 4 | Vulnerable dependencies |
97
+ | ENV | 4 | Insecure environment variables |
98
+ | GIT | 4 | Git security (gitignore, hooks) |
99
+ | IO | 4 | Input/output validation |
100
+ | LOG | 4 | Logging and monitoring gaps |
101
+ | PERM | 4 | Overly permissive file permissions |
102
+ | PROC | 4 | Process isolation issues |
103
+ | RATE | 4 | Missing rate limiting |
104
+ | SEC | 4 | Security headers |
105
+ | API | 4 | API security issues |
106
+ | VSCODE | 4 | VS Code configuration risks |
107
+ | CURSOR | 4 | Cursor IDE configuration risks |
108
+ | CVE | 4 | Known CVE detection |
109
+ | GATEWAY | 8 | Gateway misconfigurations |
110
+ | CONFIG | 9 | Insecure default settings |
111
+ | SUPPLY | 8 | Supply chain attack vectors |
112
+ | SKILL | 12 | Malicious skill/tool detection |
113
+ | HEARTBEAT | 6 | Heartbeat/cron abuse |
114
+ | WINDSURF | 3 | Windsurf IDE configuration risks |
73
115
 
74
- # Scan specific directory
75
- hackmyagent secure ./my-project
116
+ </details>
76
117
 
77
- # Auto-fix issues
78
- hackmyagent secure --fix
118
+ <details>
119
+ <summary>Auto-fix capabilities</summary>
79
120
 
80
- # Preview fixes without applying
81
- hackmyagent secure --fix --dry-run
121
+ **General (`hackmyagent secure --fix`):**
122
+
123
+ | Check | Issue | Auto-fix |
124
+ |-------|-------|----------|
125
+ | CRED-001 | Exposed API keys | Replace with env var reference |
126
+ | GIT-001 | Missing .gitignore | Create with secure defaults |
127
+ | GIT-002 | Incomplete .gitignore | Add missing patterns |
128
+ | PERM-001 | Overly permissive files | Set restrictive permissions |
129
+ | MCP-001 | Root filesystem access | Scope to project directory |
130
+ | NET-001 | Bound to 0.0.0.0 | Bind to 127.0.0.1 |
131
+
132
+ **OpenClaw (`hackmyagent secure-openclaw --fix`):**
133
+
134
+ | Check | Issue | Auto-fix |
135
+ |-------|-------|----------|
136
+ | GATEWAY-001 | Bound to 0.0.0.0 | Bind to 127.0.0.1 |
137
+ | GATEWAY-003 | Plaintext token | Replace with `${OPENCLAW_AUTH_TOKEN}` |
138
+ | GATEWAY-004 | Approvals disabled | Enable approvals |
139
+ | GATEWAY-005 | Sandbox disabled | Enable sandbox |
140
+
141
+ Use `--dry-run` first to preview changes. Backups are created automatically in `.hackmyagent-backup/`.
142
+
143
+ </details>
144
+
145
+ ---
82
146
 
83
- # Skip specific checks
84
- hackmyagent secure --ignore CRED-001,GIT-002
147
+ ### `hackmyagent fix-all`
85
148
 
86
- # JSON output for CI/CD
87
- hackmyagent secure --json
149
+ Run all OpenA2A security plugins in sequence: scan, fix, report.
88
150
 
89
- # Show all checks (including passed)
90
- hackmyagent secure --verbose
151
+ ```bash
152
+ hackmyagent fix-all # scan and fix current directory
153
+ hackmyagent fix-all ./my-agent # target specific directory
154
+ hackmyagent fix-all --dry-run # preview without applying
155
+ hackmyagent fix-all --scan-only # scan only, no fixes
156
+ hackmyagent fix-all --json # JSON output for CI
157
+ hackmyagent fix-all --with-aim # enable AIM identity + audit logging
158
+ hackmyagent fix-all -v # verbose output
91
159
  ```
92
160
 
93
- **Security Categories:**
94
-
95
- | Category | Checks | Description |
96
- |----------|--------|-------------|
97
- | CRED | 4 | Credential exposure detection |
98
- | MCP | 12 | MCP server configuration |
99
- | CLAUDE | 8 | Claude Code security |
100
- | NET | 6 | Network security |
101
- | PROMPT | 4 | Prompt injection defenses |
102
- | INJ | 4 | Input validation (XSS, SQL, cmd) |
103
- | ENCRYPT | 4 | Encryption at rest |
104
- | SESSION | 4 | Session management |
105
- | AUDIT | 4 | Audit trails |
106
- | SANDBOX | 4 | Process isolation |
107
- | TOOL | 4 | Tool permission boundaries |
108
- | AUTH | 4 | Authentication checks |
109
- | DEPS | 4 | Dependency security |
110
- | ENV | 4 | Environment variable safety |
111
- | GIT | 4 | Git security (.gitignore, secrets in history) |
112
- | IO | 4 | Input/output validation |
113
- | LOG | 4 | Logging and monitoring |
114
- | PERM | 4 | File permissions |
115
- | PROC | 4 | Process isolation |
116
- | RATE | 4 | Rate limiting |
117
- | SEC | 4 | General security headers |
118
- | API | 4 | API security |
119
- | VSCODE | 4 | VS Code configuration |
120
- | CURSOR | 4 | Cursor IDE configuration |
121
- | CVE | 4 | OpenClaw CVE detection |
122
- | GATEWAY | 8 | Gateway misconfigurations |
123
- | CONFIG | 9 | Insecure settings |
124
- | SUPPLY | 8 | Supply chain attacks |
125
- | SKILL | 12 | Malicious skill detection |
126
- | HEARTBEAT | 6 | Heartbeat/cron abuse |
127
- | WINDSURF | 3 | Windsurf IDE configuration |
161
+ **Plugin execution order:**
162
+
163
+ | # | Plugin | What it does |
164
+ |---|--------|--------------|
165
+ | 1 | **SkillGuard** | Hash pinning, tamper detection, dangerous pattern scanning (reverse shells, exfil, prompt injection) |
166
+ | 2 | **SignCrypt** | Ed25519 signing of SKILL.md and HEARTBEAT.md, SHA-256 hash pinning, signature verification |
167
+ | 3 | **Secretless** | Credential detection (10 patterns), env var replacement, AES-256-GCM encrypted store |
128
168
 
129
- **Exit Codes:**
130
- - `0` - No critical/high issues
131
- - `1` - Critical or high severity issues found
169
+ **`--with-aim` adds:**
170
+ - Ed25519 identity generation for the agent
171
+ - Cryptographic audit log at `.opena2a/aim/audit.jsonl`
172
+ - Capability policy enforcement via `policy.yaml`
173
+ - 8-factor trust scoring
174
+
175
+ ---
132
176
 
133
177
  ### `hackmyagent check`
134
178
 
135
- Verify a skill's safety before installing.
179
+ Verify a skill before installing it.
136
180
 
137
181
  ```bash
138
182
  hackmyagent check @publisher/skill-name
139
- hackmyagent check @anthropic/claude-mcp --verbose
140
183
  hackmyagent check @publisher/skill --json
141
- hackmyagent check @publisher/skill --offline # skip DNS verification
184
+ hackmyagent check @publisher/skill --offline # skip DNS verification
142
185
  ```
143
186
 
144
- **Checks performed:**
145
- - Publisher identity via DNS TXT records
146
- - Permissions requested (filesystem, network, shell access)
147
- - Revocation status against global blocklist
187
+ Checks: publisher identity (DNS TXT), permissions requested, revocation status.
148
188
 
149
- **Note:** Only scan systems you own or have permission to test.
150
-
151
- **Risk Levels:** `low`, `medium`, `high`, `critical`
189
+ ---
152
190
 
153
191
  ### `hackmyagent scan`
154
192
 
@@ -157,70 +195,45 @@ Scan external infrastructure for exposed AI agent endpoints.
157
195
  ```bash
158
196
  hackmyagent scan example.com
159
197
  hackmyagent scan 192.168.1.100 -p 3000,8080
160
- hackmyagent scan example.com --verbose
161
198
  hackmyagent scan example.com --json
162
199
  ```
163
200
 
164
- **Detects:**
165
- - Exposed MCP SSE/tools endpoints
166
- - Public configuration files
167
- - API keys in responses
168
- - Debug/admin interfaces
169
-
170
- **Scoring:** A (90-100), B (80-89), C (70-79), D (60-69), F (<60)
171
-
172
- ### `hackmyagent attack`
173
-
174
- Red team your AI agent with adversarial security testing. 55 attack payloads across 5 categories.
175
-
176
- ```bash
177
- # Local simulation (no API calls - test payloads locally)
178
- hackmyagent attack --local
179
- hackmyagent attack --local --system-prompt "You are a helpful assistant"
201
+ Detects: exposed MCP SSE/tools endpoints, public configs, API keys in responses, debug interfaces.
180
202
 
181
- # Test an API endpoint
182
- hackmyagent attack https://api.example.com/v1/chat
183
- hackmyagent attack https://api.example.com --api-format anthropic
203
+ Scoring: A (90-100), B (80-89), C (70-79), D (60-69), F (<60).
184
204
 
185
- # Filter by category or intensity
186
- hackmyagent attack --local --category prompt-injection
187
- hackmyagent attack --local --intensity aggressive
205
+ > Only scan systems you own or have written authorization to test.
188
206
 
189
- # Custom payloads from a JSON file
190
- hackmyagent attack https://api.example.com --payload-file custom.json
207
+ ---
191
208
 
192
- # CI/CD gate — fail on vulnerabilities at or above severity threshold
193
- hackmyagent attack https://api.example.com --fail-on-vulnerable # any finding
194
- hackmyagent attack https://api.example.com --fail-on-vulnerable medium # medium+
195
- hackmyagent attack https://api.example.com --fail-on-vulnerable critical # critical only
209
+ ### `hackmyagent attack`
196
210
 
197
- # Output formats
198
- hackmyagent attack --local -f json
199
- hackmyagent attack --local -f sarif -o results.sarif
211
+ Red team your AI agent with 55 adversarial payloads across 5 categories.
200
212
 
201
- # Verbose mode (show each payload result)
202
- hackmyagent attack --local --verbose
213
+ ```bash
214
+ hackmyagent attack --local # local simulation
215
+ hackmyagent attack --local --system-prompt "You are helpful" # with custom prompt
216
+ hackmyagent attack https://api.example.com/v1/chat # test live endpoint
217
+ hackmyagent attack --local --category prompt-injection # single category
218
+ hackmyagent attack --local --intensity aggressive # full suite
219
+ hackmyagent attack --local -f sarif -o results.sarif # SARIF output
220
+ hackmyagent attack https://api.example.com --fail-on-vulnerable medium # CI gate
203
221
  ```
204
222
 
205
- **Attack Categories:**
223
+ <details>
224
+ <summary>Attack categories and custom payloads</summary>
206
225
 
207
226
  | Category | Payloads | Description |
208
227
  |----------|----------|-------------|
209
- | `prompt-injection` | 12 | Manipulate agent behavior via malicious input |
210
- | `jailbreak` | 12 | Bypass safety guardrails and restrictions |
211
- | `data-exfiltration` | 11 | Extract sensitive information from the agent |
212
- | `capability-abuse` | 10 | Misuse agent tools and capabilities |
228
+ | `prompt-injection` | 12 | Manipulate agent behavior via injected instructions |
229
+ | `jailbreak` | 12 | Bypass safety guardrails and system constraints |
230
+ | `data-exfiltration` | 11 | Extract sensitive data, system prompts, credentials |
231
+ | `capability-abuse` | 10 | Misuse agent tools for unintended actions |
213
232
  | `context-manipulation` | 10 | Poison agent context or memory |
214
233
 
215
- **Intensity Levels:**
216
-
217
- | Level | Description |
218
- |-------|-------------|
219
- | `passive` | Observation only, minimal risk |
220
- | `active` | Standard attack payloads (default) |
221
- | `aggressive` | Creative/risky payloads, full suite |
234
+ Intensity: `passive` (observation only), `active` (default), `aggressive` (full suite).
222
235
 
223
- **Custom Payload File Format:**
236
+ **Custom payloads:** Create a JSON file and pass with `--payloads custom.json`:
224
237
 
225
238
  ```json
226
239
  {
@@ -239,256 +252,263 @@ hackmyagent attack --local --verbose
239
252
  }
240
253
  ```
241
254
 
242
- Only `id` and `payload` are required. See `--help` for all defaults.
255
+ Only `id` and `payload` are required.
243
256
 
244
- **Output Formats:**
245
- - `text` - Human-readable report (default)
246
- - `json` - Machine-readable JSON
247
- - `sarif` - SARIF 2.1.0 for GitHub Security tab integration
248
- - `html` - Standalone HTML report
257
+ </details>
249
258
 
250
- **Risk Scoring:**
251
- - 0-24: LOW - Minor issues, agent is reasonably secure
252
- - 25-49: MEDIUM - Some vulnerabilities, review recommended
253
- - 50-69: HIGH - Significant vulnerabilities, action required
254
- - 70-100: CRITICAL - Severe vulnerabilities, immediate action needed
259
+ Output formats: `text`, `json`, `sarif` (GitHub Security tab), `html`.
260
+
261
+ ---
255
262
 
256
263
  ### `hackmyagent secure --benchmark`
257
264
 
258
- Run the [OASB-1](https://oasb.ai/oasb-1) (Open Agent Security Benchmark) — 46 controls across 10 categories that measure how secure your AI agent setup is.
265
+ Run the [OASB-1](https://oasb.ai/oasb-1) (Open Agent Security Benchmark) — 46 controls across 10 categories.
259
266
 
260
267
  ```bash
261
- # Run benchmark (L1 by default)
262
- hackmyagent secure --benchmark oasb-1
268
+ hackmyagent secure -b oasb-1 # L1 baseline (26 controls)
269
+ hackmyagent secure -b oasb-1 -l L2 # L2 standard (44 controls)
270
+ hackmyagent secure -b oasb-1 -l L3 # L3 hardened (46 controls)
271
+ hackmyagent secure -b oasb-1 -v # verbose (every control)
272
+ hackmyagent secure -b oasb-1 -f html -o report.html # HTML report
273
+ hackmyagent secure -b oasb-1 --fail-below 70 # CI gate
274
+ ```
263
275
 
264
- # Target specific directory
265
- hackmyagent secure ./my-project --benchmark oasb-1
276
+ <details>
277
+ <summary>OASB-1 categories and maturity levels</summary>
266
278
 
267
- # Different maturity levels
268
- hackmyagent secure -b oasb-1 -l L1 # Essential (26 controls)
269
- hackmyagent secure -b oasb-1 -l L2 # Standard (44 controls)
270
- hackmyagent secure -b oasb-1 -l L3 # Hardened (46 controls)
279
+ | # | Category | Controls |
280
+ |---|----------|----------|
281
+ | 1 | Identity & Provenance | 4 |
282
+ | 2 | Capability & Authorization | 5 |
283
+ | 3 | Input Security | 5 |
284
+ | 4 | Output Security | 4 |
285
+ | 5 | Credential Protection | 5 |
286
+ | 6 | Supply Chain Integrity | 5 |
287
+ | 7 | Agent-to-Agent Security | 4 |
288
+ | 8 | Memory & Context Integrity | 4 |
289
+ | 9 | Operational Security | 5 |
290
+ | 10 | Monitoring & Response | 5 |
271
291
 
272
- # Verbose see every control with pass/fail/unverified status
273
- hackmyagent secure -b oasb-1 -v
292
+ **Maturity levels:** L1 Essential (26 controls), L2 Standard (44), L3 Hardened (46).
274
293
 
275
- # Filter by category
276
- hackmyagent secure -b oasb-1 --category "Credential Protection"
294
+ **Ratings:** Certified (100%), Compliant (L1=100% + L2>=90%), Passing (>=90%), Needs Improvement (>=70%), Failing (<70%).
277
295
 
278
- # Output formats
279
- hackmyagent secure -b oasb-1 -f json
280
- hackmyagent secure -b oasb-1 -f sarif -o results.sarif
281
- hackmyagent secure -b oasb-1 -f html -o report.html
282
- hackmyagent secure -b oasb-1 -f asp -o profile.asp.json
296
+ </details>
283
297
 
284
- # CI/CD gate exit 1 if compliance is below threshold
285
- hackmyagent secure -b oasb-1 --fail-below 70
286
- ```
298
+ Output formats: `text`, `json`, `sarif`, `html`, `asp` (Agent Security Profile).
287
299
 
288
- **OASB-1 Categories (46 controls):**
289
-
290
- | # | Category | Controls | What it checks |
291
- |---|----------|----------|----------------|
292
- | 1 | Identity & Provenance | 4 | Cryptographic identity, ownership, provenance chain |
293
- | 2 | Capability & Authorization | 5 | Least privilege, capability boundaries, human-in-the-loop |
294
- | 3 | Input Security | 5 | Prompt injection, input validation, URL/SSRF protection |
295
- | 4 | Output Security | 4 | Output validation, destructive op confirmation, exfiltration prevention |
296
- | 5 | Credential Protection | 5 | Hardcoded secrets, context window isolation, log redaction |
297
- | 6 | Supply Chain Integrity | 5 | Dependency scanning, lockfiles, rug pull protection, SBOM |
298
- | 7 | Agent-to-Agent Security | 4 | Mutual auth, message integrity, trust boundaries |
299
- | 8 | Memory & Context Integrity | 4 | Context injection, memory isolation, summarization security |
300
- | 9 | Operational Security | 5 | Non-root execution, sandboxing, network isolation, resource limits |
301
- | 10 | Monitoring & Response | 5 | Security logging, anomaly detection, kill switch, incident response |
302
-
303
- **Maturity Levels:**
304
-
305
- | Level | Controls | Purpose |
306
- |-------|----------|---------|
307
- | L1 - Essential | 26 | Baseline security every agent should meet |
308
- | L2 - Standard | 44 (L1 + 18) | Production-grade agent security |
309
- | L3 - Hardened | 46 (L2 + 2) | High-security environments, multi-modal threats |
310
-
311
- **Rating System:**
312
-
313
- | Rating | L1 Criteria | L2 Criteria | L3 Criteria |
314
- |--------|-------------|-------------|-------------|
315
- | Certified | 100% | L1=100% + L2=100% | All 100% |
316
- | Compliant | — | L1=100% + L2≥90% | L1=100% + L2≥90% |
317
- | Passing | ≥90% | L1≥90% | L1≥90% |
318
- | Needs Improvement | ≥70% | L1≥70% | L1≥70% |
319
- | Failing | <70% | L1<70% | L1<70% |
320
-
321
- **Output Formats:**
322
- - `text` — Terminal report with category breakdown (default)
323
- - `json` — Machine-readable JSON with full control details
324
- - `sarif` — SARIF 2.1.0 for GitHub Security tab and IDE integration
325
- - `html` — Standalone HTML report with donut chart, radar chart, and grades
326
- - `asp` — Agent Security Profile (portable security posture document)
327
-
328
- **Exit Codes:**
329
- - `0` — Rating is Passing or better (or compliance above `--fail-below` threshold)
330
- - `1` — Rating is Failing or Needs Improvement (or compliance below threshold)
300
+ ---
331
301
 
332
302
  ### `hackmyagent secure-openclaw`
333
303
 
334
- Scan OpenClaw/Moltbot installations with 47 specialized security checks and auto-remediation.
304
+ 47 specialized checks for OpenClaw/Moltbot installations.
335
305
 
336
306
  ```bash
337
- hackmyagent secure-openclaw # scan default location
338
- hackmyagent secure-openclaw ~/.moltbot # scan specific directory
339
- hackmyagent secure-openclaw --fix # auto-fix gateway misconfigurations
340
- hackmyagent secure-openclaw --fix --dry-run # preview fixes
341
- hackmyagent secure-openclaw --json # JSON output for CI/CD
307
+ hackmyagent secure-openclaw # scan default location
308
+ hackmyagent secure-openclaw ~/.moltbot # specific directory
309
+ hackmyagent secure-openclaw --fix # auto-fix gateway configs
310
+ hackmyagent secure-openclaw --fix --dry-run # preview fixes
311
+ hackmyagent secure-openclaw --json # JSON output
342
312
  ```
343
313
 
344
- **Detects:**
345
- - CVE-2026-25253 vulnerable versions (before v2026.1.29)
346
- - Missing `controlUi.allowedOrigins` (patch alone isn't enough)
347
- - ClawHavoc C2 IP addresses and malware filenames
348
- - ClickFix social engineering patterns
349
- - Unsigned/malicious skills (ClawHavoc campaign patterns)
350
- - Reverse shell backdoors
351
- - Credential exfiltration (wallets, SSH keys, API keys)
352
- - Heartbeat/cron abuse
353
- - Gateway misconfigurations (GHSA-g8p2 vulnerability)
354
- - Disabled sandbox/approval confirmations
355
-
356
- **Auto-Fix (with `--fix`):**
357
- | Check | Before | After |
358
- |-------|--------|-------|
359
- | GATEWAY-001 | `0.0.0.0` | `127.0.0.1` (local-only) |
360
- | GATEWAY-003 | Plaintext token | `${OPENCLAW_AUTH_TOKEN}` env var |
361
- | GATEWAY-004 | Approvals disabled | Approvals enabled |
362
- | GATEWAY-005 | Sandbox disabled | Sandbox enabled |
363
-
364
- **Check Categories:**
365
- | Category | Checks | Description |
366
- |----------|--------|-------------|
367
- | SKILL | 12 | Malicious skill detection |
368
- | HEARTBEAT | 6 | Heartbeat/cron abuse |
369
- | GATEWAY | 8 | Gateway misconfigurations (4 auto-fixable) |
370
- | CONFIG | 9 | Insecure settings |
371
- | SUPPLY | 8 | Supply chain attacks |
372
- | CVE | 4 | OpenClaw CVE detection |
314
+ Detects: CVE-2026-25253, ClawHavoc IOCs, reverse shells, credential exfiltration, gateway misconfigs, disabled sandbox.
373
315
 
374
316
  See [SECURITY_CHECKS.md](docs/SECURITY_CHECKS.md#openclaw-security-checks) for full documentation.
375
317
 
318
+ ---
319
+
376
320
  ### `hackmyagent rollback`
377
321
 
378
- Undo auto-fix changes.
322
+ Undo auto-fix changes. Backups are created automatically in `.hackmyagent-backup/`.
379
323
 
380
324
  ```bash
381
- hackmyagent rollback # rollback current directory
382
- hackmyagent rollback ./my-project # rollback specific directory
325
+ hackmyagent rollback # rollback current directory
326
+ hackmyagent rollback ./my-project # rollback specific directory
327
+ ```
328
+
329
+ ---
330
+
331
+ ## Plugin Architecture
332
+
333
+ HackMyAgent uses a modular plugin system built on [`@opena2a/plugin-core`](packages/plugin-core). Each plugin implements `scan()` to detect issues and `fix()` to remediate them.
334
+
335
+ ### Packages
336
+
337
+ | Package | npm | Description |
338
+ |---------|-----|-------------|
339
+ | [`@opena2a/plugin-core`](packages/plugin-core) | — | Plugin interface, registry, shared types |
340
+ | [`@opena2a/aim-core`](packages/aim-core) | — | Ed25519 identity, audit logging, capability policy, trust scoring |
341
+ | [`@opena2a/secretless-openclaw`](packages/secretless-openclaw) | — | Credential scanning (10 patterns), env var replacement, AES-256-GCM store |
342
+ | [`@opena2a/signcrypt-openclaw`](packages/signcrypt-openclaw) | — | Ed25519 file signing, SHA-256 hash pinning, signature verification |
343
+ | [`@opena2a/skillguard-openclaw`](packages/skillguard-openclaw) | — | Permission pinning, tamper detection, dangerous pattern scanning |
344
+
345
+ ### Writing a Plugin
346
+
347
+ ```typescript
348
+ import type {
349
+ OpenA2APlugin,
350
+ PluginMetadata,
351
+ PluginStatus,
352
+ Finding,
353
+ Remediation,
354
+ FixOptions,
355
+ PluginInitOptions,
356
+ } from '@opena2a/plugin-core';
357
+
358
+ export const metadata: PluginMetadata = {
359
+ packageName: '@my-org/my-plugin',
360
+ displayName: 'My Plugin',
361
+ description: 'Detects and fixes X',
362
+ version: '1.0.0',
363
+ findings: ['MY-001', 'MY-002'],
364
+ scoreImprovement: 10,
365
+ };
366
+
367
+ export class MyPlugin implements OpenA2APlugin {
368
+ readonly metadata = metadata;
369
+
370
+ async init(options?: PluginInitOptions): Promise<void> {
371
+ // Access AIM Core for identity-aware audit logging:
372
+ // const aimCore = options?.aimCore;
373
+ }
374
+
375
+ async scan(agentDir: string): Promise<Finding[]> {
376
+ // Scan the agent directory and return findings
377
+ return [
378
+ {
379
+ id: 'MY-001',
380
+ title: 'Insecure widget detected',
381
+ description: 'Widget at config.json line 12 uses plaintext.',
382
+ severity: 'high', // critical | high | medium | low
383
+ filePath: 'config.json',
384
+ line: 12,
385
+ autoFixable: true,
386
+ },
387
+ ];
388
+ }
389
+
390
+ async fix(agentDir: string, options?: FixOptions): Promise<Remediation[]> {
391
+ if (options?.dryRun) {
392
+ // Return what would be fixed without modifying files
393
+ return [{ findingId: 'MY-001', description: 'Would encrypt widget', filesModified: ['config.json'], rollbackAvailable: false }];
394
+ }
395
+
396
+ // Apply fixes and return what was changed
397
+ return [{ findingId: 'MY-001', description: 'Encrypted widget', filesModified: ['config.json'], rollbackAvailable: false }];
398
+ }
399
+
400
+ async status(): Promise<PluginStatus> {
401
+ return { name: metadata.displayName, version: metadata.version, active: true, findingsCount: 0 };
402
+ }
403
+
404
+ async uninstall(): Promise<void> {}
405
+ }
406
+
407
+ export function createPlugin(): MyPlugin {
408
+ return new MyPlugin();
409
+ }
383
410
  ```
384
411
 
385
- Backups are automatically created in `.hackmyagent-backup/` with timestamps.
412
+ Register the plugin in `@opena2a/plugin-core`:
413
+
414
+ ```typescript
415
+ import { registerPlugin } from '@opena2a/plugin-core';
416
+ import { createPlugin, metadata } from '@my-org/my-plugin';
417
+
418
+ registerPlugin({
419
+ metadata,
420
+ factory: createPlugin,
421
+ });
422
+ ```
423
+
424
+ ### Trust Score
425
+
426
+ AIM Core provides an 8-factor weighted trust score (0.0 to 1.0) for each agent:
427
+
428
+ | Factor | Weight | What it measures |
429
+ |--------|--------|------------------|
430
+ | `identity` | 0.20 | Ed25519 keypair exists and is valid |
431
+ | `capabilities` | 0.15 | Capabilities declared and pinned |
432
+ | `secretsManaged` | 0.15 | No hardcoded credentials |
433
+ | `auditLog` | 0.10 | Audit trail active |
434
+ | `configSigned` | 0.10 | Configuration integrity verified |
435
+ | `skillsVerified` | 0.10 | Skills cryptographically signed |
436
+ | `networkControlled` | 0.10 | Network access restricted |
437
+ | `heartbeatMonitored` | 0.10 | Heartbeat monitoring active |
438
+
439
+ Use `--with-aim` in `fix-all` to generate trust scores.
440
+
441
+ ---
386
442
 
387
443
  ## CI/CD Integration
388
444
 
389
445
  ### GitHub Actions
390
446
 
391
447
  ```yaml
392
- name: Security Scan
448
+ name: Agent Security
393
449
  on: [push, pull_request]
394
-
395
450
  jobs:
396
- security:
451
+ scan:
397
452
  runs-on: ubuntu-latest
398
453
  steps:
399
454
  - uses: actions/checkout@v4
400
455
  - uses: actions/setup-node@v4
401
- with:
402
- node-version: '20'
456
+ with: { node-version: '20' }
403
457
  - run: npx hackmyagent secure --json > security-report.json
458
+ - run: npx hackmyagent fix-all --scan-only --json > plugin-report.json
404
459
  - uses: actions/upload-artifact@v4
405
- with:
406
- name: security-report
407
- path: security-report.json
460
+ with: { name: security-reports, path: '*.json' }
408
461
  ```
409
462
 
410
- ### GitHub Actions with Attack Mode (SARIF)
463
+ ### SARIF (GitHub Security Tab)
411
464
 
412
465
  ```yaml
413
- name: AI Agent Security
414
- on: [push, pull_request]
415
-
416
- jobs:
417
- attack-scan:
418
- runs-on: ubuntu-latest
419
- steps:
420
- - uses: actions/checkout@v4
421
- - uses: actions/setup-node@v4
422
- with:
423
- node-version: '20'
424
- - name: Run attack simulation
425
- run: npx hackmyagent attack --local -f sarif -o attack-results.sarif --fail-on-vulnerable medium
426
- - name: Upload SARIF to GitHub Security
427
- uses: github/codeql-action/upload-sarif@v3
428
- with:
429
- sarif_file: attack-results.sarif
430
-
431
- benchmark:
432
- runs-on: ubuntu-latest
433
- steps:
434
- - uses: actions/checkout@v4
435
- - uses: actions/setup-node@v4
436
- with:
437
- node-version: '20'
438
- - name: Run OASB-1 benchmark
439
- run: npx hackmyagent secure -b oasb-1 --fail-below 70
466
+ - run: npx hackmyagent attack --local -f sarif -o results.sarif --fail-on-vulnerable medium
467
+ - uses: github/codeql-action/upload-sarif@v3
468
+ with: { sarif_file: results.sarif }
440
469
  ```
441
470
 
442
471
  ### Pre-commit Hook
443
472
 
444
473
  ```bash
445
- # .git/hooks/pre-commit
446
474
  #!/bin/sh
475
+ # .git/hooks/pre-commit
447
476
  npx hackmyagent secure --ignore LOG-001,RATE-001
448
477
  ```
449
478
 
450
- ### JSON Output
451
-
452
- All commands support `--json` for machine-readable output:
479
+ ### JSON Piping
453
480
 
454
481
  ```bash
482
+ # Filter critical findings
455
483
  hackmyagent secure --json | jq '.findings[] | select(.severity == "critical")'
456
- ```
457
-
458
- ## Supported Platforms
459
484
 
460
- - **Claude Code** - CLAUDE.md, skills, MCP servers
461
- - **Cursor** - .cursor/ rules, MCP configurations
462
- - **VSCode** - .vscode/mcp.json configurations
463
- - **Generic MCP** - Any MCP server setup
485
+ # Count issues by category
486
+ hackmyagent secure --json | jq '[.findings[].id | split("-")[0]] | group_by(.) | map({(.[0]): length}) | add'
487
+ ```
464
488
 
465
- ## Security Check Reference
489
+ ---
466
490
 
467
- For the complete list of 147+ security checks with descriptions and remediation guidance, see [SECURITY_CHECKS.md](docs/SECURITY_CHECKS.md).
491
+ ## Exit Codes
468
492
 
469
- ## Auto-Fix Capabilities
493
+ | Code | Meaning | Commands |
494
+ |------|---------|----------|
495
+ | `0` | Clean — no critical/high issues | All commands |
496
+ | `1` | Critical or high severity issues remain after scan/fix | `secure`, `fix-all`, `attack` |
497
+ | `2` | Incomplete scan — one or more plugins failed to run | `fix-all` |
470
498
 
471
- The following issues can be automatically fixed with `--fix`:
499
+ ---
472
500
 
473
- **General (`hackmyagent secure --fix`):**
474
- | Check ID | Issue | Auto-Fix Action |
475
- |----------|-------|-----------------|
476
- | CRED-001 | Exposed API keys | Replace with env var reference |
477
- | GIT-001 | Missing .gitignore | Create with secure defaults |
478
- | GIT-002 | Incomplete .gitignore | Add missing patterns |
479
- | PERM-001 | Overly permissive files | Set restrictive permissions |
480
- | MCP-001 | Root filesystem access | Scope to project directory |
481
- | NET-001 | Bound to 0.0.0.0 | Bind to 127.0.0.1 |
501
+ ## Supported Platforms
482
502
 
483
- **OpenClaw (`hackmyagent secure-openclaw --fix`):**
484
- | Check ID | Issue | Auto-Fix Action |
485
- |----------|-------|-----------------|
486
- | GATEWAY-001 | Bound to 0.0.0.0 | Bind to 127.0.0.1 |
487
- | GATEWAY-003 | Plaintext token in config | Replace with `${OPENCLAW_AUTH_TOKEN}` |
488
- | GATEWAY-004 | Approvals disabled | Enable approval confirmations |
489
- | GATEWAY-005 | Sandbox disabled | Enable sandbox mode |
503
+ | Platform | What HackMyAgent scans |
504
+ |----------|------------------------|
505
+ | **Claude Code** | CLAUDE.md, skills, MCP server configs |
506
+ | **Cursor** | .cursor/ rules, MCP configurations |
507
+ | **VS Code** | .vscode/mcp.json configurations |
508
+ | **Windsurf** | IDE configurations |
509
+ | **Generic MCP** | Any MCP server setup |
490
510
 
491
- Always use `--dry-run` first to preview changes. Backups are created automatically.
511
+ ---
492
512
 
493
513
  ## Environment Variables
494
514
 
@@ -497,44 +517,39 @@ Always use `--dry-run` first to preview changes. Backups are created automatical
497
517
  | `NO_COLOR` | Disable colored output |
498
518
  | `HACKMYAGENT_TIMEOUT` | Default timeout for scans (ms) |
499
519
 
500
- ## Test Fixtures
501
-
502
- Sample projects with intentional security issues for testing:
503
-
504
- ```bash
505
- # Test the scanner against example projects
506
- npx hackmyagent secure test-fixtures/insecure-api # Score: 27/100
507
- npx hackmyagent secure test-fixtures/insecure-mcp # Score: 0/100
508
- npx hackmyagent secure test-fixtures/insecure-library # Score: 60/100
509
- npx hackmyagent secure test-fixtures/clean-project # Score: 100/100
510
-
511
- # Test auto-fix
512
- npx hackmyagent secure test-fixtures/insecure-api --fix
513
- ```
514
-
515
- See [test-fixtures/README.md](test-fixtures/README.md) for details.
520
+ ---
516
521
 
517
522
  ## Contributing
518
523
 
519
- Contributions welcome! See [CONTRIBUTING.md](CONTRIBUTING.md) for guidelines.
524
+ Contributions welcome. See [CONTRIBUTING.md](CONTRIBUTING.md).
520
525
 
521
526
  ```bash
522
- # Development setup
523
527
  git clone https://github.com/opena2a-org/hackmyagent.git
524
528
  cd hackmyagent
525
529
  npm install
526
- npm run build
527
- npm test
530
+ npx turbo build # build all 7 packages
531
+ npx turbo test # run 501 tests
528
532
  ```
529
533
 
530
- ## License
534
+ ### Monorepo Structure
531
535
 
532
- Apache-2.0
536
+ ```
537
+ packages/
538
+ cli/ # CLI entry point (hackmyagent command)
539
+ core/ # Scanner engine (147+ checks)
540
+ aim-core/ # Ed25519 identity, audit, policy, trust
541
+ plugin-core/ # Plugin interface and registry
542
+ secretless-openclaw/ # Credential scanner plugin
543
+ signcrypt-openclaw/ # Signing and hash pinning plugin
544
+ skillguard-openclaw/ # Permission and pattern scanner plugin
545
+ ```
533
546
 
534
547
  ---
535
548
 
536
- ## Secure What You Find
549
+ ## License
537
550
 
538
- HackMyAgent finds vulnerabilities. **[AIM](https://github.com/opena2a-org/agent-identity-management)** fixes them — the open-source NHI platform for AI agents with cryptographic identity, governance, and access control.
551
+ Apache-2.0
552
+
553
+ ---
539
554
 
540
- [Get started with AIM](https://opena2a.org/docs/quick-start) | [Learn about NHI governance](https://opena2a.org/nhi)
555
+ Built by [OpenA2A](https://opena2a.org). HackMyAgent finds vulnerabilities. [AIM](https://github.com/opena2a-org/agent-identity-management) manages identity and access.