GSEC practice question 14 of 35

You are reviewing a packet capture file from your network intrusion detection system. In the packet stream, you come across a long series of "no operation" (NOP) commands. In addition to the NOP commands, there appears to be a malicious payload. Of the following, which is the most appropriate preventative measure for this type of attack?

Full set: 383 questions

Domain Network Device Security

Answer options
A: Limits on the number of failed logins
B: Boundary checks on program inputs Correct answer
C: Controls against time of check/time of use attacks
D: Restrictions on file permissions
Correct Answer:
B. Boundary checks on program inputs
Explanation

The scenario describes a NOP (no operation) sled, which is a classic component of a buffer overflow exploit. This attack occurs when a program fails to validate the size of user-supplied input, allowing an attacker to write data beyond the boundaries of an allocated memory buffer. This overwrites adjacent memory, including the instruction pointer, to redirect execution to a malicious payload. The NOP sled serves as a large target, increasing the chances of a successful jump to the payload. The most direct and effective preventative measure is to implement strict boundary checks on all program inputs, ensuring that data cannot be written past the end of a buffer, thus preventing the overflow from occurring.

Why Incorrect

A. Limits on the number of failed logins: This is a countermeasure for brute-force authentication attacks, not memory corruption vulnerabilities like buffer overflows.
C. Controls against time of check/time of use attacks: This prevents race condition vulnerabilities, where a resource's state changes between a security check and its use, which is unrelated to buffer overflows.
D. Restrictions on file permissions: This is a principle of least privilege control that can limit post-exploitation damage but does not prevent the initial buffer overflow exploit itself.

References

1. Dowd

M.

McDonald

J.

& Schuh

J. (2006). The Art of Software Security Assessment: Identifying and Preventing Software Vulnerabilities. Addison-Wesley.

Chapter 5

"Memory Corruption

" details buffer overflow vulnerabilities. Section 5.5

"Exploitation

" describes the use of NOP sleds to improve the reliability of exploits. The primary defense discussed throughout the chapter is proper bounds checking and input validation.

2. Zheng

X.

& MIT OpenCourseWare. (2014). 6.858 Computer Systems Security

Fall 2014. Massachusetts Institute of Technology.

In Lecture 2: "Software Vulnerabilities

" the notes explain stack buffer overflows

shellcode

and the use of NOP sleds (Slide 28). The lecture then discusses defenses

with the first and most fundamental being "Bounds checking" (Slide 36)

which prevents writing past the end of an array.

3. Software Engineering Institute

Carnegie Mellon University. (2016). CERT C Coding Standard.

Rule ARR30-C

"Do not form or use out-of-bounds pointers or array subscripts

" directly addresses the root cause of buffer overflows. The standard states

"Out-of-bounds memory accesses can lead to buffer overflows... Proper validation of all inputs and calculated values is required to prevent out-of-bounds memory access." This is the formal definition of boundary checking.

4. Boneh

D.

& Stanford University. (n.d.). CS 155: Computer and Network Security

Lecture 4: Buffer Overflows.

The lecture notes describe how buffer overflow attacks work

including the use of a "NOP sled" to make the target for the overwritten return address larger. Under the "Defenses" section

the first method listed is "Write secure code

" with the primary example being the use of bounds-checked functions like strncpy() instead of strcpy()

which is a direct implementation of boundary checking.

Scroll to Top