QuestionQ292

Endpoint Attack and Pivoting

John works as a C programmer and develops the following C program:

#include <stdlib.h>  
#include <stdio.h>  
#include <string.h>  
int buffer(char *str) \{  
char buffer1[10];  
strcpy(buffer1, str);  
return 1;  
\}  
int main(int argc, char *argv[]) \{  
buffer(argv[1]);  
printf("Executed\n");  
return 1;  
\}  

His program is susceptible to a __________ attack.

  • A SQL injection
  • B Denial-of-Service
  • C Buffer overflow
  • D Cross site scripting
Explanation

strcpy performs no bounds checking. Copying an argument longer than the 10-byte buffer1 array can write beyond that array and overwrite adjacent memory, creating a buffer-overflow vulnerability.

Community Discussion

No comments yet. Be the first to start the discussion!