Security Measures
Understanding security measures in the debugged environment.
These commands are helpful for further dissection of the security measures placed on the binary.
checksec
checksec
The checksec
command is inspired by the checksec
used on the command line. It's a convenient way to check security within gdb
.
Fortify is a security feature we haven't seen yet; it's a compile-time feature that adds extra checks to detect buffer overflows. I haven't written any articles on fortified binaries yet, but you can read more here.
canary
canary
The canary
tool is one of my favorite GEF tools, and what sets it apart from the other gdb
extensions. This command finds the canary value and prints its location and value.
This makes locating the canary on the stack much easier:
aslr
aslr
You can enable or disable ASLR on the debugged binary. Remember that this is an internal GEF setting and does not affect ASLR on the kernel. Since we never know if ASLR is running on a remote binary, we should assume it is on.
This will not work on a process that was loaded and gdb
was then attached. You must initiate the process using gdb
.
pie
pie
The pie
command is used when handling position-independent executables (PIE enabled). It provides a series of commands instead of the typical gdb
commands that automatically resolve absolute addresses for the run.
Use pie breakpoint <offset>
to set a breakpoint. It can be used like the normal b
command in gdb
and will automatically resolve the address.
Use pie info
the same way you would use info break
in gdb
. This lists the breakpoints.
Use pie delete <number>
to delete a breakpoint. It can be used like the normal delete
command in gdb
.
Finally, when running the binary, use pie run
instead of the typical run
command. This converts the PIE breakpoints to real breakpoints at runtime.
Last updated