ELI5: Explain Like I'm 5

Stack canary

Imagine you have a piggy bank that you want to keep your money safe in. You don't want anyone to steal your money, so you put a lock on the piggy bank. The lock has a special code that only you know. This way, if anyone tries to steal your money, they won't be able to open the piggy bank without the code.

A stack canary is kind of like a lock on your computer. When your computer runs a program, it puts important information, like the instructions for the program and the data it needs to use, into a special place called the stack. But sometimes, bad guys try to sneak into the stack and steal that information so they can do bad things with it. That's where the stack canary comes in.

The stack canary is like a little secret code that your computer puts into the stack when it starts running the program. This code is random and changing all the time. If a bad guy tries to sneak into the stack, they will try to steal information from the stack and use it to do bad things. But when they do that, they'll have to mess with the stack canary, too. If they mess with the stack canary, they'll change the code, and the computer will notice that the code has been changed. The computer will know that someone is trying to mess with the program and will stop the program before the bad guy can do any damage.

So, just like the lock on your piggy bank keeps your money safe, the stack canary keeps your computer program safe from bad guys who want to steal your information and use it for bad things.