Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sections relocation in object files #4639

Open
Voxanimus opened this issue May 16, 2024 · 3 comments
Open

Sections relocation in object files #4639

Voxanimus opened this issue May 16, 2024 · 3 comments
Labels
enhancement Some subsystem of angr needs tweaking good first issue Good issue for getting introduced to the codebase help wanted Good issue for community involvement

Comments

@Voxanimus
Copy link

Question

I have a binary that have a problem in its ELF headers, this is creating problem while loading the file. The things is I use ghidra to check some interesting address an try to reach them with the simulation manager in angr, due to the absence of elf headers, the address that I found into ghidra does not match anything in the project loaded by angr.
Is there a way to remap the sections to be consistent with the memory map I have in ghidra ?

This is the memory map in ghidra
image

this is the sections in angr:
image

@Voxanimus Voxanimus added needs-triage Issue has yet to be looked at by a maintainer question Issues that do not require code changes labels May 16, 2024
@rhelmot
Copy link
Member

rhelmot commented May 16, 2024

Is this a .o file? Can you possibly attach it?

@Voxanimus
Copy link
Author

That's not a .o file, it's an ELF file. I put the file in a zip, github don't like it
my_binary.zip

@rhelmot
Copy link
Member

rhelmot commented May 17, 2024

This is a .o file, you can tell because file(1) identifies it as "relocatable" and it has no program headers. .o files are ELF files; the L in ELF stands for linkable.

there is no set standard for how to load .o files into a single address space, they are simply not meant to do that. angr compensates by doing a linking hackjob, which assigns addresses to each loadable section before relocating it and dumping in into memory. It would be possible to specify addresses for each section, but the infrastructure for it in cle simply doesn't exist, and I don't have the cycles to add it right now. I would accept a PR.

Probably an easier solution for you in this case would be to simply link this binary into an executable or shared object, and then load that into ghidra and angr. They will match up then, provided you set the correct base address.

@rhelmot rhelmot added enhancement Some subsystem of angr needs tweaking help wanted Good issue for community involvement good first issue Good issue for getting introduced to the codebase and removed question Issues that do not require code changes needs-triage Issue has yet to be looked at by a maintainer labels May 17, 2024
@ltfish ltfish changed the title Sections relocation Sections relocation in object files May 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Some subsystem of angr needs tweaking good first issue Good issue for getting introduced to the codebase help wanted Good issue for community involvement
Projects
None yet
Development

No branches or pull requests

2 participants