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

ELF may load debuginfo to get more symbols #2489

Open
RocketMaDev opened this issue Oct 16, 2024 · 3 comments
Open

ELF may load debuginfo to get more symbols #2489

RocketMaDev opened this issue Oct 16, 2024 · 3 comments
Labels

Comments

@RocketMaDev
Copy link

Now the class ELF could load executables perfectly, but some symbols could not be found in libc.so.6 for optimization. However, these debug symbols are included in its debuginfo which could be downloaded via debuginfod on multiple distros. When I try to load the debuginfo so that I have more symbols to access, it failed, as it was detecting relro.

---> 19 libc = ELF('./lib/libc.debuginfo')
File /usr/lib/python3.12/site-packages/pwnlib/elf/elf.py:362, in ELF.__init__(self, path, checksec)
File /usr/lib/python3.12/site-packages/pwnlib/elf/elf.py:457, in ELF._describe(self, *a, **kw)
File /usr/lib/python3.12/site-packages/pwnlib/elf/elf.py:2069, in ELF.checksec(self, banner, color)
File /usr/lib/python3.12/site-packages/pwnlib/elf/elf.py:1702, in ELF.relro(self)
File /usr/lib/python3.12/site-packages/pwnlib/elf/elf.py:1604, in ELF.dynamic_by_tag(self, tag)
AttributeError: 'Section' object has no attribute 'iter_tags'

If the ELF class could pass these checks for debuginfo, more symbols could be grabbed.

@peace-maker
Copy link
Member

We should be able to open such ELF files, yes.
In the meantime you can use libcdb.unstrip_libc to grab the debuginfo and merge the debuginfo back into the libc via eu-unstrip. Then you can use all symbols on the original libc.so.6.

@RocketMaDev
Copy link
Author

But it just failed to load the debuginfo directly. Do you mean that I can only load it after unstrip_libc?

@peace-maker
Copy link
Member

We should fix loading external debuginfo files with the ELF class.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants