Skip to content

[Rule Tuning] Abnormally Large DNS Response#5922

Open
eric-forte-elastic wants to merge 11 commits intomainfrom
5509-rule-tuning-abnormally-large-dns-response-11013227-0301-4a8c-b150-4db924484475
Open

[Rule Tuning] Abnormally Large DNS Response#5922
eric-forte-elastic wants to merge 11 commits intomainfrom
5509-rule-tuning-abnormally-large-dns-response-11013227-0301-4a8c-b150-4db924484475

Conversation

@eric-forte-elastic
Copy link
Copy Markdown
Contributor

@eric-forte-elastic eric-forte-elastic commented Apr 6, 2026

Pull Request

Issue link(s):
Resolves #5509

Summary - What I changed

Tuning to update DNS traffic detection to include Zeek DNS traffic identification. Additionally, reduces false positive/duplicate alerts by removing the connection by removing event.type is "connection" as this will cause the rule to fire not only on the start/end of the connection but on flows after the connection is established and first alert is created on the flow (thereby being a duplicate). Furthermore, the field network.bytes in practice is not the number of bytes for the request, but the session total from the connection in the established connection case. As such it is still useful in the start/end of a connection, but not for the overall session total. This has been changed to destination.bytes as this will include directionality in the filtering paired with the event type filtering event.type:("allowed" or "end" or "protocol" or "start") to exclude summary messages.

How To Test

Verify in telemetry.

Checklist

  • Added a label for the type of pr: bug, enhancement, schema, maintenance, Rule: New, Rule: Deprecation, Rule: Tuning, Hunt: New, or Hunt: Tuning so guidelines can be generated
  • Added the meta:rapid-merge label if planning to merge within 24 hours
  • Secret and sensitive material has been managed correctly
  • Automated testing was updated or added to match the most common scenarios
  • Documentation and comments were added for features that require explanation

Contributor checklist

@tradebot-elastic
Copy link
Copy Markdown

tradebot-elastic commented Apr 6, 2026

⛔️ Test failed

Results
  • ❌ Abnormally Large DNS Response (kuery)
    • coverage_issue: no_rta
    • stack_validation_failed: no_rta

@eric-forte-elastic eric-forte-elastic marked this pull request as ready for review April 6, 2026 19:15
@tradebot-elastic
Copy link
Copy Markdown

tradebot-elastic commented Apr 6, 2026

⛔️ Test failed

Results
  • ❌ Abnormally Large DNS Response (kuery)
    • coverage_issue: no_rta
    • stack_validation_failed: no_rta

@tradebot-elastic
Copy link
Copy Markdown

tradebot-elastic commented Apr 7, 2026

⛔️ Test failed

Results
  • ❌ Abnormally Large DNS Response (kuery)
    • coverage_issue: no_rta
    • stack_validation_failed: no_rta

@eric-forte-elastic eric-forte-elastic marked this pull request as draft April 8, 2026 12:25
@tradebot-elastic
Copy link
Copy Markdown

tradebot-elastic commented Apr 8, 2026

⛔️ Test failed

Results
  • ❌ Abnormally Large DNS Response (kuery)
    • coverage_issue: no_rta
    • stack_validation_failed: no_rta

@eric-forte-elastic eric-forte-elastic marked this pull request as ready for review April 8, 2026 13:55
@tradebot-elastic
Copy link
Copy Markdown

tradebot-elastic commented Apr 8, 2026

⛔️ Test failed

Results
  • ❌ Abnormally Large DNS Response (kuery)
    • coverage_issue: no_rta
    • stack_validation_failed: no_rta

@tradebot-elastic
Copy link
Copy Markdown

tradebot-elastic commented Apr 8, 2026

⛔️ Test failed

Results
  • ❌ Abnormally Large DNS Response (kuery)
    • coverage_issue: no_rta
    • stack_validation_failed: no_rta

@tradebot-elastic
Copy link
Copy Markdown

tradebot-elastic commented Apr 8, 2026

⛔️ Test failed

Results
  • ❌ Abnormally Large DNS Response (kuery)
    • coverage_issue: no_rta
    • stack_validation_failed: no_rta

@tradebot-elastic
Copy link
Copy Markdown

tradebot-elastic commented Apr 8, 2026

⛔️ Test failed

Results
  • ❌ Abnormally Large DNS Response (kuery)
    • coverage_issue: no_rta
    • stack_validation_failed: no_rta

@tradebot-elastic
Copy link
Copy Markdown

tradebot-elastic commented Apr 9, 2026

⛔️ Test failed

Results
  • ❌ Abnormally Large DNS Response (kuery)
    • coverage_issue: no_rta
    • stack_validation_failed: no_rta

or network.protocol:"dns"
or event.dataset:(network_traffic.dns or zeek.dns))
and destination.bytes > 60000
and event.type:("allowed" or "end" or "protocol" or "start")
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The query change itself looks good, just wanted to clarify on whether event.type:connection events from any target integrations are being intentionally excluded.

Copy link
Copy Markdown
Contributor Author

@eric-forte-elastic eric-forte-elastic Apr 9, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good question, short answer: yes exclusion is intentional, but nuanced.

Long Answer:
event.type:connection has a dual use. First is that is almost always populated, you will regularly see things like: event.type = ["start", "connection"]. This doc/event should be interpenetrated as the start of a connection or more directly, the event that was the attempt to start the connection. Following this entry there will be doc(s) that have event.type = ["connection"] which contain a summary of the total events from the connection.

Notionally and over simplified you could see something like:

Doc 1: event.type = ["start", "connection"]... size 4b
Doc 2: event.type = ["allowed", "connection"] ... size 6b
Doc 3: event.type = ["end", "connection"] ... size 2b
Doc 4: event.type = ["connection"] ... size 12b

In the above case, the Doc 4 of size 12b is a summary of Docs 1-3, not additional data. Where this applied to the rule, is that we need to exclude the summary docs which have just event.type:connection, while keeping the docs that have that event type which are not the summary. Otherwise, the destination.bytes size would be applied to the summary of the connection interactions as opposed to the triggering event itself, thereby creating many false positives.

(event.dataset:zeek.dns or type:dns or event.type:connection) and network.bytes > 60000
((event.category:(network or network_traffic) and destination.port:53)
or network.protocol:"dns"
or event.dataset:(network_traffic.dns or zeek.dns))
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
or event.dataset:(network_traffic.dns or zeek.dns))
or data_stream.dataset:(network_traffic.dns or zeek.dns))

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Rule Tuning] Abnormally Large DNS Response (11013227-0301-4a8c-b150-4db924484475)

6 participants