Question

need help with binary bomb phase_2

Asked by: errang

Hey, I need to diffuse a binary bomb, I'm not an assembly language expert... so I'd appreciate any help =)

080519e5 <phase_2>:
 80519e5:       55                      push   %ebp
 80519e6:       89 e5                   mov    %esp,%ebp
 80519e8:       53                      push   %ebx
 80519e9:       83 ec 2c                sub    $0x2c,%esp
 80519ec:       8d 45 d8                lea    0xffffffd8(%ebp),%eax
 80519ef:       50                      push   %eax
 80519f0:       ff 75 08                pushl  0x8(%ebp)
 80519f3:       e8 5f 03 00 00          call   8051d57 <read_six_numbers>
 80519f8:       bb 01 00 00 00          mov    $0x1,%ebx
 80519fd:       83 c4 10                add    $0x10,%esp
 8051a00:       8b 44 9d d4             mov    0xffffffd4(%ebp,%ebx,4),%eax
 8051a04:       83 c0 05                add    $0x5,%eax
 8051a07:       39 44 9d d8             cmp    %eax,0xffffffd8(%ebp,%ebx,4)
 8051a0b:       74 05                   je     8051a12 <phase_2+0x2d>
 8051a0d:       e8 9a 07 00 00          call   80521ac <explode_bomb>
 8051a12:       43                      inc    %ebx
 8051a13:       83 fb 05                cmp    $0x5,%ebx
 8051a16:       7e e8                   jle    8051a00 <phase_2+0x1b>
 8051a18:       8b 5d fc                mov    0xfffffffc(%ebp),%ebx
 8051a1b:       c9                      leave
 8051a1c:       c3                      ret

08051d57 <read_six_numbers>:
 8051d57:       55                      push   %ebp
 8051d58:       89 e5                   mov    %esp,%ebp
 8051d5a:       83 ec 08                sub    $0x8,%esp
 8051d5d:       8b 55 0c                mov    0xc(%ebp),%edx
 8051d60:       8d 42 14                lea    0x14(%edx),%eax
 8051d63:       50                      push   %eax
 8051d64:       8d 42 10                lea    0x10(%edx),%eax
 8051d67:       50                      push   %eax
 8051d68:       8d 42 0c                lea    0xc(%edx),%eax
 8051d6b:       50                      push   %eax
 8051d6c:       8d 42 08                lea    0x8(%edx),%eax
 8051d6f:       50                      push   %eax
 8051d70:       8d 42 04                lea    0x4(%edx),%eax
 8051d73:       50                      push   %eax
 8051d74:       52                      push   %edx
 8051d75:       68 72 23 05 08          push   $0x8052372
 8051d7a:       ff 75 08                pushl  0x8(%ebp)
 8051d7d:       e8 d6 f7 ff ff          call   8051558 <_PROCEDURE_LINKAGE_TABLE_+0xb0>
 8051d82:       83 c4 20                add    $0x20,%esp
 8051d85:       83 f8 05                cmp    $0x5,%eax
 8051d88:       7f 05                   jg     8051d8f <read_six_numbers+0x38>
 8051d8a:       e8 1d 04 00 00          call   80521ac <explode_bomb>
 8051d8f:       c9                      leave
 8051d90:       c3                      ret


