【问题标题】:Classloader vulnerability reproducing procedure in struts 1.1struts 1.1 中的类加载器漏洞重现过程
【发布时间】:2014-05-05 03:49:00
【问题描述】:

在 Struts1 中,我听说有一个由 CVE-2014-0114 引起的类加载器漏洞问题。但我无法在我的项目中重现这一点。谁能帮助我如何重现此问题。我用谷歌搜索但没有得到任何复制程序。

我正在为我的网络项目使用struts-1.1Jboss -4.2.3.GAApache 2.2.0MySql 5.0.37JKModJDK 1.6.0_12Ant 1.7.0

【问题讨论】:

    标签: security jboss classloader struts-1 reproducible-research


    【解决方案1】:

    尝试调用映射到 struts 操作(由操作表单支持)的 URL。该框架将尝试从查询参数填充您的表单 bean。因此,如果您有一个像?class.classLoader.defaultAssertionStatus=true 这样的查询参数,它会转换为formBean.getClass().getClassLoader().setDefaultAssertionStatus(true)

    如果您启用了调试日志记录,您会看到以下消息:

    2014-05-05 12:57:50,238 DEBUG [org.apache.struts.action.RequestProcessor]  Populating bean properties from this request
    2014-05-05 12:57:50,238 DEBUG [org.apache.commons.beanutils.BeanUtils] BeanUtils.populate(com.xxx.struts.demo.web.form.SimpleForm@71909bc, {class.classLoader.defaultAssertionStatus=[Ljava.lang.String;@a6b23fd4})
    2014-05-05 12:57:50,238 DEBUG [org.apache.commons.beanutils.BeanUtils]   setProperty(com.xxx.struts.demo.web.form.SimpleForm@71909bc, class.classLoader.defaultAssertionStatus, [true])
    2014-05-05 12:57:50,246 DEBUG [org.apache.commons.beanutils.BeanUtils]     Target bean = com.ibm.ws.classloading.internal.AppClassLoader@3ac10955
    2014-05-05 12:57:50,246 DEBUG [org.apache.commons.beanutils.BeanUtils]     Target name = defaultAssertionStatus
    2014-05-05 12:57:50,250 DEBUG [org.apache.commons.beanutils.ConvertUtils] Convert string 'true' to class 'boolean'
    2014-05-05 12:57:50,250 DEBUG [org.apache.commons.beanutils.ConvertUtils]   Using converter org.apache.commons.beanutils.converters.BooleanConverter@de2943ef
    2014-05-05 12:57:50,250 DEBUG [org.apache.commons.beanutils.PropertyUtils] setSimpleProperty: Invoking method public void java.lang.ClassLoader.setDefaultAssertionStatus(boolean) with value true (class java.lang.Boolean)
    

    【讨论】:

    • 你能给我举个例子吗? @kishore-kirdat
    • 例如 - http:///struts-demo/demo.do?class.classLoader.defaultAssertionStatus=true。
    • 谢谢。但我仍然不清楚为什么打开默认断言会导致拒绝服务问题。
    • 该漏洞允许攻击者操纵类加载器属性。因此,实际影响取决于应用程序容器,因为每个容器(类加载器)都公开了它们自己的属性。
    • 您使用什么版本的 Struts 和 BeanUtils 来获得该输出?我的输出不同:我得到 BeanUtils.populateConvert string,但 setSimpleProperty 没有被记录。
    【解决方案2】:

    我已经尝试了超过 2 种方法来重现目的。它工作正常。

    1. http://127.0.0.1:8080/MyFormGroupEditSection.do?com.macao.DelphyHacker.Marathonclass.marathonId=34&groupId=862
    2. http://127.0.0.1:8080/MyFormGroupEditSection.do?class.classLoader=true&groupId=862

    为了解决这个问题,我想添加一些 cmets。您可以点击这 2 个链接。希望它能帮助您消除这个问题。

    http://h30499.www3.hp.com/t5/HP-Security-Research-Blog/Protect-your-Struts1-applications/ba-p/6463188#.U2J7xeaSxro

    http://mail-archives.apache.org/mod_mbox/struts-announcements/201405.mbox/%3C53629980.8060805%40apache.org%3E

    【讨论】:

    【解决方案3】:
    【解决方案4】:

    除上述解决方案外,我想指出的是,在 ClassLoader 中的 defaultAssertionStatus = enabled; 行中添加断点 setDefaultAssertionStatus 并在 private boolean defaultAssertionStatus = false; 行中添加观察者是验证上述是否存在的好方法url 修改:?class.classLoader.defaultAssertionStatu‌​s=true 已经生效,您的 defaultAssertionStatus 现在应该为 true。

    希望这会有所帮助!

    【讨论】:

    • 这没有提供问题的答案。要批评或要求作者澄清,请在他们的帖子下方发表评论 - 您可以随时评论自己的帖子,一旦您有足够的reputation,您就可以comment on any post。 - From Review
    • 我没有足够的代表并想分享这个,因为我找不到一个简单的解决方案来测试 URL 是否有效。我在上面指定的断点完成了这项工作。
    【解决方案5】:

    这样的东西可以测试(至少在代码中)

          try {
            PropertyUtils.getNestedProperty(this, "class");
            Logger.error(this, "SECURITY ISSUE- `class` attribute NOT DISABLED for BeanUtil introspection, See: CVE-2014-0114 ");
          } catch (java.lang.NoSuchMethodException nse) {
            Logger.info(this, "`class` is disabled as a property for introspection in struts for security");
          } catch (Exception e) {
            Logger.warn(this, e.getMessage(), e);
          }
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2018-11-20
      • 2011-05-10
      • 1970-01-01
      • 2014-09-14
      • 2022-01-12
      • 1970-01-01
      相关资源
      最近更新 更多