Skip to content

render: don't assume prior matches exist within thread - #2612

Merged
mike-hunhoff merged 6 commits into
masterfrom
fix/render/exception
Mar 4, 2025
Merged

render: don't assume prior matches exist within thread#2612
mike-hunhoff merged 6 commits into
masterfrom
fix/render/exception

Conversation

@mike-hunhoff

Copy link
Copy Markdown
Collaborator

No description provided.

@mike-hunhoff
mike-hunhoff requested a review from a team February 24, 2025 17:47

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown

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 February 24, 2025 17:49

CHANGELOG updated or no update needed, thanks! 😄

Comment thread capa/render/result_document.py
@williballenthin

Copy link
Copy Markdown
Collaborator

i don't quite understand the scenario that leads to this. can you share an example?

@mike-hunhoff

Copy link
Copy Markdown
Collaborator Author

i don't quite understand the scenario that leads to this. can you share an example?

Our test sample tests/data/dynamic/cape/v2.2/0000a65749f5902c4d82ffa701198038f0b4870b00a27cfca109f8f933476d82.json.gz triggers this bug after recent capa rule updates.

This bug is triggered when the rendering logic attempts to render a result containing a namespace match for host-interaction/process/create where two rules within this namespace, create process on Windows and create process suspended, match as capabilities. The logic corrected here assumes all of the matched namespace rules are within the same thread as the result being rendered. create process on Windows is matched in the same thread as the result being rendered but create process suspended is not matched in the same thread as the result being rendered. Therefore, an exception is triggered when create process suspended is processed and matches_in_thread is empty, because there are no matches for the rule in the same thread as the result being rendered.

Comment thread capa/render/result_document.py
@mike-hunhoff
mike-hunhoff merged commit 7ecf292 into master Mar 4, 2025
@mike-hunhoff
mike-hunhoff deleted the fix/render/exception branch March 4, 2025 00:49
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