behind enemy lines reverse engineering c++ in modern ages · rax/ eax- stores the return value of...

93
Behind Enemy Lines Reverse Engineering C++ in Modern Ages Gal Zaban @0xgalz

Upload: others

Post on 12-May-2020

5 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Behind Enemy Lines Reverse Engineering C++ in Modern Ages · RAX/ EAX- stores the return value of functions. RCX/ ECX- Stores pointers to objects. MSVC __fastcall calling convention

Behind Enemy Lines

Reverse Engineering C++ in Modern Ages

Gal Zaban@0xgalz

Page 2: Behind Enemy Lines Reverse Engineering C++ in Modern Ages · RAX/ EAX- stores the return value of functions. RCX/ ECX- Stores pointers to objects. MSVC __fastcall calling convention

id;

● Gal Zaban.

● Security Researcher.

● I break yo’ stuff and sew for fun and non profit.

Page 3: Behind Enemy Lines Reverse Engineering C++ in Modern Ages · RAX/ EAX- stores the return value of functions. RCX/ ECX- Stores pointers to objects. MSVC __fastcall calling convention

Agenda

● C++ from a Reverse Engineer Perspective.

● Picking a Target.

● Winning.

● Putting it into Practice.

● Have fun! :)

Page 4: Behind Enemy Lines Reverse Engineering C++ in Modern Ages · RAX/ EAX- stores the return value of functions. RCX/ ECX- Stores pointers to objects. MSVC __fastcall calling convention

Binary Creation

Compiler, linker, etc.

Code Binary

Page 5: Behind Enemy Lines Reverse Engineering C++ in Modern Ages · RAX/ EAX- stores the return value of functions. RCX/ ECX- Stores pointers to objects. MSVC __fastcall calling convention

What if we would like to reverse the process?

Page 6: Behind Enemy Lines Reverse Engineering C++ in Modern Ages · RAX/ EAX- stores the return value of functions. RCX/ ECX- Stores pointers to objects. MSVC __fastcall calling convention

?CodeBinary

Page 7: Behind Enemy Lines Reverse Engineering C++ in Modern Ages · RAX/ EAX- stores the return value of functions. RCX/ ECX- Stores pointers to objects. MSVC __fastcall calling convention

Reverse Engineering

● Locals and Names don’t appear in the binary.

● Unless the code was compiled in debug mode.

● Optimizations usually make my head hurt.

● Static vs. Dynamic reversing.

● Hardware vs. Software.

● And many more.

Page 8: Behind Enemy Lines Reverse Engineering C++ in Modern Ages · RAX/ EAX- stores the return value of functions. RCX/ ECX- Stores pointers to objects. MSVC __fastcall calling convention

What is it good for?

● Vulnerabilities● Look for bugs in a code and exploit them.

● Understand the logic of code/ algorithm.● Solve complex synchronization and bad optimizations.

Page 9: Behind Enemy Lines Reverse Engineering C++ in Modern Ages · RAX/ EAX- stores the return value of functions. RCX/ ECX- Stores pointers to objects. MSVC __fastcall calling convention

The Reversed Steps

Decompiler + Human

Disassembler

Binary Assembly Code

Page 10: Behind Enemy Lines Reverse Engineering C++ in Modern Ages · RAX/ EAX- stores the return value of functions. RCX/ ECX- Stores pointers to objects. MSVC __fastcall calling convention

The Reversed Steps

Decompiler + Human

Disassembler

Binary Assembly Code

Page 11: Behind Enemy Lines Reverse Engineering C++ in Modern Ages · RAX/ EAX- stores the return value of functions. RCX/ ECX- Stores pointers to objects. MSVC __fastcall calling convention

Now, for a real example :)

Page 12: Behind Enemy Lines Reverse Engineering C++ in Modern Ages · RAX/ EAX- stores the return value of functions. RCX/ ECX- Stores pointers to objects. MSVC __fastcall calling convention

What is the most effective way to learn Reversing of C++ code?

