Briefly describe the process of compilation

Assignment Help Assembly Language
Reference no: EM132557782 , Length: 9 pages

Section 1 - Computer Architecture Review Questions

Question 1. Briefly describe the process of compilation. In your discussion, include the role of the high-level languages, low-level languages, machine code, opcodes, and binary form.

Question 2. If you reverse engineer a sample of malware that was compiled using an interpreted language, explain why the disassembly will not produce processor specific assembly (such as x86).

Question 3. List and explain the three hardware components of the Von Neumann architecture. Further define the main components of the CPU.

Question 4. A program is a dormant piece of software stored on disk. A compiled Windows program contains the sections discussed in week 1 (.code/.text, .data, etc). Once a program begins execution, the operating system loads it into memory. A program in execution (i.e. loaded into memory) is called a process. List and briefly define the four major sections of main memory (RAM) for a process.

Question 5. Endianness is something to be aware of when looking at data in memory. Suppose you observe the following value at a specific memory location on an x86 architecture: 0x0100ABC0. You suspect this represents an IPv4 address. What is the IP address?

Question 6. Which x86 register is used to store the address of the next instruction to execute?

Question 7. Suppose the EAX register contains the value 0xA7025F31. What are the values of AX, AH, and AL?

Section 2 - Disassembly Exercise

Load lab2-1.exe into IDA to observe the disassembly. This program does not do anything interesting. We are studying it to practice our assembly skills. Make sure the entire binary is analyzed by IDA before you begin navigating. You will know when IDA is done with analysis when you see the following "finished" message:

Click on Options -> General then place a check mark next to Line Prefixes. This option shows the relative memory addresses in IDA-View. We also want to see the opcodes, so enter 6 into the Number of opcode bytes entry.

Navigate to the Functions Window and go to functionsub_401020.

Question 1) The first two instruction in this function are establishing the stack frame. It is normal to always see this code upon function entry. How many bytes of object code (opcodes) is requires to establish the stack frame?

Question 2) What are the values in the eax and edx registers after the instruction at 0x00401025 has executed?

Question 3) What are the value in the eax and edx registers after the instruction at 0x0040102A has executed?

Question 4) What are the value in the eax and edx registers after the instruction at 0x0040102C has executed?

Question 5) What is the opcode for push eax?

Question 6) How many parameters does function sub_401000 have?

Question 7) In this case, what are the values of the parameters passed to sub_401000?

Question 8) Double click on sub_401000 to analyze the function. How many local variables are there?

Question 9) What are the values of [ebp+arg_0] and [ebp+arg_4]?

Question 10) In which register do value returning functions normally store their return value?

Question 11) What value does function sub_401000 return?

Question 12) Click the back arrow on the upper left of your IDA display to return to the calling function. Explain the code at 0x0040103E. What will be the values of the ZF and CF bits in the flags register?

Section 3 - Reverse Engineering Exercise

Load lab2-2.exe into IDA to observe the disassembly. Make sure the entire binary is analyzed before you begin navigating. You will know when IDA is done with analysis when you see the following "finished" message:

Click on Options -> General then place a check mark next to Line Prefixes. This option shows the relative memory addresses in IDA-View.

Navigate to the Functions Window and go to function sub_401030.

Question 1) How many parameters are in sub_401030? How many local variables?

So sub_401030 is actually our int main(int argc, char* argv[]) function. Unfortunately, IDA does not recognize it as the entry point. You can rename the function by right-clicking on sub_401030 and giving a new name that is more intuitive. Let's call it MAIN.

Since we know the function prototype is the main function defined above, we can rename the arguments to enhance our readability of the program. Since arguments are pushed onto the stack in right to left order, the first argument is always the one closest to EBP. Therefore, arg_0 is int argc. Right-click on arg_0 and rename as argc. This is our argument counter, which holds an integer value that indicates the number of command-line arguments passed to the program when it is executed. Rename arg_4 to argv. argv is a character array that contains the command line arguments.

Question 2) Show a screenshot like the one below with the function and the arguments renamed.

Question 3) At 0x00401036, what value is being compared to argc?

Question 4) What is the address of the next instruction executed if the values from problem three are not equivalent?

The at address 0x0040103C through 0x00401047 is grabbing the first element of the argv array, or argv[0], and storing it into the eax register. At 0x00401050 and at 0x00401089, we see the same function, sub_4010B1, being called. This function is the standard C printf function. Rename sub_4010B1 to printf. You may wish to quickly research the C printf function if you are not familiar.

Question 5) What are the arguments being passed to the printf function when it is called at 0x00401050?

Question 6)  Explain the purpose of the three instructions at 0x00401055,0x00401058, and 0x0040105A.

Question 7)  What is the purpose of the code block at loc_401098?

Question 8)  Now we need to analyze the code block at loc_40105C. Under what conditions does this code get executed? Remember, it has to do with the instruction at 0x00401036.

