elhacker.net cabecera Bienvenido(a), Visitante. Por favor Ingresar o Registrarse
¿Perdiste tu email de activación?.

 

 


Tema destacado: Los 10 CVE más críticos (peligrosos) de 2020


+  Foro de elhacker.net
|-+  Seguridad Informática
| |-+  Análisis y Diseño de Malware (Moderador: fary)
| | |-+  [MASM32] KernelBase Address + GetProcAddress
0 Usuarios y 1 Visitante están viendo este tema.
Páginas: [1] Ir Abajo Respuesta Imprimir
Autor Tema: [MASM32] KernelBase Address + GetProcAddress  (Leído 3,430 veces)
The Swash

Desconectado Desconectado

Mensajes: 194


Programmer


Ver Perfil WWW
[MASM32] KernelBase Address + GetProcAddress
« en: 9 Mayo 2011, 02:23 am »

Código
  1. .386
  2. .model flat, stdcall
  3. option casemap:none
  4. assume fs:nothing
  5.  
  6. .data
  7. GPA db "GetProcAddress",0
  8. Cont dd 0
  9.  
  10. .code
  11. start:
  12. mov eax, fs:[030h]    ; Get pointer of the PEB
  13. mov eax, [eax + 0ch]  ; Get pointer of PPEB_LDR_DATA
  14. mov eax, [eax + 0ch]  ; Get pointer of InLoadOrderModuleList
  15. mov eax, [eax]        ; Get InLoadOrderModuleList of next library "ntdll"
  16. mov eax, [eax]        ; Get InLoadOrderModuleList of next library "kernel32"
  17. mov eax, [eax + 018h] ; Get BaseAddress of "kernel32"
  18.  
  19. mov ecx, dword ptr[eax + 03ch]   ; Set PE Offset
  20. add ecx, 078h                    ; Set in DirectoryTable[0]
  21. mov edx, dword ptr [eax + ecx]   ; Get Export Table RVA
  22. add edx, eax                     ; Add KernelBase Address
  23. xor ebx, ebx                     ; Clean EBX
  24. add edx, 020h                    ; Set in addressofnames RVA
  25. mov ebx, dword ptr [edx]         ; Get RVA AddressOfNames Table
  26. add ebx, eax                     ; Add KernelBase Address
  27.  
  28. COMP:                   ; Rutine of compare strings with "GetProcAddress", incrementing Cont
  29. add ebx, 4
  30. inc [Cont]
  31. mov esi, dword ptr [ebx]
  32. add esi, eax
  33. lea edi, [GPA]
  34. mov ecx, 0Eh
  35. repe cmpsb
  36. jnz COMP
  37.  
  38. ;GetAddress
  39. xor ebx, ebx            ; Clean EBX
  40. add edx, 04h            ; Set on Table Ordinal RVA
  41. mov ebx, dword ptr[edx] ; Get first RVA of Ordinal
  42. add ebx, eax            ; Add KernelBase Address
  43. mov edi, eax            ; Save KernelBase Address in EDI
  44. xor eax, eax            ; Clean EAX
  45. mov al, 02h             ; Base of WORD
  46. mov esi, edx            ; Save Address of RVA Ordinal Table
  47. mul word ptr[Cont]      ; Mul Cont for get WORD
  48. mov [Cont], eax         ; Get new value in Cont
  49. xor eax, eax            ; Clean EAX
  50. add ebx, [Cont]         ; Add Cont to Address of Ordinal Table
  51. mov ax,word ptr[ebx]    ; Get Ordinal of GetProcAddress
  52. sub esi, 08h            ; Set in AddressOfFunctions
  53. mov ecx, [esi]          ; Get First pointer to Functions RVA
  54. add ecx, edi            ; Add KernelBase Address
  55. xor ebx, ebx            ; Clean EBX
  56. mov ebx, eax            ; Mov Ordinal to EBX for MUL
  57. mov eax, 04h            ; Base of DWORD
  58. mul ebx                 ; Calcule spaces to Get address bassed in (Address of First Function + Ordinal GetProcAddress
  59. add ecx, eax            ; Add spaces for Set Address in RVA of GetProcAddress
  60. mov ecx, [ecx]          ; Get RVA of GetProcAddress
  61. add ecx, edi            ; Add KernelBase Address
  62. end start

Agradecimientos a Shaddy, [Zero], Lelo, Thor, Psymera & todos los que me han ayudado.
« Última modificación: 9 Mayo 2011, 02:28 am por The Swash » En línea

Páginas: [1] Ir Arriba Respuesta Imprimir 

Ir a:  

Mensajes similares
Asunto Iniciado por Respuestas Vistas Último mensaje
GetProcAddress alternative function
Programación Visual Basic
cobein 2 2,999 Último mensaje 9 Octubre 2008, 00:24 am
por cobein
Bajar Masm32
ASM
тαптяα 7 6,563 Último mensaje 16 Octubre 2010, 19:02 pm
por Eternal Idol
Duda con GetProcAddress
Ingeniería Inversa
.:UND3R:. 5 4,131 Último mensaje 8 Agosto 2011, 19:35 pm
por .:UND3R:.
Duda GetProcAddress
Programación C/C++
naderST 4 2,417 Último mensaje 5 Marzo 2013, 03:38 am
por naderST
no logro invocar a getprocaddress en masm 64 bits
ASM
Belial & Grimoire 3 3,152 Último mensaje 6 Agosto 2013, 06:10 am
por Belial & Grimoire
WAP2 - Aviso Legal - Powered by SMF 1.1.21 | SMF © 2006-2008, Simple Machines