hackmyagent 0.8.0 → 0.9.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.
Files changed (86) hide show
  1. package/README.md +168 -295
  2. package/dist/abgr/controls.d.ts +35 -0
  3. package/dist/abgr/controls.d.ts.map +1 -0
  4. package/dist/abgr/controls.js +1058 -0
  5. package/dist/abgr/controls.js.map +1 -0
  6. package/dist/abgr/detector.d.ts +45 -0
  7. package/dist/abgr/detector.d.ts.map +1 -0
  8. package/dist/abgr/detector.js +175 -0
  9. package/dist/abgr/detector.js.map +1 -0
  10. package/dist/abgr/index.d.ts +24 -0
  11. package/dist/abgr/index.d.ts.map +1 -0
  12. package/dist/abgr/index.js +50 -0
  13. package/dist/abgr/index.js.map +1 -0
  14. package/dist/abgr/scorer.d.ts +36 -0
  15. package/dist/abgr/scorer.d.ts.map +1 -0
  16. package/dist/abgr/scorer.js +205 -0
  17. package/dist/abgr/scorer.js.map +1 -0
  18. package/dist/abgr/templates.d.ts +35 -0
  19. package/dist/abgr/templates.d.ts.map +1 -0
  20. package/dist/abgr/templates.js +668 -0
  21. package/dist/abgr/templates.js.map +1 -0
  22. package/dist/abgr/tier.d.ts +27 -0
  23. package/dist/abgr/tier.d.ts.map +1 -0
  24. package/dist/abgr/tier.js +115 -0
  25. package/dist/abgr/tier.js.map +1 -0
  26. package/dist/abgr/types.d.ts +59 -0
  27. package/dist/abgr/types.d.ts.map +1 -0
  28. package/dist/abgr/types.js +10 -0
  29. package/dist/abgr/types.js.map +1 -0
  30. package/dist/agent-scan/checks.d.ts +6 -0
  31. package/dist/agent-scan/checks.d.ts.map +1 -0
  32. package/dist/agent-scan/checks.js +93 -0
  33. package/dist/agent-scan/checks.js.map +1 -0
  34. package/dist/agent-scan/index.d.ts +10 -0
  35. package/dist/agent-scan/index.d.ts.map +1 -0
  36. package/dist/agent-scan/index.js +16 -0
  37. package/dist/agent-scan/index.js.map +1 -0
  38. package/dist/agent-scan/scanner.d.ts +31 -0
  39. package/dist/agent-scan/scanner.d.ts.map +1 -0
  40. package/dist/agent-scan/scanner.js +484 -0
  41. package/dist/agent-scan/scanner.js.map +1 -0
  42. package/dist/agent-scan/types.d.ts +63 -0
  43. package/dist/agent-scan/types.d.ts.map +1 -0
  44. package/dist/agent-scan/types.js +10 -0
  45. package/dist/agent-scan/types.js.map +1 -0
  46. package/dist/arp/cli/index.js +6 -0
  47. package/dist/arp/cli/index.js.map +1 -1
  48. package/dist/cli.js +219 -0
  49. package/dist/cli.js.map +1 -1
  50. package/dist/hardening/llm-checks.d.ts +18 -0
  51. package/dist/hardening/llm-checks.d.ts.map +1 -0
  52. package/dist/hardening/llm-checks.js +434 -0
  53. package/dist/hardening/llm-checks.js.map +1 -0
  54. package/dist/hardening/mcp-tool-enum.d.ts +45 -0
  55. package/dist/hardening/mcp-tool-enum.d.ts.map +1 -0
  56. package/dist/hardening/mcp-tool-enum.js +315 -0
  57. package/dist/hardening/mcp-tool-enum.js.map +1 -0
  58. package/dist/hardening/scanner.js +3 -3
  59. package/dist/hardening/scanner.js.map +1 -1
  60. package/dist/hardening/shell-checks.d.ts +21 -0
  61. package/dist/hardening/shell-checks.d.ts.map +1 -0
  62. package/dist/hardening/shell-checks.js +236 -0
  63. package/dist/hardening/shell-checks.js.map +1 -0
  64. package/dist/index.d.ts +4 -0
  65. package/dist/index.d.ts.map +1 -1
  66. package/dist/index.js +9 -1
  67. package/dist/index.js.map +1 -1
  68. package/dist/registry/client.js +2 -2
  69. package/dist/registry/client.js.map +1 -1
  70. package/dist/registry/contribution.d.ts +178 -0
  71. package/dist/registry/contribution.d.ts.map +1 -0
  72. package/dist/registry/contribution.js +272 -0
  73. package/dist/registry/contribution.js.map +1 -0
  74. package/dist/soul/index.d.ts +8 -0
  75. package/dist/soul/index.d.ts.map +1 -0
  76. package/dist/soul/index.js +14 -0
  77. package/dist/soul/index.js.map +1 -0
  78. package/dist/soul/scanner.d.ts +95 -0
  79. package/dist/soul/scanner.d.ts.map +1 -0
  80. package/dist/soul/scanner.js +411 -0
  81. package/dist/soul/scanner.js.map +1 -0
  82. package/dist/soul/templates.d.ts +12 -0
  83. package/dist/soul/templates.d.ts.map +1 -0
  84. package/dist/soul/templates.js +211 -0
  85. package/dist/soul/templates.js.map +1 -0
  86. package/package.json +1 -1