Page 13: Behind Enemy Lines Reverse Engineering C++ in Modern Ages · RAX/ EAX- stores the return value of functions. RCX/ ECX- Stores pointers to objects. MSVC __fastcall calling convention
Page 14: Behind Enemy Lines Reverse Engineering C++ in Modern Ages · RAX/ EAX- stores the return value of functions. RCX/ ECX- Stores pointers to objects. MSVC __fastcall calling convention

Win Chicken Invader!

Page 15: Behind Enemy Lines Reverse Engineering C++ in Modern Ages · RAX/ EAX- stores the return value of functions. RCX/ ECX- Stores pointers to objects. MSVC __fastcall calling convention

Win Chicken Invader!

Page 16: Behind Enemy Lines Reverse Engineering C++ in Modern Ages · RAX/ EAX- stores the return value of functions. RCX/ ECX- Stores pointers to objects. MSVC __fastcall calling convention

But there is a problem..

Page 17: Behind Enemy Lines Reverse Engineering C++ in Modern Ages · RAX/ EAX- stores the return value of functions. RCX/ ECX- Stores pointers to objects. MSVC __fastcall calling convention

I am TERRIBLE at this game… The only way I can win

is….cheating!!11

Page 18: Behind Enemy Lines Reverse Engineering C++ in Modern Ages · RAX/ EAX- stores the return value of functions. RCX/ ECX- Stores pointers to objects. MSVC __fastcall calling convention

Objective: Win Chicken Invaders

By Patching the Game!

Page 19: Behind Enemy Lines Reverse Engineering C++ in Modern Ages · RAX/ EAX- stores the return value of functions. RCX/ ECX- Stores pointers to objects. MSVC __fastcall calling convention

Let’s Start!

Page 20: Behind Enemy Lines Reverse Engineering C++ in Modern Ages · RAX/ EAX- stores the return value of functions. RCX/ ECX- Stores pointers to objects. MSVC __fastcall calling convention

What do we want?

● Make the game easier.○ Make the Chicken Boss easier.

● Learn reverse engineering C++ on the way.

Page 21: Behind Enemy Lines Reverse Engineering C++ in Modern Ages · RAX/ EAX- stores the return value of functions. RCX/ ECX- Stores pointers to objects. MSVC __fastcall calling convention

What do we have?● The binary of the game.● A tool for disassembling the code.● Our knowledge in C++.● Some knowledge in reverse engineering (?).

Page 22: Behind Enemy Lines Reverse Engineering C++ in Modern Ages · RAX/ EAX- stores the return value of functions. RCX/ ECX- Stores pointers to objects. MSVC __fastcall calling convention

Our tools for Reverse Engineering

Page 23: Behind Enemy Lines Reverse Engineering C++ in Modern Ages · RAX/ EAX- stores the return value of functions. RCX/ ECX- Stores pointers to objects. MSVC __fastcall calling convention

Tools we use- Disassemblers

Page 24: Behind Enemy Lines Reverse Engineering C++ in Modern Ages · RAX/ EAX- stores the return value of functions. RCX/ ECX- Stores pointers to objects. MSVC __fastcall calling convention

Tools we use- Disassemblers● IDA is our fav tool.

Page 25: Behind Enemy Lines Reverse Engineering C++ in Modern Ages · RAX/ EAX- stores the return value of functions. RCX/ ECX- Stores pointers to objects. MSVC __fastcall calling convention

Assembly Basics (For MSVC Compiler) ● Important registers.

○ RAX/ EAX- stores the return value of functions.

○ RCX/ ECX- Stores pointers to objects.

● MSVC __fastcall calling convention uses Registers to pass Parameters○ RCX, RDX, RDI, RSI, R8, R9

○ Anything else goes to the stack.

Page 26: Behind Enemy Lines Reverse Engineering C++ in Modern Ages · RAX/ EAX- stores the return value of functions. RCX/ ECX- Stores pointers to objects. MSVC __fastcall calling convention

C++ Concepts in 60 seconds

Page 27: Behind Enemy Lines Reverse Engineering C++ in Modern Ages · RAX/ EAX- stores the return value of functions. RCX/ ECX- Stores pointers to objects. MSVC __fastcall calling convention

