Sins of Buffer Overrun Flashcards
What is a buffer overrun?
A buffer overrun occurs when a program allows input to write beyond the end of the allocated buffer.
What is a buffer in programming?
A buffer is a piece of memory allocated to a variable by a programmer.
Give an example of a buffer declaration in Java.
Integer names = new String[10];
What can happen if more data is provided than a buffer expects?
It can result in an application crash or exploitation.
Why are lower-level languages like C and C++ more affected by buffer overruns?
Because they allow direct memory manipulation, unlike higher-level languages like C# and Java which have garbage collectors that manage memory.
Which level languages are more affected by buffer overruns and why?(provide level, 2 example languages and motivation)
Lower level languages like C and C++, because they allow direct memory manipulation, unlike higher-level languages like C# and Java which have garbage collectors that manage memory.
Name some related security issues to buffer overruns.
Integer overflows, format string bugs, and unbounded write to an array.
What is a basic redemption method for preventing buffer overruns?
Validate user input to ensure it does not exceed buffer boundaries.
What should you do to safely manage buffer accesses in your code?
Use safe string and buffer handling functions, and understand the implications of custom buffer-copying code.
Name a compiler-based defense against buffer overruns.
Using options like /GS in compilers.
What is a recommended operating system-level defense against buffer overruns?
Data Execution Prevention (DEP) and PaX.
What is address randomization, and how is it used in defending against buffer overruns?
Address Space Layout Randomization (ASLR) randomizes memory addresses to make buffer overruns more difficult to exploit, such as /dynamicbase in Windows.
Why is it important to understand what data the attacker controls?
To manage that data safely in your code and prevent security vulnerabilities.
Why should you not rely solely on compiler and OS defenses?
Because they are not sufficient on their own and should be complemented with safe coding practices
What should you avoid when writing new code to prevent buffer overruns?
Avoid using unsafe functions.