Hi Leutz
ich habe mal ein frage was genau die IAT (import address table )ist meines erachtens sind da die addressen drinn um funktion bzw apis aufzurufen.
beispiel:
00404254 $- FF25 28504000 JMP DWORD PTR DS:[<&user32.GetDlgItemTex>; user32.GetDlgItemTextA
hier jumpt der doch zur dll user32 api procaddresse 77D6AC06
DS:[00405028]=77D6AC06 (user32.GetDlgItemTextA)
Local calls from 0040413B, 004041BE
Wie genau arbeitet iidking der nimmt doch auch die addresse von einer ausgewählten dll und ausgewählten funktion die addresse und speichert die in der ziel.exe.
ich benutze für mein inline patcher die find kernel32 funktion und getprocaddress funktion
aber leider schlagen die av´s alarm und es läuft nur auf der windows version auf der die ziel.exe gepatcht wurde also muss ich die iat patchen.
könnte mir einer ein source posten in masm?
ich weis nur so weit:
mapping die ziel.exe
schreibe die section
und schreibe die iat mit den function und hier komme ich nicht weiter
mfg
ragdog
ich habe mal ein frage was genau die IAT (import address table )ist meines erachtens sind da die addressen drinn um funktion bzw apis aufzurufen.
beispiel:
00404254 $- FF25 28504000 JMP DWORD PTR DS:[<&user32.GetDlgItemTex>; user32.GetDlgItemTextA
hier jumpt der doch zur dll user32 api procaddresse 77D6AC06
DS:[00405028]=77D6AC06 (user32.GetDlgItemTextA)
Local calls from 0040413B, 004041BE
Wie genau arbeitet iidking der nimmt doch auch die addresse von einer ausgewählten dll und ausgewählten funktion die addresse und speichert die in der ziel.exe.
ich benutze für mein inline patcher die find kernel32 funktion und getprocaddress funktion
Code:
;This is yoda's code with some small changes and commenting
GetKernelBaseAddress: ;returns 0 on error
mov edi,[esp+4] ;Get the value of the first parameter, which is the address of the top of the stack
and edi,0FFFF0000h ; wipe the LOWORD !
.WHILE TRUE
.IF word ptr [edi]==IMAGE_DOS_SIGNATURE
mov esi,edi
add esi,[esi+03Ch]
.IF dword ptr [esi]==IMAGE_NT_SIGNATURE
.BREAK
.ENDIF
.ENDIF
sub edi,010000h
.IF edi<070000000h ;The kernel32.dll would be no lower than this address
mov edi,0BFF70000h
.BREAK
.ENDIF
.ENDW
xchg eax,edi
ret 4
GetProcedureAddress:
; check PE Signarue
mov esi,[esp+4h] ;DllBaseAddress
cmp word ptr [esi],IMAGE_DOS_SIGNATURE
jnz @@error
add esi,[esi+3Ch]
cmp dword ptr [esi],IMAGE_NT_SIGNATURE
jnz @@error
; get the string length of the target Api
mov edi,[esp+8h] ;szapi
mov ecx,150
xor al,al
repnz scasb
mov ecx,edi
sub ecx,[esp+8h] ;ecx = szAPI length
; trace the export table
mov edx,[esi+78h] ;edx = xport table
add edx,[esp+4h]
assume edx:ptr IMAGE_EXPORT_DIRECTORY
mov ebx,[edx].AddressOfNames;ebx = addressOfNames array pointer
add ebx,[esp+4h]
xor eax,eax
.REPEAT
mov edi,[ebx]
add edi,[esp+4h]
mov esi,[esp+8h]
push ecx
repz cmpsb
.IF ZERO?
add esp,4
.BREAK
.ENDIF
pop ecx
add ebx,4
inc eax
.UNTIL eax==[edx].NumberOfNames
; did we found sth ?
.IF eax==[edx].NumberOfNames
jmp @@error
.ENDIF
; find the corresponding Ordinal
mov esi,[edx].AddressOfNameOrdinals
add esi,[esp+4h]
push edx ;save the export table pointer
mov ebx,2
xor edx,edx
mul ebx
pop edx
add eax,esi
xor ecx,ecx
mov word ptr cx,[eax] ;ecx = api Ordinal
mov edi,[edx].AddressOfFunctions;get the address of the api
xor edx,edx
mov ebx,4
mov eax,ecx
mul ebx
add eax,[esp+4h]
add eax,edi
mov eax,[eax]
add eax,[esp+4h]
jmp @@got_proc_address
assume edx:nothing
@@error:
xor eax,eax
@@got_proc_address:
ret 8
aber leider schlagen die av´s alarm und es läuft nur auf der windows version auf der die ziel.exe gepatcht wurde also muss ich die iat patchen.
könnte mir einer ein source posten in masm?
ich weis nur so weit:
mapping die ziel.exe
schreibe die section
und schreibe die iat mit den function und hier komme ich nicht weiter
mfg
ragdog