homepage
Open menu
Go one level top
  • Train and Certify
    • Overview
    • Get Started in Cyber
    • Courses
    • GIAC Certifications
    • Training Roadmap
    • OnDemand
    • Live Training
    • Summits
    • Cyber Ranges
    • College Degrees & Certificates
    • Scholarship Academies
    • NICE Framework
    • Specials
  • Manage Your Team
    • Overview
    • Group Purchasing
    • Why Work with SANS
    • Build Your Team
    • Hire Cyber Talent
    • Team Development
    • Private Training
    • Security Awareness Training
    • Leadership Training
    • Industries
  • Resources
    • Overview
    • Internet Storm Center
    • White Papers
    • Webcasts
    • Tools
    • Newsletters
    • Blog
    • Podcasts
    • Posters & Cheat Sheets
    • Summit Presentations
    • Security Policy Project
  • Focus Areas
    • Cyber Defense
    • Cloud Security
    • Digital Forensics & Incident Response
    • Industrial Control Systems
    • Cyber Security Leadership
    • Offensive Operations
  • Get Involved
    • Overview
    • Join the Community
    • Work Study
    • Teach for SANS
    • CISO Network
    • Partnerships
    • Sponsorship Opportunities
  • About
    • About SANS
    • Our Founder
    • Instructors
    • Mission
    • Diversity
    • Awards
    • Contact
    • Frequently Asked Questions
    • Customer Reviews
    • Press
  • SANS Sites
    • GIAC Security Certifications
    • Internet Storm Center
    • SANS Technology Institute
    • Security Awareness Training
  • Search
  • Log In
  • Join
    • Account Dashboard
    • Log Out
  1. Home >
  2. Blog >
  3. Parsing Sysmon Events for IR Indicators
Matt Churchill

Parsing Sysmon Events for IR Indicators

February 25, 2015

Intro and Installation

A dedicated endpoint monitoring tool is quickly becoming a necessity among organizations to increase visibility, logging, and alerting to combat targeted attacks and commodity malware. Sysmon is a free endpoint monitoring tool by Microsoft Sysinternals and was recently updated to version 2.0. Sysmon is a great tool for home use, as another way to track malware in a sandbox, and for anyone interested in discovering the value of endpoint monitoring.

Sysmon monitors a computer system for several action: process creation with command line and hash, process termination, network connections, changes in file creation timestamps, and driver/image loading. Sysmon logs this information in a standard Windows event log format that can also be sent to a SIEM if used in an enterprise. While Sysmon does provide some monitoring capabilities, it can be easily shut down by attackers and provides no automated alerting. Sysmon is available at http://technet.microsoft.com/en-us/sysinternals/dn798348.

While logging is nice, it provides no value if the log is not reviewed. The purpose of this post is to provide an easy and automated way to present the Sysmon event log for review and a batch script using the tools and techniques described in this post will be available for download. If Sysmon is not already installed, download from Microsoft Sysinternals and install using a command line such as:

sysmon –i –accepteula –h md5 –n -l

This installs Sysmon as a service that will survive reboots, collect network connection information, record MD5 hashes for all created processes, and record loading of modules.

The Log File

Once Sysmon is installed, it records everything to a standard Windows event log. On a Windows 7 system and above, this file is located here:

C:\Windows\System32\winevt\Logs\Microsoft-Windows-Sysmon%4Operational.evtx

This log file is in a standard event log format and thus not easily read. A sample log entry can be seen on the Sysinternal’s Sysmon page. Microsoft Event Viewer can open the log, but each entry must be individually reviewed; proper analysis requires something a little more automated. To see examples of using Event Viewer and further Sysmon information in general, see Carlos Perez’s post. To copy the log file for further parsing, use a command like this:

robocopy C:\Windows\system32\winevt\Logs\ C:\Users\User\Desktop\sysmon Microsoft-Windows-Sysmon%4Operational.evtx

This command will simply copy out the log file and place it on the user’s desktop in a folder named sysmon.

Parsing

