hackmyagent 0.4.3 → 0.5.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 CHANGED
@@ -1,154 +1,191 @@
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
+ **Find it. Break it. Fix it.**
7
8
 
8
- **Website:** [hackmyagent.com](https://hackmyagent.com) Scan external infrastructure for exposed MCP endpoints, configs, and credentials
9
+ The hacker's toolkit for AI agents. 147 security checks, 55 attack payloads, auto-fix with rollback, and OASB benchmark compliance. Scans Claude Code, Cursor, VS Code, 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 # add agent identity + audit logging
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 30 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 30 security categories</summary>
81
+
82
+ | Category | Checks | What it detects |
83
+ |----------|--------|-----------------|
84
+ | CRED | 4 | Hardcoded API keys, tokens, passwords |
85
+ | MCP | 10 | MCP server misconfigurations |
86
+ | CLAUDE | 7 | 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
+ | DEP | 4 | Vulnerable dependencies |
97
+ | ENV | 4 | Insecure environment variables |
98
+ | GIT | 3 | Git security (gitignore, hooks) |
99
+ | IO | 4 | Input/output validation |
100
+ | LOG | 4 | Logging and monitoring gaps |
101
+ | PERM | 3 | 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 | 2 | VS Code configuration risks |
107
+ | CURSOR | 1 | 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 |
73
114
 
74
- # Scan specific directory
75
- hackmyagent secure ./my-project
115
+ </details>
76
116
 
77
- # Auto-fix issues
78
- hackmyagent secure --fix
117
+ <details>
118
+ <summary>Auto-fix capabilities</summary>
79
119
 
80
- # Preview fixes without applying
81
- hackmyagent secure --fix --dry-run
120
+ **General (`hackmyagent secure --fix`):**
121
+
122
+ | Check | Issue | Auto-fix |
123
+ |-------|-------|----------|
124
+ | CRED-001 | Exposed API keys | Replace with env var reference |
125
+ | GIT-001 | Missing .gitignore | Create with secure defaults |
126
+ | GIT-002 | Incomplete .gitignore | Add missing patterns |
127
+ | PERM-001 | Overly permissive files | Set restrictive permissions |
128
+ | MCP-001 | Root filesystem access | Scope to project directory |
129
+ | NET-001 | Bound to 0.0.0.0 | Bind to 127.0.0.1 |
130
+
131
+ **OpenClaw (`hackmyagent secure-openclaw --fix`):**
132
+
133
+ | Check | Issue | Auto-fix |
134
+ |-------|-------|----------|
135
+ | GATEWAY-001 | Bound to 0.0.0.0 | Bind to 127.0.0.1 |
136
+ | GATEWAY-003 | Plaintext token | Replace with `${OPENCLAW_AUTH_TOKEN}` |
137
+ | GATEWAY-004 | Approvals disabled | Enable approvals |
138
+ | GATEWAY-005 | Sandbox disabled | Enable sandbox |
139
+
140
+ Use `--dry-run` first to preview changes. Backups are created automatically in `.hackmyagent-backup/`.
141
+
142
+ </details>
143
+
144
+ ---
82
145
 
83
- # Skip specific checks
84
- hackmyagent secure --ignore CRED-001,GIT-002
146
+ ### `hackmyagent fix-all`
85
147
 
86
- # JSON output for CI/CD
87
- hackmyagent secure --json
148
+ Run all OpenA2A security plugins in sequence: scan, fix, report.
88
149
 
89
- # Show all checks (including passed)
90
- hackmyagent secure --verbose
150
+ ```bash
151
+ hackmyagent fix-all # scan and fix current directory
152
+ hackmyagent fix-all ./my-agent # target specific directory
153
+ hackmyagent fix-all --dry-run # preview without applying
154
+ hackmyagent fix-all --scan-only # scan only, no fixes
155
+ hackmyagent fix-all --json # JSON output for CI
156
+ hackmyagent fix-all --with-aim # enable AIM identity + audit logging
157
+ hackmyagent fix-all -v # verbose output
91
158
  ```
92
159
 
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 |
160
+ **Plugin execution order:**
161
+
162
+ | # | Plugin | What it does |
163
+ |---|--------|--------------|
164
+ | 1 | **SkillGuard** | Hash pinning, tamper detection, dangerous pattern scanning (reverse shells, exfil, prompt injection) |
165
+ | 2 | **SignCrypt** | Ed25519 signing of SKILL.md and HEARTBEAT.md, SHA-256 hash pinning, signature verification |
166
+ | 3 | **Secretless** | Credential detection (10 patterns), env var replacement, AES-256-GCM encrypted store |
128
167
 
129
- **Exit Codes:**
130
- - `0` - No critical/high issues
131
- - `1` - Critical or high severity issues found
168
+ **`--with-aim` adds:**
169
+ - Ed25519 identity generation for the agent
170
+ - Cryptographic audit log at `.opena2a/aim/audit.jsonl`
171
+ - Capability policy enforcement via `policy.yaml`
172
+ - 8-factor trust scoring
173
+
174
+ ---
132
175
 
133
176
  ### `hackmyagent check`
134
177
 
135
- Verify a skill's safety before installing.
178
+ Verify a skill before installing it.
136
179
 
137
180
  ```bash
138
181
  hackmyagent check @publisher/skill-name
139
- hackmyagent check @anthropic/claude-mcp --verbose
140
182
  hackmyagent check @publisher/skill --json
141
- hackmyagent check @publisher/skill --offline # skip DNS verification
183
+ hackmyagent check @publisher/skill --offline # skip DNS verification
142
184
  ```
143
185
 
144
- **Checks performed:**
145
- - Publisher identity via DNS TXT records
146
- - Permissions requested (filesystem, network, shell access)
147
- - Revocation status against global blocklist
186
+ Checks: publisher identity (DNS TXT), permissions requested, revocation status.
148
187
 
149
- **Note:** Only scan systems you own or have permission to test.
150
-
151
- **Risk Levels:** `low`, `medium`, `high`, `critical`
188
+ ---
152
189
 
153
190
  ### `hackmyagent scan`
154
191
 
@@ -157,70 +194,45 @@ Scan external infrastructure for exposed AI agent endpoints.
157
194
  ```bash
158
195
  hackmyagent scan example.com
159
196
  hackmyagent scan 192.168.1.100 -p 3000,8080
160
- hackmyagent scan example.com --verbose
161
197
  hackmyagent scan example.com --json
162
198
  ```
163
199
 
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"
200
+ Detects: exposed MCP SSE/tools endpoints, public configs, API keys in responses, debug interfaces.
180
201
 
181
- # Test an API endpoint
182
- hackmyagent attack https://api.example.com/v1/chat
183
- hackmyagent attack https://api.example.com --api-format anthropic
202
+ Scoring: A (90-100), B (80-89), C (70-79), D (60-69), F (<60).
184
203
 
185
- # Filter by category or intensity
186
- hackmyagent attack --local --category prompt-injection
187
- hackmyagent attack --local --intensity aggressive
204
+ > Only scan systems you own or have written authorization to test.
188
205
 
189
- # Custom payloads from a JSON file
190
- hackmyagent attack https://api.example.com --payload-file custom.json
206
+ ---
191
207
 
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
208
+ ### `hackmyagent attack`
196
209
 
197
- # Output formats
198
- hackmyagent attack --local -f json
199
- hackmyagent attack --local -f sarif -o results.sarif
210
+ Red team your AI agent with 55 adversarial payloads across 5 categories.
200
211
 
201
- # Verbose mode (show each payload result)
202
- hackmyagent attack --local --verbose
212
+ ```bash
213
+ hackmyagent attack --local # local simulation
214
+ hackmyagent attack --local --system-prompt "You are helpful" # with custom prompt
215
+ hackmyagent attack https://api.example.com/v1/chat # test live endpoint
216
+ hackmyagent attack --local --category prompt-injection # single category
217
+ hackmyagent attack --local --intensity aggressive # full suite
218
+ hackmyagent attack --local -f sarif -o results.sarif # SARIF output
219
+ hackmyagent attack https://api.example.com --fail-on-vulnerable medium # CI gate
203
220
  ```
204
221
 
205
- **Attack Categories:**
222
+ <details>
223
+ <summary>Attack categories and custom payloads</summary>
206
224
 
207
225
  | Category | Payloads | Description |
208
226
  |----------|----------|-------------|
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 |
227
+ | `prompt-injection` | 12 | Manipulate agent behavior via injected instructions |
228
+ | `jailbreak` | 12 | Bypass safety guardrails and system constraints |
229
+ | `data-exfiltration` | 11 | Extract sensitive data, system prompts, credentials |
230
+ | `capability-abuse` | 10 | Misuse agent tools for unintended actions |
213
231
  | `context-manipulation` | 10 | Poison agent context or memory |
214
232
 
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 |
233
+ Intensity: `passive` (observation only), `active` (default), `aggressive` (full suite).
222
234
 
223
- **Custom Payload File Format:**
235
+ **Custom payloads:** Create a JSON file and pass with `--payload-file custom.json`:
224
236
 
225
237
  ```json
226
238
  {
@@ -239,302 +251,302 @@ hackmyagent attack --local --verbose
239
251
  }
240
252
  ```
241
253
 
242
- Only `id` and `payload` are required. See `--help` for all defaults.
254
+ Only `id` and `payload` are required.
243
255
 
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
256
+ </details>
249
257
 
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
258
+ Output formats: `text`, `json`, `sarif` (GitHub Security tab), `html`.
259
+
260
+ ---
255
261
 
256
262
  ### `hackmyagent secure --benchmark`
257
263
 
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.
264
+ Run the [OASB-1](https://oasb.ai/oasb-1) (Open Agent Security Benchmark) — 46 controls across 10 categories.
259
265
 
260
266
  ```bash
261
- # Run benchmark (L1 by default)
262
- hackmyagent secure --benchmark oasb-1
267
+ hackmyagent secure -b oasb-1 # L1 baseline (26 controls)
268
+ hackmyagent secure -b oasb-1 -l L2 # L2 standard (44 controls)
269
+ hackmyagent secure -b oasb-1 -l L3 # L3 hardened (46 controls)
270
+ hackmyagent secure -b oasb-1 -v # verbose (every control)
271
+ hackmyagent secure -b oasb-1 -f html -o report.html # HTML report
272
+ hackmyagent secure -b oasb-1 --fail-below 70 # CI gate
273
+ ```
263
274
 
264
- # Target specific directory
265
- hackmyagent secure ./my-project --benchmark oasb-1
275
+ <details>
276
+ <summary>OASB-1 categories and maturity levels</summary>
266
277
 
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)
278
+ | # | Category | Controls |
279
+ |---|----------|----------|
280
+ | 1 | Identity & Provenance | 4 |
281
+ | 2 | Capability & Authorization | 5 |
282
+ | 3 | Input Security | 5 |
283
+ | 4 | Output Security | 4 |
284
+ | 5 | Credential Protection | 5 |
285
+ | 6 | Supply Chain Integrity | 5 |
286
+ | 7 | Agent-to-Agent Security | 4 |
287
+ | 8 | Memory & Context Integrity | 4 |
288
+ | 9 | Operational Security | 5 |
289
+ | 10 | Monitoring & Response | 5 |
271
290
 
272
- # Verbose see every control with pass/fail/unverified status
273
- hackmyagent secure -b oasb-1 -v
291
+ **Maturity levels:** L1 Essential (26 controls), L2 Standard (44), L3 Hardened (46).
274
292
 
275
- # Filter by category
276
- hackmyagent secure -b oasb-1 --category "Credential Protection"
293
+ **Ratings:** Certified (100%), Compliant (L1=100% + L2>=90%), Passing (>=90%), Needs Improvement (>=70%), Failing (<70%).
277
294
 
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
295
+ </details>
283
296
 
284
- # CI/CD gate exit 1 if compliance is below threshold
285
- hackmyagent secure -b oasb-1 --fail-below 70
286
- ```
297
+ Output formats: `text`, `json`, `sarif`, `html`, `asp` (Agent Security Profile).
287
298
 
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)
299
+ ---
331
300
 
332
301
  ### `hackmyagent secure-openclaw`
333
302
 
334
- Scan OpenClaw/Moltbot installations with 47 specialized security checks and auto-remediation.
303
+ 47 specialized checks for OpenClaw/Moltbot installations.
335
304
 
336
305
  ```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
306
+ hackmyagent secure-openclaw # scan default location
307
+ hackmyagent secure-openclaw ~/.moltbot # specific directory
308
+ hackmyagent secure-openclaw --fix # auto-fix gateway configs
309
+ hackmyagent secure-openclaw --fix --dry-run # preview fixes
310
+ hackmyagent secure-openclaw --json # JSON output
342
311
  ```
343
312
 
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 |
313
+ Detects: CVE-2026-25253, ClawHavoc IOCs, reverse shells, credential exfiltration, gateway misconfigs, disabled sandbox.
373
314
 
374
315
  See [SECURITY_CHECKS.md](docs/SECURITY_CHECKS.md#openclaw-security-checks) for full documentation.
375
316
 
317
+ ---
318
+
376
319
  ### `hackmyagent rollback`
377
320
 
378
- Undo auto-fix changes.
321
+ Undo auto-fix changes. Backups are created automatically in `.hackmyagent-backup/`.
379
322
 
380
323
  ```bash
381
- hackmyagent rollback # rollback current directory
382
- hackmyagent rollback ./my-project # rollback specific directory
324
+ hackmyagent rollback # rollback current directory
325
+ hackmyagent rollback ./my-project # rollback specific directory
326
+ ```
327
+
328
+ ---
329
+
330
+ ## Plugin Architecture
331
+
332
+ 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.
333
+
334
+ ### Packages
335
+
336
+ | Package | npm | Description |
337
+ |---------|-----|-------------|
338
+ | [`@opena2a/plugin-core`](packages/plugin-core) | — | Plugin interface, registry, shared types |
339
+ | [`@opena2a/aim-core`](packages/aim-core) | — | Ed25519 identity, audit logging, capability policy, trust scoring |
340
+ | [`@opena2a/secretless-openclaw`](packages/secretless-openclaw) | — | Credential scanning (10 patterns), env var replacement, AES-256-GCM store |
341
+ | [`@opena2a/signcrypt-openclaw`](packages/signcrypt-openclaw) | — | Ed25519 file signing, SHA-256 hash pinning, signature verification |
342
+ | [`@opena2a/skillguard-openclaw`](packages/skillguard-openclaw) | — | Permission pinning, tamper detection, dangerous pattern scanning |
343
+
344
+ ### Writing a Plugin
345
+
346
+ ```typescript
347
+ import type {
348
+ OpenA2APlugin,
349
+ PluginMetadata,
350
+ PluginStatus,
351
+ Finding,
352
+ Remediation,
353
+ FixOptions,
354
+ PluginInitOptions,
355
+ } from '@opena2a/plugin-core';
356
+
357
+ export const metadata: PluginMetadata = {
358
+ packageName: '@my-org/my-plugin',
359
+ displayName: 'My Plugin',
360
+ description: 'Detects and fixes X',
361
+ version: '1.0.0',
362
+ findings: ['MY-001', 'MY-002'],
363
+ scoreImprovement: 10,
364
+ };
365
+
366
+ export class MyPlugin implements OpenA2APlugin {
367
+ readonly metadata = metadata;
368
+
369
+ async init(options?: PluginInitOptions): Promise<void> {
370
+ // Access AIM Core for identity-aware audit logging:
371
+ // const aimCore = options?.aimCore;
372
+ }
373
+
374
+ async scan(agentDir: string): Promise<Finding[]> {
375
+ // Scan the agent directory and return findings
376
+ return [
377
+ {
378
+ id: 'MY-001',
379
+ title: 'Insecure widget detected',
380
+ description: 'Widget at config.json line 12 uses plaintext.',
381
+ severity: 'high', // critical | high | medium | low
382
+ filePath: 'config.json',
383
+ line: 12,
384
+ autoFixable: true,
385
+ },
386
+ ];
387
+ }
388
+
389
+ async fix(agentDir: string, options?: FixOptions): Promise<Remediation[]> {
390
+ if (options?.dryRun) {
391
+ // Return what would be fixed without modifying files
392
+ return [{ findingId: 'MY-001', description: 'Would encrypt widget', filesModified: ['config.json'], rollbackAvailable: false }];
393
+ }
394
+
395
+ // Apply fixes and return what was changed
396
+ return [{ findingId: 'MY-001', description: 'Encrypted widget', filesModified: ['config.json'], rollbackAvailable: false }];
397
+ }
398
+
399
+ async status(): Promise<PluginStatus> {
400
+ return { name: metadata.displayName, version: metadata.version, active: true, findingsCount: 0 };
401
+ }
402
+
403
+ async uninstall(): Promise<void> {}
404
+ }
405
+
406
+ export function createPlugin(): MyPlugin {
407
+ return new MyPlugin();
408
+ }
383
409
  ```
384
410
 
385
- Backups are automatically created in `.hackmyagent-backup/` with timestamps.
411
+ Register the plugin in `@opena2a/plugin-core`:
412
+
413
+ ```typescript
414
+ import { registerPlugin } from '@opena2a/plugin-core';
415
+ import { createPlugin, metadata } from '@my-org/my-plugin';
416
+
417
+ registerPlugin({
418
+ metadata,
419
+ create: createPlugin,
420
+ });
421
+ ```
422
+
423
+ ### Trust Score
424
+
425
+ AIM Core provides an 8-factor weighted trust score (0.0 to 1.0) for each agent:
426
+
427
+ | Factor | Weight | What it measures |
428
+ |--------|--------|------------------|
429
+ | `identity` | 0.20 | Ed25519 keypair exists and is valid |
430
+ | `capabilities` | 0.15 | Capabilities declared and pinned |
431
+ | `secretsManaged` | 0.15 | No hardcoded credentials |
432
+ | `auditLog` | 0.10 | Audit trail active |
433
+ | `configSigned` | 0.10 | Configuration integrity verified |
434
+ | `skillsVerified` | 0.10 | Skills cryptographically signed |
435
+ | `networkControlled` | 0.10 | Network access restricted |
436
+ | `heartbeatMonitored` | 0.10 | Heartbeat monitoring active |
437
+
438
+ Use `--with-aim` in `fix-all` to generate trust scores.
439
+
440
+ ---
386
441
 
387
442
  ## CI/CD Integration
388
443
 
389
444
  ### GitHub Actions
390
445
 
391
446
  ```yaml
392
- name: Security Scan
447
+ name: Agent Security
393
448
  on: [push, pull_request]
394
-
395
449
  jobs:
396
- security:
450
+ scan:
397
451
  runs-on: ubuntu-latest
398
452
  steps:
399
453
  - uses: actions/checkout@v4
400
454
  - uses: actions/setup-node@v4
401
- with:
402
- node-version: '20'
455
+ with: { node-version: '20' }
403
456
  - run: npx hackmyagent secure --json > security-report.json
457
+ - run: npx hackmyagent fix-all --scan-only --json > plugin-report.json
404
458
  - uses: actions/upload-artifact@v4
405
- with:
406
- name: security-report
407
- path: security-report.json
459
+ with: { name: security-reports, path: '*.json' }
408
460
  ```
409
461
 
410
- ### GitHub Actions with Attack Mode (SARIF)
462
+ ### SARIF (GitHub Security Tab)
411
463
 
412
464
  ```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
465
+ - run: npx hackmyagent attack --local -f sarif -o results.sarif --fail-on-vulnerable medium
466
+ - uses: github/codeql-action/upload-sarif@v3
467
+ with: { sarif_file: results.sarif }
440
468
  ```
441
469
 
442
470
  ### Pre-commit Hook
443
471
 
444
472
  ```bash
445
- # .git/hooks/pre-commit
446
473
  #!/bin/sh
474
+ # .git/hooks/pre-commit
447
475
  npx hackmyagent secure --ignore LOG-001,RATE-001
448
476
  ```
449
477
 
450
- ### JSON Output
451
-
452
- All commands support `--json` for machine-readable output:
478
+ ### JSON Piping
453
479
 
454
480
  ```bash
481
+ # Filter critical findings
455
482
  hackmyagent secure --json | jq '.findings[] | select(.severity == "critical")'
456
- ```
457
-
458
- ## Supported Platforms
459
483
 
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
484
+ # Count issues by category
485
+ hackmyagent secure --json | jq '[.findings[].id | split("-")[0]] | group_by(.) | map({(.[0]): length}) | add'
486
+ ```
464
487
 
465
- ## Security Check Reference
488
+ ---
466
489
 
467
- For the complete list of 147+ security checks with descriptions and remediation guidance, see [SECURITY_CHECKS.md](docs/SECURITY_CHECKS.md).
490
+ ## Exit Codes
468
491
 
469
- ## Auto-Fix Capabilities
492
+ | Code | Meaning | Commands |
493
+ |------|---------|----------|
494
+ | `0` | Clean — no critical/high issues | All commands |
495
+ | `1` | Critical or high severity issues remain after scan/fix | `secure`, `fix-all`, `attack` |
496
+ | `2` | Incomplete scan — one or more plugins failed to run | `fix-all` |
470
497
 
471
- The following issues can be automatically fixed with `--fix`:
498
+ ---
472
499
 
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 |
500
+ ## Supported Platforms
482
501
 
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 |
502
+ | Platform | What HackMyAgent scans |
503
+ |----------|------------------------|
504
+ | **Claude Code** | CLAUDE.md, skills, MCP server configs |
505
+ | **Cursor** | .cursor/ rules, MCP configurations |
506
+ | **VS Code** | .vscode/mcp.json configurations |
507
+ | **Generic MCP** | Any MCP server setup |
490
508
 
491
- Always use `--dry-run` first to preview changes. Backups are created automatically.
509
+ ---
492
510
 
493
511
  ## Environment Variables
494
512
 
495
513
  | Variable | Description |
496
514
  |----------|-------------|
497
515
  | `NO_COLOR` | Disable colored output |
498
- | `HACKMYAGENT_TIMEOUT` | Default timeout for scans (ms) |
499
-
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
516
 
515
- See [test-fixtures/README.md](test-fixtures/README.md) for details.
517
+ ---
516
518
 
517
519
  ## Contributing
518
520
 
519
- Contributions welcome! See [CONTRIBUTING.md](CONTRIBUTING.md) for guidelines.
521
+ Contributions welcome. See [CONTRIBUTING.md](CONTRIBUTING.md).
520
522
 
521
523
  ```bash
522
- # Development setup
523
524
  git clone https://github.com/opena2a-org/hackmyagent.git
524
525
  cd hackmyagent
525
526
  npm install
526
- npm run build
527
- npm test
527
+ npx turbo build # build all 7 packages
528
+ npx turbo test # run 501 tests
528
529
  ```
529
530
 
530
- ## License
531
+ ### Monorepo Structure
531
532
 
532
- Apache-2.0
533
+ ```
534
+ packages/
535
+ cli/ # CLI entry point (hackmyagent command)
536
+ core/ # Scanner engine (147 checks)
537
+ aim-core/ # Ed25519 identity, audit, policy, trust
538
+ plugin-core/ # Plugin interface and registry
539
+ secretless-openclaw/ # Credential scanner plugin
540
+ signcrypt-openclaw/ # Signing and hash pinning plugin
541
+ skillguard-openclaw/ # Permission and pattern scanner plugin
542
+ ```
533
543
 
534
544
  ---
535
545
 
536
- ## Secure What You Find
546
+ ## License
537
547
 
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.
548
+ Apache-2.0
549
+
550
+ ---
539
551
 
540
- [Get started with AIM](https://opena2a.org/docs/quick-start) | [Learn about NHI governance](https://opena2a.org/nhi)
552
+ Built by [OpenA2A](https://opena2a.org). HackMyAgent finds vulnerabilities. [AIM](https://github.com/opena2a-org/agent-identity-management) manages identity and access.