Skip to main content

impair defenses | indicator blocking | ETW - event tracing for windows | autologger | wmi

https://attack.mitre.org/techniques/T1562/006/ 

https://medium.com/palantir/tampering-with-windows-event-tracing-background-offense-and-defense-4be7ac62ac63

 

synopsis:

Attacker always wants to cover their tracks. so they delete or disable windows event logs, audit logs, they even interrupt logging system or agent from the host so the host cannot send their logs to siem. 

attacker may change the following registry to achieve that:

HKLM\SYSTEM\CurrentControlSet\Control\WMI\Autologger\AUTOLOGGER_NAME\{Provider_GUID}

it can also be done by utilizing some administrative utilities like powershell, windows management instrumentation etc. 

now the question is how can we know the autologger name, GUID etc?

you can know that by navigating to the above registry path. or we can dig deeper the followings:

ETW architecture:

events providers

event tracing sessions

event consumers

 

tracing sessions are responsible for collecting events from event providers and relaying them to log files and consumers. sessions are created and configured by controllers like the windows built-in logman.exe command line utility. now we will see some existing commands for exploring existing trace sessions and their respective ETW providers. note that, need to execute these commands with elevated context. 

list all running trace sessions:

logman query -ets


 data collector set which we call autologger name / ETW provider. 

 

list all providers that a trace session is subscribed to:

logman query "EventLog-Application" -ets

you will get the GUID besides the provider name. 

 

ETW tempering techniques:

ETW provides a stealthy mechanism to affect logging without itself generating an event log trail. here is the log supply cut off procedure--

1. you can alter the registry setting. change the start value from 1 to 0. 

no need to reboot this is called ephemeral. where the attack can take place without a reboot. 

2. attacker can delete the whole registry

HKLM\SYSTEM\CurrentControlSet\Control\WMI\Autologger\AUTOLOGGER_NAME{PROVIDER_GUID}

the above techniques involves the removal of a provider entry from a configured autologger. removing a provider registration from an autologger will cause events to cease the flow to the respective trace session.

i.e. Remove-EtwTraceProvider -AutologgerName EventLog-Application -Guid '{A0C1853B-5C40-4B15-8766-3CF1C58F985A}'

THE ABOVE EXAMPLE, the guid refers to the Microsoft-Windows-PowerShell ETW provider. this command will end up deleting the following registry key:

HKLM\SYSTEM\CurrentControlSet\Control\WMI\Autologger\EventLog-Application\{A0C1853B-5C40-4B15-8766-3CF1C58F985A} 

 

3. Provider enable property modificaition:

HKLM\SYSTEM\CurrentControlSet\Control\WMI\Autologger\AUTOLOGGER_NAME{PROVIDER_GUID} - EnableProperty (REG_DWORD)

this technique involves altering the Enable keyword of an autologger session. for example, by default all ETW provider entries in the EventLog-Application autologger session are set to 0x41 which translates to

EVENT_ENABLE_PROPERTY_SID and  EVENT_ENABLE_PROPERTY_ENABLE_KEYWORD_0.

EVENT_ENABLE_PROPERTY_ENABLE_KEYWORD_0 is not documented. it specifies that any events generated for a provider should be logged even if the keyword value is set to 0. so what attacker can do is, EVENT_ENABLE_PROPERTY_IGNORE_KEYWORD_0 which resulting value 0x11 which further specifies all events where the vaule is 0 and ignore, those not to be logged. 

example:

Set-EtwTraceProvider -Guid '{A0C1853B-5C40-4B15-8766-3CF1C58F985A}' -AutologgerName EventLog-Application -Property 0x11

the guid is for Microsoft-Windows-PowerShell event logging.

the above example will end up setting:

HKLM\SYSTEM\CurrentControlSet\Control\WMI\Autologger\EventLog-Application\{A0C1853B-5C40-4B15-8766-3CF1C58F985A}\EnableProperty to 0x11

upon rebooting events will cease to be reported to the powershell event log. 

 

standard Logging level:

0 log always

1 log critical

2 error

3 warning

4 informational

5 verbose 

 

4. ETW provider removal from a trace session

tempering category: ephemeral

permission required: system

detection artifacts: unfortunately no file, registry, event logs are associated with this event. logman.exe will be issued to perform this attack. an attacker can obfuscate their techniques by using win32 api directly, wmi, dcom, powershell etc. 

the techniques involves removing an ETW provider from a trace session, cutting off its ability to supply events to log file or consumer until a reboot occurs or until the attacker restores the ETW provider. 

here is the following powershell code that attacker can apply:

logman update trace EventLog-Application --p Microsoft-PowerShell -ets

 

Splunk:

check event id 8 and 12 for detection.  

check image or process logman.exe or Image="*\\logman.exe" or Image="*\\wpr.exe"

CommandLine="*query*" or CommandLine="*update trace*"

TargetObject=”HKLM\\SYSTEM\\CurrentControlSet\\Control\\WMI\\Autologger*” 

https://securebug.se/blog/category/detection-rules/

https://gist.github.com/guitarrapc/35a94b908bad677a7310

 

 

 


 attacker can change the start value as 0 instead of 1. 

but a user with non-admin privileges can not even view the permission of this registry. 

permissions should be Administrators, EventLog and SYSTEM

 

 

Comments

Popular posts from this blog

Install Nessus from docker

Docker installation. Give the below commands one by one. apt install docker-cli apt install docker.io After the installation is complete, if you are inside wsl then give this command to start docker, because inside wsl systemd (systemctl) does not work: service docker start WSL troubleshooting : If the above command " service docker start " does not work then use below command: dockerd (It may not work if any previous docker process is running. It will show you pid of that process. Use this command to kill that process " kill -9 pid " and run dockerd command again) If " docker ps -a " giving error like " Cannot connect to the Docker daemon at unix:///run/podman/podman.sock. Is the docker daemon running? " This is because you may installed podman-docker package. If you remove the package still you will get this error but you should remove the package. Then issue this command: env | grep -i docker DOCKER_HOST=unix:///run/podman/podman.sock   -->...

Installtion of SQLMutant tool

This tool is perfectly works on ubuntu 24 system. And I found it is not working properly in kali linux 24 version.   https://github.com/blackhatethicalhacking/SQLMutant/tree/main This tool need to use along with sqlmap tool. Showing this cheat sheet for kali or debian based system.  This tool actually analyze everything and give you the vulnerable url where sql injection is possible. You just need to use then sqlmap to exploit that.   Prerequisite: apt install pipx -y (for ubuntu) pip3 install uro or pipx install uro pipx ensurepath pipx completions  (not needed)  source ~/.bashrc   or restart system If go tool is not installed then run the below two commands first ( golang-go ) or follow this link to install go (https://mahimfiroj.blogspot.com/2024/12/installing-nuclei-in-kali.html) otherwise skip this step.   dpkg -l | grep packagename (Using this command you can check package is installed or not) apt install gccgo-go -y or apt install gol...

net command cheat sheet

  To see what users present in the system: net user To see local groups in the system: net localgroup To see domain groups. This should be run on a domain controller: net group To see the details of a user along with his/her group membership: net user mahim To see who are the members of a particular group (local machine): net localgroup "administrators"    (These are not case sensitive. You can use administrators or Administrators. Both will give you same result. To see who are the members of a particular group (domain machine): net group "domain admins" Create a local user: net user localuser1 MyP@ssw0rd /add Create a domain user: net user domainuser1 MyP@ssw0rd /add /domain Add the local user to local admin group: net localgroup Administrators localuser1 /add Add the user to domain admin group: net group "Domain Admins" domainuser1 /add /domain Avi