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

Heap module broken when inspecting static binary #755

Open
minium opened this issue May 11, 2020 · 2 comments
Open

Heap module broken when inspecting static binary #755

minium opened this issue May 11, 2020 · 2 comments

Comments

@minium
Copy link

@minium minium commented May 11, 2020

Description

When trying to inspect the heap of a binary (specifically lab7A from the Modern Binary Exploitation training), I get the following error:

In file included from /tmp/pwndbg/x86-64_struct-malloc_state.cc:74:
/usr/include/pcre2.h:965:2: error: #error PCRE2_CODE_UNIT_WIDTH must be defined before including pcre2.h.
  965 | #error PCRE2_CODE_UNIT_WIDTH must be defined before including pcre2.h.
      |  ^~~~~
/usr/include/pcre2.h:966:2: error: #error Use 8, 16, or 32; or 0 for a multi-width application.
  966 | #error Use 8, 16, or 32; or 0 for a multi-width application.
      |  ^~~~~
In file included from /tmp/pwndbg/x86-64_struct-malloc_state.cc:133:
/usr/include/nc_tparm.h:39:10: fatal error: ncurses_cfg.h: No such file or directory
   39 | #include <ncurses_cfg.h>
      |          ^~~~~~~~~~~~~~~
compilation terminated.

It seems to be related to missing dependencies. I only see this behaviour when compiling the binary statically.

Steps to reproduce

First run the binary:

gdb ./lab7A

Then inside of GDB:

b main
r
heap

My setup

Here are the version details

Gdb:      9.1
Python:   3.8.2 (default, Apr  1 2020, 15:52:55)  [GCC 9.3.0]
Pwndbg:   1.1.0 build: f90db72
Capstone: 4.0.1024
Unicorn:  1.0.1

Also, I'm running the latest kali version:

Linux kali 5.5.0-kali2-amd64 #1 SMP Debian 5.5.17-1kali1 (2020-04-21) x86_64 GNU/Linux
@zachriggle
Copy link
Member

@zachriggle zachriggle commented Jul 7, 2020

This looks like we need to add more headers to the blacklist for compilation. Can you post the full GDB command that's executed?

Also, can you attach the lab7A file? You should be able to zip it up and drag+drop.

@Ben-Lichtman
Copy link

@Ben-Lichtman Ben-Lichtman commented Jul 21, 2020

I am having a similar issue with #include <QCoreApplication> from QT libraries. Any pointers to where in the code this blacklist is implemented?

Edit: I found the blacklist https://github.com/pwndbg/pwndbg/blob/970ac229a835fa1f5d7aeaf8cf8b3770804df841/pwndbg/typeinfo.py However i'm having a lot of trouble adding all the right headers to it to get the heap command working. There must be a smarter way to do it...

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

Successfully merging a pull request may close this issue.

None yet
3 participants
You can’t perform that action at this time.