Dynamic Object Creation

Page 28: Behind Enemy Lines Reverse Engineering C++ in Modern Ages · RAX/ EAX- stores the return value of functions. RCX/ ECX- Stores pointers to objects. MSVC __fastcall calling convention

Dynamic Object Creation

Page 29: Behind Enemy Lines Reverse Engineering C++ in Modern Ages · RAX/ EAX- stores the return value of functions. RCX/ ECX- Stores pointers to objects. MSVC __fastcall calling convention

Dynamic Object Creation

Page 30: Behind Enemy Lines Reverse Engineering C++ in Modern Ages · RAX/ EAX- stores the return value of functions. RCX/ ECX- Stores pointers to objects. MSVC __fastcall calling convention

Basic Constructors● How can we recognize a constructor in Assembly?

○ Sets the vtable to the object first bytes (4/ 8 - x86/x64)

○ Sets the object members in the other offsets

○ In case of inheritance, also calling the father’s constructor.

● As can be seen in the following example:

Page 31: Behind Enemy Lines Reverse Engineering C++ in Modern Ages · RAX/ EAX- stores the return value of functions. RCX/ ECX- Stores pointers to objects. MSVC __fastcall calling convention

Basic Constructors● How can we recognize a constructor in Assembly?

○ Sets the vtable to the object first bytes (4/ 8 - x86/x64)○ Sets the object members in the other offsets

○ In case of inheritance, also calling the father’s constructor.

● As can be seen in the following example:

Page 32: Behind Enemy Lines Reverse Engineering C++ in Modern Ages · RAX/ EAX- stores the return value of functions. RCX/ ECX- Stores pointers to objects. MSVC __fastcall calling convention

Basic Constructors● How can we recognize a constructor in Assembly?

○ Sets the vtable to the object first bytes (4/ 8 - x86/x64)

○ Sets the object members in the other offsets○ In case of inheritance, also calling the father’s constructor.

● As can be seen in the following example:

Page 33: Behind Enemy Lines Reverse Engineering C++ in Modern Ages · RAX/ EAX- stores the return value of functions. RCX/ ECX- Stores pointers to objects. MSVC __fastcall calling convention

Virtual calls

Page 34: Behind Enemy Lines Reverse Engineering C++ in Modern Ages · RAX/ EAX- stores the return value of functions. RCX/ ECX- Stores pointers to objects. MSVC __fastcall calling convention

Virtual calls

● The function that will be called will change on runtime

The virtual call

Page 35: Behind Enemy Lines Reverse Engineering C++ in Modern Ages · RAX/ EAX- stores the return value of functions. RCX/ ECX- Stores pointers to objects. MSVC __fastcall calling convention

Virtual calls

● The function that will be called will change on runtime

Move the virtual function to EAX

Page 36: Behind Enemy Lines Reverse Engineering C++ in Modern Ages · RAX/ EAX- stores the return value of functions. RCX/ ECX- Stores pointers to objects. MSVC __fastcall calling convention

Virtual calls

● The function that will be called will change on runtime

Assignment of the vtable to EDX

Page 37: Behind Enemy Lines Reverse Engineering C++ in Modern Ages · RAX/ EAX- stores the return value of functions. RCX/ ECX- Stores pointers to objects. MSVC __fastcall calling convention

Virtual calls?

Assignment of the vtable to EDX

Move the virtual function to EAX

The virtual call

Page 38: Behind Enemy Lines Reverse Engineering C++ in Modern Ages · RAX/ EAX- stores the return value of functions. RCX/ ECX- Stores pointers to objects. MSVC __fastcall calling convention

The Game

Page 39: Behind Enemy Lines Reverse Engineering C++ in Modern Ages · RAX/ EAX- stores the return value of functions. RCX/ ECX- Stores pointers to objects. MSVC __fastcall calling convention

String in the Binary

● The string is in use by Controller::runLevel

Page 40: Behind Enemy Lines Reverse Engineering C++ in Modern Ages · RAX/ EAX- stores the return value of functions. RCX/ ECX- Stores pointers to objects. MSVC __fastcall calling convention

