凭据注入
当我们找到一个凭证后我们应该如何利用呢?
Runas 可以帮你解决这个问题。
当我们有一个 AD 的凭证时,我们可以在目标上运行 Runas ,将凭证注入内存中:
runas.exe /netonly /user:<domain>\<username> cmd.exe
- /netonly :
- /user : 提供域和用户的信息
- cmd.exe : 注入凭证后运行的程序
验证
当我们提供了密码进行登录后,我们如何验证我们的凭据是否正常工作,最可靠的方法时列出 SYSVOL ,任何 AD 账户都可以读取 SYSVOL 目录的内容。
C:\Tools>dir \\za.tryhackme.com\SYSVOL\
Volume in drive \\za.tryhackme.com\SYSVOL is Windows
Volume Serial Number is 1634-22A9
Directory of \\za.tryhackme.com\SYSVOL
02/24/2022 09:57 PM <DIR> .
02/24/2022 09:57 PM <DIR> ..
02/24/2022 09:57 PM <JUNCTION> za.tryhackme.com [C:\Windows\SYSVOL\domain]
0 File(s) 0 bytes
3 Dir(s) 51,835,408,384 bytes free
通过 MMC 进行枚举
:::info GUI 方法,比较繁琐,并且适用性不高
:::
TryHackMe | Enumerating Active Directory
利用 CMD
CMD 中有一个内置命令 net
可以帮助我们枚举 AD 内容。
:::info Net 命令官方文档
:::
用户
C:\>net user /domain
The request will be processed at a domain controller for domain za.tryhackme.com
User accounts for \\THMDC
-------------------------------------------------------------------------------
aaron.conway aaron.hancock aaron.harris
aaron.johnson aaron.lewis aaron.moore
aaron.patel aaron.smith abbie.joyce
abbie.robertson abbie.taylor abbie.walker
abdul.akhtar abdul.bates abdul.holt
abdul.jones abdul.wall abdul.west
abdul.wilson abigail.cox abigail.cox1
abigail.smith abigail.ward abigail.wheeler
[....]
The command completed successfully.
C:\>net user zoe.marshall /domain
The request will be processed at a domain controller for domain za.tryhackme.com
User name zoe.marshall
Full Name Zoe Marshall
Comment
User's comment
Country/region code 000 (System Default)
Account active Yes
Account expires Never
Password last set 2/24/2022 10:06:06 PM
Password expires Never
Password changeable 2/24/2022 10:06:06 PM
Password required Yes
User may change password Yes
Workstations allowed All
Logon script
User profile
Home directory
Last logon Never
Logon hours allowed All
Local Group Memberships
Global Group memberships *Domain Users *Internet Access
The command completed successfully.
组
C:\>net group /domain
The request will be processed at a domain controller for domain za.tryhackme.com
Group Accounts for \\THMDC
-------------------------------------------------------------------------------
*Cloneable Domain Controllers
*DnsUpdateProxy
*Domain Admins
*Domain Computers
*Domain Controllers
*Domain Guests
*Domain Users
[...]
*Schema Admins
*Server Admins
*Tier 0 Admins
*Tier 1 Admins
*Tier 2 Admins
The command completed successfully.
C:\>net group "Tier 1 Admins" /domain
The request will be processed at a domain controller for domain za.tryhackme.com
Group name Tier 1 Admins
Comment
Members
-------------------------------------------------------------------------------
t1_arthur.tyler t1_gary.moss t1_henry.miller
t1_jill.wallis t1_joel.stephenson t1_marian.yates
t1_rosie.bryant
The command completed successfully.
密码策略
C:\>net accounts /domain
The request will be processed at a domain controller for domain za.tryhackme.com
Force user logoff how long after time expires?: Never
Minimum password age (days): 0
Maximum password age (days): Unlimited
Minimum password length: 0
Length of password history maintained: None
Lockout threshold: Never
Lockout duration (minutes): 30
Lockout observation window (minutes): 30
Computer role: PRIMARY
The command completed successfully.
利用 Powershell
:::info AD-RSAT 官方文档
:::
用户
PS C:\> Get-ADUser -Identity gordon.stevens -Server za.tryhackme.com -Properties *
AccountExpirationDate :
accountExpires : 9223372036854775807
AccountLockoutTime :
[...]
Deleted :
Department : Consulting
Description :
DisplayName : Gordon Stevens
DistinguishedName : CN=gordon.stevens,OU=Consulting,OU=People,DC=za,DC=tryhackme,DC=com
[...]
- Identity : 正在枚举的账户名称
- Server : 指定 DC
- Properties : 显示那些属性
组
PS C:\> Get-ADGroup -Identity Administrators -Server za.tryhackme.com
DistinguishedName : CN=Administrators,CN=Builtin,DC=za,DC=tryhackme,DC=com
GroupCategory : Security
GroupScope : DomainLocal
Name : Administrators
ObjectClass : group
ObjectGUID : f4d1cbcd-4a6f-4531-8550-0394c3273c4f
SamAccountName : Administrators
SID : S-1-5-32-544
PS C:\> Get-ADGroupMember -Identity Administrators -Server za.tryhackme.com
distinguishedName : CN=Domain Admins,CN=Users,DC=za,DC=tryhackme,DC=com
name : Domain Admins
objectClass : group
objectGUID : 8a6186e5-e20f-4f13-b1b0-067f3326f67c
SamAccountName : Domain Admins
SID : S-1-5-21-3330634377-1326264276-632209373-512
[...]
distinguishedName : CN=Administrator,CN=Users,DC=za,DC=tryhackme,DC=com name : Administrator
objectClass : user
objectGUID : b10fe384-bcce-450b-85c8-218e3c79b30fSamAccountName : Administrator
SID : S-1-5-21-3330634377-1326264276-632209373-500
域
查看特定域的信息
PS C:\> Get-ADDomain -Server za.tryhackme.com
AllowedDNSSuffixes : {}
ChildDomains : {}
ComputersContainer : CN=Computers,DC=za,DC=tryhackme,DC=com
DeletedObjectsContainer : CN=Deleted Objects,DC=za,DC=tryhackme,DC=com
DistinguishedName : DC=za,DC=tryhackme,DC=com
DNSRoot : za.tryhackme.com
DomainControllersContainer : OU=Domain Controllers,DC=za,DC=tryhackme,DC=com
[...]
UsersContainer : CN=Users,DC=za,DC=tryhackme,DC=com
Bloodhound
我们可以利用 BloodHound 进行 AD 枚举,基本上涉及到 AD 攻击就会使用到该工具
LDAP 枚举
389, 636, 3268, 3269 - Pentesting LDAP - HackTricks
Powerview
PowerView 备忘单:PowerView 备忘单
# 使用 powershell -ep bypass 绕过 PowerSHELL 执行策略
controller\administrator@DOMAIN-CONTROLL C:\Users\Administrator>powershell -ep bypass
Windows PowerShell
Copyright (C) Microsoft Corporation. All rights reserved.
PS C:\Users\Administrator>
WMI 枚举
Offensive WMI - Active Directory Enumeration (Part 5)