[*] NT security: do not contaminate the caller thread of AuProcesses with user-switching elevation.
This commit is contained in:
parent
188dfd9459
commit
e63903d0f4
@ -650,16 +650,16 @@ namespace Aurora::Processes
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
BOOL Exec(LPCWSTR lpApplicationName,
|
BOOL ExecOnThread(LPCWSTR lpApplicationName,
|
||||||
LPWSTR lpCommandLine,
|
LPWSTR lpCommandLine,
|
||||||
LPSECURITY_ATTRIBUTES lpProcessAttributes,
|
LPSECURITY_ATTRIBUTES lpProcessAttributes,
|
||||||
LPSECURITY_ATTRIBUTES lpThreadAttributes,
|
LPSECURITY_ATTRIBUTES lpThreadAttributes,
|
||||||
BOOL bInheritHandles,
|
BOOL bInheritHandles,
|
||||||
DWORD dwCreationFlags,
|
DWORD dwCreationFlags,
|
||||||
LPVOID lpEnvironment,
|
LPVOID lpEnvironment,
|
||||||
LPCWSTR lpCurrentDirectory,
|
LPCWSTR lpCurrentDirectory,
|
||||||
LPSTARTUPINFOW lpStartupInfo,
|
LPSTARTUPINFOW lpStartupInfo,
|
||||||
LPPROCESS_INFORMATION lpProcessInformation)
|
LPPROCESS_INFORMATION lpProcessInformation)
|
||||||
{
|
{
|
||||||
DWORD dwSesssionId;
|
DWORD dwSesssionId;
|
||||||
GetCurrentSessionId(dwSesssionId);
|
GetCurrentSessionId(dwSesssionId);
|
||||||
@ -993,6 +993,40 @@ namespace Aurora::Processes
|
|||||||
pSetSecurityDescriptorDacl(&this->sd, TRUE, NULL, FALSE);
|
pSetSecurityDescriptorDacl(&this->sd, TRUE, NULL, FALSE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
BOOL Exec(LPCWSTR lpApplicationName,
|
||||||
|
LPWSTR lpCommandLine,
|
||||||
|
LPSECURITY_ATTRIBUTES lpProcessAttributes,
|
||||||
|
LPSECURITY_ATTRIBUTES lpThreadAttributes,
|
||||||
|
BOOL bInheritHandles,
|
||||||
|
DWORD dwCreationFlags,
|
||||||
|
LPVOID lpEnvironment,
|
||||||
|
LPCWSTR lpCurrentDirectory,
|
||||||
|
LPSTARTUPINFOW lpStartupInfo,
|
||||||
|
LPPROCESS_INFORMATION lpProcessInformation)
|
||||||
|
{
|
||||||
|
BOOL bRet = false;
|
||||||
|
|
||||||
|
if (auto pThread = AuThreads::Spawn([&]()
|
||||||
|
{
|
||||||
|
bRet = ExecOnThread(lpApplicationName,
|
||||||
|
lpCommandLine,
|
||||||
|
lpProcessAttributes,
|
||||||
|
lpThreadAttributes,
|
||||||
|
bInheritHandles,
|
||||||
|
dwCreationFlags,
|
||||||
|
lpEnvironment,
|
||||||
|
lpCurrentDirectory,
|
||||||
|
lpStartupInfo,
|
||||||
|
lpProcessInformation);
|
||||||
|
|
||||||
|
}, false))
|
||||||
|
{
|
||||||
|
pThread->GetShutdownWaitable()->Lock();
|
||||||
|
}
|
||||||
|
|
||||||
|
return bRet;
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
AUKN_SYM void RunAs(StartupParameters &startupParameters,
|
AUKN_SYM void RunAs(StartupParameters &startupParameters,
|
||||||
@ -1008,7 +1042,7 @@ namespace Aurora::Processes
|
|||||||
std::placeholders::_7, std::placeholders::_8,
|
std::placeholders::_7, std::placeholders::_8,
|
||||||
std::placeholders::_9, std::placeholders::_10);
|
std::placeholders::_9, std::placeholders::_10);
|
||||||
startupParameters.ntFixSharedHandleAttrs = std::bind(&SecureRunAs::FixSharedAttrs, pThat,
|
startupParameters.ntFixSharedHandleAttrs = std::bind(&SecureRunAs::FixSharedAttrs, pThat,
|
||||||
std::placeholders::_1);
|
std::placeholders::_1);
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
Loading…
Reference in New Issue
Block a user