GithubHelp home page GithubHelp logo

olafhartong / sysmon-modular Goto Github PK

View Code? Open in Web Editor NEW
2.5K 164.0 567.0 4.79 MB

A repository of sysmon configuration modules

License: MIT License

PowerShell 81.71% Python 18.29%
sysmon dfir threat-hunting mitre-attack modular security-tools

sysmon-modular's Introduction

sysmon-modular | A Sysmon configuration repository for everybody to customise

license Maintenance GitHub last commit Build Sysmon config with all modules Twitter Discord Shield

This is a Microsoft Sysinternals Sysmon download here configuration repository, set up modular for easier maintenance and generation of specific configs.

Please keep in mind that any of these configurations should be considered a starting point, tuning per environment is strongly recommended.

Note: to get even more value out of the FileExecutable event, consider getting the most up to date version of the LOLdrivers config merged into the config as well. You can easily do that by grabbing the file and adding it in the 29_file_execute_detected folder and generate a new config.

The sysmonconfig.xml within the repo is automatically generated after a successful merge by the PowerShell script and a successful load by Sysmon in an Azure Pipeline run. More info on how to generate a custom config, incorporating your own modules here

Pre-Grenerated configurations

Type Config Description
default sysmonconfig.xml This is the balanced configuration, most used, more information here
default+ sysmonconfig-with-filedelete.xml This is the balanced configuration, most used, more information including FileDelete file saves
verbose sysmonconfig-excludes-only.xml This is the very verbose configuration, all events are included, only the exclusion modules are applied. This should not be used in production without validation, will generate a significant amount of data and might impact performance. More information here
super verbose sysmonconfig-research.xml A configuration with extreme verbosity. The log volume expected from this file is significantly high, really DO NOT USE IN PRODUCTION! This config is only for research, this will use way more CPU/Memory. Only enable prior to running the to be investigated technique, when done load a lighter config.
MDE augment sysmonconfig-mde-augmentation.xml A configuration to augment Defender for Endpoint, intended to augment the information and have as little overlap as possible. This is based on the default/balanced config and will not generate all events for Sysmon, there are comments in the config. In the benefit of IR, consider using the excludes only config and only ingest the enriching events. (Blog with more rationale soon)

Index


Next to the documentation below, there is also a video on how to use this project.

how to use this project


NOTICE; Sysmon below 15 will not completely be compatible with this configuration

Older versions are still available in the branches, but are not as complete as the current branch

To understand added features in the versions, have a look at my small blog post and newer articles or watch my DerbyCon talk

Note: I do recommend using a minimal number of configurations within your environment for multiple obvious reasons, like; maintenance, output equality, manageability and so on. But do make tailored configurations for Domain Controllers, Servers and workstations.


Required actions

I highly recommend looking at the configs before implementing them in your production environment. This enables you to have as actionable logging as possible and as litte noise as possible.

Customization

You will need to install and observe the results of the configuration in your own environment before deploying it widely. For example, you will need to exclude actions of your antivirus, which will otherwise likely fill up your logs with useless information.

Generating a config

PowerShell

$> git clone https://github.com/olafhartong/sysmon-modular.git
$> cd sysmon modular
$> . .\Merge-SysmonXml.ps1
$> Merge-AllSysmonXml -Path ( Get-ChildItem '[0-9]*\*.xml') -AsString | Out-File sysmonconfig.xml

Generating custom configs

Below functions with great thanks to mbmy

New Function: Find-RulesInBasePath - takes a base path (i.e. C:\folder\sysmon-modular) and finds all candidate xml rule files based upon regex pattern

Example: PS C:\Users\sysmon\sysmon-modular> Find-RulesInBasePath -BasePath C:\users\sysmon\sysmon-modular\ -OutputRules | Out-File available_rules.txt

Merge-AllSysmonXml New Parameters:

-BasePath - finds all candidate xml rule files from a provided path based upon regex pattern and merges them

Example: PS C:\Users\sysmon\sysmon-modular> Merge-AllSysmonXml -AsString -BasePath C:\Users\sysmon\sysmon-modular\

-ExcludeList - Combined with -BasePath, takes a list of rules and excludes them from found rules prior to merge

Example: PS C:\Users\sysmon\sysmon-modular> Merge-AllSysmonXml -AsString -BasePath C:\Users\sysmon\sysmon-modular\ -ExcludeList C:\users\sysmon\sysmon-modular\exclude_rules.txt

-IncludeList - Combined with -BasePath, finds all available rules from base path but only merges those defined in a list

Example: PS C:\Users\sysmon\sysmon-modular> Merge-AllSysmonXml -AsString -BasePath C:\Users\sysmon\sysmon-modular\ -IncludeList C:\users\sysmon\sysmon-modular\include_rules.txt

NOTE The BasePath needs to be the full path to the sysmon-modular files (for example c:\tools\sysmon-modular), otherwise PowerShell will not be able to locate them, resulting in a default config.

Include/Exclude List Format Example:

