Hello Jose,
I am sorry for that delay responding to your last message but I was taking my time doing some troubleshoots in order to feed you with some valuable information.
Before you have posted your last message, I decided to detect which wazuh module is causing the problem, so I disabled all and started by activating one by one and finally I realized that the responsible module is 'syscollector' because the crash occured after activating it and specifically at the moment when the syscollector scan started (not after the initial scan which occurs after restarting the agent). Here is the log from the agent (I forgot to activate the debug level):
1) After activating the syscollector module and restarting the agent:
2022/05/04 10:44:34 wazuh-agent: INFO: Received exit signal.
2022/05/04 10:44:34 wazuh-agent: INFO: Set pending exit signal.
2022/05/04 10:44:34 wazuh-modulesd:syscollector: INFO: Stop received for Syscollector.
2022/05/04 10:44:34 wazuh-agent: INFO: Exiting...
2022/05/04 10:44:34 wazuh-agent: INFO: Using notify time: 10 and max time to reconnect: 60
2022/05/04 10:44:34 wazuh-agent: INFO: (1410): Reading authentication keys file.
2022/05/04 10:44:34 wazuh-agent: INFO: (1350): Active response disabled.
2022/05/04 10:44:34 wazuh-agent: INFO: Using AES as encryption method.
2022/05/04 10:44:34 wazuh-agent: INFO: Trying to connect to server (x.x.x.x:1514/tcp).
2022/05/04 10:44:34 wazuh-agent: INFO: (6001): File integrity monitoring disabled.
2022/05/04 10:44:34 wazuh-agent: WARNING: The check_winaudit option is deprecated in favor of the SCA module.
2022/05/04 10:44:34 rootcheck: INFO: Started (pid: 11708).
2022/05/04 10:44:34 wazuh-agent: INFO: (4102): Connected to the server (x.x.x.x:1514/tcp).
2022/05/04 10:44:34 wazuh-modulesd:agent-upgrade: INFO: (8153): Module Agent Upgrade started.
2022/05/04 10:44:34 wazuh-agent: INFO: Windows version is 6.0 or newer. (Microsoft Windows Server 2008 R2 Enterprise Edition (full) Service Pack 1 [Ver: 6.1.7601] - Wazuh v4.2.5).
2022/05/04 10:44:34 wazuh-agent: INFO: (1951): Analyzing event log: 'Application'.
2022/05/04 10:44:34 wazuh-modulesd:osquery: INFO: Module disabled. Exiting...
2022/05/04 10:44:34 wazuh-modulesd:ciscat: INFO: Module disabled. Exiting...
2022/05/04 10:44:34 sca: INFO: Module started.
2022/05/04 10:44:34 wazuh-agent: INFO: (1951): Analyzing event log: 'Security'.
2022/05/04 10:44:34 sca: INFO: Loaded policy 'C:\Program Files (x86)\ossec-agent\ruleset\sca\sca_win_audit.yml'
2022/05/04 10:44:34 wazuh-agent: INFO: (1951): Analyzing event log: 'System'.
2022/05/04 10:44:34 sca: INFO: Starting Security Configuration Assessment scan.
2022/05/04 10:44:34 wazuh-agent: INFO: (1950): Analyzing file: 'active-response\active-responses.log'.
2022/05/04 10:44:34 sca: INFO: Starting evaluation of policy: 'C:\Program Files (x86)\ossec-agent\ruleset\sca\sca_win_audit.yml'
2022/05/04 10:44:34 wazuh-agent: INFO: Started (pid: 11708).
2022/05/04 10:44:34 wazuh-modulesd:syscollector: INFO: Module started.
2022/05/04 10:44:34 wazuh-modulesd:syscollector: INFO: Starting evaluation.
2022/05/04 10:44:38 sca: INFO: Evaluation finished for policy 'C:\Program Files (x86)\ossec-agent\ruleset\sca\sca_win_audit.yml'
2022/05/04 10:44:38 sca: INFO: Security Configuration Assessment scan finished. Duration: 4 seconds.
2022/05/04 10:44:41 wazuh-modulesd:syscollector: INFO: Evaluation finished.
2022/05/04 10:44:41 rootcheck: INFO: Starting rootcheck scan.
2022/05/04 10:44:46 rootcheck: INFO: Ending rootcheck scan.
2022/05/04 11:44:42 wazuh-modulesd:syscollector: INFO: Starting evaluation.
2022/05/04 11:45:00 wazuh-modulesd:syscollector: INFO: Evaluation finished.
2022/05/04 12:45:02 wazuh-modulesd:syscollector: INFO: Starting evaluation.
2022/05/04 12:45:20 wazuh-modulesd:syscollector: INFO: Evaluation finished.
2022/05/04 13:45:22 wazuh-modulesd:syscollector: INFO: Starting evaluation.
2022/05/04 13:45:42 wazuh-modulesd:syscollector: INFO: Evaluation finished.
2022/05/04 14:45:43 wazuh-modulesd:syscollector: INFO: Starting evaluation.
2022/05/04 14:46:02 wazuh-modulesd:syscollector: INFO: Evaluation finished.
2022/05/04 15:17:32 wazuh-agent: ERROR: Could not get message for (Application)
2) Until now the syscollector scan is running frequently and there's no crash, so I activated the active response module on the agent (As I said I have initially disabled all the modules) and again restarted the agent:
2022/05/04 15:31:17 wazuh-agent: INFO: Received exit signal.
2022/05/04 15:31:17 wazuh-agent: INFO: Set pending exit signal.
2022/05/04 15:31:17 wazuh-modulesd:syscollector: INFO: Stop received for Syscollector.
2022/05/04 15:31:17 wazuh-modulesd:syscollector: INFO: Module finished.
2022/05/04 15:31:17 wazuh-agent: INFO: Exiting...
2022/05/04 15:31:17 wazuh-agent: INFO: Using notify time: 10 and max time to reconnect: 60
2022/05/04 15:31:18 wazuh-agent: INFO: (1410): Reading authentication keys file.
2022/05/04 15:31:18 wazuh-agent: INFO: Started (pid: 10216).
2022/05/04 15:31:18 wazuh-agent: INFO: Using AES as encryption method.
2022/05/04 15:31:18 wazuh-agent: INFO: Trying to connect to server (x.x.x.x:1514/tcp).
2022/05/04 15:31:18 wazuh-agent: INFO: (6001): File integrity monitoring disabled.
2022/05/04 15:31:18 wazuh-agent: WARNING: The check_winaudit option is deprecated in favor of the SCA module.
2022/05/04 15:31:18 rootcheck: INFO: Started (pid: 10216).
2022/05/04 15:31:18 wazuh-agent: INFO: (4102): Connected to the server (x.x.x.x:1514/tcp).
2022/05/04 15:31:18 wazuh-modulesd:agent-upgrade: INFO: (8153): Module Agent Upgrade started.
2022/05/04 15:31:18 wazuh-agent: INFO: Windows version is 6.0 or newer. (Microsoft Windows Server 2008 R2 Enterprise Edition (full) Service Pack 1 [Ver: 6.1.7601] - Wazuh v4.2.5).
2022/05/04 15:31:18 wazuh-agent: INFO: (1951): Analyzing event log: 'Application'.
2022/05/04 15:31:18 sca: INFO: Module started.
2022/05/04 15:31:18 wazuh-modulesd:ciscat: INFO: Module disabled. Exiting...
2022/05/04 15:31:18 wazuh-modulesd:osquery: INFO: Module disabled. Exiting...
2022/05/04 15:31:18 wazuh-agent: INFO: (1951): Analyzing event log: 'Security'.
2022/05/04 15:31:18 sca: INFO: Loaded policy 'C:\Program Files (x86)\ossec-agent\ruleset\sca\sca_win_audit.yml'
2022/05/04 15:31:18 wazuh-agent: INFO: (1951): Analyzing event log: 'System'.
2022/05/04 15:31:18 sca: INFO: Starting Security Configuration Assessment scan.
2022/05/04 15:31:18 wazuh-agent: INFO: (1950): Analyzing file: 'active-response\active-responses.log'.
2022/05/04 15:31:18 wazuh-modulesd:syscollector: INFO: Module started.
2022/05/04 15:31:18 wazuh-modulesd:syscollector: INFO: Starting evaluation.
2022/05/04 15:31:18 sca: INFO: Starting evaluation of policy: 'C:\Program Files (x86)\ossec-agent\ruleset\sca\sca_win_audit.yml'
2022/05/04 15:31:18 wazuh-agent: INFO: Started (pid: 10216).
2022/05/04 15:31:19 rootcheck: INFO: Starting rootcheck scan.
2022/05/04 15:31:21 sca: INFO: Evaluation finished for policy 'C:\Program Files (x86)\ossec-agent\ruleset\sca\sca_win_audit.yml'
2022/05/04 15:31:21 sca: INFO: Security Configuration Assessment scan finished. Duration: 3 seconds.
2022/05/04 15:31:24 rootcheck: INFO: Ending rootcheck scan.
2022/05/04 15:31:35 wazuh-modulesd:syscollector: INFO: Evaluation finished.
2022/05/04 16:31:37 wazuh-modulesd:syscollector: INFO: Starting evaluation.
At that moment, the application error event has occured and the alerts appeared on wazuh as mentionned in the joined screenshot.
Note: the timestamp in the log file (2022/05/04 16:31:xx) corresponds to the timestamp on the wazuh manager (2022/05/04 15:46:xx).
Additionally, I have run the procdump process on the wazuh-agent.exe program (procdump -t wazuh) which creates a .dmp file when the application crashes and then I opened it using WinDbg debugging tool (I am not familiar with it) and I obtained this output:
FAULTING_IP:
msvcrt!strlen+c
757843df 8a01 mov al,byte ptr [ecx]
EXCEPTION_RECORD: ffffffff -- (.exr 0xffffffffffffffff)
ExceptionAddress: 757843df (msvcrt!strlen+0x0000000c)
ExceptionCode: c0000005 (Access violation)
ExceptionFlags: 00000000
NumberParameters: 2
Parameter[0]: 00000000
Parameter[1]: 04eb1043
Attempt to read from address 04eb1043
DEFAULT_BUCKET_ID: INVALID_POINTER_READ
PROCESS_NAME: wazuh-agent.exe
ERROR_CODE: (NTSTATUS) 0xc0000005 - L
EXCEPTION_CODE: (NTSTATUS) 0xc0000005 - L
EXCEPTION_PARAMETER1: 00000000
EXCEPTION_PARAMETER2: 04eb1043
READ_ADDRESS: 04eb1043
FOLLOWUP_IP:
msvcrt!strlen+c
757843df 8a01 mov al,byte ptr [ecx]
MOD_LIST: <ANALYSIS/>
NTGLOBALFLAG: 0
APPLICATION_VERIFIER_FLAGS: 0
FAULTING_THREAD: 000027f8
PRIMARY_PROBLEM_CLASS: INVALID_POINTER_READ
BUGCHECK_STR: APPLICATION_FAULT_INVALID_POINTER_READ
LAST_CONTROL_TRANSFER: from 61a90014 to 757843df
STACK_TEXT:
030cf8e8 61a90014 04eb1043 00000000 04eb0048 msvcrt!strlen+0xc
WARNING: Stack unwind information not available. Following frames may be wrong.
030cf9e8 61a9679b 0249f1f4 67e27b60 030cfb08 sysinfo!ZNK7SysInfo15getSerialNumberB5cxx11Ev+0x624
030cfa78 67d1040c 0249f1f4 67e27b60 030cfb98 sysinfo!ZN7SysInfo8hardwareB5cxx11Ev+0x5b
030cfb08 67d12e8b 67e27b60 025b5f50 030cfb78 syscollector!ZN12Syscollector15getHardwareDataB5cxx11Ev+0x5c
030cfb98 67d14d6e 0139f568 025b5f50 030cfc08 syscollector!ZN12Syscollector12scanHardwareEv+0x16b
030cfc38 67d15382 00000000 67e27bb4 030cfca8 syscollector!ZN12Syscollector4scanEv+0x1de
030cfc8c 67d1550a 030cfc40 67e27b60 004c411c syscollector!ZN12Syscollector8syncLoopERSt11unique_lockISt5mutexE+0x122
030cfcc8 67d15aa2 030cfd60 030cff08 030cfed8 syscollector!ZN12Syscollector8syncLoopERSt11unique_lockISt5mutexE+0x2aa
00000000 00000000 00000000 00000000 00000000 syscollector!ZN12Syscollector4initERKSt10shared_ptrI8ISysInfoESt8functionIFvRKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEEESF_S5_IFv24syscollector_log_level_tSD_EESD_SD_SD_jbbbbbbbbbb+0x562
SYMBOL_STACK_INDEX: 0
SYMBOL_NAME: msvcrt!strlen+c
FOLLOWUP_NAME: MachineOwner
MODULE_NAME: msvcrt
IMAGE_NAME: msvcrt.dll
DEBUG_FLR_IMAGE_TIMESTAMP: 4eeaf722
STACK_COMMAND: ~10s; .ecxr ; kb
FAILURE_BUCKET_ID: INVALID_POINTER_READ_c0000005_msvcrt.dll!strlen
BUCKET_ID: APPLICATION_FAULT_INVALID_POINTER_READ_msvcrt!strlen+c
Followup: MachineOwner
But if you like to analyse the .dmp yourself using another tool, you can find it in the attachement.
Finally, I hope all this information can help analyzing the problem.
Regards,
Mohamed Zaghouani