I'm now reading The Shellcoder's Handbook: Discovering and Exploiting Security Holes, 2nd Edition.
In the second chapter considered the simple buffer overflow problem like this (C code):
int main () {
int array[5];
int i;
for (i = 0; i <= 255; i++ ) {
array[i] = 10;
}
}
Author compiled the code with cc and execute it:
shellcoders@debian:~/chapter_2$ cc buffer2.c
shellcoders@debian:~/chapter_2$ ./a.out
Segmentation fault (core dumped)
then had a peek at written core dump with gdb:
shellcoders@debian:~/chapter_2$ gdb -q -c core
Program terminated with signal 11, Segmentation fault.
#0 0x0000000a in ?? ()
(gdb)
The problem is that core dump haven't been written in my case. I have only message: zsh: segmentation fault ./a.out.
I use Kali 2021.4a in VirtualBox. I have been tried to change default shell with chsh -s /bin/bash but it change nothing and terminal keep opens as zsh.
How to make core dump written on fault? Looks it's should be file written in the same directory with executable file.
/var/lib/systemd/coredump, e.g.sudo ls -la /var/lib/systemd/coredumpcoredumpctl gdb $MYPIDjournalctlmaybe there is information why core dump isn't created. Also check here: fromdual.com/hunting-the-core