To turn the XML event log into an easier to digest file, we can use Microsoft Logparser. Logparser will parse the event log into a CSV file using this command:

logparser -i:evt -o:csv “Select RecordNumber,TO_UTCTIME(TimeGenerated),EventID,SourceName,ComputerName,SID,Strings from %src% WHERE EventID in (‘1′;’2′;’3′;’4’;’5’;’6’;’7’)” > sysmon\sysmon_parsed.txt

Now we have a plain text file we can easily open in Excel or use for further automated parsing. If reviewing in Excel, open as a delimited file with both “,” and “|” chosen as delimiters.

To pull further information out of the file, we can turn to TekDefense’s TekCollect python script. This script will help us gather all IP Address, MD5 hashes, domain names, and executable names. TekCollect requires Python 2.7 and we can launch the script using a command like:

python tekcollect.py -f sysmon\sysmon_parsed.txt -t MD5 > sysmon\Hashes.txt

This command will automatically search the parsed Sysmon log for any MD5 hashes it can find. The resulting Hashes.txt will contain a de-duplicated list of all the MD5 hashes found. The –t switch also allows us to designate the information we want to pull from the file. We can repeat the command using “ip4”, “exe”, and “domain” to finish collecting the desired information and create additional easy to read text files for review.

Analysis

Now we have nice and neat text files parsed from the Sysmon event log, suitable for analysis. A manual review of the text files created could lead to a discovery or previously unknown indicators.

However, since manual review can sometimes be time consuming, there are a few automated tricks we can employ to make our job easier.

Keyword Search

Included with the script that accompanies this blog post is a file called “sysmon_keywords.tx”. This file contains 15 example keywords that might warrant further follow-up. The keywords include searches for terms like “whoami”, “tasklist”, and “quser” as well as file extensions like “.bat”, “.cmd”, and “.rar”. Any results for these terms will placed in a separate file named Keywords.csv.

The “sysmon_keywords.txt” file is easily editable and can contain IP Addresses, domain names, file names, or any other Regex search term you might want to monitor for quick and easy wins when reviewing the activity taking place on the system. This type of automated search could help narrow down the hunting process Jack Crook describes in his recent blog post.

Hash Analysis

The first file to examine is the list of MD5 hashes. While a list of hashes on its own does not mean much, we can use an automated VirusTotal lookup to determine if any of the hashes warrant a closer look. I prefer to use WoanWare’s virustotalchecker, however, it does require Net 4.5 and a VirusTotal API key. Another option is to use Didier Stevens’ virustotal-search.py script, but an API key is still needed.

The great thing about this tool is the use of caching. If you use caching and have searched the same hash in the past 30 days, you get the cached result, which can greatly speed up analysis. This is an excellent option if you end up completing this Sysmon analysis process once a week. After the initial run, the tool will only need to search new hashes it hasn’t checked recently.

Using this command will automate the VirusTotal lookups and give us two files to review:

virustotalchecker.exe -m c -f sysmon\Hashes.txt –o .

This produces two CSV files, one file contains matches and one file contains hashes without matches. Searching the file with matches will tell us if there were any hashes on VirusTotal with a high confidence of positive anti-virus detects. If a hash is deemed suspicious, copy the hash and search the sysmon_parsed.txt file to see which process and command line are responsible for the entry. Keep in mind that not all suspicious hashes will have matches on VirusTotal.

IP Address Analysis

The second file to check is the one containing IP addresses. A nice way of checking these in bulk is using the GUI program IPNetInfo from NirSoft. The program allows the user to paste a list of IP addresses as input and will automatically filter out any non-public IP Addresses. For scripting you can automatically launch the program with the list as input using a command like:

ipnetinfo.exe /ipfile sysmon\IPs.txt

This command will still launch the GUI to allow for bulk review of the WhoIs results. With a huge list of IP Addresses to check, it might be beneficial to use the option “Pause for 30 Seconds after Retrieving 50 IP Addresses”. This will limit the program from making too many requests and getting your IP Address temporarily blacklisted from making additional queries. There is also an option to retry failed queries.

