hackmyagent 0.4.2 → 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,152 +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.0
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
- - **SUPPLY-005–008:** ClawHavoc campaign IOCs (C2 IPs, malware filenames, ClickFix patterns)
17
- - **GATEWAY-007–008, CONFIG-007–009:** Config hardening (open DM wildcards, disabled sandbox, weak tokens)
18
-
19
- 11 new checks. 145+ total.
20
-
21
- ## Disclaimer
13
+ ---
22
14
 
23
- 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
24
16
 
25
17
  ```bash
26
- npx hackmyagent check @publisher/skill # verify a skill before installing
27
- npx hackmyagent secure # harden your agent setup (145+ checks)
28
- npx hackmyagent secure --fix # auto-fix security issues
29
- npx hackmyagent scan example.com # scan for exposed infrastructure
30
- npx hackmyagent attack --local # red team with 55 attack payloads
31
- 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
32
21
  ```
33
22
 
34
- ## Two Ways to Scan
23
+ No config files required. Works out of the box.
35
24
 
36
- | Tool | Use Case |
37
- |------|----------|
38
- | **[hackmyagent.com](https://hackmyagent.com)** | Scan external targets — check if your MCP servers, configs, or credentials are exposed on the internet |
39
- | **`npx hackmyagent secure`** | Scan local projects — harden your agent setup before deploying |
40
-
41
- ## Why HackMyAgent?
25
+ ---
42
26
 
43
- 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)
44
43
 
45
- - **Check** skills before installing (publisher verification, permission analysis)
46
- - **Secure** your agent setup (145+ security checks with auto-remediation)
47
- - **Scan** external infrastructure (exposed MCP endpoints, leaked configs)
44
+ ---
48
45
 
49
46
  ## Installation
50
47
 
51
48
  ```bash
52
- # Use directly with npx
49
+ # Run directly (no install needed)
53
50
  npx hackmyagent secure
54
51
 
55
- # Or install globally
52
+ # Install globally
56
53
  npm install -g hackmyagent
57
54
 
58
- # Or add to your project
55
+ # Add to project devDependencies
59
56
  npm install --save-dev hackmyagent
60
57
  ```
61
58
 
59
+ **Requirements:** Node.js 18+
60
+
61
+ ---
62
+
62
63
  ## Commands
63
64
 
64
65
  ### `hackmyagent secure`
65
66
 
66
- Scan and harden your local agent setup with 145+ security checks across 31 categories.
67
+ Scan and harden your local agent setup. 147+ checks across 31 categories with auto-remediation.
67
68
 
68
69
  ```bash
69
- # Basic scan
70
- 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 |
71
115
 
72
- # Scan specific directory
73
- hackmyagent secure ./my-project
116
+ </details>
74
117
 
75
- # Auto-fix issues
76
- hackmyagent secure --fix
118
+ <details>
119
+ <summary>Auto-fix capabilities</summary>
77
120
 
78
- # Preview fixes without applying
79
- 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
+ ---
80
146
 
81
- # Skip specific checks
82
- hackmyagent secure --ignore CRED-001,GIT-002
147
+ ### `hackmyagent fix-all`
83
148
 
84
- # JSON output for CI/CD
85
- hackmyagent secure --json
149
+ Run all OpenA2A security plugins in sequence: scan, fix, report.
86
150
 
87
- # Show all checks (including passed)
88
- 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
89
159
  ```
90
160
 
91
- **Security Categories:**
92
-
93
- | Category | Checks | Description |
94
- |----------|--------|-------------|
95
- | CRED | 4 | Credential exposure detection |
96
- | MCP | 12 | MCP server configuration |
97
- | CLAUDE | 8 | Claude Code security |
98
- | NET | 6 | Network security |
99
- | PROMPT | 4 | Prompt injection defenses |
100
- | INJ | 4 | Input validation (XSS, SQL, cmd) |
101
- | ENCRYPT | 4 | Encryption at rest |
102
- | SESSION | 4 | Session management |
103
- | AUDIT | 4 | Audit trails |
104
- | SANDBOX | 4 | Process isolation |
105
- | TOOL | 4 | Tool permission boundaries |
106
- | AUTH | 4 | Authentication checks |
107
- | DEPS | 4 | Dependency security |
108
- | ENV | 4 | Environment variable safety |
109
- | GIT | 4 | Git security (.gitignore, secrets in history) |
110
- | IO | 4 | Input/output validation |
111
- | LOG | 4 | Logging and monitoring |
112
- | PERM | 4 | File permissions |
113
- | PROC | 4 | Process isolation |
114
- | RATE | 4 | Rate limiting |
115
- | SEC | 4 | General security headers |
116
- | API | 4 | API security |
117
- | VSCODE | 4 | VS Code configuration |
118
- | CURSOR | 4 | Cursor IDE configuration |
119
- | CVE | 2 | CVE-2026-25253 detection |
120
- | GATEWAY | 8 | Gateway misconfigurations |
121
- | CONFIG | 9 | Insecure settings |
122
- | SUPPLY | 8 | Supply chain attacks |
123
- | SKILL | 12 | Malicious skill detection |
124
- | HEARTBEAT | 6 | Heartbeat/cron abuse |
125
- | 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 |
126
168
 
127
- **Exit Codes:**
128
- - `0` - No critical/high issues
129
- - `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
+ ---
130
176
 
131
177
  ### `hackmyagent check`
132
178
 
133
- Verify a skill's safety before installing.
179
+ Verify a skill before installing it.
134
180
 
135
181
  ```bash
136
182
  hackmyagent check @publisher/skill-name
137
- hackmyagent check @anthropic/claude-mcp --verbose
138
183
  hackmyagent check @publisher/skill --json
139
- hackmyagent check @publisher/skill --offline # skip DNS verification
184
+ hackmyagent check @publisher/skill --offline # skip DNS verification
140
185
  ```
141
186
 
142
- **Checks performed:**
143
- - Publisher identity via DNS TXT records
144
- - Permissions requested (filesystem, network, shell access)
145
- - Revocation status against global blocklist
187
+ Checks: publisher identity (DNS TXT), permissions requested, revocation status.
146
188
 
147
- **Note:** Only scan systems you own or have permission to test.
148
-
149
- **Risk Levels:** `low`, `medium`, `high`, `critical`
189
+ ---
150
190
 
151
191
  ### `hackmyagent scan`
152
192
 
@@ -155,70 +195,45 @@ Scan external infrastructure for exposed AI agent endpoints.
155
195
  ```bash
156
196
  hackmyagent scan example.com
157
197
  hackmyagent scan 192.168.1.100 -p 3000,8080
158
- hackmyagent scan example.com --verbose
159
198
  hackmyagent scan example.com --json
160
199
  ```
161
200
 
162
- **Detects:**
163
- - Exposed MCP SSE/tools endpoints
164
- - Public configuration files
165
- - API keys in responses
166
- - Debug/admin interfaces
167
-
168
- **Scoring:** A (90-100), B (80-89), C (70-79), D (60-69), F (<60)
169
-
170
- ### `hackmyagent attack`
171
-
172
- Red team your AI agent with adversarial security testing. 55 attack payloads across 5 categories.
173
-
174
- ```bash
175
- # Local simulation (no API calls - test payloads locally)
176
- hackmyagent attack --local
177
- 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.
178
202
 
179
- # Test an API endpoint
180
- hackmyagent attack https://api.example.com/v1/chat
181
- 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).
182
204
 
183
- # Filter by category or intensity
184
- hackmyagent attack --local --category prompt-injection
185
- hackmyagent attack --local --intensity aggressive
205
+ > Only scan systems you own or have written authorization to test.
186
206
 
187
- # Custom payloads from a JSON file
188
- hackmyagent attack https://api.example.com --payload-file custom.json
207
+ ---
189
208
 
190
- # CI/CD gate — fail on vulnerabilities at or above severity threshold
191
- hackmyagent attack https://api.example.com --fail-on-vulnerable # any finding
192
- hackmyagent attack https://api.example.com --fail-on-vulnerable medium # medium+
193
- hackmyagent attack https://api.example.com --fail-on-vulnerable critical # critical only
209
+ ### `hackmyagent attack`
194
210
 
