I have the exercise to control the input of the eip/rip register (in my case rip) arbitrarily. The following program is given:
#include <stdio.h>
#include <string.h>
#define VAR_SIZE 32
void output(int argc, char** argv) {
char stack[VAR_SIZE];
strcpy(stack, argv[1]);
printf("%s\n", stack);
}
int main(int argc, char** argv) {
output(argc, argv);
return 0;
}
We may use the debugger gdb
. Unfortunately I have no idea where to start.
In order to set the value of the RIP x86-64 register, you can use the following command in gdb:
set $rip = 20
This will set the value of the register to 20
.