A second option in automatically searching IP Addresses is to use Team Cymru’s server for bulk lookups. This process involves using a NetCat connection to send the list of IP Addresses for automatic processing. The process is very quick and the command to use looks like:

ncat.exe whois.cymru.com 43 < sysmon\IPs.txt > sysmon\Whois_Results.txt

After the IP Addresses have been resolved and the WhoIs information has been collected, it is easy to view and sort the results. After completing this process once or twice and collecting a nice baseline of results, it should be easy to pick out information that seems out of place. For instance, it is easy to sort by Country to see if any unexpected connections have been made. If an IP Address warrants further follow-up, search the sysmon_parsed.txt file to see which process is making the connection.

Conclusion

Sysmon is great for providing some simple monitoring information on the host system and the recent version allows for the use of configuration and filter files. The process outlined above gives us automated parsing for the endpoint monitoring that Sysmon completes. The data presented by the parsing is easy to review and should help when looking for indicators of attacker activity.

To make this process even easier, the commands listed above are compiled into an easy to use batch script. The script will automatically collect and parse the Sysmon Event Log when run on the system to investigate or you can optionally designate an already collected log file. The script will then follow the process outlined by parsing the event log, running TekCollect to grab specific indicators, searching for keywords, launching a VirusTotal hash comparison, and completing a bulk WhoIs search.

The batch script can be downloaded at https://github.com/CrowdStrike/Forensics. This post originally appeared on the CrowdStrike blog.

Matt Churchill is a Senior Consultant for CrowdStrike specializing in incident response forensics. Matt was previously a cyber-crime investigator for a local law enforcement agency and also conducted forensic examinations for the FBI. He holds the SANS Certifications GCFA, GCFE, and GREM and can be reached at @matt_churchill.

6.2.5

Share:
TwitterLinkedInFacebook
Copy url Url was copied to clipboard
Subscribe to SANS Newsletters
Receive curated news, vulnerabilities, & security awareness tips
United States
Canada
United Kingdom
Spain
Belgium
Denmark
Norway
Netherlands
Australia
India
Japan
Singapore
Afghanistan
Aland Islands
Albania
Algeria
American Samoa
Andorra
Angola
Anguilla
Antarctica
Antigua and Barbuda
Argentina
Armenia
Aruba
Austria
Azerbaijan
Bahamas
Bahrain
Bangladesh
Barbados
Belarus
Belize
Benin
Bermuda
Bhutan
Bolivia
Bonaire, Sint Eustatius, and Saba
Bosnia And Herzegovina
Botswana
Bouvet Island
Brazil
British Indian Ocean Territory
Brunei Darussalam
Bulgaria
Burkina Faso
Burundi
Cambodia
Cameroon
Cape Verde
Cayman Islands
Central African Republic
Chad
Chile
China
Christmas Island
Cocos (Keeling) Islands
Colombia
Comoros
Cook Islands
Costa Rica
Croatia (Local Name: Hrvatska)
Curacao
Cyprus
Czech Republic
Democratic Republic of the Congo
Djibouti
Dominica
Dominican Republic
East Timor
East Timor
Ecuador
Egypt
El Salvador
Equatorial Guinea
Eritrea
Estonia
Ethiopia
Falkland Islands (Malvinas)
Faroe Islands
Fiji
Finland
France
French Guiana
French Polynesia
French Southern Territories
Gabon
Gambia
Georgia
Germany
Ghana
Gibraltar
Greece
Greenland
Grenada
Guadeloupe
Guam
Guatemala
Guernsey
Guinea
Guinea-Bissau
Guyana
Haiti
Heard And McDonald Islands
Honduras
Hong Kong
Hungary
Iceland
Indonesia
Iraq
Ireland
Isle of Man
Israel
Italy
Jamaica
Jersey
Jordan
Kazakhstan
Kenya
Kingdom of Saudi Arabia
Kiribati
Korea, Republic Of
Kosovo
Kuwait
Kyrgyzstan
Lao People's Democratic Republic
Latvia
Lebanon
Lesotho
Liberia
Liechtenstein
Lithuania
Luxembourg
Macau
Macedonia
Madagascar
Malawi
Malaysia
Maldives
Mali
Malta
Marshall Islands
Martinique
Mauritania
Mauritius
Mayotte
Mexico
Micronesia, Federated States Of
Moldova, Republic Of
Monaco
Mongolia
Montenegro
Montserrat
Morocco
Mozambique
Myanmar
Namibia
Nauru
Nepal
Netherlands Antilles
New Caledonia
New Zealand
Nicaragua
Niger
Nigeria
Niue
Norfolk Island
Northern Mariana Islands
Oman
Pakistan
Palau
Palestine
Panama
Papua New Guinea
Paraguay
Peru
Philippines
Pitcairn
Poland
Portugal
Puerto Rico
Qatar
Reunion
Romania
Russian Federation
Rwanda
Saint Bartholemy
Saint Kitts And Nevis
Saint Lucia
Saint Martin
Saint Vincent And The Grenadines
Samoa
San Marino
Sao Tome And Principe
Senegal
Serbia
Seychelles
Sierra Leone
Sint Maarten
Slovakia (Slovak Republic)
Slovenia
Solomon Islands
South Africa
South Georgia and the South Sandwich Islands
South Sudan
Sri Lanka
St. Helena
St. Pierre And Miquelon
Suriname
Svalbard And Jan Mayen Islands
Swaziland
Sweden
Switzerland
Taiwan
Tajikistan
Tanzania
Thailand
Togo
Tokelau
Tonga
Trinidad And Tobago
Tunisia
Turkey
Turkmenistan
Turks And Caicos Islands
Tuvalu
Uganda
Ukraine
United Arab Emirates
United States Minor Outlying Islands
Uruguay
Uzbekistan
Vanuatu
Vatican City
Venezuela
Vietnam
Virgin Islands (British)
Virgin Islands (U.S.)
Wallis And Futuna Islands
Western Sahara
Yemen
Yugoslavia
Zambia
Zimbabwe

