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 4 Weeks Ago
nitrogrlie is offline.
New User
  
 
Join Date: Oct 2009
Posts: 24
Reputation: 3
Points: 190, Level: 1
Points: 190, Level: 1 Points: 190, Level: 1 Points: 190, Level: 1
Level up: 48%, 210 Points needed
Level up: 48% Level up: 48% Level up: 48%
Activity: 6.0%
Activity: 6.0% Activity: 6.0% Activity: 6.0%
DLL Injection

This is my first time playing with in-process application modification (previously did out-of-process manipulation and packet spoofing / client recreation) and I don't understand why the following code isn't working right now:
Code:
	DWORD guidLOW, guidHIGH;

	__asm 
	{
		mov edx, 0x00476580
		call edx
		mov guidLOW, eax
		mov guidHIGH, edx
	}

	char guidStr[32];
	_snprintf_s(guidStr, 32, 32, "GUID: 0x%08x%08x\n", guidHIGH, guidLOW);
	MessageBox(0, guidStr, "GUID", 0);
I run this from a thread I create in the Initialization function of a DLL I inject. The issue is that basically the guidStr I get is 0x0000000000000000. I know the function address is okay because I used Olly to pause WoW and re-direct EIP at a random point in time to that address and it ran fine, generating the appropriate GUID.

Am I just doing some dumb mistake?

Thanks for the help in advance...
Reply With Quote


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

  #2  
Old 4 Weeks Ago
lanman92 is offline.
Site Donator
  
 
Join Date: Mar 2007
Posts: 767
Reputation: 20
Points: 3,876, Level: 6
Points: 3,876, Level: 6 Points: 3,876, Level: 6 Points: 3,876, Level: 6
Level up: 31%, 624 Points needed
Level up: 31% Level up: 31% Level up: 31%
Activity: 6.7%
Activity: 6.7% Activity: 6.7% Activity: 6.7%

Your TLS is off. Look at the asm in that function. You'll see that it reads from FS:0x2C. That's thread-local and you'll have to rip the OM from the 'regular' memory and put it in your thread's local storage. Or, you could hook EndScene.
Reply With Quote
  #3  
Old 4 Weeks Ago
furang's Avatar
furang is offline.
Master Sergeant
  
 
Join Date: Jul 2009
Posts: 84
Reputation: 19
Points: 315, Level: 1
Points: 315, Level: 1 Points: 315, Level: 1 Points: 315, Level: 1
Level up: 79%, 85 Points needed
Level up: 79% Level up: 79% Level up: 79%
Activity: 5.1%
Activity: 5.1% Activity: 5.1% Activity: 5.1%

I guess it should be smth like this
Code:
mov EDX, [0x012705B0] ; getting OM
mov EDX, [EDX+0x00002D94] ; EDX=OM
mov EAX, FS:[0x2C]; getting TLS
mov EAX, [EAX] ; EAX=TLS[0]
add EAX, 8 ; EAX=TLS[2]
mov [EAX], EDX ;replacing TLS[2] pointer with pointer to OM
__________________
i did it 4 lulz

Last edited by furang; 4 Weeks Ago at 11:24 PM.
Reply With Quote
  #4  
Old 4 Weeks Ago
nitrogrlie is offline.
New User
  
 
Join Date: Oct 2009
Posts: 24
Reputation: 3
Points: 190, Level: 1
Points: 190, Level: 1 Points: 190, Level: 1 Points: 190, Level: 1
Level up: 48%, 210 Points needed
Level up: 48% Level up: 48% Level up: 48%
Activity: 6.0%
Activity: 6.0% Activity: 6.0% Activity: 6.0%
Quote:
Originally Posted by lanman92 View Post
Your TLS is off. Look at the asm in that function. You'll see that it reads from FS:0x2C. That's thread-local and you'll have to rip the OM from the 'regular' memory and put it in your thread's local storage. Or, you could hook EndScene.
That explains it, but that also brings up more questions. Since WoW has the same FS seg descriptor (0x0053) for each thread but it's base is different in each case I can't just GetThreadContext() of one of its threads and set my FS accordingly. So how else to obtain my GUID properly?

