Skip to content

[Security Solution] Exception lists are removed during rule import rule import, causing false positives #256010

@nikitaindik

Description

@nikitaindik

This issue was created using Cursor

Summary

When using POST /api/detection_engine/rules/_import with overwrite_exceptions=true, there is a race condition that causes false-positive alerts. Existing exception list items are deleted before new items are written back, creating a window where running rules see empty exception lists and generate alerts that should have been suppressed.

Expected Behavior

Importing rules and exceptions with overwrite flags should be an atomic-like operation. Running rules should never evaluate against partially-imported (empty) exception lists.

Actual Behavior

The overwrite flow in importExceptionLists deletes all existing exception list items first (deleteListItemsToBeOverwritten), then new items are imported in a separate subsequent step (importExceptionListItems). During this window, any enabled rule that fires will query the now-empty exception lists and produce alerts that should have been excluded.

Steps to Reproduce

  1. Create a detection rule with an exception list that excludes certain events
  2. Enable the rule so it runs on a schedule (e.g., every 5 minutes)
  3. Use the import API with overwrite=true and overwrite_exceptions=true to re-import the same rule and exceptions
  4. If the rule fires during the import window (between exception item deletion and re-creation), alerts are generated for events that should be excluded

Root Cause

The exception overwrite uses a delete-then-recreate pattern with no transactional guarantees:

  1. importExceptionLists() → calls deleteListItemsToBeOverwritten() to remove all items from overwritten lists
  2. importExceptionListItems() → writes new items back

Between steps 1 and 2, the exception lists exist but contain zero items. There is no mechanism to pause rules during import.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Feature:Rule ExceptionsSecurity Solution Detection Rule Exceptions areaFeature:Rule Import/ExportSecurity Solution Detection Rule Import & Export workflowTeam: SecuritySolutionSecurity Solutions Team working on SIEM, Endpoint, Timeline, Resolver, etc.Team:Detection EngineSecurity Solution Detection Engine AreaTeam:Detection Rule ManagementSecurity Detection Rule Management TeamTeam:Detections and RespSecurity Detection Response TeambugFixes for quality problems that affect the customer experiencegood first issuelow hanging fruitimpact:mediumAddressing this issue will have a medium level of impact on the quality/strength of our product.triage:keepFor relevant work that team should plan.

    Type

    No fields configured for Bug.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions