This is an example of a different type of buffer overflow
vulnerability. How can one get the program to grant “root
privileges” without knowing the correct password? Is the attack
blocked by any of the three buffer overflow defenses that we
discussed in class? (code example from www.thegeekstuff.com)
#include <stdio.h>
#include <string.h>
int main(void) {
int pass = 0;
char buff[15];
printf("Enter the password: ");
gets(buff);
if( strcmp(buff, "thegeekstuff") ) {
printf ("\nWrong Password\n");
} else {
printf ("\nCorrect Password\n");
pass = 1;
}
if(pass) {
/* Now Give root or admin rights to user*/
printf ("\nRoot privileges given to the user\n");
}
return 0;
}