diff --git a/.github/workflows/wix3-build.yml b/.github/workflows/wix3-build.yml
index 53fd68254..b6393be31 100644
--- a/.github/workflows/wix3-build.yml
+++ b/.github/workflows/wix3-build.yml
@@ -24,7 +24,7 @@ jobs:
- name: Set version number
run: |
- $version = "3.12.0-c"+(151+$($Env:GITHUB_RUN_NUMBER))
+ $version = "3.15.0-a"+$($Env:GITHUB_RUN_NUMBER)
echo $version
echo "NUPKG_VERSION=$version" | Out-File -FilePath $Env:GITHUB_ENV -Encoding utf-8 -Append
diff --git a/src/burn/stub/Stub.vcxproj b/src/burn/stub/Stub.vcxproj
index 28138de5b..3340a2356 100644
--- a/src/burn/stub/Stub.vcxproj
+++ b/src/burn/stub/Stub.vcxproj
@@ -42,6 +42,7 @@
true
true
cabinet.dll;crypt32.dll;msi.dll;shlwapi.dll;version.dll;wininet.dll;wintrust.dll
+ /DEPENDENTLOADFLAG:0x800 %(AdditionalOptions)
diff --git a/src/burn/stub/precomp.h b/src/burn/stub/precomp.h
index 387d4f0fd..91e76109d 100644
--- a/src/burn/stub/precomp.h
+++ b/src/burn/stub/precomp.h
@@ -6,6 +6,7 @@
#include
#include
+#include
#include
#include
#include
diff --git a/src/burn/stub/stub.cpp b/src/burn/stub/stub.cpp
index 923765d49..ba38f3ccd 100644
--- a/src/burn/stub/stub.cpp
+++ b/src/burn/stub/stub.cpp
@@ -2,6 +2,10 @@
#include "precomp.h"
+static const HRESULT E_SUSPECTED_TAMPERING = MAKE_HRESULT(SEVERITY_ERROR, 500/*FACILITY_WIX*/, 2001);
+
+static void AvoidLocalDllRedirection(LPCWSTR wzPath);
+
int WINAPI wWinMain(
__in HINSTANCE hInstance,
@@ -53,6 +57,8 @@ int WINAPI wWinMain(
AppInitialize(rgsczSafelyLoadSystemDlls, countof(rgsczSafelyLoadSystemDlls));
}
+ AvoidLocalDllRedirection(sczPath);
+
// call run
hr = EngineRun(hInstance, hEngineFile, lpCmdLine, nCmdShow, &dwExitCode);
ExitOnFailure(hr, "Failed to run application.");
@@ -63,3 +69,23 @@ int WINAPI wWinMain(
return FAILED(hr) ? (int)hr : (int)dwExitCode;
}
+
+static void AvoidLocalDllRedirection(LPCWSTR wzPath)
+{
+ LPWSTR sczLocalPath = NULL;
+ HMODULE hmodComCtl = NULL;
+
+ // Bail if there's a .exe.local directory, as it's a feature of
+ // DLL redirection that has no real use for a bundle and is a hole for
+ // DLL hijacking attacks.
+
+ if (FAILED(StrAllocFormatted(&sczLocalPath, L"%ls.local", wzPath))
+ || DirExists(sczLocalPath, NULL)
+ || FileExistsEx(sczLocalPath, NULL)
+ || FAILED(LoadSystemLibrary(L"Comctl32.dll", &hmodComCtl)))
+ {
+ ::ExitProcess((UINT)E_SUSPECTED_TAMPERING);
+ }
+
+ ReleaseStr(sczLocalPath);
+}
diff --git a/src/libs/dutil/dirutil.cpp b/src/libs/dutil/dirutil.cpp
index e549d236f..47b768ac6 100644
--- a/src/libs/dutil/dirutil.cpp
+++ b/src/libs/dutil/dirutil.cpp
@@ -210,8 +210,8 @@ extern "C" HRESULT DAPI DirEnsureDeleteEx(
}
}
- // If we're deleting files and/or child directories loop through the contents of the directory.
- if (fDeleteFiles || fRecurse)
+ // If we're deleting files and/or child directories loop through the contents of the directory, but skip junctions.
+ if ((fDeleteFiles || fRecurse) && (0 == (dwAttrib & FILE_ATTRIBUTE_REPARSE_POINT)))
{
if (fScheduleDelete)
{
diff --git a/tools/WixBuild.Version.targets b/tools/WixBuild.Version.targets
index e764217a4..b4143497b 100644
--- a/tools/WixBuild.Version.targets
+++ b/tools/WixBuild.Version.targets
@@ -5,7 +5,7 @@
3
- 12
+ 15
2020
0