Complex GodMode written in Assembly [Code Injection]

    [move]THIS IS JUST FOR THE LOVE OF BEAUTIFUL CODE ![/move]
Hello, today i made this little complex cleo here.

this is a simple BUT complex godmode cleo, written in assembly and cleo code (lol can you believe that?)

Basically... this is an example of "Code Injection" and exploitation of the hex end tags in CLEO in order build a Code Cave!

CLEO code:
Code:
{$CLEO}

//   This is an example of:
// - How to use CLEO for building a code cave.
// - Made by T3KTONIT
// - origine : -

0000: START
:ShowLoadedText
wait 1000
0AD1: show_formatted_text_highpriority "Complex Health is loaded!" time 5000
jump @Thread_0

:Thread_0
wait 1000                            
0A9F: 0@ = current_thread_pointer                
0A8E: 0@ = 0@ + 16
0A8D: 1@ = read_memory 0@ size 4 virtual_protect 0
0A8E: 1@ = 1@ + 200
/////////////////////// Simple Code Injection ///////////////////////

0A8C: write_memory 0x04B331C size 4 value 1@ virtual_protect 1 
0A8C: write_memory 0x04B331B size 1 value 0xB8 virtual_protect 1
0A8C: write_memory 0x04B3320 size 1 value 0xFF virtual_protect 1
0A8C: write_memory 0x04B3321 size 1 value 0xE0 virtual_protect 1
0A8C: write_memory 0x04B3322 size 1 value 0x90 virtual_protect 1 
0A8C: write_memory 0x04B3323 size 1 value 0x90 virtual_protect 1 
0A8C: write_memory 0x04B3324 size 1 value 0x90 virtual_protect 1
 
// *************************************************
// * MOV EAX, (addressof)Assembly_Code_Container   *  <-------------------- this is the injected assembly code.
// * JMP EAX                                       *
// *************************************************

///////////////////////----------------------/////////////////////// 
       
jump @Thread_0

:Assembly_Code_Container
hex
CC CC CC CC CC     // INT 3

8B 54 24 14        // MOV EDX, [ESP + 0x14]
B8 25 33 4B 00     // MOV EAX, gta_sa.exe + 0xB3325      
81 FA 00 00 C0 41  // CMP EDX, 0x41C00000      
7D 02              // JNL _next_label jump next 0x2 bytes      <-------------------- this is the assembly code for the health hack        
FF E0              // JMP EAX 
89 96 40 05 00 00  // MOV [ESI+00000540],EDX     
FF E0              // JMP EAX
  
CC CC CC CC CC     // INT 3
end   

the code used in this cleo is :

Code:
1- MOV EDX, [ESP + 0x14]
2- MOV EAX, gta_sa.exe + 0xB3325      
3- CMP EDX, 0x41C00000      
4- JNL _next_label jump next 0x2 bytes            
5- JMP EAX 
6- MOV [ESI+00000540],EDX     
7- JMP EAX

Now let me explain:


The first line is just a continuation to the original code.
The second line is storing location to the original code.
The third and 4th line is for comparing the Health if its smaller than 24.00 (float)
The 5th and 7th lines are for jumping back to original code
The 6th line is for moving the health to the player.


Okay, i'm not gonna explain more about what the Assembly code does, but i'm sure you can learn that by yourself.

Now these write_memory codes here:

Code:
0A8C: write_memory 0x04B331C size 4 value 1@ virtual_protect 1 
0A8C: write_memory 0x04B331B size 1 value 0xB8 virtual_protect 1
0A8C: write_memory 0x04B3320 size 1 value 0xFF virtual_protect 1
0A8C: write_memory 0x04B3321 size 1 value 0xE0 virtual_protect 1
0A8C: write_memory 0x04B3322 size 1 value 0x90 virtual_protect 1 
0A8C: write_memory 0x04B3323 size 1 value 0x90 virtual_protect 1 
0A8C: write_memory 0x04B3324 size 1 value 0x90 virtual_protect 1

These are for changing the flow of the code by adding a JMP instruction!
first of all we add a MOV EAX instruction (Byte code : 0xB8) and we move our Container address which at 1@ to eax
Then we JMP to eax (byte code : 0xFF, 0xE0) and this code takes us to our Code cave (@Assembly_Code_Container)

