MULTIPLE PROCESSOR SYSTEMS SECURITY Q25) (Security) Consider the code below from the textbook: 1 int main (int
Question:
MULTIPLE PROCESSOR SYSTEMS
SECURITY
Q25) (Security) Consider the code below from the textbook:
1 int main (int argc, char *argv[ ] ) {
2 char src[100], dst[100], cmd[256] = "cp "; /* declare 3 character arrays */
3 printf("Please enter name of source file: "); /* ask for source file */
4 gets(src); /* get input from the keyboard */
5 strcat(cmd, src); /* concatenate src after cp */
6 strcat(cmd, " "); /* add a space to the end of cmd */
7 printf("Please enter name of destination file: "); /* ask for output file name */
8 gets(dst); /* get input from the keyboard */
9 strcat(cmd, dst); /* complete the commands string */
10 system(cmd); /* execute the cp command */
11 }
Let us assume that the code above is written by a programmer with no ill objective. Notice however that the program is interacting with the user at lines 4 and 8. Is it possible for a user of the program to interact with the program to exploit it: (Answers without proper detailed explanations will be disregarded)
a) Using Buffer Overflow Attack? Describe how the user can possibly exploit it?
b) Using Command Injection Attack? Describe how the user can possibly exploit it?