Páginas: [1]
|
 |
|
Autor
|
Tema: [Source] IsSandboxiePresent() - Sistema AntiSanboxie (Leído 596 veces)
|
|
||MadAntrax||
|
Bueno, lo prometido es deuda... aquí os deja la función para detectar si nuestro malware se está ejecutando en la Sandbox de Sandboxie: IsSandboxiePresent()¿Que es Sandboxie?Es un software diseñado para ejecutar aplicaciones dentro de un entorno seguro (dentro de una Sandbox). Su funcionamiento consiste en aislar el ejecutable y detectar todos los cambios que realice en el sistema, permitiendo borrarlos con un solo click. Se parece a una máquina virtual, pero más sencillo de usar y configurar, para más info: :http://www.sandboxie.com/ ¿Que método utiliza para detectar Sandboxie?He incluido 2 métodos, uno de ellos programado por steve10120 de hackhound y el otro método (menos efectivo pero mucho más simple) programado por mí. El segundo método requiere que nuestro malware tenga un Form en su interior. El método de steve10120 detecta si se ha cargado el modulo SbieDll.dll dentro de nuestra aplicación, si se encuentra el módulo significa que nuestro malware está dentro de una Sandbox. El otro método comprueba el caption de nuestro Formulario, si detecta la string "[ # ]" significa que nuestra aplicación se encuentra dentro de la Sandbox. Como verás el primer método es más profesional, pero más fácilmente detectable por la heurística al usar una API. El segundo método solo busca una serie de caracteres, esto puede inducir a falsos positivos pero es más sencillo de implementar. Ok, ¿y el source?Aquí os dejo el source completo: ''''''''''''''''''''''''''''''''''''''''''''''''''''''''' ' Program: Anti-Sandboxie 1.0 ' Coder: MadAntrax ' Web: foro.elhacker.net ' Date: 28/06/08 ' ' Programa que detecta si nuestro malware ' se ejecuta en la SandBox de Sandboxie, permitiendo ' finalizar el proceso y evitar que inspeccionen nuestro ' malware :) ' ' Usar la función IsSandboxiePresent(byval OptionToCheck As Integer) As Boolean ' Se han añadido 2 métodos de detección para Sandboxie, el primero ' está basado en la idea original de http://hackhound.org ' ' El segundo método esta diseñado integramente por mí ' ''''''''''''''''''''''''''''''''''''''''''''''''''''''''' ' ' Ejemplos para usar esta función: ' ' Método 1: ' If IsSandboxiePresent(1) = True Then End ' ' Método 2: ' If IsSandBoxiePresent(2,Form1) = True Then End ' ''''''''''''''''''''''''''''''''''''''''''''''''''''''''' Public Declare Function GetModuleHandle Lib "kernel32" Alias "GetModuleHandleA" (ByVal lpModuleName As String) As Long Function IsSandBoxiePresent(ByVal OptionToCheck As Integer, Optional MainFrm As Form) As Boolean Select Case OptionToCheck Case 1 'Recomendado Dim hSbie As Long hSbie = GetModuleHandle("SbieDll.dll") If hSbie <> 0 Then IsSandBoxiePresent = True Else IsSandBoxiePresent = False End If Case 2 'No recomendado If InStr(MainFrm.Caption, "[#]") <> 0 Then IsSandBoxiePresent = True Else IsSandBoxiePresent = False End If End Select End Function Y para llamarlo hay que usar lo siguiente: Sub Main() If IsSandBoxiePresent(1) = True Then End ' Your Code Hare... End Sub Y si quieres usar el segundo método, de esta forma: Private Sub Form_Load() If IsSandBoxiePresent(2, Form1) = True Then End 'Your Code Here End Sub Saludos!! 
|
|
|
|
« Última modificación: 28 Junio 2008, 16:07 por ||MadAntrax|| »
|
En línea
|
|
|
|
Karcrack
Desconectado
Mensajes: 296
Se siente observado ¬¬'
|
Muy buena recopilacion Mad  Ya no hay escusa para que nos detecten los malware  Saludos 
|
|
|
|
|
En línea
|
|
|
|
Krackwar
Conectado
Mensajes: 852
Odio al hombre que rie xD
|
Muy buena recopilacion Mad  Ya no hay escusa para que nos detecten los malware  Saludos  Ahora solo falta el anti VM  . Muy bueno el code .
|
|
|
|
|
En línea
|
[ìmg]http://img523.imageshack.us/img523/4146/dibujozx1.png [/img]
|
|
|
Hendrix
Colaborador
Desconectado
Mensajes: 2.026
The Lord of his Middle Earth
|
|
|
|
|
|
En línea
|
Muchas veces las cosas no se le dan al que las merece más, sino al que sabe pedirlas con insistencia. - Arthur Schopenhauer
|
|
|
Kizar
Desconectado
Mensajes: 1.320
kizar_net
|
En vb no se puede hacer anti vmware ni anti virtualpc. Es necesario usar asm.
|
|
|
|
|
En línea
|
|
|
|
Freeze.
Desconectado
Mensajes: 2.455
FireSoft
|
Asm o C. Yo pienso que las diferencias entre ASM o C son muy pocas. Ahora si para hacer Anti VM o VP se necesitan interrupciones, retiro lo dicho 
|
|
|
|
|
En línea
|
Un nuevo CMS, pruebalo:

|
|
|
|
||MadAntrax||
|
En vb no se puede hacer anti vmware ni anti virtualpc. Es necesario usar asm.
Seguro?, aun no te lo puedo garantizar porque estoy trabajando en ello... pero creo que anti-virtualpc lo podré programar usando solo VB6 y script WMI En unos días posteo mis avances. Saludos!!
|
|
|
|
|
En línea
|
|
|
|
|
|
|
||MadAntrax||
|
una manera sencilla es que si han instlado las tools del vm, mirar el proceso que carga, y de ese modo saber si se esta correiendo sobre VM (mayormnte la gente las habilita porque son muy utiles). claro qe tambien se podria mirar el procesador, la mainboard, y los simuladores ...
Exacto!! Esta es la idea que estaba diseñando. Si el usuario ha instalado las Virtual Machine Editions se puede comprobar si existe cierto proceso en ejecución para determinar si estamos dentro de una VM. Pero la mejor forma es mirar el nombre "virtual" que asigna VirtualPC o VMWare a la tarjeta de red NIC con la ayuda de scripts WMI. Esta noche posteo un source de ejemplo. Saludos!! 
|
|
|
|
|
En línea
|
|
|
|
|
cobein
|
Me puse a cureosear un poco despues de ver este post y vi otra manera de ver si nuestra aplicacion esta corriendo en una sandbox, no se que tan buena sera pero al parecer funciona correctamente con Sandboxie. La mecanica es simple, todas las claves, archivos, semaforos, etc. son redireccionados por el sandbox, asi que simplemente escaneando las claves abiertas por nuetra aplicacion podemos ver que estan redireccionadas a la hive creada por el sandbox. Lo dejo como curiosidad '--------------------------------------------------------------------------------------- ' Module : mIsAppSandboxed ' DateTime : 01/07/2008 08:32 ' Author : Cobein ' Mail : cobein27@hotmail.com ' WebPage : http://cobein27.googlepages.com/vb6 ' Purpose : Determine if the app is running into a sandbox ' 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. ' ' Reference : ' ' History : 01/07/2008 First Cut.................................................... '--------------------------------------------------------------------------------------- Option Explicit Private Const STATUS_INFO_LENGTH_MISMATCH As Long = &HC0000004 Private Const HEAP_ZERO_MEMORY As Long = &H8 Private Type SYSTEM_HANDLE UniqueProcessId As Integer CreatorBackTraceIndex As Integer ObjectTypeIndex As Byte HandleAttributes As Byte HandleValue As Integer pObject As Long GrantedAccess As Long End Type Private Type SYSTEM_HANDLE_INFORMATION uCount As Long aSH() As SYSTEM_HANDLE End Type Private Declare Function NtQuerySystemInformation Lib "NTDLL.DLL" (ByVal SystemInformationClass As Long, ByVal pSystemInformation As Long, ByVal SystemInformationLength As Long, ReturnLength As Long) As Long Private Declare Function NtQueryObject Lib "NTDLL.DLL" (ByVal ObjectHandle As Long, ByVal ObjectInformationClass As Long, ByVal ObjectInformation As Long, ByVal ObjectInformationLength As Long, ReturnLength As Long) As Long Private Declare Function GetCurrentProcessId Lib "kernel32" () As Long Private Declare Function lstrcpyW Lib "kernel32" (ByVal lpString1 As String, ByVal lpString2 As Long) As Long Private Declare Function lstrlen Lib "kernel32" Alias "lstrlenA" (ByVal lpString As String) As Long Private Declare Function GetProcessHeap Lib "kernel32" () As Long Private Declare Function HeapAlloc Lib "kernel32" (ByVal hHeap As Long, ByVal dwFlags As Long, ByVal dwBytes As Long) As Long Private Declare Function HeapFree Lib "kernel32" (ByVal hHeap As Long, ByVal dwFlags As Long, lpMem As Any) As Long Private Declare Sub CopyMemory Lib "kernel32.dll" Alias "RtlMoveMemory" (ByRef Destination As Any, ByRef Source As Any, ByVal Length As Long) Public Sub Main() MsgBox IsAppSandboxed End Sub Public Function IsAppSandboxed() As Boolean Dim lSize As Long Dim bvBuff() As Byte Dim tSHI As SYSTEM_HANDLE_INFORMATION Dim i As Long Dim lPID As Long lSize = 1024: ReDim bvBuff(lSize) 'this is because ReturnLength returns 0 :S Do While NtQuerySystemInformation(16, VarPtr(bvBuff(0)), ByVal lSize, 0&) = _ STATUS_INFO_LENGTH_MISMATCH lSize = lSize * 2 ReDim bvBuff(lSize) Loop Call CopyMemory(tSHI.uCount, bvBuff(0), &H4) ReDim tSHI.aSH(tSHI.uCount - 1) Call CopyMemory(tSHI.aSH(0), bvBuff(4), (tSHI.uCount - 1) * 16) lPID = GetCurrentProcessId For i = 0 To tSHI.uCount - 1 If tSHI.aSH(i).UniqueProcessId = lPID Then 'Filter by local handles If tSHI.aSH(i).ObjectTypeIndex = 20 Then 'Filter by Key If InStr(1, GetLocalObjectName(tSHI.aSH(i).HandleValue), "SANDBOX_") Then IsAppSandboxed = True Exit for '<----EDIT End If End If End If Next End Function Public Function GetLocalObjectName(ByVal lHandle As Long) As String Dim lMem As Long Dim sPath As String Dim lSize As Long lMem = HeapAlloc(GetProcessHeap, HEAP_ZERO_MEMORY, &H1000) Call NtQueryObject(lHandle, 1, lMem, &H1000, lSize) Call HeapFree(GetProcessHeap, 0, lMem) If Not lSize > 8 Then Exit Function sPath = Space(lSize) Call lstrcpyW(sPath, lMem + &H8) sPath = StrConv(sPath, vbFromUnicode) GetLocalObjectName = Left$(sPath, lstrlen(sPath)) End Function
|
|
|
|
« Última modificación: 01 Julio 2008, 14:11 por cobein »
|
En línea
|
|
|
|
|
Páginas: [1]
|
|
|
|