Skip to content

vmray: extract number features for registry key handles - #2835

Merged
mike-hunhoff merged 10 commits into
mandiant:masterfrom
AdeboyeDN:issue-2815-extract-hkey-from-void-ptr
Jan 30, 2026
Merged

vmray: extract number features for registry key handles#2835
mike-hunhoff merged 10 commits into
mandiant:masterfrom
AdeboyeDN:issue-2815-extract-hkey-from-void-ptr

Conversation

@AdeboyeDN

Copy link
Copy Markdown
Contributor

Closes #2815

Checklist

  • CHANGELOG update added
  • Tests added
  • No documentation update needed

@gemini-code-assist

Copy link
Copy Markdown
Contributor

Summary of Changes

Hello @AdeboyeDN, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request significantly enhances the VMRay feature extraction capabilities by enabling the accurate interpretation and extraction of numerical values from specific void_ptr parameters. By whitelisting parameters like hKey and hKeyRoot, the system can now convert their string representations into meaningful numerical features, providing more precise and comprehensive analysis of API call arguments. This change addresses a limitation where such parameters were previously overlooked, improving the overall fidelity of the extracted features.

Highlights

  • VMRay Feature Extraction Enhancement: Introduced a mechanism to correctly extract numerical features from specific void_ptr parameters (e.g., hKey, hKeyRoot) during VMRay call analysis, which were previously skipped.
  • Whitelisted Parameters: Defined a VOID_PTR_NUMBER_PARAMS frozenset to explicitly list void_ptr parameters that should be interpreted as numbers, including hKey, hKeyRoot, hkResult, and samDesired.
  • Robust Parsing: Implemented parsing logic with error handling to convert the string representation of these whitelisted void_ptr values into numerical features, logging debug messages for any parsing failures.
  • Test Coverage: Added a new test, test_vmray_hkey_whitelist, to ensure the VOID_PTR_NUMBER_PARAMS frozenset contains all expected whitelisted parameters.
  • Changelog Update: Updated the CHANGELOG.md to document the new feature of extracting number features from whitelisted void_ptr parameters in VMRay.

🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console.

Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

@AdeboyeDN AdeboyeDN changed the title Issue 2815 extract hkey from void ptr vmray: extract number features for registry key handles Jan 23, 2026

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Code Review

This pull request introduces a useful feature to extract numeric values from specific void* parameters in VMRay logs, which is particularly helpful for analyzing registry-related API calls. The implementation is clean, includes error handling, and is accompanied by a new test and a changelog entry. My review includes a suggestion to make the new test stricter to better safeguard against unintended changes to the parameter whitelist.

Comment thread tests/test_vmray_features.py Outdated
AdeboyeDN and others added 3 commits January 23, 2026 07:55
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
Comment thread tests/test_vmray_features.py Outdated

@mike-hunhoff mike-hunhoff left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

nice work @AdeboyeDN , I've left a couple of quick comments for your review.

Comment thread CHANGELOG.md Outdated
Comment thread tests/test_vmray_features.py
@mike-hunhoff

Copy link
Copy Markdown
Collaborator

Also, @AdeboyeDN please sync your branch with master.

@mike-hunhoff mike-hunhoff added this to the v10 milestone Jan 26, 2026
@AdeboyeDN

Copy link
Copy Markdown
Contributor Author

@mike-hunhoff everything should be good now

@AdeboyeDN

Copy link
Copy Markdown
Contributor Author

Hi @mike-hunhoff , I see you’ve approved the PR. Is there anything else blocking it from being merged?

@mike-hunhoff

Copy link
Copy Markdown
Collaborator

Hi @mike-hunhoff , I see you’ve approved the PR. Is there anything else blocking it from being merged?

@AdeboyeDN your PR looks good, but I'm waiting on a bug to be fixed in the upstream so we can run the unit tests here to verify that they fully pass. Thank you for your patience.

@mike-hunhoff
mike-hunhoff merged commit 77440c0 into mandiant:master Jan 30, 2026
34 checks passed
saniyafatima07 pushed a commit to saniyafatima07/capa that referenced this pull request Jun 17, 2026
* vmray: extract number features for whitelisted void_ptr parameters

* added changelog

* Apply suggestions from code review

Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>

* fix lint

* fix lint

* fix test

* remove unused import

* Add hKey parameter extraction and tests

---------

Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
Co-authored-by: Mike Hunhoff <mike.hunhoff@gmail.com>
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.

vmray: missing hKey values

3 participants