Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Research the detection for vulnerabilities that require a specific OS version to match #23967

Closed
3 tasks done
pereyra-m opened this issue Jun 6, 2024 · 10 comments
Closed
3 tasks done

Comments

@pereyra-m
Copy link
Member

pereyra-m commented Jun 6, 2024

Description

During the analysis of #23747, some sanitizations were requested. For example:

Nevertheless, after setting the specific affected versions for macOS, it's still required to make sure the detection occurs as expected.

DoD

  • Research about the sanitizations mentioned and perform manual tests
  • Upload a comment with the result of the analysis
  • Create issues for any action item that arises (if any)
@pereyra-m
Copy link
Member Author

Update

I begin with the analysis of the translations and the required manual tests to verify the behavior.

@pereyra-m
Copy link
Member Author

Analysis

The macOS scan for the cases detailed above was analyzed.

As @sebasfalcone points out, the entry in the global CPE map for macOS lacks of a version field.
It should be

  "macOS": "apple:macos:$(VERSION)::::"

This simple change would allow to improve the detection when the platforms array of a package contains an entry with an specific version.

Proposal: update the map with the new entry.

But the naming problem is different, and it affects the OS scan.
According to https://es.wikipedia.org/wiki/MacOS, the OS name has changed across the versions:

  • Mac OS X: v10.0 <= version <= v10.8
  • OS X: v10.9 <= version <= v10.11
  • Mac OS: v10.12 <= version (Sierra, the oldest OS supported by Wazuh agent)

There is also an old OS X Server that we don't need to consider.

The problem is that some candidates in the NVD don't follow this structure, and use a name that doesn't correspond to the version. For example:

These are false negatives, because the agents installed in v10.12 and above will report an OS CPE with macos but the NVD uses mac_os_x as product name.

Proposal: create a rule in the migration tool that automatically replaces mac_os_x by macos if the affected range includes the OS version range covered by the Wazuh agent.

Another issue found can be seen at

Proposal: create a rule in the migration tool that inserts a generic macos CPE when the target_sw string is read.

Really similar to

Proposal: we can't change the behavior of the CPE comparison. We must sanitize all platforms that contain a - in the version field and use a *.

The most complex situations that were found

Proposal: manually decompose the range in a detailed list of CPEs with single affected versions for each platform that has this condition.

@sebasfalcone
Copy link
Member

sebasfalcone commented Jun 7, 2024

Conclusion

We can divide the analysis into three distinct parts

Wrong CPEs for macOS

We can fix this without altering the inner workings of the scanner. To do so, we can make use of some sort of dictionary (taking inspiration from here)

CC: @wazuh/devel-cppserver-div2

target_sw field from the CPEs

We have two paths:

  • Re-interpret the target_sw field in the content to convert it into a platform
    • Further investigation is needed to see the impact on the scanner
    • CC: @wazuh/devel-cppserver-div2
  • Make a more complete use of the CPEs in the scanner
    • Currently, we are not using the CPEs to their full intent, we may want to adapt the scanner to do so
    • CC: @wazuh/devel-cppserver-div1

Interpretation of - fields in the CPEs

This one is tricky. We know that this value is used without regard by the NVD. My take is that we should revisit all the CPEs that make use of it and manually classify them (for later sanitization)

CC: @wazuh/devel-threatintel

@Dwordcito
Copy link
Member

@sebasfalcone please update this issue with the definitions talked the last tuesday.

@sebasfalcone
Copy link
Member

sebasfalcone commented Jun 13, 2024

Action items

Interpretation of - fields in the CPEs

For Windows systems, the proposed solution can be found here:

Further investigation is needed to see if the same solution applies to macOS:

target_sw field from the CPEs

Wrong CPEs for macOS

@Damian-Mangold
Copy link
Member

Hi @sebasfalcone , these are the CPEs of the content we are migrating from the NVD where the target_sw field is not a "-" or "*".

report_target_sw.zip

@sebasfalcone
Copy link
Member

sebasfalcone commented Jun 13, 2024

From the provided list, I've filtered out using the following criteria:

  • It should refer to an OS
  • It should be supported by VD

Tier 1

Apple

Entries that should match with a CPE from CPE

  • mac
  • mac_os
  • macos

Microsoft

Entries that should match with the generic CPE

  • windows

Entries that should match with a CPE from this list

  • windows_server

Linux

Entries that should match with the generic CPE

  • linux
  • linux_kernel

Entries that should match with a CPE from this list

  • debian
  • linux_mint
  • oracle
  • redhat_enterprise_linux
  • suse
  • suse_linux
  • ubuntu

Note

There may not be a specific CPE entire for that OS. If so, we should analyze the case and create it

Tier 2

  • windows_server_2008

Tier 3

  • windows_server_2003
  • windows_xp

No tier

  • windows_7
  • windows_8
  • windows_8.1
  • windows_vista
  • mac_os_x

Maping

All the items listed above should be mapped using a similar logic to:

@sebasfalcone

This comment has been minimized.

@sebasfalcone
Copy link
Member

ETA moved

Due re-definitions the ETA will be delayed

@sebasfalcone
Copy link
Member

Conclusion

  • All issues dispatched
  • Solution will be made by content

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: Done
Development

No branches or pull requests

4 participants