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

improve and fix various dynamic parts #1809

Merged
merged 2 commits into from
Oct 18, 2023

Conversation

mr-tz
Copy link
Collaborator

@mr-tz mr-tz commented Oct 16, 2023

addresses various issues encountered during testing

Checklist

  • No CHANGELOG update needed
  • No new tests needed
  • No documentation update needed

Comment on lines +88 to +90
if cr.static is None and cr.target.file.pe is not None:
cr.static = Static()
cr.static.pe = cr.target.file.pe
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

noticed that this may store the data instead, maybe there's a better way to handle this?

Copy link
Collaborator

Choose a reason for hiding this comment

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

please add a comment with a reference to such a report and CAPE version.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Do we want to add all/many/few reports to capa testfiles?
I'm pulling down sandbox data for all our current testfile EXEs and DLLs.

Copy link
Collaborator

Choose a reason for hiding this comment

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

i think it would be good to have a fair collection, but not necessarily one for every sample.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

adding a few initially here: mandiant/capa-testfiles#217

Comment on lines +98 to +99
if len(cr.behavior.processes) == 0:
raise EmptyReportError("CAPE did not capture any processes")
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

such empty reports are fairly useless

Comment on lines +28 to +32
for symbol in generate_symbols(call.api):
call.api = symbol

addr = DynamicCallAddress(thread=th.address, id=call_index)
yield CallHandle(address=addr, inner=call)
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I've noticed we run into issues since CAPE reports only list the api (like CreateFileA), however:

  • rules often include the DLL (which we won't get easily here)
  • use the generic name (like CreateFile [not A/W])

This is one way/part of handling this, maybe we can come up with a more generic way.

capa/helpers.py Outdated Show resolved Hide resolved
capa/helpers.py Outdated Show resolved Hide resolved
capa/main.py Outdated Show resolved Hide resolved
@mr-tz mr-tz force-pushed the dynamic-fixes-1 branch 2 times, most recently from 0ade462 to 316e65d Compare October 17, 2023 18:02
@mr-tz mr-tz merged commit 2cfd450 into dynamic-feature-extraction Oct 18, 2023
17 checks passed
@mr-tz mr-tz deleted the dynamic-fixes-1 branch October 18, 2023 08:59
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.

2 participants