wazuh / wazuh

Wazuh - The Open Source Security Platform. Unified XDR and SIEM protection for endpoints and cloud workloads.
https://wazuh.com/
Other
10.35k stars 1.59k forks source link

Vuln-detector: Discard inactive Linux kernel packages Almalinux #21169

Open fabfive opened 8 months ago

fabfive commented 8 months ago

Hi Folks

I'm running version 4.7.1 as a single node docker install.

I have AlmaLinux 8 clients (Version 4.7.1) that report old , not running kernels in the vulneranbility detection.

but according to https://github.com/wazuh/wazuh/pull/4996 this should be fixed, right?

Example: Client running: 4.18.0-513.9.1.el8_9.x86_64 Vuln-Detector complains about: kernel-core-4.18.0-477.27.2.el8_8.x86_64 rpm with condition: Package less than 4.18.0-513.5.1.el8_9

How can this be fixed?

Thax for any help fab

MarcelKemp commented 8 months ago

Hi @fabfive,

As far as I can see, it is possible that kernel packages are discarded, but the kernel-core case is not.

However, to verify if this is a problem, we would need the following information from an affected agent:

I look forward to your reply.

fabfive commented 8 months ago

Hi @MarcelKemp


- GET /syscollector/{agent_id}/packages
this is a bit strange!
there are no kernel-core packages in the output
just one kernel-module
  {
    "scan": {
      "id": 0,
      "time": "2024-01-02T15:38:55+00:00"
    },
    "install_time": "1703782147",
    "architecture": "x86_64",
    "location": " ",
    "name": "kernel-modules",
    "source": " ",
    "priority": " ",
    "format": "rpm",
    "section": "System Environment/Kernel",
    "size": 26220908,
    "description": "kernel modules to match the core kernel",
    "vendor": "AlmaLinux",
    "version": "4.18.0-513.9.1.el8_9",
    "agent_id": "006"
  },

but on the system:

[root@wazuh home]# rpm -qa | grep kernel-core kernel-core-4.18.0-513.9.1.el8_9.x86_64 kernel-core-4.18.0-477.27.2.el8_8.x86_64 [root@wazuh home]# rpm -qa | grep kernel-modules kernel-modules-4.18.0-513.9.1.el8_9.x86_64 kernel-modules-4.18.0-477.27.2.el8_8.x86_64


and in Inventory data on the wazuh dashboard kernel-core and kernel-modules pakages are listed
![Screenshot from 2024-01-04 11-35-17](https://github.com/wazuh/wazuh/assets/8616103/54fe6765-f2d7-4e91-ad6a-882fa5b8d01f)

I hope this helps

best
Fab
MarcelKemp commented 8 months ago

Thank you very much! I'll research it, as soon as I get a conclusion I'll let you know.

MarcelKemp commented 7 months ago

Hi @fabfive,

Sorry for the delay.

It seems to be a problem in the conditions that have been added in the following code:

For this case, if you also have other kernel-*, we should take this into account so that they are discarded and only take the case we want.

We are going to consider this problem to be solved together with the VD refactor:

Thanks for reporting it!

nbrys commented 2 months ago

This doesn't seem to be resolved in manager 4.8.0 and client 4.7.4. The dashboard is still reporting on older kernels