Application Shimming
Adversaries may establish persistence and/or elevate privileges by executing malicious content triggered by application shims. The Microsoft Windows Application Compatibility Infrastructure/Framework (Application Shim) was created to allow for backward compatibility of software as the operating system codebase changes over time. The SDB (Shim DataBase) stores fix entries and shims. Malicious shim databases can be installed by adversaries using sdbinst.exe. Custom shims can be written to intercept and redirect API calls to inject malicious code into otherwise legitimate processes. This allows adversaries to apply persistent fixes to legitimate applications that execute when those applications run.
let SdbInstall = DeviceProcessEvents
| where Timestamp > ago(24h)
| where FileName =~ "sdbinst.exe"
| extend SdbFile = extract(@"sdbinst\.exe\s+(?:[-/][^\s]+\s+)*([\S]+\.sdb)", 1, ProcessCommandLine)
| extend IsUninstall = ProcessCommandLine has "-u"
| project SdbTime=Timestamp, DeviceName, AccountName, ProcessCommandLine,
SdbFile, IsUninstall, InitiatingProcessFileName;
let SdbRegistry = DeviceRegistryEvents
| where Timestamp > ago(24h)
| where RegistryKey has_any (
"SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\AppCompatFlags\\Custom",
"SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\AppCompatFlags\\InstalledSDB"
)
| where ActionType in ("RegistryValueSet", "RegistryKeyCreated")
| project RegTime=Timestamp, DeviceName, AccountName, RegistryKey,
RegistryValueName, RegistryValueData, InitiatingProcessFileName;
let SdbFiles = DeviceFileEvents
| where Timestamp > ago(24h)
| where FileName endswith ".sdb"
| where FolderPath !has "C:\\Windows\\AppPatch\\"
| where ActionType in ("FileCreated", "FileModified")
| project FileTime=Timestamp, DeviceName, AccountName, FileName, FolderPath, ActionType;
union (SdbInstall | extend EventType="SDB_INSTALL"),
(SdbRegistry | extend EventType="SDB_REGISTRY"),
(SdbFiles | extend EventType="SDB_FILE_CREATED")
| sort by SdbTime desc, RegTime desc, FileTime desc Data Sources
Required Tables
False Positives
- Microsoft and third-party application compatibility fixes installed via Windows Update or application installers that use sdbinst.exe to deploy compatibility shims
- Enterprise IT teams that deploy application compatibility databases via Group Policy or SCCM to resolve application compatibility issues
- Software vendors that include shim databases in their installers to ensure compatibility with different Windows versions
- Windows ADK (Assessment and Deployment Kit) users creating compatibility fixes for legacy applications
References (6)
- https://attack.mitre.org/techniques/T1546/011/
- https://github.com/redcanaryco/atomic-red-team/blob/master/atomics/T1546.011/T1546.011.md
- https://www.fireeye.com/blog/threat-research/2017/05/fin7-shim-databases-persistence.html
- https://www.mandiant.com/resources/blog/fin7-duos-duplicitous-scheme
- https://www.alex-ionescu.com/?p=39
- https://github.com/mandiant/ShimCacheParser
Unlock Pro Content
Get the full detection package for T1546.011 including response playbook, investigation guide, and atomic red team tests.