安全研究

安全漏洞
LHA缓冲区溢出/目录遍历漏洞

发布日期:2004-04-30
更新日期:2006-04-05

受影响系统:
Mr. S.K. LHA 1.17
Mr. S.K. LHA 1.15
Barracuda Networks Barracuda Spam Firewall spamdef < 3.0.9388
Barracuda Networks Barracuda Spam Firewall firmware < 3.3.03.022
Mr. S.K. LHA 1.14
    - RedHat Linux 9.0
不受影响系统:
Barracuda Networks Barracuda Spam Firewall 3.3.03.022
Barracuda Networks Barracuda Spam Firewall 3.0.9388
描述:
BUGTRAQ  ID: 10243
CVE ID: CVE-2004-0234,CVE-2004-0235,CAN-2005-0643,CAN-2005-0644

LHa是一款基于控制台的解压缩程序。

LHa存在两个缓冲区溢出和两个目录遍历问题,远程攻击者可以利用这些漏洞以进程权限在系统上执行任意指令或破坏系统。

缓冲区溢出发生在测试(t)或者展开(x)操作时,对超长文件名或目录名进行解析时,get_header()函数会发生缓冲区溢出。精心构建文件名或目录名可以进程权限执行任意指令。

另外就是对相对路径没有任何保护,可简单使用LHA建立路径类似"../../../../../etc/cron.d/evil"的压缩包,虽然对绝对路径有保护,但可使用类似"//etc/cron.d/evil"的路径形式绕过。攻击者可以构建简单包当LHA操作时破坏系统文件。

<*来源:Ulf Harnhammar (ulfh@update.uu.se
        Jean-Sébastien Guay-Leroux (jean-sebastien@guay-leroux[.]com)
  
  链接:http://mail.stalker.com/Lists/CGatePro/Message/61244.html
        http://marc.theaimsgroup.com/?l=bugtraq&m=114417106609845&w=2
        http://secunia.com/advisories/11510/print/
        https://www.redhat.com/support/errata/RHSA-2004-179.html
*>

测试方法:

警 告

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

Ulf Harnhammar (ulfh@update.uu.se)提供了如下测试方法:

/* Author : N4rK07IX  narkotix@linuxmail.org

  Bug Found By : Ulf Ha"rnhammar <Ulf.Harnhammar.9485@student.uu.se>

LHa buffer overflows and directory traversal problems


PROGRAM: LHa (Unix version)
VENDOR: various people
VULNERABLE VERSIONS: 1.14d to 1.14i            // Theze sectionz completely taken from full-disclosure :))
                     1.17 (Linux binary)
                     possibly others
IMMUNE VERSIONS: 1.14i with my patch applied
                 1.14h with my patch applied

Patch : Ulf Ha"rnhammar made some patch U can find it on :
          LHa 1.14: http://www2m.biglobe.ne.jp/~dolphin/lha/lha.htm
      http://www2m.biglobe.ne.jp/~dolphin/lha/prog/
          LHa 1.17: http://www.infor.kanazawa-it.ac.jp/~ishii/lhaunix/


---------------------------------------------------------------

Little Explanation about Exploit : Copy the attached overflow.lha file to your directory , i.e /home
Then open overflow.lha with text editor(vim is better), U will see there four bytes XXXX at the end of the line, just
delete XXXX and paste your ASCII RET address there,but make sure not to malform the file.Then run the sploit.

Note : overflow.lha file is completely taken from Ulf's post.

Demo:

addicted@labs:~/c-hell$ ./lha /home/addicted/overflow.lha
--------------------------------------------------
| Author : N4rK07IX
| Vim 6.x Local Xpl0it
| narkotix@linuxmail.org
|--------------------------------------------------
[+] RET ADDRESS = 0xbffffd90
[!] Paste These ASCII 4 bytes Ret Adress to the XXXX in the file overflow.lha
[!] ASCII RET ADDR = 慅

建议:
厂商补丁:

Red Hat
-------
RedHat已经为此发布了一个安全公告(RHSA-2004:179-01)以及相应补丁:
RHSA-2004:179-01:An updated LHA package fixes security vulnerabilities
链接:https://www.redhat.com/support/errata/RHSA-2004-179.html

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

http://www.barracudanetworks.com/ns/products/spam_overview.php

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