This is what I know about phase 2
080519e5 <phase_2>:
 80519e5:      55                         push   %ebp <------------------------Pushes ebp onto the stack
 80519e6:      89 e5                      mov    %esp,%ebp <-------------------ebp = esp
 80519e8:      53                         push   %ebx <------------------------Pushes ebx onto the stack
 80519e9:      83 ec 2c                   sub    $0x2c,%esp <------------------esp = esp-44
 80519ec:      8d 45 d8                   lea    0xffffffd8(%ebp),%eax <-------load effective address eax = 0xffffffd8(%ebp)?
 80519ef:      50                         push   %eax <------------------------Pushes eax onto the stack
 80519f0:      ff 75 08                   pushl  0x8(%ebp) <-------------------Push ebp onto the stack offset by 8
 80519f3:      e8 5f 03 00 00             call   8051d57 <read_six_numbers> <--Call the function with the parameters already there
 80519f8:      bb 01 00 00 00             mov    $0x1,%ebx <-------------------ebx = 1
 80519fd:      83 c4 10                   add    $0x10,%esp <------------------esp = esp + 10
 8051a00:      8b 44 9d d4                mov    0xffffffd4(%ebp,%ebx,4),%eax<-eax = 0xffffffd4(%ebp,%ebx,4)
 8051a04:      83 c0 05                   add    $0x5,%eax <-------------------eax = eax + 5
 8051a07:      39 44 9d d8                cmp    %eax,0xffffffd8(%ebp,%ebx,4)<-compares eax with that huge offset thing
 8051a0b:      74 05                      je     8051a12 <phase_2+0x2d> <------jumps if the compare works out right
 8051a0d:      e8 9a 07 00 00             call   80521ac <explode_bomb> <------explodes bomb, have to avoid this
 8051a12:      43                         inc    %ebx <------------------------increment ebx by 1?
 8051a13:      83 fb 05                   cmp    $0x5,%ebx <-------------------compare ebx to 5
 8051a16:      7e e8                      jle    8051a00 <phase_2+0x1b> <------jump less than phase 2 + the offset 8051A00
 8051a18:      8b 5d fc                   mov    0xfffffffc(%ebp),%ebx <-------ebx = the huge offset of ebp
 8051a1b:      c9                         leave  <-----------------------------breaks down the current stack frame
 8051a1c:      c3                         ret    <-----------------------------It goes back to the calling code

And this is what I think the C code should look like, not 100% sure its right:

void phase_2(char *input)
{
    int ii;
    int numbers[6];

    read_six_numbers(input, numbers);

    for (ii = 1; ii < 6; ii++) {
        if (numbers[ii] != numbers[ii-1] + 5)
            explode_bomb();
    }
}

I've gotta diffuse 4 more phases after this so I'd appreciate any hints to get this done.  Thanks in advance!!

This Question has been solved and asker verified All Experts Exchange premium technology solutions are available to subscription members.

Subscribe now for full access to Experts Exchange and get

Instant Access to this Solution

  • Plus...
  • 30 Day FREE access, no risk, no obligation
  • Collaborate with the world's top tech experts
  • Unlimited access to our exclusive solution database
  • Never be left without tech help again

Subscribe Now

Asked On
2009-04-25 at 21:57:24ID24355820
Tags

binary bomb

,

phase_2

Topics

Assembly Programming Language

,

Miscellaneous Programming

Participating Experts
1
Points
500
Comments
20

Trusted by hundreds of thousands everyday for fast, accurate and reliable tech support.

  • "The time we save is the biggest benefit of Experts Exchange to Warner Bros. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange." Mike Kapnisakis, Warner Bros.
  • "Our team likes having a resource that is more secure than just using Google and most experts using this service really know their stuff. It's nice to look here first versus using Google." Dayna Sellner, Lockheed Martin
  • "Anytime that I've been stumped with a problem, 9 out of 10 times Experts Exchange has either the accepted solution or an open discussion of the potential solution to the problem." Kenny Red, eBay Inc.

See what Experts Exchange can do for you.

Got a question?

We've got the answer.

Experts Exchange has been collecting answers to technology questions since 1996…3 million and counting! If you have a question, chances are we already have your answer.

Screenshot of Experts Exchange Knowledgebase

Need individual assistance?

Our experts are ready to help.

If you can't find the exact answer you're looking for, ask our exclusive community of 50,000 experts. You’ll get a personalized answer from a trusted professional.

Screenshot of Experts Exchange Knowledgebase

Want to learn from the best?

Read articles from industry experts.

Thousands of free tech tips, tricks, how-to’s and tutorials are available in our peer reviewed articles section. See for yourself how smart our experts are, no login required.

Screenshot of an Article

Working on a long term project?

Store your work and research.

