aboutsummaryrefslogtreecommitdiff
path: root/src/burn/engine/core.cpp
diff options
context:
space:
mode:
authorRob Mensching <rob@firegiant.com>2024-03-20 23:51:53 -0700
committerRob Mensching <rob@firegiant.com>2024-03-22 14:25:14 -0700
commit75a8c75d4e02ea219008dc5af7d03869291d61f7 (patch)
treec51a05a3cb878de83a2043e24a4641bddd181495 /src/burn/engine/core.cpp
parent2e5960b575881567a8807e6b8b9c513138b19742 (diff)
downloadwix-75a8c75d4e02ea219008dc5af7d03869291d61f7.tar.gz
wix-75a8c75d4e02ea219008dc5af7d03869291d61f7.tar.bz2
wix-75a8c75d4e02ea219008dc5af7d03869291d61f7.zip
Protect elevated working folder from malicious data
When running elevated, Burn uses the Windows Temp folder as its working folder to prevent normal processes from tampering with the files. Windows Temp does allow non-elevated processes to write to the folder but they cannot see the files there. Unfortunately, contrary to our belief, non-elevated processes can read the files in Windows Temp by watching for directory changes. This allows a malicious process to lie in wait, watching the Windows Temp folder until a Burn process is launched elevated, then attack the working folder. Mitigate that attack by protecting the working folder to only elevated users. Managed custom actions also fall back to using the Windows Temp folder in some cases and thus can be exposed in a similar fashion as an elevated Burn process. Remove that possibility.
Diffstat (limited to 'src/burn/engine/core.cpp')
-rw-r--r--src/burn/engine/core.cpp10
1 files changed, 5 insertions, 5 deletions
diff --git a/src/burn/engine/core.cpp b/src/burn/engine/core.cpp
index 8903b5b2..2d8a76dd 100644
--- a/src/burn/engine/core.cpp
+++ b/src/burn/engine/core.cpp
@@ -182,7 +182,7 @@ extern "C" HRESULT CoreInitialize(
182 if (BURN_MODE_NORMAL == pEngineState->internalCommand.mode || BURN_MODE_EMBEDDED == pEngineState->internalCommand.mode) 182 if (BURN_MODE_NORMAL == pEngineState->internalCommand.mode || BURN_MODE_EMBEDDED == pEngineState->internalCommand.mode)
183 { 183 {
184 // Extract all UX payloads to working folder. 184 // Extract all UX payloads to working folder.
185 hr = UserExperienceEnsureWorkingFolder(&pEngineState->cache, &pEngineState->userExperience.sczTempDirectory); 185 hr = UserExperienceEnsureWorkingFolder(pEngineState->internalCommand.fInitiallyElevated, &pEngineState->cache, &pEngineState->userExperience.sczTempDirectory);
186 ExitOnFailure(hr, "Failed to get unique temporary folder for bootstrapper application."); 186 ExitOnFailure(hr, "Failed to get unique temporary folder for bootstrapper application.");
187 187
188 hr = PayloadExtractUXContainer(&pEngineState->userExperience.payloads, &containerContext, pEngineState->userExperience.sczTempDirectory); 188 hr = PayloadExtractUXContainer(&pEngineState->userExperience.payloads, &containerContext, pEngineState->userExperience.sczTempDirectory);
@@ -227,7 +227,7 @@ extern "C" HRESULT CoreInitializeConstants(
227 hr = StrAllocString(&pRegistration->sczBundlePackageAncestors, pRegistration->sczId, 0); 227 hr = StrAllocString(&pRegistration->sczBundlePackageAncestors, pRegistration->sczId, 0);
228 ExitOnFailure(hr, "Failed to copy self to bundle package ancestors."); 228 ExitOnFailure(hr, "Failed to copy self to bundle package ancestors.");
229 } 229 }
230 230
231 for (DWORD i = 0; i < pEngineState->packages.cPackages; ++i) 231 for (DWORD i = 0; i < pEngineState->packages.cPackages; ++i)
232 { 232 {
233 BURN_PACKAGE* pPackage = pEngineState->packages.rgPackages + i; 233 BURN_PACKAGE* pPackage = pEngineState->packages.rgPackages + i;
@@ -605,7 +605,7 @@ extern "C" HRESULT CoreElevate(
605 // If the elevated companion pipe isn't created yet, let's make that happen. 605 // If the elevated companion pipe isn't created yet, let's make that happen.
606 if (!pEngineState->sczBundleEngineWorkingPath) 606 if (!pEngineState->sczBundleEngineWorkingPath)
607 { 607 {
608 hr = CacheBundleToWorkingDirectory(&pEngineState->cache, pEngineState->registration.sczExecutableName, &pEngineState->section, &pEngineState->sczBundleEngineWorkingPath); 608 hr = CacheBundleToWorkingDirectory(pEngineState->internalCommand.fInitiallyElevated, &pEngineState->cache, pEngineState->registration.sczExecutableName, &pEngineState->section, &pEngineState->sczBundleEngineWorkingPath);
609 ExitOnFailure(hr, "Failed to cache engine to working directory."); 609 ExitOnFailure(hr, "Failed to cache engine to working directory.");
610 } 610 }
611 611
@@ -714,7 +714,7 @@ extern "C" HRESULT CoreApply(
714 // Ensure the engine is cached to the working path. 714 // Ensure the engine is cached to the working path.
715 if (!pEngineState->sczBundleEngineWorkingPath) 715 if (!pEngineState->sczBundleEngineWorkingPath)
716 { 716 {
717 hr = CacheBundleToWorkingDirectory(&pEngineState->cache, pEngineState->registration.sczExecutableName, &pEngineState->section, &pEngineState->sczBundleEngineWorkingPath); 717 hr = CacheBundleToWorkingDirectory(pEngineState->internalCommand.fInitiallyElevated, &pEngineState->cache, pEngineState->registration.sczExecutableName, &pEngineState->section, &pEngineState->sczBundleEngineWorkingPath);
718 ExitOnFailure(hr, "Failed to cache engine to working directory."); 718 ExitOnFailure(hr, "Failed to cache engine to working directory.");
719 } 719 }
720 720
@@ -2285,7 +2285,7 @@ static HRESULT DetectPackage(
2285{ 2285{
2286 HRESULT hr = S_OK; 2286 HRESULT hr = S_OK;
2287 BOOL fBegan = FALSE; 2287 BOOL fBegan = FALSE;
2288 2288
2289 fBegan = TRUE; 2289 fBegan = TRUE;
2290 hr = UserExperienceOnDetectPackageBegin(&pEngineState->userExperience, pPackage->sczId); 2290 hr = UserExperienceOnDetectPackageBegin(&pEngineState->userExperience, pPackage->sczId);
2291 ExitOnRootFailure(hr, "BA aborted detect package begin."); 2291 ExitOnRootFailure(hr, "BA aborted detect package begin.");