首页 技术 正文
技术 2022年11月9日
0 收藏 479 点赞 4,147 浏览 1337 个字

应该是S2-048目前最详细的一篇了..

漏洞影响

Struts 2.3.x系列中的Showcase应用

使用了struts1 插件,并在使用ActionMessages时将客户端可控的参数拼接传递给new ActionMessage,如下图

Struts S2-048 RCE漏洞分析

插件介绍

Struts1插件主要是为了可以在Struts2应用程序中使用Struts1操作和ActionForms,插件提供了一个包装类org.apache.struts2.s1.Struts1Action来对Struts1的 Action 包装成为 Struts2中的Action,要在Struts 2应用程序中使用现有的Struts 1操作和ActionForms需要在对应的struts.xml中进行配置,如下图

Struts S2-048 RCE漏洞分析

触发流程

拿官网中漏洞公告提到的应用Showcase做演示,将程序导入到eclipse中方便分析。根据官网给出的关键字进行搜索,发现 org.apache.struts2.showcase.integration.SaveGangsterAction 满足漏洞触发条件。

Struts S2-048 RCE漏洞分析

根据对应的配置文件找到对应的action为/integration/saveGangster,将showcase在tomcat中跑起来,访问/integration/saveGangster,将断点设置在org.apache.struts2.s1.Struts1Action的execute方法中,发起一次请求来试试。

Struts S2-048 RCE漏洞分析

我们看到88行获取了一个Action对象,这个对象就是存在漏洞那个class

Struts S2-048 RCE漏洞分析

99行调用了存在漏洞的SaveGangsterAction的execute方法,并将我们的表单请求封装到了actionForm中

Struts S2-048 RCE漏洞分析

org.apache.struts2.showcase.integration.SaveGangsterAction的execute方法在45行在new ActionMessage对象时将表单的name参数拼接到了构造方法传递的参数中。通过org.apache.struts.action.Action.addMessages(HttpServletRequest request, ActionMessages messages)将请求与ActionMessages一起封装,使用了一个全局变量Globals.MESSAGE_KEY来做标识

Struts S2-048 RCE漏洞分析

在String org.apache.struts2.s1.Struts1Action.execute()的101行通过Globals.MESSAGE_KEY将这个ActionMessages获取了出来,进入后面的流程

Struts S2-048 RCE漏洞分析

108行调用了getText(msg.getKey()),将我们拼接后的参数后传入了getText(),最后在com.opensymphony.xwork2.util.LocalizedTextUtil.getDefaultMessage(String key, Locale locale, ValueStack valueStack, Object[] args, String defaultMessage)方法的683行调用了TextParseUtil.translateVariables来执行了ognl表达式

Struts S2-048 RCE漏洞分析

Struts S2-048 RCE漏洞分析

上一篇: Google瓦片地图URL
下一篇: Redis单线程架构
相关推荐
python开发_常用的python模块及安装方法
adodb:我们领导推荐的数据库连接组件bsddb3:BerkeleyDB的连接组件Cheetah-1.0:我比较喜欢这个版本的cheeta…
日期:2022-11-24 点赞:878 阅读:9,490
Educational Codeforces Round 11 C. Hard Process 二分
C. Hard Process题目连接:http://www.codeforces.com/contest/660/problem/CDes…
日期:2022-11-24 点赞:807 阅读:5,905
下载Ubuntn 17.04 内核源代码
zengkefu@server1:/usr/src$ uname -aLinux server1 4.10.0-19-generic #21…
日期:2022-11-24 点赞:569 阅读:6,738
可用Active Desktop Calendar V7.86 注册码序列号
可用Active Desktop Calendar V7.86 注册码序列号Name: www.greendown.cn Code: &nb…
日期:2022-11-24 点赞:733 阅读:6,491
Android调用系统相机、自定义相机、处理大图片
Android调用系统相机和自定义相机实例本博文主要是介绍了android上使用相机进行拍照并显示的两种方式,并且由于涉及到要把拍到的照片显…
日期:2022-11-24 点赞:512 阅读:8,129
Struts的使用
一、Struts2的获取  Struts的官方网站为:http://struts.apache.org/  下载完Struts2的jar包,…
日期:2022-11-24 点赞:671 阅读:5,292