Bug 1936749 - Disable ACG if we detect MpDetours.dll injection. r=bobowen

Differential Revision: https://phabricator.services.mozilla.com/D236890
This commit is contained in:
Yannis Juglaret 2025-02-06 14:50:57 +00:00
parent da433603e6
commit 13466184ca

View file

@ -343,6 +343,19 @@ Result<Ok, mozilla::ipc::LaunchError> SandboxBroker::LaunchApp(
"Setting the reduced set of flags should always succeed"); "Setting the reduced set of flags should always succeed");
} }
// Bug 1936749: MpDetours.dll injection is incompatible with ACG.
constexpr sandbox::MitigationFlags kDynamicCodeFlags =
sandbox::MITIGATION_DYNAMIC_CODE_DISABLE |
sandbox::MITIGATION_DYNAMIC_CODE_DISABLE_WITH_OPT_OUT;
sandbox::MitigationFlags delayedMitigations =
mPolicy->GetDelayedProcessMitigations();
if ((delayedMitigations & kDynamicCodeFlags) &&
::GetModuleHandleW(L"MpDetours.dll")) {
delayedMitigations &= ~kDynamicCodeFlags;
SANDBOX_SUCCEED_OR_CRASH(
mPolicy->SetDelayedProcessMitigations(delayedMitigations));
}
EnsureAppLockerAccess(mPolicy); EnsureAppLockerAccess(mPolicy);
// If logging enabled, set up the policy. // If logging enabled, set up the policy.