Hello Khaled,
There are a couple of changes to be made:
field should not carry the data, it would be only win.eventdata.image.If this is changed in the rule it would be:
<group name="sysmon_eid11_detections,">
<rule id="101116" level="6">
<if_sid>92204</if_sid>
<if_group>sysmon_eid11_detections</if_group>
<field name="win.eventdata.image">^C:\\\\Windows\\\\system32\\\\cleanmgr.exe</field>
<description>Executable file dropped in folder commonly used by malware.</description>
<mitre>
<id>T1105</id>
</mitre>
</rule>
</group>
You can see see the output:
{"win":{"system":{"providerName":"Microsoft-Windows-Sysmon","providerGuid":"{5770385f-c22a-43e0-bf4c-06f5698ffbd9}","eventID":"11","version":"2","level":"4","task":"11","opcode":"0","keywords":"0x8000000000000000","systemTime":"2022-12-22T08:22:01.8738755Z","eventRecordID":"1514725","processID":"5820","threadID":"8372","channel":"Microsoft-Windows-Sysmon/Operational","computer":"Khaled-Helal","severityValue":"INFORMATION","message":"\"File created:\r\nRuleName: DLL\r\nUtcTime: 2022-12-22 08:22:01.873\r\nProcessGuid: {6c5c177c-13a7-63a4-480f-000000008f00}\r\nProcessId: 11056\r\nImage: C:\\Windows\\system32\\cleanmgr.exe\r\nTargetFilename: C:\\Users\\KHALED~1.HEL\\AppData\\Local\\Temp\\73802D92-8DF7-458B-886C-10202D62EF0C\\WimProvider.dll\r\nCreationUtcTime: 2022-12-22 08:22:01.872\r\nUser: STP\\khaled.helal\""},"eventdata":{"ruleName":"DLL","utcTime":"2022-12-22 08:22:01.873","processGuid":"{6c5c177c-13a7-63a4-480f-000000008f00}","processId":"11056","image":"C:\\\\Windows\\\\system32\\\\cleanmgr.exe","targetFilename":"C:\\\\Users\\\\KHALED~1.HEL\\\\AppData\\\\Local\\\\Temp\\\\73802D92-8DF7-458B-886C-10202D62EF0C\\\\WimProvider.dll","creationUtcTime":"2022-12-22 08:22:01.872","user":"STP\\\\khaled.helal"}}}
**Phase 1: Completed pre-decoding.
full event: '{"win":{"system":{"providerName":"Microsoft-Windows-Sysmon","providerGuid":"{5770385f-c22a-43e0-bf4c-06f5698ffbd9}","eventID":"11","version":"2","level":"4","task":"11","opcode":"0","keywords":"0x8000000000000000","systemTime":"2022-12-22T08:22:01.8738755Z","eventRecordID":"1514725","processID":"5820","threadID":"8372","channel":"Microsoft-Windows-Sysmon/Operational","computer":"Khaled-Helal","severityValue":"INFORMATION","message":"\"File created:\r\nRuleName: DLL\r\nUtcTime: 2022-12-22 08:22:01.873\r\nProcessGuid: {6c5c177c-13a7-63a4-480f-000000008f00}\r\nProcessId: 11056\r\nImage: C:\\Windows\\system32\\cleanmgr.exe\r\nTargetFilename: C:\\Users\\KHALED~1.HEL\\AppData\\Local\\Temp\\73802D92-8DF7-458B-886C-10202D62EF0C\\WimProvider.dll\r\nCreationUtcTime: 2022-12-22 08:22:01.872\r\nUser: STP\\khaled.helal\""},"eventdata":{"ruleName":"DLL","utcTime":"2022-12-22 08:22:01.873","processGuid":"{6c5c177c-13a7-63a4-480f-000000008f00}","processId":"11056","image":"C:\\\\Windows\\\\system32\\\\cleanmgr.exe","targetFilename":"C:\\\\Users\\\\KHALED~1.HEL\\\\AppData\\\\Local\\\\Temp\\\\73802D92-8DF7-458B-886C-10202D62EF0C\\\\WimProvider.dll","creationUtcTime":"2022-12-22 08:22:01.872","user":"STP\\\\khaled.helal"}}}'
**Phase 2: Completed decoding.
name: 'json'
win.eventdata.creationUtcTime: '2022-12-22 08:22:01.872'
win.eventdata.image: 'C:\\Windows\\system32\\cleanmgr.exe'
win.eventdata.processGuid: '{6c5c177c-13a7-63a4-480f-000000008f00}'
win.eventdata.processId: '11056'
win.eventdata.ruleName: 'DLL'
win.eventdata.targetFilename: 'C:\\Users\\KHALED~1.HEL\\AppData\\Local\\Temp\\73802D92-8DF7-458B-886C-10202D62EF0C\\WimProvider.dll'
win.eventdata.user: 'STP\\khaled.helal'
win.eventdata.utcTime: '2022-12-22 08:22:01.873'
win.system.channel: 'Microsoft-Windows-Sysmon/Operational'
win.system.computer: 'Khaled-Helal'
win.system.eventID: '11'
win.system.eventRecordID: '1514725'
win.system.keywords: '0x8000000000000000'
win.system.level: '4'
win.system.message: '"File created:
RuleName: DLL
UtcTime: 2022-12-22 08:22:01.873
ProcessGuid: {6c5c177c-13a7-63a4-480f-000000008f00}
ProcessId: 11056
Image: C:\Windows\system32\cleanmgr.exe
TargetFilename: C:\Users\KHALED~1.HEL\AppData\Local\Temp\73802D92-8DF7-458B-886C-10202D62EF0C\WimProvider.dll
CreationUtcTime: 2022-12-22 08:22:01.872
User: STP\khaled.helal"'
win.system.opcode: '0'
win.system.processID: '5820'
win.system.providerGuid: '{5770385f-c22a-43e0-bf4c-06f5698ffbd9}'
win.system.providerName: 'Microsoft-Windows-Sysmon'
win.system.severityValue: 'INFORMATION'
win.system.systemTime: '2022-12-22T08:22:01.8738755Z'
win.system.task: '11'
win.system.threadID: '8372'
win.system.version: '2'
**Phase 3: Completed filtering (rules).
id: '101116'
level: '6'
description: 'Executable file dropped in folder commonly used by malware.'
groups: '['sysmon_eid11_detections']'
firedtimes: '1'
mail: 'False'
mitre.id: '['T1105']'
mitre.tactic: '['Command and Control']'
mitre.technique: '['Ingress Tool Transfer']'
**Alert to be generated.
Regards,
Juan Cabrera
Hi,
The rule must be written in the file /var/ossec/etc/rules/local_rules.xml. After this, restart the manager to apply the changes.
The logtest tool is used to test logs and check which rule is matched.
Regards !
Juan Cabrera