EMO Style ForumPro - Hos Geldiniz
[Asm] Codecaving tutorial Uyeols10

Join the forum, it's quick and easy

EMO Style ForumPro - Hos Geldiniz
[Asm] Codecaving tutorial Uyeols10
EMO Style ForumPro - Hos Geldiniz
Would you like to react to this message? Create an account in a few clicks or log in to continue.
Giriş yap

Şifremi unuttum

Istatistikler
Toplam 203 kayıtlı kullanıcımız var
Son kaydolan kullanıcımız: crayzboy76

Kullanıcılarımız toplam 1186 mesaj attılar bunda 862 konu
Tarıyıcı
 Kapı
 Indeks
 Üye Listesi
 Profil
 SSS
 Arama
Arama
 
 

Sonuç :
 


Rechercher çıkıntı araştırma

RSS akısı


Yahoo! 
MSN 
AOL 
Netvibes 
Bloglines 


Anahtar-kelime

kutu  loot  pointer  

Kimler hatta?
Toplam 9 kullanıcı online :: 0 Kayıtlı, 0 Gizli ve 9 Misafir

Yok

[ Bütün listeye bak ]


Sitede bugüne kadar en çok 217 kişi C.tesi Tem. 29, 2017 1:46 am tarihinde online oldu.
En son konular
» İnternetten Para Kazandıran Oyun ! Ödeme Alt Limiti Yok ! DEV KONU
[Asm] Codecaving tutorial I_icon_minitimeCuma Ağus. 29, 2014 8:33 am tarafından Hello EMO

» goldenchase.net maden yaparak para kazanma
[Asm] Codecaving tutorial I_icon_minitimeCuma Ağus. 29, 2014 8:18 am tarafından Hello EMO

» etichal hacker görsel egitim seti
[Asm] Codecaving tutorial I_icon_minitimeÇarş. Ağus. 06, 2014 4:57 am tarafından Hello EMO

» KO TBL Source C#
[Asm] Codecaving tutorial I_icon_minitimePtsi Ara. 09, 2013 6:36 am tarafından Hello EMO

» x86 Registers
[Asm] Codecaving tutorial I_icon_minitimeC.tesi Ağus. 24, 2013 5:02 am tarafından Hello EMO

» [Tutorial] Pegando Address, Pointers de WYD
[Asm] Codecaving tutorial I_icon_minitimeÇarş. Tem. 10, 2013 7:25 am tarafından Hello EMO

» [Tutorial] Pegando Address, Pointers de CS Metodo²
[Asm] Codecaving tutorial I_icon_minitimeÇarş. Tem. 10, 2013 7:23 am tarafından Hello EMO

» [Tutorial] Aprendendo basico deASM OLLYDBG
[Asm] Codecaving tutorial I_icon_minitimeÇarş. Tem. 10, 2013 7:22 am tarafından Hello EMO

» Basic C# DLL injector
[Asm] Codecaving tutorial I_icon_minitimePtsi Tem. 08, 2013 7:48 am tarafından Hello EMO

Reklam

[Asm] Codecaving tutorial

Aşağa gitmek

[Asm] Codecaving tutorial Empty [Asm] Codecaving tutorial

Mesaj tarafından Hello EMO Cuma Ocak 14, 2011 5:28 pm

Codecaving tutorial


Codecaving is, basically, to put a jump before a target offset that needs to be patched to an empty or unimportant zone in memory, put your modified code there, and then jump back under the target address.

What's the point of doing this?
Codecaving allows you to get the effects of modifying an offset that could be blacklisted by poor anti-cheat software (ex: Warden in Warcraft 3), since you never modify it directly.
You could therefore take the offsets of some hack and make them almost "undetectable" (considering you keep that hack private or simply for yourself).


Pseudo example:

Before the code cave and patching:

  • 1 Address 1 and its content
    2 Target
    3 Address 3 and its content

    4 Unimportant stuff
    5 Unimportant stuff
    6 Unimportant stuff


(Unimportant stuff is mostly 00's and INT3's)

After the Code cave and patching:

  • 1 JUMP to address 4
    2 Target
    3 Address 3 and its content

    4 Address 1's content
    5 Patched target
    6 JUMP back to address 3

As you can see, the target code is still being patched, but not at Address 5 instead of Address 2.

Let's do a codecave now!

Things you will need:

  • An offset to patch
  • A real-time debugger (OllyDBG)

For this example, we are going to use some stupid offset I found while offset-hunting in Warcraft 3:

6F39B991 BA 08000000 MOV EDX,8

to

6F39B991 BA 00000000 MOV EDX,0

Effect: Removes ground textures (ground becomes all black).

Let's analyze the bunch of code over that address. Open up Warcraft 3 and get in a custom game. Then start OllyDBG and attach war3.exe, then right click -> go to -> 6F39B991 or CTRL+G -> 6F39B991 (you may need to do this twice to get to the address).

We must first find some empty memory zone in which we will input our code.

