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.
In this case the compiler adds the variable local_10. This variable helds a canary value that is checked at the end of the function.
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 ***: terminated
fish: './test' terminated by signal SIGABRT (Abort)
❯❯❯ sudo lz4 -d core.test.1000.c611b7caa58a4fa3bcf403e6eac95bb0.1121.1574354610000000.lz4
[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.
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 links
- Hack Tool Apk
- Pentest Tools Online
- Hackers Toolbox
- Pentest Tools Website
- Termux Hacking Tools 2019
- Blackhat Hacker Tools
- Pentest Tools Tcp Port Scanner
- Hacking Tools Hardware
- Nsa Hacker Tools
- Pentest Tools Website
- Kik Hack Tools
- Hacking Tools And Software
- Termux Hacking Tools 2019
- Pentest Tools Tcp Port Scanner
- Hacking Tools Windows 10
- Hacking Tools Github
- Pentest Tools Bluekeep
- Hacker Tools Hardware
- Beginner Hacker Tools
- Pentest Recon Tools
- Hacking Apps
- Hack Apps
- Hacking Tools Online
- Hacking Tools For Pc
- Black Hat Hacker Tools
- Physical Pentest Tools
- Nsa Hack Tools
- Hacking Tools 2019
- Hacking Tools Windows
- Hacking Tools 2020
- How To Hack
- Hacking Tools For Kali Linux
- Hacking Tools Github
- Hacker Tools Mac
- Hacking Apps
- Hacker Tools Free
- Hacker Tools List
- World No 1 Hacker Software
- Hackrf Tools
- Pentest Tools Nmap
- Hacker Tools For Mac
- Hack Tools 2019
- Hacking Tools Usb
- Best Pentesting Tools 2018
- Hacking Tools And Software
- Hacker Tools For Windows
- Pentest Tools Github
- Hacker Tools Mac
- Hacking Tools Mac
- Underground Hacker Sites
- Hack Tools For Pc
- How To Make Hacking Tools
- Hacking Tools For Games
- Hacking Tools Software
- Hacking Tools For Pc
- Hacker Security Tools
- Top Pentest Tools
- Pentest Tools
- Pentest Tools
- Hack Website Online Tool
- Pentest Tools Online
- Free Pentest Tools For Windows
- Github Hacking Tools
- Hacking Tools For Mac
- Tools Used For Hacking
- Pentest Tools For Windows
- Pentest Recon Tools
- Pentest Tools Online
- Hacker Tools
- Hacker Hardware Tools
- Hack Tools For Mac
- Hacker Tools For Windows
- Hack Tools Download
- Hack Tools Download
- Hack Tools Download
- Hacking Tools For Windows Free Download
- Hacking Tools Kit
- Hacker
- Hacking Tools For Kali Linux
- Pentest Tools Online
- Hack Tools For Mac
- Hacker Tools Free Download
- Hack Tools For Ubuntu
- What Are Hacking Tools
- Underground Hacker Sites
- Hacker Search Tools
- Hacking Tools For Kali Linux
- Hacking Tools
- Hacking Tools For Kali Linux
- Best Pentesting Tools 2018
- Pentest Recon Tools
- Hacker Tools Linux
- Hacking Tools Windows 10
- Hacking Tools Pc
- Hacker Tools Linux
- Hacker Tools Apk
- Hacking Tools For Kali Linux
- Best Hacking Tools 2019
- Best Hacking Tools 2019
- Hacking Tools Mac
- Pentest Tools For Android
- Hackrf Tools
- Hacking Tools Pc
- Pentest Tools Kali Linux
- Hacker Tool Kit
- Top Pentest Tools
- Hak5 Tools
- Pentest Tools Open Source
- Hacking Tools For Kali Linux
- Hacker Tools
- Hacker Security Tools
- Hacking Tools Name
- Pentest Tools Find Subdomains
- Hack Tools Github
- Hacking Tools For Games
- What Is Hacking Tools
- Hack Tool Apk
- Hacking Tools Name
- Bluetooth Hacking Tools Kali
- Hacking Tools Free Download
- Hacker Tools Free Download
- Hackrf Tools
- Hacker Tools Free
- Pentest Box Tools Download
- Pentest Reporting Tools
- Pentest Tools For Android
- Pentest Tools Bluekeep
- Hacker Tools For Pc
- Hacker Tools List
- Hacking Tools Name
- Hacker Tools For Ios
- Hack Rom Tools




