Título: Problema inyeccion
Publicado por: rmdma() en 1 Marzo 2012, 11:19 am
codigo al que inyectar: include 'win32ax.inc' .data t1 db 'sindlll',0 t2 db 'damedll',0 .code start: stdcall prueba,t1,t2 ret proc prueba,t1,t2 mov esi,[t1] mov ecx,[t2] push 0 push esi push ecx push 0 call [MessageBoxA] ret endp .end start
la dll: format PE GUI 4.0 DLL entry DllEntryPoint include 'win32a.inc' section '.data' dato1 db 'hellooo',0 dato2 db 'agurrrr',0 section '.text' code readable executable proc DllEntryPoint hinstDLL,fdwReason,lpvReserved pushad push dato1 push dato2 mov eax, 0x00402010 ; la direccion de la funcion prueba call eax add esp,8 popad endp
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 (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.
Título: Re: Problema inyeccion
Publicado por: Eternal Idol 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.
Título: Re: Problema inyeccion
Publicado por: _Enko 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. section '.reloc' fixups data discardable
En los ejemplos de fasm, en la carpeta EXAMPLES hay una DLL. ; DLL creation example format PE GUI 4.0 DLL entry DllEntryPoint include 'win32a.inc' section '.text' code readable executable proc DllEntryPoint hinstDLL,fdwReason,lpvReserved mov eax,TRUE ret endp ; VOID ShowErrorMessage(HWND hWnd,DWORD dwError); proc ShowErrorMessage hWnd,dwError local lpBuffer:DWORD lea eax,[lpBuffer] invoke FormatMessage,FORMAT_MESSAGE_ALLOCATE_BUFFER+FORMAT_MESSAGE_FROM_SYSTEM,0,[dwError],LANG_NEUTRAL,eax,0,0 invoke MessageBox,[hWnd],[lpBuffer],NULL,MB_ICONERROR+MB_OK invoke LocalFree,[lpBuffer] ret endp ; VOID ShowLastError(HWND hWnd); proc ShowLastError hWnd invoke GetLastError stdcall ShowErrorMessage,[hWnd],eax ret endp section '.idata' import data readable writeable ;..............imports section '.reloc' fixups data discardable
Si estas en WinNT y familia, no le gusta la secciónes vacias. En ese caso, se hace section '.reloc' data discardable fixups if ~ $-$$ dd 0,8 ;empty fixups section iff no other fixups end if
Saludos.
|