Tags:
  • Digital Forensics and Incident Response

Related Content

Blog
SANS_DFIR_Justify_Your_Training.png
Digital Forensics and Incident Response
January 20, 2022
SANS DFIR courses - Justify your training
Use these justification letter templates to share the key details of this training and certification opportunities with your boss.
Viv_Ross_370x370.png
Viviana Ross
read more
Blog
Untitled_design-43.png
Digital Forensics and Incident Response, Cybersecurity and IT Essentials, Industrial Control Systems Security, Purple Team, Open-Source Intelligence (OSINT), Penetration Testing and Ethical Hacking, Cyber Defense, Cloud Security, Security Management, Legal, and Audit
December 8, 2021
Good News: SANS Virtual Summits Will Remain FREE for the Community in 2022
They’re virtual. They’re global. They’re free.
Emily Blades
read more
Blog
Digital Forensics and Incident Response
June 4, 2010
WMIC for incident response
Earlier this week, I posted about using psexec during incident response. I mentioned at the end of that post that I've been using WMIC in place of psexec and that I'd have more on that later. This post, is a follow up to the psexec post. WMIC Prompted by the excellent work of Ed Skoudis and his...
370x370_Mike-Pilkington.jpg
Mike Pilkington
read more
  • Register to Learn
  • Courses
  • Certifications
  • Degree Programs
  • Cyber Ranges
  • Job Tools
  • Security Policy Project
  • Posters & Cheat Sheets
  • White Papers
  • Focus Areas
  • Cyber Defense
  • Cloud Security
  • Cyber Security Leadership
  • Digital Forensics
  • Industrial Control Systems
  • Offensive Operations
