Changeset 53220 in vbox
- Timestamp:
- Nov 5, 2014 8:51:38 AM (10 years ago)
- Location:
- trunk/src/VBox/HostDrivers/Support/win
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/HostDrivers/Support/win/SUPHardenedVerify-win.h
r53035 r53220 133 133 /** The file owner must be TrustedInstaller on Vista+. */ 134 134 # define SUPHNTVI_F_TRUSTED_INSTALLER_OWNER RT_BIT(4) 135 /** Resource image, could be any bitness. */ 136 # define SUPHNTVI_F_RESOURCE_IMAGE RT_BIT(30) 135 /** Ignore the image architecture (otherwise it must match the verification 136 * code). Used with resource images and such. */ 137 # define SUPHNTVI_F_IGNORE_ARCHITECTURE RT_BIT(30) 137 138 /** Raw-mode context image, always 32-bit. */ 138 139 # define SUPHNTVI_F_RC_IMAGE RT_BIT(31) -
trunk/src/VBox/HostDrivers/Support/win/SUPHardenedVerifyImage-win.cpp
r53042 r53220 1235 1235 RTLDRMOD hLdrMod; 1236 1236 RTLDRARCH enmArch = fFlags & SUPHNTVI_F_RC_IMAGE ? RTLDRARCH_X86_32 : RTLDRARCH_HOST; 1237 if (fFlags & SUPHNTVI_F_ RESOURCE_IMAGE)1237 if (fFlags & SUPHNTVI_F_IGNORE_ARCHITECTURE) 1238 1238 enmArch = RTLDRARCH_WHATEVER; 1239 1239 rc = RTLdrOpenWithReader(&pNtViRdr->Core, RTLDR_O_FOR_VALIDATION, enmArch, &hLdrMod, pErrInfo); -
trunk/src/VBox/HostDrivers/Support/win/SUPHardenedVerifyProcess-win.cpp
r53036 r53220 1835 1835 : SUPHNTVI_F_REQUIRE_BUILD_CERT; 1836 1836 if (f32bitResourceDll) 1837 fFlags |= SUPHNTVI_F_ RESOURCE_IMAGE;1837 fFlags |= SUPHNTVI_F_IGNORE_ARCHITECTURE; 1838 1838 1839 1839 PSUPHNTVIRDR pNtViRdr; … … 1850 1850 RTLDRMOD hLdrMod; 1851 1851 RTLDRARCH enmArch = fFlags & SUPHNTVI_F_RC_IMAGE ? RTLDRARCH_X86_32 : RTLDRARCH_HOST; 1852 if (fFlags & SUPHNTVI_F_ RESOURCE_IMAGE)1852 if (fFlags & SUPHNTVI_F_IGNORE_ARCHITECTURE) 1853 1853 enmArch = RTLDRARCH_WHATEVER; 1854 1854 rc = RTLdrOpenWithReader(&pNtViRdr->Core, RTLDR_O_FOR_VALIDATION, enmArch, &hLdrMod, pErrInfo); -
trunk/src/VBox/HostDrivers/Support/win/SUPR3HardenedMain-win.cpp
r53051 r53220 369 369 * Internal Functions * 370 370 *******************************************************************************/ 371 static NTSTATUS supR3HardenedScreenImage(HANDLE hFile, bool fImage, PULONG pfAccess, PULONG pfProtect,371 static NTSTATUS supR3HardenedScreenImage(HANDLE hFile, bool fImage, bool fIgnoreArch, PULONG pfAccess, PULONG pfProtect, 372 372 bool *pfCallRealApi, const char *pszCaller, bool fAvoidWinVerifyTrust, 373 373 bool *pfQuiet); … … 1052 1052 ULONG fProtect = 0; 1053 1053 bool fCallRealApi = false; 1054 rcNt = supR3HardenedScreenImage(hFile, true /*fImage*/, &fAccess, &fProtect, &fCallRealApi,1055 "Imports", false /*fAvoidWinVerifyTrust*/, NULL /*pfQuiet*/);1054 rcNt = supR3HardenedScreenImage(hFile, true /*fImage*/, false /*fIgnoreArch*/, &fAccess, &fProtect, 1055 &fCallRealApi, "Imports", false /*fAvoidWinVerifyTrust*/, NULL /*pfQuiet*/); 1056 1056 NtClose(hFile); 1057 1057 } … … 1275 1275 1276 1276 1277 static NTSTATUS supR3HardenedScreenImage(HANDLE hFile, bool fImage, PULONG pfAccess, PULONG pfProtect, 1277 /** 1278 * Screens an image file or file mapped with execute access. 1279 * 1280 * @returns NT status code. 1281 * @param hFile The file handle. 1282 * @param fImage Set if image file mapping being made 1283 * (NtCreateSection thing). 1284 * @param fIgnoreArch Using the DONT_RESOLVE_DLL_REFERENCES flag, 1285 * which also implies that DLL init / term code 1286 * isn't called, so the architecture should be 1287 * ignored. 1288 * @param pfAccess Pointer to the NtCreateSection access flags, 1289 * so we can modify them if necessary. 1290 * @param pfProtect Pointer to the NtCreateSection protection 1291 * flags, so we can modify them if necessary. 1292 * @param pfCallRealApi Whether it's ok to go on to the real API. 1293 * @param pszCaller Who is calling (for debugging / logging). 1294 * @param fAvoidWinVerifyTrust Whether we should avoid WinVerifyTrust. 1295 * @param pfQuiet Where to return whether to be quiet about 1296 * this image in the log (i.e. we've seen it 1297 * lots of times already). Optional. 1298 */ 1299 static NTSTATUS supR3HardenedScreenImage(HANDLE hFile, bool fImage, bool fIgnoreArch, PULONG pfAccess, PULONG pfProtect, 1278 1300 bool *pfCallRealApi, const char *pszCaller, bool fAvoidWinVerifyTrust, bool *pfQuiet) 1279 1301 { … … 1540 1562 * left of the path buffer for an RTERRINFO buffer. 1541 1563 */ 1564 if (fIgnoreArch) 1565 fFlags |= SUPHNTVI_F_IGNORE_ARCHITECTURE; 1542 1566 RTERRINFO ErrInfo; 1543 1567 RTErrInfoInit(&ErrInfo, (char *)&uBuf.abBuffer[cbNameBuf], sizeof(uBuf) - cbNameBuf); … … 1610 1634 bool fCallRealApi; 1611 1635 //SUP_DPRINTF(("supR3HardenedWinVerifyCachePreload: scanning %ls\n", pwszName)); 1612 supR3HardenedScreenImage(hFile, false, &fAccess, &fProtect, &fCallRealApi, "preload", false /*fAvoidWinVerifyTrust*/,1613 NULL /*pfQuiet*/);1636 supR3HardenedScreenImage(hFile, false, false /*fIgnoreArch*/, &fAccess, &fProtect, &fCallRealApi, "preload", 1637 false /*fAvoidWinVerifyTrust*/, NULL /*pfQuiet*/); 1614 1638 //SUP_DPRINTF(("supR3HardenedWinVerifyCachePreload: done %ls\n", pwszName)); 1615 1639 … … 1648 1672 bool fCallRealApi; 1649 1673 //SUP_DPRINTF(("supR3HardenedMonitor_NtCreateSection: 1\n")); 1650 NTSTATUS rcNt = supR3HardenedScreenImage(hFile, fImage, &fAccess, &fProtect, &fCallRealApi,1674 NTSTATUS rcNt = supR3HardenedScreenImage(hFile, fImage, true /*fIgnoreArch*/, &fAccess, &fProtect, &fCallRealApi, 1651 1675 "NtCreateSection", true /*fAvoidWinVerifyTrust*/, NULL /*pfQuiet*/); 1652 1676 //SUP_DPRINTF(("supR3HardenedMonitor_NtCreateSection: 2 rcNt=%#x fCallRealApi=%#x\n", rcNt, fCallRealApi)); … … 1982 2006 ULONG fProtect = 0; 1983 2007 bool fCallRealApi = false; 1984 rcNt = supR3HardenedScreenImage(hFile, true /*fImage*/, &fAccess, &fProtect, &fCallRealApi, 2008 rcNt = supR3HardenedScreenImage(hFile, true /*fImage*/, RT_VALID_PTR(pfFlags) && (*pfFlags & 0x2) /*fIgnoreArch*/, 2009 &fAccess, &fProtect, &fCallRealApi, 1985 2010 "LdrLoadDll", false /*fAvoidWinVerifyTrust*/, &fQuiet); 1986 2011 NtClose(hFile); … … 2132 2157 bool fCallRealApi = false; 2133 2158 bool fQuietFailure = false; 2134 rcNt = supR3HardenedScreenImage(hFile, true /*fImage*/, &fAccess, &fProtect, &fCallRealApi,2159 rcNt = supR3HardenedScreenImage(hFile, true /*fImage*/, true /*fIgnoreArch*/, &fAccess, &fProtect, &fCallRealApi, 2135 2160 "LdrLoadDll", true /*fAvoidWinVerifyTrust*/, &fQuietFailure); 2136 2161 NtClose(hFile);
Note:
See TracChangeset
for help on using the changeset viewer.