MachoView should define imported symbols even if they are not presented in SYMTAB

Open
#7,196 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

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

Research direction

Start in view/macho/machoview.cpp around line 3121, then inspect how DYLD_INFO binding strings are handled alongside the symtab loop. Open the attached binary, navigate to 0x100004000, and verify that the imported symbol referenced by binding is defined even when symtab.nsyms is zero, so relocation analysis no longer leaves a null external symbol.

Written by the indexing model from the issue text.

Description

Component: BinaryViewType Effort: Low File Format: Mach-O Impact: Medium

Version and Platform (required):

  • Binary Ninja Version: 5.2.8012-dev Personal (aec518eb)

Bug Description:
Current implementation of MachoView relies on symtab when defining the symbols in the macho. However it is possible to bind imported (external) symbols even if they are not in the symtab, as binding from DYLD_INFO uses their own inlined strings. So for the cases when symbol is used in the binding, but not listed in the symtab, leads to the error with applying relocation during macho analysis.

Steps To Reproduce:
Please provide all steps required to reproduce the behavior:

  1. Open attached binary
  2. Go to 0x100004000
  3. There is null instead of external symbol

Expected Behavior:
I think MachoView should define symbols when they referenced in the dyld binding as well.

Screenshots/Video Recording:

Image Image

Binary:
bin.zip

Additional Information:
Definition of the imported macho symbol is nested in the loop over symtab, so if there is no symbols (symtab.nsyms == 0) then no symbols will be defined, it's incorrect.

https://github.com/Vector35/binaryninja-api/blob/2f1d09c6b714a9f2664eab0a9dbef79e3cbd8919/view/macho/machoview.cpp#L3121

Dominant language
C++
Stars
1.3k
Forks
298
Avg merge
5d 5h
Merged PRs (30d)
19

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.

More from Vector35/binaryninja-api

All issues in Vector35/binaryninja-api

Similar issues

More C++ issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.