Controller::runLevel - The SpaceShip● In the beginning of this function we can see a shared_pointer of a spaceShip

object is being used.

● We are going to take a deeper look at this object.

Page 41: Behind Enemy Lines Reverse Engineering C++ in Modern Ages · RAX/ EAX- stores the return value of functions. RCX/ ECX- Stores pointers to objects. MSVC __fastcall calling convention

“SpaceShip” Constructor

Page 42: Behind Enemy Lines Reverse Engineering C++ in Modern Ages · RAX/ EAX- stores the return value of functions. RCX/ ECX- Stores pointers to objects. MSVC __fastcall calling convention

“SpaceShip” Constructor

Page 43: Behind Enemy Lines Reverse Engineering C++ in Modern Ages · RAX/ EAX- stores the return value of functions. RCX/ ECX- Stores pointers to objects. MSVC __fastcall calling convention

“SpaceShip” Constructor

Page 44: Behind Enemy Lines Reverse Engineering C++ in Modern Ages · RAX/ EAX- stores the return value of functions. RCX/ ECX- Stores pointers to objects. MSVC __fastcall calling convention

“SpaceShip” Vtable

Page 45: Behind Enemy Lines Reverse Engineering C++ in Modern Ages · RAX/ EAX- stores the return value of functions. RCX/ ECX- Stores pointers to objects. MSVC __fastcall calling convention

“SpaceShip” Vtable

*

Page 46: Behind Enemy Lines Reverse Engineering C++ in Modern Ages · RAX/ EAX- stores the return value of functions. RCX/ ECX- Stores pointers to objects. MSVC __fastcall calling convention

“SpaceShip” Vtable

*

● We can see the vtable contains both spaceShip function and GameObject functions

● SpaceShip Inherits from GameObject

Page 47: Behind Enemy Lines Reverse Engineering C++ in Modern Ages · RAX/ EAX- stores the return value of functions. RCX/ ECX- Stores pointers to objects. MSVC __fastcall calling convention

How does it look like from the father side?

Page 48: Behind Enemy Lines Reverse Engineering C++ in Modern Ages · RAX/ EAX- stores the return value of functions. RCX/ ECX- Stores pointers to objects. MSVC __fastcall calling convention

The “Game Object” constructor:: vtable● The game object assigns its vtable to the first 8 bytes.

Page 49: Behind Enemy Lines Reverse Engineering C++ in Modern Ages · RAX/ EAX- stores the return value of functions. RCX/ ECX- Stores pointers to objects. MSVC __fastcall calling convention

“Game Object” constructor:: members

Page 50: Behind Enemy Lines Reverse Engineering C++ in Modern Ages · RAX/ EAX- stores the return value of functions. RCX/ ECX- Stores pointers to objects. MSVC __fastcall calling convention

“Game Object” constructor:: members

Page 51: Behind Enemy Lines Reverse Engineering C++ in Modern Ages · RAX/ EAX- stores the return value of functions. RCX/ ECX- Stores pointers to objects. MSVC __fastcall calling convention

“Game Object” :: members

Assignment to the relevant offset in the GameObject

Page 52: Behind Enemy Lines Reverse Engineering C++ in Modern Ages · RAX/ EAX- stores the return value of functions. RCX/ ECX- Stores pointers to objects. MSVC __fastcall calling convention

“Game Object” :: members

The return values from the function calls

Assignment to the relevant offset int the Game object

Page 53: Behind Enemy Lines Reverse Engineering C++ in Modern Ages · RAX/ EAX- stores the return value of functions. RCX/ ECX- Stores pointers to objects. MSVC __fastcall calling convention

“Game Object” :: Vtable● If we return to our vtable these are the functions of the game object

Page 54: Behind Enemy Lines Reverse Engineering C++ in Modern Ages · RAX/ EAX- stores the return value of functions. RCX/ ECX- Stores pointers to objects. MSVC __fastcall calling convention

“Game Object” :: Vtable

