bomb lab phase 3 github

There is a small amount of extra credit for each additional phase . It reads a the answer line from the user for each phase, then calls a function phase_x that has the code for phase x (x between 1 and 6 for the six phases). So if my solutions I have found for different phases are in a file called solutions.txt I would run "run solutions.txt" and it would run my bomb with that argument. Answer contains 6 integers. BOMB LAB - PHASE 4. 17:24. phase3 . A binary bomb is a program that consists of a sequence of phases. So, what have we got here? Guess the second number 2. Phase 3 Resources Intro This post walks through the first 3 phases of the lab. Binary Bomb. Make the file so that each phase's answer is on a separate line. Guide and work-through for System I's Bomb Lab at DePaul University. The bomb program will ask you you for a secret input. As usual, we will set a breakpoint at our phase, phase_3, and then run the bomb using answers.txt as an argument. : CSAPP: Bomb Lab . Each time your bomb explodes it noties the bomblab server, and you lose some points in the nal score for the lab. I seem to be missing something crucial in this code. I think I have a pretty good understanding of what most of the code is doing. Step 2: Defuse Your Bomb. So there are consequences to exploding the bomb. I know that it is using switch table here. Subtraction of 0xb8-0x125 gives the integer -109, which works with this phase. Each additional explosion costs you 0.5 points. For phase two, run gdb bomb on terminal and do the following: (gdb) break phase_2. Load the binary, analyze it, seek to sym.phase_3, then print it. addr_target = 0x400FC9 # The address of the first instruction of the explode_bomb function, which is to be avoided. A binary bomb is a program that consists of a sequence of six phases. Now is time to introduce Visual mode, which opens up many of r2's best features. ------------------------------------------------------- (gdb) disas phase_3 Dump of assembler code for function phase_3: You can compile directly on myth using a copy of a Makefile from any CS107 assignment/lab as a starting point, and then use gdb or objdump to poke around. The final constraint on our input occurs in the nested loops between <phase_6+57> and <phase_6+104>. If you type the correct string, then the phase is defused and the bomb proceeds to the next phase. Look at the source file bomb.c to get an idea about the overall structure of the bomb. GitHub taku-k / bomb-lab Public master bomb-lab/phase-3.txt Go to file Cannot retrieve contributors at this time 75 lines (69 sloc) 3.06 KB Raw Blame phase_3. Lab Assignments. ^^Seems to give back length of our string.So we want our input to be a string of length 6. Posted on 2016-10-26. Dump of assembler code for function phase_3: => 0x08048ce8 <+0>: sub . Feel free to re away at CTARGET and RTARGET with any strings you like. One possible input is " 0 q 777 ". Bomb-Assembly. Also, where the arrow is, it's comparing the current node with the next node. 08048ce8 <phase_3>: 8048ce8: 83 ec 1c sub $0x1c,%esp 8048ceb: c7 04 24 18 a5 04 08 movl $0x804a518, (%esp) 8048cf2: e8 b4 04 00 00 call 80491ab <string_length> 8048cf7: 83 c0 01. Evil has planted a slew of "binary bombs" on our machines. The return value of the c function is always storaged in the eax, so the 0x0000000000400f56 <+19>: mov $0x0,%eax compare the number of the parameters and the 0x1,it must be bigger than 1. Phase 1. If it is not 6 characters, it will jump to Bomb_Explode function. Each of you will work with a special "binary bomb". These are the precise rules: There are a total of 34 points (1, 1, 3, 5, 5, 5, 7, 7 points for phases 1-8, respectively). A note to the reader: For explanation on how to set up the lab environment see the "Introduction" section of the post. Phase_3 switchcase . Download and print the gdb quick reference guide. Assembly to C Code jumps. I can get to the last bomb explosion function.. but i can't get past it. Let's use gdb to figure out what they are. The list of numbers I've inputed is this: So far from my understanding, two conditions need to be met: edx must equal 0xf, meaning the first input has to be 5, 21, 37, etc. In this video, I demonstrate how to solve the Bomblab Phase 3 for Computer Systems. Details on Grading for Bomb Lab. %d 4 . Phase 3 of Binary Bomb Lab In this lab, we want to find the input that would bypass the explode line. ECEN 324 - Lab Assignment 2: Defuse a binary bomb. So if my solutions I have found for different phases are in a file called solutions.txt I would run "run solutions.txt" and it would run my bomb with that argument. So there are consequences to exploding the bomb. You will have to run through the reverse engineering process, but there won't be much in the way of complicated assembly to decipher or tricky mental hoops to jump through. It. . NASM on linux: Using sys_read adds extra line at the end. Phase 1 Phase 2 Phase 3 Phase 4 Phase 5 Phase 6 Secret Phase. The difficulty comes from recursion and another function whose purpose isn't clear from just its name. 13. . Choose one bomb to work on and delete the rest. It needs to be six integers separated by spaces, and each integer needs to be less than or equal to six. Bomb lab phase_4. GitHub master binary-bomb/phase3.txt Go to file Cannot retrieve contributors at this time 133 lines (122 sloc) 5.41 KB Raw Blame =================== Phase 3 =================== Move the breakpoint from commands file to 0x8048a98, the beginning of phase_3. I just figured out the solution will be in format "%d %d", but I do not know how to get those numbers. Phases 5 and 6 are a little more difficult, so they are worth 15 points each. The labs all share some common features. You will get full credit for defusing phase 1 with less than 20 explosions. Computer Science questions and answers. When I type the following comman in the terminal to see how each case switch to which address, the result just not working. Readme (27 points) 2 points for explosion suppression, 5 points for each level question. If any of these is . to "defuse" using your assembly and reverse-engineering skills. Solving a reverse engineering challenge using r2 and ESIL. Each lab is distributed in a self-contained tar file. radare2 as an alternative to gdb-peda. This is phase 2 of a binary bomb lab. Engineering; Computer Science; Computer Science questions and answers; This is Phase_6 from the Bomb Lab. I see there is an array of integers.I am trying to figure out how to use them appropriately to solve this problem. A short introduction to instrumentation and Frida on Linux. Read more . Read more . Lets try "flower" and see if we get pass the. I assume that the student has already set up a VPN connection to a linux . addr . (gdb) info line main Line 3 of "main.c" starts at address 0x401050 <main> and ends at 0x401075 <main+ (gdb) disas 0x401050 0x401075 Dump of assembler code from 0x401050 to 0x401075: 0x00401050 . This lab allows you to specify a file for the bomb to read your discovered solutions from at run time. Each phase expects you to type a particular string on stdin. (up to -6 points deducted) Each bomb explosion notification that reaches the staff results in a 1 point deduction, capped at -6 points total. Also note that the binary follow the AT&T standard so instruction operations are reversed (e.g. You will get full credit for defusing phases 2 and 3 with less than 30 explosions. Keep going! Binary Bomb Lab- Phase 3. You must be careful! You will get full credit for defusing phases 2 and 3 with less than 30 explosions. The second part is the binary bomb program, where you're given an executable "bomb" program (no C code provided!) For lab: defuse phase 1. Your job for this level is to supply an exploit string that will cause getbuf () to return your . See the answer. Enter Graph. After that, we can input a test string and when our breakpoint hits, we can use the gdb command x/s [memory-address] to print whatever string we find at that memory address: 1. That value is decremented and compared against 0x3e8 (1000) - the bomb is triggered if our decremented value is greater than that. This page contains a complete set of turnkey labs for the CS:APP3e text. This style of attack is tricky, though, since you must: 1) get machine code onto the stack, 2) set the return pointer to the start of this code, and 3) undo the corruptions made to the stack state. I wonder how I could find the second . 11. $ gdb bomb 12345678910111213141516171819(gdb) break explode_bombbreak phase_1break phase_2break phase_3break phase_4break phase_5(gdb) break explode_bombBreakpoint 1 at 0x40143a(gdb) break phase_ . Ask Question Asked 6 years, 2 months ago. It reads two numbers, makes sure one is less than 0xe, then runs sym.func4. mov a b moves data from a to b as opposed to b to a). I am having a really hard time with this. Despite first impressions, this function isn't very complicated, and with Graph mode we can easily make sense of it. Dump of assembler code for function phase_2: => 0x0000000000400f0c <+0>: push %rbp I have solved that the first number is >1 and < 7. Otherwise, the bomb explodes by printing "BOOM!! Checks to see if ANYTHING is inputed. !" and then terminating. IT/C 2018. So the answer: 2 -109. You must do the assignment on one of the class machines. For homework: defuse phases 2 and 3. eb 3b jmp 400fbe <phase_3+0x7b> x = 2 400f83: b8 c3 02 00 00 mov $0x2c3,%eax 400f88: eb 34 jmp 400fbe <phase_3+0x7b> x = 3 400f8a: b8 00 01 00 00 mov $0x100,%eax 400f8f: eb 2d jmp 400fbe <phase_3 . (You will not get credit for using the debugger to jump over the code that checks whether input is valid; the bomb must send a correct input to our server.) The purpose of this project is to become more familiar with machine level programming. BInary Bomb Lab Phase 1 Walkthrough. Figure 1: Summary of attack lab phases 4.1 Level 1 For Phase 1, you will not inject new code . All gists Back to GitHub Sign in Sign up Sign in Sign up {{ message }} . binary bomb phase 6. braker15 asked on 5/16/2009. End of assembler dump. Defuse the "phases" of the bomb by figuring out (e.g. You do not necessarily lose the points immediately. The return value of the c function is always storaged in the eax, so the 0x0000000000400f56 <+19>: mov $0x0,%eax compare the number of the parameters and the 0x1,it must be bigger than 1. There is a small grade penalty for explosions beyond 20. A "binary bomb" is a program provided to students as an object code file. In a moment of weakness however, Dr. A binary bomb is a program that consists of a sequence of phases. Some pattern-recognition will be required. 08048db5 <phase_6>: 8048db5: 56 push %esi. A binary bomb is a program that consists of a sequence of six phases. Answers that are vague, inaccurate, or . You will get full credit for defusing phase 1 with less than 20 explosions. See the answer See the answer done loading. In this video, I demonstrate how to solve the Bomblab Phase 6 for Computer Systems. This phase takes six numbers and runs a test on five of them in a loop. Phase 1 is sort of the "Hello World" of the Bomb Lab. Phase 4 Dump of assembler code for function phase_4: 0x000000000040100b <+0>: sub $0x18,%rsp. (**Please feel free to fork or star if helpful!) which I believe is the 2nd . # The address where the symbolic execution shall begin. Evil has created a slew of "binary bombs" for our class. phase_3 () has many possible inputs. Now we have two criteria for our password. Evil decided that the first 10 bomb explosions will be free of charge. Phase 2: Before we continue, we must put our answers in a defuser.txt file (./bomb defuser.txt) so that we won't have to keep entering our answers. Bomb explosions. So I am doing the classic Binary bomb and have managed to get to phase 6 without to much trouble but I've been bashing my head trying to figure out this lat phase so any help would be appreciated. Let's load the binary in r2, analyze it, seek to sym.phase_4 then print the function. Programming C Assembly. If you type the correct string, then the phase is defused and the bomb proceeds to the next phase. What this tells us is that the input to Phase 5 is 6 characters (Performs a Count_length function followed by cmp [ebp +var_4], 6. There is a small grade penalty for explosions beyond 20. There are 2 free explosions (no points lost) for each phase. (Add 16 each time) ecx is compared to rsp, which is 15, so we need ecx to equal to 15. The input should consist of an integer (0 ~ 6), a character and another integer (both determined by the previous integer). 2 Comments 2 Solutions 12114 Views Last Modified: 11/13/2013. I know that this phase requires %d %d. NHN NEXT 2013 3 ' ' . For lab: defuse phase 1. This lab allows you to specify a file for the bomb to read your discovered solutions from at run time. No, it stops after looping once at the last cmp. Your job for this lab is to defuse your bomb. I fired up gdb, added some breakpoints before and after the first input string required for the bomb. apples For homework: defuse phases 2 and 3. If you type the correct string, then the phase is defused and the bomb proceeds to the next phase. Posted by Avantika Yellapantula at 6:00 AM. bomb.c: Source file with the bomb's main routine and a friendly greeting. Let's start gdb and place a breakpoint on explode_bomb. This is the assembly code for phase 3: It is right after parsing of two numbers taken as input. You will get full credit for defusing phase 1 with less than 20 explosions. February 20, 2011. Viewed 4k times -1 So I'm struggling understanding this phase of a binary bomb lab that I have to do for class. The nefarious Dr. We want to find the input to defuse the bomb. node1 db 76h, 3, 2 dup (0), 1, 3 dup (0), 0F0h, 0A5h, 4, 8. A binary bomb is a program that consists of a sequence of phases. Bomb lab - phase 3. In this lab, you will gain firsthand experience with one of the methods commonly used to exploit security weaknesses in operating systems and network servers. This problem has been solved! Phase 5 requires you to do an ROP attack on RTARGET to invoke function touch3 with a pointer to a string representation of your cookie. Skip to content. Introduction: The nefarious Dr. This line requires value at %rbx, that is the value at emory address at rsp + 0x4 equal to 2. double value of %eax. Then I stepped through the disassembled instructions to find a function called phase_1. This is an educational video on understanding and solving the Binary Bomb Lab. Level 5: target_f2 in rtarget (15 points) For Level 5, you will repeat the attack of Level 2 to target_f2, but in the program rtarget using gadgets from your gadget farm. 2) . I assume that the student has already logged into a Linux environment tha. => 0x00000000004012f1 <+0>: cmpb $0x0, (%rdi) //rdi = string input. When run, it prompts the user to type in 6 different strings. For homework: defuse phases 2 and 3. First things first, we can see from the call to <string_length> at <phase_5+23> and subsequent jump equal statement our string should be six characters long. Bomb Lab. . Guess the input is: 01 02 04 08 16 32. GDB Here are a few useful commands that are worth highlighting: layout asm Next, as we . Question: Bomb Lab phase 3 Right now, I know it is searching for two number(%d %d). TrendMicro CTF 2016 - re100. If you're looking for a specific phase: Here is Phase 1 Here is Phase 2 Here is Phase 3 Here is Phase 5 Here is Phase 6 Phase 4 In my opinion, this is where things start to get tricky. I have listed code below. Bomblab. P native process 101 In: phase 5 (gdb) x/32wd Ox5555555568a0 0x5555555568a0 <array.3418>: 2 10 6 1 0x5555555568b0 <array.3418+16>: 12 16 9 3 0x555555556800 <array.3418+32>: 4 7 14 5 0x5555555568d0 <array.3418+48>: 11 8 15 13 0x5555555568e0: 2032168787 1948284271 1802398056 1970239776 0x5555555568f0: 1851876128 1869902624 1752440944 1868701797 . Made this really quick but it should give an idea of how to complete phase 3 - to run it just look at my previous video Type in. I see that I need more than 2 inputs for the function to work, but it begins to get really muddy after that. The nefarious Dr. i'm stuck on phase6, i think it is the linked list that is giving me problems. In this repository All GitHub . . There is a small amount of extra credit for each additional phase . Kyle Clegg. addr_start = 0x400F60 # The address of the return of phase_3. For Level 4, you will repeat an attack similar to Level 1: you only need to overwrite the return address to move control to target_f1 inside rtarget. We'll enlist Python to help. phase3 . IMPORTANT NOTE: You can work on your solution on any Linux machine, but in order to submit your . Phase 3 of binary bomb lab. Unlike the Bomb Lab, there is no penalty for making mistakes in this lab. Evil has created a slew of "binary bombs" for our class. Jump . Thank you in advance! phase2 , +28 lea src . Each phase expects you to type a . Phase 4 I keep on getting like 3 numbers correctly, and then find the only possible solutions for the other 3 incorrect, so I am at a loss. About; Products For Teams; Stack Overflow Public questions . Computer Science questions and answers. using a debugger) what the secret input for each "phase" is. , Binary Bomb Lab .. woonohyo.tistory.com. There is a small amount of extra credit for each additional phase . The first four phases are worth 10 points each. I know there has to be 6 numbers, with the range of 1-6, and there can't be any repeats. phase 2 solved. Nonetheless, you will always gain points for completing a phase regardless of how many times the bomb has exploded. GitHub Gist: instantly share code, notes, and snippets. Once you complete a phase you will not lose points in that phase if you explode the bomb in that phase at a later time (i.e. this is binary bomb lab phase 5.I didn't solve phase 5. Show transcribed image text. 1. Phase Program Level Method Function Points 1 CTARGET 1 CI touch1 10 2 CTARGET 2 CI touch2 25 3 CTARGET 3 CI touch3 25 4 RTARGET 2 ROP touch2 35 5 RTARGET 3 ROP touch3 5 CI: Code injection ROP: Return-oriented programming Figure 1: Summary of attack lab phases The server will test your exploit string to make sure it really works, and it will update the Attacklab score- End of assembler dump. Like the last phase, it has multiple correct answers. Bomb Lab GitHub BombLabCS:APPlab . (gdb) ni 3: 0x0000000000400efe in phase_1 (gdb) disas: Dump of assembler code for function phase_1: 0x0000000000400ef0 <+0>: sub $0x8,%rsp: Link to Bomb Lab Instructions (pdf) in GitHub Repository The calling function is oblivious to the attack. Here is Phase 6. Computer Science. If the input passes that check we enter the final function: sym.fun7. You must be careful! Code must be solved. Each time your bomb explodes it notifies the bomblab server, and you lose 1/2 point (up to a max of 20 points) in the final score for the lab. Bomb-Lab/Phase5. There is a small grade penalty for explosions beyond 20. I used a linux machine running x86_64. That may not seem significantly more difficult than using an ROP attack to invoke touch2, except that we have made it so.Moreover, Phase 5 counts for only 5 points, which is not a true measure of the effort it will require. Our purpose is to help you learn about the runtime operation of programs and to understand the nature of this form of security weakness so that you can avoid it when you write system code . # We end it there so as to dump the stack and retrieve values before the stack frame is discarded. The secret phase reads in an additional line from the input stream and converts it to a long value using strtol. 0x08048e35 <+91>: add $0xb8,%eax. accidentally as you try to get to a later phase). Bomblab. From this . This was also paired with many add $0x125 and sub $0x125, but ultimately each canceled out till all was left with sub $0x125. What I know so far: first input cannot be 15, 31, 47, etc. 8048db7: 83 ec 44 sub $0x44,%esp. Once that's done, disassemble phase_4. Accroding to the format, int takes 2 bytes, char takes 1 byte. Note: the solutions in your solutions file need to be in order of phases. Slightly difficult than previous phases but it can still be solved. For lab: defuse phase 1. If for some reason you request multiple bombs, this is not a problem. A clear, concise, correct answer will earn full credit. Each phase expects you to type a particular string on stdin . Note that between the beginning and end of phase_1 there is a call to the function . Each time your bomb explodes it notifies the staff, and you lose 1/4 point (up to a max of 10 points) in the final score for the lab. You will get full credit for defusing phases 2 and 3 with less than 30 explosions. 2017-04-22 : CSAPP, . The answer should be six digits from 1 to 6, and distinct to each other. OK, but what are the commands to do all of the above? . This is just to show that in order to understand what's going on in the assembly code, one must iterate through the code using gdb fully. Binary Bomb Lab :: Phase 5. We have a loop with iterators %ebx and %edi. Each phase expects you to type a particular string on stdin. Stack Overflow. I am looking for the solution. Modified 6 years, 2 months ago. In this phase, it is not enough to simply understand the assembly. Phase 2 is all about how comparison and jump instructions create loops in Assembly. GitHub sc2225 / Bomb-Lab Public master Bomb-Lab/Phase3 Go to file sc2225 Create Phase3 Latest commit 52f2dc3 on Mar 10, 2017 History 1 contributor 149 lines (123 sloc) 7.05 KB Raw Blame Let's use "apples" as our random input: That's number 2. Binary Bomb (Phase 5) Let go through Phase 5. Point breakdown for each phase: Phase 1 - 4: 10 points each; Phase 5 and 6: 15 points each; Total maximum score possible: 70 points; Each time the "bomb explodes", it notifies the server, resulting in a (-)1/5 point deduction from the final score for the lab. Phase 4 is our first real jump in difficulty. To begin, let's take a look at the <phase_1> function in our objdump file: At the r2 command prompt, enter (uppercase) V. Binary Bomb: Phase 3 Phase 3: Note: This is a very long section mostly because I kept a long bit of dissasembly code and register data. Breakpoint 1 at 0x8048cc4. Posted on 2016-08-03 | In writeup. 8048db6: 53 push %ebx. A comparison between radare2 and the GDB-PEDA extension. Phase 4. Each phase expects you to type a particular string on stdin .



bomb lab phase 3 github