hw 10

pdf

School

Alabama A&M University *

*We aren’t endorsed by this school

Course

384

Subject

Computer Science

Date

Dec 6, 2023

Type

pdf

Pages

2

Uploaded by bl238u49owahfeduoh

Report
CS-UY 2214 — Homework 10 Jeff Epstein Introduction Unless otherwise specified, put your answers in a plain text file named hw10.txt . Number each answer. Submit your work on Gradescope. The slides, available on Brightspace, cover many useful Intel opcodes. You may consult the online Intel assembly language reference to help you understand any unknown opcodes. You can also use the offcial Intel developer’s manual. To aid in debugging your assembly language programs, you can use gdb or similar. Please read the “Reversing tutorial,” available on Brightspace. Problems 1. Consider a hypothetical computer architecture with a hypothetical assembly language. It has 32-bit registers (named r0, r1, etc) and 32-bit pointers. Its memory consists of 8-bit cells. It has (at least) the following instructions: • lw addr , reg – read a 32-bit value from memory address addr and store it in the named register • sw addr , reg – store the 32-bit value in the register into memory address addr • mov reg , imm – store the immediate value into the register Consider the following code written in this assembly language: mov r3, 0x19fab0c0 sw 0x200, r3 ; write the value in r3 to address 200 lw 0x200, r5 ; and read it from 200, into register r5 sw 0x202, r3 ; note! we write to address 202, not 200 lw 0x200, r4 ; read the 32-bit value at address 200, into r4 Answer the following questions about the value of registers after the above program executes. Give each answer as a single 32-bit number in hex. If the answer cannot be determined from the data given, state why. (a) What value would you expect to find in register r5, if this is a big-endian architecture? Explain your answer. (b) What value would you expect to find in register r5, if this is a little-endian architecture? Explain your answer. (c) What value would you expect to find in register r4, if this is a big-endian architecture? Explain your answer. (d) What value would you expect to find in register r4, if this is a little-endian architecture? Explain your answer. 1
2. First, read the reverse engineering tutorial, reversal.pdf , which is on Brightspace. If you’re using Anubis, all the necessary tools should be available for you. If you’re not using Anubis, you will need to install tools using the command described in the reverse engineering tutorial. If it’s not all already there, install the .gdbinit file, as described in the tutorial. Download the file hw10.zip from Brightspace, then upload it to Anubis. Unzip the file using the com- mand unzip hw10.zip , which will extract the four programs within: mystery1 , mystery2 , mystery3 , and mystery4 . These are executable binary machine code files, not source code. You can view them with your hex viewer. Mark the programs as executable by running this command: chmod u+x mystery* Then you can run the programs like this: ./mystery1 Each program will prompt you to enter a password. If you enter the right password, the program displays the message “Password accepted!”. Each program has a different password. Your task is to determine the correct password for each of the first three programs. The last program, mystery4 is optional , but if you solve it, everyone will be impressed. Using the techniques described in the reversal tutorial (particularly gdb and objdump ), determine the correct password for each of them. For each of the mystery programs, answer the following questions: (a) What is the correct password? (b) How did you determine the correct password? That is, what tools did you use, and what steps did you follow? Your answer should be suffciently detailed so that another student could reproduce your approach, step-by-step. Solutions without a detailed walkthrough will not be graded. (c) How was the password hidden from you? What techniques did I use to make discovering the password harder? Your answer must be specific and detailed. Describe all techniques used. Hint: the disassembly syntax used by gdb and objdump is slightly different than the syntax of nasm . In particular, you’ll see instructions like mov ah, BYTE PTR ds:0x8048100 , which in nasm -compatible syntax would be written as mov ah, [0x8048100] . That is, it’s reading a byte from the given memory address and storing it into register ah. 2
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
  • Access to all documents
  • Unlimited textbook solutions
  • 24/7 expert homework help