Buffer Overflow Attacks
Warning
This post is more than a year old. Information may be outdated.
Buffer Overflow
- In C, many strings-related functions do not check the bound.
- It may start to overwrite a fixed-sized array.
- A savvy users may put a long input array, overwriting the return address with desired value.
Preventing Such Exploits
- Use better functions.
scanf→sscanfgets→getlinestrcpy→strncpystrcat→strncat
- Use Canary Values
- Compiler inserts random unique values--canary values--before return address
- If the canary values are modified, crash.
- Address Space Layout Randomization (ASLR)
Comments