binaryninja-api: Rebase Doesn't Change Data Symbol Address

Version and Platform (required):

  • Binary Ninja Version: 5.0.7202-dev
  • OS: macOS
  • OS Version: 15.4
  • CPU Architecture: x64

Bug Description: You all fixed a crash that was happening right at rebase (Thanks!!). Crash is gone, but there is now a bug in rebase itself. The data symbol address for the payload DLL does not rebase with the rest of the database. All references to that data symbol are off by difference in old and new base.

Steps To Reproduce:

  1. Open database: bright moon dreams happily (this is new version uploaded just now to portal)
  2. Navigate to 0x27a00c9 and take note of how payload looks before rebase.
  3. Double click on payload (beachball here on my UI and it lands at the end of the string which may be intentional but odd with large string.)
  4. Navigate to 0x27a0dde (this is above the start of the string so you don’t have to scroll for a million years and whatnot).
  5. Analysis menu -> Rebase
  6. Change 0x27a0000 to 0x2780000
  7. Click Accept
  8. Navigate to 0x27800c9
  9. Note how 0x3c became 0x2003c

Expected Behavior: The data symbol addresses rebase with everything else.

Screenshots/Video Recording: Before:

Image

After:

Image

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Comments: 42 (42 by maintainers)

Most upvoted comments

It’s not that it’s “not rebasing” the global pointer value. It’s that the global pointer value isn’t computed by PC-relative code in this shellcode (because this shellcode doesn’t use a global pointer at all and is using ebx as a GPR). When you rebase the binary, the global pointer analysis runs again. In the case of this binary, the base address of the binary doesn’t effect the “global pointer value”.

I have tested multiple MIPS binaries that actually use a GP and where the value of the global pointer is computed via PC-relative code and found that when rebasing, the global pointer is updated correctly.

Thanks for all your help! And with the workaround my database looks the same as x64dbg now:

Image

And screenshots of the database look nice again:

Image

After you’ve opened the binary, if you open settings from the command palette the values will not reflect the values of the opened binary view. The settings dialog will show global settings, so you have the option to make analysis.limits.maxGlobalPointerValueUpdates 0 for all binaries (if you desired). It’s showing 10 because you only overrode that setting for a single binary through Open with Options.

Also, I tested #3 with MIPS binaries that actually use a global pointer register. After rebase, the global pointer value is being updated correctly. We likely don’t see that occur on your shellcode binary because it’s reaching analysis.limits.maxGlobalPointerValueUpdates

I agree with #2 (not ruling out #3 though, just not seeing that behavior on normal binaries that use a GP)

I watched your videos and see what you mean. #1 and #4 are really the same issue. The “Function Properties” UI shows the global pointer value that was identified by Binja, but doesn’t tell you that it has been overridden by the user or that the analysis.limits.maxGlobalPointerValueUpdates was set to 0 and therefore it’s actually undetermined.

In both cases though, analysis respected your desired behavior and the global pointer register remained undetermined (as shown from the Python console output). We just need to update the Function Properties dialog to show more information so it is known that the function isn’t using the Binja-identified gp value in that function.

Note: that DanaBot DLL contains a curse or something 🤣 or it is so heavy that binary ninja is having trouble picking it up and moving it. Maybe he adversary who compiled the DLL had too many fat electrons in their computer at the time and lots of them got trapped in this DLL.