opensearch-project / opensearch-project/security-analytics

[BUG] Sigma rules creation do not accept IPv6 addresses as value/list when defining a selection map with the modifier CIDR.

Open
#1,252 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug
Dominant language
Java
Stars
111
Forks
111
Avg merge
1d 17h
Merged PRs (30d)
13

Description

What is the bug?

When creating a sigma rule with a detection criteria that use a Map with Modifier=CIDR, you will get this error message: "[security_analytics_exception] Invalid IPv4 CIDR expression" if the value of the map is an IPv6 address.

How can one reproduce the bug?

Steps to reproduce the behavior:

  1. Go to '[Security Analytics][Detection rules][Create detection rule] page i Opensearch
  2. Define a rule with a detection map that includes for example:
    Key: ip.address
    Modifier: CIDR
    Value: 2a03:2880:f132:83:face:b00c::/96
  3. Press "Create detection rule"
  4. Get this error "[security_analytics_exception] Invalid IPv4 CIDR expression"

What is the expected behavior?

It should work with both IPv4 and IPv6 addresses according to the Sigma rules documentation, ref: https://sigmahq.io/docs/basics/modifiers.html#cidr

What is your host/environment?

  • OS: Red Hat Enterprise Linux release 9.4
  • Version Opensearch 2.15
  • Plugins
# /usr/share/opensearch/bin/opensearch-plugin list
opensearch-alerting
opensearch-anomaly-detection
opensearch-asynchronous-search
opensearch-cross-cluster-replication
opensearch-custom-codecs
opensearch-flow-framework
opensearch-geospatial
opensearch-index-management
opensearch-job-scheduler
opensearch-knn
opensearch-ml
opensearch-neural-search
opensearch-notifications
opensearch-notifications-core
opensearch-observability
opensearch-performance-analyzer
opensearch-reports-scheduler
opensearch-security
opensearch-security-analytics
opensearch-skills
opensearch-sql

Do you have any screenshots?
If applicable, add screenshots to help explain your problem.

error

Do you have any additional context?

It looks like the implementation of the "Sigma Modifiers" in Opensearch does not support IPv6 addresses with the CIDR modifier if I interpret this code correctly:
https://github.com/opensearch-project/security-analytics/blob/3e1f59d00125f522f565014bb7bd4d8ea8df2d73/src/main/java/org/opensearch/securityanalytics/rules/types/SigmaCIDRExpression.java

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reading src/main/java/org/opensearch/securityanalytics/rules/types/SigmaCIDRExpression.java and trace how the CIDR modifier validates values during detection-rule creation. Reproduce the reported IPv6 example, then verify that CIDR values and lists accept both IPv4 and IPv6 addresses without rejecting existing IPv4 behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
security
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Quiet
Clarity
Clearly specified
Newbie friendliness
68/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.