GSEC practice question 10 of 35

A program has allocated 10 characters of space for user’s response on a form. The application does not validate the number of characters that a user can input into the field before accepting the dat a. Which type of attack Is the application vulnerable to?

Full set: 383 questions

Domain Malicious Code and Exploit Mitigation

Answer options
A: On hijacking
B: Buffet overflow Correct answer
C: Cross site scripting
D: SQL Injection
Correct Answer:
B. Buffet overflow
Explanation

The scenario describes a classic buffer overflow vulnerability. The application allocates a fixed-size memory buffer (10 characters) but fails to perform bounds checking on the user-supplied input. When a user enters more data than the buffer can hold, the excess data overwrites adjacent memory locations. This can lead to program instability, crashes, or the execution of malicious code if an attacker carefully crafts the input. The core issue is the lack of input length validation against the allocated memory space.

Why Incorrect

A. Session hijacking: This attack involves stealing a user's valid session identifier to gain unauthorized access, which is unrelated to input length validation.
C. Cross-site scripting: This is an injection attack where malicious scripts are injected into trusted websites, stemming from a failure to validate input content, not its length.
D. SQL Injection: This attack involves inserting malicious SQL statements into an entry field for execution, resulting from a failure to sanitize input for database query characters.

References

1. National Institute of Standards and Technology (NIST)

"Common Weakness Enumeration (CWE-120): Buffer Copy without Checking Size of Input ('Classic Buffer Overflow')

" CWE Version 4.6. This official standard defines the vulnerability as occurring when data is copied into a buffer without verifying that the input will fit

which is precisely the scenario described.

2. Pfleeger

C. P.

& Pfleeger

S. L. (2006). Security in Computing (4th ed.). Prentice Hall. In Chapter 3

"Program Security

" Section 3.2

"Nonmalicious Program Errors

" the text explicitly details buffer overflows as a primary example of programming flaws where "a program does not check the amount of data to be copied into a buffer of a certain size" (p. 115).

3. Erickson

J. (2008). Hacking: The Art of Exploitation (2nd ed.). No Starch Press. Chapter 3

"Exploitation

" provides a detailed technical breakdown of how buffer overflows work

starting with the fundamental premise of writing more data into a buffer than was originally allocated (pp. 85-90). This is considered a foundational text in many university security courses.

4. MIT OpenCourseWare. 6.858 Computer Systems Security

Fall 2014. Lecture 3

"Controlling Untrusted Code

" discusses buffer overflows as a primary method for attackers to seize control of a program by providing an overly long input string that overwrites the return address on the stack.

Scroll to Top