Sysmon: Getting started

I’ve been using Sysmon for about 2 years now and it’s one of my favorite Sysinternal tools. My use-cases include and are not limited to the following:

  • Finding unknown & potential malicious processes running
  • Identifying the source process of outbound connections
  • Registry modifications (add/modify/delete)
  • Recording Command/Powershell commands ran in my endpoints

If you’re visiting this site, chances are that you’re already familiar with the vast logging of this tool; otherwise, if you need a more in depth introduction and what this tool can do, you may visit the Sysinternal site for more information.

Getting Started with Sysmon

Step 1: Setup Sysmon  (Note: This will apply to Sysmon 5.02 and version 6) 
Download Sysmon from here: https://technet.microsoft.com/en-us/sysinternals/sysmon

1. Extract to a local destination
2.Launch a command prompt with elevated privileges (right click-run as Administrator)
3.Run the following command: Sysmon.exe -I -h sha256 -n /accepteula
4.You should then see a message similar to the screenshot below, and eventually see the service Sysmon getting started.

5. Verify that sysmon is running by going to windows services. 

You may now launch your Event Viewer 
Navigate to > Application and Services Logs > Microsoft > Windows > Sysmon > Operational

You will see hundreds of logs being generated by your system which will include processes being created, modified, network connections, etc such as those shown in the following image:

Step 2: Keeping important logs & Discarding chatty ones

As you already saw, Sysmon will generate a tremendous amount of logs. If you decide to install and collect all of your domain endpoint sysmon logs, you will need to filter out the “Noise”; however, you also don’t want to filter out everything since you want to collect important forensic data that might be useful in a potential breach.

 

Here’s a simple configuration that I created that you may get started with.

I have commented the Event IDs so you may double-check what we’re doing.

Copy the following and paste it in notepad (or your preferred text editor) and save it as config.xml

Update September 2017: For Sysmon 6.1 you might need to change the schemaversion to version 3.40   <Sysmon schemaversion=”3.40″>

We will launch a command prompt with elevated privileges, and run the following:

sysmon -c c:\thepathtoyourconfig.xml
This command will allow Sysmon to run based on a specific configuration that we’re providing.

Again review your sysmon event logs and continue filtering “normal” process behaviors; however, do read my article called “Advanced Sysmon Filtering” which will explain why we shouldn’t just filter out processes such as svchost.exe, csrss.exe, conhost.exe, services.exe, etc which are often targeted by Malware.

If you don’t have tons of time, you can use SwiftOnSecurity’s xml configuration which may be accessed here . He/she has done extensive research on interesting artifacts to look for, which will get you started; however, it covers a finite amount of logging.

As you can see this tutorial pertains to 1 system only; however, if you are looking to deploy sysmon to hundreds or thousands of endpoints you will need to setup a way to capture these logs real-time.

I would suggest to read the following to setup a centralized log management solution:

  1. Setting Up Elasticsearch on Centos 7
  2. Set up Winlogbeats to send Windows Logs to Elasticsearch  Or if you have a domain environment you can setup a Windows Event Forwarder server and accomplish the same here
  3. Deploy Sysmon through Group Policy  (If you are planning on deploying sysmon to domain systems)

I will continue writing more Sysmon & Logstash articles to enhance our captured data.

Leave a Reply