Page 55: Behind Enemy Lines Reverse Engineering C++ in Modern Ages · RAX/ EAX- stores the return value of functions. RCX/ ECX- Stores pointers to objects. MSVC __fastcall calling convention

“Game Object” :: Vtable

● We can see the function “spaceShip::moveObj” is a pure virtual function in the father game object.

Page 56: Behind Enemy Lines Reverse Engineering C++ in Modern Ages · RAX/ EAX- stores the return value of functions. RCX/ ECX- Stores pointers to objects. MSVC __fastcall calling convention

REcap

Page 57: Behind Enemy Lines Reverse Engineering C++ in Modern Ages · RAX/ EAX- stores the return value of functions. RCX/ ECX- Stores pointers to objects. MSVC __fastcall calling convention

REcap

Page 58: Behind Enemy Lines Reverse Engineering C++ in Modern Ages · RAX/ EAX- stores the return value of functions. RCX/ ECX- Stores pointers to objects. MSVC __fastcall calling convention

After understanding those Objects and Inheritance, it’s time to go back to the code

flow

Page 59: Behind Enemy Lines Reverse Engineering C++ in Modern Ages · RAX/ EAX- stores the return value of functions. RCX/ ECX- Stores pointers to objects. MSVC __fastcall calling convention

Controller::runLevel - assembly ● In the beginning we had the spaceship shared_pointer initialization.● Afterwards we can find the following function call:

● We need to dig deeper into this function and understand what happens there.

Page 60: Behind Enemy Lines Reverse Engineering C++ in Modern Ages · RAX/ EAX- stores the return value of functions. RCX/ ECX- Stores pointers to objects. MSVC __fastcall calling convention

fillWavesVector:: Emplace_Pack Wave objects

Page 61: Behind Enemy Lines Reverse Engineering C++ in Modern Ages · RAX/ EAX- stores the return value of functions. RCX/ ECX- Stores pointers to objects. MSVC __fastcall calling convention

fillWavesVector:: Emplace_Pack Wave objects

Page 62: Behind Enemy Lines Reverse Engineering C++ in Modern Ages · RAX/ EAX- stores the return value of functions. RCX/ ECX- Stores pointers to objects. MSVC __fastcall calling convention

● We can understand this function emplaces object in a vector. ● These object are unique pointers that represent every level named “wave”

fillWavesVector:: Emplace_Pack Wave objects

Page 63: Behind Enemy Lines Reverse Engineering C++ in Modern Ages · RAX/ EAX- stores the return value of functions. RCX/ ECX- Stores pointers to objects. MSVC __fastcall calling convention

fillWavesVector:: Emplace_back WaveBoss objects● When we look further we realize that the function emplaces more unique

pointers of objects like WaveBosses. Uhm not suspicious at all!

Page 64: Behind Enemy Lines Reverse Engineering C++ in Modern Ages · RAX/ EAX- stores the return value of functions. RCX/ ECX- Stores pointers to objects. MSVC __fastcall calling convention

Controller::fillWavesVector Code

Page 65: Behind Enemy Lines Reverse Engineering C++ in Modern Ages · RAX/ EAX- stores the return value of functions. RCX/ ECX- Stores pointers to objects. MSVC __fastcall calling convention

Controller::runLevel Using the Wave vector● Before delving into understanding the waveBoss2 let’s check the usage of the

wave’s vector.

Page 66: Behind Enemy Lines Reverse Engineering C++ in Modern Ages · RAX/ EAX- stores the return value of functions. RCX/ ECX- Stores pointers to objects. MSVC __fastcall calling convention

Controller::runLevel Using the Wave vector● Before delving into understanding the waveBoss2 let’s check the usage of the

wave’s vector.●

Page 67: Behind Enemy Lines Reverse Engineering C++ in Modern Ages · RAX/ EAX- stores the return value of functions. RCX/ ECX- Stores pointers to objects. MSVC __fastcall calling convention

Controller::runLevel Using the Wave vector

Page 68: Behind Enemy Lines Reverse Engineering C++ in Modern Ages · RAX/ EAX- stores the return value of functions. RCX/ ECX- Stores pointers to objects. MSVC __fastcall calling convention

