-
Notifications
You must be signed in to change notification settings - Fork 34
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
Resolve datadog-agent kworker false positives #300
Resolve datadog-agent kworker false positives #300
Conversation
Signed-off-by: egibs <20933572+egibs@users.noreply.github.com>
a9f4e78
to
a1b5c67
Compare
Signed-off-by: egibs <20933572+egibs@users.noreply.github.com>
Signed-off-by: Evan Gibler <20933572+egibs@users.noreply.github.com>
Signed-off-by: Evan Gibler <20933572+egibs@users.noreply.github.com>
Signed-off-by: egibs <20933572+egibs@users.noreply.github.com>
Signed-off-by: egibs <20933572+egibs@users.noreply.github.com>
Signed-off-by: egibs <20933572+egibs@users.noreply.github.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The ignore_refs look more complicated than we usually have, so I just wanted to see if they could be made into non-regex form.
Also related: #306
It'd be nice if we had at least one sample to validate that we aren't breaking this query, but we can save that for another PR too.
rules/evasion/fake-process-name.yara
Outdated
@@ -7,10 +6,14 @@ rule fake_kworker_val : critical { | |||
hash_2023_Unix_Downloader_Rocke_6107 = "61075056b46d001e2e08f7e5de3fb9bfa2aabf8fb948c41c62666fd4fab1040f" | |||
strings: | |||
$kworker = /\[{0,1}kworker\/[\d:\]]{1,5}/ | |||
$kworker2 = "kworker" fullword | |||
$kworker2 = /\bkworker\b/ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
just for my own education, what's the difference between \b and fullword?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For the purposes I was using it for, probably not. It would definitely provide more control in a larger expression but I can change this back to "kworker" fullword
.
rules/evasion/fake-process-name.yara
Outdated
$kworker3 = "[kworker" | ||
// datadog process-agent | ||
$ignore_ref = /(data->|[!\*\.])?is_kworker(\.\w{0,32})?/ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can these expressions be simplified? Is there a reason why a single string (non-regex) isn't sufficient to exclude datadog?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good point -- I was way overthinking this. I'll just ignore DataDog
and datadog
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Both DataDog
and datadog
were present so I used a small expression to cover both cases in ca4eff3
(#300).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/bincapz # yara rules/evasion/fake-process-name.yara /usr/bin/process-agent -s
/bincapz # yara rules/evasion/fake-process-name.yara /usr/bin/process-agent -c
0
Signed-off-by: egibs <20933572+egibs@users.noreply.github.com>
Signed-off-by: egibs <20933572+egibs@users.noreply.github.com>
* Resolve datadog-agent kworker false positives Signed-off-by: egibs <20933572+egibs@users.noreply.github.com> * Better handling of ignore_ref Signed-off-by: egibs <20933572+egibs@users.noreply.github.com> * Update rules/evasion/fake-process-name.yara Signed-off-by: Evan Gibler <20933572+egibs@users.noreply.github.com> * Update rules/evasion/fake-process-name.yara Signed-off-by: Evan Gibler <20933572+egibs@users.noreply.github.com> * Add more precise DataDog process-agent kworker references Signed-off-by: egibs <20933572+egibs@users.noreply.github.com> * More specificity Signed-off-by: egibs <20933572+egibs@users.noreply.github.com> * Consolidate ignores Signed-off-by: egibs <20933572+egibs@users.noreply.github.com> * Ignore DataDog strings Signed-off-by: egibs <20933572+egibs@users.noreply.github.com> --------- Signed-off-by: egibs <20933572+egibs@users.noreply.github.com> Signed-off-by: Evan Gibler <20933572+egibs@users.noreply.github.com> Co-authored-by: Thomas Strömberg <t+github@chainguard.dev>
* Resolve datadog-agent kworker false positives Signed-off-by: egibs <20933572+egibs@users.noreply.github.com> * Better handling of ignore_ref Signed-off-by: egibs <20933572+egibs@users.noreply.github.com> * Update rules/evasion/fake-process-name.yara Signed-off-by: Evan Gibler <20933572+egibs@users.noreply.github.com> * Update rules/evasion/fake-process-name.yara Signed-off-by: Evan Gibler <20933572+egibs@users.noreply.github.com> * Add more precise DataDog process-agent kworker references Signed-off-by: egibs <20933572+egibs@users.noreply.github.com> * More specificity Signed-off-by: egibs <20933572+egibs@users.noreply.github.com> * Consolidate ignores Signed-off-by: egibs <20933572+egibs@users.noreply.github.com> * Ignore DataDog strings Signed-off-by: egibs <20933572+egibs@users.noreply.github.com> --------- Signed-off-by: egibs <20933572+egibs@users.noreply.github.com> Signed-off-by: Evan Gibler <20933572+egibs@users.noreply.github.com> Co-authored-by: Thomas Strömberg <t+github@chainguard.dev>
Closes: #288
"kworker" fullword
was likely matching these strings inprocess-agent
:is_kworker
checkworker
This PR tweaks the
$kworker2
string to match eitherkworker
orKworker
between word boundaries which will avoid matching against strings like those mentioned above and also adds explicit ignores foris_kworker
andcheckworker
.Discovery:
These strings were also present:
MarkWorker
IsKworker
IsNotKworker
NotKworker
The new rule should ignore these as well.