312-49V10 practice question 29 of 35
Kyle is performing the final testing of an application he developed for the accounting department. His last round of testing is to ensure that the…
Full set: 699 questionsThe provided C code contains a classic stack-based buffer overflow vulnerability. The strcpy function is used to copy the first command-line argument (argv[1]) into a fixed-size character array (buffer) of 10 bytes. The strcpy function does not perform bounds checking and will continue to copy data from the source until a null terminator is found. If an input string longer than 9 characters (plus one for the null terminator) is provided, strcpy will write past the end of the buffer, corrupting adjacent memory on the stack. This can lead to a program crash or be exploited to execute arbitrary code. Kyle is testing for this specific vulnerability.
B. SQL injection: This attack targets applications that interact with a database. The provided code does not perform any database operations.
C. Format string bug: This vulnerability arises when user-controlled input is used as the format string in functions like printf(). This code does not do that.
D. Kernel injection: This involves injecting code into the OS kernel. The vulnerability shown is in a user-space application, not the kernel itself.
1. CERT C Secure Coding Standard. (2016). Software Engineering Institute, Carnegie Mellon University. Rule STR31-C, "Guarantee that storage for strings has sufficient space for character data and the null terminator," explicitly warns against using unbounded string functions like strcpy(), as they are a common source of buffer overflows.
2. Erickson, J. (2008). Hacking: The Art of Exploitation, 2nd Edition. No Starch Press. Chapter 0x300, "Exploiting Stack-Based Buffer Overflows," (pp. 86-90) uses nearly identical C code examples with strcpy() to demonstrate the fundamental mechanism of a stack buffer overflow. This book is frequently used as a textbook in university-level security courses.
3. Howard, M., & LeBlanc, D. (2003). Writing Secure Code, 2nd Edition. Microsoft Press. Chapter 5, "Public Enemy #1: The Buffer Overrun," (pp. 126-129) identifies strcpy() as a "banned function" precisely because it enables buffer overruns by not checking the size of the destination buffer.
4. MIT OpenCourseWare. (2014). 6.858 Computer Systems Security, Fall 2014. Lecture 2 Notes: "Control-flow hijacking attacks." Section 2, "Stack buffer overflows," describes how functions like gets() and strcpy() can be used to write past the end of a buffer on the stack to overwrite control data, such as the return address.
Keep practicing
Take the free 312-49V10 practice test
Ten exam-style questions with answers and explanations, plus the exam facts and study guides.
More questions
Other 312-49V10 practice questions
- Question 1Which of the following attacks refers to unintentional download of malicious software via…
- Question 2Which of the following tool enables a user to reset his/her lost admin password in a Wind…
- Question 3Bob has encountered a system crash and has lost vital data stored on the hard drive of hi…
- Question 4Which component in the hard disk moves over the platter to read and write information?
- Question 5What file structure database would you expect to find on floppy disks?
- Question 6The offset in a hexadecimal code is:
