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

feat(pe): Expand PE attributes and filter fields #185

Merged
merged 5 commits into from
Aug 5, 2023

Conversation

rabbitstack
Copy link
Owner

This change brings a new set of PE introspection capabilities revolving around signatures, file characteristics, import hashes, and other interesting PE metadata. All filter fields are evaluated lazily, that is, they are only evaluated if the filter expression is referencing an adequate field. This logic permits enabling PE introspection in rules by default, contrary to PE enrichment in events which only happens when the option is enabled in the config file.

Another addition is related to image load and create file events. When we detect an image being loaded, the PE is parsed to enrich the event with additional fields. The same is applied to the create file events when the create disposition results in a new file being created.

The following is a list of new filter fields ready to be used in the rules:

{PeIsDLL, "indicates if the loaded image or created file is a DLL", kparams.Bool, []string{"pe.is_dll'"}, nil},
{PeIsDriver, "indicates if the loaded image or created file is a driver", kparams.Bool, []string{"pe.is_driver'"}, nil},
{PeIsExecutable, "indicates if the loaded image or created file is an executable", kparams.Bool, []string{"pe.is_exec'"}, nil},
{PeImphash, "import hash", kparams.AnsiString, []string{"pe.impash = '5d3861c5c547f8a34e471ba273a732b2'"}, nil},
{PeIsDotnet, "indicates if PE contains CLR data", kparams.Bool, []string{"pe.is_dotnet"}, nil},
{PeAnomalies, "contains PE anomalies detected during parsing", kparams.Slice, []string{"pe.anomalies in ('number of sections is 0')"}, nil},
{PeIsSigned, "indicates if the PE has embedded or catalog signature", kparams.Bool, []string{"pe.is_signed"}, nil},
{PeIsTrusted, "indicates if the PE certificate chain is trusted", kparams.Bool, []string{"pe.is_trusted"}, nil},
{PeCertSerial, "PE certificate serial number", kparams.UnicodeString, []string{"pe.cert.serial = '330000023241fb59996dcc4dff000000000232'"}, nil},
{PeCertSubject, "PE certificate subject", kparams.UnicodeString, []string{"pe.cert.subject contains 'Washington, Redmond, Microsoft Corporation'"}, nil},
{PeCertIssuer, "PE certificate CA", kparams.UnicodeString, []string{"pe.cert.issuer contains 'Washington, Redmond, Microsoft Corporation'"}, nil},
{PeCertAfter, "PE certificate expiration date", kparams.Time, []string{"pe.cert.after contains '2024-02-01 00:05:42 +0000 UTC'"}, nil},
{PeCertBefore, "PE certificate enrollment date", kparams.Time, []string{"pe.cert.before contains '2024-02-01 00:05:42 +0000 UTC'"}, nil},

@rabbitstack rabbitstack linked an issue Aug 4, 2023 that may be closed by this pull request
@rabbitstack rabbitstack changed the title feat(pe): Expand the PE attributes and filter fields feat(pe): Expand PE attributes and filter fields Aug 4, 2023
@rabbitstack rabbitstack merged commit 70c1e1b into master Aug 5, 2023
3 checks passed
@rabbitstack rabbitstack deleted the expand-pe-filter-fields branch August 5, 2023 12:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Compute PE imphash
1 participant