Buffer Overflow Flashcards
The most common and used attack methods.
What is a buffer?
A. A permanent data storage
B. A memory segment for code execution
C. A temporary data storage area
D. A device driver interface
Answer: C
Explanation:
A buffer is a temporary storage region for data being transferred.
What causes a buffer overflow?
A. Too many threads
B. Excessive CPU usage
C. Writing more data than a buffer can hold
D. Lack of file descriptors
Answer: C
Explanation:
Buffer overflow happens when data exceeds the allocated memory space.
Which language is most prone to buffer overflow vulnerabilities?
A. Java
B. Python
C. C
D. Perl
Answer: C
Explanation:
C lacks built-in bounds checking mechanisms.
What is the most common type of buffer overflow attack?
A. Heap-based
B. Format string
C. Stack-based
D. Integer overflow
Answer: C
Explanation:
Stack-based attacks are easier and more common.
Which segment holds dynamically allocated memory?
A. BSS
B. Data
C. Heap
D. Stack
Answer: C
Explanation:
Heap is for dynamic memory (e.g., malloc).
Which segment stores local variables inside functions?
A. Stack
B. Data
C. Heap
D. BSS
Answer: A
Explanation:
Stack holds function call data, including local variables.
Which historical worm first exploited a buffer overflow?
A. SQL Slammer
B. Stagefright
C. Morris Worm
D. Code Red
Answer: C
Explanation:
The Morris Worm in 1988 used a buffer overflow vulnerability.
Buffer overflow often leads to what kind of memory issues?
A. Memory swapping
B. Memory leaks
C. Memory access violations
D. Memory garbage collection
Answer: C
Explanation:
It can overwrite memory leading to crashes or code execution.
What is SEHOP designed to protect against?
A. Heap fragmentation
B. Pointer arithmetic
C. SEH overwrite via stack overflow
D. Format string attacks
Answer: C
Explanation:
SEHOP blocks attacks on the exception handler system.
Which of the following is a runtime protection mechanism?
A. Firewall
B. IDS
C. ASLR
D. Encryption
Answer: C
Explanation:
Address Space Layout Randomization (ASLR) makes memory layout unpredictable.
Which type of attack overwrites the return pointer in the stack?
A. Format string attack
B. Stack-based overflow
C. Heap spraying
D. SQL injection
Answer: B
Explanation:
Stack overflows target return pointers to change program control.
What function is unsafe due to lack of bounds checking?
A. fgets()
B. printf()
C. gets()
D. memcpy()
Answer: C
Explanation:
gets() reads input without limiting size, causing overflows.
Which language is less vulnerable to buffer overflows?
A. C
B. Java
C. C++
D. Assembly
Answer: B
Explanation:
Java has built-in bounds-checking and memory management.
What does DEP stand for in buffer overflow protection?
A. Dynamic Execution Protocol
B. Data Entry Prevention
C. Data Execution Prevention
D. Device Event Processing
Answer: C
Explanation:
DEP marks memory as non-executable to block code execution.
Which segment stores global variables initialized to zero?
A. Stack
B. Heap
C. BSS
D. Text
Answer: C
Explanation:
The BSS segment holds zero-initialized global/static variables.
Which of the following does ASLR protect against?
A. Timing attacks
B. Side-channel attacks
C. Predictable memory layouts
D. Network sniffing
Answer: C
Explanation:
ASLR randomizes memory layout to prevent accurate attack targeting.
Buffer overflow attacks typically result from:
A. Invalid port access
B. Poor memory management
C. Slow network access
D. Log file corruption
Answer: B
Explanation:
Inadequate memory checks or allocation causes overflows.
What enables an attacker to execute arbitrary code using buffer overflow?
A. Code injection
B. DOS attack
C. SQL injection
D. Cross-site scripting
Answer: A
Explanation:
Buffer overflows often allow attackers to inject and run code.
What happens if an attacker overwrites a function pointer?
A. The program halts
B. The pointer is freed
C. The attacker controls program flow
D. Nothing, it is ignored
Answer: C
Explanation:
Control flow is hijacked if function pointers are compromised.
The process of copying more data than the buffer can handle is called:
A. Memory leak
B. Buffer overrun
C. Data injection
D. Stack unwinding
Answer: B
Explanation:
Buffer overrun is a synonym for buffer overflow.
Which part of memory contains executable code of a program?
A. Heap
B. Stack
C. Text segment
D. Data segment
Answer: C
Explanation:
The text segment holds the executable machine instructions.
Which of these vulnerabilities may arise from incorrect format specifiers?
A. Heap overflow
B. Format string attack
C. Buffer underrun
D. Memory leak
Answer: B
Explanation:
Format string vulnerabilities exploit unchecked input in format functions.
The ‘memcpy()’ function is unsafe because:
A. It is slow
B. It works only in Windows
C. It lacks bounds checking
D. It encrypts memory
Answer: C
Explanation:
Like other low-level functions, it does not check for buffer limits.
Which is a valid way to prevent buffer overflows in code?
A. Ignoring user input
B. Using unsafe functions
C. Implementing bounds checks
D. Running programs without memory
Answer: C
Explanation:
Checking input size and using safe functions helps prevent overflows.