Skip to content

Commit 082c300

Browse files
committed
Autodetect DC from realm for /changepw
Make /changepw use the user realm when autodetecting the DC.
1 parent bec0e35 commit 082c300

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

Rubeus/lib/Reset.cs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
using System;
2+
using System.DirectoryServices.ActiveDirectory;
23
using System.IO;
34
using System.Linq;
45
using System.Net;
@@ -28,13 +29,13 @@ public static void UserPassword(KRB_CRED kirbi, string newPassword, string domai
2829
// KRB-PRIV structure containing ChangePasswdData, enc w/ the sub session key
2930
// reference: Microsoft Windows 2000 Kerberos Change Password and Set Password Protocols (RFC3244)
3031

31-
string dcIP = Networking.GetDCIP(domainController);
32-
if (String.IsNullOrEmpty(dcIP)) { return; }
33-
3432
// extract the user and domain from the existing .kirbi ticket
3533
string userName = kirbi.enc_part.ticket_info[0].pname.name_string[0];
3634
string userDomain = kirbi.enc_part.ticket_info[0].prealm;
3735

36+
string dcIP = Networking.GetDCIP(domainController, false, userDomain);
37+
if (String.IsNullOrEmpty(dcIP)) { return; }
38+
3839
if (targetUser == null) {
3940
Console.WriteLine("[*] Changing password for user: {0}@{1}", userName, userDomain);
4041
} else {

0 commit comments

Comments
 (0)