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

ESQL: Field existence check has opposite logic #78

Open
rtkmaryang opened this issue Sep 24, 2024 · 0 comments
Open

ESQL: Field existence check has opposite logic #78

rtkmaryang opened this issue Sep 24, 2024 · 0 comments

Comments

@rtkmaryang
Copy link

The below code shows the opposite check for the field existence check for sigma rules

# Field existence condition expressions.
field_exists_expression : ClassVar[str] = "{field} is null" # Expression for field existence as format string with {field} placeholder for field name
field_not_exists_expression : ClassVar[str] = "{field} is not null" # Expression for field non-existence as format string with {field} placeholder for field name. If not set, field_exists_expression is negated with boolean NOT.

When parsing below rule to ESQL, the condition for existence check is opposite

title: Foo bar
id: 37f81956-cd70-4d0d-8e0d-95229e13f3ab
name: foo-bar
status: experimental
logsource:
  product: windows
  service: sysmon
detection:
  mandatory_fields_hostname_exist:
    host.hostname|exists: true
  condition: >
    1 of mandatory_fields_*_exist
level: high

The generated ESQL is:

from * | where host.hostname is null

Expected generated ESQL

from * | where host.hostname is NOT null
@rtkmaryang rtkmaryang changed the title ESQL: Field existence check has opposite logic logic ESQL: Field existence check has opposite logic Sep 24, 2024
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

No branches or pull requests

1 participant