195
- # Output formats
196
- hackmyagent attack --local -f json
197
- hackmyagent attack --local -f sarif -o results.sarif
211
+ Red team your AI agent with 55 adversarial payloads across 5 categories.
198
212
 
199
- # Verbose mode (show each payload result)
200
- 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
201
221
  ```
202
222
 
203
- **Attack Categories:**
223
+ <details>
224
+ <summary>Attack categories and custom payloads</summary>
204
225
 
205
226
  | Category | Payloads | Description |
206
227
  |----------|----------|-------------|
207
- | `prompt-injection` | 12 | Manipulate agent behavior via malicious input |
208
- | `jailbreak` | 12 | Bypass safety guardrails and restrictions |
209
- | `data-exfiltration` | 11 | Extract sensitive information from the agent |
210
- | `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 |
211
232
  | `context-manipulation` | 10 | Poison agent context or memory |
212
233
 
213
- **Intensity Levels:**
214
-
215
- | Level | Description |
216
- |-------|-------------|
217
- | `passive` | Observation only, minimal risk |
218
- | `active` | Standard attack payloads (default) |
219
- | `aggressive` | Creative/risky payloads, full suite |
234
+ Intensity: `passive` (observation only), `active` (default), `aggressive` (full suite).
220
235
 
221
- **Custom Payload File Format:**
236
+ **Custom payloads:** Create a JSON file and pass with `--payloads custom.json`:
222
237
 
223
238
  ```json
224
239
  {
@@ -237,256 +252,263 @@ hackmyagent attack --local --verbose
237
252
  }
238
253
  ```
239
254
 
240
- Only `id` and `payload` are required. See `--help` for all defaults.
255
+ Only `id` and `payload` are required.
241
256
 
242
- **Output Formats:**
243
- - `text` - Human-readable report (default)
244
- - `json` - Machine-readable JSON
245
- - `sarif` - SARIF 2.1.0 for GitHub Security tab integration
246
- - `html` - Standalone HTML report
257
+ </details>
247
258
 
248
- **Risk Scoring:**
249
- - 0-24: LOW - Minor issues, agent is reasonably secure
250
- - 25-49: MEDIUM - Some vulnerabilities, review recommended
251
- - 50-69: HIGH - Significant vulnerabilities, action required
252
- - 70-100: CRITICAL - Severe vulnerabilities, immediate action needed
259
+ Output formats: `text`, `json`, `sarif` (GitHub Security tab), `html`.
260
+
261
+ ---
253
262
 
254
263
  ### `hackmyagent secure --benchmark`
255
264
 
256
- 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.
257
266
 
258
267
  ```bash
259
- # Run benchmark (L1 by default)
260
- 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
+ ```
261
275
 
262
- # Target specific directory
263
- hackmyagent secure ./my-project --benchmark oasb-1
276
+ <details>
277
+ <summary>OASB-1 categories and maturity levels</summary>
264
278
 
265
- # Different maturity levels
266
- hackmyagent secure -b oasb-1 -l L1 # Essential (26 controls)
267
- hackmyagent secure -b oasb-1 -l L2 # Standard (44 controls)
268
- 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 |
269
291
 
270
- # Verbose see every control with pass/fail/unverified status
271
- hackmyagent secure -b oasb-1 -v
292
+ **Maturity levels:** L1 Essential (26 controls), L2 Standard (44), L3 Hardened (46).
272
293
 
273
- # Filter by category
274
- hackmyagent secure -b oasb-1 --category "Credential Protection"
294
+ **Ratings:** Certified (100%), Compliant (L1=100% + L2>=90%), Passing (>=90%), Needs Improvement (>=70%), Failing (<70%).
275
295
 
276
- # Output formats
277
- hackmyagent secure -b oasb-1 -f json
278
- hackmyagent secure -b oasb-1 -f sarif -o results.sarif
279
- hackmyagent secure -b oasb-1 -f html -o report.html
280
- hackmyagent secure -b oasb-1 -f asp -o profile.asp.json
296
+ </details>
281
297
 
