0
0
Operating Systemsknowledge~20 mins

Buffer overflow attacks in Operating Systems - Practice Problems & Coding Challenges

Choose your learning style9 modes available
Challenge - 5 Problems
🎖️
Buffer Overflow Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
🧠 Conceptual
intermediate
2:00remaining
What is a buffer overflow attack?

Which of the following best describes a buffer overflow attack?

AAn attack where extra data is written beyond the buffer's boundary, potentially overwriting adjacent memory.
BAn attack that encrypts data in a buffer to prevent access.
CAn attack that deletes all data stored in a buffer intentionally.
DAn attack that compresses buffer data to save memory space.
Attempts:
2 left
💡 Hint

Think about what happens when a program writes more data than a buffer can hold.

📋 Factual
intermediate
2:00remaining
Common cause of buffer overflow

What is a common programming mistake that leads to buffer overflow vulnerabilities?

AEncrypting data before storing it in buffers.
BUsing dynamic memory allocation properly.
CUsing fixed-size buffers without checking input length.
DUsing high-level languages that manage memory automatically.
Attempts:
2 left
💡 Hint

Consider what happens if input data is longer than the buffer size.

🚀 Application
advanced
2:00remaining
Effect of buffer overflow on program behavior

What is a likely result if a buffer overflow overwrites a program's return address on the stack?

AThe program may jump to malicious code and execute it.
BThe program will automatically fix the overwritten address and continue safely.
CThe program will compress the stack to prevent errors.
DThe program will encrypt the return address to protect it.
Attempts:
2 left
💡 Hint

Think about what happens when the return address points somewhere unexpected.

🔍 Analysis
advanced
2:00remaining
Why do modern systems use stack canaries?

What is the main purpose of stack canaries in preventing buffer overflow attacks?

ATo compress stack data for faster execution.
BTo increase the size of the buffer to avoid overflow.
CTo encrypt the stack memory to prevent access.
DTo detect if the stack has been overwritten before function returns.
Attempts:
2 left
💡 Hint

Consider how a program can know if its stack was tampered with.

Reasoning
expert
2:00remaining
Why is using safe functions important to prevent buffer overflow?

Given two functions: strcpy() and strncpy(), why is strncpy() considered safer in preventing buffer overflow?

A<code>strncpy()</code> automatically allocates more memory for the buffer.
B<code>strncpy()</code> limits the number of characters copied, preventing overflow if used correctly.
C<code>strcpy()</code> encrypts the string while copying, which <code>strncpy()</code> does not.
D<code>strncpy()</code> compresses the string to fit the buffer size.
Attempts:
2 left
💡 Hint

Think about how limiting copied data size helps avoid overflow.