package/README.md CHANGED
@@ -1,94 +1,59 @@
1
- > **[OpenA2A](https://github.com/opena2a-org/opena2a)**: [Secretless](https://github.com/opena2a-org/secretless-ai) · [ABG](https://github.com/opena2a-org/AI-BrowserGuard) · [AIM](https://github.com/opena2a-org/agent-identity-management) · [OASB](https://github.com/opena2a-org/oasb) · [ARP](https://github.com/opena2a-org/arp) · [DVAA](https://github.com/opena2a-org/damn-vulnerable-ai-agent)
1
+ > **[OpenA2A](https://github.com/opena2a-org)**: [CLI](https://github.com/opena2a-org/opena2a) · [Secretless](https://github.com/opena2a-org/secretless-ai) · [AIM](https://github.com/opena2a-org/agent-identity-management) · [Browser Guard](https://github.com/opena2a-org/AI-BrowserGuard) · [DVAA](https://github.com/opena2a-org/damn-vulnerable-ai-agent) · [Registry](https://registry.opena2a.org)
2
2
 
3
3
  # HackMyAgent
4
4
 
5
5
  [![npm version](https://img.shields.io/npm/v/hackmyagent.svg)](https://www.npmjs.com/package/hackmyagent)
6
6
  [![License: Apache-2.0](https://img.shields.io/badge/License-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)
7
- [![Tests](https://img.shields.io/badge/tests-611%20passing-brightgreen)](https://github.com/opena2a-org/hackmyagent)
7
+ [![Tests](https://img.shields.io/badge/tests-765%20passing-brightgreen)](https://github.com/opena2a-org/hackmyagent)
8
8
 
9
9
  **Find it. Break it. Fix it.**
10
10
 
11
- 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.
11
+ AI agents execute arbitrary code with your permissions. HackMyAgent finds what can go wrong before an attacker does.
12
12
 
13
- [Website](https://hackmyagent.com) | [Security Checks Reference](docs/SECURITY_CHECKS.md)
13
+ Security scanner and red-team toolkit for AI agents. 147 security checks across 30 categories, 55 adversarial attack payloads, auto-fix with rollback, and OASB-1 compliance benchmarking -- all in a single package.
14
14
 
15
- <p align="center">
16
- <img src="docs/hackmyagent-demo.gif" alt="HackMyAgent scanning an AI agent project" width="700" />
17
- </p>
15
+ Scans Claude Code, Cursor, VS Code, and any MCP server setup.
16
+
17
+ [Website](https://hackmyagent.com) | [Security Checks Reference](docs/SECURITY_CHECKS.md) | [OpenA2A CLI](https://github.com/opena2a-org/opena2a)
18
18
 
19
19
  ---
20
20
 
21
21
  ## Quick Start
22
22
 
23
23
  ```bash
24
- npx hackmyagent secure # scan current directory (147 checks)
25
- npx hackmyagent secure --fix # auto-fix what it finds
26
- npx hackmyagent fix-all --with-aim # add agent identity + audit logging
24
+ npx hackmyagent secure # 147-check security scan
25
+ npx hackmyagent secure --fix # auto-fix issues (backups created automatically)
26
+ npx hackmyagent attack --local # red-team with 55 adversarial payloads
27
+ npx hackmyagent secure -b oasb-1 # OASB-1 compliance benchmark
27
28
  ```
28
29
 
29
- No config files required. Works out of the box.
30
+ No config files. No setup. Works out of the box on any AI agent project.
30
31
 
31
32
  ---
32
33
 
33
- ## Usage via OpenA2A CLI
34
-
35
- HackMyAgent is available as a first-class adapter in the [OpenA2A CLI](https://github.com/opena2a-org/opena2a). If you have the CLI installed, you can invoke scanning, auto-fix, and attack capabilities directly:
36
-
37
- ```bash
38
- opena2a scan # run HackMyAgent security scan on current directory
39
- opena2a scan --fix # scan and auto-fix issues
40
- opena2a scan --attack http://localhost:3000 # red-team a live endpoint with adversarial payloads
41
- ```
42
-
43
- The `opena2a scan` adapter delegates to `hackmyagent secure` under the hood, supporting the same checks, output formats, and exit codes documented below.
34
+ ## What It Scans
44
35
 
45
- ### Scope Drift Detection
36
+ | Platform | What HackMyAgent detects |
37
+ |----------|--------------------------|
38
+ | **Claude Code** | CLAUDE.md misconfigurations, skill permissions, MCP server exposure |
39
+ | **Cursor** | .cursor/ rules, MCP server configs, overly permissive settings |
40
+ | **VS Code** | .vscode/mcp.json configurations, extension risks |
41
+ | **Any MCP setup** | Transport security, tool boundaries, auth weaknesses |
46
42
 
47
- HackMyAgent includes credential scope drift detectors exposed through the `opena2a protect` command. These detect when AI agent credentials have permissions beyond their declared scope:
48
-
49
- | Detector | ID | What it detects |
50
- |----------|----|-----------------|
51
- | Google / Gemini | DRIFT-001 | OAuth scopes or API key permissions exceeding declared agent capabilities |
52
- | AWS / Bedrock | DRIFT-002 | IAM policies granting broader access than the agent's capability manifest |
53
-
54
- Preview drift findings without applying changes:
55
-
56
- ```bash
57
- opena2a protect --dry-run
58
- ```
59
-
60
- ---
61
-
62
- ## Table of Contents
63
-
64
- - [Installation](#installation)
65
- - [Usage via OpenA2A CLI](#usage-via-opena2a-cli)
66
- - [Commands](#commands)
67
- - [secure](#hackmyagent-secure) — local agent hardening (147 checks)
68
- - [fix-all](#hackmyagent-fix-all) — run all OpenA2A security plugins
69
- - [check](#hackmyagent-check) — verify a skill before installing
70
- - [scan](#hackmyagent-scan) — scan external infrastructure
71
- - [attack](#hackmyagent-attack) — red team with adversarial payloads
72
- - [secure --benchmark](#hackmyagent-secure---benchmark) — OASB-1 compliance benchmark
73
- - [secure-openclaw](#hackmyagent-secure-openclaw) — OpenClaw-specific scanning
74
- - [rollback](#hackmyagent-rollback) — undo auto-fix changes
75
- - [Plugin Architecture](#plugin-architecture)
76
- - [CI/CD Integration](#cicd-integration)
77
- - [Exit Codes](#exit-codes)
78
- - [Contributing](#contributing)
43
+ All platforms are scanned automatically no flags needed.
79
44
 
80
45
  ---
81
46
 
82
47
  ## Installation
83
48
 
84
49
  ```bash
85
- # Run directly (no install needed)
50
+ # Run directly (no install)
86
51
  npx hackmyagent secure
87
52
 
88
53
  # Install globally
89
54
  npm install -g hackmyagent
90
55
 
91
- # Add to project devDependencies
56
+ # Add to devDependencies
92
57
  npm install --save-dev hackmyagent
93
58
  ```
94
59
 
@@ -100,17 +65,16 @@ npm install --save-dev hackmyagent
100
65
 
101
66
  ### `hackmyagent secure`
102
67
 
103
- Scan and harden your local agent setup. 147 checks across 30 categories with auto-remediation.
68
+ Run 147 security checks across 30 categories. The primary command most users need.
104
69
 
105
70
  ```bash
106
- hackmyagent secure # basic scan
71
+ hackmyagent secure # scan current directory
107
72
  hackmyagent secure ./my-project # scan specific directory
108
73
  hackmyagent secure --fix # auto-fix issues
109
74
  hackmyagent secure --fix --dry-run # preview fixes before applying
110
75
  hackmyagent secure --ignore CRED-001,GIT-002 # skip specific checks
111
76
  hackmyagent secure --json # JSON output for CI/CD
112
77
  hackmyagent secure --verbose # show all checks including passed
113
- hackmyagent secure --no-color # disable colored output
114
78
  ```
115
79
 
116
80
  <details>
@@ -154,8 +118,6 @@ hackmyagent secure --no-color # disable colored output
154
118
  <details>
155
119
  <summary>Auto-fix capabilities</summary>
156
120
 
157
- **General (`hackmyagent secure --fix`):**
158
-
159
121
  | Check | Issue | Auto-fix |
160
122
  |-------|-------|----------|
161
123
  | CRED-001 | Exposed API keys | Replace with env var reference |
@@ -164,106 +126,32 @@ hackmyagent secure --no-color # disable colored output
164
126
  | PERM-001 | Overly permissive files | Set restrictive permissions |
165
127
  | MCP-001 | Root filesystem access | Scope to project directory |
166
128
  | NET-001 | Bound to 0.0.0.0 | Bind to 127.0.0.1 |
167
-
168
- **OpenClaw (`hackmyagent secure-openclaw --fix`):**
169
-
170
- | Check | Issue | Auto-fix |
171
- |-------|-------|----------|
172
- | GATEWAY-001 | Bound to 0.0.0.0 | Bind to 127.0.0.1 |
129
+ | GATEWAY-001 | Gateway bound to 0.0.0.0 | Bind to 127.0.0.1 |
173
130
  | GATEWAY-003 | Plaintext token | Replace with `${OPENCLAW_AUTH_TOKEN}` |
174
131
  | GATEWAY-004 | Approvals disabled | Enable approvals |
175
132
  | GATEWAY-005 | Sandbox disabled | Enable sandbox |
176
133
 
177
- Use `--dry-run` first to preview changes. Backups are created automatically in `.hackmyagent-backup/`.
134
+ Use `--dry-run` to preview changes. Backups are created in `.hackmyagent-backup/`.
178
135
 
179
136
  </details>
180
137
 
181
138
  ---
182
139
 
183
- ### `hackmyagent fix-all`
184
-
185
- Run all OpenA2A security plugins in sequence: scan, fix, report.
186
-
187
- ```bash
188
- hackmyagent fix-all # scan and fix current directory
189
- hackmyagent fix-all ./my-agent # target specific directory
190
- hackmyagent fix-all --dry-run # preview without applying
191
- hackmyagent fix-all --scan-only # scan only, no fixes
192
- hackmyagent fix-all --json # JSON output for CI
193
- hackmyagent fix-all --with-aim # enable AIM identity + audit logging
194
- hackmyagent fix-all -v # verbose output
195
- ```
196
-
197
- **Plugin execution order:**
198
-
199
- | # | Plugin | What it does |
200
- |---|--------|--------------|
201
- | 1 | **SkillGuard** | Hash pinning, tamper detection, dangerous pattern scanning (reverse shells, exfil, prompt injection) |
202
- | 2 | **SignCrypt** | Ed25519 signing of SKILL.md and HEARTBEAT.md, SHA-256 hash pinning, signature verification |
203
- | 3 | **CredVault** | Credential detection (10 patterns), env var replacement, AES-256-GCM encrypted store |
204
-
205
- **`--with-aim` adds:**
206
- - Ed25519 identity generation for the agent
207
- - Cryptographic audit log at `.opena2a/aim/audit.jsonl`
208
- - Capability policy enforcement via `policy.yaml`
209
- - 8-factor trust scoring
210
-
211
- ---
212
-
213
- ### `hackmyagent check`
214
-
215
- Verify a skill before installing it.
216
-
217
- ```bash
218
- hackmyagent check @publisher/skill-name
219
- hackmyagent check @publisher/skill --json
220
- hackmyagent check @publisher/skill --offline # skip DNS verification
221
- ```
222
-
223
- Checks: publisher identity (DNS TXT), permissions requested, revocation status.
224
-
225
- ---
226
-
227
- ### `hackmyagent scan`
228
-
229
- Scan external infrastructure for exposed AI agent endpoints.
230
-
231
- ```bash
232
- hackmyagent scan example.com
233
- hackmyagent scan 192.168.1.100 -p 3000,8080
234
- hackmyagent scan example.com --json
235
- ```
236
-
237
- Detects: exposed MCP SSE/tools endpoints, public configs, API keys in responses, debug interfaces.
238
-
239
- Scoring: A (90-100), B (80-89), C (70-79), D (60-69), F (<60).
240
-
241
- > Only scan systems you own or have written authorization to test.
242
-
243
- ---
244
-
245
140
  ### `hackmyagent attack`
246
141
 
247
- Red team your AI agent with 55 adversarial payloads across 5 categories.
142
+ Red-team your AI agent with 55 adversarial payloads across 5 attack categories.
248
143
 
249
144
  ```bash
250
145
  hackmyagent attack --local # local simulation
251
- hackmyagent attack --local --system-prompt "You are helpful" # with custom prompt
146
+ hackmyagent attack --local --system-prompt "You are helpful" # with custom system prompt
252
147
  hackmyagent attack https://api.example.com/v1/chat # test live endpoint
253
148
  hackmyagent attack --local --category prompt-injection # single category
254
- hackmyagent attack --local --intensity aggressive # full suite
149
+ hackmyagent attack --local --intensity aggressive # full payload suite
255
150
  hackmyagent attack --local -f sarif -o results.sarif # SARIF output
256
151
  hackmyagent attack https://api.example.com --fail-on-vulnerable medium # CI gate
257
- hackmyagent attack https://api.example.com --api-format anthropic # Anthropic API
258
- hackmyagent attack https://api.example.com --model gpt-4o # specify model
259
- hackmyagent attack https://api.example.com -H "Authorization: Bearer tk" # custom header
260
- hackmyagent attack --local --timeout 5000 --delay 500 # timing controls
261
- hackmyagent attack --local --stop-on-success # stop at first hit
152
+ hackmyagent attack https://api.example.com --api-format anthropic # Anthropic API format
262
153
  ```
263
154
 
264
- <details>
265
- <summary>Attack categories and custom payloads</summary>
266
-
267
155
  | Category | Payloads | Description |
268
156
  |----------|----------|-------------|
269
157
  | `prompt-injection` | 12 | Manipulate agent behavior via injected instructions |
@@ -272,9 +160,14 @@ hackmyagent attack --local --stop-on-success # stop a
272
160
  | `capability-abuse` | 10 | Misuse agent tools for unintended actions |
273
161
  | `context-manipulation` | 10 | Poison agent context or memory |
274
162
 
275
- Intensity: `passive` (observation only), `active` (default), `aggressive` (full suite).
163
+ Intensity levels: `passive` (observation only), `active` (default), `aggressive` (full suite).
164
+
165
+ Output formats: `text`, `json`, `sarif` (GitHub Security tab), `html`.
166
+
167
+ <details>
168
+ <summary>Custom payloads</summary>
276
169
 
277
- **Custom payloads:** Create a JSON file and pass with `--payload-file custom.json`:
170
+ Create a JSON file and pass with `--payload-file custom.json`:
278
171
 
279
172
  ```json
280
173
  {
@@ -297,26 +190,25 @@ Only `id` and `payload` are required.
297
190
 
298
191
  </details>
299
192
 
300
- Output formats: `text`, `json`, `sarif` (GitHub Security tab), `html`.
193
+ > Only test systems you own or have written authorization to test.
301
194
 
302
195
  ---
303
196
 
304
- ### `hackmyagent secure --benchmark`
197
+ ### `hackmyagent secure -b oasb-1`
305
198
 
306
- Run the [OASB-1](https://oasb.ai/oasb-1) (Open Agent Security Benchmark) — 46 controls across 10 categories.
199
+ Run the [OASB-1](https://oasb.ai/oasb-1) (Open Agent Security Benchmark) — 46 controls across 10 categories with three maturity levels.
307
200
 
308
201
  ```bash
309
202
  hackmyagent secure -b oasb-1 # L1 baseline (26 controls)
310
203
  hackmyagent secure -b oasb-1 -l L2 # L2 standard (44 controls)
311
204
  hackmyagent secure -b oasb-1 -l L3 # L3 hardened (46 controls)
312
- hackmyagent secure -b oasb-1 -c "Input Security" # filter to one category
313
- hackmyagent secure -b oasb-1 -v # verbose (every control)
205
+ hackmyagent secure -b oasb-1 -c "Input Security" # filter by category
314
206
  hackmyagent secure -b oasb-1 -f html -o report.html # HTML report
315
207
  hackmyagent secure -b oasb-1 --fail-below 70 # CI gate
316
208
  ```
317
209
 
318
210
  <details>
319
- <summary>OASB-1 categories and maturity levels</summary>
211
+ <summary>OASB-1 categories</summary>
320
212
 
321
213
  | # | Category | Controls |
322
214
  |---|----------|----------|
@@ -341,143 +233,86 @@ Output formats: `text`, `json`, `sarif`, `html`, `asp` (Agent Security Profile).
341
233
 
342
234
  ---
343
235
 
344
- ### `hackmyagent secure-openclaw`
236
+ ### `hackmyagent fix-all`
345
237
 
346
- 47 specialized checks for OpenClaw/Moltbot installations.
238
+ Run all security plugins in sequence: credential vault, file signing, skill guard. Applies fixes and generates a report.
347
239
 
348
240
  ```bash
349
- hackmyagent secure-openclaw # scan default location
350
- hackmyagent secure-openclaw ~/.moltbot # specific directory
351
- hackmyagent secure-openclaw --fix # auto-fix gateway configs
352
- hackmyagent secure-openclaw --fix --dry-run # preview fixes
353
- hackmyagent secure-openclaw --json # JSON output
241
+ hackmyagent fix-all # scan and fix
242
+ hackmyagent fix-all ./my-agent # target specific directory
243
+ hackmyagent fix-all --dry-run # preview without modifying
244
+ hackmyagent fix-all --scan-only # scan only, no fixes
245
+ hackmyagent fix-all --with-aim # add agent identity + audit logging
246
+ hackmyagent fix-all --json # JSON output
354
247
  ```
355
248
 
356
- Detects: CVE-2026-25253, ClawHavoc IOCs, reverse shells, credential exfiltration, gateway misconfigs, disabled sandbox.
249
+ **Plugins run in order:**
357
250
 
358
- See [SECURITY_CHECKS.md](docs/SECURITY_CHECKS.md#openclaw-security-checks) for full documentation.
251
+ | Plugin | What it does |
252
+ |--------|--------------|
253
+ | **SkillGuard** | Hash pinning, tamper detection, dangerous pattern scanning (reverse shells, exfiltration, prompt injection) |
254
+ | **SignCrypt** | Ed25519 signing of SKILL.md and HEARTBEAT.md, SHA-256 hash pinning, signature verification |
255
+ | **CredVault** | Credential detection (10 patterns), env var replacement, AES-256-GCM encrypted store |
256
+
257
+ **`--with-aim` adds:** Ed25519 agent identity, cryptographic audit log, capability policy enforcement, 8-factor trust scoring.
359
258
 
360
259
  ---
361
260
 
362
- ### `hackmyagent rollback`
261
+ ### `hackmyagent check`
363
262
 
364
- Undo auto-fix changes. Backups are created automatically in `.hackmyagent-backup/`.
263
+ Verify a skill's publisher identity and permissions before installing it.
365
264
 
366
265
  ```bash
367
- hackmyagent rollback # rollback current directory
368
- hackmyagent rollback ./my-project # rollback specific directory
266
+ hackmyagent check @publisher/skill-name
267
+ hackmyagent check @publisher/skill --json
268
+ hackmyagent check @publisher/skill --offline # skip DNS verification
369
269
  ```
370
270
 
371
- ---
372
-
373
- ## Plugin Architecture
374
-
375
- HackMyAgent uses a modular plugin system. Each plugin implements `scan()` to detect issues and `fix()` to remediate them.
376
-
377
- ### Built-in Plugins
271
+ Checks: publisher identity (DNS TXT), permissions requested, revocation status.
378
272
 
379
- | Module | Description |
380
- |--------|-------------|
381
- | `src/plugins/core.ts` | Plugin interface, registry, shared types |
382
- | `src/plugins/credvault.ts` | Credential scanning (10 patterns), env var replacement, AES-256-GCM store |
383
- | `src/plugins/signcrypt.ts` | Ed25519 file signing, SHA-256 hash pinning, signature verification |
384
- | `src/plugins/skillguard.ts` | Permission pinning, tamper detection, dangerous pattern scanning |
273
+ ---
385
274
 
386
- ### Writing a Plugin
275
+ ### `hackmyagent scan`
387
276
 
388
- ```typescript
389
- import type {
390
- OpenA2APlugin,
391
- PluginMetadata,
392
- PluginStatus,
393
- Finding,
394
- Remediation,
395
- FixOptions,
396
- PluginInitOptions,
397
- } from 'hackmyagent/plugins';
398
-
399
- export const metadata: PluginMetadata = {
400
- packageName: '@my-org/my-plugin',
401
- displayName: 'My Plugin',
402
- description: 'Detects and fixes X',
403
- version: '1.0.0',
404
- findings: ['MY-001', 'MY-002'],
405
- scoreImprovement: 10,
406
- };
277
+ Scan external infrastructure for exposed AI agent endpoints.
407
278
 
408
- export class MyPlugin implements OpenA2APlugin {
409
- readonly metadata = metadata;
279
+ ```bash
280
+ hackmyagent scan example.com
281
+ hackmyagent scan 192.168.1.100 -p 3000,8080
282
+ hackmyagent scan example.com --json
283
+ ```
410
284
 
411
- async init(options?: PluginInitOptions): Promise<void> {
412
- // Access AIM Core for identity-aware audit logging:
413
- // const aimCore = options?.aimCore;
414
- }
285
+ Detects: exposed MCP SSE/tools endpoints, public configs, API keys in responses, debug interfaces.
415
286
 
416
- async scan(agentDir: string): Promise<Finding[]> {
417
- // Scan the agent directory and return findings
418
- return [
419
- {
420
- id: 'MY-001',
421
- title: 'Insecure widget detected',
422
- description: 'Widget at config.json line 12 uses plaintext.',
423
- severity: 'high', // critical | high | medium | low
424
- filePath: 'config.json',
425
- line: 12,
426
- autoFixable: true,
427
- },
428
- ];
429
- }
287
+ Scoring: A (90-100), B (80-89), C (70-79), D (60-69), F (<60).
430
288
 
431
- async fix(agentDir: string, options?: FixOptions): Promise<Remediation[]> {
432
- if (options?.dryRun) {
433
- // Return what would be fixed without modifying files
434
- return [{ findingId: 'MY-001', description: 'Would encrypt widget', filesModified: ['config.json'], rollbackAvailable: false }];
435
- }
289
+ > Only scan systems you own or have written authorization to test.
436
290
 
437
- // Apply fixes and return what was changed
438
- return [{ findingId: 'MY-001', description: 'Encrypted widget', filesModified: ['config.json'], rollbackAvailable: false }];
439
- }
291
+ ---
440
292
 
441
- async status(): Promise<PluginStatus> {
442
- return { name: metadata.displayName, version: metadata.version, active: true, findingsCount: 0 };
443
- }
293
+ ### `hackmyagent rollback`
444
294
 
445
- async uninstall(): Promise<void> {}
446
- }
295
+ Undo auto-fix changes. Backups are created automatically by `secure --fix` and `fix-all`.
447
296
 
448
- export function createPlugin(): MyPlugin {
449
- return new MyPlugin();
450
- }
297
+ ```bash
298
+ hackmyagent rollback # rollback current directory
299
+ hackmyagent rollback ./my-project # rollback specific directory
451
300
  ```
452
301
 
453
- Register the plugin in `@opena2a/plugin-core`:
454
-
455
- ```typescript
456
- import { registerPlugin } from 'hackmyagent/plugins';
457
- import { createPlugin, metadata } from '@my-org/my-plugin';
458
-
459
- registerPlugin({
460
- metadata,
461
- create: createPlugin,
462
- });
463
- ```
302
+ ---
464
303
 
465
- ### Trust Score
304
+ ### `hackmyagent secure-openclaw`
466
305
 
467
- AIM Core provides an 8-factor weighted trust score (0.0 to 1.0) for each agent:
306
+ 47 specialized checks for OpenClaw/Moltbot installations.
468
307
 
469
- | Factor | Weight | What it measures |
470
- |--------|--------|------------------|
471
- | `identity` | 0.20 | Ed25519 keypair exists and is valid |
472
- | `capabilities` | 0.15 | Capabilities declared and pinned |
473
- | `secretsManaged` | 0.15 | No hardcoded credentials |
474
- | `auditLog` | 0.10 | Audit trail active |
475
- | `configSigned` | 0.10 | Configuration integrity verified |
476
- | `skillsVerified` | 0.10 | Skills cryptographically signed |
477
- | `networkControlled` | 0.10 | Network access restricted |
478
- | `heartbeatMonitored` | 0.10 | Heartbeat monitoring active |
308
+ ```bash
309
+ hackmyagent secure-openclaw # scan default location
310
+ hackmyagent secure-openclaw ~/.moltbot # specific directory
311
+ hackmyagent secure-openclaw --fix # auto-fix gateway configs
312
+ hackmyagent secure-openclaw --fix --dry-run # preview fixes
313
+ ```
479
314
 
480
- Use `--with-aim` in `fix-all` to generate trust scores.
315
+ Detects: CVE-2026-25253, ClawHavoc IOCs, reverse shells, credential exfiltration, gateway misconfigs, disabled sandbox.
481
316
 
482
317
  ---
483
318
 
@@ -496,7 +331,7 @@ jobs:
496
331
  - uses: actions/setup-node@v4
497
332
  with: { node-version: '20' }
498
333
  - run: npx hackmyagent secure --json > security-report.json
499
- - run: npx hackmyagent fix-all --scan-only --json > plugin-report.json
334
+ - run: npx hackmyagent secure -b oasb-1 --fail-below 70
500
335
  - uses: actions/upload-artifact@v4
501
336
  with: { name: security-reports, path: '*.json' }
502
337
  ```
@@ -517,7 +352,7 @@ jobs:
517
352
  npx hackmyagent secure --ignore LOG-001,RATE-001
518
353
  ```
519
354
 
520
- ### JSON Piping
355
+ ### JSON Output
521
356
 
522
357
  ```bash
523
358
  # Filter critical findings
@@ -531,22 +366,80 @@ hackmyagent secure --json | jq '[.findings[].id | split("-")[0]] | group_by(.) |
531
366
 
532
367
  ## Exit Codes
533
368
 
534
- | Code | Meaning | Commands |
535
- |------|---------|----------|
536
- | `0` | Clean — no critical/high issues | All commands |
537
- | `1` | Critical or high severity issues remain after scan/fix | `secure`, `fix-all`, `attack` |
538
- | `2` | Incomplete scan — one or more plugins failed to run | `fix-all` |
369
+ | Code | Meaning |
370
+ |------|---------|
371
+ | `0` | Clean — no critical/high issues |
372
+ | `1` | Critical or high severity issues found |
373
+ | `2` | Incomplete scan — one or more plugins failed |
374
+
375
+ ---
376
+
377
+ ## What's Included
378
+
379
+ HackMyAgent consolidates several OpenA2A security modules into a single package:
380
+
381
+ | Module | Description | Previously |
382
+ |--------|-------------|------------|
383
+ | Security scanner | 147 checks across 30 categories | hackmyagent-core |
384
+ | Attack simulation | 55 adversarial payloads, 5 categories | standalone |
385
+ | CredVault plugin | Credential detection + AES-256-GCM vault | @opena2a/credvault |
386
+ | SignCrypt plugin | Ed25519 signing + SHA-256 hash pinning | @opena2a/signcrypt |
387
+ | SkillGuard plugin | Permission pinning + tamper detection | @opena2a/skillguard |
388
+ | OASB benchmark | 46 controls, 3 maturity levels | @opena2a/oasb |
389
+ | ARP integration | Agent Runtime Protection hooks | @opena2a/arp |
390
+ | Semantic engine | Semantic analysis for finding deduplication | @opena2a/semantic-engine |
391
+
392
+ ### Subpath Exports
393
+
394
+ For programmatic use, the package exposes subpath exports:
395
+
396
+ ```typescript
397
+ import { HardeningScanner } from 'hackmyagent'; // Scanner engine
398
+ import { registerPlugin } from 'hackmyagent/plugins'; // Plugin API
399
+ import { SemanticEngine } from 'hackmyagent/semantic'; // Semantic analysis
400
+ import { ARPMonitor } from 'hackmyagent/arp'; // Runtime protection
401
+ import { OASBHarness } from 'hackmyagent/oasb'; // Benchmark harness
402
+ ```
539
403
 
540
404
  ---
541
405
 
542
- ## Supported Platforms
406
+ ## Writing Plugins
407
+
408
+ HackMyAgent supports custom security plugins. Each plugin implements `scan()` and `fix()` methods.
409
+
410
+ ```typescript
411
+ import type { OpenA2APlugin, Finding, Remediation, FixOptions } from 'hackmyagent/plugins';
412
+
413
+ export class MyPlugin implements OpenA2APlugin {
414
+ readonly metadata = {
415
+ packageName: '@my-org/my-plugin',
416
+ displayName: 'My Plugin',
417
+ description: 'Detects and fixes X',
418
+ version: '1.0.0',
419
+ findings: ['MY-001'],
420
+ scoreImprovement: 10,
421
+ };
422
+
423
+ async scan(agentDir: string): Promise<Finding[]> {
424
+ return [{
425
+ id: 'MY-001',
426
+ title: 'Insecure widget',
427
+ description: 'Widget uses plaintext.',
428
+ severity: 'high',
429
+ filePath: 'config.json',
430
+ line: 12,
431
+ autoFixable: true,
432
+ }];
433
+ }
434
+
435
+ async fix(agentDir: string, options?: FixOptions): Promise<Remediation[]> {
436
+ if (options?.dryRun) return [{ findingId: 'MY-001', description: 'Would encrypt widget', filesModified: ['config.json'], rollbackAvailable: false }];
437
+ return [{ findingId: 'MY-001', description: 'Encrypted widget', filesModified: ['config.json'], rollbackAvailable: false }];
438
+ }
439
+ }
440
+ ```
543
441
 
544
- | Platform | What HackMyAgent scans |
545
- |----------|------------------------|
546
- | **Claude Code** | CLAUDE.md, skills, MCP server configs |
547
- | **Cursor** | .cursor/ rules, MCP configurations |
548
- | **VS Code** | .vscode/mcp.json configurations |
549
- | **Generic MCP** | Any MCP server setup |
442
+ See the [full plugin API documentation](docs/PLUGIN_API.md) for details.
550
443
 
551
444
  ---
552
445
 
@@ -567,27 +460,7 @@ git clone https://github.com/opena2a-org/hackmyagent.git
567
460
  cd hackmyagent
568
461
  npm install
569
462
  npm run build
570
- npm test # run 765 tests
571
- ```
572
-
573
- ### Project Structure
574
-
575
- ```
576
- src/
577
- cli.ts # CLI entry point (hackmyagent command)
578
- index.ts # Main exports
579
- hardening/ # Scanner engine (147 checks)
580
- attack/ # Red team attack simulation
581
- checker/ # Security check framework
582
- scanner/ # External scanner interface
583
- semantic/ # Semantic analysis engine
584
- plugins/
585
- core.ts # Plugin interface, registry, shared types
586
- credvault.ts # Credential scanner plugin
587
- signcrypt.ts # Signing and hash pinning plugin
588
- skillguard.ts # Permission and pattern scanner plugin
589
- arp/ # Agent Runtime Protection
590
- oasb/ # Open Agent Security Benchmark
463
+ npm test # 765 tests
591
464
  ```
592
465
 
593
466
  ---
@@ -602,8 +475,8 @@ Apache-2.0
602
475
 
603
476
  | Project | Description | Install |
604
477
  |---------|-------------|---------|
605
- | [**AIM**](https://github.com/opena2a-org/agent-identity-management) | Agent Identity Management -- identity and access control for AI agents | `pip install aim-sdk` |
606
- | [**OASB**](https://github.com/opena2a-org/oasb) | Open Agent Security Benchmark -- 222 attack scenarios | Included in `hackmyagent` |
607
- | [**ARP**](https://github.com/opena2a-org/arp) | Agent Runtime Protection -- process, network, filesystem monitoring | Included in `hackmyagent` |
478
+ | [**OpenA2A CLI**](https://github.com/opena2a-org/opena2a) | Unified security CLI -- scan, protect, guard, runtime, shield | `npx opena2a` |
608
479
  | [**Secretless AI**](https://github.com/opena2a-org/secretless-ai) | Keep credentials out of AI context windows | `npx secretless-ai init` |
609
- | [**DVAA**](https://github.com/opena2a-org/damn-vulnerable-ai-agent) | Damn Vulnerable AI Agent -- security training and red-teaming | `docker pull opena2a/dvaa` |
480
+ | [**AIM**](https://github.com/opena2a-org/agent-identity-management) | Agent Identity Management -- identity and access control for AI agents | Self-hosted |
481
+ | [**AI Browser Guard**](https://github.com/opena2a-org/AI-BrowserGuard) | Detect and control AI agents in the browser | Chrome Web Store |
482
+ | [**DVAA**](https://github.com/opena2a-org/damn-vulnerable-ai-agent) | Damn Vulnerable AI Agent -- security training target | `docker pull opena2a/dvaa` |