Instructions 0x0040105C through 0x00401067 are grabbing the second value in argv, or argv[1], and storing it into eax. This value is then passed as an argument to sub_401160. This function is the C standard atoi function. Rename sub_401160 to atoi. The atoi function (ASCII to Integer) takes an ASCII character as a parameter and returns a decimal value. For example:

As you can see, the atoi function takes an ASCII character, in this case ‘7', and returns the actual decimal value of 7. If a use enters ‘7' in a keyboard, the value 0x37 (or 55 in decimal) is what gets recorded, not the decimal value 7. The atoi function is commonly used to resolve human integer input into its logical meaning.

The value returned from atoi gets stored into var_4. It is then passed to sub_401000 as an argument. We don't know what that function does yet, we will have to reverse engineer it. For now, skip over it and let's finish analyzing the rest of this code. We will go back to that function later.

Question 9)  What gets stored in var_8?

Question 10) What gets printed at the call to printf at 0x0040108E?

Question 11) Double-click on aD:

This brings you to the location in the binary where this string is stored. At which address and section (text, data, rsrc, etc) is this string stored?

Question 12) Now go back and double-click on sub_401000 to analyze its code. Try to reverse engineer this function. It is a tricky one, since it involves recursion. Explain your conclusion.

Question 13) Summarize the overall functionality of the program. Execute the program to validate your analysis.

Extra Challenge.

Write a C program (or pseudo-code) equivalent of the lab2-2.exe.

Attachment:- Malware Forensics.rar

Reference no: EM132557782

Questions Cloud

Provide the necessary journal entries for the year : The cost of machinery is S$250 000. The construction of the machinery is completed on 1 June 2019, Provide the necessary journal entries for the year
Discuss the earnings management techniques : Discuss the earnings management techniques that you believe would meet your manager's requirements. Include three examples to support your advice.
Protein is one of most misunderstood nutrients : Protein is one of the most misunderstood nutrients. What do you think is the most important function of protein?
Compute total cash from financing activities : In 2005, the company issued additional common shares for $500,000 and borrowed $600,000 from the bank. Compute total cash from financing activities
Briefly describe the process of compilation : Briefly describe the process of compilation. In your discussion, include the role of the high-level languages, low-level languages, machine code, opcodes
Make a statement of mary adjusted cash book balance : Make A statement of Mary's adjusted cash book balance. On 30th April 2016, Mary's bank statement reflected a balance of R922,260
What were the equivalent units for conversion cost : Comfort chair company manufacturers a standard recliner. What were the equivalent units for conversion cost during February
Social-cognitive perspective with humanistic perspective : Write a paper comparing the main themes of the social-cognitive perspective with the humanistic perspective.
Calculate the amount of depreciation under each depreciation : Cost of equipment was $75,000 with $5,000 residual value. Calculate the amount of depreciation under each of the three depreciation methods

Reviews

Write a Review

Assembly Language Questions & Answers

  Write an assembly program to implement finite state machine

In this lab we will write an assembly program to implement a Finite State Machine (FSM) that recognizes hexadecimal integer constant that conforms to MASM syntax.

  Documented assembly language program

Write a complete well documented assembly language program (starts at $C000) that counts the number of 1s in each byte in a list. The LIST_IN starts at $C100

  Assembly language program to find all prime numbers between

Write a 68000 assembly language program to find all prime numbers between 1 and a specified upper value, inclusive, using the Sieve of Erathosthenes. The specified upper value may be as low as 3 or as high as 1023. Proceed as follows

  Write the assembly language program to add five numbers

Write the assembly language program to add five numbers stored at locations 20, 21, 22, 23 and 24. Then subtract the number stored in location 25 from result.

  Microcontroller assembly language programs

Write the following 8051 Microcontroller assembly language programs and simulate your programs in EDSIM 51 simulation

  Find out the prime numbers from a given range of numbers

Write a program called PRIME2 to find out the prime numbers from a given range of numbers (for ex: from 1 to 50) using for loop.

  Write and debug a marie assembly language program

You are to design, write, test, and debug a MARIE assembly language program that inputs a sequence of characters from the set A-Z, stores each character in memory after it is transformed by the trivial ROT13 cipher

  Write a mips assembly language program

CS2810 MIPS Project - Write a MIPS assembly language program that asks the user for 10 integers one at a time and stores them in memory

  Program that requests n as input

Write a program that requests N as input and computes the left-hand and the right-hand sides of the equation, verifies that they are equal, and displays the result.

  Project - game of nim

Nim is a mathematical game of strategy in which two players take turns removing objects from distinct heaps - a player must choose one pile and remove

  Program for huffman compression/decompression

Write a program for Huffman compression/decompression in assembly language that takes the data from input.txt and writes the output in output.txt.

  Write an equivalent m68000 assembly language

write an equivalent M68000 assembly language - What are the resulting values in the CCR - show any changes to register(s) and/or memory that would result

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd