Network: WoW Gold | WoW Accounts | MPS Games | FPSowned
MMOwned - World of Warcraft Exploits, Hacks, Bots and Guides
Homepage »      Register »      Hall of Fame »      Ranks And Awards »      Advertise »      Marketplace »
 
Sign up



Do you like this excellent information? Then Donate HERE to remove ads and support the MMOwned community.


Go Back   MMOwned - World of Warcraft Exploits, Hacks, Bots and Guides > World of Warcraft > Bots and Programs > WoW Memory Editing

WoW Memory Editing WoW Memory Editing for learning purposes only.
This section is more advanced than others on MMOwned Read the section specific rules, infractions will be given out if u break them!That is including the expectations! - If you don't meet them then don't post

Reply
 
LinkBack Thread Tools
  #1  
Old 10-30-2009
Cromon's Avatar
Cromon is offline.
Contributor

  
 
Join Date: Mar 2008
Location: Switzerland
Posts: 327
Nominated 29 Times in 3 Posts
Nominated TOTM/W Award(s): 1
Reputation: 132
Points: 3,581, Level: 5
Points: 3,581, Level: 5 Points: 3,581, Level: 5 Points: 3,581, Level: 5
Level up: 98%, 19 Points needed
Level up: 98% Level up: 98% Level up: 98%
Activity: 14.6%
Activity: 14.6% Activity: 14.6% Activity: 14.6%

Advanced Injection

Hello everyone!

After a lot of work my ASM-Injection lib for C++ is finally finished. Now of course i want to test that thing and use it

My first steps worked well (calling virtuall functions of objects) and are making a lot of fun ! But now im trying to get to some advanced things which at the moment arent working. Here is a list of what id like to learn:

1. Calling functions with parameters
2. Hooking LUA-Events
3. Hooking WoW-Functions

Well, lets begin with the first one, functions with parameters. From what i made in ASM before when i was learning the basics of ASM i used to call functions with parameters by pushing my parameter on the stack and in the function it gets popped and used. Now i tried that with the lua-function IsFlying. I suggest that it uses one parameter that is the unit we want to inspect. So, thats what i now coded:
Code:
	IAsmInterface* ias = g_MemInterf->GetInterface();
	ias->Clear();
	DWORD dwAddr = ias->AllocateMemory(g_MemInterf->GetProcess());
	ias->AddLine("mov eax, %u", obj->GetOffset());
	ias->AddLine("push eax");
	ias->AddLine("xor eax, eax");
	ias->AddLine("call %u", 0x005973F0);
	ias->AddLine("retn");
	DWORD dwRet = ias->InjectAndExecute(g_MemInterf->GetProcess(), dwAddr, 0);
Now that crashed wow with an acces_violation that the memory could not be written.

To the other 2 points i mentioned above id say we come if the first one is solved

Greetings
Cromon

Last edited by Cromon; 10-30-2009 at 05:01 AM.
Reply With Quote


Donate to remove ads, get your "DONATOR title, and get access to the MMOwned community's elite Shoutbawx.

  #2  
Old 10-30-2009
ggg898 is offline.
Sergeant
  
 
Join Date: Jan 2009
Posts: 39
Reputation: 10
Points: 409, Level: 1
Points: 409, Level: 1 Points: 409, Level: 1 Points: 409, Level: 1
Level up: 2%, 491 Points needed
Level up: 2% Level up: 2% Level up: 2%
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%

If its the lua function you are trying to call (i havnt looked at the address, just asuming) then the parameter is not the unit, it is the lua state which lua uses to pass parameter in.
Reply With Quote
  #3  
Old 10-30-2009
Robske's Avatar
Robske is offline.
Contributor
  
 
Join Date: May 2007
Location: Dragon Shores
Posts: 773
Reputation: 180
Points: 4,156, Level: 6
Points: 4,156, Level: 6 Points: 4,156, Level: 6 Points: 4,156, Level: 6
Level up: 62%, 344 Points needed
Level up: 62% Level up: 62% Level up: 62%
Activity: 6.1%
Activity: 6.1% Activity: 6.1% Activity: 6.1%

Quote:
Originally Posted by ggg898 View Post
If its the lua function you are trying to call (i havnt looked at the address, just asuming) then the parameter is not the unit, it is the lua state which lua uses to pass parameter in.
Could be wrong, but the Lua Function IsFlying() will throw the boolean on the lua stack instead of placing it in eax right?
__________________
“First learn computer science and all the theory. Next develop a programming style. Then forget all that and just hack.” -(George Carrette)
Reply With Quote
  #4  
Old 10-30-2009
Cromon's Avatar
Cromon is offline.
Contributor

  
 
