Path: blob/master/modules/auxiliary/gather/citrix_published_bruteforce.rb
19593 views
##1# This module requires Metasploit: https://metasploit.com/download2# Current source: https://github.com/rapid7/metasploit-framework3##45class MetasploitModule < Msf::Auxiliary6include Msf::Exploit::Remote::Udp78def initialize(info = {})9super(10update_info(11info,12'Name' => 'Citrix MetaFrame ICA Published Applications Bruteforcer',13'Description' => %q{14This module attempts to brute force program names within the Citrix15Metaframe ICA server.16},17'Author' => [ 'aushack' ],18'References' => [19[ 'OSVDB', '50617' ],20[ 'BID', '5817' ]21],22'Notes' => {23'Reliability' => UNKNOWN_RELIABILITY,24'Stability' => UNKNOWN_STABILITY,25'SideEffects' => UNKNOWN_SIDE_EFFECTS26}27)28)2930register_options(31[32Opt::RPORT(1604),33]34)35end3637def autofilter38false39end4041def run42connect_udp4344print_status("Attempting to contact Citrix ICA service...")4546# Client NetBIOS hostname. This works fine >:)47client = Rex::Text.rand_text_alphanumeric(8)4849# Server hello packet50client_connect =51"\x1e\x00\x01\x30\x02\xfd\xa8\xe3\x00\x00\x00\x00\x00\x00\x00\x00" +52"\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"5354# Server hello response55server_response =56"\x30\x00\x02\x31\x02\xfd\xa8\xe3\x02\x00\x06\x44"5758applications = [59'TEST',60'NOTEPAD',61'ACROBAT READER',62'ACROBAR',63'EXPLORER',64'WORD',65'WORD2K',66'WORDXP',67'WORD2K3',68'WORD2K7',69'WORD 2000',70'WORD XP',71'WORD 2003',72'WORD 2007',73'WORD2000',74'WORD2003',75'WORD2007',76'EXCEL',77'EXCEL2K',78'EXCELXP',79'EXCEL2K3',80'EXCEL2K7',81'EXCEL 2000',82'EXCEL XP',83'EXCEL 2003',84'EXCEL 2007',85'EXCEL2000',86'EXCEL2003',87'EXCEL2007',88'ACCESS',89'ACCESS2K',90'ACCESSXP',91'ACCESS2K3',92'ACCESS2K7',93'ACCESS 2000',94'ACCESS XP',95'ACCESS 2003',96'ACCESS 2007',97'ACCESS2000',98'ACCESS2003',99'ACCESS2007',100'POWERPOINT',101'POWERPOINT2K',102'POWERPOINTXP',103'POWERPOINT2K3',104'POWERPOINT2K7',105'POWERPOINT 2000',106'POWERPOINT XP',107'POWERPOINT 2003',108'POWERPOINT 2007',109'POWERPOINT2000',110'POWERPOINT2003',111'POWERPOINT2007',112'OUTLOOK',113'OUTLOOKXP',114'OUTLOOK2K',115'OUTLOOK2K3',116'OUTLOOK2K7',117'OUTLOOK 2000',118'OUTLOOK XP',119'OUTLOOK 2003',120'OUTLOOK 2007',121'OUTLOOK2000',122'OUTLOOK2003',123'OUTLOOK2007',124'LOTUS',125'LOTUS NOTES',126'INTERNETEXPLORER',127'IE',128'IEXPLORER',129'FIREFOX',130'FIREFOX 3',131'NETSCAPE',132'NETSCAPE7',133'NETSCAPE6',134'MAIL',135'EMAIL',136'E-MAIL',137'INTERNET',138'CMD',139'COMMAND',140]141142# Citrix is publishing this application143application_valid =144"\x3e\x00\x02\x35\x02\xfd\xa8\xe3\x02\x00\x06\x44"145# Application not found / published146application_invalid =147"\x20\x00\x01\x3a\x02\xfd\xa8\xe3\x02\x00\x06\x44"148149udp_sock.put(client_connect)150res = udp_sock.get(3)151152if (res[0, server_response.length] == server_response)153print_status("Citrix ICA Server Detected. Attempting to brute force Published Applications.")154155applications.each do |application|156# Create the packet157packet = [52 + application.length].pack('C')158packet << "\x00\x02\x34\x02\xfd\xa8\xe3\x00\x00\x00\x00\x00\x00\x00\x00"159packet << "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x26\x00\x02\x00"160packet << [39 + application.length].pack('C')161packet << "\x00\x00\x00\x00\x00"162packet << application163packet << "\x00\x01\x00\x04\x00"164packet << client165packet << "\x00"166167udp_sock.put(packet)168res = udp_sock.get(3)169170if (res[0, application_valid.length] == application_valid)171print_status("Found: #{application}")172end173174if (res[0, application_invalid.length] == application_invalid)175print_error("NOT Found: #{application}")176end177end178179else180print_error("Server did not respond.")181end182183disconnect_udp184end185end186187188