1
漏洞描述
Nacos在处理某些基于Jraft的请求时,采用Hessian进行反序列化,但并未设置限制,导致应用存在远程代码执行(RCE)漏洞。
2
漏洞复现
步骤一:在Fofa中搜索以下语法并随机确定要进行攻击测试的目标....
#FOFA搜索语法
protocol="nacos(http)"
步骤二:开启代理并打开BP对其首页进行抓包拦截....修改请求包内容....在响应数据包的正文中返回内容包含"version":"2.0.3"的json数据。
GET /nacos/v1/console/server/state HTTP/1.1
Host: ip
Cache-Control: max-age=0
Upgrade-Insecure-Requests: 1
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/116.0.5845.111 Safari/537.36
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.7
Accept-Encoding: gzip, deflate, br
Accept-Language: zh-CN,zh;q=0.9
If-Modified-Since: Wed, 28 Jul 2021 11:28:45 GMT
Connection: close
步骤三:开启代理并打开BP对其首页进行抓包拦截....修改请求包内容....无返回数据包。
GET / HTTP/1.1
Host: ip
Cache-Control: max-age=0
Upgrade-Insecure-Requests: 1
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/116.0.5845.111 Safari/537.36
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.7
Accept-Encoding: gzip, deflate, br
Accept-Language: zh-CN,zh;q=0.9
If-Modified-Since: Wed, 28 Jul 2021 11:28:45 GMT
Connection: close
步骤四:使用NacosRce工具进行命令执行,得到结果。
3
nuclei脚本
id: nacos-jraft-hessian-rce
info:
name: nacos-jraft-hessian-rce
author: sm
severity: critical
tags: nacos,rce,Hessian,nacos-rce
description: Nacos在处理某些基于Jraft的请求时,采用Hessian进行反序列化,但并未设置限制,导致应用存在远程代码执行(RCE)漏洞
metadata:
"protocol="nacos(http)"" :
verified: true
reference: https://mp.weixin.qq.com/s/FUBdfMugEd-5k-CGyLbuJw
tcp:
inputs:
host:
"{{Host}}:7848"
matchers:
type: word
words:
""
id: nacos-jraftserver-deserialization-rce
info:
name: Nacos - jraftserver deserialization Remote Code Execution
author: unknown
severity: critical
description: Nacos uses Hessian for deserialization when processing certain Jraft based requests, but no restrictions are set, resulting in remote code execution (RCE) vulnerabilities in the application.
reference: https://stack.chaitin.com/techblog/detail?id=106
tags: nacos,rce,nacos-rce
metadata:
max-request: 1
http:
- method: GET
path:
- "{{BaseURL}}/nacos/v1/console/server/state"
- "{{BaseURL}}/v1/console/server/state"
matchers-condition: or
matchers:
- type: word
words:
- '"standalone_mode":"cluster"'
part: body
- type: regex
regex:
- '"version":"2..*?"'
part: body
4
nacos集成脚本推荐
https://github.com/charonlight/NacosExploitGUI
原文始发于微信公众号(揽月安全团队):Nacos Hessian反序列化漏洞
免责声明:文章中涉及的程序(方法)可能带有攻击性,仅供安全研究与教学之用,读者将其信息做其他用途,由读者承担全部法律及连带责任,本站不承担任何法律及连带责任;如有问题可邮件联系(建议使用企业邮箱或有效邮箱,避免邮件被拦截,联系方式见首页),望知悉。
- 左青龙
- 微信扫一扫
-
- 右白虎
- 微信扫一扫
-
评论