Quote:
mov EDX, [0x012705B0]
mov EDX, [EDX+0x00002D94]
mov EAX, FS:[0x2C]
mov EAX, [EAX]
add EAX, 8
mov [EAX], edx
I do not understand this the address or the offsets (aka what they are, where they came from, and how you found them). Could you please elaborate?
Reply With Quote
  #5  
Old 4 Weeks Ago
furang's Avatar
furang is offline.
Master Sergeant
  
 
Join Date: Jul 2009
Posts: 84
Reputation: 19
Points: 315, Level: 1
Points: 315, Level: 1 Points: 315, Level: 1 Points: 315, Level: 1
Level up: 79%, 85 Points needed
Level up: 79% Level up: 79% Level up: 79%
Activity: 5.1%
Activity: 5.1% Activity: 5.1% Activity: 5.1%

lanman92 gave nice coments in prev post. ok. i've added coments in my post.
__________________
i did it 4 lulz
Reply With Quote
  #6  
Old 4 Weeks Ago
nitrogrlie is offline.
New User
  
 
Join Date: Oct 2009
Posts: 24
Reputation: 3
Points: 190, Level: 1
Points: 190, Level: 1 Points: 190, Level: 1 Points: 190, Level: 1
Level up: 48%, 210 Points needed
Level up: 48% Level up: 48% Level up: 48%
Activity: 6.0%
Activity: 6.0% Activity: 6.0% Activity: 6.0%
Quote:
Originally Posted by furang View Post
lanman92 gave nice coments in prev post. ok. i've added coments in my post.
Thanks for the help, the code you gave me wasn't working until I made a small change, for some reason "mov EDX, [0x012705B0]" would load 0x012705B0 into EDX, and not its dereferenced value. Here it is and I also included two ways of obtaining the player GUID, one in asm and one with func ptrs.

Code:
	unsigned int ObjMngr = 0;

	// Correct TLS with proper ObjectManager ptr
	__asm {
		mov EDX, 0x012705B0
		mov EDX, [EDX]
		mov EDX, [EDX+0x2D94]
		mov ObjMngr, EDX
		mov EAX, FS:[0x2C] 
		mov EAX, [EAX] 		; EAX = TLS[0] 
		mov [EAX+8], EDX 	; replacing TLS[2] pointer with pointer to ObjMngr
	}

	// Get our GUID
	unsigned int guidLOW, guidHIGH;
	__asm {
		mov edx, 0x00476580
		call edx
		mov guidLOW, eax
		mov guidHIGH, edx
	}

	typedef unsigned long long (*fptr_t)(void);
	fptr_t GetPlayerGuid = (fptr_t)0x00476580;
	unsigned long long x = GetPlayerGuid();

	FILE * file = fopen("C:\\Users\\Public\\test.txt", "w");
	fprintf(file, "ObjMngr Addr: 0x%08x\n", ObjMngr);
	fprintf(file, "GUID: 0x%08x%08x\n", guidHIGH, guidLOW);
	fprintf(file, "GUID: 0x%016llx\n", x);
	fflush(file);
	fclose(file);

	char guidStr[32];
	_snprintf_s(guidStr, 32, 32, "GUID: 0x%08x%08x\n", guidHIGH, guidLOW);
	MessageBox(0, guidStr, "GUID", 0);
EDIT: I should add, that once you have ObjMngr you really don't need to call either function to get the GUID as you can just use the ObjMngr with 0xC0 offset to get the GUID.

What I would love to learn though, is how people arrived at the 0x012705B0 addr and the 0x2D94 offset so that I can find it myself in future patches?

Last edited by nitrogrlie; 4 Weeks Ago at 12:17 AM.
Reply With Quote
  #7  
Old 4 Weeks Ago
lanman92 is offline.
Site Donator
  
 
Join Date: Mar 2007
Posts: 767
Reputation: 20
Points: 3,876, Level: 6
Points: 3,876, Level: 6 Points: 3,876, Level: 6 Points: 3,876, Level: 6
Level up: 31%, 624 Points needed
Level up: 31% Level up: 31% Level up: 31%
Activity: 6.7%
Activity: 6.7% Activity: 6.7% Activity: 6.7%

Look at the function at 0x47A480. The last part of that function shows the offsets. It's always the last xref to 'ObjectMgrClient.cpp' from what I can remember in the recent patches.
Reply With Quote
  #8  