SO lets resume what's gonna happen, FIRST when you're going to take damage the original code is gonna get executed, then the flow of the code will be changed so instead of continuing normally (damaging you player), it will JUMP to our container (which contains Assembly code) and then it will executed the code, and then JUMP back to the original place it came from.
Tadaaa.

Aaaaand that's it, hope you enjoy my tutorial. leave a thanks if you did.  :somuchwin:

PS: i challenge you to create a cleo like this. (it doesn't have to be healthhack, you can make airbrake, or spammer or anything else... or even healthhack xDD)


.CS file is added in the attachements, It is automatically Enabled.
(If you get exploded by admins you will die.)
 

Attachments

  • cleo.cs
    19.2 KB · Views: 89

FraizeR007

Active member
Joined
Aug 12, 2014
Messages
58
Reaction score
0
Re: [Code Injection/Challenge]Complex GodMode written in Assembly

T3K link said:
    [move]THIS IS JUST FOR THE LOVE OF BEAUTIFUL CODE ![/move]
Hello, today i made this little complex cleo here.

this is a simple BUT complex godmode cleo, written in assembly and cleo code (lol can you believe that?)

Basically... this is an example of "Code Injection" and exploitation of the hex end tags in CLEO in order build a Code Cave!

CLEO code:
Code:
{$CLEO}

//   This is an example of:
// - How to use CLEO for building a code cave.
// - Made by T3KTONIT
// - origine : -

0000: START
:ShowLoadedText
wait 1000
0AD1: show_formatted_text_highpriority "Complex Health is loaded!" time 5000
jump @Thread_0

:Thread_0
wait 1000                            
0A9F: 0@ = current_thread_pointer                
0A8E: 0@ = 0@ + 16
0A8D: 1@ = read_memory 0@ size 4 virtual_protect 0
0A8E: 1@ = 1@ + 200
/////////////////////// Simple Code Injection ///////////////////////

0A8C: write_memory 0x04B331C size 4 value 1@ virtual_protect 1 
0A8C: write_memory 0x04B331B size 1 value 0xB8 virtual_protect 1
0A8C: write_memory 0x04B3320 size 1 value 0xFF virtual_protect 1
0A8C: write_memory 0x04B3321 size 1 value 0xE0 virtual_protect 1
0A8C: write_memory 0x04B3322 size 1 value 0x90 virtual_protect 1 
0A8C: write_memory 0x04B3323 size 1 value 0x90 virtual_protect 1 
0A8C: write_memory 0x04B3324 size 1 value 0x90 virtual_protect 1
 
// *************************************************
// * MOV EAX, (addressof)Assembly_Code_Container   *  <-------------------- this is the injected assembly code.
// * JMP EAX                                       *
// *************************************************

///////////////////////----------------------/////////////////////// 
       
jump @Thread_0

:Assembly_Code_Container
hex
CC CC CC CC CC     // INT 3

8B 54 24 14        // MOV EDX, [ESP + 0x14]
B8 25 33 4B 00     // MOV EAX, gta_sa.exe + 0xB3325      
81 FA 00 00 C0 41  // CMP EDX, 0x41C00000      
7D 02              // JNL _next_label jump next 0x2 bytes      <-------------------- this is the assembly code for the health hack        
FF E0              // JMP EAX 
89 96 40 05 00 00  // MOV [ESI+00000540],EDX     
FF E0              // JMP EAX
  
CC CC CC CC CC     // INT 3
end   

the code used in this cleo is :

Code:
1- MOV EDX, [ESP + 0x14]
2- MOV EAX, gta_sa.exe + 0xB3325      
3- CMP EDX, 0x41C00000      
4- JNL _next_label jump next 0x2 bytes            
5- JMP EAX 
6- MOV [ESI+00000540],EDX     
7- JMP EAX

Now let me explain:


The first line is just a continuation to the original code.
The second line is storing location to the original code.
The third and 4th line is for comparing the Health if its smaller than 24.00 (float)
The 5th and 7th lines are for jumping back to original code
The 6th line is for moving the health to the player.


Okay, i'm not gonna explain more about what the Assembly code does, but i'm sure you can learn that by yourself.

Now these write_memory codes here:

Code:
0A8C: write_memory 0x04B331C size 4 value 1@ virtual_protect 1 
0A8C: write_memory 0x04B331B size 1 value 0xB8 virtual_protect 1
0A8C: write_memory 0x04B3320 size 1 value 0xFF virtual_protect 1
0A8C: write_memory 0x04B3321 size 1 value 0xE0 virtual_protect 1
0A8C: write_memory 0x04B3322 size 1 value 0x90 virtual_protect 1 
0A8C: write_memory 0x04B3323 size 1 value 0x90 virtual_protect 1 
0A8C: write_memory 0x04B3324 size 1 value 0x90 virtual_protect 1

These are for changing the flow of the code by adding a JMP instruction!
first of all we add a MOV EAX instruction (Byte code : 0xB8) and we move our Container address which at 1@ to eax
Then we JMP to eax (byte code : 0xFF, 0xE0) and this code takes us to our Code cave (@Assembly_Code_Container)

SO lets resume what's gonna happen, FIRST when you're going to take damage the original code is gonna get executed, then the flow of the code will be changed so instead of continuing normally (damaging you player), it will JUMP to our container (which contains Assembly code) and then it will executed the code, and then JUMP back to the original place it came from.
Tadaaa.

Aaaaand that's it, hope you enjoy my tutorial. leave a thanks if you did.  :somuchwin:

PS: i challenge you to create a cleo like this. (it doesn't have to be healthhack, you can make airbrake, or spammer or anything else... or even healthhack xDD)


.CS file is added in the attachements, It is automatically Enabled.
(If you get exploded by admins you will die.)

CAn you please tell the link or the list of NOPS opCodes?. i wanted to make some cool mods
 

T3KTONIT

Well-known member
Joined
Sep 2, 2013
Messages
308
Reaction score
5
Re: [Code Injection/Challenge]Complex GodMode written in Assembly

FraizeR007 link said:
CAn you please tell the link or the list of NOPS opCodes?. i wanted to make some cool mods
these are not NOPs. and i don't know..
 

FraizeR007

Active member
Joined
Aug 12, 2014
Messages
58
Reaction score
0
Re: [Code Injection/Challenge]Complex GodMode written in Assembly

T3K link said:
these are not NOPs. and i don't know..

I mean the list of memory codes "write_memory codes" list the meaning of it?
 

0x_

Wtf I'm not new....
Administrator
Joined
Feb 18, 2013
Messages
1,118
Reaction score
166
Re: [Code Injection/Challenge]Complex GodMode written in Assembly

T3K link said:

PS: i challenge you to create a cleo like this. (it doesn't have to be healthhack, you can make airbrake, or spammer or anything else... or even healthhack xDD)


.CS file is added in the attachements, It is automatically Enabled.
(If you get exploded by admins you will die.)

Dont see that happen sadly no one here cares about that...
Anyway good work ;p
 

FraizeR007

Active member
Joined
Aug 12, 2014
Messages
58
Reaction score
0
Re: [Code Injection/Challenge]Complex GodMode written in Assembly

T3K link said:

Nice, and is there any tutorial how to write_memory address? How to disable/enable?

BTW im confuse with your tut above xD

what is [byte] before the memory address?

is that like

1= on
0= off

do i need to put that thing onto it?
 

T3KTONIT

Well-known member
Joined
Sep 2, 2013
Messages
308
Reaction score
5
Re: [Code Injection/Challenge]Complex GodMode written in Assembly

FraizeR007 link said:
Nice, and is there any tutorial how to write_memory address? How to disable/enable?

BTW im confuse with your tut above xD

what is [byte] before the memory address?

is that like

1= on
0= off

do i need to put that thing onto it?
omg this is not memory hack, this is byte patching and it is advanced stuff....

if you want to just simply write memory, just do this:
write_memory ADDRESS size 4 value VALUE virtual_protect 0

for example suicide(set health to 0):
Code:
0A8D: 1@ = read_memory 0xB6F5F0 size 4 virtual_protect 0
0A8E: 1@ = 1@ + 0x540
0A8C: write_memory 1@ size 4 value 0 virtual_protect 0
 
Top