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:
- Open database: bright moon dreams happily (this is new version uploaded just now to portal)
- Navigate to
0x27a00c9and take note of howpayloadlooks before rebase. - 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.) - Navigate to
0x27a0dde(this is above the start of the string so you don’t have to scroll for a million years and whatnot). - Analysis menu -> Rebase
- Change
0x27a0000to0x2780000 - Click Accept
- Navigate to
0x27800c9 - Note how
0x3cbecame0x2003c
Expected Behavior: The data symbol addresses rebase with everything else.
Screenshots/Video Recording: Before:
After:
About this issue
- Original URL
- State: closed
- Created 2 years ago
- Comments: 42 (42 by maintainers)
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:
And screenshots of the database look nice again:
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.maxGlobalPointerValueUpdates0for all binaries (if you desired). It’s showing10because you only overrode that setting for a single binary throughOpen with Options.Also, I tested
#3with 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 reachinganalysis.limits.maxGlobalPointerValueUpdatesI agree with
#2(not ruling out#3though, just not seeing that behavior on normal binaries that use a GP)I watched your videos and see what you mean.
#1and#4are 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 theanalysis.limits.maxGlobalPointerValueUpdateswas set to0and therefore it’s actuallyundetermined.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.