关于struts漏洞之---/struts/webconsole.html

来源:互联网 发布:mac上的音频处理软件 编辑:程序博客网 时间:2024/06/06 04:05

使用扫描工具扫描出struts项目存放访问 路径:http:host:port/web//struts/webconsole.html,

刚开始以为是在项目的struts.xml配置文件中开启了开发模式,后来发现无论开启与否,甚至显式的关闭开发模式,这个链接都可以访问,

于是上网看看别人的解决办法,从先解决问题出发,按网上的办法进入如下路径:

struts2-core-*.jar\org\apache\struts2\interceptor\debugging\

删除了里面的所有静态文件,ftl,html,js,css,

再访问就变成404了,问题到此基础解决了,先交差吧,但,是否就只有这个“无奈”的解决方法呢?

于是将视线转向国外,在SO上找到如下两个自称解决办法的“办法”:

struts.xml中添加<constant name="struts.action.excludePattern" value="/struts/webconsole.html" />

web.xml中添加

<security-constraint>
  <web-resource-collection>
    <web-resource-name>OGNLconsole</web-resource-name>
    <url-pattern>*/struts/webconsole.*</url-pattern>
  </web-resource-collection>
</security-constraint>

经测试,这两种都“不能”解决问题,为什么使用双引号呢,因为如果真一点用的都没有,就干脆不用提了,

这两种方法方法都基于一种思想:权限,

第一种方法是想把某些url排除,而第二种方法也是对url进行详细配置,包括权限,

经过改良,第一种改成,必须使用 * ,不能是详细的后缀等形式

<constant name="struts.action.excludePattern" value="/static/.*" />

第二种改成正好相反,必须详细到后缀,不能使用万用格式 *

<security-constraint>
  <web-resource-collection>
    <web-resource-name>OGNLconsole</web-resource-name>
    <url-pattern>/struts/webconsole.
html</url-pattern>
  </web-resource-collection>
  <auth-constraint/>
</security-constraint>

至此,经过改良,已经不需要再对jar包进行修改了,应用的配置功能得以体现。

0 0
原创粉丝点击