Controller::runLevel- Virtual Call ● There are lots problem for reverse engineers when virtual call is been used.● We can not easily know statically know which function is going to be called.

Page 69: Behind Enemy Lines Reverse Engineering C++ in Modern Ages · RAX/ EAX- stores the return value of functions. RCX/ ECX- Stores pointers to objects. MSVC __fastcall calling convention

REcap● After reading the assembly code, so far we figure out some of the parts!

Page 70: Behind Enemy Lines Reverse Engineering C++ in Modern Ages · RAX/ EAX- stores the return value of functions. RCX/ ECX- Stores pointers to objects. MSVC __fastcall calling convention

Examine the virtual call on runtime

Page 71: Behind Enemy Lines Reverse Engineering C++ in Modern Ages · RAX/ EAX- stores the return value of functions. RCX/ ECX- Stores pointers to objects. MSVC __fastcall calling convention

Examine the virtual call on runtime

Page 72: Behind Enemy Lines Reverse Engineering C++ in Modern Ages · RAX/ EAX- stores the return value of functions. RCX/ ECX- Stores pointers to objects. MSVC __fastcall calling convention

Examine the virtual call on runtime

Page 73: Behind Enemy Lines Reverse Engineering C++ in Modern Ages · RAX/ EAX- stores the return value of functions. RCX/ ECX- Stores pointers to objects. MSVC __fastcall calling convention

Virtual call to Wave3::createWave()● The address of the the register EAX(contains the function address of the virtual

call) is Wave3::createWave()

Page 74: Behind Enemy Lines Reverse Engineering C++ in Modern Ages · RAX/ EAX- stores the return value of functions. RCX/ ECX- Stores pointers to objects. MSVC __fastcall calling convention

Examine the virtual call on runtime

Page 75: Behind Enemy Lines Reverse Engineering C++ in Modern Ages · RAX/ EAX- stores the return value of functions. RCX/ ECX- Stores pointers to objects. MSVC __fastcall calling convention

Examine the virtual call on runtime

Page 76: Behind Enemy Lines Reverse Engineering C++ in Modern Ages · RAX/ EAX- stores the return value of functions. RCX/ ECX- Stores pointers to objects. MSVC __fastcall calling convention

Virtual call to Wave4::createWave()● The next time we ran the code, EAX points to Wave4::createWave()

Page 77: Behind Enemy Lines Reverse Engineering C++ in Modern Ages · RAX/ EAX- stores the return value of functions. RCX/ ECX- Stores pointers to objects. MSVC __fastcall calling convention

The virtual call - createWave()● After running the code multiple times, we discovered the virtual call is to

createWave() of the relevant Wave object.● All the wave objects are part of the vector explained before and being chosen

according to a counter

Page 78: Behind Enemy Lines Reverse Engineering C++ in Modern Ages · RAX/ EAX- stores the return value of functions. RCX/ ECX- Stores pointers to objects. MSVC __fastcall calling convention

The virtual call - createWave()● After running the code multiple times, we discovered the virtual call is to

createWave of the relevant Wave object.● All the wave objects are part of the vector explained before and beeing chose

according to a counter ● When a boss appear in the game the “WaveBossX::createWave” function is being

called.

Page 79: Behind Enemy Lines Reverse Engineering C++ in Modern Ages · RAX/ EAX- stores the return value of functions. RCX/ ECX- Stores pointers to objects. MSVC __fastcall calling convention

Examine WaveBoss2

Page 80: Behind Enemy Lines Reverse Engineering C++ in Modern Ages · RAX/ EAX- stores the return value of functions. RCX/ ECX- Stores pointers to objects. MSVC __fastcall calling convention

WaveBoss2 constructor

● “WaveBoss” Inherits from ChickenBoss2

Page 81: Behind Enemy Lines Reverse Engineering C++ in Modern Ages · RAX/ EAX- stores the return value of functions. RCX/ ECX- Stores pointers to objects. MSVC __fastcall calling convention

WaveBoss2 constructor