Join Date: Mar 2008
Location: Switzerland
Posts: 327
Nominated 29 Times in 3 Posts
Nominated TOTM/W Award(s): 1
Reputation: 132
Points: 3,581, Level: 5
Points: 3,581, Level: 5 Points: 3,581, Level: 5 Points: 3,581, Level: 5
Level up: 98%, 19 Points needed
Level up: 98% Level up: 98% Level up: 98%
Activity: 14.6%
Activity: 14.6% Activity: 14.6% Activity: 14.6%

Yes, i think its placed on the LUA-stack and in eax there will be either 1 or 0 if the function pushed something on the stack or not.

The offset is taken from the 3.2.2a info posted by Apoc, so i guess its correct. Ill try to do things with the lua_state cause even if i would get IsFlying working without the lua_state i would need it to get the returnvalue.
Reply With Quote
  #5  
Old 10-30-2009
furang's Avatar
furang is offline.
Master Sergeant
  
 
Join Date: Jul 2009
Posts: 84
Reputation: 19
Points: 364, Level: 1
Points: 364, Level: 1 Points: 364, Level: 1 Points: 364, Level: 1
Level up: 91%, 36 Points needed
Level up: 91% Level up: 91% Level up: 91%
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%

Attach olly and trace that call. Inject CC opcode at the beginning for int3. And your stack is not balanced. Fix this obvious bugs. If doesn't help just let us know.
__________________
i did it 4 lulz
Reply With Quote
  #6  
Old 10-30-2009
ggg898 is offline.
Sergeant
  
 
Join Date: Jan 2009
Posts: 39
Reputation: 10
Points: 409, Level: 1
Points: 409, Level: 1 Points: 409, Level: 1 Points: 409, Level: 1
Level up: 2%, 491 Points needed
Level up: 2% Level up: 2% Level up: 2%
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%

Im just happy I dont use advanced injection. Seems hard :P
Reply With Quote
  #7  
Old 10-30-2009
Cromon's Avatar
Cromon is offline.
Contributor

  
 
Join Date: Mar 2008
Location: Switzerland
Posts: 327
Nominated 29 Times in 3 Posts
Nominated TOTM/W Award(s): 1
Reputation: 132
Points: 3,581, Level: 5
Points: 3,581, Level: 5 Points: 3,581, Level: 5 Points: 3,581, Level: 5
Level up: 98%, 19 Points needed
Level up: 98% Level up: 98% Level up: 98%
Activity: 14.6%
Activity: 14.6% Activity: 14.6% Activity: 14.6%

Quote:
Originally Posted by furang View Post
Attach olly and trace that call. Inject CC opcode at the beginning for int3. And your stack is not balanced. Fix this obvious bugs. If doesn't help just let us know.
Kk, good idea, ill let olly go trough it. And thanks for pointing to the stack-thing, i allways forget that *memo*.
Reply With Quote
  #8  
Old 10-30-2009
flo8464's Avatar
flo8464 is offline.
Knight-Lieutenant
  
 
Join Date: Apr 2009
Location: Germany
Posts: 347
Reputation: 13
Points: 1,423, Level: 3
Points: 1,423, Level: 3 Points: 1,423, Level: 3 Points: 1,423, Level: 3
Level up: 4%, 677 Points needed
Level up: 4% Level up: 4% Level up: 4%
Activity: 9.4%
Activity: 9.4% Activity: 9.4% Activity: 9.4%

Quote:
Originally Posted by Cromon View Post
Yes, i think its placed on the LUA-stack and in eax there will be either 1 or 0 if the function pushed something on the stack or not.
Luafunctions return with eax set to the number of pushed things in total.
__________________
Hey, it compiles! Ship it!
Reply With Quote
  #9  
Old 10-30-2009
Cromon's Avatar
Cromon is offline.
Contributor

  
 
Join Date: Mar 2008
Location: Switzerland
Posts: 327
Nominated 29 Times in 3 Posts
Nominated TOTM/W Award(s): 1
Reputation: 132
Points: 3,581, Level: 5
Points: 3,581, Level: 5 Points: 3,581, Level: 5 Points: 3,581, Level: 5
Level up: 98%, 19 Points needed
Level up: 98% Level up: 98% Level up: 98%
Activity: 14.6%
Activity: 14.6% Activity: 14.6% Activity: 14.6%

yes, and cause IsFlying either fails or pushes a boolean it will be 1 or 0, thats what i ment in the post quoted
Reply With Quote
  #10  
Old 10-30-2009
ostapus is offline.
Master Sergeant
  
 
Join Date: Nov 2008
Posts: 79
Reputation: 36
Points: 596, Level: 1
Points: 596, Level: 1 Points: 596, Level: 1 Points: 596, Level: 1
Level up: 40%, 304 Points needed
Level up: 40% Level up: 40% Level up: 40%
Activity: 0.4%
Activity: 0.4% Activity: 0.4% Activity: 0.4%

why dont you look in IDA on IsFlying rather than bother people with questions ?
Reply With Quote
  #11  
Old 10-30-2009
Cromon's Avatar
Cromon is offline.
Contributor

  
 
Join Date: Mar 2008
Location: Switzerland
Posts: 327
Nominated 29 Times in 3 Posts
Nominated TOTM/W Award(s): 1
Reputation: 132
Points: 3,581, Level: 5
Points: 3,581, Level: 5 Points: 3,581, Level: 5 Points: 3,581, Level: 5
Level up: 98%, 19 Points needed
Level up: 98% Level up: 98% Level up: 98%
Activity: 14.6%
Activity: 14.6% Activity: 14.6% Activity: 14.6%

1. Read the thread, then answer if you really have something to say
2. Give me a license for a version of IDA compatible with a current symbol-database or give me a symbol-database for a free version
3. If i bother you with my question, hit ALT + F4 very, very, very, very, fast (or press the "back"-button of your browser in the same speed). If not and you like to contribute, do so. You can see in the replies above that there is a common interest in these things.

And last but not least:
If you just wanna troll, gtfo.

And now back to topic:
Couldnt work on that since the last posting, but ill keep you all updated!
Reply With Quote
  #12  
Old 10-30-2009
Robske's Avatar
Robske is offline.
Contributor
  
 
Join Date: May 2007
Location: Dragon Shores
Posts: 773
Reputation: 180
Points: 4,156, Level: 6
Points: 4,156, Level: 6 Points: 4,156, Level: 6 Points: 4,156, Level: 6
Level up: 62%, 344 Points needed
Level up: 62% Level up: 62% Level up: 62%
Activity: 6.1%
Activity: 6.1% Activity: 6.1% Activity: 6.1%

Quote:
Originally Posted by Cromon View Post
The offset is taken from the 3.2.2a info posted by Apoc, so i guess its correct. Ill try to do things with the lua_state cause even if i would get IsFlying working without the lua_state i would need it to get the returnvalue.
Rhough outlines to get return values:

Code:
LuaFunction(pLuaState)
for Index: 0 -> GetTop(pLuaState)
{
      Foo = ToFoo(pLuaState, Index, 0)
}
Keep in mind that you have to handle both stacks (The functions to handle the lua stack such as PushString, GetTop and ToString use the cdecl calling convention) As with ToFoo, if you wish to call a function that requires arguments, you'll have to push those on the lua stack manually.
__________________
“First learn computer science and all the theory. Next develop a programming style. Then forget all that and just hack.” -(George Carrette)
Reply With Quote
  #13  
Old 10-30-2009
ostapus is offline.
Master Sergeant
  
 
Join Date: Nov 2008
Posts: 79
Reputation: 36
Points: 596, Level: 1
Points: 596, Level: 1 Points: 596, Level: 1 Points: 596, Level: 1
Level up: 40%, 304 Points needed
Level up: 40% Level up: 40% Level up: 40%
Activity: 0.4%
Activity: 0.4% Activity: 0.4% Activity: 0.4%

so, you didn't look to isFlying....
1. eax will always = 1 (in case of isFlying)... rings any bell ?
2. any lua C function (which is isFlying) will always has just 1 parameter ( to answer what should be passed into function as parameter)
3. google ida (5.2 is latest "free" avaliable), you dont need "current" symbol database

was it helpfull enough ?
Reply With Quote
  #14  
Old 10-31-2009
Ellesar1 is offline.
Site Donator
  
 
Join Date: Feb 2009
Posts: 75
Reputation: 14
Points: 765, Level: 1
Points: 765, Level: 1 Points: 765, Level: 1 Points: 765, Level: 1
Level up: 73%, 135 Points needed
Level up: 73% Level up: 73% Level up: 73%
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%

Since IsFlying is a Lua function, it's signature has to conform to the Lua specification, and so is:
Code:
int IsFlying (lua_State* L);
- lua_State contains the whole state of Lua. Everything which is available to Lua is somehow referenced there. Therefore, there is only one lua_State in the whole game. There is some memory location which points to the lua_State. You can get it from the Info Dump Thread
- the function returns the number of arguments which should be returned. As IsFlying returns 1 or nil depending on whether you are flying or not, there will be always one argument returned and the return value of the function will therefore be one.

In the info dump thread, you can get the memory location of IsFlying. Go there with OllyDbg (or any other similar tool) to get the disassembled function. Try to fill out as many comment fields as you can. The Info Dump Thread is a real help here. If you are through, log in with a guest account and call the function to fill out even more comment fields. Here is what I get from looking at this function:

Code:
CPU Disasm
Address   Hex dump          Command                               Comments
005973F0  /.  55            PUSH EBP
005973F1  |.  8BEC          MOV EBP,ESP
005973F3  |.  E8 88F1EDFF   CALL 00476580                         ; GetActivePlayerGUID
005973F8  |.  68 A1000000   PUSH 0A1
005973FD  |.  68 C8DB9A00   PUSH OFFSET WoW.009ADBC8              ; ASCII "c:\BuildServer\bs1\work\WoW-code\branches\wow-patch-3_2_2_A-branch\WoW\Source\Object/ObjectClient/Player_C.h"
00597402  |.  6A 10         PUSH 10
00597404  |.  52            PUSH EDX                              ; Arg2 => guidHigh
00597405  |.  50            PUSH EAX                              ; Arg1 => guidLow
00597406  |.  E8 4507EEFF   CALL 00477B50                         ; GetObjectByGUID => eax = playerbase, ecx = playerbase+1818, edx = 10
0059740B  |.  83C4 14       ADD ESP,14
0059740E  |.  85C0          TEST EAX,EAX
00597410  |.  74 5D         JE SHORT 0059746F                     ; return nil if object wasn't returned properly
00597412  |.  8B88 680F0000 MOV ECX,DWORD PTR DS:[EAX+0F68]
00597418  |.  85C9          TEST ECX,ECX
0059741A  |.  74 29         JE SHORT 00597445
0059741C  |.  8379 14 03    CMP DWORD PTR DS:[ECX+14],3
00597420  |.  75 23         JNE SHORT 00597445                    ; if [playerbase+0f68] == 0 || [[playerbase+0f68]+14] != 3 jump
00597422  |.  8B10          MOV EDX,DWORD PTR DS:[EAX]            ; 009e6c70
00597424  |.  68 970E0000   PUSH 0E97
00597429  |.  68 347F9D00   PUSH OFFSET WoW.009D7F34              ; ASCII ".\ScriptEvents.cpp"
0059742E  |.  8BC8          MOV ECX,EAX
00597430  |.  8B42 3C       MOV EAX,DWORD PTR DS:[EDX+3C]
00597433  |.  6A 08         PUSH 8
00597435  |.  FFD0          CALL EAX                              ; call 0065ecc0
00597437  |.  52            PUSH EDX                              ; Arg2 => guidHigh ([playerbase+794])
00597438  |.  50            PUSH EAX                              ; Arg1 => guidLow ([playerbase+790])
00597439  |.  E8 1207EEFF   CALL 00477B50                         ; GetObjectByGUID
0059743E  |.  83C4 14       ADD ESP,14
00597441  |.  85C0          TEST EAX,EAX
00597443  |.  74 2A         JE SHORT 0059746F                     ; return nil if object wasn't returned properly
00597445  |>  8B88 D8000000 MOV ECX,DWORD PTR DS:[EAX+0D8]
0059744B  |.  F741 44 00000 TEST DWORD PTR DS:[ECX+44],02000000
00597452  |.  74 1B         JE SHORT 0059746F                     ; if [[eax+0d8]+44] == 02 00 00 00 return nil
00597454  |.  D9E8          FLD1                                  ; else return 1
00597456  |.  8B55 08       MOV EDX,DWORD PTR SS:[ARG.1]
00597459  |.  83EC 08       SUB ESP,8
0059745C  |.  DD1C24        FSTP QWORD PTR SS:[ARG.RETADDR]
0059745F  |.  52            PUSH EDX
00597460  |.  E8 ABC52600   CALL 00803A10                         ; lua_pushnumber
00597465  |.  83C4 0C       ADD ESP,0C
00597468  |.  B8 01000000   MOV EAX,1
0059746D  |.  5D            POP EBP
0059746E  |.  C3            RETN
0059746F  |>  8B45 08       MOV EAX,DWORD PTR SS:[ARG.1]          ; return nil
00597472  |.  50            PUSH EAX                              ; /Arg1 => [ARG.1]
00597473  |.  E8 78C52600   CALL 008039F0                         ; \WoW.008039F0, lua_pushnil
00597478  |.  83C4 04       ADD ESP,4
0059747B  |.  B8 01000000   MOV EAX,1
00597480  |.  5D            POP EBP
00597481  \.  C3            RETN
so, what I can take from this is that your desired info is

Code:
temp = playerbase;
if ([playerbase+0xf68] && [[playerbase+0xf68]+0x14] == 0x3) {
    guidL = [playerbase + 0x790];
    guidH = [playerbase + 0x794];
    temp = GetObjectByGUID(guidL, guidH);
}
return ([[temp+0xd8]+0x44] != 0x2000000) ? 1 : nil;
Couldn't find out what [playerbase+0xf68] represents and what GUID is standing at [playerbase + 0x790] if the if if-branch is taken.

Since I'm new to memory editing there can of course be some errors in this. Feel free to post any improvements or bug reports :-)
Reply With Quote
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are On



All times are GMT -4. The time now is 10:51 PM.




Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.3.2

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524