Old 4 Weeks Ago
nitrogrlie is offline.
New User
  
 
Join Date: Oct 2009
Posts: 24
Reputation: 3
Points: 190, Level: 1
Points: 190, Level: 1 Points: 190, Level: 1 Points: 190, Level: 1
Level up: 48%, 210 Points needed
Level up: 48% Level up: 48% Level up: 48%
Activity: 6.0%
Activity: 6.0% Activity: 6.0% Activity: 6.0%
Using VFTable Funcs

Here is some code in case anyone else is learning DLL injection and gets annoyed with mistakes here and there when trying to use the VFTables.

Code:
DWORD WINAPI runFunction(LPVOID lParam) {  
	unsigned int ObjMngr = 0;

	// Correct TLS with proper ObjectManager ptr
	__asm {
		mov EDX, 0x012705B0
		mov EDX, [EDX]
		mov EDX, [EDX+0x2D94]
		mov ObjMngr, EDX
		mov EAX, FS:[0x2C] 
		mov EAX, [EAX] 		; EAX = TLS[0] 
		mov [EAX+8], EDX 	; replacing TLS[2] pointer with pointer to ObjMngr
	}

	// Get our GUID
	DWORD guidLOW, guidHIGH;
	__asm {
		mov edx, 0x00476580
		call edx
		mov guidLOW, eax
		mov guidHIGH, edx
	}
	
	// Alternative way to get GUID without asm code
	/*
	typedef unsigned long long (*fptr_t)(void);
	fptr_t GetPlayerGuid = (fptr_t)0x00476580;
	unsigned long long playerGuid = GetPlayerGuid();
	*/

	// Get Player pointer
	DWORD playerPtr = 0;
	DWORD playerVFTable = 0;
	__asm {
		push 0xA1
		push 0x00
		push 0x10
		push guidHIGH
		push guidLOW
		mov EDX, 0x00477B50
		call EDX
		mov playerPtr, EAX
		mov EAX, [EAX]
		mov playerVFTable, EAX
		add esp, 0x14
	}

	FILE * file = fopen("C:\\Users\\Public\\test.txt", "w");
	fprintf(file, "ObjMngr Addr: 0x%08x\n", ObjMngr);
	fprintf(file, "GUID: 0x%08x%08x\n", guidHIGH, guidLOW);
	//fprintf(file, "GUID: 0x%016llx\n", playerGuid);
	fprintf(file, "Ptr : 0x%08x\n", playerPtr);
	fprintf(file, "pVFT: 0x%08x\n", playerVFTable);

	// List VFTable addresses
	DWORD VFTable[53];
	for( unsigned short i = 0; i < 53; i++ ) {
		DWORD addr = 0;
		DWORD index = playerVFTable + 4*i;
		__asm {
			mov EDX, index
			mov EDX, [EDX]
			mov addr, EDX
		}
		VFTable[i] = addr;
		fprintf(file, "\t[%02d] - 0x%08x\n", i, addr);
	}
	fprintf(file, "\n");

	// Get our Position
	float pos[3] = {0.0};
	DWORD pos_addr = (DWORD)&pos[0];
	DWORD index = VFTable[11];

	// test this by getting 10 points
	for( unsigned int i = 0; i < 10; i++ ) {
		__asm {
			mov EDX, index
			push pos_addr
			mov ECX, playerPtr
			call EDX
			add esp, 4
		}
		fprintf(file, "Position: %04.2f, %04.2f, %03.2f\n", pos[0], pos[1], pos[2]);

		char gStr[128];
		_snprintf_s(gStr, 128, 128, "Position: %04.2f, %04.2f, %03.2f\n",  pos[0], pos[1], pos[2]);
		MessageBox(0, gStr, "Info", 0);
	}

	// Flush and Close our file
	fflush(file);
	fclose(file);

	// Check Stuff

    ExitThread(0);
}
To Remember: When using VFtables you need to set ECX to be the pointer to the class of the object you want to call the VFTable function for. That led me to a few crashes before I had a "duh" moment.

Next - i'm looking for information of how to perform IPC between the loaded DLL and my injection program through the use of data_seg. Is there a good manual link anyone can provide that describes how to "use" it and not how to "define" it? Or perhaps a post with a quick example?
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 04:42 PM.




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

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