Save solutions to your questions, answers you’ve discovered through searching plus helpful articles in your personal knowledgebase for easy future access.

Screenshot of Experts Exchange Knowledgebase

Access the answers to your technology questions today.

Subscribe Now

30-day free trial. Register in 60 seconds.

What Makes Experts Exchange Unique?

Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.

Trusted by the world's most respected brands.

image of each brand's logo

Faithfully serving IT professionals since 1996.

Experts Exchange Logo

Try it out and discover for yourself.

Subscribe Now

30-day free trial. Register in 60 seconds.

Related Solutions

  1. binary bomb assignment, figuring out assembly
    OK im sure of u guys might of encountered this little exercise before. Anyways, I'm having trouble figuring out one of the phases. Anyways here's the code: /* The second phase is harder. No one will ever figure out * how to defuse this... */ input = read_line(); ...
  2. defuse binary bomb
    I have a homework in which I have to disassembler the code and figure out how to defuse the bomb. Can anyone help please thanks bomb-quiet: file format elf32-i386 Disassembly of section .init: 08048718 <_init>: 8048718: 55 push %ebp 804871...
  3. Binary Bomb
    I am trying to defuse a binary bomb and this is the code for phase one Dump of assembler code for function phase_1: 0x08048b08 <phase_1+0>: push %ebp 0x08048b09 <phase_1+1>: mov %esp,%ebp 0x08048b0b <phase_1+3>: sub $0x10,%esp 0x08048b0e <phase_1...
  4. Binary Bomb Phase 5
    Infinity08 your comments are really helping me understand this better. Could you please let me know if what I wrote is going on here is correct. I can't seem to figure out exactly what this wants, except know it wants a string that is length 6. Thanks again Dump of assemb...
  5. Binary Bomb Final Phase
    Alright, on the last phase of the binary bomb. I have the code commented and just wanted to know if what I think is happening really is. So far I just think it is a bunch of nested loops and that the input will be 5 or less numbers. Alright any feedback would be very appre...
  6. Binary Bomb Final Phase
    I am working through the CS:APP textbook (auditing a class at the local state U) and I'm trying to complete the final phase of the binary bomb lab. Basically, I need to figure out what string to send to this function (in C) so that the "bomb" doesn't "explode....

Free Tech Articles

  1. WARNING: 5 Reasons why you should NEVER fix a computer for free.
    It is in our nature to love the puzzle. We are obsessed. The lot of us. We love puzzles. We love the challenge. We thrive on finding the answer. We hate disarray. It bothers us deep in our soul. W...
  2. SCCM OSD Basic troubleshooting
    SCCM 2007 OSD is a fantastic way to deploy operating systems, however, like most things SCCM issues can sometimes be difficult to resolve due to the sheer volume of logs to sift through and the dispe...
  3. Migrate Small Business Server 2003 to Exchange 2010 and Windows 2008 R2
    This guide is intended to provide step by step instructions on how to migrate from Small Business Server 2003 to Windows 2008 R2 with Exchange 2010. For this migration to work you will need the fo...
  4. Create a Win7 Gadget
    This article shows you how to create a simple "Gadget" -- a sort of mini-application supported by Windows 7 and Vista. Gadgets can be dropped anywhere on the desktop to provide instant information, ...
  5. Outlook continually prompting for username and password
    There have been a lot of questions recently regarding Outlook prompting for a username and password whilst using Exchange 2007. There are a few reasons why this would happen and I will try to cover t...
  6. Backup Exchange 2010 Information Store using Windows Backup
    There seems to be quite a lot of confusion around the ability to backup Exchange 2010 using the built in Windows Backup feature. This stems from the omission of this feature prior to Exchange 2007 s...

