Vector35 / Vector35/binaryninja-api

Edit current instruction generates wrong input text when an integer token's value is in the middle of a function

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

Nobody has claimed this yet.

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

Description

The title might be a bit confusing, but it is quite straightforward from the image. For the instruction at 0x40167f, the token is rendered as sub_4016f2+1 because there is a function at 0x4016f3.

Screenshot 2023-09-22 at 9 02 36 PM

Now if we press E to edit the current instruction, the candidate input text becomes this:

Screenshot 2023-09-22 at 9 04 27 PM

The input text can be assembled properly, but it is different from the original instruction. The operand will become 0x4016f4. The reason we get this is because we are dumping every token in a verbatim way, and for the sub_4016f2 token, its value is actually 0x4016f3.

Another interesting behavior is we can right click the token sub_4016f2 and set its integer display type to unsigned hex (rather than default), this will force the token to be rendered as 0x4016f3, which will avoid the above issue. Though this is not very discoverable since the user may think there are already two integer tokens, and setting the integer display types will only make things worse.

Database:
heaven.exe.bndb.zip

Original crackme: https://crackmes.one/crackme/64f1f77ad931496abf90951d

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

Reproduce the issue with the linked heaven.exe.bndb database at instruction 0x40167f, then trace the Edit current instruction flow and how integer tokens are rendered into candidate input text. Compare the displayed sub_4016f2+1 operand with the assembled result and verify that editing preserves the original instruction value.

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
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.