Author Topic: What does this code  (Read 1061 times)

0 Members and 1 Guest are viewing this topic.

Offline zendk

  • NULL
  • Posts: 3
  • Cookies: 0
    • View Profile
What does this code
« on: October 07, 2015, 08:07:29 pm »
Hi!
I am trying to crack the program. The point is that when you run creates shared memory area, and is written to some information. It is necessary to know what is written there.

There is only .exe
With the help of IDA I have translated the program in pseudo-code, but now I can not fully understand what the code does.

I am hope for your help :)
« Last Edit: October 07, 2015, 08:09:02 pm by zendk »

Offline Trevor

  • Serf
  • *
  • Posts: 39
  • Cookies: 18
  • Coder, Reverser
    • View Profile
Re: What does this code
« Reply #1 on: October 07, 2015, 08:30:46 pm »
From a glance, it looks like that you need to stop the infinite while loop.

There is no break statement, so you need to resort to other ways.
My guess is that you need  to exploit that memcpy somehow.

Unfortunately, I cannot help you further unless you provide more information about what exactly you are trying to achieve.

Offline zendk

  • NULL
  • Posts: 3
  • Cookies: 0
    • View Profile
Re: What does this code
« Reply #2 on: October 07, 2015, 08:45:30 pm »
Thank you for your feedback!

All I need is to understand what makes this program.

There was a suspicion that it simply records the number 32 into the variable DstBuf, but it turned out that this is not the right answer.

P.S. By the way, if something goes wrong in the program and stop the cycle, it will print to the console any appropriate inscription.
P.P.S. As I understand the cycle stops every 1600 seconds ...wath line 100
« Last Edit: October 07, 2015, 08:57:19 pm by zendk »

Offline chris_kzn

  • Serf
  • *
  • Posts: 25
  • Cookies: 2
    • View Profile
Re: What does this code
« Reply #3 on: October 08, 2015, 01:56:03 am »
Are you new to C++ programming?

Offline xor

  • Peasant
  • *
  • Posts: 59
  • Cookies: 32
    • View Profile
Re: What does this code
« Reply #4 on: October 08, 2015, 06:44:27 am »
They created a file mapping called WhatTheFile.
You can take advantage of any language and map to that same file to read or write what's in it.

The function that you're probably trying to cause an exception in is itoa(v3, DstBuf, 10);
This puts the number in v3 (1) into DstBuf and converts it to a string in Base 10 format.

The file mapping to CreateFileMapping is only accessing 256 bytes.
If you map to the file and write past this, you will overwrite the value of v3, which means you can put a string in it and make it crash on itoa.

Offline zendk

  • NULL
  • Posts: 3
  • Cookies: 0
    • View Profile
Re: What does this code
« Reply #5 on: October 08, 2015, 01:36:00 pm »
Are you new to C++ programming?
Yes.
They created a file mapping called WhatTheFile.
You can take advantage of any language and map to that same file to read or write what's in it.

The function that you're probably trying to cause an exception in is itoa(v3, DstBuf, 10);
This puts the number in v3 (1) into DstBuf and converts it to a string in Base 10 format.

The file mapping to CreateFileMapping is only accessing 256 bytes.
If you map to the file and write past this, you will overwrite the value of v3, which means you can put a string in it and make it crash on itoa.
Thank you very much for your time. And still - WHAT is written in this file? And if i can map to that same file to read or write, how can this be done?

Thanks for the help! :)