切换到宽版
  • 2871阅读
  • 0回复

Jboss中安全隐患 JMX-Console 登录名密码的设置 [复制链接]

上一主题 下一主题
离线猫仙
 

只看楼主 倒序阅读 使用道具 楼主  发表于: 2017-09-06
如果客户公司安全级别比较高,有时会进行安全扫描.比如中科网威等工具会扫描出数据库和jboss的一些安全漏洞,这里主要描述jboss的安全漏洞之一:
    漏洞号 37267                                         所属应用类别 webservers
    漏洞名: Jboss权限检查漏洞                    所属攻击类别 WEB脚本攻击

     危险级别:NPVL-B(高级)                         所属操作系统 widnows            
    CVSS分值: 5.94                                     漏洞相关端口 9999/tcp



    以上漏洞主要是指JBoss的JMX-Console没有设置用户密码.下面详细介绍该如何设置,以下来源与网络,原文连接

          

    i) 找到JBoss安装目录/server/default/deploy/jmx-console.war/WEB-INF/jboss-web.xml文 件,去掉<security-domain>java:/jaas/jmx-console</security- domain>的注释。修改后的该文件内容为:

<jboss-web>
  
<!-- Uncomment the security-domain to enable security. You will
      need to edit the htmladaptor login configuration to setup the
      login modules used to authentication users.
-->
      
<security-domain>java:/jaas/jmx-console</security-domain>
</jboss-web>

ii)修改与i)中的jboss-web.xml同级目录下的web.xml文件,查找到<security-constraint/>节点,去掉它的注释,修改后该部分内容为:

<!-- A security constraint that restricts access to the HTML JMX console
   to users with the role JBossAdmin. Edit the roles to what you want and
   uncomment the WEB-INF/jboss-web.xml/security-domain element to enable
   secured access to the HTML JMX console.
-->
  
<security-constraint>
    
<web-resource-collection>
      
<web-resource-name>HtmlAdaptor</web-resource-name>
      
<description>An example security config that only allows users with the
         role JBossAdmin to access the HTML JMX console web application
      
</description>
      
<url-pattern>/*</url-pattern>
      
<http-method>GET</http-method>
      
<http-method>POST</http-method>
    
</web-resource-collection>
    
<auth-constraint>
      
<role-name>JBossAdmin</role-name>
    
</auth-constraint>
  
</security-constraint>


   在此处可以看出,为登录配置了角色JBossAdmin。


iii) 在第一步中的jmx-console安全域和第二步中的运行角色JBossAdmin都是在login-config.xml中配置,我们在JBoss安 装目录/server/default/conf下找到它。查找名字为:jmx-console的application-policy:

<application-policy name = "jmx-console">
      
<authentication>
          
<login-module code="org.jboss.security.auth.spi.UsersRolesLoginModule"
             flag
= "required">
          
<module-option name="usersProperties">props/jmx-console-users.properties</module-option>
          
<module-option name="rolesProperties">props/jmx-console-roles.properties</module-option>
          
</login-module>
      
</authentication>
    
</application-policy>



在此处可以看出,登录的角色、用户等的信息分别在props目录下的jmx-console-roles.properties和jmx-console-users.properties文件中设置,分别打开这两个文件。

jboss-4.2.2.GA\server\default\conf\props
其中jmx-console-users.properties文件的内容如下:

# A sample users.properties file for use with the UsersRolesLoginModule
admin
=admin


该文件定义的格式为:用户名=密码,在该文件中,默认定义了一个用户名为admin,密码也为admin的用户,读者可将其改成所需的用户名和密码。
jmx-console-roles.properties的内容如下:

# A sample roles.properties file for use with the UsersRolesLoginModule
admin
=JBossAdmin, HttpInvoker


该文件定义的格式为:用户名=角色,多个角色以“,”隔开,该文件默认为admin用户定义了JBossAdmin和HttpInvoker这两个角色。
配置完成后读者可以通过访问: http://localhost:9999/jmx-console/ ,输入jmx-console-roles.properties文件中定义的用户名和密码,访问jmx-console的页面。



总结以下 其实就是修改2个xml文件.去掉注释的安全部分. 然后在jboss-4.2.2.GA\server\default\conf\props下面修改自己定义的用户名密码.登录http://localhost:9999/jmx-console/ 看看是否让你输入用户名密码了?成功了吧?

快速回复
限100 字节
如果您提交过一次失败了,可以用”恢复数据”来恢复帖子内容
 
上一个 下一个