- Timestamp:
- Aug 22, 2014 8:38:31 PM (11 years ago)
- svn:sync-xref-src-repo-rev:
- 95703
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/HostDrivers/Support/win/SUPHardenedVerifyImage-win.cpp
r52453 r52482 137 137 #endif /* IN_RING3 */ 138 138 139 /** The TrustedInstaller SID (Vista+). */140 139 static union 141 140 { 142 141 SID Sid; 143 142 uint8_t abPadding[SECURITY_MAX_SID_SIZE]; 144 } g_TrustedInstallerSid; 143 } 144 /** The TrustedInstaller SID (Vista+). */ 145 g_TrustedInstallerSid, 146 /** Local system ID (S-1-5-21). */ 147 g_LocalSystemSid; 148 145 149 146 150 /** Set after we've retrived other SPC root certificates from the system. */ … … 411 415 412 416 /** 413 * Checks if the file is owned by TrustedInstaller on Vista and later.417 * Checks if the file is owned by TrustedInstaller (Vista+) or similar. 414 418 * 415 419 * @returns true if owned by TrustedInstaller of pre-Vista, false if not. … … 418 422 * @param pwszName The name of the file. 419 423 */ 420 static bool supHardNtViCheckIsOwnedByTrustedInstaller (HANDLE hFile, PCRTUTF16 pwszName)424 static bool supHardNtViCheckIsOwnedByTrustedInstallerOrSimilar(HANDLE hFile, PCRTUTF16 pwszName) 421 425 { 422 426 if (g_uNtVerCombined < SUP_NT_VER_VISTA) … … 442 446 /* 443 447 * Check the owner. 448 * 449 * Initially we wished to only allow TrustedInstaller. But a Winodws CAPI 450 * plugin "Program Files\Tumbleweed\Desktop Validator\tmwdcapiclient.dll" 451 * turned up owned by the local system user, and we cannot operate without 452 * the plugin loaded once it's installed (WinVerityTrust fails). 444 453 */ 445 454 PSID pOwner = uBuf.Rel.Control & SE_SELF_RELATIVE ? &uBuf.abView[uBuf.Rel.Owner] : uBuf.Abs.Owner; 446 455 Assert((uintptr_t)pOwner - (uintptr_t)&uBuf < sizeof(uBuf) - sizeof(SID)); 447 456 if (RtlEqualSid(pOwner, &g_TrustedInstallerSid)) 457 return true; 458 if (RtlEqualSid(pOwner, &g_LocalSystemSid)) 448 459 return true; 449 460 … … 705 716 /* Must be owned by trusted installer. (This test is superfuous, thus no relaxation here.) */ 706 717 if ( !(fFlags & SUPHNTVI_F_TRUSTED_INSTALLER_OWNER) 707 && !supHardNtViCheckIsOwnedByTrustedInstaller (hFile, pwszName))718 && !supHardNtViCheckIsOwnedByTrustedInstallerOrSimilar(hFile, pwszName)) 708 719 return rc; 709 720 … … 762 773 /* Must be owned by trusted installer. */ 763 774 if ( !(fFlags & SUPHNTVI_F_TRUSTED_INSTALLER_OWNER) 764 && !supHardNtViCheckIsOwnedByTrustedInstaller (hFile, pwszName))775 && !supHardNtViCheckIsOwnedByTrustedInstallerOrSimilar(hFile, pwszName)) 765 776 return rc; 766 777 return VINF_LDRVI_NOT_SIGNED; … … 779 790 780 791 if ( !(fFlags & SUPHNTVI_F_TRUSTED_INSTALLER_OWNER) 781 && !supHardNtViCheckIsOwnedByTrustedInstaller (hFile, pwszName))792 && !supHardNtViCheckIsOwnedByTrustedInstallerOrSimilar(hFile, pwszName)) 782 793 return rc; 783 794 … … 827 838 { 828 839 if ( !(fFlags & SUPHNTVI_F_TRUSTED_INSTALLER_OWNER) 829 && !supHardNtViCheckIsOwnedByTrustedInstaller (hFile, pwszName))840 && !supHardNtViCheckIsOwnedByTrustedInstallerOrSimilar(hFile, pwszName)) 830 841 return rc; 831 842 return VINF_LDRVI_NOT_SIGNED; … … 837 848 */ 838 849 if ( (fFlags & SUPHNTVI_F_TRUSTED_INSTALLER_OWNER) 839 || supHardNtViCheckIsOwnedByTrustedInstaller (hFile, pwszName))850 || supHardNtViCheckIsOwnedByTrustedInstallerOrSimilar(hFile, pwszName)) 840 851 return VINF_LDRVI_NOT_SIGNED; 841 852 … … 1015 1026 * user32.dll. Since we need user32.dll and will be checking it's digital 1016 1027 * signature, it's reasonably safe to let this thru. 1028 * (The report was of SECURITY_BUILTIN_DOMAIN_RID + DOMAIN_ALIAS_RID_ADMINS 1029 * owning user32.dll, see public ticket 13187, VBoxStartup.3.log.) 1017 1030 */ 1018 1031 if ( (pNtViRdr->fFlags & SUPHNTVI_F_TRUSTED_INSTALLER_OWNER) 1019 && !supHardNtViCheckIsOwnedByTrustedInstaller (pNtViRdr->hFile, pwszName))1032 && !supHardNtViCheckIsOwnedByTrustedInstallerOrSimilar(pNtViRdr->hFile, pwszName)) 1020 1033 { 1021 1034 if (!supHardViUtf16PathStartsWithEx(pwszName, (uint32_t)RTUtf16Len(pwszName), … … 1615 1628 *RtlSubAuthoritySid(&g_TrustedInstallerSid, 4) = 1853292631; 1616 1629 *RtlSubAuthoritySid(&g_TrustedInstallerSid, 5) = 2271478464; 1617 return VINF_SUCCESS; 1630 1631 if (NT_SUCCESS(rcNt)) 1632 rcNt = RtlInitializeSid(&g_LocalSystemSid, &s_NtAuth, 1); 1633 if (NT_SUCCESS(rcNt)) 1634 { 1635 *RtlSubAuthoritySid(&g_LocalSystemSid, 0) = SECURITY_LOCAL_SYSTEM_RID; 1636 return VINF_SUCCESS; 1637 } 1618 1638 } 1619 1639 rc = RTErrConvertFromNtStatus(rcNt);
Note:
See TracChangeset
for help on using the changeset viewer.