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

Add Florian Roth's rules #304

Closed
wants to merge 7 commits into from

Conversation

egibs
Copy link
Member

@egibs egibs commented Jun 29, 2024

Relates to: #267

Florian Roth's signature-base repository contains a lot of interesting rules.

TBD how much overlap there is with what we currently have but I wanted to get a PR going to add them -- we'll also want to ensure that YaraCI doesn't have any false negatives.

The repository is licensed under DRL 1.1 which allows us to integrate these rules so long as we attribute them appropriately (which will happen automatically via Rule metadata).

@egibs egibs requested a review from tstromberg June 29, 2024 21:49
@egibs
Copy link
Member Author

egibs commented Jun 29, 2024

The Lint Check isn't having the best time:

reviewdog: post failed for misspell: fail to parse diff: GET https://api.github.com/repos/chainguard-dev/bincapz/pulls/304: 406 Sorry, the diff exceeded the maximum number of files (300). Consider using 'List pull requests files' API or locally cloning the repository instead. [{Resource:PullRequest Field:diff Code:too_large Message:}]

@@ -58,6 +58,8 @@ func findFilesRecursively(ctx context.Context, root string, c Config) ([]string,

// cleanPath removes the temporary directory prefix from the path.
func cleanPath(path string, prefix string) string {
// if the path has "private" prefix, remove it
path = strings.ReplaceAll(path, "/private", "")
Copy link
Member Author

Choose a reason for hiding this comment

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

Not sure why this started happening (on MacOS) but the path had a /private/... prefix which caused the TrimPrefix to return the original path unaltered.

/* $command18 = "/mount " ascii prone to FPs */

condition:
( filename == "sudoers" or filepath contains "/etc/sudoers.d" ) and
Copy link
Member Author

@egibs egibs Jun 29, 2024

Choose a reason for hiding this comment

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

The filename and filepath external variables were present in 12 of the copied rule files so I excluded those from the update.sh rsync.

@egibs egibs changed the title Add signature-base rules Add Florian Roth's rules Jun 29, 2024
egibs added 4 commits June 29, 2024 17:57
@egibs egibs added the rules Adds or modifies YARA Rules label Jun 30, 2024
egibs added a commit to egibs/malcontent that referenced this pull request Jun 30, 2024
@tstromberg
Copy link
Collaborator

Since Florian is also the guy behind YARAForge, I suspect the best of his rules are already part of bincapz. Is there anything you feel like is missing?

tstromberg added a commit that referenced this pull request Jul 1, 2024
* Tweak password_finder_mimipenguin rule

Signed-off-by: egibs <[email protected]>

* Move Finder to extra strings

Signed-off-by: egibs <[email protected]>

* Remove overlapping strings related to #304

Signed-off-by: egibs <[email protected]>

* Update rules/combo/stealer/password.yara

Signed-off-by: Evan Gibler <[email protected]>

* Add mimipenguin samples

Signed-off-by: egibs <[email protected]>

* Fix simple results

Signed-off-by: egibs <[email protected]>

* Tweak rule now that we have samples

Signed-off-by: egibs <[email protected]>

* Fix tests

Signed-off-by: egibs <[email protected]>

---------

Signed-off-by: egibs <[email protected]>
Signed-off-by: Evan Gibler <[email protected]>
Co-authored-by: Thomas Strömberg <[email protected]>
@egibs
Copy link
Member Author

egibs commented Jul 1, 2024

Since Florian is also the guy behind YARAForge, I suspect the best of his rules are already part of bincapz. Is there anything you feel like is missing?

That's a good question. I'll comb through them and see if there's something more targeted we can implement. I'll carry over the path formatting fix into a new PR.

@egibs egibs marked this pull request as draft July 1, 2024 22:37
@egibs
Copy link
Member Author

egibs commented Jul 9, 2024

Closing for now. Cherry-picking specific rules and adding samples for them is more useful than adding all of the rules (some of which may cause false positives or need to be turned off).

@egibs egibs closed this Jul 9, 2024
@egibs egibs deleted the signature-base-rules branch July 19, 2024 13:20
egibs added a commit to egibs/malcontent that referenced this pull request Aug 5, 2024
* Tweak password_finder_mimipenguin rule

Signed-off-by: egibs <[email protected]>

* Move Finder to extra strings

Signed-off-by: egibs <[email protected]>

* Remove overlapping strings related to chainguard-dev#304

Signed-off-by: egibs <[email protected]>

* Update rules/combo/stealer/password.yara

Signed-off-by: Evan Gibler <[email protected]>

* Add mimipenguin samples

Signed-off-by: egibs <[email protected]>

* Fix simple results

Signed-off-by: egibs <[email protected]>

* Tweak rule now that we have samples

Signed-off-by: egibs <[email protected]>

* Fix tests

Signed-off-by: egibs <[email protected]>

---------

Signed-off-by: egibs <[email protected]>
Signed-off-by: Evan Gibler <[email protected]>
Co-authored-by: Thomas Strömberg <[email protected]>
egibs added a commit to egibs/malcontent that referenced this pull request Sep 25, 2024
* Tweak password_finder_mimipenguin rule

Signed-off-by: egibs <[email protected]>

* Move Finder to extra strings

Signed-off-by: egibs <[email protected]>

* Remove overlapping strings related to chainguard-dev#304

Signed-off-by: egibs <[email protected]>

* Update rules/combo/stealer/password.yara

Signed-off-by: Evan Gibler <[email protected]>

* Add mimipenguin samples

Signed-off-by: egibs <[email protected]>

* Fix simple results

Signed-off-by: egibs <[email protected]>

* Tweak rule now that we have samples

Signed-off-by: egibs <[email protected]>

* Fix tests

Signed-off-by: egibs <[email protected]>

---------

Signed-off-by: egibs <[email protected]>
Signed-off-by: Evan Gibler <[email protected]>
Co-authored-by: Thomas Strömberg <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
rules Adds or modifies YARA Rules
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants