CVE-2012-1854 Microsoft Sentinel · KQL

Detect CVE-2012-1854 - Microsoft VBA Insecure Library Loading (DLL Hijacking) in Microsoft Sentinel

Detects exploitation of CVE-2012-1854, a DLL hijacking vulnerability in Microsoft Visual Basic for Applications (VBA). Attackers can place a malicious DLL in a directory searched before the legitimate library path, causing Office applications loading VBA to execute attacker-controlled code. This vulnerability is listed in CISA's Known Exploited Vulnerabilities catalog.

MITRE ATT&CK

Tactic
Execution Persistence Privilege Escalation

KQL Detection Query

Microsoft Sentinel (KQL)
kusto
let SuspiciousDLLPaths = dynamic(['\\Users\\', '\\AppData\\', '\\Temp\\', '\\Downloads\\', '\\Desktop\\']);
DeviceImageLoadEvents
| where Timestamp > ago(7d)
| where InitiatingProcessFileName has_any ('WINWORD.EXE', 'EXCEL.EXE', 'POWERPNT.EXE', 'OUTLOOK.EXE', 'MSACCESS.EXE', 'MSPUB.EXE', 'VISIO.EXE')
| where FileName has_any ('vbe7.dll', 'vba7.dll', 'vbe6.dll', 'vba6.dll', 'msvbvm60.dll', 'msvbvm50.dll')
| where FolderPath has_any (SuspiciousDLLPaths)
| project Timestamp, DeviceName, AccountName, InitiatingProcessFileName, InitiatingProcessFolderPath, FileName, FolderPath, SHA256, InitiatingProcessCommandLine
| extend RiskIndicator = 'VBA DLL loaded from non-standard path'
| order by Timestamp desc
high severity high confidence

Detects Office applications loading VBA-related DLLs from non-standard paths such as user profile directories, AppData, Temp, or Downloads folders, indicative of DLL hijacking exploitation of CVE-2012-1854.

Data Sources

Microsoft Defender for EndpointMicrosoft Sentinel

Required Tables

DeviceImageLoadEvents

False Positives & Tuning

  • Legitimate software testing or development environments where VBA DLLs are deployed in non-standard locations
  • Software installation or update processes temporarily placing DLLs in user directories
  • Portable Office applications or sandboxed environments with non-standard directory structures
  • Antivirus or DLP tools staging files in temporary locations during scanning

Other platforms for CVE-2012-1854


Testing Methodology

Validate this detection against 3 adversary techniques from Atomic Red Team. Each test below lists the behaviour to exercise and the telemetry you should expect to see. Executable commands and cleanup steps are available with Pro.

  1. Test 1VBA DLL Hijack - Place Malicious DLL in Temp Directory

    Expected signal: Sysmon Event ID 7 showing WINWORD.EXE loading vbe7.dll from %TEMP% path; DeviceImageLoadEvents in MDE showing FolderPath containing \Temp\

  2. Test 2VBA DLL Hijack - Place Malicious DLL in Downloads Directory

    Expected signal: Sysmon ImageLoad event with ImageLoaded path in \Downloads\; Windows Security log showing file creation event in Downloads directory followed by Office process DLL load

  3. Test 3VBA DLL Hijack - Simulate Document-Triggered DLL Load via PowerShell

    Expected signal: Sysmon Event ID 7 with POWERPNT.EXE as initiating process and vba7.dll loaded from TEMP\vba_hijack_test path; process creation event showing PowerShell as parent of POWERPNT

Unlock Pro Content

Get the full detection package for CVE-2012-1854 including response playbook, investigation guide, and atomic red team tests.

Response PlaybookInvestigation GuideHunting QueriesAtomic Red Team TestsTuning Guidance

Related Detections