Cloud Class Webinars

  1. Avoiding Bugs in Microsoft Access
    Alison Balter takes and in-depth look at avoiding bugs in Access. In this webinar you will learn about using the immediate window to debug your applications, invoking the debugger, using breakpoints to troubleshoot, stepping through code, setting the next statement to execute, ...
  2. Top 10 Best New Features in Visio 2010
    Scott Helmers gives live demonstrations of the top 10 new features in Visio 2010. This webinar will teach you how to create compelling diagrams by adding shapes to the page with a single click, linking the shapes in a diagram to data in Excel (or SQL Server, or SharePoint), ...
  3. IT Consultant Business Secrets Revealed
    Michael Munger, Experts Exchange tech pro and IT consultant, pulls back the curtain on his very successful businesses and answers question on every IT consultant and business owner should know about. He shares secrets on what he did to solve the 5 most common problems in IT, ...
  4. Disaster Recovery and Business Continuity
    Quest CTO, Mike Billon, gives an overview of the steps involved in building a dunamic disaster recovery plan. Through case studies and an examination of software/hardware tooles for monitoring and testing, you'll gain a better understandin of where you are, where you want ...
  5. Organize Your Visio Diagrams with Containers and Lists
    Scott Helmers uses cross functional flowcharts, wireframe diagrams, data graphic legends and seating charts to teach you: how to ustilize all three new structured diagram components in Visio 2010, the best practices for organizeing shapes in previous version of Visio, how to organize ...
  6. How to Us Objects, Properties, Events and Methods in Microsoft Access
    Alison Dalter gives an in-depbth look at objects, properties, events and methods in Microsoft Access. In this webinar you will learn about using the object browser, referring to objects, working with properties and methods, working with object variables, understanding the ...

Join the Community

Give a Little. Get a Lot.

Join the community of experts here and help other tech pros by answering question in your area of expertise. You can earn FREE access to all Experts Exchange's premium features and resources.

Join the Community

Answers

 

by: Infinity08Posted on 2009-04-26 at 23:53:29ID: 24239345

 

by: errangPosted on 2009-04-27 at 00:26:53ID: 24239461

well... not to sound mouthy or anything... but you didn't give me the answer to #1... and that's not making #2 much easier... lol =(

 

by: errangPosted on 2009-04-27 at 00:34:47ID: 24239490

and... phase 2 isn't anything like phase 1... was it?

dunno... guess i'm more of a visual learner, I was never much of a do it yourself guy... =(

 

by: Infinity08Posted on 2009-04-27 at 01:11:24ID: 24239646

>> and... phase 2 isn't anything like phase 1... was it?

In the sense that phase 1 was about finding the right string, and phase 2 is about finding the right 6 integers, they're different. In all other ways, they're pretty much the same. There's only two more concepts added : arithmetic and loops. That's all.


>> but you didn't give me the answer to #1... and that's not making #2 much easier... lol =(

If you understood 100% how phase 1 works, phase 2 shouldn't be difficult at all. But you found the answer to phase 1 by guessing basically - If my memory serves me right, you did a strings on the executable, and tried out the different strings you found until one worked, right ?

Anyway, I assure you phase 2 is not hard ... You just have to concentrate for a while - don't let yourself be distracted by other projects. Don't depend on me for being there at every turn pointing you in the right direction. Investigate things on your own, try out different theories you might have, etc.

Do you keep track of what's on the stack at all times ? If not, that might help you too.

 

by: errangPosted on 2009-04-27 at 08:41:24ID: 24242900

>If my memory serves me right, you did a strings on the executable, and tried out the different strings you found until one worked, right ?

Yeah... but I did do it your way before moving onto phase 2.

 

by: Infinity08Posted on 2009-04-27 at 09:32:40ID: 24243344

So, what's the progress ?

 

by: errangPosted on 2009-04-27 at 09:38:44ID: 24243400

pretty much were I was at 12:30 am last night...

>> Anyway, I assure you phase 2 is not hard

I suppose that's what they mean by relativity... what may seem unfathomable to the student, may seem like child's play to the teacher.. lol

 

by: Infinity08Posted on 2009-04-27 at 09:43:58ID: 24243452

Could be. But still ...

So, let's continue where we left off then : Which values do the two addresses refer to ? Which two values are being compared ?

 

by: errangPosted on 2009-04-27 at 11:07:42ID: 24244131

/sigh... lol

eax refers to the values the user input? It's eax because of the line:

