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

Avoid processing null elements of an array in Vulnerability Detector #3458

Merged
merged 2 commits into from Jun 6, 2019

Conversation

crolopez
Copy link
Contributor

@crolopez crolopez commented Jun 4, 2019

Related issue
#3456

Description

This PR prevents the bug described in the issue, and also protects it from happening in the other string array that we can find in a vulnerability node: affected_packages.

However, a null element in affected_packages does not produce a segmentation fault as it does if this element is found in advisories.

The fix consists of adding a null check on the elements of the array.

Configuration options

Considering that this error is not replicable with the currently hosted feed, the configuration must involve an offline update. We can use url or path for this.

    <feed name="redhat">
      <disabled>no</disabled>
      <path>/local_path/feed.json</path>
      <update_from_year>2010</update_from_year>
      <update_interval>1m</update_interval>
    </feed>

To replicate it, we have to download a feed and modify one of its vulnerabilities by adding null value to an array of strings like:

    "advisories": [
      "RHSA-2014:0429",
      "RHSA-2014:0452",
      "RHSA-2014:0401",
      "RHSA-2014:0253",
      "RHSA-2014:0252",
      "RHSA-2015:1009",
      "RHSA-2014:0525",
      "RHSA-2014:0526",
      "RHSA-2014:0527",
      "RHSA-2014:0528",
      "RHSA-2014:0400",
      null
    ]

Tests

  • Configuration of null elements in the rest of the vulnerability variables (previously controlled).
  • Compilation without warnings in every supported platform
    • Linux
  • Source installation
  • Package installation
  • Source upgrade
  • Package upgrade
  • Memory tests
    • Valgrind report for affected components
    • CPU impact
    • RAM usage impact
  • Retrocompatibility with older Wazuh versions
  • Working on cluster environments

@crolopez crolopez requested a review from bah07 June 4, 2019 10:45
@crolopez crolopez added this to In review in Wazuh TBD via automation Jun 4, 2019
@crolopez crolopez removed this from In review in Wazuh TBD Jun 4, 2019
@crolopez crolopez changed the title 3456 null strings Avoid processing null elements of an array in Vulnerability Detector Jun 4, 2019
@vikman90 vikman90 requested a review from snaow June 5, 2019 10:46
@bah07 bah07 merged commit c805221 into 3.9 Jun 6, 2019
@bah07 bah07 deleted the 3456-null-strings branch June 6, 2019 09:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants