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

Vulnerability scanner - Missing functionality on translations #23518

Closed
2 tasks done
sebasfalcone opened this issue May 19, 2024 · 7 comments · Fixed by #23727
Closed
2 tasks done

Vulnerability scanner - Missing functionality on translations #23518

sebasfalcone opened this issue May 19, 2024 · 7 comments · Fixed by #23727
Assignees
Labels
level/task type/enhancement New feature or request

Comments

@sebasfalcone
Copy link
Member

sebasfalcone commented May 19, 2024

Description

Currently, the translation mechanism used on the vulnerability scanner (#22477):

  • Doesn't validate that the vendor name matches the one on the translation regex
  • Lacks the capability of replacing the version provided by syscollector

Version replacement - use cases

Static version

Replace the version with some fixed value:

{
  "target": [
    "windows"
  ],
  "source": {
    "vendor": "^Microsoft Corporation",
    "product": "^Microsoft Office Professional Plus 2016 - en-us$",
    "version": ""
  },
  "translation": [
    {
      "vendor": "microsoft",
      "product": "office",
      "version": "16.0.0.0"
    }
  ]
}

Dynamic version

Obtain the version information from the package name:

  {
    "scan_id": 0,
    "scan_time": "2024/05/14 14:13:18",
    "format": "win",
    "name": "Java 2 Runtime Environment Standard Edition v1.3.1", <----- VERSION IN NAME
    "version": " ", <----- EMPTY VERSION
    "priority": " ",
    "section": " ",
    "size": 0,
    "vendor": " ",
    "install_time": "2024/05/14 14:12:38",
    "architecture": "i686",
    "multiarch": null,
    "source": " ",
    "description": " ",
    "location": " ",
    "cpe": null,
    "msu_name": null,
    "checksum": "07d6fe0244cbe8abad0cdc83ae6d1f53dcd092da",
    "item_id": "8d91907b799e329bf1c472fe5898abfa946ee746"
  }

In this example, we could use the following translation

{
  "target": [
    "windows"
  ],
  "source": {
    "vendor": "^\\s",
    "product": "^Java \\d Runtime Environment Standard Edition v\\d+\\.\\d+\\.\\d+",
    "version": "v(\\d+\\.\\d+\\.\\d+)"
  },
  "translation": [
    {
      "vendor": "oracle",
      "product": "jre",
      "version": ""
    },
    {
      "vendor": "sun",
      "product": "jre",
      "version": ""
    }
  ]
}

Logic

flowchart TD
    A[Start] --> B{source.version empty}
    B -->|No| C[Use version extracted from product name]
    B -->|Yes| E{translation.version empty}
    E -->|No| F[Use translation version]
    E -->|Yes| G[No version to replace]

DoD

  • Functionality implemented
  • Tests updated
@pereyra-m
Copy link
Member

Update

The changes are present temporarily at https://github.com/wazuh/wazuh/tree/enhancement/23518-add-version-replace-on-translations-temp because the target branch 4.9.0 still doesn't have the latest commits.

The QA tests pass locally

2024-05-22_13-37

UTs pass

2024-05-22_14-07

@pereyra-m
Copy link
Member

Update

Rebase of PR https://github.com/wazuh/intelligence-data/pull/293 and changes in the review applied

@sebasfalcone
Copy link
Member Author

sebasfalcone commented May 28, 2024

Issue blocked

We are waiting for the upward merge of 4.8.0 into 4.9.0 to continue this development

@pereyra-m
Copy link
Member

Update

The PR for this repository was created.
It's temporarily pointing to 4.8.0 until the merge to 4.9.0 is done.

@pereyra-m pereyra-m linked a pull request May 28, 2024 that will close this issue
4 tasks
@pereyra-m
Copy link
Member

Update

PR rebased after base branch change.

@pereyra-m
Copy link
Member

pereyra-m commented Jun 4, 2024

Update

Issue in progress again. Changes by review in both PRs and rebase.

@pereyra-m
Copy link
Member

Update

Rebase and conflict solving for PR #23727

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
level/task type/enhancement New feature or request
Projects
Status: Done
Development

Successfully merging a pull request may close this issue.

2 participants