By scrolling down to the end of Game.dll, I found out this neat little place:
[code=asm] 6F85BE24 0000 ADD BYTE PTR DS:[EAX],AL
6F85BE26 0000 ADD BYTE PTR DS:[EAX],AL
6F85BE28 0000 ADD BYTE PTR DS:[EAX],AL
6F85BE2A 0000 ADD BYTE PTR DS:[EAX],AL
6F85BE2C 0000 ADD BYTE PTR DS:[EAX],AL
6F85BE2E 0000 ADD BYTE PTR DS:[EAX],AL
6F85BE30 0000 ADD BYTE PTR DS:[EAX],AL
6F85BE32 0000 ADD BYTE PTR DS:[EAX],AL
6F85BE34 0000 ADD BYTE PTR DS:[EAX],AL
6F85BE36 0000 ADD BYTE PTR DS:[EAX],AL
6F85BE38 0000 ADD BYTE PTR DS:[EAX],AL
6F85BE3A 0000 ADD BYTE PTR DS:[EAX],AL
6F85BE3C 0000 ADD BYTE PTR DS:[EAX],AL
6F85BE3E 0000 ADD BYTE PTR DS:[EAX],AL
6F85BE40 0000 ADD BYTE PTR DS:[EAX],AL
6F85BE42 0000 ADD BYTE PTR DS:[EAX],AL [/code]
etc.

Then let'a go back to our target address, 6F39B991, and analyse what's around it.
[code=asm] 6F39B974 8D4C24 24 LEA ECX,DWORD PTR SS:[ESP+24]
6F39B978 E8 E3A8C7FF CALL Game.6F016260
=> 6F39B97D E8 1E50C7FF CALL Game.6F0109A0
6F39B982 39AE 30030000 CMP DWORD PTR DS],EBP
6F39B988 74 07 JE SHORT Game.6F39B991
6F39B98A 8BCE MOV ECX,ESI
6F39B98C E8 4FEDFFFF CALL Game.6F39A6E0
6F39B991 BA 08000000 MOV EDX,8 // Target offset
6F39B996 8D4C24 5C LEA ECX,DWORD PTR SS:[ESP+5C] // Return address [/code]
We will use a normal jump to get there.

6F39B97D seems like a good place to start our jump since it is 5 bytes long. Take that address's info down in notepad or w/e.

6F39B97D E8 1E50C7FF CALL Game.6F0109A0

PAUSE OllyDBG and change this line:

6F39B97D E8 1E50C7FF CALL Game.6F0109A0

to

6F39B97D E9 A2044C00 JMP Game.6F85BE24

To do this, Select then right click the address -> Assemble or simply press spacebar then type: jmp 6F85BE24 and press enter (don't fill with NOP's)

[Asm] Codecaving tutorial Codecavingtutorial01
Now press enter on that address to go the empty zone.

On 6F85BE24, we will place the info of the address we took down in note. It was

CALL Game.6F0109A0

Like we did just a minute ago, we will right click -> assemble.

Type call 6F0109A0 and press enter.

[Asm] Codecaving tutorial Codecavingtutorial02
Now that we have added this line, we need to also add everything else that was between it and our target address:
[code=asm] 6F39B982 39AE 30030000 CMP DWORD PTR DS:[ESI+330],EBP
6F39B988 74 07 JE SHORT Game.6F39B991
6F39B98A 8BCE MOV ECX,ESI
6F39B98C E8 4FEDFFFF CALL Game.6F39A6E0
6F39B991 BA 08000000 MOV EDX,8 // target address [/code]
So, just like we did before, click on the line below the one we modified and assemble this:

[Asm] Codecaving tutorial Codecavingtutorial03
Then, on the next line, assemble this twice:

[Asm] Codecaving tutorial Codecavingtutorial04
The reason we are putting 2 NOP's here instead of JE SHORT 6F39B991 is because 6F39B991 is way out of range for the short jump.

Then, on the next line:

[Asm] Codecaving tutorial Codecavingtutorial05
Then, on the next line:

[Asm] Codecaving tutorial Codecavingtutorial06
Now let's modify MOV EDX,8 to MOV EDX,0 to get the black floor effect in-game.

Assemble at 6F85BE38:

[Asm] Codecaving tutorial Codecavingtutorial07
Alright, we are almost done! What we need to do now is jump back to 6F39B996, the address that was just below our target.

Assemble this on the next line:

[Asm] Codecaving tutorial Codecavingtutorial08
Your memory should now look like this:

Your jump:

[Asm] Codecaving tutorial 081
Your code cave:

[Asm] Codecaving tutorial 082
Alright, now we need to jump to the memory zone we just made.

Assemble this at:

[Asm] Codecaving tutorial Codecavingtutorial09

You are now ready to press on PLAY in OllyDBG. Your floor should be black.
© Tyrano
Hello EMO
Hello EMO
EMO Team
EMO Team

Cinsiyet : Erkek
Burçlar : Yay
Yılan
Mesaj Sayısı : 935
Puan : 384393
Rep Puanı : 18
Doğum tarihi : 28/11/89
Kayıt tarihi : 21/07/09
Yaş : 34
Nerden : EMO WorlD
İş/Hobiler : RCE Student / Game Hacking / Learn Beginner C#,C++,Delphi
Lakap : EMO

https://emostyle.yetkinforum.com

Sayfa başına dön Aşağa gitmek

Sayfa başına dön

- Similar topics

 
Bu forumun müsaadesi var:
Bu forumdaki mesajlara cevap veremezsiniz