Vector35 / Vector35/binaryninja-api

Structure members not created when using shifted pointers

Open
#4,584 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Component: Core Effort: Low Impact: Low
Dominant language
C++
Stars
1.3k
Forks
298
Avg merge
5d 5h
Merged PRs (30d)
19

Description

Version and Platform (required):

  • Binary Ninja Version: 3.5.4480-dev, 60681746
  • OS: windows
  • OS Version: 11
  • CPU Architecture: x86_64

Bug Description:
Normally if a structure is defined with a size, but with undefined members (like a new structure with size 0x200 but no members specified), when those members are referenced (e.g. arg1->__offset(0x20)) Binary Ninja gives the option to create members for the structure based on the references in HLIL.

However, when the type is a shifted pointer (e.g. int64_t* __offset(VstorDeviceExtension, 0x20) arg2), and then operations on an undefined member occur with the shifted pointer (e.g. (arg2 - 0x20)->__offset(0x108)), I'd expect to be able to create all members for the VstorDeviceExtensions like normal, as Binary Ninja knows that arg2 - 0x20 is referencing the start of VstorDeviceExtension and the __offset(0x108) is a member of VstorDeviceExtension at offset 0x108.

However this option to create all members for the structure is not available in the UI.

Steps To Reproduce:

  1. Create a structure/type with a size and no defined members
  2. Create an offset pointer to somewhere within the type
  3. Note that when that offset pointer references an undefined member of the parent type, the UI does not give the option to auto-detect and define the members

Expected Behavior:
The UI should provide the option to auto-create members at the referenced offsets for shifted pointers

Screenshots:

Additional Information:

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the shifted-pointer case in the UI using the structure, offset pointer, and HLIL references described in the issue. Trace the existing auto-create-members behavior for ordinary undefined structure references and make the shifted-pointer case offer equivalent member creation at the referenced offsets; verify both cases in the UI.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
reverse-engineering
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.