concept

Stack Canaries

Stack canaries are a security mechanism used in computer programs to detect and prevent stack buffer overflow attacks. They involve placing a small, random value (the 'canary') on the stack between the local variables and the return address, and checking its integrity before a function returns. If the canary has been altered, it indicates a buffer overflow has occurred, and the program typically terminates to prevent exploitation.

Also known as: Stack cookies, Stack guards, Stack protector, Canary values, Buffer overflow protection
🧊Why learn Stack Canaries?

Developers should learn and use stack canaries when building software in languages like C or C++ that are vulnerable to buffer overflows, especially for security-critical applications such as operating systems, web servers, or embedded systems. They are essential for mitigating common exploits like return-oriented programming (ROP) and should be implemented alongside other defenses like address space layout randomization (ASLR) and non-executable stacks to provide layered protection.

Compare Stack Canaries

Learning Resources

Related Tools

Alternatives to Stack Canaries