Modern gcc compiler (v9.2.0) protects the stack by default and you will notice it because instead of SIGSEGV on stack overflow you will get a SIGABRT, but it also generates coredumps.
The memset overflows the four bytes stack variable and modifies the canary value.
The 64bits canary 0x5429851ebaf95800 can't be predicted, but in specific situations is not re-generated and can be bruteforced or in other situations can be leaked from memory for example using a format string vulnerability or an arbitrary read wihout overflowing the stack.
If the canary doesn't match, the libc function __stack_chck_fail is called and terminates the prorgam with a SIGABORT which generates a coredump, in the case of archlinux managed by systemd and are stored on "/var/lib/systemd/coredump/"
❯❯❯ ./test
*** stack smashing detected ***:
fish: './test' terminated by signal SIGABRT (Abort)
[sudo] password for xxxx:
Decoding file core.test.1000.c611b7caa58a4fa3bcf403e6eac95bb0.1121.1574354610000000
core.test.1000.c611b : decoded 249856 bytes
❯❯❯ sudo gdb /home/xxxx/test core.test.1000.c611b7caa58a4fa3bcf403e6eac95bb0.1121.1574354610000000 -q
We specify the binary and the core file as a gdb parameters. We can see only one LWP (light weight process) or linux thread, so in this case is quicker to check. First of all lets see the back trace, because in this case the execution don't terminate in the segfaulted return.
We can see on frame 5 the address were it would had returned to main if it wouldn't aborted.
Happy Idea: we can use this stack canary aborts to detect stack overflows. In Debian with prevous versions it will be exploitable depending on the compilation flags used.
And note that the canary is located as the last variable in the stack so the previous variables can be overwritten without problems.
Related posts
- Hacker Tools For Mac
- Hacker Tools For Pc
- Easy Hack Tools
- Free Pentest Tools For Windows
- Free Pentest Tools For Windows
- Pentest Tools List
- Game Hacking
- Pentest Tools For Windows
- Termux Hacking Tools 2019
- Best Pentesting Tools 2018
- Pentest Tools Framework
- Top Pentest Tools
- Usb Pentest Tools
- Wifi Hacker Tools For Windows
- World No 1 Hacker Software
- New Hack Tools
- Tools 4 Hack
- Hacker Tools For Mac
- Free Pentest Tools For Windows
- Hack Tools
- Bluetooth Hacking Tools Kali
- Hacks And Tools
- Pentest Tools Url Fuzzer
- Game Hacking
- Hacker Tools Github
- Growth Hacker Tools
- Hack Tools Download
- Hacking Tools Github
- Hacking Tools For Windows 7
- Hacking Tools For Pc
- Growth Hacker Tools
- Hacking Apps
- Physical Pentest Tools
- Hacking Tools
- Pentest Tools
- Pentest Tools For Android
- Nsa Hack Tools Download
- Pentest Tools Free
- Pentest Tools For Windows
- Nsa Hacker Tools
- Hacker Tools Hardware
- Hacking Apps
- Pentest Tools For Android
- Hack Tool Apk
- Android Hack Tools Github
- Hacker Tools For Windows
- Hacker Techniques Tools And Incident Handling
- How To Make Hacking Tools
- Hacking Tools For Windows
- Hack Tools For Pc
- Pentest Tools Online
- Pentest Tools Apk
- How To Hack
- Hacker
- Pentest Tools Tcp Port Scanner
- Pentest Tools Kali Linux
- Free Pentest Tools For Windows
- Hack Tools For Games
- Pentest Tools Website
- Hacking Apps
- How To Make Hacking Tools
- Pentest Tools Download
- Free Pentest Tools For Windows
- Hack Tools For Windows
- Hacker Tools Mac
- Hacks And Tools
- Hacking Tools Windows 10
- Hack Tools For Pc
- Hacking Tools Mac
- Hacking Tools 2019
- Hacking Tools Windows 10
- Pentest Automation Tools
- New Hacker Tools
- Hack Tools Online
- Pentest Tools Alternative
- Hacking Tools 2019
- Easy Hack Tools
- Hack Tools Online
- Hacker Tools 2019
- Hak5 Tools
- Pentest Recon Tools
- Hack Tools Online
- Physical Pentest Tools
- Best Hacking Tools 2019
- Hack Tools Download
- World No 1 Hacker Software
- How To Hack
- Hacker Tools For Pc
- Best Hacking Tools 2020
- Pentest Tools Port Scanner
- Hacking Tools Mac
- Pentest Tools Linux
- Hacker Tools List
- Hack Tools 2019
- Pentest Tools
- Android Hack Tools Github
- Hacker Tools 2019
- Hack Tools For Mac
- Hack Rom Tools
- Hacker Tools Software
- Game Hacking
- Hacking Tools For Windows Free Download
- Bluetooth Hacking Tools Kali
- Hacker Tools Free
- Tools For Hacker
- Hacking Tools
- Pentest Tools Kali Linux
- Pentest Tools Framework
- Hacker
- Physical Pentest Tools
- How To Make Hacking Tools
- Hacker Tools Software
- Hacker Tools Free
- Nsa Hack Tools