首页 -> 安全研究

安全研究

绿盟月刊
绿盟安全月刊->第25期->最新漏洞
期刊号: 类型: 关键词:
Apache 数据库认证模块SQL语句插入漏洞

日期:2001-09-10

受影响的系统:  
Apache mod_auth_pg 1.2b2
Apache mod_auth_mysql 1.9
Apache mod_auth_oracle 0.5.1
Apache mod_auth_pgsql 0.9.5
Apache mod_auth_pgsql_sys 0.9.4

不受影响系统:  
Apache mod_auth_mysql 2.20
Apache mod_auth_mysql 1.10
Apache mod_auth_ora7 1.0
Apache mod_auth_ora8 1.0
Apache mod_auth_pg 1.3
Apache mod_auth_pgsql 0.9.6
描述:
--------------------------------------------------------------------------------


Apache 包含一些认证模块,其中一些使用SQL数据库来存储信息的模块存在一个远程SQL
语句插入的漏洞。如果Apache启动了这些模块,攻击者可能远程非法访问apache系统。

在这些认证处理过程中,需要在数据库中查找用户的口令hash。在有问题的模块中,采用
类似下列语句来生长SQL查询语句:
   
Query := Sprintf ("SELECT %s FROM %s WHERE %s = '%s'",
                  Password_Column, User_Table, User_Column,
                  User);
模块会根据返回的hash值与用户输入的口令进行比较。
然而,由于"User"的内容是用户提供的,攻击者可以提供下列的"User"内容:
   
'; SELECT 'wA8aGH92dPQnIDD

这使得生长的SQL语句变成了两条:
  
     SELECT password_column FROM user_table WHERE user_column = '';
     SELECT 'wA8aGH92dPQnIDD'

对于PostgreSQL模块,第二条SQL语句会返回一个有效的hash值,它是攻击者根据输入的
口令算出来的。因此在随后的匹配中就会一致,攻击者无需知道真正的口令就可以通过认证。

对于Oracle模块,攻击者可以使用UNION命令来插入其他的SQL语句,甚至可以调用存储过程。
对于MySQL模块,攻击者可能并不能很容易地加以利用。

<*来源:RUS-CERT (http://cert.uni-stuttgart.de/)  
       http://cert.uni-stuttgart.de/advisories/apache_auth.php
*>




--------------------------------------------------------------------------------
建议:

厂商补丁:

部分模块的作者已经提供了升级版本。我们建议正在使用此软件的用户尽快到厂商主页上
下载并升级:

* AuthPG 1.3 by Min S. Kim (http://authpg.sourceforge.net/)
* mod_auth_mysql 1.10 by Vivek Khera (ftp://ftp.kcilink.com/pub/)
* mod_auth_pgsql 0.9.6 by Guiseppe Tanzilli
(http://www.giuseppetanzilli.it/mod_auth_pgsql/dist/)

版权所有,未经许可,不得转载