282
- # CI/CD gate exit 1 if compliance is below threshold
283
- hackmyagent secure -b oasb-1 --fail-below 70
284
- ```
298
+ Output formats: `text`, `json`, `sarif`, `html`, `asp` (Agent Security Profile).
285
299
 
286
- **OASB-1 Categories (46 controls):**
287
-
288
- | # | Category | Controls | What it checks |
289
- |---|----------|----------|----------------|
290
- | 1 | Identity & Provenance | 4 | Cryptographic identity, ownership, provenance chain |
291
- | 2 | Capability & Authorization | 5 | Least privilege, capability boundaries, human-in-the-loop |
292
- | 3 | Input Security | 5 | Prompt injection, input validation, URL/SSRF protection |
293
- | 4 | Output Security | 4 | Output validation, destructive op confirmation, exfiltration prevention |
294
- | 5 | Credential Protection | 5 | Hardcoded secrets, context window isolation, log redaction |
295
- | 6 | Supply Chain Integrity | 5 | Dependency scanning, lockfiles, rug pull protection, SBOM |
296
- | 7 | Agent-to-Agent Security | 4 | Mutual auth, message integrity, trust boundaries |
297
- | 8 | Memory & Context Integrity | 4 | Context injection, memory isolation, summarization security |
298
- | 9 | Operational Security | 5 | Non-root execution, sandboxing, network isolation, resource limits |
299
- | 10 | Monitoring & Response | 5 | Security logging, anomaly detection, kill switch, incident response |
300
-
301
- **Maturity Levels:**
302
-
303
- | Level | Controls | Purpose |
304
- |-------|----------|---------|
305
- | L1 - Essential | 26 | Baseline security every agent should meet |
306
- | L2 - Standard | 44 (L1 + 18) | Production-grade agent security |
307
- | L3 - Hardened | 46 (L2 + 2) | High-security environments, multi-modal threats |
308
-
309
- **Rating System:**
310
-
311
- | Rating | L1 Criteria | L2 Criteria | L3 Criteria |
312
- |--------|-------------|-------------|-------------|
313
- | Certified | 100% | L1=100% + L2=100% | All 100% |
314
- | Compliant | — | L1=100% + L2≥90% | L1=100% + L2≥90% |
315
- | Passing | ≥90% | L1≥90% | L1≥90% |
316
- | Needs Improvement | ≥70% | L1≥70% | L1≥70% |
317
- | Failing | <70% | L1<70% | L1<70% |
318
-
319
- **Output Formats:**
320
- - `text` — Terminal report with category breakdown (default)
321
- - `json` — Machine-readable JSON with full control details
322
- - `sarif` — SARIF 2.1.0 for GitHub Security tab and IDE integration
323
- - `html` — Standalone HTML report with donut chart, radar chart, and grades
324
- - `asp` — Agent Security Profile (portable security posture document)
325
-
326
- **Exit Codes:**
327
- - `0` — Rating is Passing or better (or compliance above `--fail-below` threshold)
328
- - `1` — Rating is Failing or Needs Improvement (or compliance below threshold)
300
+ ---
329
301
 
330
302
  ### `hackmyagent secure-openclaw`
331
303
 
332
- Scan OpenClaw/Moltbot installations with 45 specialized security checks and auto-remediation.
304
+ 47 specialized checks for OpenClaw/Moltbot installations.
333
305
 
334
306
  ```bash
