Part 34 – Hacking Double Variables

For a complete table of contents of all the lessons please click below as it will give you a brief of each lesson in addition to the topics it will cover. https://github.com/mytechnotalent/Reverse-Engineering-Tutorial

Let’s review our code.

  1. int main(void) {
  2. double myNumber = 1337.77;
  3. std::cout << myNumber << std::endl;
  4. return 0;
  5. }

Part 34 – Hacking Double Variables - 图1

Let’s debug!

Part 34 – Hacking Double Variables - 图2

Let’s set a breakpoint at main+24 and continue.

Part 34 – Hacking Double Variables - 图3

We see the strd r2, [r11, #-12] and we have to fully understand that this means we are storing the value at the offset of -12 from register r11 into r2. Let’s now examine what exactly resides there.

Part 34 – Hacking Double Variables - 图4

Voila! We see 1337.77 at that offset location or specifically stored into 0x7efff230 in memory.

Part 34 – Hacking Double Variables - 图5

Let’s step into twice which executes the vldr d0, [r11, #-12] as we understand that 1337.77 will now be loaded into the double precision math coprocessor d0 register. Let’s now print the value at that location below.

Part 34 – Hacking Double Variables - 图6

Let’s hack the d0 register!

Part 34 – Hacking Double Variables - 图7

Now let’s reexamine the value inside d0.

Part 34 – Hacking Double Variables - 图8

Let’s continue.

Part 34 – Hacking Double Variables - 图9

Successfully hacked!

Next week we will dive into the SizeOf Operator.