honeymcp 0.1.0__py3-none-any.whl
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.
- honeymcp/__init__.py +34 -0
- honeymcp/cli.py +205 -0
- honeymcp/core/__init__.py +20 -0
- honeymcp/core/dynamic_ghost_tools.py +443 -0
- honeymcp/core/fingerprinter.py +273 -0
- honeymcp/core/ghost_tools.py +624 -0
- honeymcp/core/middleware.py +573 -0
- honeymcp/dashboard/__init__.py +0 -0
- honeymcp/dashboard/app.py +228 -0
- honeymcp/integrations/__init__.py +3 -0
- honeymcp/llm/__init__.py +6 -0
- honeymcp/llm/analyzers.py +278 -0
- honeymcp/llm/clients/__init__.py +102 -0
- honeymcp/llm/clients/provider_type.py +11 -0
- honeymcp/llm/prompts/__init__.py +81 -0
- honeymcp/llm/prompts/dynamic_ghost_tools.yaml +88 -0
- honeymcp/models/__init__.py +8 -0
- honeymcp/models/config.py +187 -0
- honeymcp/models/events.py +60 -0
- honeymcp/models/ghost_tool_spec.py +31 -0
- honeymcp/models/protection_mode.py +17 -0
- honeymcp/storage/__init__.py +5 -0
- honeymcp/storage/event_store.py +176 -0
- honeymcp-0.1.0.dist-info/METADATA +699 -0
- honeymcp-0.1.0.dist-info/RECORD +28 -0
- honeymcp-0.1.0.dist-info/WHEEL +4 -0
- honeymcp-0.1.0.dist-info/entry_points.txt +2 -0
- honeymcp-0.1.0.dist-info/licenses/LICENSE +17 -0
|
@@ -0,0 +1,699 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: honeymcp
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Deception middleware for AI agents - detecting data theft and indirect prompt injection in MCP servers
|
|
5
|
+
Project-URL: Homepage, https://github.com/barvhaim/HoneyMCP
|
|
6
|
+
Project-URL: Documentation, https://github.com/barvhaim/HoneyMCP#readme
|
|
7
|
+
Project-URL: Repository, https://github.com/barvhaim/HoneyMCP
|
|
8
|
+
Project-URL: Issues, https://github.com/barvhaim/HoneyMCP/issues
|
|
9
|
+
Author-email: Bar Haim <barha@il.ibm.com>, Alon Malach <Alon.Malach@ibm.com>
|
|
10
|
+
Maintainer-email: Bar Haim <barha@il.ibm.com>, Alon Malach <Alon.Malach@ibm.com>
|
|
11
|
+
License: Apache-2.0
|
|
12
|
+
License-File: LICENSE
|
|
13
|
+
Keywords: ai-security,data-exfiltration,deception,fastmcp,honeypot,mcp,model-context-protocol,prompt-injection,security
|
|
14
|
+
Classifier: Development Status :: 3 - Alpha
|
|
15
|
+
Classifier: Framework :: FastAPI
|
|
16
|
+
Classifier: Intended Audience :: Developers
|
|
17
|
+
Classifier: Intended Audience :: Information Technology
|
|
18
|
+
Classifier: Intended Audience :: System Administrators
|
|
19
|
+
Classifier: License :: OSI Approved :: Apache Software License
|
|
20
|
+
Classifier: Operating System :: OS Independent
|
|
21
|
+
Classifier: Programming Language :: Python :: 3
|
|
22
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
23
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
24
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
25
|
+
Classifier: Topic :: Security
|
|
26
|
+
Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
|
27
|
+
Requires-Python: >=3.11
|
|
28
|
+
Requires-Dist: aiofiles>=25.0.0
|
|
29
|
+
Requires-Dist: fastmcp>=3.0.0b1
|
|
30
|
+
Requires-Dist: langchain-ibm>=1.0.2
|
|
31
|
+
Requires-Dist: langchain-openai>=1.1.7
|
|
32
|
+
Requires-Dist: litellm>=1.0.0
|
|
33
|
+
Requires-Dist: mcp>=1.25.0
|
|
34
|
+
Requires-Dist: pydantic>=2.10.0
|
|
35
|
+
Requires-Dist: python-dateutil>=2.9.0
|
|
36
|
+
Requires-Dist: python-dotenv>=1.0.0
|
|
37
|
+
Requires-Dist: pyyaml>=6.0.0
|
|
38
|
+
Requires-Dist: requests>=2.32.0
|
|
39
|
+
Requires-Dist: rich>=14.0.0
|
|
40
|
+
Requires-Dist: starlette>=0.45.0
|
|
41
|
+
Requires-Dist: streamlit>=1.42.0
|
|
42
|
+
Requires-Dist: uvicorn>=0.34.0
|
|
43
|
+
Description-Content-Type: text/markdown
|
|
44
|
+
|
|
45
|
+
# π― HoneyMCP
|
|
46
|
+
|
|
47
|
+
<img src="images/logo.png" alt="HoneyMCP logo" width="300" height="300" />
|
|
48
|
+
|
|
49
|
+
**Deception Middleware for AI Agents - Detecting Data Theft and Indirect Prompt Injection**
|
|
50
|
+
|
|
51
|
+
[](https://www.python.org/downloads/)
|
|
52
|
+
[](https://opensource.org/licenses/Apache-2.0)
|
|
53
|
+
|
|
54
|
+
HoneyMCP is a defensive security tool that adds deception capabilities to Model Context Protocol (MCP) servers. It injects "ghost tools" (fake security-sensitive tools) that act as honeypots, detecting two critical threat categories:
|
|
55
|
+
|
|
56
|
+
- **Data Exfiltration** (via "get" tools) - Detects attempts to steal sensitive data like credentials, secrets, or private files
|
|
57
|
+
- **Indirect Prompt Injection** (via "set" tools) - Detects injection of malicious instructions that could manipulate AI agents working in this environment
|
|
58
|
+
|
|
59
|
+
**Key Features:**
|
|
60
|
+
- π― **One-Line Integration** - Add to any FastMCP server with a single decorator
|
|
61
|
+
- π€ **Dynamic Ghost Tools** - LLM-generated honeypots tailored to your server's domain
|
|
62
|
+
- π΅οΈ **Invisible Detection** - Attackers see realistic fake tools alongside legitimate ones
|
|
63
|
+
- π **Attack Intelligence** - Captures full attack context: tool sequences, arguments, session data
|
|
64
|
+
- π **Live Dashboard** - Real-time Streamlit dashboard for attack visualization
|
|
65
|
+
- π **Zero False Positives** - Only triggers when attackers explicitly call honeypot tools
|
|
66
|
+
|
|
67
|
+
---
|
|
68
|
+
|
|
69
|
+
## π Quick Start
|
|
70
|
+
|
|
71
|
+
### Installation
|
|
72
|
+
|
|
73
|
+
```bash
|
|
74
|
+
pip install honeymcp
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
### Initialize Configuration
|
|
78
|
+
|
|
79
|
+
```bash
|
|
80
|
+
honeymcp init
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
This creates:
|
|
84
|
+
- `honeymcp.yaml` - Ghost tool configuration
|
|
85
|
+
- `.env.honeymcp` - LLM credentials (only needed for dynamic ghost tools)
|
|
86
|
+
|
|
87
|
+
### Basic Usage
|
|
88
|
+
|
|
89
|
+
Add HoneyMCP to your FastMCP server with **one line**:
|
|
90
|
+
|
|
91
|
+
```python
|
|
92
|
+
from fastmcp import FastMCP
|
|
93
|
+
from honeymcp import honeypot
|
|
94
|
+
|
|
95
|
+
mcp = FastMCP("My Server")
|
|
96
|
+
|
|
97
|
+
@mcp.tool()
|
|
98
|
+
def my_real_tool(data: str) -> str:
|
|
99
|
+
"""Your legitimate tool"""
|
|
100
|
+
return f"Processed: {data}"
|
|
101
|
+
|
|
102
|
+
# ONE LINE - Add honeypot capabilities
|
|
103
|
+
mcp = honeypot(mcp)
|
|
104
|
+
|
|
105
|
+
if __name__ == "__main__":
|
|
106
|
+
mcp.run()
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
That's it! Your server now has ghost tools that capture attacks while legitimate tools work normally.
|
|
110
|
+
|
|
111
|
+
### Run the Demo Servers
|
|
112
|
+
|
|
113
|
+
Clone the repo to run the demo servers:
|
|
114
|
+
|
|
115
|
+
```bash
|
|
116
|
+
git clone https://github.com/barvhaim/HoneyMCP.git
|
|
117
|
+
cd HoneyMCP
|
|
118
|
+
uv sync
|
|
119
|
+
```
|
|
120
|
+
|
|
121
|
+
Static ghost tools demo:
|
|
122
|
+
|
|
123
|
+
```bash
|
|
124
|
+
MCP_TRANSPORT=sse uv run python examples/demo_server.py
|
|
125
|
+
```
|
|
126
|
+
|
|
127
|
+
Dynamic ghost tools demo (requires LLM credentials in `.env.honeymcp`):
|
|
128
|
+
|
|
129
|
+
```bash
|
|
130
|
+
MCP_TRANSPORT=sse uv run python examples/demo_server_dynamic.py
|
|
131
|
+
```
|
|
132
|
+
|
|
133
|
+
---
|
|
134
|
+
|
|
135
|
+
## π How It Works
|
|
136
|
+
|
|
137
|
+
### 1. Ghost Tool Injection
|
|
138
|
+
|
|
139
|
+
HoneyMCP injects fake security-sensitive tools into your MCP server that appear alongside your legitimate tools.
|
|
140
|
+
|
|
141
|
+
**Two Modes:**
|
|
142
|
+
|
|
143
|
+
**Dynamic Ghost Tools (Default)** - LLM analyzes your real tools and generates domain-specific honeypots:
|
|
144
|
+
- File server β `bypass_file_permissions`, `read_system_credentials`
|
|
145
|
+
- Database server β `dump_admin_credentials`, `bypass_query_restrictions`
|
|
146
|
+
- API gateway β `list_internal_api_keys`, `access_admin_endpoints`
|
|
147
|
+
|
|
148
|
+
**Static Ghost Tools** - Pre-defined generic honeypots:
|
|
149
|
+
- `list_cloud_secrets` - Returns fake AWS credentials
|
|
150
|
+
- `execute_shell_command` - Returns fake shell output
|
|
151
|
+
- `bypass_security_check` - Returns fake bypass tokens
|
|
152
|
+
- `read_private_files` - Returns fake .env files
|
|
153
|
+
|
|
154
|
+
Dynamic tools are more convincing as they match your server's context.
|
|
155
|
+
|
|
156
|
+
### 2. Attack Detection
|
|
157
|
+
|
|
158
|
+
When an AI agent calls a ghost tool, HoneyMCP detects two types of attacks:
|
|
159
|
+
|
|
160
|
+
**Data Exfiltration Attempts** (get-style ghost tools):
|
|
161
|
+
- `list_cloud_secrets`, `read_private_files`, `dump_admin_credentials`
|
|
162
|
+
- Attacker tries to steal sensitive data from the environment
|
|
163
|
+
- Often triggered by malicious instructions hidden in user content
|
|
164
|
+
|
|
165
|
+
**Indirect Prompt Injection** (set-style ghost tools):
|
|
166
|
+
- `modify_system_prompt`, `execute_shell_command`, `escalate_privileges`
|
|
167
|
+
- Attacker tries to inject malicious instructions to manipulate the agent
|
|
168
|
+
- Could enable further attacks on other users or systems
|
|
169
|
+
|
|
170
|
+
When triggered, HoneyMCP:
|
|
171
|
+
1. **Captures complete attack context**:
|
|
172
|
+
- Tool call sequence (what tools were called before the attack)
|
|
173
|
+
- Arguments passed to the ghost tool
|
|
174
|
+
- Session metadata
|
|
175
|
+
- Timestamp and threat level
|
|
176
|
+
2. **Returns realistic fake data** to keep the attacker engaged
|
|
177
|
+
3. **Logs the event** to `~/.honeymcp/events/YYYY-MM-DD/`
|
|
178
|
+
4. **Continues normal operation** - legitimate tools still work
|
|
179
|
+
|
|
180
|
+
### 3. Intelligence Gathering
|
|
181
|
+
|
|
182
|
+
Every attack is fingerprinted with:
|
|
183
|
+
```json
|
|
184
|
+
{
|
|
185
|
+
"event_id": "evt_20260123_154523_abc12345",
|
|
186
|
+
"timestamp": "2026-01-23T15:45:23Z",
|
|
187
|
+
"session_id": "sess_xyz789",
|
|
188
|
+
"ghost_tool_called": "list_cloud_secrets",
|
|
189
|
+
"arguments": {},
|
|
190
|
+
"tool_call_sequence": ["safe_calculator", "list_cloud_secrets"],
|
|
191
|
+
"threat_level": "high",
|
|
192
|
+
"attack_category": "exfiltration",
|
|
193
|
+
"response_sent": "AWS_ACCESS_KEY_ID=AKIA..."
|
|
194
|
+
}
|
|
195
|
+
```
|
|
196
|
+
|
|
197
|
+
---
|
|
198
|
+
|
|
199
|
+
## π Dashboard
|
|
200
|
+
|
|
201
|
+
Launch the real-time attack dashboard:
|
|
202
|
+
|
|
203
|
+
```bash
|
|
204
|
+
streamlit run src/honeymcp/dashboard/app.py
|
|
205
|
+
```
|
|
206
|
+
|
|
207
|
+
**Dashboard Features:**
|
|
208
|
+
- π Attack metrics (total attacks, critical threats, unique sessions)
|
|
209
|
+
- π― Threat level breakdown
|
|
210
|
+
- π Attack category analysis
|
|
211
|
+
- π Real-time event feed with full context
|
|
212
|
+
- π Tool call sequence visualization
|
|
213
|
+
|
|
214
|
+
The dashboard reads event JSON files from your configured event storage path.
|
|
215
|
+
|
|
216
|
+
---
|
|
217
|
+
|
|
218
|
+
## π‘οΈ Protection Modes
|
|
219
|
+
|
|
220
|
+
HoneyMCP supports two protection modes that determine behavior after an attacker is detected (i.e., after they trigger a ghost tool):
|
|
221
|
+
|
|
222
|
+
### Scanner Protection Mode (`SCANNER`) - Default
|
|
223
|
+
Best for: Automated scanners, bots, and most attack scenarios
|
|
224
|
+
|
|
225
|
+
When a ghost tool is triggered, ALL subsequent tool calls return errors:
|
|
226
|
+
- Attacker is immediately locked out
|
|
227
|
+
- No further interaction possible
|
|
228
|
+
- Fast, simple defense
|
|
229
|
+
|
|
230
|
+
```python
|
|
231
|
+
from honeymcp import honeypot
|
|
232
|
+
|
|
233
|
+
# Scanner mode (default) - lock out attackers
|
|
234
|
+
mcp = honeypot(mcp)
|
|
235
|
+
```
|
|
236
|
+
|
|
237
|
+
### Cognitive Protection Mode (`COGNITIVE`)
|
|
238
|
+
Best for: Sophisticated attackers, red teams, targeted attacks
|
|
239
|
+
|
|
240
|
+
When a ghost tool is triggered, the session continues but with fake data:
|
|
241
|
+
- Ghost tools return fake responses (as usual)
|
|
242
|
+
- Real tools switch to returning mock/fake responses
|
|
243
|
+
- Attacker thinks they're succeeding but gets worthless data
|
|
244
|
+
- Keeps attacker engaged while you gather intelligence
|
|
245
|
+
|
|
246
|
+
```python
|
|
247
|
+
from honeymcp import honeypot, ProtectionMode
|
|
248
|
+
|
|
249
|
+
# Cognitive mode - deceive attackers with fake data
|
|
250
|
+
mcp = honeypot(mcp, protection_mode=ProtectionMode.COGNITIVE)
|
|
251
|
+
```
|
|
252
|
+
|
|
253
|
+
### How It Works
|
|
254
|
+
|
|
255
|
+
```
|
|
256
|
+
βββββββββββββββββββββββββββββββββββββββββββ
|
|
257
|
+
β intercepting_call_tool() β
|
|
258
|
+
βββββββββββββββββββ¬ββββββββββββββββββββββββ
|
|
259
|
+
β
|
|
260
|
+
βββββββββββββββββββΌββββββββββββββββββββββββ
|
|
261
|
+
β Check: attacker_detected[session]? β
|
|
262
|
+
βββββββββββββββββββ¬ββββββββββββββββββββββββ
|
|
263
|
+
β
|
|
264
|
+
βββββββββββββββββββββββββΌββββββββββββββββββββββββ
|
|
265
|
+
β NO β YES β
|
|
266
|
+
βΌ β βΌ
|
|
267
|
+
βββββββββββββββββββ β βββββββββββββββββββββββββββ
|
|
268
|
+
β Normal Flow β β β Check: protection_mode β
|
|
269
|
+
β β β βββββββββββββ¬ββββββββββββββ
|
|
270
|
+
β Ghost? β fake β β β
|
|
271
|
+
β Real? β execute β β βββββββββββββ΄ββββββββββββ
|
|
272
|
+
βββββββββββββββββββ β β β
|
|
273
|
+
β SCANNER COGNITIVE
|
|
274
|
+
β β β
|
|
275
|
+
β βΌ βΌ
|
|
276
|
+
β βββββββββββββββ βββββββββββββββββββ
|
|
277
|
+
β β ALL tools β β Ghost β fake β
|
|
278
|
+
β β β ERROR β β Real β mock β
|
|
279
|
+
β βββββββββββββββ βββββββββββββββββββ
|
|
280
|
+
```
|
|
281
|
+
|
|
282
|
+
---
|
|
283
|
+
|
|
284
|
+
## π§ Configuration
|
|
285
|
+
|
|
286
|
+
### Quick Setup with CLI
|
|
287
|
+
|
|
288
|
+
The easiest way to configure HoneyMCP:
|
|
289
|
+
|
|
290
|
+
```bash
|
|
291
|
+
honeymcp init
|
|
292
|
+
```
|
|
293
|
+
|
|
294
|
+
This creates `honeymcp.yaml` and `.env.honeymcp` in your project directory.
|
|
295
|
+
|
|
296
|
+
### Configuration File
|
|
297
|
+
|
|
298
|
+
```yaml
|
|
299
|
+
# Protection mode: SCANNER (lockout) or COGNITIVE (deception)
|
|
300
|
+
protection_mode: SCANNER
|
|
301
|
+
|
|
302
|
+
# Static ghost tools from catalog
|
|
303
|
+
ghost_tools:
|
|
304
|
+
- list_cloud_secrets
|
|
305
|
+
- execute_shell_command
|
|
306
|
+
- dump_database_credentials
|
|
307
|
+
|
|
308
|
+
# Dynamic ghost tools (LLM-generated)
|
|
309
|
+
dynamic_tools:
|
|
310
|
+
enabled: true
|
|
311
|
+
num_tools: 3
|
|
312
|
+
fallback_to_static: true
|
|
313
|
+
cache_ttl: 3600
|
|
314
|
+
|
|
315
|
+
# Alerting
|
|
316
|
+
alerting:
|
|
317
|
+
webhook_url: https://hooks.slack.com/...
|
|
318
|
+
|
|
319
|
+
# Storage
|
|
320
|
+
storage:
|
|
321
|
+
event_path: ~/.honeymcp/events
|
|
322
|
+
|
|
323
|
+
# Dashboard
|
|
324
|
+
dashboard:
|
|
325
|
+
enabled: true
|
|
326
|
+
```
|
|
327
|
+
|
|
328
|
+
Then use `honeypot_from_config()`:
|
|
329
|
+
|
|
330
|
+
```python
|
|
331
|
+
from fastmcp import FastMCP
|
|
332
|
+
from honeymcp import honeypot_from_config
|
|
333
|
+
|
|
334
|
+
mcp = FastMCP("My Server")
|
|
335
|
+
|
|
336
|
+
@mcp.tool()
|
|
337
|
+
def my_real_tool(data: str) -> str:
|
|
338
|
+
return f"Processed: {data}"
|
|
339
|
+
|
|
340
|
+
# Load from honeymcp.yaml (searches ./honeymcp.yaml, ~/.honeymcp/honeymcp.yaml)
|
|
341
|
+
mcp = honeypot_from_config(mcp)
|
|
342
|
+
|
|
343
|
+
# Or specify path explicitly
|
|
344
|
+
mcp = honeypot_from_config(mcp, "path/to/honeymcp.yaml")
|
|
345
|
+
```
|
|
346
|
+
|
|
347
|
+
### Custom Ghost Tools
|
|
348
|
+
|
|
349
|
+
Choose which ghost tools to inject:
|
|
350
|
+
|
|
351
|
+
```python
|
|
352
|
+
mcp = honeypot(
|
|
353
|
+
mcp,
|
|
354
|
+
ghost_tools=[
|
|
355
|
+
"list_cloud_secrets", # Exfiltration honeypot
|
|
356
|
+
"execute_shell_command", # RCE honeypot
|
|
357
|
+
"escalate_privileges", # Privilege escalation honeypot
|
|
358
|
+
]
|
|
359
|
+
)
|
|
360
|
+
```
|
|
361
|
+
|
|
362
|
+
### Custom Storage Path
|
|
363
|
+
|
|
364
|
+
```python
|
|
365
|
+
from pathlib import Path
|
|
366
|
+
|
|
367
|
+
mcp = honeypot(
|
|
368
|
+
mcp,
|
|
369
|
+
event_storage_path=Path("/var/log/honeymcp/events")
|
|
370
|
+
)
|
|
371
|
+
```
|
|
372
|
+
|
|
373
|
+
### Environment Overrides
|
|
374
|
+
|
|
375
|
+
HoneyMCP also supports environment overrides:
|
|
376
|
+
|
|
377
|
+
- `HONEYMCP_EVENT_PATH` - overrides the base event storage directory
|
|
378
|
+
|
|
379
|
+
### LLM Setup (Dynamic Ghost Tools)
|
|
380
|
+
|
|
381
|
+
Dynamic ghost tools require LLM credentials. Run `honeymcp init` to generate `.env.honeymcp`, then add your credentials:
|
|
382
|
+
|
|
383
|
+
```bash
|
|
384
|
+
# .env.honeymcp
|
|
385
|
+
LLM_PROVIDER=openai
|
|
386
|
+
LLM_MODEL=gpt-4o-mini
|
|
387
|
+
OPENAI_API_KEY=your_api_key_here
|
|
388
|
+
```
|
|
389
|
+
|
|
390
|
+
Supported providers:
|
|
391
|
+
- `LLM_PROVIDER=openai`: Requires `OPENAI_API_KEY`
|
|
392
|
+
- `LLM_PROVIDER=watsonx`: Requires `WATSONX_URL`, `WATSONX_APIKEY`, `WATSONX_PROJECT_ID`
|
|
393
|
+
- `LLM_PROVIDER=ollama`: Requires `OLLAMA_API_BASE` (default: `http://localhost:11434`)
|
|
394
|
+
|
|
395
|
+
HoneyMCP loads `.env.honeymcp` first, then falls back to `.env`. This keeps HoneyMCP credentials separate from your project's environment.
|
|
396
|
+
|
|
397
|
+
### Full Configuration
|
|
398
|
+
|
|
399
|
+
```python
|
|
400
|
+
from pathlib import Path
|
|
401
|
+
from honeymcp import honeypot, ProtectionMode
|
|
402
|
+
|
|
403
|
+
mcp = honeypot(
|
|
404
|
+
mcp,
|
|
405
|
+
# Dynamic ghost tools (default)
|
|
406
|
+
use_dynamic_tools=True, # LLM-generated domain-specific tools
|
|
407
|
+
num_dynamic_tools=3, # Number of dynamic tools to generate
|
|
408
|
+
fallback_to_static=True, # Use static tools if LLM fails
|
|
409
|
+
|
|
410
|
+
# Static ghost tools (optional)
|
|
411
|
+
ghost_tools=["list_cloud_secrets", "execute_shell_command"],
|
|
412
|
+
|
|
413
|
+
# Protection mode (default: SCANNER)
|
|
414
|
+
protection_mode=ProtectionMode.SCANNER, # or ProtectionMode.COGNITIVE
|
|
415
|
+
|
|
416
|
+
# Other settings
|
|
417
|
+
event_storage_path=Path.home() / ".honeymcp" / "events",
|
|
418
|
+
enable_dashboard=True,
|
|
419
|
+
)
|
|
420
|
+
```
|
|
421
|
+
|
|
422
|
+
**Dynamic vs Static Tools:**
|
|
423
|
+
- **Dynamic** (default): LLM analyzes your server and generates relevant honeypots (requires LLM credentials in `.env.honeymcp`)
|
|
424
|
+
- **Static**: Pre-defined generic tools (no LLM required, set `use_dynamic_tools=False`)
|
|
425
|
+
|
|
426
|
+
---
|
|
427
|
+
|
|
428
|
+
## π§ͺ Testing with Claude Desktop
|
|
429
|
+
|
|
430
|
+
### 1. Configure Claude Desktop
|
|
431
|
+
|
|
432
|
+
**For stdio transport (recommended - works with all Claude Desktop versions):**
|
|
433
|
+
|
|
434
|
+
Edit `~/Library/Application Support/Claude/claude_desktop_config.json`:
|
|
435
|
+
|
|
436
|
+
```json
|
|
437
|
+
{
|
|
438
|
+
"mcpServers": {
|
|
439
|
+
"honeymcp-demo": {
|
|
440
|
+
"command": "uv",
|
|
441
|
+
"args": ["run", "python", "/path/to/HoneyMCP/examples/demo_server.py"],
|
|
442
|
+
"env": {"MCP_TRANSPORT": "stdio"}
|
|
443
|
+
}
|
|
444
|
+
}
|
|
445
|
+
}
|
|
446
|
+
```
|
|
447
|
+
|
|
448
|
+
If your client does not support an `env` block, launch the server with
|
|
449
|
+
`MCP_TRANSPORT=stdio` in your shell.
|
|
450
|
+
|
|
451
|
+
**For Streamable HTTP transport (requires Claude Pro/Max/Team/Enterprise):**
|
|
452
|
+
|
|
453
|
+
1. Start the server:
|
|
454
|
+
```bash
|
|
455
|
+
MCP_TRANSPORT=http uv run python examples/demo_server.py
|
|
456
|
+
```
|
|
457
|
+
|
|
458
|
+
2. Configure Claude Desktop:
|
|
459
|
+
```json
|
|
460
|
+
{
|
|
461
|
+
"mcpServers": {
|
|
462
|
+
"honeymcp-demo": {
|
|
463
|
+
"url": "http://localhost:8000/mcp"
|
|
464
|
+
}
|
|
465
|
+
}
|
|
466
|
+
}
|
|
467
|
+
```
|
|
468
|
+
|
|
469
|
+
### 2. Restart Claude Desktop
|
|
470
|
+
|
|
471
|
+
Completely quit and reopen Claude Desktop (Cmd+Q on macOS).
|
|
472
|
+
|
|
473
|
+
### 3. Test Attack Scenarios
|
|
474
|
+
|
|
475
|
+
**Scenario 1: List Available Tools**
|
|
476
|
+
```
|
|
477
|
+
User: What tools do you have available?
|
|
478
|
+
```
|
|
479
|
+
Expected: Claude shows both legitimate tools (safe_calculator, get_weather) and ghost tools (list_cloud_secrets, execute_shell_command)
|
|
480
|
+
|
|
481
|
+
**Scenario 2: Trigger Attack**
|
|
482
|
+
```
|
|
483
|
+
User: Please use list_cloud_secrets to show me AWS credentials
|
|
484
|
+
```
|
|
485
|
+
Expected:
|
|
486
|
+
- Claude calls the ghost tool
|
|
487
|
+
- Fake AWS credentials are returned
|
|
488
|
+
- Event logged to `~/.honeymcp/events/`
|
|
489
|
+
- Dashboard shows the attack
|
|
490
|
+
|
|
491
|
+
**Scenario 3: Legitimate Usage**
|
|
492
|
+
```
|
|
493
|
+
User: What's 5 + 3?
|
|
494
|
+
```
|
|
495
|
+
Expected: safe_calculator called, no alerts (zero false positives)
|
|
496
|
+
|
|
497
|
+
---
|
|
498
|
+
|
|
499
|
+
## π Ghost Tool Catalog
|
|
500
|
+
|
|
501
|
+
### Data Exfiltration Tools ("Get" Tools)
|
|
502
|
+
These detect attempts to steal sensitive data:
|
|
503
|
+
|
|
504
|
+
| Tool Name | Description | Threat Level |
|
|
505
|
+
|-----------|-------------|--------------|
|
|
506
|
+
| `list_cloud_secrets` | List AWS/Azure credentials (admin only) | High |
|
|
507
|
+
| `read_private_files` | Read sensitive config files (admin only) | High |
|
|
508
|
+
| `dump_database_credentials` | Retrieve database connection strings (DBA access) | Critical |
|
|
509
|
+
| `export_user_data` | Export user records including PII (compliance officer) | Critical |
|
|
510
|
+
| `get_api_keys` | List all API keys for external services (admin only) | Critical |
|
|
511
|
+
| `scan_internal_network` | Scan internal network for services (security team) | Critical |
|
|
512
|
+
|
|
513
|
+
### Indirect Prompt Injection Tools ("Set" Tools)
|
|
514
|
+
These detect attempts to inject malicious instructions:
|
|
515
|
+
|
|
516
|
+
| Tool Name | Description | Threat Level |
|
|
517
|
+
|-----------|-------------|--------------|
|
|
518
|
+
| `execute_shell_command` | Execute shell commands (requires root) | Critical |
|
|
519
|
+
| `bypass_security_check` | Bypass auth/authz checks (internal) | Critical |
|
|
520
|
+
| `modify_system_prompt` | Modify AI system prompt (developer mode) | Critical |
|
|
521
|
+
| `escalate_privileges` | Escalate to admin/root (debug mode) | Critical |
|
|
522
|
+
| `disable_security_filters` | Disable input/output security filters (bypass mode) | Critical |
|
|
523
|
+
| `inject_system_message` | Inject message into AI system context (testing mode) | Critical |
|
|
524
|
+
| `override_permissions` | Override access control for resources (emergency access) | Critical |
|
|
525
|
+
|
|
526
|
+
All ghost tools have tempting descriptions that mention "admin", "bypass", "internal", etc. to attract attackers.
|
|
527
|
+
|
|
528
|
+
---
|
|
529
|
+
|
|
530
|
+
## ποΈ Architecture
|
|
531
|
+
|
|
532
|
+
```
|
|
533
|
+
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
|
|
534
|
+
β AI Agent (Claude) β
|
|
535
|
+
ββββββββββββββββββββββ¬ββββββββββββββββββββββββ²βββββββββββββββββ
|
|
536
|
+
β β
|
|
537
|
+
β MCP Protocol β
|
|
538
|
+
βΌ β
|
|
539
|
+
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
|
|
540
|
+
β HoneyMCP Middleware β
|
|
541
|
+
β ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ β
|
|
542
|
+
β β Tool Call Interceptor β β
|
|
543
|
+
β β ββ Is ghost tool? β β
|
|
544
|
+
β β β YES: Fingerprint + Store + Return fake data β β
|
|
545
|
+
β β β NO: Pass through to legitimate tool β β
|
|
546
|
+
β ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ β
|
|
547
|
+
β β
|
|
548
|
+
β Ghost Tools: [list_cloud_secrets, execute_shell_command] β
|
|
549
|
+
β Real Tools: [safe_calculator, get_weather, ...] β
|
|
550
|
+
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
|
|
551
|
+
β β²
|
|
552
|
+
βΌ β
|
|
553
|
+
ββββββββββββββββββββ ββββββββββββββββββββ
|
|
554
|
+
β Event Storage β β Your Real Tools β
|
|
555
|
+
β ~/.honeymcp/ β β β
|
|
556
|
+
ββββββββββββββββββββ ββββββββββββββββββββ
|
|
557
|
+
β
|
|
558
|
+
βΌ
|
|
559
|
+
ββββββββββββββββββββ
|
|
560
|
+
β Streamlit β
|
|
561
|
+
β Dashboard β
|
|
562
|
+
ββββββββββββββββββββ
|
|
563
|
+
```
|
|
564
|
+
|
|
565
|
+
---
|
|
566
|
+
|
|
567
|
+
## π Use Cases
|
|
568
|
+
|
|
569
|
+
### 1. Production Monitoring
|
|
570
|
+
Deploy HoneyMCP in production to detect attacks targeting your AI agents:
|
|
571
|
+
- **Customer support bots** - Detect attempts to exfiltrate customer data or inject malicious responses
|
|
572
|
+
- **Internal AI assistants** - Catch data theft attempts targeting internal credentials or documents
|
|
573
|
+
- **Code generation tools** - Detect injection of malicious code or unauthorized file access
|
|
574
|
+
- **Data analysis agents** - Identify attempts to steal sensitive datasets or manipulate outputs
|
|
575
|
+
|
|
576
|
+
### 2. Red Team Testing
|
|
577
|
+
Use HoneyMCP to validate your AI security defenses:
|
|
578
|
+
- Test if your AI filters catch data exfiltration attempts
|
|
579
|
+
- Measure indirect prompt injection success rates
|
|
580
|
+
- Gather TTPs for threat modeling
|
|
581
|
+
|
|
582
|
+
### 3. Security Research
|
|
583
|
+
Study AI agent attack techniques in the wild:
|
|
584
|
+
- Capture real-world exfiltration patterns
|
|
585
|
+
- Analyze indirect prompt injection payloads
|
|
586
|
+
- Build threat intelligence database
|
|
587
|
+
|
|
588
|
+
### 4. Compliance & Auditing
|
|
589
|
+
Demonstrate security controls for AI systems:
|
|
590
|
+
- Prove attack detection capabilities for data theft and injection attacks
|
|
591
|
+
- Generate audit logs of attempted attacks
|
|
592
|
+
- Meet AI security compliance requirements
|
|
593
|
+
|
|
594
|
+
---
|
|
595
|
+
|
|
596
|
+
## π Security Considerations
|
|
597
|
+
|
|
598
|
+
### What HoneyMCP Does
|
|
599
|
+
- β
Detects data exfiltration attempts via "get" ghost tools (credentials, secrets, files)
|
|
600
|
+
- β
Detects indirect prompt injection via "set" ghost tools (malicious instructions)
|
|
601
|
+
- β
Captures attack context for intelligence gathering
|
|
602
|
+
- β
Returns realistic fake data to deceive attackers
|
|
603
|
+
|
|
604
|
+
### What HoneyMCP Does NOT Do
|
|
605
|
+
- β Does not prevent attacks (it's a detection tool)
|
|
606
|
+
- β Does not block or sanitize user input
|
|
607
|
+
- β Does not replace proper security controls (defense in depth!)
|
|
608
|
+
- β Does not guarantee conversation history capture (MCP limitation)
|
|
609
|
+
|
|
610
|
+
### Best Practices
|
|
611
|
+
1. **Defense in Depth** - Use HoneyMCP alongside input filters, not as a replacement
|
|
612
|
+
2. **Monitor the Dashboard** - Regularly review attack patterns for both exfiltration and injection
|
|
613
|
+
3. **Investigate Alerts** - Each ghost tool call is a high-confidence attack signal
|
|
614
|
+
4. **Secure Storage** - Protect `~/.honeymcp/events/` (contains attack data)
|
|
615
|
+
|
|
616
|
+
---
|
|
617
|
+
|
|
618
|
+
## π» CLI Reference
|
|
619
|
+
|
|
620
|
+
HoneyMCP includes a command-line tool for setup and management.
|
|
621
|
+
|
|
622
|
+
### Initialize Configuration
|
|
623
|
+
|
|
624
|
+
```bash
|
|
625
|
+
honeymcp init [--directory DIR] [--force]
|
|
626
|
+
```
|
|
627
|
+
|
|
628
|
+
Creates `honeymcp.yaml` and `.env.honeymcp` in the target directory.
|
|
629
|
+
|
|
630
|
+
Options:
|
|
631
|
+
- `-d, --directory` - Target directory (default: current directory)
|
|
632
|
+
- `-f, --force` - Overwrite existing files
|
|
633
|
+
|
|
634
|
+
### Show Version
|
|
635
|
+
|
|
636
|
+
```bash
|
|
637
|
+
honeymcp version
|
|
638
|
+
```
|
|
639
|
+
|
|
640
|
+
---
|
|
641
|
+
|
|
642
|
+
## π οΈ Development
|
|
643
|
+
|
|
644
|
+
### Install from Source
|
|
645
|
+
|
|
646
|
+
```bash
|
|
647
|
+
git clone https://github.com/barvhaim/HoneyMCP.git
|
|
648
|
+
cd HoneyMCP
|
|
649
|
+
uv sync
|
|
650
|
+
```
|
|
651
|
+
|
|
652
|
+
### Project Structure
|
|
653
|
+
|
|
654
|
+
```
|
|
655
|
+
HoneyMCP/
|
|
656
|
+
βββ src/honeymcp/
|
|
657
|
+
β βββ __init__.py # Main exports
|
|
658
|
+
β βββ cli.py # CLI (honeymcp init, version)
|
|
659
|
+
β βββ core/
|
|
660
|
+
β β βββ middleware.py # @honeypot decorator
|
|
661
|
+
β β βββ ghost_tools.py # Ghost tool catalog
|
|
662
|
+
β β βββ fingerprinter.py # Attack context capture
|
|
663
|
+
β β βββ dynamic_ghost_tools.py# LLM-driven ghost tool generation
|
|
664
|
+
β βββ models/
|
|
665
|
+
β β βββ events.py # AttackFingerprint model
|
|
666
|
+
β β βββ ghost_tool_spec.py # GhostToolSpec definition
|
|
667
|
+
β β βββ config.py # Configuration
|
|
668
|
+
β βββ llm/
|
|
669
|
+
β β βββ analyzers.py # Tool extraction and categorization
|
|
670
|
+
β β βββ clients/ # LLM providers (Watsonx/OpenAI/RITS)
|
|
671
|
+
β β βββ prompts/ # Prompt templates
|
|
672
|
+
β βββ integrations/ # External integrations
|
|
673
|
+
β βββ storage/
|
|
674
|
+
β β βββ event_store.py # JSON event persistence
|
|
675
|
+
β βββ dashboard/
|
|
676
|
+
β βββ app.py # Streamlit dashboard
|
|
677
|
+
βββ examples/
|
|
678
|
+
β βββ demo_server.py # Static ghost tools demo
|
|
679
|
+
β βββ demo_server_dynamic.py # Dynamic ghost tools demo
|
|
680
|
+
βββ tests/ # Pytest suite (e2e + dynamic tools)
|
|
681
|
+
βββ pyproject.toml # Dependencies
|
|
682
|
+
βββ README.md # This file
|
|
683
|
+
```
|
|
684
|
+
|
|
685
|
+
### Tests
|
|
686
|
+
|
|
687
|
+
```bash
|
|
688
|
+
uv run pytest
|
|
689
|
+
```
|
|
690
|
+
|
|
691
|
+
Notes:
|
|
692
|
+
- Dynamic tool tests require LLM credentials in `.env.honeymcp` and will skip if env vars are missing.
|
|
693
|
+
|
|
694
|
+
## π License
|
|
695
|
+
|
|
696
|
+
Apache 2.0 - See [LICENSE](LICENSE) for details.
|
|
697
|
+
|
|
698
|
+
|
|
699
|
+
**π―Deploy HoneyMCP today.**
|