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

dynamic: emit complete features for A/W APIs #2409

Merged
merged 6 commits into from
Sep 27, 2024
Merged

dynamic: emit complete features for A/W APIs #2409

merged 6 commits into from
Sep 27, 2024

Conversation

mike-hunhoff
Copy link
Collaborator

closes #2408

This fixes A/W API detection for CAPE, VMRay, and drakvuf where capa rules that specified A/W APIs without the A/W could not be matched e.g. https://github.com/mandiant/capa-rules/blob/627395d6f19dc76894bbf7d365d28d083fab67cf/lib/create-or-open-registry-key.yml#L4

Copy link

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

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

Please add bug fixes, new features, breaking changes and anything else you think is worthwhile mentioning to the master (unreleased) section of CHANGELOG.md. If no CHANGELOG update is needed add the following to the PR description: [x] No CHANGELOG update needed

@github-actions github-actions bot dismissed their stale review September 26, 2024 20:43

CHANGELOG updated or no update needed, thanks! 😄

@mike-hunhoff mike-hunhoff changed the title dynamic: fix A/W API detection for all dynamic extractors dynamic: emit complete features for A/W APIs Sep 26, 2024
Copy link
Collaborator

@yelhamer yelhamer left a comment

Choose a reason for hiding this comment

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

Awesome. LGTM!

@@ -50,7 +51,8 @@ def extract_call_features(ph: ProcessHandle, th: ThreadHandle, ch: CallHandle) -
else:
assert_never(value)

yield API(call.api), ch.address
for name in capa.features.extractors.helpers.generate_symbols("", call.api):
Copy link
Collaborator

Choose a reason for hiding this comment

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

we should update this API to accept None when the dll isn't present, not the empty string. But that can happen in another PR.

@@ -37,6 +37,8 @@
),
("0000a657", "process=(1180:3052)", capa.features.common.String("nope"), False),
# thread/api calls
("0000a657", "process=(2900:2852),thread=2904", capa.features.insn.API("RegQueryValueExA"), True),
("0000a657", "process=(2900:2852),thread=2904", capa.features.insn.API("RegQueryValueEx"), True),
Copy link
Collaborator

Choose a reason for hiding this comment

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

perfect, thanks for adding tests

@mr-tz mr-tz merged commit 00d2bb0 into master Sep 27, 2024
28 checks passed
@mr-tz mr-tz deleted the fix/2408 branch September 27, 2024 09:26
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.

dynamic: complete features not emitted for A/W APIs
4 participants