Identify a bu er over ow vulnerability in the source of the login program in assignment.c. Show two possible inputs that can be used to bypass password authentication, i.e., that can allow the adversa

Are you pressed for time and haven’t started working on your assignment yet? Would you like to buy an assignment? Use our custom writing services for better grades. Even if your deadline is approaching fast, our writers can handle your task right when you need it.


Order a Similar Paper Order a Different Paper

Identify a buffer overflow vulnerability in the source of the login program in assignment.c.

Show two possible inputs that can be used to bypass password authentication, i.e., that

can allow the adversary to login without knowing the victim’s password.

This is the code:

#include

#include

#define BUFLEN 16

char enteredusername[BUFLEN];

char enteredpassword[BUFLEN];

char username[BUFLEN];

char password[BUFLEN];

void init()

{

// Set all buffers to 0

memset(username, 0, BUFLEN);

memset(password, 0, BUFLEN);

memset(enteredusername, 0, BUFLEN);

memset(enteredpassword, 0, BUFLEN);

// Set username and password for one user

strcpy(username, “bob”);

strcpy(password, “bef9b9b9”);

}

int main()

{

init();

printf(“Enter username: n”);

gets(enteredusername);

printf(“Enter password for user %s: n”, enteredusername);

gets(enteredpassword);

if (!memcmp(password, enteredpassword, BUFLEN) && !memcmp(username, enteredusername, BUFLEN))

{

printf(“Access granted. Welcome %sn”, enteredusername); // now the user is logged in

return 0;

}

else

{

printf(“Access denied. Invalid username or passwordn”); // the user authentication attempt is rejected

return -1;

}

}

Writerbay.net

Most students find it hard to finish papers at some point in their studies. If it ever happens to you, don’t get desperate—we have a service for every writing emergency! Whether you’re stuck with a problem, equation, or a piece of creative writing, we will definitely come to your rescue. Fill in the order form with the details of your paper. Write your personal instructions so we can meet your expectations.


Order a Similar Paper Order a Different Paper