Persistence via Malicious Microsoft Outlook VBA Template
Attackers establish persistence by installing a malicious VBA template in Microsoft Outlook, triggering scripts upon application startup by modifying the VBAProject.OTM file, detected by monitoring for unauthorized file modifications.
Attackers can leverage Microsoft Outlook’s VBA scripting capabilities to establish persistence on compromised systems. This is achieved by installing malicious VBA templates within the Outlook environment. These templates are designed to execute upon application startup, granting the attacker sustained access and control. The attack centers around unauthorized modifications to the VbaProject.OTM file, a critical component for VBA script storage in Outlook. This technique allows threat actors to maintain a foothold even after system restarts or user logoffs. Defenders need to monitor for suspicious changes to this file to identify and mitigate potential compromises.
Attack Chain
- The attacker gains initial access to the target system, potentially through phishing or other social engineering methods (not detailed in source).
- The attacker identifies a user with Microsoft Outlook installed and running on a Windows system.
- The attacker modifies or replaces the existing
VbaProject.OTMfile located in the user’s Outlook profile (C:\Users\*\AppData\Roaming\Microsoft\Outlook\). - The modified
VbaProject.OTMfile contains malicious VBA code designed to execute when Outlook starts. - The victim launches Microsoft Outlook.
- The malicious VBA code within
VbaProject.OTMexecutes automatically upon Outlook startup, establishing persistence. - The VBA script can perform various malicious actions, such as downloading and executing additional payloads, establishing command and control, or exfiltrating data.
Impact
Successful exploitation can lead to persistent access to the compromised system, allowing attackers to steal sensitive information, deploy ransomware, or use the system as a staging ground for further attacks within the network. The number of victims and specific sectors targeted depends on the attacker’s objectives and scope of the campaign. If the attack succeeds, an attacker could gain complete control over the user’s email account and associated data, leading to significant data breaches and financial losses.
Recommendation
- Deploy the Sigma rule
Detect Outlook VBA Template Modificationto your SIEM to identify unauthorized modifications to theVbaProject.OTMfile based on file creation events. - Enable Sysmon file creation logging (Event ID 11) to activate the
Detect Outlook VBA Template Modificationrule. - Implement application control policies to restrict unauthorized modifications to Outlook VBA files as described in the “Response and remediation” section of the source.
- Monitor file creation events related to
VbaProject.OTMin the specified paths (C:\\Users\\*\\AppData\\Roaming\\Microsoft\\Outlook\\VbaProject.OTM) as highlighted in the rule query.
Detection coverage 2
Detect Outlook VBA Template Modification
mediumDetects the creation or modification of the VbaProject.OTM file, indicating a potential persistence attempt via malicious Outlook VBA.
Detect Outlook VBA Project from Suspicious Process
mediumDetects process creating VBA Project files that are not Outlook
Detection queries are kept inside the platform. Get full rules →