mov    0xffffffd4(%ebp,%ebx,4),%eax

and its getting compared to 0xffffffd8(%ebp,%ebx,4) in line:

cmp    %eax,0xffffffd8(%ebp,%ebx,4)

It needs to pass this compare in order to jump over the explode bomb phase...

 

by: Infinity08Posted on 2009-04-27 at 12:33:55ID: 24244926

Yes, but which values do the addresses 0xffffffd4(%ebp,%ebx,4) and 0xffffffd8(%ebp,%ebx,4) refer to ?

 

by: errangPosted on 2009-04-27 at 14:00:28ID: 24245628

one of them must refer to user input and one of them must refer to the expected value... i'm not sure which refers to which.

 

by: Infinity08Posted on 2009-04-27 at 14:21:14ID: 24245796

I already told you that there's no pre-determined array or anything like that.

What's the base address of the array of 6 numbers that the read_six_numbers function filled ?

 

by: errangPosted on 2009-04-27 at 14:46:08ID: 24245978

Yeah, I said expected value... I thought you said the value changes depending on what the user typed?

 

by: Infinity08Posted on 2009-04-27 at 14:58:59ID: 24246072

You lost me. What value are you talking about ?

 

by: errangPosted on 2009-04-27 at 16:10:21ID: 24246529

the password... It's dependent on what the user types... Right?

Is the password dependent on the first number the user types?

Is it an arithmetic sequence where each number is +5 of the previous number?

 

by: errangPosted on 2009-04-27 at 19:25:48ID: 24247157

Ok... got past phase_2 (FINALLY!!!!)

I got it when a friend of mine told me to pay attention to the add $0x5, %eax line...

Any chance you can help me out with a few more of the phases? lol

 

by: Infinity08Posted on 2009-04-27 at 22:57:59ID: 24247934

>> Is it an arithmetic sequence where each number is +5 of the previous number?

You're getting there :)


>> Ok... got past phase_2 (FINALLY!!!!)

Good !


>> Any chance you can help me out with a few more of the phases? lol

Sure. Let's keep the different phases separated in separate questions this time though, because the first question was getting to be really long lol.

So, for phase 3 we'd continue here :

        http://www.experts-exchange.com/Programming/Languages/Assembly/Q_24355832.html

ok ?

 

by: errangPosted on 2009-04-27 at 22:59:49ID: 24247937

sounds great!

I'll see you there then =)

 

by: Infinity08Posted on 2009-04-27 at 23:07:35ID: 24247959

I have to step out for a short while, but then I'll get back to you for phase 3 ... give it a go in the meantime, using the knowledge you gained from solving the first two. See if you can get anywhere. In my experience with this kind of question on EE, once people have solved the first two, the other ones go a lot easier.

 

by: errangPosted on 2009-04-27 at 23:08:57ID: 24247964

lol, kk, I just posted what I think it's supposed to be.

20120131-EE-VQP-002

3 Ways to Join

30-Day Free Trial

The Experts

98% positive feedback on 31,087 answers since March 2000. angeliii is a Microsoft Most Valuable Professional for his work with MS SQL Server & Develoment.

He has also proven his knowledge of Visual Basic Programming, PHP Scripting and Oracle Databases.

The Experts

97% positive feedback on 10,752 answers since July 2000. lrmoore has more than 18 years experience in the networking industry.

The six-time Mircosoft MVPs specialties include firewalls, virtual private networking, and network management.

Testimonials

"...and excellent source for support... Kind of like having your very own IT dept." Electriciansnet

Testimonials

"I was apprehensive at signing up at first. However... it has already made my life as an IT administrator much easier." JaCrews

Testimonials

"WOW! You guys have great, active, and knowledgeable people on here." moore50

Business Clients

Business Clients

In the Press

"If you’ve got a question... Experts Exchange can supply an answer.”

In the Press

"...an invaluable aid for both IT professionals and those who require tech support."

In the Press

"where IT professionals provide quick answers on just about any topic"

Business Account Plans

Loading Advertisement...