2

Using pwntools, I'm trying to use the Coredump method as per this part of the pwntools docs: https://docs.pwntools.com/en/latest/elf/corefile.html?highlight=using%20corefiles#using-corefiles-to-automate-exploitation

For testing purposes, I copy and pasted the code from this section (same as previous link). I used the same C file and compiled it in the same way, and copied the pwntools script and I would get the following error.

Traceback (most recent call last):
  File "crash_pwn.py", line 10, in <module>
    core = Coredump('./core')
  File "/home/nick/.local/lib/python3.8/site-packages/pwnlib/elf/corefile.py", line 546, in __init__
    super(Corefile, self).__init__(*a, **kw)
  File "/home/nick/.local/lib/python3.8/site-packages/pwnlib/elf/elf.py", line 218, in __init__
    self.mmap = mmap.mmap(self.file.fileno(), 0, access=mmap.ACCESS_COPY)
ValueError: cannot mmap an empty file

Upon further investigation, it seems that the core file that is generated by the script is empty (0 kb); not sure why this is.

NOTE: I am using WSL as opposed to a virtual machine for linux or anything like that. Not sure if that effects anything.

Nick Pfeiffer
  • 151
  • 2
  • 9

0 Answers0