Hello Lucio,
I think you are not using the proper log for your testing in
ossec-logtest. Even if the level of the rule is 0,
ossec-logtest should return you the triggered rule. In addition, your
logtest shows that "
No decoder matched" and that should not be the case.
Let's use these logs in order to find out if your custom rules work correctly:
2016 Sep 27 10:48:30 WinEvtLog: Security: AUDIT_SUCCESS(5137): Microsoft-Windows-Security-Auditing: AAAABCC: KKKKK: 01.KKKKK.com: An account was successfully logged on.
2016 Sep 27 10:48:30 WinEvtLog: Security: AUDIT_SUCCESS(5241): Microsoft-Windows-Security-Auditing: AAAABCC: KKKKK: 01.KKKKK.com: An account was successfully logged on.Also, we are going to change your rule to make debugging easier:
<rule id="110011" level="12">
<if_sid>18104</if_sid>
<id>^5137$|^5139$|^5141$</id>
<description>Windows Audit Success testing</description>
</rule>If we do not use your custom rule and use
Log1,
logtest return:
**Phase 1: Completed pre-decoding.
full event: '2016 Sep 27 10:48:30 WinEvtLog: Security: AUDIT_SUCCESS(5137): Microsoft-Windows-Security-Auditing: AAAABCC: KKKKK: 01.KKKKK.com: An account was successfully logged on.'
timestamp: '2016 Sep 27 10:48:30'
hostname: 'centos1'
program_name: 'WinEvtLog'
log: 'Security: AUDIT_SUCCESS(5137): Microsoft-Windows-Security-Auditing: AAAABCC: KKKKK: 01.KKKKK.com: An account was successfully logged on.'
**Phase 2: Completed decoding.
decoder: 'windows'
type: 'Security'
status: 'AUDIT_SUCCESS'
id: '5137'
extra_data: 'Microsoft-Windows-Security-Auditing'
dstuser: 'AAAABCC'
system_name: '01.KKKKK.com'
**Phase 3: Completed filtering (rules).
Rule id: '18104'
Level: '0'
Description: 'Windows audit success event.'We can see that default Wazuh rule for Windows audit success event (
18104) is triggered. Showing that even level 0 rules are displayed.
Although, when we add the custom rule we get the following:
**Phase 1: Completed pre-decoding.
full event: '2016 Sep 27 10:48:30 WinEvtLog: Security: AUDIT_SUCCESS(5137): Microsoft-Windows-Security-Auditing: AAAABCC: KKKKK: 01.KKKKK.com: An account was successfully logged on.'
timestamp: '2016 Sep 27 10:48:30'
hostname: 'centos1'
program_name: 'WinEvtLog'
log: 'Security: AUDIT_SUCCESS(5137): Microsoft-Windows-Security-Auditing: AAAABCC: KKKKK: 01.KKKKK.com: An account was successfully logged on.'
**Phase 2: Completed decoding.
decoder: 'windows'
type: 'Security'
status: 'AUDIT_SUCCESS'
id: '5137'
extra_data: 'Microsoft-Windows-Security-Auditing'
dstuser: 'AAAABCC'
system_name: '01.KKKKK.com'
**Phase 3: Completed filtering (rules).
Rule id: '110011'
Level: '12'
Description: 'Windows Audit Success testing'
**Alert to be generated.**Phase 1: Completed pre-decoding.
full event: '2016 Sep 27 10:48:30 WinEvtLog: Security: AUDIT_SUCCESS(5241): Microsoft-Windows-Security-Auditing: AAAABCC: KKKKK: 01.KKKKK.com: An account was successfully logged on.'
timestamp: '2016 Sep 27 10:48:30'
hostname: 'centos1'
program_name: 'WinEvtLog'
log: 'Security: AUDIT_SUCCESS(5241): Microsoft-Windows-Security-Auditing: AAAABCC: KKKKK: 01.KKKKK.com: An account was successfully logged on.'
**Phase 2: Completed decoding.
decoder: 'windows'
type: 'Security'
status: 'AUDIT_SUCCESS'
id: '5241'
extra_data: 'Microsoft-Windows-Security-Auditing'
dstuser: 'AAAABCC'
system_name: '01.KKKKK.com'
**Phase 3: Completed filtering (rules).
Rule id: '18104'
Level: '0'
Description: 'Windows audit success event.'You can see that the custom rule is trigger when id is one of the specified in your
<id> tag and that the level is properly set (
Level: '12'). Although, for other ids Wazuh default rule (
18104) is triggered, with level set to 0.