Subscribe to SANS Newsletters
Receive curated news, vulnerabilities, & security awareness tips
United States
Canada
United Kingdom
Spain
Belgium
Denmark
Norway
Netherlands
Australia
India
Japan
Singapore
Afghanistan
Aland Islands
Albania
Algeria
American Samoa
Andorra
Angola
Anguilla
Antarctica
Antigua and Barbuda
Argentina
Armenia
Aruba
Austria
Azerbaijan
Bahamas
Bahrain
Bangladesh
Barbados
Belarus
Belize
Benin
Bermuda
Bhutan
Bolivia
Bonaire, Sint Eustatius, and Saba
Bosnia And Herzegovina
Botswana
Bouvet Island
Brazil
British Indian Ocean Territory
Brunei Darussalam
Bulgaria
Burkina Faso
Burundi
Cambodia
Cameroon
Cape Verde
Cayman Islands
Central African Republic
Chad
Chile
China
Christmas Island
Cocos (Keeling) Islands
Colombia
Comoros
Cook Islands
Costa Rica
Croatia (Local Name: Hrvatska)
Curacao
Cyprus
Czech Republic
Democratic Republic of the Congo
Djibouti
Dominica
Dominican Republic
East Timor
East Timor
Ecuador
Egypt
El Salvador
Equatorial Guinea
Eritrea
Estonia
Ethiopia
Falkland Islands (Malvinas)
Faroe Islands
Fiji
Finland
France
French Guiana
French Polynesia
French Southern Territories
Gabon
Gambia
Georgia
Germany
Ghana
Gibraltar
Greece
Greenland
Grenada
Guadeloupe
Guam
Guatemala
Guernsey
Guinea
Guinea-Bissau
Guyana
Haiti
Heard And McDonald Islands
Honduras
Hong Kong
Hungary
Iceland
Indonesia
Iraq
Ireland
Isle of Man
Israel
Italy
Jamaica
Jersey
Jordan
Kazakhstan
Kenya
Kingdom of Saudi Arabia
Kiribati
Korea, Republic Of
Kosovo
Kuwait
Kyrgyzstan
Lao People's Democratic Republic
Latvia
Lebanon
Lesotho
Liberia
Liechtenstein
Lithuania
Luxembourg
Macau
Macedonia
Madagascar
Malawi
Malaysia
Maldives
Mali
Malta
Marshall Islands
Martinique
Mauritania
Mauritius
Mayotte
Mexico
Micronesia, Federated States Of
Moldova, Republic Of
Monaco
Mongolia
Montenegro
Montserrat
Morocco
Mozambique
Myanmar
Namibia
Nauru
Nepal
Netherlands Antilles
New Caledonia
New Zealand
Nicaragua
Niger
Nigeria
Niue
Norfolk Island
Northern Mariana Islands
Oman
Pakistan
Palau
Palestine
Panama
Papua New Guinea
Paraguay
Peru
Philippines
Pitcairn
Poland
Portugal
Puerto Rico
Qatar
Reunion
Romania
Russian Federation
Rwanda
Saint Bartholemy
Saint Kitts And Nevis
Saint Lucia
Saint Martin
Saint Vincent And The Grenadines
Samoa
San Marino
Sao Tome And Principe
Senegal
Serbia
Seychelles
Sierra Leone
Sint Maarten
Slovakia (Slovak Republic)
Slovenia
Solomon Islands
South Africa
South Georgia and the South Sandwich Islands
South Sudan
Sri Lanka
St. Helena
St. Pierre And Miquelon
Suriname
Svalbard And Jan Mayen Islands
Swaziland
Sweden
Switzerland
Taiwan
Tajikistan
Tanzania
Thailand
Togo
Tokelau
Tonga
Trinidad And Tobago
Tunisia
Turkey
Turkmenistan
Turks And Caicos Islands
Tuvalu
Uganda
Ukraine
United Arab Emirates
United States Minor Outlying Islands
Uruguay
Uzbekistan
Vanuatu
Vatican City
Venezuela
Vietnam
Virgin Islands (British)
Virgin Islands (U.S.)
Wallis And Futuna Islands
Western Sahara
Yemen
Yugoslavia
Zambia
Zimbabwe
  • © 2022 SANS™ Institute
  • Privacy Policy
  • Contact
  • Careers
  • Twitter
  • Facebook
  • Youtube
  • LinkedIn