Page 82: Behind Enemy Lines Reverse Engineering C++ in Modern Ages · RAX/ EAX- stores the return value of functions. RCX/ ECX- Stores pointers to objects. MSVC __fastcall calling convention

The Flow from here● We can see that “WaveBoss2” Inherits from “ChickenBoss2”● Our next step is to reverse engineer the code of ChickenBoss2 and figure out

what we would want to change in the boss.

Page 83: Behind Enemy Lines Reverse Engineering C++ in Modern Ages · RAX/ EAX- stores the return value of functions. RCX/ ECX- Stores pointers to objects. MSVC __fastcall calling convention

Summary● It is quite similar to the process we’ve done so far I’ll summarize the results.

Page 84: Behind Enemy Lines Reverse Engineering C++ in Modern Ages · RAX/ EAX- stores the return value of functions. RCX/ ECX- Stores pointers to objects. MSVC __fastcall calling convention

Summary● It is quite similar to the process we’ve done so far I’ll summarize the results.● After reversing the “ChickenBoss2” object we figure out it also inherits from

“ChickenBase” that inherits from “GameObject”

WaveBoss2 ChickenBoss2 ChickenBase GameObject

Page 85: Behind Enemy Lines Reverse Engineering C++ in Modern Ages · RAX/ EAX- stores the return value of functions. RCX/ ECX- Stores pointers to objects. MSVC __fastcall calling convention

Summary● It is quite similar to the process we’ve done so far I’ll summarize the results.● After reversing the “ChickenBoss2” object we figure out it also inherits from

“ChickenBase” that inherits from “GameObject”● We also saw “GameObject” has other children like: regularChicken, spaceShip,

etc.○ After reversing GameObject we saw one of its members seems like the amount of lives the

object has.

Page 86: Behind Enemy Lines Reverse Engineering C++ in Modern Ages · RAX/ EAX- stores the return value of functions. RCX/ ECX- Stores pointers to objects. MSVC __fastcall calling convention

Summary● It is quite similar to the process we’ve done so far I’ll summarize the results.● After reversing the “ChickenBoss2” object we figure out it also inherits from

“ChickenBase” that inherits from “GameObject”● We also saw “GameObject” has other children like: regularChicken, spaceShip,

etc.○ After reversing GameObject we saw one of its members seems like the amount of lives the

object has.

○ Now we know what to change!

Page 87: Behind Enemy Lines Reverse Engineering C++ in Modern Ages · RAX/ EAX- stores the return value of functions. RCX/ ECX- Stores pointers to objects. MSVC __fastcall calling convention

Changing the boss lives ● After the research we’ve done now we can understand what is this member:

● The amount of lives the boss has

Page 88: Behind Enemy Lines Reverse Engineering C++ in Modern Ages · RAX/ EAX- stores the return value of functions. RCX/ ECX- Stores pointers to objects. MSVC __fastcall calling convention

Changing the boss lives

Page 89: Behind Enemy Lines Reverse Engineering C++ in Modern Ages · RAX/ EAX- stores the return value of functions. RCX/ ECX- Stores pointers to objects. MSVC __fastcall calling convention

Changing the boss lives

Page 90: Behind Enemy Lines Reverse Engineering C++ in Modern Ages · RAX/ EAX- stores the return value of functions. RCX/ ECX- Stores pointers to objects. MSVC __fastcall calling convention

Changing the boss lives

Page 91: Behind Enemy Lines Reverse Engineering C++ in Modern Ages · RAX/ EAX- stores the return value of functions. RCX/ ECX- Stores pointers to objects. MSVC __fastcall calling convention

Changing the boss lives

Page 92: Behind Enemy Lines Reverse Engineering C++ in Modern Ages · RAX/ EAX- stores the return value of functions. RCX/ ECX- Stores pointers to objects. MSVC __fastcall calling convention

Questions?

@0xgalz

Page 93: Behind Enemy Lines Reverse Engineering C++ in Modern Ages · RAX/ EAX- stores the return value of functions. RCX/ ECX- Stores pointers to objects. MSVC __fastcall calling convention

Thank you for your time

@0xgalz