ELEC424/COMP424/ELEC553: Mobile & Embedded Systems

Home
Schedule
Labs
Resources

Lab 1: Part 1: Hacking with GDB


The purpose of this part is to familiarize you with GDB.

You are going to use GDB to hack a simple login program that can be downloaded here.

The program will take a password from stdin and compare with a predefined password.

If you supply a wrong password:

$ ./login
$ Type in the password and press enter:
$ \wrong password\
$ Incorrect passord!
$ Type the password and press enter:

You job is to use GDB to analyze the execution of the program, and figure out what is the right password that is predefined in the program.


Hints

You can use GDB to view the assembly code of the binary. Try to find where the terminal input is compared with the password. Then, try to locate the memory location of the password and take a peek.

Have fun!


Writing the report

Please write down the retrieved password in the first sentence of the corresponding section. Also please briefly describe the GDB commands you use, and how they help you to find the password.