agent-audit 0.1.0__py3-none-any.whl → 0.2.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.
- agent_audit/cli/commands/scan.py +41 -30
- agent_audit/cli/formatters/json.py +2 -2
- agent_audit/cli/formatters/sarif.py +9 -3
- agent_audit/models/finding.py +19 -7
- agent_audit/models/risk.py +13 -0
- agent_audit/rules/builtin/owasp_agentic.yaml +126 -0
- agent_audit/rules/builtin/owasp_agentic_v2.yaml +832 -0
- agent_audit/rules/engine.py +60 -1
- agent_audit/scanners/base.py +5 -3
- agent_audit/scanners/config_scanner.py +1 -1
- agent_audit/scanners/mcp_config_scanner.py +4 -3
- agent_audit/scanners/mcp_inspector.py +5 -4
- agent_audit/scanners/python_scanner.py +668 -7
- agent_audit/utils/mcp_client.py +1 -0
- agent_audit/version.py +1 -1
- {agent_audit-0.1.0.dist-info → agent_audit-0.2.0.dist-info}/METADATA +49 -35
- {agent_audit-0.1.0.dist-info → agent_audit-0.2.0.dist-info}/RECORD +19 -17
- {agent_audit-0.1.0.dist-info → agent_audit-0.2.0.dist-info}/WHEEL +0 -0
- {agent_audit-0.1.0.dist-info → agent_audit-0.2.0.dist-info}/entry_points.txt +0 -0
|
@@ -0,0 +1,832 @@
|
|
|
1
|
+
# OWASP Agentic Top 10 (2026) - Extended Rules
|
|
2
|
+
# Reference: https://genai.owasp.org/resource/owasp-top-10-for-agentic-applications-for-2026/
|
|
3
|
+
# NOTE: Do NOT modify this file manually. All new rules should be appended.
|
|
4
|
+
|
|
5
|
+
rules:
|
|
6
|
+
|
|
7
|
+
# =============================================================================
|
|
8
|
+
# ASI-01: Agent Goal Hijack
|
|
9
|
+
# Attacker manipulates agent's goals, decision logic, or task selection through
|
|
10
|
+
# malicious input. Unlike simple prompt injection, Goal Hijack affects the
|
|
11
|
+
# agent's multi-step planning behavior.
|
|
12
|
+
# =============================================================================
|
|
13
|
+
|
|
14
|
+
- id: AGENT-010
|
|
15
|
+
title: "System Prompt Injection Vector in User Input Path"
|
|
16
|
+
description: >
|
|
17
|
+
User-controlled input is concatenated directly into system prompts or
|
|
18
|
+
agent instructions without sanitization. This enables Agent Goal Hijack
|
|
19
|
+
(ASI-01) where attackers can redirect the agent's planning and objectives.
|
|
20
|
+
severity: critical
|
|
21
|
+
category: goal_hijack
|
|
22
|
+
owasp_agentic_id: "ASI-01"
|
|
23
|
+
cwe_id: "CWE-77"
|
|
24
|
+
|
|
25
|
+
detection:
|
|
26
|
+
type: ast
|
|
27
|
+
patterns:
|
|
28
|
+
- pattern_type: "function_arg_fstring"
|
|
29
|
+
function_names:
|
|
30
|
+
- "ChatPromptTemplate.from_messages"
|
|
31
|
+
- "SystemMessage"
|
|
32
|
+
- "SystemMessagePromptTemplate"
|
|
33
|
+
- "HumanMessagePromptTemplate.from_template"
|
|
34
|
+
arg_contains_fstring: true
|
|
35
|
+
context: "system_prompt"
|
|
36
|
+
|
|
37
|
+
- pattern_type: "string_concat_to_prompt"
|
|
38
|
+
target_variables:
|
|
39
|
+
- "system_prompt"
|
|
40
|
+
- "system_message"
|
|
41
|
+
- "instructions"
|
|
42
|
+
- "system_instructions"
|
|
43
|
+
- "agent_prompt"
|
|
44
|
+
operations:
|
|
45
|
+
- "format"
|
|
46
|
+
- "+"
|
|
47
|
+
- "f-string"
|
|
48
|
+
- ".join"
|
|
49
|
+
|
|
50
|
+
- pattern_type: "unsanitized_template_variable"
|
|
51
|
+
template_functions:
|
|
52
|
+
- "PromptTemplate"
|
|
53
|
+
- "ChatPromptTemplate"
|
|
54
|
+
dangerous_variable_sources:
|
|
55
|
+
- "request"
|
|
56
|
+
- "user_input"
|
|
57
|
+
- "query"
|
|
58
|
+
- "message"
|
|
59
|
+
- "input"
|
|
60
|
+
|
|
61
|
+
remediation:
|
|
62
|
+
description: >
|
|
63
|
+
Never concatenate user input directly into system prompts.
|
|
64
|
+
Use structured prompt templates with clear separation between
|
|
65
|
+
system instructions and user data. Implement input validation
|
|
66
|
+
and sanitization before passing to any prompt template.
|
|
67
|
+
code_example: |
|
|
68
|
+
# BAD: Direct concatenation
|
|
69
|
+
prompt = f"You are an agent. User says: {user_input}"
|
|
70
|
+
|
|
71
|
+
# GOOD: Structured separation
|
|
72
|
+
messages = [
|
|
73
|
+
SystemMessage(content="You are a helpful agent."),
|
|
74
|
+
HumanMessage(content=sanitize(user_input))
|
|
75
|
+
]
|
|
76
|
+
references:
|
|
77
|
+
- "https://genai.owasp.org/resource/owasp-top-10-for-agentic-applications-for-2026/"
|
|
78
|
+
- "https://owasp.org/www-project-top-10-for-large-language-model-applications/"
|
|
79
|
+
|
|
80
|
+
- id: AGENT-011
|
|
81
|
+
title: "Missing Goal Validation / Instruction Boundary"
|
|
82
|
+
description: >
|
|
83
|
+
Agent configuration lacks explicit goal boundaries or instruction
|
|
84
|
+
immutability controls. Without 'Intent Capsule' patterns or goal
|
|
85
|
+
validation, the agent's objectives can be silently redirected via
|
|
86
|
+
poisoned documents, emails, or tool outputs (ASI-01).
|
|
87
|
+
severity: high
|
|
88
|
+
category: goal_hijack
|
|
89
|
+
owasp_agentic_id: "ASI-01"
|
|
90
|
+
|
|
91
|
+
detection:
|
|
92
|
+
type: config
|
|
93
|
+
patterns:
|
|
94
|
+
- pattern_type: "missing_config_key"
|
|
95
|
+
config_contexts:
|
|
96
|
+
- framework: "langchain"
|
|
97
|
+
required_keys:
|
|
98
|
+
- "allowed_tools"
|
|
99
|
+
- "max_iterations"
|
|
100
|
+
- framework: "crewai"
|
|
101
|
+
required_keys:
|
|
102
|
+
- "goal"
|
|
103
|
+
- "backstory"
|
|
104
|
+
- "max_iter"
|
|
105
|
+
- framework: "autogen"
|
|
106
|
+
required_keys:
|
|
107
|
+
- "system_message"
|
|
108
|
+
- "max_consecutive_auto_reply"
|
|
109
|
+
|
|
110
|
+
- pattern_type: "agent_without_input_guard"
|
|
111
|
+
indicators:
|
|
112
|
+
- "AgentExecutor"
|
|
113
|
+
- "initialize_agent"
|
|
114
|
+
- "Agent("
|
|
115
|
+
missing_guards:
|
|
116
|
+
- "input_validator"
|
|
117
|
+
- "input_filter"
|
|
118
|
+
- "input_guard"
|
|
119
|
+
- "prompt_guard"
|
|
120
|
+
|
|
121
|
+
remediation:
|
|
122
|
+
description: >
|
|
123
|
+
Implement explicit goal boundaries for all agents. Use immutable
|
|
124
|
+
system instructions, define allowed_tools explicitly, set
|
|
125
|
+
max_iterations, and add input validation before agent execution.
|
|
126
|
+
code_example: |
|
|
127
|
+
# GOOD: Explicit boundaries
|
|
128
|
+
agent = AgentExecutor(
|
|
129
|
+
agent=agent,
|
|
130
|
+
tools=allowed_tools_only,
|
|
131
|
+
max_iterations=10,
|
|
132
|
+
handle_parsing_errors=True,
|
|
133
|
+
early_stopping_method="generate",
|
|
134
|
+
)
|
|
135
|
+
references:
|
|
136
|
+
- "https://genai.owasp.org/resource/owasp-top-10-for-agentic-applications-for-2026/"
|
|
137
|
+
|
|
138
|
+
# =============================================================================
|
|
139
|
+
# ASI-03: Identity and Privilege Abuse
|
|
140
|
+
# Agent misuses its identity or inherits credentials from other services for
|
|
141
|
+
# privilege escalation. Agents are the most dangerous non-human identity (NHI)
|
|
142
|
+
# and require zero-trust identity management.
|
|
143
|
+
# =============================================================================
|
|
144
|
+
|
|
145
|
+
- id: AGENT-013
|
|
146
|
+
title: "Agent with Long-Lived or Shared Credentials"
|
|
147
|
+
description: >
|
|
148
|
+
Agent uses long-lived API keys, shared service accounts, or
|
|
149
|
+
hardcoded tokens instead of short-lived, scoped credentials.
|
|
150
|
+
This violates zero-trust identity principles and enables
|
|
151
|
+
Identity & Privilege Abuse (ASI-03).
|
|
152
|
+
severity: high
|
|
153
|
+
category: identity_privilege_abuse
|
|
154
|
+
owasp_agentic_id: "ASI-03"
|
|
155
|
+
cwe_id: "CWE-798"
|
|
156
|
+
|
|
157
|
+
detection:
|
|
158
|
+
type: ast
|
|
159
|
+
patterns:
|
|
160
|
+
- pattern_type: "hardcoded_credential_in_agent"
|
|
161
|
+
indicators:
|
|
162
|
+
- assignment_to:
|
|
163
|
+
- "api_key"
|
|
164
|
+
- "secret_key"
|
|
165
|
+
- "access_token"
|
|
166
|
+
- "service_account_key"
|
|
167
|
+
- "bearer_token"
|
|
168
|
+
value_is: "string_literal"
|
|
169
|
+
context_near:
|
|
170
|
+
- "Agent"
|
|
171
|
+
- "Tool"
|
|
172
|
+
- "LLM"
|
|
173
|
+
- "ChatOpenAI"
|
|
174
|
+
- "Anthropic"
|
|
175
|
+
|
|
176
|
+
- pattern_type: "unscoped_env_credential"
|
|
177
|
+
functions:
|
|
178
|
+
- "os.environ.get"
|
|
179
|
+
- "os.getenv"
|
|
180
|
+
variable_names:
|
|
181
|
+
- "API_KEY"
|
|
182
|
+
- "SECRET_KEY"
|
|
183
|
+
- "SERVICE_TOKEN"
|
|
184
|
+
missing_patterns:
|
|
185
|
+
- "token_expiry"
|
|
186
|
+
- "credential_scope"
|
|
187
|
+
- "session_token"
|
|
188
|
+
|
|
189
|
+
remediation:
|
|
190
|
+
description: >
|
|
191
|
+
Use short-lived, session-scoped credentials for agents. Each agent
|
|
192
|
+
should have its own unique identity. Implement credential rotation
|
|
193
|
+
and scope credentials to the minimum required permissions.
|
|
194
|
+
code_example: |
|
|
195
|
+
# BAD: Long-lived shared credential
|
|
196
|
+
agent = Agent(api_key="sk-hardcoded-key-123")
|
|
197
|
+
|
|
198
|
+
# GOOD: Short-lived scoped credential
|
|
199
|
+
credential = get_scoped_credential(
|
|
200
|
+
scope="read:documents",
|
|
201
|
+
ttl=timedelta(minutes=15)
|
|
202
|
+
)
|
|
203
|
+
agent = Agent(credential=credential)
|
|
204
|
+
references:
|
|
205
|
+
- "https://genai.owasp.org/resource/owasp-top-10-for-agentic-applications-for-2026/"
|
|
206
|
+
|
|
207
|
+
- id: AGENT-014
|
|
208
|
+
title: "Overly Permissive Agent Role / Tool Access"
|
|
209
|
+
description: >
|
|
210
|
+
Agent is configured with overly broad tool access or admin-level
|
|
211
|
+
permissions when it only needs a subset. Violates the Least-Agency
|
|
212
|
+
principle (ASI-03).
|
|
213
|
+
severity: high
|
|
214
|
+
category: identity_privilege_abuse
|
|
215
|
+
owasp_agentic_id: "ASI-03"
|
|
216
|
+
|
|
217
|
+
detection:
|
|
218
|
+
type: ast
|
|
219
|
+
patterns:
|
|
220
|
+
- pattern_type: "excessive_tool_grant"
|
|
221
|
+
indicators:
|
|
222
|
+
dangerous_tool_combinations:
|
|
223
|
+
- ["file_read", "network_outbound"]
|
|
224
|
+
- ["shell_exec", "network_outbound"]
|
|
225
|
+
- ["database_write", "shell_exec"]
|
|
226
|
+
- ["file_write", "file_delete", "shell_exec"]
|
|
227
|
+
tool_count_threshold: 10
|
|
228
|
+
|
|
229
|
+
- pattern_type: "auto_approval_pattern"
|
|
230
|
+
keywords:
|
|
231
|
+
- "trust_all_tools"
|
|
232
|
+
- "auto_approve"
|
|
233
|
+
- "no_confirm"
|
|
234
|
+
- "skip_approval"
|
|
235
|
+
- "--dangerously-skip-permissions"
|
|
236
|
+
- "handle_tool_error=True"
|
|
237
|
+
|
|
238
|
+
remediation:
|
|
239
|
+
description: >
|
|
240
|
+
Apply Least-Agency principle: grant agents only the minimum tools
|
|
241
|
+
and permissions needed for their specific task. Review tool lists
|
|
242
|
+
regularly and remove unnecessary capabilities.
|
|
243
|
+
references:
|
|
244
|
+
- "https://genai.owasp.org/resource/owasp-top-10-for-agentic-applications-for-2026/"
|
|
245
|
+
|
|
246
|
+
# =============================================================================
|
|
247
|
+
# ASI-04: Agentic Supply Chain Vulnerabilities
|
|
248
|
+
# External components the agent depends on (third-party APIs, models, RAG
|
|
249
|
+
# data sources, MCP servers) pose risks. Key insight: supply chain includes
|
|
250
|
+
# not just code but also data and models.
|
|
251
|
+
# =============================================================================
|
|
252
|
+
|
|
253
|
+
- id: AGENT-015
|
|
254
|
+
title: "Untrusted MCP Server Source"
|
|
255
|
+
description: >
|
|
256
|
+
MCP server is loaded from an unverified source without integrity
|
|
257
|
+
verification. Malicious MCP servers on npm have been documented
|
|
258
|
+
in the wild (ASI-04).
|
|
259
|
+
severity: critical
|
|
260
|
+
category: supply_chain_agentic
|
|
261
|
+
owasp_agentic_id: "ASI-04"
|
|
262
|
+
cwe_id: "CWE-494"
|
|
263
|
+
|
|
264
|
+
detection:
|
|
265
|
+
type: config
|
|
266
|
+
patterns:
|
|
267
|
+
- pattern_type: "npx_unfixed_version"
|
|
268
|
+
in_config_keys:
|
|
269
|
+
- "mcpServers"
|
|
270
|
+
- "servers"
|
|
271
|
+
command_patterns:
|
|
272
|
+
- regex: "npx\\s+(-y\\s+)?(?!@modelcontextprotocol/)\\S+"
|
|
273
|
+
description: "npx running non-official MCP package"
|
|
274
|
+
- regex: "npx\\s+.*@latest"
|
|
275
|
+
description: "npx with @latest tag (unpinned version)"
|
|
276
|
+
|
|
277
|
+
- pattern_type: "missing_integrity_check"
|
|
278
|
+
missing_keys:
|
|
279
|
+
- "hash"
|
|
280
|
+
- "integrity"
|
|
281
|
+
- "checksum"
|
|
282
|
+
- "sha256"
|
|
283
|
+
|
|
284
|
+
- pattern_type: "unofficial_mcp_source"
|
|
285
|
+
untrusted_indicators:
|
|
286
|
+
- "github.com"
|
|
287
|
+
- "file://"
|
|
288
|
+
- "http://"
|
|
289
|
+
|
|
290
|
+
remediation:
|
|
291
|
+
description: >
|
|
292
|
+
Pin MCP server versions explicitly. Verify integrity with checksums.
|
|
293
|
+
Only use MCP servers from trusted registries or official sources.
|
|
294
|
+
Audit MCP server code before deploying.
|
|
295
|
+
code_example: |
|
|
296
|
+
// BAD: Unpinned, unknown source
|
|
297
|
+
"mcpServers": {
|
|
298
|
+
"risky": { "command": "npx", "args": ["-y", "some-unknown-package"] }
|
|
299
|
+
}
|
|
300
|
+
|
|
301
|
+
// GOOD: Pinned version, official source
|
|
302
|
+
"mcpServers": {
|
|
303
|
+
"filesystem": {
|
|
304
|
+
"command": "npx",
|
|
305
|
+
"args": ["-y", "@modelcontextprotocol/server-filesystem@1.2.3"]
|
|
306
|
+
}
|
|
307
|
+
}
|
|
308
|
+
references:
|
|
309
|
+
- "https://www.bleepingcomputer.com/news/security/the-real-world-attacks-behind-owasp-agentic-ai-top-10/"
|
|
310
|
+
|
|
311
|
+
- id: AGENT-016
|
|
312
|
+
title: "Unvalidated RAG Data Source"
|
|
313
|
+
description: >
|
|
314
|
+
Agent's RAG pipeline ingests data from external sources without
|
|
315
|
+
integrity validation or provenance tracking. Poisoned RAG data
|
|
316
|
+
can silently corrupt agent decisions (ASI-04).
|
|
317
|
+
severity: high
|
|
318
|
+
category: supply_chain_agentic
|
|
319
|
+
owasp_agentic_id: "ASI-04"
|
|
320
|
+
|
|
321
|
+
detection:
|
|
322
|
+
type: ast
|
|
323
|
+
patterns:
|
|
324
|
+
- pattern_type: "unvalidated_rag_ingestion"
|
|
325
|
+
functions:
|
|
326
|
+
- "WebBaseLoader"
|
|
327
|
+
- "UnstructuredURLLoader"
|
|
328
|
+
- "DirectoryLoader"
|
|
329
|
+
- "CSVLoader"
|
|
330
|
+
- "PyPDFLoader"
|
|
331
|
+
missing_validation:
|
|
332
|
+
- "validate_source"
|
|
333
|
+
- "check_integrity"
|
|
334
|
+
- "verify_checksum"
|
|
335
|
+
chained_to:
|
|
336
|
+
- "add_documents"
|
|
337
|
+
- "from_documents"
|
|
338
|
+
- "add_texts"
|
|
339
|
+
- "upsert"
|
|
340
|
+
|
|
341
|
+
remediation:
|
|
342
|
+
description: >
|
|
343
|
+
Validate all RAG data sources before ingestion. Implement data
|
|
344
|
+
integrity checks, maintain data lineage, and regularly audit
|
|
345
|
+
vector store contents for poisoned entries.
|
|
346
|
+
references:
|
|
347
|
+
- "https://genai.owasp.org/resource/owasp-top-10-for-agentic-applications-for-2026/"
|
|
348
|
+
|
|
349
|
+
# =============================================================================
|
|
350
|
+
# ASI-05: Unexpected Code Execution (RCE)
|
|
351
|
+
# Agent is manipulated to generate and execute malicious code. This is a
|
|
352
|
+
# special and high-severity form of ASI-02 (Tool Misuse).
|
|
353
|
+
# Core defense: hardware-level sandbox + code static analysis.
|
|
354
|
+
# =============================================================================
|
|
355
|
+
|
|
356
|
+
- id: AGENT-017
|
|
357
|
+
title: "Unsandboxed Code Execution in Agent"
|
|
358
|
+
description: >
|
|
359
|
+
Agent executes dynamically generated code (via eval, exec,
|
|
360
|
+
subprocess, or code interpreter tools) without sandbox isolation.
|
|
361
|
+
This enables RCE attacks where manipulated prompts lead to
|
|
362
|
+
arbitrary code execution on the host system (ASI-05).
|
|
363
|
+
severity: critical
|
|
364
|
+
category: unexpected_code_execution
|
|
365
|
+
owasp_agentic_id: "ASI-05"
|
|
366
|
+
cwe_id: "CWE-94"
|
|
367
|
+
|
|
368
|
+
detection:
|
|
369
|
+
type: ast
|
|
370
|
+
patterns:
|
|
371
|
+
- pattern_type: "dynamic_exec_in_agent"
|
|
372
|
+
functions:
|
|
373
|
+
- "eval"
|
|
374
|
+
- "exec"
|
|
375
|
+
- "compile"
|
|
376
|
+
context:
|
|
377
|
+
- inside_tool_decorator: true
|
|
378
|
+
- inside_agent_class: true
|
|
379
|
+
|
|
380
|
+
- pattern_type: "subprocess_without_sandbox"
|
|
381
|
+
functions:
|
|
382
|
+
- "subprocess.run"
|
|
383
|
+
- "subprocess.Popen"
|
|
384
|
+
- "subprocess.call"
|
|
385
|
+
- "os.system"
|
|
386
|
+
- "os.popen"
|
|
387
|
+
missing_guards:
|
|
388
|
+
- "docker"
|
|
389
|
+
- "sandbox"
|
|
390
|
+
- "seccomp"
|
|
391
|
+
- "apparmor"
|
|
392
|
+
- "nsjail"
|
|
393
|
+
- "firejail"
|
|
394
|
+
- "--read-only"
|
|
395
|
+
- "restricted"
|
|
396
|
+
|
|
397
|
+
- pattern_type: "code_interpreter_no_sandbox"
|
|
398
|
+
tool_names:
|
|
399
|
+
- "PythonREPLTool"
|
|
400
|
+
- "PythonAstREPLTool"
|
|
401
|
+
- "ShellTool"
|
|
402
|
+
- "BashTool"
|
|
403
|
+
- "code_interpreter"
|
|
404
|
+
missing_config:
|
|
405
|
+
- "sandbox"
|
|
406
|
+
- "docker"
|
|
407
|
+
- "isolation"
|
|
408
|
+
- "restricted"
|
|
409
|
+
|
|
410
|
+
remediation:
|
|
411
|
+
description: >
|
|
412
|
+
NEVER execute LLM-generated code on the host system without
|
|
413
|
+
hardware-enforced sandbox isolation. Use Docker containers with
|
|
414
|
+
read-only filesystems, disabled networking, and resource limits.
|
|
415
|
+
Apply static analysis to generated code before execution.
|
|
416
|
+
code_example: |
|
|
417
|
+
# BAD: Direct execution
|
|
418
|
+
@tool
|
|
419
|
+
def run_code(code: str):
|
|
420
|
+
exec(code) # RCE vulnerability
|
|
421
|
+
|
|
422
|
+
# GOOD: Sandboxed execution
|
|
423
|
+
@tool
|
|
424
|
+
def run_code(code: str):
|
|
425
|
+
result = docker_sandbox.execute(
|
|
426
|
+
code, timeout=30, network=False, read_only=True
|
|
427
|
+
)
|
|
428
|
+
return result
|
|
429
|
+
references:
|
|
430
|
+
- "https://genai.owasp.org/resource/owasp-top-10-for-agentic-applications-for-2026/"
|
|
431
|
+
|
|
432
|
+
# =============================================================================
|
|
433
|
+
# ASI-06: Memory & Context Poisoning
|
|
434
|
+
# Attacker injects malicious data into the agent's long-term memory
|
|
435
|
+
# (vector database, knowledge graph) causing the agent to exhibit wrong
|
|
436
|
+
# or malicious behavior even without active attack.
|
|
437
|
+
# Key difference: This is persistent corruption, unlike transient goal hijack.
|
|
438
|
+
# =============================================================================
|
|
439
|
+
|
|
440
|
+
- id: AGENT-018
|
|
441
|
+
title: "Unsanitized Input to Persistent Memory"
|
|
442
|
+
description: >
|
|
443
|
+
User or external input is written to the agent's persistent memory
|
|
444
|
+
(vector database, knowledge graph, conversation store) without
|
|
445
|
+
sanitization or validation. This enables Memory Poisoning (ASI-06)
|
|
446
|
+
where malicious data persists across sessions.
|
|
447
|
+
severity: critical
|
|
448
|
+
category: memory_poisoning
|
|
449
|
+
owasp_agentic_id: "ASI-06"
|
|
450
|
+
cwe_id: "CWE-20"
|
|
451
|
+
|
|
452
|
+
detection:
|
|
453
|
+
type: ast
|
|
454
|
+
patterns:
|
|
455
|
+
- pattern_type: "unsanitized_memory_write"
|
|
456
|
+
write_functions:
|
|
457
|
+
- "add_documents"
|
|
458
|
+
- "add_texts"
|
|
459
|
+
- "upsert"
|
|
460
|
+
- "insert"
|
|
461
|
+
- "persist"
|
|
462
|
+
- "save_context"
|
|
463
|
+
- "add_message"
|
|
464
|
+
- "add_memory"
|
|
465
|
+
- "store"
|
|
466
|
+
source_indicators:
|
|
467
|
+
- "user_input"
|
|
468
|
+
- "message"
|
|
469
|
+
- "query"
|
|
470
|
+
- "request"
|
|
471
|
+
- "input"
|
|
472
|
+
missing_between:
|
|
473
|
+
- "sanitize"
|
|
474
|
+
- "validate"
|
|
475
|
+
- "filter"
|
|
476
|
+
- "clean"
|
|
477
|
+
- "escape"
|
|
478
|
+
|
|
479
|
+
remediation:
|
|
480
|
+
description: >
|
|
481
|
+
Sanitize and validate ALL data before writing to persistent memory.
|
|
482
|
+
Implement integrity checks on stored data. Use version control
|
|
483
|
+
for memory stores to enable rollback if poisoning is detected.
|
|
484
|
+
code_example: |
|
|
485
|
+
# BAD: Direct write
|
|
486
|
+
vectorstore.add_texts([user_input])
|
|
487
|
+
|
|
488
|
+
# GOOD: Sanitized write with validation
|
|
489
|
+
sanitized = sanitize_for_storage(user_input)
|
|
490
|
+
if validate_content(sanitized):
|
|
491
|
+
vectorstore.add_texts([sanitized], metadata={"source": "user", "timestamp": now()})
|
|
492
|
+
references:
|
|
493
|
+
- "https://genai.owasp.org/resource/owasp-top-10-for-agentic-applications-for-2026/"
|
|
494
|
+
|
|
495
|
+
- id: AGENT-019
|
|
496
|
+
title: "Conversation History Without Integrity Protection"
|
|
497
|
+
description: >
|
|
498
|
+
Agent stores and retrieves conversation history without integrity
|
|
499
|
+
protection, versioning, or expiration. An attacker can poison
|
|
500
|
+
conversation context to influence future agent behavior (ASI-06).
|
|
501
|
+
severity: medium
|
|
502
|
+
category: memory_poisoning
|
|
503
|
+
owasp_agentic_id: "ASI-06"
|
|
504
|
+
|
|
505
|
+
detection:
|
|
506
|
+
type: ast
|
|
507
|
+
patterns:
|
|
508
|
+
- pattern_type: "unbounded_memory"
|
|
509
|
+
classes:
|
|
510
|
+
- "ConversationBufferMemory"
|
|
511
|
+
- "ConversationBufferWindowMemory"
|
|
512
|
+
- "ConversationSummaryMemory"
|
|
513
|
+
missing_config:
|
|
514
|
+
- "k="
|
|
515
|
+
- "max_token_limit"
|
|
516
|
+
- "return_messages=False"
|
|
517
|
+
|
|
518
|
+
- pattern_type: "memory_without_expiry"
|
|
519
|
+
indicators:
|
|
520
|
+
- "RedisChatMessageHistory"
|
|
521
|
+
- "MongoDBChatMessageHistory"
|
|
522
|
+
- "FileChatMessageHistory"
|
|
523
|
+
missing_config:
|
|
524
|
+
- "ttl"
|
|
525
|
+
- "expiry"
|
|
526
|
+
- "max_age"
|
|
527
|
+
- "session_timeout"
|
|
528
|
+
|
|
529
|
+
remediation:
|
|
530
|
+
description: >
|
|
531
|
+
Implement bounded memory with explicit window sizes or TTL.
|
|
532
|
+
Add integrity checksums to stored conversation history.
|
|
533
|
+
Implement session-based isolation to prevent cross-session pollution.
|
|
534
|
+
references:
|
|
535
|
+
- "https://genai.owasp.org/resource/owasp-top-10-for-agentic-applications-for-2026/"
|
|
536
|
+
|
|
537
|
+
# =============================================================================
|
|
538
|
+
# ASI-07: Insecure Inter-Agent Communication
|
|
539
|
+
# In multi-agent systems, communication channels between agents are vulnerable
|
|
540
|
+
# to interception, spoofing, or replay attacks. Multi-agent systems are
|
|
541
|
+
# essentially distributed systems and must be secured as such.
|
|
542
|
+
# =============================================================================
|
|
543
|
+
|
|
544
|
+
- id: AGENT-020
|
|
545
|
+
title: "Unencrypted or Unauthenticated Inter-Agent Channel"
|
|
546
|
+
description: >
|
|
547
|
+
Multi-agent system communicates over unencrypted channels or without
|
|
548
|
+
mutual authentication. Agents trust other agents based on network
|
|
549
|
+
location alone, enabling impersonation and message tampering (ASI-07).
|
|
550
|
+
severity: high
|
|
551
|
+
category: insecure_inter_agent_comm
|
|
552
|
+
owasp_agentic_id: "ASI-07"
|
|
553
|
+
cwe_id: "CWE-319"
|
|
554
|
+
|
|
555
|
+
detection:
|
|
556
|
+
type: composite
|
|
557
|
+
patterns:
|
|
558
|
+
- pattern_type: "multi_agent_no_auth"
|
|
559
|
+
framework_patterns:
|
|
560
|
+
- class_names: ["GroupChat", "GroupChatManager", "ConversableAgent"]
|
|
561
|
+
framework: "autogen"
|
|
562
|
+
missing_config: ["authentication", "tls", "verify"]
|
|
563
|
+
- class_names: ["Crew", "Agent"]
|
|
564
|
+
framework: "crewai"
|
|
565
|
+
missing_config: ["auth", "secure_channel"]
|
|
566
|
+
|
|
567
|
+
- pattern_type: "agent_comm_no_tls"
|
|
568
|
+
url_patterns:
|
|
569
|
+
- "http://"
|
|
570
|
+
context_keywords:
|
|
571
|
+
- "agent"
|
|
572
|
+
- "delegate"
|
|
573
|
+
- "handoff"
|
|
574
|
+
- "message"
|
|
575
|
+
|
|
576
|
+
- pattern_type: "no_message_verification"
|
|
577
|
+
missing_patterns:
|
|
578
|
+
- "verify_signature"
|
|
579
|
+
- "hmac"
|
|
580
|
+
- "sign_message"
|
|
581
|
+
- "mutual_tls"
|
|
582
|
+
- "mTLS"
|
|
583
|
+
|
|
584
|
+
remediation:
|
|
585
|
+
description: >
|
|
586
|
+
Apply mutual TLS (mTLS) to all inter-agent communication.
|
|
587
|
+
Cryptographically sign all messages between agents.
|
|
588
|
+
Never trust agent identity based on network location alone.
|
|
589
|
+
references:
|
|
590
|
+
- "https://genai.owasp.org/resource/owasp-top-10-for-agentic-applications-for-2026/"
|
|
591
|
+
|
|
592
|
+
# =============================================================================
|
|
593
|
+
# ASI-08: Cascading Failures
|
|
594
|
+
# A small failure in one component triggers chain reactions leading to
|
|
595
|
+
# system-wide uncontrolled failure. Agent planner may attempt increasingly
|
|
596
|
+
# dangerous operations while trying to recover.
|
|
597
|
+
# This is a resilience and architectural vulnerability, not necessarily
|
|
598
|
+
# requiring malicious intent.
|
|
599
|
+
# =============================================================================
|
|
600
|
+
|
|
601
|
+
- id: AGENT-021
|
|
602
|
+
title: "Missing Circuit Breaker / Max Iterations"
|
|
603
|
+
description: >
|
|
604
|
+
Agent loop lacks circuit breaker, max iteration limit, or error
|
|
605
|
+
budget. A minor tool failure can trigger infinite retry loops or
|
|
606
|
+
increasingly destructive recovery attempts (ASI-08).
|
|
607
|
+
severity: high
|
|
608
|
+
category: cascading_failures
|
|
609
|
+
owasp_agentic_id: "ASI-08"
|
|
610
|
+
|
|
611
|
+
detection:
|
|
612
|
+
type: ast
|
|
613
|
+
patterns:
|
|
614
|
+
- pattern_type: "agent_without_iteration_limit"
|
|
615
|
+
agent_constructors:
|
|
616
|
+
- "AgentExecutor"
|
|
617
|
+
- "initialize_agent"
|
|
618
|
+
- "create_react_agent"
|
|
619
|
+
missing_params:
|
|
620
|
+
- "max_iterations"
|
|
621
|
+
- "max_execution_time"
|
|
622
|
+
- "max_steps"
|
|
623
|
+
- "timeout"
|
|
624
|
+
|
|
625
|
+
- pattern_type: "unbounded_agent_loop"
|
|
626
|
+
loop_patterns:
|
|
627
|
+
- "while True"
|
|
628
|
+
- "while 1"
|
|
629
|
+
context_near:
|
|
630
|
+
- "tool"
|
|
631
|
+
- "agent"
|
|
632
|
+
- "llm"
|
|
633
|
+
- "invoke"
|
|
634
|
+
- "run"
|
|
635
|
+
missing_break_conditions:
|
|
636
|
+
- "max_retries"
|
|
637
|
+
- "break"
|
|
638
|
+
- "timeout"
|
|
639
|
+
|
|
640
|
+
remediation:
|
|
641
|
+
description: >
|
|
642
|
+
Always configure max_iterations, max_execution_time, and error
|
|
643
|
+
budgets for agent loops. Implement circuit breaker patterns that
|
|
644
|
+
pause execution and seek human intervention on repeated failures.
|
|
645
|
+
code_example: |
|
|
646
|
+
# BAD: No limits
|
|
647
|
+
agent = AgentExecutor(agent=agent, tools=tools)
|
|
648
|
+
|
|
649
|
+
# GOOD: Explicit limits
|
|
650
|
+
agent = AgentExecutor(
|
|
651
|
+
agent=agent, tools=tools,
|
|
652
|
+
max_iterations=15,
|
|
653
|
+
max_execution_time=300,
|
|
654
|
+
handle_parsing_errors=True,
|
|
655
|
+
early_stopping_method="generate",
|
|
656
|
+
)
|
|
657
|
+
references:
|
|
658
|
+
- "https://genai.owasp.org/resource/owasp-top-10-for-agentic-applications-for-2026/"
|
|
659
|
+
|
|
660
|
+
- id: AGENT-022
|
|
661
|
+
title: "No Error Handling in Tool Execution"
|
|
662
|
+
description: >
|
|
663
|
+
Agent tool functions lack error handling, causing unhandled
|
|
664
|
+
exceptions to propagate and potentially trigger cascading failures
|
|
665
|
+
across the agent's execution pipeline (ASI-08).
|
|
666
|
+
severity: medium
|
|
667
|
+
category: cascading_failures
|
|
668
|
+
owasp_agentic_id: "ASI-08"
|
|
669
|
+
|
|
670
|
+
detection:
|
|
671
|
+
type: ast
|
|
672
|
+
patterns:
|
|
673
|
+
- pattern_type: "tool_without_error_handling"
|
|
674
|
+
indicators:
|
|
675
|
+
- has_tool_decorator: true
|
|
676
|
+
- missing_try_except: true
|
|
677
|
+
- calls_external: true
|
|
678
|
+
|
|
679
|
+
remediation:
|
|
680
|
+
description: >
|
|
681
|
+
Wrap all tool function bodies in try/except with graceful error
|
|
682
|
+
messages. Never let raw exceptions propagate to the agent planner.
|
|
683
|
+
references:
|
|
684
|
+
- "https://genai.owasp.org/resource/owasp-top-10-for-agentic-applications-for-2026/"
|
|
685
|
+
|
|
686
|
+
# =============================================================================
|
|
687
|
+
# ASI-09: Human-Agent Trust Exploitation
|
|
688
|
+
# Attacker manipulates agent output to deceive human users, causing them
|
|
689
|
+
# to bypass security controls or approve malicious operations.
|
|
690
|
+
# Essentially using human trust in agents for social engineering.
|
|
691
|
+
# =============================================================================
|
|
692
|
+
|
|
693
|
+
- id: AGENT-023
|
|
694
|
+
title: "Agent Output Without Transparency / Audit Trail"
|
|
695
|
+
description: >
|
|
696
|
+
Agent produces outputs or recommendations without exposing its
|
|
697
|
+
reasoning chain, data sources, or tool invocations to the human
|
|
698
|
+
reviewer. This makes human-in-the-loop a rubber stamp rather than
|
|
699
|
+
a genuine review (ASI-09).
|
|
700
|
+
severity: medium
|
|
701
|
+
category: trust_exploitation
|
|
702
|
+
owasp_agentic_id: "ASI-09"
|
|
703
|
+
|
|
704
|
+
detection:
|
|
705
|
+
type: ast
|
|
706
|
+
patterns:
|
|
707
|
+
- pattern_type: "opaque_agent_output"
|
|
708
|
+
agent_patterns:
|
|
709
|
+
- "AgentExecutor"
|
|
710
|
+
missing_config:
|
|
711
|
+
- "return_intermediate_steps=True"
|
|
712
|
+
- "verbose=True"
|
|
713
|
+
- "return_source_documents"
|
|
714
|
+
- "include_reasoning"
|
|
715
|
+
|
|
716
|
+
remediation:
|
|
717
|
+
description: >
|
|
718
|
+
Configure agents to return intermediate steps and reasoning.
|
|
719
|
+
Make all data sources and tool invocations visible to human
|
|
720
|
+
reviewers. The human-in-the-loop must be a critical review
|
|
721
|
+
step, not a rubber stamp.
|
|
722
|
+
code_example: |
|
|
723
|
+
# GOOD: Transparent output
|
|
724
|
+
agent = AgentExecutor(
|
|
725
|
+
agent=agent, tools=tools,
|
|
726
|
+
return_intermediate_steps=True,
|
|
727
|
+
verbose=True,
|
|
728
|
+
)
|
|
729
|
+
references:
|
|
730
|
+
- "https://genai.owasp.org/resource/owasp-top-10-for-agentic-applications-for-2026/"
|
|
731
|
+
|
|
732
|
+
# =============================================================================
|
|
733
|
+
# ASI-10: Rogue Agents
|
|
734
|
+
# Autonomous entities deviate from intended goals or exhibit misaligned
|
|
735
|
+
# behavior without external manipulation.
|
|
736
|
+
# This is the purest agentic threat: spontaneous, autonomous threats from
|
|
737
|
+
# internal misalignment.
|
|
738
|
+
# Key defenses: Kill switch + behavior monitoring + governance.
|
|
739
|
+
# =============================================================================
|
|
740
|
+
|
|
741
|
+
- id: AGENT-024
|
|
742
|
+
title: "Agent Without Kill Switch / Shutdown Mechanism"
|
|
743
|
+
description: >
|
|
744
|
+
Agent operates without a kill switch or graceful shutdown mechanism.
|
|
745
|
+
If the agent drifts from its intended purpose, there is no way to
|
|
746
|
+
immediately halt its execution (ASI-10).
|
|
747
|
+
severity: critical
|
|
748
|
+
category: rogue_agent
|
|
749
|
+
owasp_agentic_id: "ASI-10"
|
|
750
|
+
|
|
751
|
+
detection:
|
|
752
|
+
type: ast
|
|
753
|
+
patterns:
|
|
754
|
+
- pattern_type: "no_kill_switch"
|
|
755
|
+
agent_constructors:
|
|
756
|
+
- "AgentExecutor"
|
|
757
|
+
- "Crew"
|
|
758
|
+
- "AutoGen"
|
|
759
|
+
combined_missing:
|
|
760
|
+
- all_of:
|
|
761
|
+
- "max_iterations"
|
|
762
|
+
- "max_execution_time"
|
|
763
|
+
- "timeout"
|
|
764
|
+
- "early_stopping"
|
|
765
|
+
|
|
766
|
+
- pattern_type: "daemon_agent_no_monitor"
|
|
767
|
+
indicators:
|
|
768
|
+
- "daemon=True"
|
|
769
|
+
- "background"
|
|
770
|
+
- "schedule.every"
|
|
771
|
+
- "while True"
|
|
772
|
+
context:
|
|
773
|
+
- "agent"
|
|
774
|
+
- "crew"
|
|
775
|
+
missing_patterns:
|
|
776
|
+
- "health_check"
|
|
777
|
+
- "heartbeat"
|
|
778
|
+
- "monitor"
|
|
779
|
+
- "watchdog"
|
|
780
|
+
|
|
781
|
+
remediation:
|
|
782
|
+
description: >
|
|
783
|
+
Implement a non-negotiable, auditable kill switch for all agents.
|
|
784
|
+
Set max_iterations and max_execution_time. For long-running agents,
|
|
785
|
+
implement heartbeat monitoring and automatic shutdown on anomaly.
|
|
786
|
+
code_example: |
|
|
787
|
+
# GOOD: Agent with kill switch
|
|
788
|
+
agent = AgentExecutor(
|
|
789
|
+
agent=agent, tools=tools,
|
|
790
|
+
max_iterations=25,
|
|
791
|
+
max_execution_time=600,
|
|
792
|
+
early_stopping_method="generate",
|
|
793
|
+
callbacks=[KillSwitchCallback(max_cost=10.0)],
|
|
794
|
+
)
|
|
795
|
+
references:
|
|
796
|
+
- "https://genai.owasp.org/resource/owasp-top-10-for-agentic-applications-for-2026/"
|
|
797
|
+
|
|
798
|
+
- id: AGENT-025
|
|
799
|
+
title: "Agent Without Behavioral Monitoring / Logging"
|
|
800
|
+
description: >
|
|
801
|
+
Agent actions are not logged or monitored, making it impossible
|
|
802
|
+
to detect behavioral drift or misaligned actions. Without
|
|
803
|
+
observability, rogue behavior goes undetected (ASI-10).
|
|
804
|
+
severity: high
|
|
805
|
+
category: rogue_agent
|
|
806
|
+
owasp_agentic_id: "ASI-10"
|
|
807
|
+
|
|
808
|
+
detection:
|
|
809
|
+
type: ast
|
|
810
|
+
patterns:
|
|
811
|
+
- pattern_type: "agent_without_observability"
|
|
812
|
+
agent_constructors:
|
|
813
|
+
- "AgentExecutor"
|
|
814
|
+
- "initialize_agent"
|
|
815
|
+
- "Crew"
|
|
816
|
+
missing_all_of:
|
|
817
|
+
- "callbacks"
|
|
818
|
+
- "callback_manager"
|
|
819
|
+
- "verbose"
|
|
820
|
+
- "logging"
|
|
821
|
+
- "tracer"
|
|
822
|
+
- "langsmith"
|
|
823
|
+
- "wandb"
|
|
824
|
+
|
|
825
|
+
remediation:
|
|
826
|
+
description: >
|
|
827
|
+
Implement comprehensive logging of every agent decision, tool
|
|
828
|
+
call, and state change. Establish behavioral baselines and
|
|
829
|
+
alert on deviations. Use tracing tools like LangSmith or
|
|
830
|
+
custom callbacks for full observability.
|
|
831
|
+
references:
|
|
832
|
+
- "https://genai.owasp.org/resource/owasp-top-10-for-agentic-applications-for-2026/"
|