335
- hackmyagent secure-openclaw # scan default location
336
- hackmyagent secure-openclaw ~/.moltbot # scan specific directory
337
- hackmyagent secure-openclaw --fix # auto-fix gateway misconfigurations
338
- hackmyagent secure-openclaw --fix --dry-run # preview fixes
339
- 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
340
312
  ```
341
313
 
342
- **Detects:**
343
- - CVE-2026-25253 vulnerable versions (before v2026.1.29)
344
- - Missing `controlUi.allowedOrigins` (patch alone isn't enough)
345
- - ClawHavoc C2 IP addresses and malware filenames
346
- - ClickFix social engineering patterns
347
- - Unsigned/malicious skills (ClawHavoc campaign patterns)
348
- - Reverse shell backdoors
349
- - Credential exfiltration (wallets, SSH keys, API keys)
350
- - Heartbeat/cron abuse
351
- - Gateway misconfigurations (GHSA-g8p2 vulnerability)
352
- - Disabled sandbox/approval confirmations
353
-
354
- **Auto-Fix (with `--fix`):**
355
- | Check | Before | After |
356
- |-------|--------|-------|
357
- | GATEWAY-001 | `0.0.0.0` | `127.0.0.1` (local-only) |
358
- | GATEWAY-003 | Plaintext token | `${OPENCLAW_AUTH_TOKEN}` env var |
359
- | GATEWAY-004 | Approvals disabled | Approvals enabled |
360
- | GATEWAY-005 | Sandbox disabled | Sandbox enabled |
361
-
362
- **Check Categories:**
363
- | Category | Checks | Description |
364
- |----------|--------|-------------|
365
- | SKILL | 12 | Malicious skill detection |
366
- | HEARTBEAT | 6 | Heartbeat/cron abuse |
367
- | GATEWAY | 8 | Gateway misconfigurations (4 auto-fixable) |
368
- | CONFIG | 9 | Insecure settings |
369
- | SUPPLY | 8 | Supply chain attacks |
370
- | CVE | 2 | CVE-2026-25253 detection |
314
+ Detects: CVE-2026-25253, ClawHavoc IOCs, reverse shells, credential exfiltration, gateway misconfigs, disabled sandbox.
371
315
 
372
316
  See [SECURITY_CHECKS.md](docs/SECURITY_CHECKS.md#openclaw-security-checks) for full documentation.
373
317
 
318
+ ---
319
+
374
320
  ### `hackmyagent rollback`
375
321
 
376
- Undo auto-fix changes.
322
+ Undo auto-fix changes. Backups are created automatically in `.hackmyagent-backup/`.
377
323
 
378
324
  ```bash
379
- hackmyagent rollback # rollback current directory
380
- 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
+ }
381
410
  ```
382
411
 
383
- 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
+ ---
384
442
 
385
443
  ## CI/CD Integration
386
444
 
387
445
  ### GitHub Actions
388
446
 
389
447
  ```yaml
390
- name: Security Scan
448
+ name: Agent Security
391
449
  on: [push, pull_request]
392
-
393
450
  jobs:
394
- security:
451
+ scan:
395
452
  runs-on: ubuntu-latest
396
453
  steps:
397
454
  - uses: actions/checkout@v4
398
455
  - uses: actions/setup-node@v4
399
- with:
400
- node-version: '20'
456
+ with: { node-version: '20' }
401
457
  - run: npx hackmyagent secure --json > security-report.json
458
+ - run: npx hackmyagent fix-all --scan-only --json > plugin-report.json
402
459
  - uses: actions/upload-artifact@v4
403
- with:
404
- name: security-report
405
- path: security-report.json
460
+ with: { name: security-reports, path: '*.json' }
406
461
  ```
407
462
 
408
- ### GitHub Actions with Attack Mode (SARIF)
463
+ ### SARIF (GitHub Security Tab)
409
464
 
410
465
  ```yaml
411
- name: AI Agent Security
412
- on: [push, pull_request]
413
-
414
- jobs:
415
- attack-scan:
416
- runs-on: ubuntu-latest
417
- steps:
418
- - uses: actions/checkout@v4
419
- - uses: actions/setup-node@v4
420
- with:
421
- node-version: '20'
422
- - name: Run attack simulation
423
- run: npx hackmyagent attack --local -f sarif -o attack-results.sarif --fail-on-vulnerable medium
424
- - name: Upload SARIF to GitHub Security
425
- uses: github/codeql-action/upload-sarif@v3
426
- with:
427
- sarif_file: attack-results.sarif
428
-
429
- benchmark:
430
- runs-on: ubuntu-latest
431
- steps:
432
- - uses: actions/checkout@v4
433
- - uses: actions/setup-node@v4
434
- with:
435
- node-version: '20'
436
- - name: Run OASB-1 benchmark
437
- 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 }
438
469
  ```
439
470
 
440
471
  ### Pre-commit Hook
441
472
 
442
473
  ```bash
443
- # .git/hooks/pre-commit
444
474
  #!/bin/sh
475
+ # .git/hooks/pre-commit
445
476
  npx hackmyagent secure --ignore LOG-001,RATE-001
446
477
  ```
447
478
 
448
- ### JSON Output
449
-
450
- All commands support `--json` for machine-readable output:
479
+ ### JSON Piping
451
480
 
452
481
  ```bash
