Register for your free account! | Forgot your password?

Go Back   elitepvpers > Coders Den > General Coding
You last visited: Today at 00:27

  • Please register to post and access all features, it's quick, easy and FREE!

Advertisement



[asm] modul base

Discussion on [asm] modul base within the General Coding forum part of the Coders Den category.

Reply
 
Old   #1
 
Tyrar's Avatar
 
elite*gold: 0
Join Date: Oct 2008
Posts: 1,637
Received Thanks: 1,119
[asm] modul base

ich versuche grade, an die base adresse einer dll zur kommen!
ich kann allerdings kein GetModuleHandle verwenden, da das ganze mit meinem crypter zu tun hat. strings sind auch schlecht möglich zu verwenden.

ich bräuchte etwas in die richtung, wie es auch mit der process base geht:
Code:
mov eax, fs:[0x30]
mov eax, [eax+8] ; process base
so könnte ich dann zur runtime die ganzen adressen berechnen, relocations kann ich leider auch nicht verwenden, da die auch (möglichst) entfernt werden sollen

jemand ne idee wie ich das anstellen kann?

oder gibt es eine möglichkeit an das eip register zu kommen?
damit könnte ich immerhin auch was anfangen!

edit:
mir kam grad nach dem absenden des posts ne passende idee:
Code:
GetEIP:
pop eax
jmp eax
Code:
call GetEIP
Tyrar is offline  
Old 05/28/2012, 17:30   #2


 
Ende!'s Avatar
 
elite*gold: 1
Join Date: Feb 2009
Posts: 6,378
Received Thanks: 7,996
Code:
; ------------------------------------------------------------------------------
; Name: sc_FindGPA
; Return:	eax = Address of GetProcAddress
;		edx = Module handle of Kernel32.dll
; ------------------------------------------------------------------------------
sc_FindGPA Macro
	Local _no_match
	Local _walk_export_list
	Local _leave_loop
		
		push			ebp
		mov			ebp, esp					; Create stack frame
		sub			esp, 20
		
		push			ecx
		push			ebx
		push			edi
		push			esi
		
		sc_FindKernel32		edx
		
		mov			eax, [edx+3Ch] 		; PE Header
		add			eax, edx		; Add VMA
		mov			esi, [eax+78h] 		; Export table ptr
		add			esi, edx		; Add VMA
		add			esi, 18h		; Number of names
		
		lodsd
		mov			[ebp-4], eax
		
		lodsd
		add			eax, edx
		mov			[ebp-8], eax
		
		lodsd
		add			eax, edx
		mov			[ebp-12], eax
		
		lodsd
		add			eax, edx
		mov			[ebp-16], eax
				
		mov			ecx, [ebp-4]
		xor			ebx, ebx

	; Search export list for GetProcAddress
	_walk_export_list:
		lea			eax, [ebx*4]
		add			eax, [ebp-12]
		mov			eax, [eax]
		add			eax, edx
		
		mov			edi, [eax]
		cmp			edi, 'PteG'
		jne short		_no_match
		mov			edi, [eax+4]
		cmp			edi, 'Acor'
		jne short		_no_match
		
		jmp short		_leave_loop
	_no_match:
		
		inc			ebx
		loop 			_walk_export_list
		
	_leave_loop:
	
		; Ordinal is in ebx nao
		
		lea			eax, [ebx*2]
		add			eax, [ebp-16]
		lea			eax, [eax]
		
		; Get function address using ordinal as index
		xor 			ebx, ebx
		mov 			bx, word ptr[eax]
		shl			ebx, 2  			; * 4
		add			ebx, [ebp-8]
		mov			eax, [ebx]
		add			eax, edx
		
		pop			esi
		pop			edi
		pop			ebx
		pop			ecx
		
		leave
		
EndM
Code:
; ------------------------------------------------------------------------------
; Name: sc_FindKernel32
; Parameters: reg = register to store ptr to Kernel32.dll
; ------------------------------------------------------------------------------
sc_FindKernel32 Macro reg:REQ
	Local _next_module

		push	esi
		push	edi

		mov	esi, fs:[30h]
		mov	esi, [esi+0Ch]
		mov	esi, [esi+1Ch]
		
	_next_module:
		mov	reg, [esi+08h]
		mov	edi, [esi+20h]
		mov	esi, [esi]
		cmp	byte ptr[edi+12*2], 0
		jne	_next_module
		
		pop	edi
		pop	esi
EndM
Copy pasta aus einem alten Projekt von mir, welches exzessiven Gebrauch von Shellcode machte. Um das Ganze zu verstehen, solltest du mit dem MASM Syntax vertraut sein.

Edit:
Quote:
oder gibt es eine möglichkeit an das eip register zu kommen?
damit könnte ich immerhin auch was anfangen!
Um auch diese Frage zu beantworten:
Code:
GetEIP proc
    pop eax
    push eax
    ret
GetEIP endp
So mach ich's immer, deine Variante ist aber selbstredend auch möglich.
Ende! is offline  
Reply


Similar Threads Similar Threads
Wp Modul Opera Help
06/08/2011 - DarkOrbit - 7 Replies
Hello, I use Opera, but I can not work in Opera Wp Modules Please Please help me Mozilla Freezes Opera Pluing None Not Working
[NDSL/NDS] R4 Modul!
03/03/2011 - Trading - 0 Replies
Hallo, ich wusste nicht wohin damit, also mach ich hier ein Thread auf! Ist nur das Modul! R4 Revolution, Klappt noch alles wunderbar! Ich akzeptiere nur PayPal! 20 € würden reichen! Der Handel wird so ablaufen: 1. Ihr sendet mir 20 € PayPal. ! Es müssen genau ungefähr 20 € sein!!!! Achtet auf die Steuer!
D&D Online - Modul 10
12/19/2009 - User Submitted News - 0 Replies
Noch vor Weihnachten: Modul 10 im Anmarsch Das 10. Modul zu Dungeons and Dragons Online mit dem Titel "The Path of Inspiration", kommt noch vor Weihnachten. Codemasters gab das Erscheinungsdatum der europäischen Version bekannt. Demnach erscheint Modul 10 am 21. Dezember. Das bedeute, dass die Server wie gewohnt zu der üblichen Zeit von 9.00 Uhr bis 16.00 (MEZ) nicht online sein werden. Mit "The Path of Inspiration" kommen dann Abenteuer für Level 17 bis 19, neue Epische Dungeons, der...
Gm modul?
07/17/2009 - Metin2 Private Server - 3 Replies
Hey leute... Gibt es eigentlich ein GMmodul zur eingabe von Values? Weil die normalen benutzer können das ja nicht benutzen... Aber da die Pserverfiles ja langsam PUB sind könnte ja evtl. das GMmodul in diesen sachen stecken... Weiss jemand bescheid darüber? Mfg
Public Modul
01/27/2008 - WarRock - 5 Replies
Hi kann irgentjemand wieder mal ein public modul für visual basic 6.0 hier rein schicken ? Ich wäre sehr dankbar :D



All times are GMT +1. The time now is 00:28.


Powered by vBulletin®
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
SEO by vBSEO ©2011, Crawlability, Inc.
This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

Support | Contact Us | FAQ | Advertising | Privacy Policy | Terms of Service | Abuse
Copyright ©2025 elitepvpers All Rights Reserved.