Closed DERE-ad2001 closed 1 year ago
Can you send the stack dump? It will be shown if you enable the debug mode (gef config gef.debug 1
)
gef➤ gef config gef.debug 1
gef➤ gef-remote localhost 1234
[=] [remote] initializing remote session with localhost:1234 under /tmp/tmpxg8r95uo
[=] [remote] Installing new objfile handlers
[=] [remote] Enabling extended remote: False
[=] [remote] Executing 'target remote localhost:1234'
warning: remote target does not support file transfer, attempting to access files from local filesystem.
warning: Unable to find dynamic linker breakpoint function.
GDB will be unable to debug shared library initializers
and track explicitly loaded dynamic code.
0x000000550283c980 in ?? ()
[=] Setting up as remote session
[=] [remote] downloading '/proc/1/exe' -> '/tmp/tmpxg8r95uo/tmp/my_issue'
─────────────────────────────── Exception raised ───────────────────────────────
error: Remote I/O error: Function not implemented
───────────────────────────── Detailed stacktrace ──────────────────────────────
↳ File "/home/ubuntu/.gdbinit-gef.py", line 10823, in sync()
→ gdb.execute(f"remote get {src} {tgt.absolute()}")
↳ File "/home/ubuntu/.gdbinit-gef.py", line 10902, in __setup_remote()
→ if not self.sync(fpath, str(self.file)):
↳ File "/home/ubuntu/.gdbinit-gef.py", line 10857, in setup()
→ self.__setup_remote()
↳ File "/home/ubuntu/.gdbinit-gef.py", line 10764, in __init__()
→ if not self.setup():
↳ File "/home/ubuntu/.gdbinit-gef.py", line 5981, in do_invoke()
→ gef.session.remote = GefRemoteSessionManager(args.host, args.port, args.pid, qemu_binary)
↳ File "/home/ubuntu/.gdbinit-gef.py", line 504, in wrapper()
→ return f(*args, **kwargs)
↳ File "/home/ubuntu/.gdbinit-gef.py", line 256, in wrapper()
→ rv = f(*args, **kwargs)
↳ File "/home/ubuntu/.gdbinit-gef.py", line 4504, in invoke()
→ bufferize(self.do_invoke)(argv)
─────────────────────────────────── Version ────────────────────────────────────
GEF: (Standalone)
Blob Hash(/home/ubuntu/.gdbinit-gef.py): 8875fc48f622386dc807eff5dd47c2d754a04498
SHA256(/home/ubuntu/.gdbinit-gef.py): 7dd1bd86d8694b4046a3e1343ebb153cf2c4685edecf99aadbdacec18a94d93b
GDB: 13.1
GDB-Python: 3.11
obsolete loaded_command_names
Loaded commands: $, aliases, aliases add, aliases ls, aliases rm, aslr, canary, checksec, context, dereference, edit-flags, elf-info, entry-break, format-string-helper, functions, gef-remote, got, heap, heap arenas, heap bins, heap bins fast, heap bins large, heap bins small, heap bins tcache, heap bins unsorted, heap chunk, heap chunks, heap set-arena, heap-analysis-helper, hexdump, hexdump byte, hexdump dword, hexdump qword, hexdump word, highlight, highlight add, highlight clear, highlight list, highlight remove, hijack-fd, ksymaddr, memory, memory list, memory reset, memory unwatch, memory watch, name-break, nop, patch, patch byte, patch dword, patch qword, patch string, patch word, pattern, pattern create, pattern search, pcustom, pcustom edit, pcustom list, pcustom show, pie, pie attach, pie breakpoint, pie delete, pie info, pie remote, pie run, print-format, process-search, process-status, registers, reset-cache, scan, search-pattern, shellcode, shellcode get, shellcode search, stub, theme, trace-run, version, vmmap, xfiles, xinfo, xor-memory, xor-memory display, xor-memory patch
───────────────────────────── Last 10 GDB commands ─────────────────────────────
139 c
140 ni
141 exit
142 set sysroot /usr/aarch64-linux-gnu/
143 gef-remote localhost 1234
144 gef-remote localhost 1234
145 exit
146 file my_issue
147 gef config gef.debug 1
148 gef-remote localhost 1234
───────────────────────────── Runtime environment ──────────────────────────────
* GDB: 13.1
* Python: 3.11.2 - final
* OS: Linux - 6.2.0-25-generic (x86_64)
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 23.04
Release: 23.04
Codename: lunar
────────────────────────────────────────────────────────────────────────────────
Try again using the qemu-user mode: see the docs https://hugsy.github.io/gef/commands/gef-remote/
Still having the same issue
It looks like GDB changed their API. We'll look into it
It works just fine (with the correct syntax) using the gdb-multiarch packaged with ubuntu 23.04.
The problem must come from your setup. Check your GDB and try using the latest gef.py from the main branch.
GEF+GDB version
Operating System
Ubuntu 23.04
Issues encountered
When i trying to remotely debug a aarch64 compiled binary using gef, i get the below error.
i compiled the program using :
aarch64-linux-gnu-gcc rop1.c -o rop1 -fno-stack-protector
Ran using qemu:
$ qemu-aarch64 -g 1234 -L /usr/aarch64-linux-gnu/ ./rop1
And used gef.
Do you read the docs and look at previously closed issues/PRs for similar cases?
Yes
Architecture impacted
Reproducing the issue
Compiled the binary :
ubuntu@ubuntu2304:/tmp$ sudo aarch64-linux-gnu-gcc -fPIE -fpic my_issue.c -o my_issue
Running the binary for remote debugging:
ubuntu@ubuntu2304:/tmp$ sudo qemu-aarch64 -g 1234 -L /usr/aarch64-linux-gnu/ my_issue
Remote debugging using gef:
Minimalist test case