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

[Rule Tuning] Cobalt Strike Command and Control Beacon #3187

Closed
ChestoOfGlen opened this issue Oct 16, 2023 · 2 comments · Fixed by #3196
Closed

[Rule Tuning] Cobalt Strike Command and Control Beacon #3187

ChestoOfGlen opened this issue Oct 16, 2023 · 2 comments · Fixed by #3196
Assignees
Labels
community Rule: Tuning tweaking or tuning an existing rule

Comments

@ChestoOfGlen
Copy link

Link to rule

https:/elastic/detection-rules/blob/f584fb6e31fa6a052a316fa108adf83e9a0d5e82/rules/network/command_and_control_cobalt_strike_beacon.toml

Description

This rule has a lack of capitalisation in the query with respect to the AND/OR operators in the most recent update. This is causing this rule to match on the word "and" in Elasticsearch instead of properly applying the logic and searching for the C2 destination traffic events.
The specific issue is with the last "AND", however I think that all AND/OR operators should be capitalised as that appears to be the standard defined in the Elastic documentation for query string/Lucene syntax (https://www.elastic.co/guide/en/elasticsearch/reference/8.10/query-dsl-query-string-query.html#query-string-syntax).
image

This has caused a huge amount of false positives in our environment since the rule package was updated around October 14.
z-browser-32438219137-6035031742390-39b55aa9de690dc68abf0f1a1bde316e879171dbd7ec1b5adb4d0cefe36f1482

Confirming that running this same Lucene query in Discover returns only false positive results as it matches on the word "and".
image

And running it with properly capitalised AND/OR operators returns the expected zero results.
image

Finally, just to note, the previous commit for this rule had the "AND" properly capitalised.

event.dataset: (network_traffic.tls or network_traffic.http) AND destination.domain:/[a-z]{3}.stage.[0-9]{8}\..*/

image

Solution is to, naturally, update the query to use correct capitalisation for the AND/OR operators, in line with what appears in the query string/Lucene Elastic docs as linked above.

@ChestoOfGlen ChestoOfGlen added the Rule: Tuning tweaking or tuning an existing rule label Oct 16, 2023
@brokensound77
Copy link
Contributor

This will be resolved by #3194

@w0rk3r
Copy link
Contributor

w0rk3r commented Oct 16, 2023

Hey @ChestoOfGlen, as #3194 will min_stack the rule at 8.10+, I pushed #3196 to fix this in previous versions and other occurrences. Thanks for bringing this to our attention, looking forward to more contributions!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
community Rule: Tuning tweaking or tuning an existing rule
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants