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

 

 


Tema destacado: Sigue las noticias más importantes de seguridad informática en el Twitter! de elhacker.NET


  Mostrar Mensajes
Páginas: 1 ... 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 [547] 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 ... 620
5461  Programación / Ingeniería Inversa / Re: ayuda reparar iat en: 28 Enero 2011, 01:51 am
Hola!

Esa parte es normal. Para desempacar el UPX, debes estar parado en el OEP. Luego fixear la IAT con ImpRec.

Si tienes problemas, usa PEExplorer para desempacar (http://www.heaventools.com/download-pe-explorer.htm) y listo.

Saludos!
5462  Programación / Programación Visual Basic / Re: [BRAINSTORMING] KPC v3 (Karcrack Project Crypter) en: 28 Enero 2011, 00:22 am
Bueno, me gustaria aportar con algo que hice hace un tiempo, pero en realidad no se si sera de utilidad (tampoco se si ya se ha hecho con anterioridad).

Como saben cuando VB llama a una API, ejecuta una secuencia de codigo muy particular. Algo como esto:

Código:
MOV EAX,DWORD PTR DS:[4032E8]
OR EAX,EAX
JE SHORT Proyecto.00401AEB
JMP EAX
PUSH Proyecto.00401AC8
MOV EAX,<JMP.&MSVBVM60.DllFunctionCall>
CALL EAX
JMP EAX

Basicamente lo que hace es verificar el valor que hay en la posicion de memoria 4032E8. Si hay un cero, entonces llama a DllFunctionCall para cargar la DLL (si en necesario) y luego usa GetProcAdress para obtener la direccion de la API. Al final, copia la direccion de la funcion a la direccion 4032E8.

Ahora, la idea es cargar cualquier codigo ASM en memoria usando VirtualAlloc y VirtualProtect; luego definir una funcion API llamada que sera la que ejecute el codigo

En realidad los parametros y el valor de retorno deben calcularse con Olly (u otro Debugger), pero eso es otra historia  :P

Ahora, el siguiente codigo es del modulo que se encarga de hacer todo el trabajo.

Importante: El codigo ASM que se ejecutara se encuentra en la sección de recursos del EXE. Esto lo hice asi simplemente por sencillez. Pero el codigo podria estar en cualquier parte.

Código:
Attribute VB_Name = "modResASMAPI"
Option Explicit
'---------------------------------------------------------------------------------------
' Module      : modResAsmAPI
' DateTime    : 19/10/2009 20:15
' Author      : MCKSys Argentina
' Mail        : nop
' WebPage     : nop, thanks
' Purpose     : Call ASM code inside VB
' Usage       : At your own risk
' Requirements: none
' Distribution: You can freely use this code in your own
'               applications, but you may not reproduce
'               or publish this code on any web site,
'               online service, or distribute as source
'               on any media without express permission.
'
' Thanks To   : Rivardo Narvaja, Solid [CLS]... and everyone at CrackslatinoS !
'
' History     : 19/10/2009 First Release................................................
'---------------------------------------------------------------------------------------

'PLEASE EXCUSE MY BAD ENGLISH!!!

Public Const MEM_COMMIT = &H1000
Public Const MEM_RESERVE = &H2000
Public Const MEM_DECOMMIT = &H4000
Public Const MEM_RELEASE = 32768 '&H8000
Public Const PAGE_EXECUTE_READWRITE = &H40
Private Const VBHeaderConst = &H21354256 '"VB5!"
Public Declare Function VirtualAlloc Lib "kernel32" (lpAddress As Any, ByVal dwSize As Long, ByVal flAllocationType As Long, ByVal flProtect As Long) As Long
Public Declare Function VirtualFree Lib "kernel32" (lpAddress As Any, ByVal dwSize As Long, ByVal dwFreeType As Long) As Long
Public Declare Sub RtlMoveMemory Lib "kernel32" (dest As Any, src As Any, ByVal L As Long)

Private Type tASMProc
    Nombre As String
    Addr As Long
    Size As Long
End Type

Dim procAddrArray() As tASMProc
Dim procAddrArrayIdx As Long

Function loadAPI(Nombre As String) As Boolean
'loadAPI: Loads ASM code from resource named "Nombre" and points the VB declared API (with the same name)
'         to loaded ASM code
Dim ASMproc() As Byte
Dim procAddr As Long

Err.Clear
On Error GoTo Hell

'load ASM code from resources
ASMproc = LoadResData(Nombre, "CUSTOM")
'create section in memory to copy ASM code
'Note the PAGE_EXECUTE_READWRITE flag!
procAddr = VirtualAlloc(ByVal 0, UBound(ASMproc) + 1, MEM_RESERVE Or MEM_COMMIT, PAGE_EXECUTE_READWRITE)
If procAddr = 0 Then
    MsgBox "loadAPI: Unable to reserve memory!" 'you can delete this...
    loadAPI = False
    Exit Function
End If
'copy ASM code to section
RtlMoveMemory ByVal procAddr, ASMproc(0), UBound(ASMproc) + 1
'update array of procs to release memory when we're finish
If procAddrArrayIdx > 0 Then
    procAddrArrayIdx = procAddrArrayIdx + 1
End If
ReDim Preserve procAddrArray(procAddrArrayIdx)
procAddrArray(procAddrArrayIdx).Addr = procAddr
procAddrArray(procAddrArrayIdx).Nombre = UCase(Nombre)
procAddrArray(procAddrArrayIdx).Size = UBound(ASMproc) + 1
'patch EXE in memory to make declared API to point to our loaded code
If Not patchVBAPI(Nombre, procAddr) Then
    MsgBox "loadAPI: Unable to patch EXE in memory!" 'you can delete this...
    loadAPI = False
    Exit Function
End If
'all ok, return true
loadAPI = True
Exit Function
Hell:
    'failure :(
    MsgBox "loadAPI: " & Err.Description 'you can delete this...
    loadAPI = False
End Function

Function releaseAPI(Nombre As String) As Boolean
'releaseAPI: Releases loaded ASM code form memory and points the VB declared API (with the same name)
'            to "nothing"

Dim I As Long
Dim J As Long
Dim procAddr As Long
Dim procSize As Long

Err.Clear
On Error GoTo Hell

'patch EXE in memory to make declared API to point to nothing
If Not patchVBAPI(Nombre, 0) Then
    MsgBox "loadAPI: Imposible parchear Ejecutable!"
    releaseAPI = False
    Exit Function
End If
'update array of procs to release memory when we're finish
If procAddrArrayIdx = 0 Then
    'save memory address and size of proc to release it later
    procAddr = procAddrArray(procAddrArrayIdx).Addr
    procSize = procAddrArray(procAddrArrayIdx).Size
    ReDim procAddrArray(procAddrArrayIdx)
Else
    For I = 0 To UBound(procAddrArray) - 1
        If (procAddrArray(I).Nombre = UCase(Nombre)) Then
            'save memory address and size of proc to release it later
            procAddr = procAddrArray(I).Addr
            procSize = procAddrArray(I).Size
            For J = I To UBound(procAddrArray) - 2
                procAddrArray(J) = procAddrArray(J + 1)
                GoTo Seguir
            Next J
        End If
    Next I
Seguir:
    procAddrArrayIdx = procAddrArrayIdx - 1
    ReDim Preserve procAddrArray(procAddrArrayIdx)
End If
'release created section in memory (where ASM code is)
I = VirtualFree(ByVal procAddr, procSize, MEM_DECOMMIT)
If I = 0 Then
    MsgBox "releaseAPI: Unable to Decommit memory!" 'you can delete this...
    releaseAPI = False
    Exit Function
End If
I = VirtualFree(ByVal procAddr, 0, MEM_RELEASE)
If I = 0 Then
    MsgBox "releaseAPI: Unable to release memory!" 'you can delete this...
    releaseAPI = False
    Exit Function
End If
'all ok, return true
releaseAPI = True
Exit Function
Hell:
    'failure
    MsgBox "releaseAPI: " & Err.Description 'you can delete this...
    releaseAPI = False
End Function

Function getVBHeader(AddrProc As Long) As Long
'Searches and returns address of VBHeader struct from memory, starting from "AddrProc"
'Returns 0 ifnot founded or error

Dim Buffer As Long
Dim ImageBaseNormal As Long
Dim I As Long

ImageBaseNormal = AddrProc - CLng("&H" + Right(Hex(AddrProc), 4))
If AddrProc <= ImageBaseNormal Then
    'not logic!
    getVBHeader = 0
Else
    I = AddrProc
    Do While I > ImageBaseNormal
        RtlMoveMemory Buffer, ByVal I, &H4
        If Buffer = VBHeaderConst Then
            'VBHeader founded!
            getVBHeader = I
            Exit Function
        End If
        I = I - 4
    Loop
End If
'not founded
getVBHeader = 0
End Function

Public Function patchVBAPI(Nombre As String, AddrProc As Long) As Boolean
'Patches the declared API (Nombre) to point to the AddrProc address
Dim offsetExternalTable As Long
Dim offsetVBHeader As Long
Dim ExternalCount As Long
Dim vbAPIVar As Long
Dim parche(4) As Byte
Dim I As Long
Dim J As Long
Dim K As Long
Dim strAux As String

Err.Clear
On Error GoTo Salida

offsetVBHeader = getVBHeader(AddressOf releaseAPI)

'are we in the VB IDE?
If offsetVBHeader = 0 Then GoTo Salida

offsetExternalTable = GetDwordAt(offsetVBHeader + &H30) + &H234

ExternalCount = 0
ExternalCount = GetDwordAt(offsetExternalTable + 4)
K = GetDwordAt(offsetExternalTable)

For I = 1 To ExternalCount
    If GetByteAt(K) <> 6 Then
        J = GetDwordAt(K + 4)
        strAux = UCase(GetANSIStrAt(GetDwordAt(J + 4)))
        If strAux = UCase(Nombre) Then
            vbAPIVar = GetDwordAt(J + &H19)
            RtlMoveMemory ByVal vbAPIVar, AddrProc, &H4
            Exit For
        End If
    End If
    K = K + 8
Next I
patchVBAPI = True
Exit Function
Salida:
    patchVBAPI = False
End Function

Private Function DWHexFill(xDword As Long) As String
Dim strAux As String

strAux = Hex(xDword)
DWHexFill = String(8 - Len(strAux), "0") + strAux
End Function

Private Function HexFill(xByte As Byte) As String
Dim strAux As String
strAux = Hex(xByte)
If Len(strAux) = 1 Then
    strAux = "0" + strAux
End If
HexFill = strAux
End Function

Private Function GetANSIStrAt(Posicion As Long) As String
Dim I As Long
Dim car As Byte
Dim strAux As String

strAux = ""
I = Posicion
car = GetByteAt(I)
Do While car <> 0
    strAux = strAux + Chr(car)
    I = I + 1
    car = GetByteAt(I)
Loop
GetANSIStrAt = strAux
End Function

Private Function GetByteAt(Posicion As Long) As Byte
Dim lAux As Byte

RtlMoveMemory lAux, ByVal Posicion, &H1
GetByteAt = CByte("&H" + HexFill(lAux))
End Function

Private Function GetDwordAt(Posicion As Long) As Long
Dim lAux As Long

RtlMoveMemory lAux, ByVal Posicion, &H4
GetDwordAt = CLng("&H" + DWHexFill(lAux))
End Function

Ahora, en otro modulo (o en el mismo) definimos la funcion que lo llamara:

Código
  1. Declare Sub VBSHL Lib "invisible.dll" (dest as Long, ByVal count as Byte)
  2. 'VBSHL: Hace lo mismo que SHL en ASM. Corre hacia la izquierda el valor de dest, la cantidad definida por count
  3.  


Por ultimo, se llamaria a la funcion asi:
Código
  1. Private Sub Command1_Click()
  2. Dim Numero As Long
  3.  
  4. 'Carga API en VB
  5. If Not loadAPI("VBSHL") Then
  6.    MsgBox "No se pudo cargar la API! (Esto no funciona en el IDE de VB 6!)"
  7.    Exit Sub
  8. End If
  9. 'carga los parametros de la API'
  10. Numero = 10
  11. 'Llamamos a la API como la declaramos :)
  12. VBSHL Numero, 1
  13. If Numero = 20 Then
  14.    MsgBox "Funciona bien! :)"
  15. Else
  16.    MsgBox "Error. No funciono :("
  17. End If
  18. 'Liberar API
  19. releaseAPI "VBSHL"
  20. End Sub
  21.  

Bueno, lo dejo por aca, a ver si sirve de algo...

Saludos!

5463  Programación / Ingeniería Inversa / Re: Problema al editar ascii en: 25 Enero 2011, 18:12 pm
Si esas cadenas estan en la sección de recursos del programa, con un editor de recursos puedes cambiarlas a placer.

Busca en Google para encontrarlos (hay muchisimos)

Si las cadenas NO estan en los recursos, pues, puedes usar el editor Hexa para cambiarlas, pero no podras ocupar mas espacio del que ocupan (ten en cuenta el caracter nulo al final)

Saludos!

PD: Como editor Hexa uso UltraEdit.  :P
5464  Programación / Ingeniería Inversa / Re: AYUDA POR FAVOR... en: 24 Enero 2011, 23:06 pm
Buenas!!

Ese soft es demo tienen una licencia de 30 dias

Que puedo hacer!!!  :P


Saludos

Bajartelo de Taringa????  ;D

Saludos!
5465  Programación / Ingeniería Inversa / Re: CrackMe v3.0 en: 24 Enero 2011, 21:32 pm
porque se ponen tan odiosos con un crackme...

Crackme??? Este post trata sobre un crackme, pero no sobre TU crackme.

Odiosos??? Pues, eso me cae mal, o bien, no he entendido lo que haz querido decir. Despues de todo, fuiste tu quien empezo con los "insultos"...

siempre querirendo probar que son mejores que otros... jajaj

Al contrario. Si aparece un desafio y se logra sobrepasar, el tutorial que explica los pasos (y enseña) para pasarlo es la prueba suficiente y necesaria para lograr el reconocimiento de quienes lo leen.


Eso es todo. Aqui no hay "elites". Al menos, yo no conozco alguno (ni me considero uno).


Por lo pronto, este post es sobre el crackme de Keyen Night, quien esta haciendo un gran trabajo en lo que a protectores para .NET se refiere.


PD: Aqui no hay animos ni lugar para las ofensas y las discuciones sin sentido.


Saludos!
5466  Programación / Ingeniería Inversa / Re: AYUDA POR FAVOR... en: 24 Enero 2011, 20:50 pm
Con lo mismo que te puse en el post anterior. Olvidate de la extension  ;)
5467  Programación / Ingeniería Inversa / Re: CrackMe v3.0 en: 24 Enero 2011, 14:43 pm
y yo que pensé que yo era un novato.... jojojo

Pues, si quieres te hago un crackme a ver si puedes sacarle el secreto...

Quizas, asi veremos que tan novatos somos.... no?  :P

PD: La modestia es una virtud  ;D
5468  Programación / Ingeniería Inversa / Re: AYUDA POR FAVOR... en: 24 Enero 2011, 13:41 pm
Puedes probar con MultiExtractor (www.multiextractor.com). Te permite sacar varios tipos de images de ejecutables y demas...

Saludos!
5469  Programación / Ingeniería Inversa / Re: Ayuda con Repair 0.6 en: 20 Enero 2011, 19:28 pm
Bajalo desde aqui:

http://www.woodmann.com/collaborative/tools/index.php/Category:Tool_Hiding_Tools

Saludos!
5470  Programación / Ingeniería Inversa / Re: Ayuda programa en Delphi en: 20 Enero 2011, 19:25 pm
El problema es que ya te hemos dado las pautas necesarias para empezar.

Ahora te toca a ti hacer el esfuerzo.

Te dije que el programa esta empacado con UPX, por eso IDR no lo abre. Si lo desempacas, IDR lo levantara.

Aunque, lo mas probable es que tampoco sepas que hacer con el analisis de IDR.

Por eso, te recomiendo esto: http://ricardonarvaja.info/WEB/INTRODUCCION%20AL%20CRACKING%20CON%20OLLYDBG%20DESDE%20CERO/

La mejor guia para inicarse en el mundo de la Ingenieria Inversa...  ;D

Saludos!
Páginas: 1 ... 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 [547] 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 ... 620
WAP2 - Aviso Legal - Powered by SMF 1.1.21 | SMF © 2006-2008, Simple Machines