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

 

 


Tema destacado: Curso de javascript por TickTack


+  Foro de elhacker.net
|-+  Programación
| |-+  Programación General
| | |-+  ASM (Moderador: Eternal Idol)
| | | |-+  Problema inyeccion
0 Usuarios y 1 Visitante están viendo este tema.
Páginas: [1] Ir Abajo Respuesta Imprimir
Autor Tema: Problema inyeccion  (Leído 3,121 veces)
rmdma()

Desconectado Desconectado

Mensajes: 17


mov eax,0x69


Ver Perfil
Problema inyeccion
« en: 1 Marzo 2012, 11:19 am »

codigo al que inyectar:
Código
  1.    include 'win32ax.inc'
  2.  
  3.    .data
  4.        t1 db 'sindlll',0
  5.        t2 db 'damedll',0
  6.  
  7.  
  8.    .code
  9.    start:
  10.        stdcall prueba,t1,t2
  11.        ret
  12.  
  13.        proc prueba,t1,t2
  14.            mov esi,[t1]
  15.            mov ecx,[t2]
  16.  
  17.           push 0
  18.           push esi
  19.           push ecx
  20.           push 0
  21.           call [MessageBoxA]
  22.           ret
  23.  
  24.         endp
  25.    .end start
  26.  

la dll:
Código
  1. format PE GUI 4.0 DLL
  2. entry DllEntryPoint
  3.  
  4. include 'win32a.inc'
  5.  
  6. section '.data'
  7.  
  8. dato1 db 'hellooo',0
  9. dato2 db 'agurrrr',0
  10.  
  11.  
  12. section '.text' code readable executable
  13.  
  14. proc DllEntryPoint hinstDLL,fdwReason,lpvReserved
  15.  
  16. pushad
  17. push dato1
  18. push dato2
  19. mov eax, 0x00402010 ; la direccion de la funcion prueba
  20. call eax
  21. add esp,8
  22. popad
  23. endp    
  24.  

quiero usar la funcion prueba desde la dll, pero me esta petando , hesegido el tutorial este
https://foro.elhacker.net/programacion_cc/tutorialiniciandome_en_el_hacking_mediante_inyeccion_de_dll_con_ejercicio-t258750.15.html
pero  me lo e montao en asm.


En línea

Eternal Idol
Kernel coder
Moderador
***
Desconectado Desconectado

Mensajes: 5.937


Israel nunca torturó niños, ni lo volverá a hacer.


Ver Perfil WWW
Re: Problema inyeccion
« Respuesta #1 en: 1 Marzo 2012, 12:51 pm »

Tenes que depurar tu codigo para ver donde falla, podes poner un int 3 en el codigo y configurar el WinDbg como depurador post-mortem, ejecutandolo con -I, asi se abre automaticamente.


En línea

La economía nunca ha sido libre: o la controla el Estado en beneficio del Pueblo o lo hacen los grandes consorcios en perjuicio de éste.
Juan Domingo Perón
_Enko


Desconectado Desconectado

Mensajes: 538



Ver Perfil WWW
Re: Problema inyeccion
« Respuesta #2 en: 1 Marzo 2012, 13:43 pm »

la dll esta mal hecha. Te falta la sección de reloc/fixups.

Tenes que poner esto al final de la dll.
Código:
section '.reloc' fixups data discardable
En los ejemplos de fasm, en la carpeta EXAMPLES hay una DLL.


Código
  1.  
  2. ; DLL creation example
  3.  
  4. format PE GUI 4.0 DLL
  5. entry DllEntryPoint
  6.  
  7. include 'win32a.inc'
  8.  
  9. section '.text' code readable executable
  10.  
  11. proc DllEntryPoint hinstDLL,fdwReason,lpvReserved
  12. mov eax,TRUE
  13. ret
  14. endp
  15.  
  16. ; VOID ShowErrorMessage(HWND hWnd,DWORD dwError);
  17.  
  18. proc ShowErrorMessage hWnd,dwError
  19.  local lpBuffer:DWORD
  20. lea eax,[lpBuffer]
  21. invoke FormatMessage,FORMAT_MESSAGE_ALLOCATE_BUFFER+FORMAT_MESSAGE_FROM_SYSTEM,0,[dwError],LANG_NEUTRAL,eax,0,0
  22. invoke MessageBox,[hWnd],[lpBuffer],NULL,MB_ICONERROR+MB_OK
  23. invoke LocalFree,[lpBuffer]
  24. ret
  25. endp
  26.  
  27. ; VOID ShowLastError(HWND hWnd);
  28.  
  29. proc ShowLastError hWnd
  30. invoke GetLastError
  31. stdcall ShowErrorMessage,[hWnd],eax
  32. ret
  33. endp
  34.  
  35. section '.idata' import data readable writeable
  36. ;..............imports
  37.  
  38. section '.reloc' fixups data discardable
  39.  
  40.  

Si estas en WinNT y familia, no le gusta la secciónes vacias.
En ese caso, se hace
Código:
section '.reloc' data discardable fixups 
if ~ $-$$  
        dd      0,8 ;empty fixups section iff no other fixups  
end if
Saludos.
« Última modificación: 1 Marzo 2012, 13:57 pm por _Enko » En línea

Páginas: [1] Ir Arriba Respuesta Imprimir 

Ir a:  

Mensajes similares
Asunto Iniciado por Respuestas Vistas Último mensaje
Problema Inyeccion SQL
Nivel Web
WiseHidden 8 4,526 Último mensaje 25 Diciembre 2010, 12:47 pm
por WiseHidden
problema Inyeccion DLL
Programación C/C++
tig0 4 2,310 Último mensaje 31 Julio 2011, 12:44 pm
por tig0
Problema con inyección SQL
Bugs y Exploits
janisorna 2 3,595 Último mensaje 11 Julio 2013, 18:44 pm
por janisorna
problema inyeccion SQL
Nivel Web
BigByte 5 2,972 Último mensaje 26 Enero 2014, 00:12 am
por dRak0
WAP2 - Aviso Legal - Powered by SMF 1.1.21 | SMF © 2006-2008, Simple Machines