Hello Fidel,Here are some decoders for your log. For this type of log that contains variables that can change in order or that may not always be present, it's a good idea to use sibling decoders. Note that each decoder searches for a field, for example, "Device name:", regardless of its order of appearance.
I've included the fields you mentioned in your message: date, time, devname, Device Name, Process Path, Severity and Rules List. You can easily add more fields by creating analogous decoders.You can add these decoders to /var/ossec/etc/decoders/local_decoder.xml
or create a separate decoder file for them.Note that to create and test your decoders, you should remove the following header: 2023 Aug 23 00:00:11 WZHA094HP01->10.94.94.11
as this is added by Wazuh but is not part of the original message. <decoder name="FortiEDR">
<prematch>FortiEDR</prematch>
</decoder>
<decoder name="FortiEDR">
<parent>FortiEDR</parent>
<regex>date=(\.*)\s\w+=|date=(\.*)$</regex>
<order>date</order>
</decoder>
<decoder name="FortiEDR">
<parent>FortiEDR</parent>
<regex>time=(\.*)\s\w+=|time=(\.*)$</regex>
<order>time</order>
</decoder>
<decoder name="FortiEDR">
<parent>FortiEDR</parent>
<regex>devname=(\.*)\s\w+=|devname=(\.*)$</regex>
<order>devname</order>
</decoder>
<decoder name="FortiEDR">
<parent>FortiEDR</parent>
<regex>Device Name:(\.*);|Device Name:(\.*)$</regex>
<order>Device_Name</order>
</decoder>
<decoder name="FortiEDR">
<parent>FortiEDR</parent>
<regex>Process Path:(\.*);|Process Path:(\.*)$</regex>
<order>Process_Path</order>
</decoder>
<decoder name="FortiEDR">
<parent>FortiEDR</parent>
<regex>Severity:(\.*);|Severity:(\.*)$</regex>
<order>Severity</order>
</decoder>
<decoder name="FortiEDR">
<parent>FortiEDR</parent>
<regex>Rules List:(\.*);|Rules List:(\.*)$</regex>
<order>Rules_List</order>
</decoder>
Once you edited your decoders, you can test them using /var/ossec/bin/wazuh-logtest
:
# /var/ossec/bin/wazuh-logtest
Starting wazuh-logtest v4.5.1
Type one log per line
date=2023-08-22 time=23:00:06 timestamp=1692741606 devname="SYSLOG-FortiEDR" devid="SYSLOG-23F6C9DF" vd="root" itime=1692741606 devname="SYSLOG-FortiEDR" device_id="SYSLOG-23F6C9DF" type="generic" pri="notice" msg="1 2023-08-22T22:00:05.000Z organization.console.ensilo.com FortiEDR - - - Message Type: Security Event;Organization: OrganizationName;Organization ID: 1;Event ID: 4105996;Raw Data ID: 1723875024;Device Name: WEBA162HP09;Device State: Running;Operating System: Windows Server 2019 Standard;Process Name: powershell.exe;Process Path: \\Device\\HarddiskVolume4\\Windows\\System32\\WindowsPowerShell\\v1.0\\powershell.exe;Process Type: 64bit;Severity: High;Classification: Inconclusive;Destination: Sensitive Information Access;First Seen: 22-Aug-2023, 20:02:06;Last Seen: 23-Aug-2023, 00:00:05;Action: Blocked (Simulation);Count: 128;Certificate: yes;Rules List: Suspicious Application - Connection Attempt from a Suspicious Application;Users: ;MAC Address: 00-15-5D-CA-29-4B;Script: powershellScript.ps1\';Script Path: {try {& \'C:\\Jenkins\\workspace\\WEBA162HP09 (Granja Web Nodo 1)\\ReinicioServicio.Task-WEBA162HP09@tmp\\durable-8bc7dc06\\powershellScript.ps1\';Autonomous System: N/A;Country: N/A;Process Hash: 6CBCE4A295C163791B60FC23D285E6D84F28EE4C;Source IP: 192.168.162.215;Threat Name: Unknown;Threat Family: Unknown;Threat Type: Unknown;Remediation Processes: N/A;Remediation Files: N/A;MITRE techniques: T1059 - Command and Scripting Interpreter, TA0005 - Defense Evasion, T1059.006 - Command and Scripting Interpreter: Python, T1218.009 - Signed Binary Proxy Execution: Regsvcs/Regasm, T1047 - Windows Management Instrumentation, T1170 - Signed Binary Proxy Execution: Mshta, T1218.010 - Signed Binary Proxy Execution: Regsvr32, T1059.001 - Command and Scripting Interpreter: PowerShell, T1218.003 - Signed Binary Proxy Execution: CMSTP, T1218"
**Phase 1: Completed pre-decoding.
full event: 'date=2023-08-22 time=23:00:06 timestamp=1692741606 devname="SYSLOG-FortiEDR" devid="SYSLOG-23F6C9DF" vd="root" itime=1692741606 devname="SYSLOG-FortiEDR" device_id="SYSLOG-23F6C9DF" type="generic" pri="notice" msg="1 2023-08-22T22:00:05.000Z organization.console.ensilo.com FortiEDR - - - Message Type: Security Event;Organization: OrganizationName;Organization ID: 1;Event ID: 4105996;Raw Data ID: 1723875024;Device Name: WEBA162HP09;Device State: Running;Operating System: Windows Server 2019 Standard;Process Name: powershell.exe;Process Path: \\Device\\HarddiskVolume4\\Windows\\System32\\WindowsPowerShell\\v1.0\\powershell.exe;Process Type: 64bit;Severity: High;Classification: Inconclusive;Destination: Sensitive Information Access;First Seen: 22-Aug-2023, 20:02:06;Last Seen: 23-Aug-2023, 00:00:05;Action: Blocked (Simulation);Count: 128;Certificate: yes;Rules List: Suspicious Application - Connection Attempt from a Suspicious Application;Users: ;MAC Address: 00-15-5D-CA-29-4B;Script: powershellScript.ps1\';Script Path: {try {& \'C:\\Jenkins\\workspace\\WEBA162HP09 (Granja Web Nodo 1)\\ReinicioServicio.Task-WEBA162HP09@tmp\\durable-8bc7dc06\\powershellScript.ps1\';Autonomous System: N/A;Country: N/A;Process Hash: 6CBCE4A295C163791B60FC23D285E6D84F28EE4C;Source IP: 192.168.162.215;Threat Name: Unknown;Threat Family: Unknown;Threat Type: Unknown;Remediation Processes: N/A;Remediation Files: N/A;MITRE techniques: T1059 - Command and Scripting Interpreter, TA0005 - Defense Evasion, T1059.006 - Command and Scripting Interpreter: Python, T1218.009 - Signed Binary Proxy Execution: Regsvcs/Regasm, T1047 - Windows Management Instrumentation, T1170 - Signed Binary Proxy Execution: Mshta, T1218.010 - Signed Binary Proxy Execution: Regsvr32, T1059.001 - Command and Scripting Interpreter: PowerShell, T1218.003 - Signed Binary Proxy Execution: CMSTP, T1218"'
**Phase 2: Completed decoding.
name: 'FortiEDR'
Device_Name: ' WEBA162HP09'
Process_Path: ' \\Device\\HarddiskVolume4\\Windows\\System32\\WindowsPowerShell\\v1.0\\powershell.exe'
Rules_List: ' Suspicious Application - Connection Attempt from a Suspicious Application'
Severity: ' High'
date: '2023-08-22'
devname: '"SYSLOG-FortiEDR"'
time: '23:00:06'
After testing your rules and decoders with wazuh-logtest
, remember to restart your manager to apply these changes to future alerts.
Let us know if you have any questions.
Best regards,
Sandra.