{"id":507,"date":"2013-06-06T23:02:31","date_gmt":"2013-06-06T15:02:31","guid":{"rendered":"http:\/\/inbreak.net\/?p=507"},"modified":"2013-06-06T23:02:31","modified_gmt":"2013-06-06T15:02:31","slug":"struts2%e6%9c%80%e8%bf%91%e9%87%8f%e4%ba%a7%e6%bc%8f%e6%b4%9e%e5%88%86%e6%9e%90%ef%bc%882013-6%ef%bc%89","status":"publish","type":"post","link":"https:\/\/www.inbreak.net\/archives\/507.html","title":{"rendered":"STRUTS2\u6700\u8fd1\u91cf\u4ea7\u6f0f\u6d1e\u5206\u6790\uff082013-6\uff09"},"content":{"rendered":"

by \u7a7a\u865a\u6d6a\u5b50\u5fc3 http:\/\/inbreak.net \u5fae\u535a\uff1ahttp:\/\/t.qq.com\/javasecurity
\n\u53ef\u80fd\u662f\u7531\u4e8e\u6c9f\u901a\u95ee\u9898\uff0c\u5bfc\u81f4struts2\u5b98\u65b9\u5bf9\u6211\u63d0\u4ea4\u7684S2-012\u6f0f\u6d1e\u540d\u79f0\u7406\u89e3\u9519\u8bef\uff0c\u6f0f\u6d1e\u63cf\u8ff0\u4e3astruts2\u7684\u67d0\u4e2a\u793a\u4f8b\u5e94\u7528\u51fa\u73b0\u6f0f\u6d1e\uff0c\u4f46\u662fstruts2\u662f\u6309\u7167\u6846\u67b6\u51fa\u73b0\u6f0f\u6d1e\u4fee\u8865\u7684\u3002\u800c\u8fd9\u4e2as2-012\u7adf\u7136\u5f15\u53d1\u4e86\u4e00\u8fde\u4e32\u8840\u6848\u3002
\n\u5176\u5b9e\u53d1\u8fd9\u7bc7\u6587\u7ae0\uff0c\u6211\u975e\u5e38\u607c\u706b\uff0c\u4efb\u8c01\u624b\u91cc\u6709\u4e00\u4e2a0day\uff0c\u6342\u4e86\u534a\u5929\uff0c\u7ed3\u679c\u53c8\u88ab\u522b\u4eba\u516c\u5f00\uff0c\u90fd\u4f1a\u975e\u5e38\u607c\u706b\u3002\u53bb\u5e74\u6211\u5728XCON\u53d1\u5e03\u7684S2-012\u6f0f\u6d1e\uff0c\u5176\u5b9estruts2\u8fd8\u5b58\u5728\u76f8\u4f3c\u7684\u6f0f\u6d1e\u3002\u5728struts\u4e2d\uff0c\u6846\u67b6\u63a5\u6536\u5230\u7684\u7528\u6237\u8f93\u5165\uff0c\u9664\u4e86\u53c2\u6570\u3001\u503c\u4ee5\u5916\uff0c\u8fd8\u6709\u5176\u4ed6\u5730\u65b9\uff0c\u6bd4\u5982\u6587\u4ef6\u540d\u3002\u8fd9\u4e2a\u6f0f\u6d1e\uff0c\u662fstruts2\u5bf9url\u4e2d\u7684\u6587\u4ef6\u540d\u505a\u4e86\u89e3\u6790\uff0c\u5bfc\u81f4\u7684ognl\u4ee3\u7801\u6267\u884c\u3002
\n\u8fd9\u4e2d\u95f4\u5b58\u5728\u4e00\u4e9b\u6280\u672f\u7ec6\u8282\uff0c\u4e0b\u9762\u5c55\u5f00\u5206\u6790\u3002
\nenableOGNLEvalExpression\u7684\u9a97\u5c40<\/strong>
\n\u4ece\u6f0f\u6d1e\u516c\u544a\u4e0a\u770b\u5230\u8fd9\u4e2a\u8bcd\uff0c\u5f88\u5bb9\u6613\u8ba4\u4e3a\u662fstruts2\u628aognl\u8868\u8fbe\u5f0f\u5e72\u6389\u4e86\uff0c\u53ef\u4ee5\u9009\u62e9\u7ec8\u7ed3\u4e00\u5207\u3002\u4e8b\u5b9e\u4e0a\u7981\u6b62\u7684\u662fOGNL\u7684\u5176\u4e2d\u4e00\u79cd\u8c03\u7528\u65b9\u5f0f\uff0c\u800c\u8fd9\u79cd\u8c03\u7528\u65b9\u5f0f\uff0c\u4e5f\u53ea\u662f\u5728S2-013\u8fd9\u91cc\u8c03\u7528\u3002
\nstruts2\u6709\u53e6\u5916\u4e00\u6bb5\u5a01\u6b66\u7684\u4ee3\u7801\uff0c\u771f\u6b63\u5728\u9632\u5b88\u8fd9\u4e2a\u6f0f\u6d1e\u3002<\/p>\n

\r\norg.apache.struts2.views.util.DefaultUrlHelper\u8fd9\u4e2a\u7c7b\uff1a\r\n<\/pre>\n

\u539f\u672c\u662f\u8fd9\u6837\u5199\u7684\uff0c\u4ee3\u7801\u8d70\u5230translateAndEncode\u5c31\u4f1a\u8c03\u7528ognl\u6267\u884c\uff0c\u5b83\u7684\u903b\u8f91\u4e00\u5171\u5305\u62ecognl\u7684translate\uff0c\u4ee5\u53caurlencode\u8fd9\u4e24\u4e2a\u529f\u80fd\u3002<\/p>\n

\r\n    private String buildParameterSubstring(String name, String value) {\r\n        StringBuilder builder = new StringBuilder();\r\n        builder.append(translateAndEncode(name));\r\n        builder.append('=');\r\n        builder.append(translateAndEncode(value));\r\n        return builder.toString();\r\n    }\r\n<\/pre>\n

\u8865\u4e01\u4e4b\u540e\uff0c\u8fd9\u91cc\u88ab\u6539\u4e3a\u4ec5\u4ec5urlencode\uff0c\u4e0d\u518d\u505aognl\u6267\u884c\u3002\u8fd9\u4e2a\u548cenableOGNLEvalExpression\u6ca1\u6709\u4efb\u4f55\u5173\u7cfb\u3002<\/p>\n

\r\n    private String buildParameterSubstring(String name, String value) {\r\n        StringBuilder builder = new StringBuilder();\r\n        builder.append(encode(name));\r\n        builder.append('=');\r\n        builder.append(encode(value));\r\n        return builder.toString();\r\n    }\r\n<\/pre>\n

\u6211\u6ca1\u6709\u7ec6\u770b\u5185\u5bb9\uff0c\u53ea\u770b\u65b9\u6cd5\u540d\u7684\u53d8\u52a8\uff0c\u5c31\u611f\u89c9\u53ef\u4ee5\u6d17\u6d17\u7761\u4e86\uff0c\u4e0d\u5fc5\u5f80\u4e0b\u8ddf\u8fdb\u4e86\u3002
\nallowStaticMethodAccess\u9a97\u5c40<\/strong>
\n\u4e00\u76f4\u4ee5\u6765allowStaticMethodAccess\u662fstruts2\u7684poc\u6807\u914d\uff0c\u4ece\u7b2c\u4e00\u4e2apoc\u51fa\u73b0\u5f00\u59cb\uff0c\u5c31\u4e00\u76f4\u5b58\u5728\u3002
\n\u57282013\u5e745\u670827\u65e5\uff0c\u4e5f\u5c31\u662f\u524d\u51e0\u5929\uff0c\u5927\u5bb6\u53ef\u4ee5\u81ea\u884c\u67e5\u770bSVNlog\uff0cstruts2\u505a\u4e86\u4e00\u4ef6\u5f88\u7325\u7410\u7684\u4e8b\u60c5\uff0c\u628a\u4ee5\u4e0b\u4ee3\u7801\u5220\u9664\u4e86\uff1a<\/p>\n

\r\n    public void setAllowStaticMethodAccess(boolean allowStaticMethodAccess) {\r\n        this.allowStaticMethodAccess = allowStaticMethodAccess;\r\n    }\r\n<\/pre>\n

\u8fd9\u4e2a\u52a8\u4f5c\u76f4\u63a5\u5bfc\u81f4\u4e00\u4e2a\u7ed3\u679c\uff0c\u4ee5\u540e\u5728OGNL\u7684POC\u4e2d\u6267\u884c<\/p>\n

\r\n#_memberAccess[\"allowStaticMethodAccess\"]=true\r\n<\/pre>\n

\u4e00\u5b9a\u4f1a\u62a5\u9519\u7684\uff0c\u56e0\u4e3a\u6ca1\u6709set\u65b9\u6cd5\u4e86\u3002
\n\u5f88\u6709\u7ec8\u7ed3\u4e00\u5207\u7684\u610f\u601d\uff0c\u5c31\u50cf\u4ee5\u540e\u6709\u65b0\u7684OGNL\u6f0f\u6d1e\uff0c\u5c31\u4e0d\u80fd\u5199\u8fd9\u4e00\u53e5\u4e86\u3002\u4f46\u662f\u6211\u53ef\u4ee5\u7ed5\u8fc7\u8fd9\u4e2a\u4e1c\u897f\uff0c\u4e0b\u9762\u7ed3\u5408s2-015\u6f0f\u6d1e\u505a\u4e2a\u793a\u4f8b\u3002
\nstruts2\u6846\u67b6s2-015\u5410\u69fd<\/strong>
\n\u8fd9\u4e2a\u6f0f\u6d1e\uff0c\u88ab\u4eba\u516c\u5e03\u51fa\u6765\uff0c\u5b9e\u9645\u4e0a\uff0c\u53d1\u5e03\u8005\u4e00\u5171\u53d1\u5e03\u4e86\u51e0\u4e2a\u6f0f\u6d1e\uff0c\u5305\u542bS2-015\u3001\u4ee5\u53caS2-012\u3002\u5177\u4f53\u5730\u5740\u5728<\/p>\n

\r\nhttps:\/\/communities.coverity.com\/blogs\/security\/2013\/05\/29\/struts2-remote-code-execution-via-ognl-injection\r\n<\/pre>\n

\u975e\u5e38\u8be6\u7ec6\uff0c\u67d0\u540c\u4e8b\u8ba4\u4e3a\u4ed6\u6bd4\u6211\u5206\u6790\u7684\u597d\uff0c\u6240\u4ee5\u6211\u5c31\u4e0d\u5199\u7ffb\u8bd1\u4e86\uff0c\u5927\u5bb6\u81ea\u5df1\u770b\u3002
\n\u540e\u6765\u4ed4\u7ec6\u60f3\u4e86\u60f3\uff0c\u731c\u6d4b\u8001\u5916\u53ef\u80fd\u9047\u5230s2-012\uff0c\u5bfc\u81f4\u4e86\u8be5\u6587\u7ae0\u7684\u53d1\u5e03\uff0c\u5f53\u7136\uff0c\u8fd9\u53ea\u662f\u6211\u7684\u4e2a\u4ebaYY\u3002
\n\u53d1\u5e03\u8005\u624b\u63e12\u4e2a0day\uff0c\u5f88\u4e0d\u5e78\uff0c\u6211\u4e5f\u6709\u8fd9\u4e24\u4e2a0day\uff0c\u53bb\u5e74xcon\u53d1\u5e03\u4e86\u4e00\u4e2a\uff0c\u4e4b\u540e\u63d0\u4ea4\u4e86\u5b98\u65b9\uff0c\u4f46\u662f\u4ed6\u4e0d\u77e5\u9053\uff0c\u56e0\u4e3a\u5b98\u65b9\u5230\u4eca\u5e74\u624d\u516c\u5f00\u4fee\u8865\u3002
\n\u524d\u51e0\u5929\u5b98\u65b9\u7a81\u7136\u516c\u5f00\u4fee\u8865\u4e86\u6211\u53d1\u5e03\u7684\u4e00\u4e2a0day\uff0c\u8fd9\u4e2a\u8001\u5916\u770b\u5230s2-012\u540e\uff0c\u53ef\u80fd\u4e5f\u975e\u5e38\u607c\u706b\uff0c\u56e0\u4e3a\u8fd9\u4e2a\u6f0f\u6d1e\u548c\u4ed6\u624b\u5934\u5206\u6790\u76840day\u521a\u597d\u76f8\u540c\uff0c\u6240\u4ee5\u4e00\u6012\u4e4b\u4e0b\u548c\u5176\u4ed60day\u4e00\u8d77\u53d1\u51fa\u6765\u4e86\uff0c\u5171\u540c\u7ec4\u6210\u4e00\u7bc7\u6587\u7ae0\u3002\u53ef\u4ee5\u770b\u5230\uff0c\u53d1\u5e03\u8005\u76f4\u63a5\u4eceblog\u53d1\u5e03\uff0c\u4e4b\u540e\u5b98\u65b9\u624d\u6536\u5230\u6d88\u606f\u5f00\u59cb\u4fee\u8865\u3002
\n\u8fd9\u4e2a\u6f0f\u6d1e\u7684\u89e6\u53d1\u4ee3\u7801\u5c55\u73b0\u5f62\u5f0f\u548cs2-012\u975e\u5e38\u50cf\uff0c\u6240\u4ee5\u7406\u89e3\u4e86s2-012\u540e\uff0c\u53ef\u4ee5\u8054\u60f3\u5230\u8fd9\u4e2a0day\uff0c\u5f88\u5bb9\u6613\u901a\u8fc7\u6d4b\u8bd5\u51fa\u6765\uff0c\u6211\u5f53\u65f6\u4e5f\u662f\u770b\u5230\u7c7b\u4f3c\u7684\u4f7f\u7528\uff0c\u968f\u624b\u6d4b\u8bd5\u5c31\u53d1\u73b0\u4e86\u3002\u76f8\u4fe1\u6709\u5f88\u591a\u6f0f\u6d1e\uff0c\u90fd\u662f\u7c7b\u4f3c\u7684\u60c5\u51b5\u4e0b\u53d1\u73b0\u7684\u3002\u751a\u81f3\u53ef\u80fd\u4e0d\u6b62\u6211\u4eec\u624b\u91cc\u6709\uff0c\u5176\u5b9e\u4f60\u4e5f\u975e\u5e38\u607c\u706b\u3002
\nS2-015\u7684poc\u5728\u8001\u5916\u7684\u6587\u7ae0\u4e2d\u5982\u4e0b\uff1a<\/p>\n

\r\nhttp:\/\/127.0.0.1:8080\/struts2-blank\/example\/$%7B%23context['xwork.MethodAccessor.denyMethodExecution']=%21%28%23_memberAccess['allowStaticMethodAccess']=true%29,%28@java.lang.Runtime@getRuntime%28%29%29.exec%28'touch%20aaa'%29.waitFor%28%29%7D.action\/\r\n<\/pre>\n

\u7531\u4e8ePOC\u4e2d\u5b58\u5728#_memberAccess[“allowStaticMethodAccess”]=true\uff0c\u6240\u4ee5\u53d1\u5e03\u8005\u63d0\u5230\u5347\u7ea7\u5230s2-014\u53ef\u4ee5\u7f13\u89e3\u3002
\n\u5176\u5b9e\u53d1\u5e03\u8005\u8bef\u89e3\u4e86\uff0c\u4f46\u662fstruts2\u5f00\u53d1\u8005\u6ca1\u6709\u8bef\u89e3\uff0c\u6240\u4ee5\u8d76\u7d27\u63a8\u51fa\u4e86S2-015\u3002
\n\u4f46\u662f\u5982\u679c\u4e0d\u8bb2\u51fa\u6765\uff0c\u4f60\u8fd8\u662f\u4f1a\u53d1\u73b0\u90a3\u4e2aPOC\u5728S2-014\u4e4b\u540e\u5176\u5b9e\u4e0d\u80fd\u6253\uff0c\u5c31\u5982\u8001\u5916\u6587\u7ae0\u4e2d\u6240\u8bf4\uff0c\u88ab\u7f13\u89e3\u4e86\u3002\u90a3\u8981\u600e\u4e48\u6253\u5462\uff1f
\nOGNL\u7684POC\u6709\u4e2a\u5c0f\u6280\u5de7<\/strong>
\n\u8fd9\u4e2a\u4e1c\u897f\u7684\u542b\u4e49\uff0c\u662f\u5141\u8bb8\u9759\u6001\u65b9\u6cd5\u6267\u884c\uff0c\u90a3\u4e48\u5b98\u65b9\u7981\u6b62\u4fee\u6539\u8fd9\u4e2a\u8bbe\u7f6e\uff0c\u610f\u601d\u5c31\u662f\u6c38\u8fdc\u7981\u6b62\u9759\u6001\u65b9\u6cd5\u6267\u884c\u3002
\n\u56e0\u4e3aPOC\u4e2d\u7684\u201c@java.lang.Runtime@getRuntime\u201d\u5176\u5b9e\u5c31\u662f\u5728\u6267\u884c\u9759\u6001\u65b9\u6cd5\uff0c\u6240\u4ee5\u624d\u4e00\u5b9a\u8981\u5f00\u542f\u9759\u6001\uff0c\u4f46\u662f\u8fd9\u53ea\u662fjava\u4ee3\u7801\u7684\u4e00\u79cd\u5199\u6cd5\u7f62\u4e86\u3002
\n\u6211\u4eec\u53ef\u4ee5\u7528\u53e6\u4e00\u4e2a\u5199\u6cd5\uff0c\u7ed5\u8fc7\u8fd9\u4e2a\u9650\u5236\u3002<\/p>\n

\r\n\/\/by \u7a7a\u865a\u6d6a\u5b50\u5fc3 http:\/\/inbreak.net \u5fae\u535a\uff1ahttp:\/\/t.qq.com\/javasecurity\r\n(new java.lang.ProcessBuilder('calc')).start()\r\n<\/pre>\n

\u8fd9\u6bb5\u4ee3\u7801\u4e2d\uff0c\u6ca1\u6709\u8c03\u7528\u4efb\u4f55\u9759\u6001\u65b9\u6cd5\uff0c\u4ec5\u4ec5\u662fnew\u4e00\u4e2a\u5bf9\u8c61\uff0c\u4e4b\u540e\u6267\u884c\u5176\u4e2d\u4e00\u4e2a\u52a8\u6001\u65b9\u6cd5\uff0c\u6240\u4ee5\u4e0d\u5fc5allowStaticMethodAccess\u4e00\u6837\u80fd\u8fbe\u5230\u6267\u884c\u7cfb\u7edf\u547d\u4ee4\u7684\u6548\u679c\u3002
\n\u8fd9\u4e2a\u5c0f\u6280\u5de7\uff0c\u53ef\u4ee5\u5e72\u5f88\u591a\u4e8b\u60c5\u3002
\n1\u3001\u53ef\u4ee5\u7ed5\u8fc7\u67d0\u4e9bWAF\uff0c\u6211\u4e0d\u544a\u8bc9\u4f60\u662f\u54ea\u4e9b\uff0c\u514d\u5f97\u4f60\u62ff\u53bb\u9a97\u5956\u54c1\u3002
\n2\u3001\u53ef\u4ee5\u4e3a\u4ee5\u540e\u65b0\u7684OGNL\u4ee3\u7801\u6267\u884c\u94fa\u8def\uff0c\u907f\u514d0day\u6765\u4e86\uff0c\u6211\u4eec\u5c45\u7136\u56e0\u4e3a\u8fd9\u4e2a\u4e0d\u4f1a\u5199POC\u3002
\nS2-015\u7684\u4fee\u8865<\/strong>
\n\u7b80\u5355\u8bf4\u4e00\u53e5\uff0c\u8fd9\u91cc\u6ca1\u6709\u4ec0\u4e48\u7814\u7a76\u4ef7\u503c\uff0c\u8fd9\u6b21\u4fee\u8865\uff0c\u5b98\u65b9\u91c7\u7528\u4e86\u9650\u5236action\u7684\u540d\u79f0\uff0c\u53ea\u80fd<\/p>\n

\r\n[a-z]*[A-Z]*[0-9]*[.\\-_!\/]*\r\n<\/pre>\n

\u603b\u7ed3struts2\u51fa\u73b0\u8fc7\u7684ognl\u8868\u8fbe\u5f0f\u8f93\u5165\u70b9<\/strong>
\n1\u3001request\u53c2\u6570\u540d
\n2\u3001request\u53c2\u6570\u503c
\n3\u3001request\u6587\u4ef6\u540d
\n4\u3001request\u7684cookie\u540d
\n5\u3001respose\u7684body
\n\u60e8\u4e0d\u5fcd\u7779\uff0c\u597d\u50cfHTTP\u5934\u57fa\u672c\u90fd\u51fa\u4e86\u95ee\u9898\uff0c\u4e5f\u6ca1\u5269\u4e0b\u591a\u5c11\u4e86\u3002\u4e00\u4e2a\u6d41\u884c\u6846\u67b6\uff0c\u80fd\u591f\u5728\u8fd9\u4e48\u591a\u5730\u65b9\u51fa\u73b0\u8fdc\u7a0b\u4ee3\u7801\u6267\u884c\uff0c\u771f\u662f\u96be\u4e3astruts\u5f00\u53d1\u8005\u4e86\u3002
\n\u540c\u65f6\u4e5f\u95ee\u4e00\u4e0b\u4f7f\u7528struts\u7684\u540c\u5b66\u4eec\uff0c\u4f60\u4eec\u8fd9\u4e9b\u5e74\uff0c\u662f\u600e\u4e48\u8fc7\u6765\u7684\uff1f
\n\u5728\u963f\u91cc\u5df4\u5df4\uff0c\u6211\u65f6\u5e38\u5206\u6790struts2\u6f0f\u6d1e\u7136\u540e\u53d1\u62a5\u544a\uff0c\u6709\u65f6\u5019\u4f1a\u662f0day\uff0c\u90a3\u5c31\u8981\u51fa\u4e2a\u8865\u4e01\u7ed9\u5404\u4e2a\u9879\u76ee\u7528\uff0c\u6700\u540e\u7b49\u5230\u5b98\u65b9\u53d1\u5e03\u8865\u4e01\u65f6\uff0c\u6211\u4eec\u518d\u8bc4\u4f30\u662f\u5426\u9700\u8981\u91cd\u65b0\u66f4\u65b0\u56de\u53bb\u3002\u5bfc\u81f4\u6211\u4eec\u65f6\u5e38\u529d\u8bf4\u5f00\u53d1\u4eba\u5458\u5c3d\u91cf\u4e0d\u8981\u4f7f\u7528\u8fd9\u4e2a\u6846\u67b6\uff0c\u5c24\u5176\u662f\u9879\u76ee\u521d\u671f\u8bc4\u5ba1\u65f6\uff0c\u53d1\u73b0struts2\uff0c\u6df1\u6076\u75db\u7edd\uff0c\u8bf4\u5f88\u591a\u5f88\u591a\u8bdd\u7528\u4e8e\u5413\u552c\u5f00\u53d1\u4eba\u5458\u3002
\n\u5728\u8fd9\u79cd\u8d8b\u52bf\u4e0b\uff0c\u6211\u5bf9\u8fd9\u4e2a\u4e1c\u897f\u5df2\u7ecf\u518d\u65e0\u4efb\u4f55\u4fa5\u5e78\u5fc3\u7406\uff0c\u51b3\u5b9a\u63a8\u51fa\u4e00\u4e2a\u865a\u62df\u8865\u4e01\u3002\u81f3\u4e8e\u963f\u91cc\u7684\u771f\u5b9e\u65b9\u6848\uff0c\u6211\u80af\u5b9a\u4e0d\u80fd\u544a\u8bc9\u5927\u5bb6\uff0c\u4f46\u662f\u53ef\u4ee5\u8bb2\u8bb2\u601d\u8def\u3002
\n\u7edf\u4e00\u9632\u5fa1\u65b9\u6848<\/strong>
\n\u9996\u5148\u5347\u7ea7\u5230\u6700\u65b0\u7248\u672c\u3002
\n\u5728ognl\u8fd9\u4e2a\u8bed\u8a00\u7684\u5165\u53e3\uff0c\u52a0\u5165\u62e6\u622a\u4ee3\u7801\uff0c\u4e00\u65e6\u53d1\u73b0\u5371\u9669\u8c03\u7528\uff0c\u76f4\u63a5\u5e72\u6389\u3002
\n\u4ee3\u7801\u539f\u7406\u662f\uff0c\u5728OGNL\u6267\u884c\u4e4b\u524d\uff0c\u5bf9\u8bed\u53e5\u505a\u5224\u65ad\uff0c\u770b\u5230\u6709\u9ed1\u540d\u5355\u7684\u4ee3\u7801\uff0c\u5c31\u5e72\u6389\u3002\u7406\u8bba\u4e0a\uff0c\u5f00\u53d1\u4eba\u5458\u7406\u8bba\u4e0a\u4e0d\u4f1a\u81ea\u5df1\u5199OGNL\u7528\u4e8e\u64cd\u4f5c\u6587\u4ef6\uff0c\u6267\u884c\u547d\u4ee4\u7b49\uff0c\u4ed6\u4eec\u6700\u591a\u4ecesession\u4e2d\u53d6\u4e00\u4e2a\u503c\uff0c\u6216\u8005\u5728\u9875\u9762\u4e0a\u53d6\u4e00\u4e2a\u503c\u3002
\n\u8986\u76d6\u6389Ognl.Ognl\u7c7b\uff0c\u6dfb\u52a0\u5982\u4e0b\u4ee3\u7801\uff1a<\/p>\n

\r\n    public static Object parseExpression(String expression)\r\n            throws OgnlException {\r\n        \/\/ hackedbykxlzx by \u7a7a\u865a\u6d6a\u5b50\u5fc3 http:\/\/inbreak.net \u5fae\u535a\uff1ahttp:\/\/t.qq.com\/javasecurity\r\n\t\/\/\u3002\u3002\u3002\u4e0b\u9762\u662f\u767d\u540d\u5355\u5217\u8868\uff0c\u8bf7\u5404\u4f4d\u540c\u5b66\u81ea\u884c\u641c\u7d22java\u5371\u9669\u4ee3\u7801\uff0c\u4e4b\u540e\u52a0\u5165\u5217\u8868\uff0c\u5b9e\u5728\u4e0d\u4f1a\u7684\uff0c\u627e\u51e0\u4e2awebshell\u770b\u770b\uff0c\u6211\u80af\u5b9a\u4e0d\u4f1a\u628a\u963f\u91cc\u6b63\u5728\u4f7f\u7528\u7684\u5217\u8868\u544a\u8bc9\u4f60\u4eec\u7684\u3002\r\n        String evalMethod[] = { \"Runtime\", \"new file\" };\r\n        String methodString = null;\r\n        methodString = expression.toLowerCase();\r\n        for (int i = 0; i < evalMethod.length; i++) {\r\n            if (methodString.indexOf(evalMethod[i].toLowerCase()) > -1) {\r\n                Log.securityLog(Log.getInfo()+\"|OGNL\u6b63\u5728\u6267\u884c\u6076\u610f\u8bed\u53e5|\" + methodString\r\n                        + \"|\u770b\u5230\u8fd9\u4e2a\u6d88\u606f\uff0c\u8bf7\u8054\u7cfb\u5b89\u5168\u5de5\u7a0b\u5e08\uff01\uff01\uff01\",\"4700012@qq.com\");\r\n            }\r\n        }\r\n\r\n        try {\r\n            OgnlParser parser = new OgnlParser(new StringReader(expression));\r\n            return parser.topLevelExpression();\r\n        } catch (ParseException e) {\r\n            throw new ExpressionSyntaxException(expression, e);\r\n        } catch (TokenMgrError e) {\r\n            throw new ExpressionSyntaxException(expression, e);\r\n        }\r\n    }\r\n<\/pre>\n

\u4e3a\u4ec0\u4e48\u8981\u52a0\u5165QQ\u90ae\u7bb1\u5462\uff1f\u5177\u4f53\u539f\u56e0\u4e0d\u8bf4\uff0c\u53ea\u8bf4\u7ed3\u679c\uff0c\u7ed3\u679c\u662f\uff0c\u6211\u7684\u90ae\u7bb1\u53ef\u4ee5\u6536\u52300DAY\uff0c\u4f60\u5982\u679c\u771f\u7684\u770b\u61c2\u4e86\uff0c\u81ea\u5df1\u731c\u731c\u539f\u56e0\uff1f
\nby \u7a7a\u865a\u6d6a\u5b50\u5fc3 http:\/\/inbreak.net \u5fae\u535a\uff1ahttp:\/\/t.qq.com\/javasecurity<\/p>\n","protected":false},"excerpt":{"rendered":"

\u53ef\u80fd\u662f\u7531\u4e8e\u6c9f\u901a\u95ee\u9898\uff0c\u5bfc\u81f4struts2\u5b98\u65b9\u5bf9\u6211\u63d0\u4ea4\u7684S2-012\u6f0f\u6d1e\u540d\u79f0\u7406\u89e3\u9519\u8bef\uff0c\u6f0f\u6d1e\u63cf\u8ff0\u4e3astruts2\u7684\u67d0\u4e2a\u793a\u4f8b\u5e94\u7528\u51fa\u73b0\u6f0f\u6d1e\uff0c\u4f46\u662fstruts2\u662f\u6309\u7167\u6846\u67b6\u51fa\u73b0\u6f0f\u6d1e\u4fee\u8865\u7684\u3002\u800c\u8fd9\u4e2as2-012\u7684\u53d1\u5e03\u7adf\u7136\u5f15\u53d1\u4e86\u4e00\u8fde\u4e32\u8840\u6848\u3002<\/p>\n

\u7ee7\u7eed\u9605\u8bfb »<\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[84,86,5],"tags":[112,60],"views":152573,"_links":{"self":[{"href":"https:\/\/www.inbreak.net\/wp-json\/wp\/v2\/posts\/507"}],"collection":[{"href":"https:\/\/www.inbreak.net\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.inbreak.net\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.inbreak.net\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.inbreak.net\/wp-json\/wp\/v2\/comments?post=507"}],"version-history":[{"count":4,"href":"https:\/\/www.inbreak.net\/wp-json\/wp\/v2\/posts\/507\/revisions"}],"predecessor-version":[{"id":529,"href":"https:\/\/www.inbreak.net\/wp-json\/wp\/v2\/posts\/507\/revisions\/529"}],"wp:attachment":[{"href":"https:\/\/www.inbreak.net\/wp-json\/wp\/v2\/media?parent=507"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.inbreak.net\/wp-json\/wp\/v2\/categories?post=507"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.inbreak.net\/wp-json\/wp\/v2\/tags?post=507"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}