#include <stdio.h>
char getPasswd()
{
int trigger = 'F';
char passwd[100];
gets(passwd);
return (char)trigger;
}
void login()
{
printf("You are logged in!\n");
exit(0);
}
void main()
{
printf("Please enter password: ");
if (getPasswd() == 'T')
{
login();
}
else
{
printf("The password is incorrect.\n");
exit(1);
}
}
I'm learning buffer overflow vulnerability and I tried to learn the logic out of this so because its 100 bytes long so running TT for about 108 characters long shows I'm inside but I'm trying now to modify the return address and got a bit confused. So if anyone could help how to modify return address to display "logged in".
Trying to use gdb to modify the return address so that it shows "logged in".
gbd --args ./a.out $(python -c 'print("TTTT" + "\x44\x84\x04\x08')')