Vector35 / binaryninja-api

Public API, examples, documentation and issues for Binary Ninja
https://binary.ninja/
MIT License
888 stars 198 forks source link

prevent Binary Ninja from being installed in BNGetUserDirectory() #5660

Open arcturus-prime opened 2 months ago

arcturus-prime commented 2 months ago

Version and Platform (required):

Bug Description: Attempting to start a fresh copy of Binary Ninja results in a panic about SetLoggerError. The file paths are related to dwarf_import and dwarf_export. After disabling these and the RISC-V architecture plugin, it starts without -p. The error message prior to disabling anything is:

thread '<unnamed>' panicked at 'Unable to initialize logger: SetLoggerError(())', examples/dwarf/dwarf_export/src/lib.rs:786:30
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
fatal runtime error: failed to initiate panic, error 5

After temporarily starting with -p and disabling the Dwarf Import and Dwarf Export core plugins:

thread '<unnamed>' panicked at 'Failed to set up logging: SetLoggerError(())', src/lib.rs:2855:56
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
Aborted (core dumped)

At this point, using the debug log flag reveals this at the time of the panic:

[0:11103607258094950935 Core info] Loaded native plugin arch_riscv
[0:11103607258094950935 Core debug] Plugin Path: /home/arcprime/.binaryninja/plugins/libarch_riscv.so

Disabling the RISC-V architecture plugin resolves this last message and allows Binary Ninja to start without -p.

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

  1. Start Binary Ninja through the command line
  2. Error immediately appears

Expected Behavior: Binary Ninja should succeed in loading with the core plugins enabled.

Additional Information: I attempted to switch to the dev channel as suggested, both after starting with -p and after disabling these specific plugins. I was met with an error message which is attached below. Dismissing this error allowed Binary Ninja to start, but there was no change in the channel.

Screenshot from 2024-06-24 18-42-51

psifertex commented 2 months ago

Try using https://binary.ninja/recover/ requesting the dev branch. This almost sounds like some file corruption.

psifertex commented 2 months ago

Can also double check the stable installer hashes against https://binary.ninja/js/hashes.js (though not dev)

arcturus-prime commented 2 months ago

I just verified the hash for stable, it matches. I will request the dev branch though.

arcturus-prime commented 2 months ago

I requested the developer builds and I am encountering the same exact issue with those. Disabling the 3 plugins resolves the error as before.

arcturus-prime commented 2 months ago

After deleting my configuration in .config and installing to another location, I seem to resolved the issue. In all honesty, I don't really know what the issue was there.

psifertex commented 2 months ago

Very strange. No idea what might have caused that but glad it's resolved. Thanks for letting us know.

arcturus-prime commented 2 months ago

Actually, I just realized that Binary Ninja makes a folder named .binaryninja in $HOME. In a spectacular failure, I happened to name the installation folder the same thing. User fail.

psifertex commented 2 months ago

Ohhh, that will do it. We'll actually throw a warning into the product to prevent that. You might not be the first person to have done it. Makes way more sense now why the update failed.

I'm going to re-open this issue to track that guard-rail.

xusheng6 commented 1 month ago

Since on Linux installing binja merely means to extract it, we cannot really prevent people from accidentally installing binja into that directory. Probably need to detect the case and throw a warning in a more discoverable way