3_network_connection_initiated\include_native_windows_tools.xml
12_13_14_registry_event\exclude_internet_explorer_settings.xml
12_13_14_registry_event\exclude_webroot.xml
17_18_pipe_event\include_winreg.xml
19_20_21_wmi_event\include_wmi_create.xml
2_file_create_time\exclude_chrome.xml
3_network_connection_initiated\include_native_windows_tools.xml
3_network_connection_initiated\include_ports_proxies.xml
8_create_remote_thread\include_general_commment.xml
8_create_remote_thread\include_psinject.xml
9_raw_access_read\include_general_commment.xml

Building a config with all sysmon-modular rules for certain event IDs (include whole directory) and then disabling all event ids without imported rules

Example:

# generate the config
$sysmonconfig =  Merge-AllSysmonXml  -BasePath . -IncludeList $workingFolder\include.txt -VerboseLogging -PreserveComments

# flip off any rule groups where rules were not imported
foreach($rg in $sysmonconfig.SelectNodes("/Sysmon/EventFiltering/RuleGroup [*/@onmatch]"))
{
    $ruleNodes = $rg.SelectNodes("./* [@onmatch]")

    if(     $ruleNodes -eq $null `
        -or $ruleNodes.ChildNodes.count -gt 0)
    {
        # no rule nodes found (unlikely) or more than one rule found
        continue
    }

    # RuleGroup with only one rule node
    $ruleNode = $ruleNodes[0]

    if($ruleNode.onmatch -eq "exclude" -and $ruleNode.ChildNodes.count -eq 0 )
    {
        $message = "{0} {1} has no matching conditions.  Toggled to 'include' to limit output" -f $ruleNode.Name,$rg.Name
        Write-Warning $message

        $ruleNode.onmatch = "include"
        $comment = $sysmonconfig.CreateComment($message)
        $rg.AppendChild($comment) | Out-Null
    }
}

Include/Exclude List Format Example (for entire rule/event families):

1_process_creation
5_process_ended
11_file_create
23_file_delete
7_image_load
17_18_pipe_event

Use

Install

Run with administrator rights

sysmon.exe -accepteula -i sysmonconfig.xml

Update existing configuration

Run with administrator rights

sysmon.exe -c sysmonconfig.xml

Python generator tool

This is a new feature, created by cnnrshd

Priority-based Rules Sorting

  1. Simple Python script that can merge based on a similar format to preexisting Include Lists - the only difference is it takes a CSV with two columns, filepath and priority
  2. A config formatted using a csv file
  3. A simple template
  4. Schemaversion is dynamic and based on the highest schema version of provided rules.

Configs generated using this script maintain comments and proper XML indentation is enforced, increasing readability and allowing easier cross-referencing of rule files

example prompt

python merge_sysmon_configs.py config_lists/default_list/default_list.csv -f csv -b templates/sysmon_template.xml  -o test.xml

** This way of generating content is still new and experimental. There is no support for the custom versions like the MDE augment and exclude-only versions yet.


Sysmon Community

There are three major Sysmon configurations:

Contributing

Pull requests / issue tickets and new additions will be greatly appreciated!

More information

I started a series of blog posts covering this repo;

MITRE ATTACK

I strive to map all configurations to the ATT&CK framework whenever Sysmon is able to detect it. Please note this is a possible log entry that might lead to a detection, not in all cases is this the only telemetry for that technique. Additionally there might be more techniques releated to that rule, the one mapped is the one I deemed most likely.

sysmon-modular's People

Contributors

aguyinahoodie avatar alwashali avatar benmontour avatar cnnrshd avatar conitrade-as avatar dstaulcu avatar elhoim avatar emiliedns avatar frack113 avatar glennbarrett avatar hkelley avatar iisresetme avatar ijlalhaider1996 avatar j91321 avatar jaybirnuw avatar joshua1909 avatar jvalente-salemstate avatar lslng avatar mattlparker avatar mbmy avatar mgreen27 avatar neo23x0 avatar olafhartong avatar redsand avatar skibum1869 avatar talljohnbrown avatar thefunch avatar torstenbeer avatar wojciechlesicki avatar zbalkan avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

sysmon-modular's Issues

typo in file name 'include_living_of_the_land.xml'

right now there are 2 files in process creation directory with names:

  • include_living_off_the_land.xml
  • include_living_of_the_land.xml

with almost identical content.
I think maybe one of these files is redundant and should be deleted. I also checked that contents of both files exist in sysmonconfig.xml then maybe this causes some inconsistencies in sysmon log generation

New exclusions for antimalwares - ProcessCreate

Hi,

Congrats for this great work!
just suggesting a few more exlclusions :)

TREND MICRO AV:
<Sysmon schemaversion="3.4">  <ProcessCreate onmatch="exclude"> <Image condition="is">C:\Program Files (x86)\Trend Micro\BM\TMBMSRV.exe</Image>       <Image condition="is">C:\Program Files (x86)\Trend Micro\OfficeScan Client\TmopExtIns32.exe</Image>       <Image condition="is">C:\Program Files (x86)\Trend Micro\OfficeScan Client\TmExtIns.exe</Image>       <Image condition="is">C:\Program Files (x86)\Trend Micro\OfficeScan Client\TmListen.exe</Image> </ProcessCreate>

SOPHOS AV:
<Sysmon schemaversion="3.4">  <ProcessCreate onmatch="exclude"> Image condition="is">C:\Program Files (x86)\Sophos\Sophos Anti-Virus\Web Intelligence\swi_service.exe</Image>       <Image condition="is">C:\Program Files (x86)\Sophos\Sophos Anti-Virus\Web Control\swc_service.exe</Image>       <Image condition="is">C:\Program Files (x86)\Sophos\Sophos System Protection\ssp.exe</Image>       <Image condition="is">C:\Program Files (x86)\Sophos\Remote Management System\RouterNT.exe</Image>       <Image condition="is">C:\Program Files (x86)\Sophos\AutoUpdate\ALsvc.exe</Image>       <Image condition="is">C:\Program Files (x86)\Sophos\Sophos Anti-Virus\SAVAdminService.exe</Image>       <Image condition="is">C:\Program Files (x86)\Sophos\Remote Management System\ManagementAgentNT.exe</Image> </ProcessCreate>

ESET NOD32 AV:
<Sysmon schemaversion="3.4">  <ProcessCreate onmatch="exclude"> <Image condition="is">C:\Program Files\ESET\ESET Nod32 Antivirus\ekrn.exe</Image>     </ProcessCreate>

MALWAREBYTES ANTIMALWARE:
<Sysmon schemaversion="3.4">     <ProcessCreate onmatch="exclude">     <Image condition="is">C:\Program Files\Malwarebytes\Anti-Malware\mbam.exe</Image>     <Image condition="is">C:\Program Files\Malwarebytes\Anti-Malware\mbamservice.exe</Image>     <Image condition="is">C:\Program Files\Malwarebytes\Anti-Malware\mbamtray.exe</Image>     </ProcessCreate>

KASPERSKY AV:
<Sysmon schemaversion="3.4">  <ProcessCreate onmatch="exclude"> <Image condition="begin with">C:\Program Files\Kaspersly Lab\</Image>     </ProcessCreate>

WINDOWS DEFENDER (Win 8+):
<Sysmon schemaversion="3.4">  <ProcessCreate onmatch="exclude"> <Image condition="contains">C:\ProgramData\Microsoft\Windows Defender\Platform\</Image>     </ProcessCreate>

NB: Kaspersky and Windows Defender leverage non-consistent paths (depending on antimalware/engine version), so that I believe the only solution is to use the "contains" operand, even if less efficient on the perfs side.

My 2 cents,

--
Phil

Error when running Merge-SysmonXMLConfiguration

When running Merge-SysmonXMLConfiguration, the following error is given.

`Merge-SysmonXMLConfiguration : The schema version of C:\Temp\sysmon-modular-master\sysmonconfig.xml () does not match that of the reference configuration:
C:\Temp\sysmon-modular-master\baseconfig.xml (4.10)
At line:1 char:78

  • ... yContinue | Merge-SysmonXMLConfiguration -ReferencePolicyPath .\basec ...
  •             ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    
    • CategoryInfo : NotSpecified: (:) [Write-Error], WriteErrorException
    • FullyQualifiedErrorId : Microsoft.PowerShell.Commands.WriteErrorException,Merge-SysmonXMLConfiguration`

No changes were made after downloading the repository. New sysmonconfig.xml is also 95 KB larger than the one that is downloaded in the respository.

Is the comparison in exclude_microsoft_drivers.xml secure enough?

Hey Olaf,

thanks a lot for your work. I was debugging some Sysmon stuff you've been reporting and I'm wondering whether rules such as

      <RuleGroup groupRelation="or">
        <DriverLoad onmatch="exclude">
          <Signature condition="begin with">Intel </Signature>
          <Signature condition="contains">microsoft</Signature>
          <Signature condition="contains">windows</Signature>
        </DriverLoad>
      </RuleGroup>

might be risky. I guess it would be possible, for example, to get a code signing certificate for a legit entity called something like "WindowSwift" - or "windowswift". Signing authorities might raise questions if I use words such as "Intel" (Intelspace in the rules) and certainly they would complain about "Microsoft", but "windowswift" seems unrelated enough to be granted.

What do you think?

Error whle running Generate-sysmon-config.ps1

Hi

While running the script after executing "Import-Module .\PSSysmonTools.psm1 ", its throwing error

The term 'Merge-SysmonXMLConfiguration' is not recognized as the name of a cmdl
et, function, script file, or operable program. Check the spelling of the name,
or if a path was included, verify that the path is correct and try again.
At H:\HELK\sysmon-modular\Generate-Sysmon-config.ps1:28 char:188

  • Get-ChildItem -Path . -Filter *.xml -Recurse -ErrorAction SilentlyContinue |
    Where {$_.Name -NotMatch "sysmonconfig(?:-\d{2}-\w{3}-\d{4}-\d{2}-\d{2})?.xml"}
    | Merge-SysmonXMLConfiguration <<<< -ReferencePolicyPath .\baseconfig.xml -Ex
    cludeMergeComments | Out-File sysmonconfig.xml -Encoding UTF8
    • CategoryInfo : ObjectNotFound: (Merge-SysmonXMLConfiguration:St
      ring) [], CommandNotFoundException
    • FullyQualifiedErrorId : CommandNotFoundException

Please suggest

Sysmon 9.0

Hi Olaf and thanks for the great work!
Will the sysmon-modular work also for sysmon 9.0?

Cheers,

momilor

Sysmon-modular to unify two XML configurations

Hi all,

I've been thinking about an idea of sysmon modular. But what I want to do , it's similar what you've done.

My idea, it's the following: I've got two sysmon XML configuration file, one of them it's a sysmon configuration "Base" (I mean, like a template with common events) and another configuration file with particular events. What I would like to do, it's to find a way to mergue the particular configuration file into the base configuration.

This idea could be done with the Mergue-SysmonXml.ps1? Or it could be modify to achieve this idea? In that case, what could I modify to try it?.

Best regards and thanks for your time and effort.

Modular File Management vs Single Config File Management

I was wondering the benefit of using Modular File Management vs Single Config File Management? Why do you consider it easier to use multiple files and then compile? Trying to figure out what the best case is for my use case. Thanks. #

Encoding on sysmonconfig.xml

Looks like the encoding on sysmonconfig.xml has changed to UCS-2 LE BOM, generated by Azure Pipeline. UCS-2 LE BOM is also the default if you execute Merge-SysmonXml.ps1 with powershell version 5.1. The file size is double of UTF-8. Not sure of the implication, but may be something worth look into?

Event ID 15: FileCreateStreamHash - Redundant entries

I was looking Event ID 15 in sysmonconfig.xml file. While I found that there are 3 exact similar entries of
"<TargetFilename condition="contains">Downloads</TargetFilename>".
Those redundant entries are needed in XML, if it is, what is it used for?

Feature Request: Automated removal of entries

Fantastic work on doing the mapping; love it!

We use a modified version of either yours or Swift's config and remove entries from certain areas to reflect what we want to see in our environment. With modular, it'd be super handy if we could have a file of things we want to remove that the script would reference when it's done putting things together that would then remove those entries.

That way, we could update from the git when there's a change and not have to manually go remove entries from the final product.

Thanks!

AppInit_DLLs Detection

The following rules don't detect activity unless we take the backslash at the end out since it is a registry value.

<TargetObject condition="begin with">HKLM\SOFTWARE\Wow6432Node\Microsoft\Windows NT\CurrentVersion\Windows\Appinit_Dlls\</TargetObject>
<TargetObject condition="begin with">HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Windows\Appinit_Dlls\</TargetObject>

AppInit_DLLs Detection Issue

The following rules don't detect activity unless we take the backslash at the end out since it is a registry value.

<TargetObject condition="begin with">HKLM\SOFTWARE\Wow6432Node\Microsoft\Windows NT\CurrentVersion\Windows\Appinit_Dlls\</TargetObject>
<TargetObject condition="begin with">HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Windows\Appinit_Dlls\</TargetObject>

Cannot merge config file

Hello there,

I´ve tried to look first on the closed issues and could not find anything that resolve the problem i´m getting:

1- Loaded the . .\Merge-SysmonXml.ps1
2 - Executed the command Merge-AllSysmonXml -Path ( Get-ChildItem '[0-9]**.xml') -AsString | Out-File sysmonconfig.xml

And then errors:

Method invocation failed because [System.IO.StringWriter] does not contain a method named 'new'.
At C:\temp\sysmon-modular\Merge-SysmonXml.ps1:60 char:17
+                 $sw = [System.IO.StringWriter]::new()
+                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidOperation: (:) [], RuntimeException
    + FullyQualifiedErrorId : MethodNotFound

You cannot call a method on a null-valued expression.
At C:\temp\sysmon-modular\Merge-SysmonXml.ps1:68 char:17
+                 $sw.Dispose()
+                 ~~~~~~~~~~~~~
    + CategoryInfo          : InvalidOperation: (:) [], RuntimeException
    + FullyQualifiedErrorId : InvokeMethodOnNull

Merge-SysmonXml : Cannot bind argument to parameter 'Source' because it is null.
At C:\temp\sysmon-modular\Merge-SysmonXml.ps1:55 char:47
+             $newDoc = Merge-SysmonXml -Source $newDoc -Diff $XmlDocs[$i]
+                                               ~~~~~~~
    + CategoryInfo          : InvalidData: (:) [Merge-SysmonXml], ParameterBindingValidationException
    + FullyQualifiedErrorId : ParameterArgumentValidationErrorNullNotAllowed,Merge-SysmonXml

Method invocation failed because [System.Xml.XmlDocument] does not contain a method named 'new'.
At C:\temp\sysmon-modular\Merge-SysmonXml.ps1:36 char:13
+             $doc = [xml]::new()
+             ~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidOperation: (:) [], RuntimeException
    + FullyQualifiedErrorId : MethodNotFound

Thanks for the attention

Rule name duplicate

Rule name in Line 152 and Line 156 are same, Line 156 should have CMSTP instead of mavinject.

New exclusions for Azure Sentinel - ProcessCreate and PipeEvent

Hi,

Congrats for this great work!
just suggesting a few more exlclusions, regarding the Microsoft Azure Sentinel SIEM's agent :)

PROCESS CREATION

<Sysmon schemaversion="4.22"> <EventFiltering> <RuleGroup name="" groupRelation="or"> <ProcessCreate onmatch="exclude"> <Rule groupRelation="and"> <ParentCommandLine condition="is">"C:\Program Files\Microsoft Monitoring Agent\Agent\MonitoringHost.exe" -Embedding</ParentCommandLine> <CommandLine condition="is">C:\Windows\system32\cscript.exe" /nologo "MonitorKnowledgeDiscovery.vbs</CommandLine> <!--Microsoft Sentinel SIEM agent, based on MOM--> </Rule> </ProcessCreate> </RuleGroup> </EventFiltering> </Sysmon>

PIPE CREATION:

<Sysmon schemaversion="4.22"> <EventFiltering> <RuleGroup name="" groupRelation="or"> <PipeEvent onmatch="exclude"> <Image condition="is">"C:\Program Files\Microsoft Monitoring Agent\Agent\MonitoringHost.exe"</Image> <!--Microsoft Sentinel SIEM agent, based on MOM--> </PipeEvent> </RuleGroup> </EventFiltering> </Sysmon>


My 2 cents,

--
Phil

Mitre ATT@CK

Hi,

Have you developed a script to automatically generate the Json file for the mitre attack navigator ??

Thanks

Bad technique id ("1053" instead of "T1053")

On this line, the technique id should be "T1053" instead of "1053":
<ImageLoaded name="technique_id=1053,technique_name=Scheduled Task" condition="end with">taskschd.dll</ImageLoaded>

Rule T1130/T1089 triggers at every GPO update

Hi,

I am new to sysmon and experimenting with configs from this repository.
Now I have installed a clean client with my baseline settings and I get a lot triggers for the rules T1130/T1089.
I came to the conclusion that this happens after every GPUpdate since my settings tell the client to process every object even if these have not changed.

Would there be a good way to filter this events. One possibility I see is to filter based on the Image which did the change. In this case it would be svchost.exe. Now I wonder if this would lead to missing out on critical detections.

Thx Bernhard

Credential Dumping - false positive?

I'm getting the following created in the event log.

`The description for Event ID 10 from source Microsoft-Windows-Sysmon cannot be found. Either the component that raises this event is not installed on your local computer or the installation is corrupted. You can install or repair the component on the local computer.

If the event originated on another computer, the display information had to be saved with the event.

The following information was included with the event:

technique_id=T1003,technique_name=Credential Dumping
2019-01-03 16:01:06.470
EV_RenderedValue_2.00
820
8872
C:\Windows\system32\svchost.exe
EV_RenderedValue_6.00
740
C:\Windows\system32\lsass.exe
5120
C:\Windows\SYSTEM32\ntdll.dll+a5fc4|C:\Windows\System32\KERNELBASE.dll+5d8e4|c:\windows\system32\lsm.dll+f6fb|C:\Windows\System32\RPCRT4.dll+784a3|C:\Windows\System32\RPCRT4.dll+dbc6d|C:\Windows\System32\RPCRT4.dll+a8dc|C:\Windows\System32\RPCRT4.dll+5a214|C:\Windows\System32\RPCRT4.dll+5912d|C:\Windows\System32\RPCRT4.dll+599db|C:\Windows\System32\RPCRT4.dll+39b5c|C:\Windows\System32\RPCRT4.dll+39fdc|C:\Windows\System32\RPCRT4.dll+542ec|C:\Windows\System32\RPCRT4.dll+55b4b|C:\Windows\System32\RPCRT4.dll+4864a|C:\Windows\SYSTEM32\ntdll.dll+2864e|C:\Windows\SYSTEM32\ntdll.dll+29fb9|C:\Windows\System32\KERNEL32.DLL+8364|C:\Windows\SYSTEM32\ntdll.dll+6e851
`

We've had sysmon 7 running on this machine for several months but I don't think it's had ProcessAccess logging enabled, so I've not seen this before.

condition="is" is removed after merge.

When Generate-Sysmon-config.ps1 is run and has a condition="is" the condition is stripped from the filter row. Please clarify if this is intended.

Before merge:

<Image condition="is">C:\Program Files\Common Files\Microsoft Shared\ClickToRun\OfficeC2RClient.exe</Image> <!-- Microsoft:Office Click2Run-->

After merge:
<Image>C:\Program Files\Common Files\Microsoft Shared\ClickToRun\OfficeC2RClient.exe</Image>

Merge-AllSysmonXml : Cannot bind argument to parameter 'Path' because it is null.

What may be the reason ?

COMPLETE ERROR MESSAGE
Merge-AllSysmonXml : Cannot bind argument to parameter 'Path' because it is null.
At line:1 char:26

  • Merge-AllSysmonXml -Path ( Get-ChildItem '[0-9]**.xml') -AsString | O ...
  •                      ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    
    • CategoryInfo : InvalidData: (:) [Merge-AllSysmonXml], ParameterBindingValidationException
    • FullyQualifiedErrorId : ParameterArgumentValidationErrorNullNotAllowed,Merge-AllSysmonXml

[Feature] Compare Sysmon to MITRE ATT&CK - Script 🤖

The goal of this feature is to provide a way for an analyst to easily check their Sysmon rules against the latest MITRE ATT&CK Framework.

Benefits:

  • Find valid and invalid Tactics and Techniques to fix in their Sysmon rule names
  • Identify all Sysmon rules that match the latest framework

Features of the script:

  • Check a single file for valid tactics, techniques or subtechniques
  • Check a modular folder for valid tactics, techniques or subtechniques
  • Use latest MITRE ATT&CK enterprise-attck.json from GitHub for comparison
  • Use local enterprise-attck.json file for comparison
  • Export valid rules for Attack Navigator (Sysmon-modular.json)
  • Ingest loaded MITRE ATT&CK into Elasticsearch cluster (Index - mitre_attck)
  • Display table view of MITRE-ATT&CK and rules found from Sysmon configs (with file paths they live in)
  • Display table view of Sysmon rules and if they are valid tactics, techniques or subtechniques

Basically, this will be the swiss army knife for all things MITRE ATT&CK and comparing them to the Sysmon rules the analysts wish to address.

This would also take care of #50

This script will work best with the full MITRE ATT&CK properties. Watch for incoming feature request / issue on this.

MergeAllSysmonXml

Hello,

please how to make the script work With the Merge-AllsysmonXml option because when I launch the script I don't get an error but the configuration file sysmonconfig.xml is empty.

my $PSVersionTable

Name Value


PSVersion 5.1.18362.628
PSEdition Desktop
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0...}
BuildVersion 10.0.18362.628
CLRVersion 4.0.30319.42000
WSManStackVersion 3.0
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1

thanks a lot

Error When Running Merge-SysmonCMLConfiguration

When running the Merge-SysmonCMLConfiguration from a fresh pull of PSSysmonTools and sysmon-modular it throws the error :

`Test-SysmonConfiguration : The 'onmatch' attribute is invalid - The value 'Exclude' is invalid according to its datatype 'urn:schemas-specterops.io:SysmonConfiguration:IncludeExcludeType' - The
Enumeration constraint failed.
At C:\Users\c11900\Documents\Engineering\sysmon\SysmonTools\PSSysmonTools\PSSysmonTools\Code\ConfigurationMerger.ps1:75 char:44

  • ... ionResult = Test-SysmonConfiguration -Path $ReferencePolicyFullPath - ...
  •             ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    
    • CategoryInfo : NotSpecified: (:) [Write-Error], WriteErrorException
    • FullyQualifiedErrorId : Microsoft.PowerShell.Commands.WriteErrorException,Test-SysmonConfiguration`

Not sure if it matters since I wasn't able to compile a config to run but this on Schema v 4.1 and sysmon v 8.0.0.

latest config erroring out

Error: Incorrect XML configuration: .\sysmonconfig.xml
Reason: Element 'ProcessTampering' is unexpected according to content model of parent element 'RuleGroup'.
Expecting: ProcessCreate, FileCreateTime, NetworkConnect, ProcessTerminate, DriverLoad, ImageLoad, CreateRemoteThread, RawAccessRead, ProcessAccess, FileCreate, RegistryEvent, FileCreateStreamHash, PipeEvent, WmiEvent, DnsQuery, FileDelete, ClipboardChange.

Config file not working as expected

Hi,

I have been testing the latest master branch with the latest sysmon, I have customised by removing some of the rules for tools i do not use, i have also added a new rule as below. From my testing though it seems part of the config is not applying, My rule is not applied and generates alot of events, if i dump the config with sysmon -c , picking some key executables from the config i cannot find them in the dump, where as if i use swiftonsecuritys z-alpha config i can find matching words.

Below is my 10_process_access config and an example of portion of the event firing still. Also event 12 seems to hit alot whereas z-alpha doesnt, comparing the configs i cannot see why it would be triggering unless the event hides the actual reg path. I have tried your default config and seem to have similar events triggering with the obvious inclusion of sfc.exe.

Any suggestions/tests?

sfc.exe

Process accessed:
RuleName:
UtcTime: 2019-10-30 07:47:08.072
SourceProcessGUID: {d1bab7ef-51e6-5dad-0000-001046290400}
SourceProcessId: 4336
SourceThreadId: 9040
SourceImage: C:\Program Files\Cisco\AMP\6.3.7\sfc.exe

Registry object added or deleted:
RuleName:
EventType: CreateKey
UtcTime: 2019-10-30 07:51:16.454
ProcessGuid: {d1bab7ef-51e5-5dad-0000-001017940300}
ProcessId: 2408
Image: C:\WINDOWS\system32\svchost.exe
TargetObject: HKCR

Thanks

Generating a config file

I am using windows 10 pro-OS. while generating a config file using below command(using PowerShell) I am not getting any error but after completing the process, sysmonconfig.xml is able to generate with an empty file

$>. .\Merge-SysmonXml.ps1
$> Merge-AllSysmonXml -Path ( Get-ChildItem '[0-9]*\*.xml') -AsString | Out-File sysmonconfig.xml

schema issue with Sysmon 11.10

Hi Olafhartong,
I am trying implement your scripts and am getting the below errors?
I am using sysmon 11.10
System Monitor v11.10 - System activity monitor
Copyright (C) 2014-2020 Mark Russinovich and Thomas Garnier
Sysinternals - www.sysinternals.com

Loading configuration file with schema version 4.30
Sysmon schema version: 4.32
Error: Incorrect XML configuration: sysmonconfig.xml
Reason: Element 'TargetFilename' is unexpected according to content model of parent element 'ProcessAccess'.
Expecting: Rule, RuleName, UtcTime, SourceProcessGUID, SourceProcessId, SourceThreadId, SourceImage, TargetProcessGUID, TargetProcessId, TargetImage, GrantedAccess, CallTrace.

do you know of a fix for this?

thanks in advance

[Feature] Enrich rule names with Tactics and Sub-techniques ⚗️

The goal of this feature is to include tactic name, tactic id, sub-technique name and sub-technique id to every single rule.

Benefits:

  • Allow for checking Sysmon rules against the latest MITRE ATT&CK for valid and invalid Tactics, Techniques, and Sub-techniques
  • Allow for full MITRE ATT&CK Mappings to Sysmon Events into a SIEM (For alerting and dashboarding)
  • Allow for scripting to automatically export an attack navigator file

So the rule:
<OriginalFileName name="technique_id=T1033,technique_name=System Owner/User Discovery" condition="is">whoami.exe</OriginalFileName>

Would become:
<OriginalFileName name="tactic_id=TA0007,tactic_name=Discovery,technique_id=T1033,technique_name=System Owner/User Discovery" condition="is">whoami.exe</OriginalFileName>

The example of a sub-technique would then be:
<OriginalFileName name="technique_id=T1518.001,technique_name=Security Software Discovery" condition="is">netsh.exe</OriginalFileName>

Which would become:
<OriginalFileName name="tactic_id=TA0007,tactic_name=Discovery,technique_id=T1518,technique_name=Software Discovery,subtechnique_id=T1518.001,subtechnique_name=Security Software Discovery" condition="is">netsh.exe</OriginalFileName>

This format works well with all of the current rules. This pairs well with: #79

Any questions or issues with this feature? 🤔

My bad or an issue? registry_event exclude ending up in wrong place

Hi,

Right or wrong, I tried to create a "12_13_14_registry_event" exclude file which should exclude everything not included using the include files. The file was named "exclude_everything.xml" (all other exclude files removed) and the content is:

<Sysmon schemaversion="4.30">
  <EventFiltering>
    <RuleGroup name="" groupRelation="or">
      <RegistryEvent onmatch="exclude">
        <TargetObject condition="begin with">HKLM</TargetObject>
        <TargetObject condition="begin with">HKU</TargetObject>
        <TargetObject condition="begin with">HKCR</TargetObject>
      </RegistryEvent>
    </RuleGroup>
  </EventFiltering>
</Sysmon>

When creating the sysmonconfig.xml file, the rows above will end up at the end of XML file (below Event ID 25), see below:

<RuleGroup groupRelation="or">
    <RegistryEvent onmatch="exclude">
      <TargetObject condition="begin with">HKLM</TargetObject>
      <TargetObject condition="begin with">HKU</TargetObject>
      <TargetObject condition="begin with">HKCR</TargetObject>
    </RegistryEvent>
  </RuleGroup>
  <RuleGroup groupRelation="or">
    <PipeEvent onmatch="include">
      <PipeName name="technique_id=T1021.002,technique_name=SMB/Windows Admin Shares" condition="begin with">\atsvc</PipeName>
      <PipeName name="technique_id=T1021.002,technique_name=SMB/Windows Admin Shares" condition="begin with">\msagent_</PipeName>
      <PipeName name="technique_id=T1021.002,technique_name=SMB/Windows Admin Shares" condition="begin with">\msf-pipe</PipeName>
      <PipeName name="technique_id=T1021.002,technique_name=SMB/Windows Admin Shares" condition="begin with">\PSEXESVC</PipeName>
      <PipeName name="technique_id=T1049,technique_name=System Network Connections Discovery" condition="begin with">\srvsvc</PipeName>
      <PipeName name="technique_id=T1033,technique_name=System Owner/User Discovery" condition="begin with">\winreg</PipeName>
    </PipeEvent>
  </RuleGroup>
  <RuleGroup groupRelation="or">
    <FileDelete onmatch="exclude">
      <Image condition="contains all">\appdata\local\google\chrome\user data\swreporter\;software_reporter_tool.exe</Image>
      <Image condition="is">C:\Program Files (x86)\Google\Chrome\Application\chrome.exe</Image>
      <User condition="contains any">NETWORK SERVICE; LOCAL SERVICE</User>
    </FileDelete>
  </RuleGroup>
</EventFiltering>
</Sysmon>

Anything I'm doing wrong or is there a bug?
Download from Git on April 21th.

BR
Daniel

i can't generate new configuration

Test-SysmonConfiguration : Schema version 4.2 is not supported.
Au caractère C:\PSSysmonTools\PSSysmonTools\Code\ConfigurationMerger.ps1:128 : 33

  • ... ionResult = Test-SysmonConfiguration -Path $PolicyFullPath -ErrorActi ...
  •             ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    
    • CategoryInfo : NotSpecified: (:) [Write-Error], WriteErrorException
    • FullyQualifiedErrorId : Microsoft.PowerShell.Commands.WriteErrorException,Test-SysmonConfiguration

New exclusions for antimalwares - NetworkConnect

Hi again,

same thing, for network trafic belonging to antimalwares solutions: connection to management server, cloud based services, etc. Quite noisy.

TRENDMICRO AV:
<NetworkConnect onmatch="exclude"> <Image condition="is">C:\Program files (x86)\Trend Micro\OfficeScan Client\tmlisten.exe</Image>       <Image condition="is">C:\Program Files (x86)\Trend Micro\BM\TMBMSRV.exe</Image>  </NetworkConnect>

SOPHOS ANTIVIRUS:
 <NetworkConnect onmatch="exclude"> <Image condition="is">C:\Program Files (x86)\Sophos\Sophos Anti-Virus\Web Intelligence\swi_service.exe</Image>       <Image condition="is">C:\Program Files (x86)\Sophos\AutoUpdate\ALsvc.exe</Image>       <Image condition="is">C:\Program Files (x86)\Sophos\Remote Management System\RouterNT.exe</Image>       <Image condition="is">C:\Program Files (x86)\Sophos\Sophos Anti-Virus\Web Control\swc_service.exe</Image>       <Image condition="is">C:\Program Files (x86)\Sophos\Sophos Anti-Virus\Web Intelligence\swi_service.exe</Image>       <Image condition="is">C:\Program Files\Sophos\Sophos Network Threat Protection\bin\SntpService.exe</Image>  </NetworkConnect>

ESET NOD32 AV:
 <NetworkConnect onmatch="exclude"> <Image condition="is">C:\Program Files\ESET\ESET Nod32 Antivirus\ekrn.exe</Image>  </NetworkConnect>

HTH.

--
Phil

How to Map kill chain phases ?

It's not related to this thing but I wanted to know is there a way to Map Kill Chain phases ? or is it already done somehow. ??

Please Guide.

incorrect SecurityProviders registry path

In file 12_13_14_registry_event/include_windows_credential_providers.xml

<TargetObject name="technique_id=T1003,technique_name=Credential Dumping" condition="begin with">HKLM\SYSTEM\CurrentControlSet\Control\SecurityProviders\SecurityProviders</TargetObject>

Shoud be:
<TargetObject name="technique_id=T1003,technique_name=Credential Dumping" condition="begin with">HKLM\SYSTEM\CurrentControlSet\Control\SecurityProviders\</TargetObject>

Same error was reported to SwiftOnSecurity but not fixed
https://github.com/SwiftOnSecurity/sysmon-config/issues?q=securityproviders

The '1_process_creation/include_living_of_the_land.xml' rule item has a duplicate

I don't have the Merge-AllSysmonXml in my directory.

When I try to paste the command Merge-AllSysmonXml -Path ( Get-ChildItem '[0-9]**.xml') -AsString | Out-File sysmonconfig.xml in Powershell in give me the following error.

Merge-AllSysmonXml : The term 'Merge-AllSysmonXml' is not recognized as the name of a cmdlet, function,
script file, or operable program. Check the spelling of the name, or if a path was included, verify that
the path is correct and try again.
At line:1 char:1

  • Merge-AllSysmonXml -Path ( Get-ChildItem '[0-9]**.xml') -AsString | ...
  •   + CategoryInfo          : ObjectNotFound: (Merge-AllSysmonXml:String) [], CommandNotFoundException
      + FullyQualifiedErrorId : CommandNotFoundException
    
    
    

And Secondly: I don't have Merge-AllSysmonXml in my directory

BSOD on windows 10 machines.

We've had something unusual crop up. From the report I've received.

Users using a flash drive will cut and paste a file off of their drive and get the attached error. .sys"

I've tried excluding the specific file that was causing the error, error continues. I've also completely removed .sys" from event ID 11, and the issue is still present.

I've reverted back to an old config file from before I implemented modular sysmon, the issue no longer was preset. I am doing more testing on my end to pin this down.

If you find something let me know, if I beat you to it I'll let you know.

The BSOD seems to stem from fastfat.sys, but only happens when using modular sysmon config.

Where do I change HashAlgorithms?

I see there are several files where HashAlgorithms is defined and they're all capturing all hashes. If I just want to capture IMPHASH, where should I change it that will work with the merge? I tried changing it in Merge-SysmonXml.ps1 but that didn't work. Thank you in advance.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.