482
+ # Filter critical findings
453
483
  hackmyagent secure --json | jq '.findings[] | select(.severity == "critical")'
454
- ```
455
-
456
- ## Supported Platforms
457
484
 
458
- - **Claude Code** - CLAUDE.md, skills, MCP servers
459
- - **Cursor** - .cursor/ rules, MCP configurations
460
- - **VSCode** - .vscode/mcp.json configurations
461
- - **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
+ ```
462
488
 
463
- ## Security Check Reference
489
+ ---
464
490
 
465
- For the complete list of 145+ security checks with descriptions and remediation guidance, see [SECURITY_CHECKS.md](docs/SECURITY_CHECKS.md).
491
+ ## Exit Codes
466
492
 
467
- ## 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` |
468
498
 
469
- The following issues can be automatically fixed with `--fix`:
499
+ ---
470
500
 
471
- **General (`hackmyagent secure --fix`):**
472
- | Check ID | Issue | Auto-Fix Action |
473
- |----------|-------|-----------------|
474
- | CRED-001 | Exposed API keys | Replace with env var reference |
475
- | GIT-001 | Missing .gitignore | Create with secure defaults |
476
- | GIT-002 | Incomplete .gitignore | Add missing patterns |
477
- | PERM-001 | Overly permissive files | Set restrictive permissions |
478
- | MCP-001 | Root filesystem access | Scope to project directory |
479
- | NET-001 | Bound to 0.0.0.0 | Bind to 127.0.0.1 |
501
+ ## Supported Platforms
480
502
 
481
- **OpenClaw (`hackmyagent secure-openclaw --fix`):**
482
- | Check ID | Issue | Auto-Fix Action |
483
- |----------|-------|-----------------|
484
- | GATEWAY-001 | Bound to 0.0.0.0 | Bind to 127.0.0.1 |
485
- | GATEWAY-003 | Plaintext token in config | Replace with `${OPENCLAW_AUTH_TOKEN}` |
486
- | GATEWAY-004 | Approvals disabled | Enable approval confirmations |
487
- | 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 |
488
510
 
489
- Always use `--dry-run` first to preview changes. Backups are created automatically.
511
+ ---
490
512
 
491
513
  ## Environment Variables
492
514
 
@@ -495,44 +517,39 @@ Always use `--dry-run` first to preview changes. Backups are created automatical
495
517
  | `NO_COLOR` | Disable colored output |
496
518
  | `HACKMYAGENT_TIMEOUT` | Default timeout for scans (ms) |
497
519
 
498
- ## Test Fixtures
499
-
500
- Sample projects with intentional security issues for testing:
501
-
502
- ```bash
503
- # Test the scanner against example projects
504
- npx hackmyagent secure test-fixtures/insecure-api # Score: 27/100
505
- npx hackmyagent secure test-fixtures/insecure-mcp # Score: 0/100
506
- npx hackmyagent secure test-fixtures/insecure-library # Score: 60/100
507
- npx hackmyagent secure test-fixtures/clean-project # Score: 100/100
508
-
509
- # Test auto-fix
510
- npx hackmyagent secure test-fixtures/insecure-api --fix
511
- ```
512
-
513
- See [test-fixtures/README.md](test-fixtures/README.md) for details.
520
+ ---
514
521
 
515
522
  ## Contributing
516
523
 
517
- Contributions welcome! See [CONTRIBUTING.md](CONTRIBUTING.md) for guidelines.
524
+ Contributions welcome. See [CONTRIBUTING.md](CONTRIBUTING.md).
518
525
 
519
526
  ```bash
520
- # Development setup
521
527
  git clone https://github.com/opena2a-org/hackmyagent.git
522
528
  cd hackmyagent
523
529
  npm install
524
- npm run build
525
- npm test
530
+ npx turbo build # build all 7 packages
531
+ npx turbo test # run 501 tests
526
532
  ```
527
533
 
528
- ## License
534
+ ### Monorepo Structure
529
535
 
530
- 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
+ ```
531
546
 
532
547
  ---
533
548
 
534
- ## Secure What You Find
549
+ ## License
535
550
 
536
- 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
+ ---
537
554
 
538
- [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.