VirtualBox

儲存庫 vbox 的更動 52404


忽略:
時間撮記:
2014-8-19 上午12:52:17 (10 年 以前)
作者:
vboxsync
訊息:

Simplified the checks.

位置:
trunk/src/VBox/HostDrivers/Support
檔案:
修改 3 筆資料

圖例:

未更動
新增
刪除
  • trunk/src/VBox/HostDrivers/Support/Makefile.kmk

    r52403 r52404  
    143143        $(if $(VBOX_WITH_MAIN),VBOX_WITH_MAIN,) \
    144144        $(if $(VBOX_WITH_RAW_MODE),VBOX_WITH_RAW_MODE,) \
    145         VBOX_PERMIT_MORE
     145        VBOX_PERMIT_MORE \
     146        VBOX_PERMIT_EVEN_MORE
    146147SUPR3_INCS         := $(PATH_SUB_CURRENT)
    147148SUPR3_SOURCES       = \
     
    185186        $(if $(VBOX_WITHOUT_DEBUGGER_CHECKS),VBOX_WITHOUT_DEBUGGER_CHECKS,) \
    186187        $(if $(VBOX_PERMIT_VISUAL_STUDIO_PROFILING),VBOX_PERMIT_VISUAL_STUDIO_PROFILING,) \
    187         VBOX_PERMIT_MORE
     188        VBOX_PERMIT_MORE \
     189        VBOX_PERMIT_EVEN_MORE
    188190ifdef VBOX_WITH_VISTA_NO_SP
    189191 SUPR3HardenedStatic_DEFS.win += VBOX_WITH_VISTA_NO_SP
     
    563565  VBoxDrv_DEFS           += VBOX_PERMIT_VISUAL_STUDIO_PROFILING
    564566 endif
    565  VBoxDrv_DEFS            += VBOX_PERMIT_MORE
     567 VBoxDrv_DEFS            += VBOX_PERMIT_MORE VBOX_PERMIT_EVEN_MORE
    566568 #VBoxDrv_DEFS.debug      += DEBUG_DARWIN_GIP
    567569 VBoxDrv_DEFS.darwin     := VBOX_WITH_HOST_VMX
  • trunk/src/VBox/HostDrivers/Support/win/SUPHardenedVerifyImage-win.cpp

    r52403 r52404  
    6969 * enough a good while. */
    7070#define SUPHARDNTVI_MAX_CAT_HASH_SIZE   128
     71
     72
     73#if defined(VBOX_PERMIT_EVEN_MORE) && !defined(VBOX_PERMIT_MORE)
     74# error "VBOX_PERMIT_EVEN_MORE without VBOX_PERMIT_MORE!"
     75#endif
    7176
    7277
     
    728733           version.  If it should, it's likely to be a fake. */
    729734        /** @todo list of signed dlls for various windows versions.  */
    730 SUP_DPRINTF(("supHardNtViCheckIfNotSignedOk: VINF_LDRVI_NOT_SIGNED\n"));
    731735        return VINF_LDRVI_NOT_SIGNED;
    732736#else
     
    735739    }
    736740
     741
    737742#ifndef IN_RING0
    738743    /*
     
    753758            return rc;
    754759
    755         if (   (fFlags & SUPHNTVI_F_TRUSTED_INSTALLER_OWNER)
    756             && supHardNtViCheckIsOwnedByTrustedInstaller(hFile, pwszName))
    757             return VINF_LDRVI_NOT_SIGNED;
    758         return rc;
    759     }
    760 #endif /* !IN_RING0 */
    761 
    762 #ifdef VBOX_PERMIT_MORE
    763     /*
    764      * AppPatch whitelist.
    765      */
    766     if (supHardViIsAppPatchDir(pwszName, cwcName))
    767     {
    768         cwcOther = g_System32NtPath.UniStr.Length / sizeof(WCHAR); /* ASSUMES System32 is called System32. */
    769         pwsz = pwszName + cwcOther + 1;
    770 
     760        /* Must be owned by trusted installer. */
    771761        if (   !(fFlags & SUPHNTVI_F_TRUSTED_INSTALLER_OWNER)
    772762            && !supHardNtViCheckIsOwnedByTrustedInstaller(hFile, pwszName))
    773763            return rc;
    774 
     764        return VINF_LDRVI_NOT_SIGNED;
     765    }
     766#endif /* !IN_RING0 */
     767
     768
     769#ifdef VBOX_PERMIT_MORE
     770    /*
     771     * AppPatch whitelist.
     772     */
     773    if (supHardViIsAppPatchDir(pwszName, cwcName))
     774    {
     775        cwcOther = g_System32NtPath.UniStr.Length / sizeof(WCHAR); /* ASSUMES System32 is called System32. */
     776        pwsz = pwszName + cwcOther + 1;
     777
     778        if (   !(fFlags & SUPHNTVI_F_TRUSTED_INSTALLER_OWNER)
     779            && !supHardNtViCheckIsOwnedByTrustedInstaller(hFile, pwszName))
     780            return rc;
     781
     782# ifndef VBOX_PERMIT_EVEN_MORE
    775783        if (supHardViUtf16PathIsEqual(pwsz, "acres.dll"))
    776784            return VINF_LDRVI_NOT_SIGNED;
    777785
    778 # ifdef RT_ARCH_AMD64
     786#  ifdef RT_ARCH_AMD64
    779787        if (supHardViUtf16PathIsEqual(pwsz, "AppPatch64\\AcGenral.dll"))
    780788            return VINF_LDRVI_NOT_SIGNED;
    781 # elif defined(RT_ARCH_X86)
     789#  elif defined(RT_ARCH_X86)
    782790        if (supHardViUtf16PathIsEqual(pwsz, "AcGenral.dll"))
    783791            return VINF_LDRVI_NOT_SIGNED;
     792#  endif
     793# endif /* !VBOX_PERMIT_EVEN_MORE */
     794
     795# ifdef IN_RING0
     796        return rc;
     797# else
     798        return VINF_LDRVI_NOT_SIGNED;
    784799# endif
    785 
    786 # ifndef IN_RING0
    787         return VINF_LDRVI_NOT_SIGNED;
    788 # else
    789         return rc;
    790 # endif
    791800    }
    792801#endif /* VBOX_PERMIT_MORE */
    793802
    794 #if !defined(IN_RING0) && defined(VBOX_PERMIT_MORE)
     803
     804#ifndef IN_RING0
     805# if defined(VBOX_PERMIT_MORE) && !defined(VBOX_PERMIT_EVEN_MORE)
    795806    /*
    796807     * Program files and common files.
     
    813824       )
    814825    {
    815         if (   (fFlags & SUPHNTVI_F_TRUSTED_INSTALLER_OWNER)
    816             && supHardNtViCheckIsOwnedByTrustedInstaller(hFile, pwszName))
    817             return VINF_LDRVI_NOT_SIGNED;
    818         return rc;
    819     }
    820 #endif /* !IN_RING0 && VBOX_PERMIT_MORE*/
    821 
     826        if (   !(fFlags & SUPHNTVI_F_TRUSTED_INSTALLER_OWNER)
     827            && !supHardNtViCheckIsOwnedByTrustedInstaller(hFile, pwszName))
     828            return rc;
     829        return VINF_LDRVI_NOT_SIGNED;
     830    }
     831
     832# elif defined(VBOX_PERMIT_MORE) && defined(VBOX_PERMIT_EVEN_MORE)
     833    /*
     834     * Anything that's owned by the trusted installer.
     835     */
     836    if (   (fFlags & SUPHNTVI_F_TRUSTED_INSTALLER_OWNER)
     837        || supHardNtViCheckIsOwnedByTrustedInstaller(hFile, pwszName))
     838        return VINF_LDRVI_NOT_SIGNED;
     839
     840# endif
     841#endif /* !IN_RING0 */
     842
     843    /*
     844     * Not permitted.
     845     */
    822846    return rc;
    823847}
  • trunk/src/VBox/HostDrivers/Support/win/SUPR3HardenedMain-win.cpp

    r52403 r52404  
    11731173    }
    11741174
     1175#ifndef VBOX_PERMIT_EVEN_MORE
    11751176    /*
    11761177     * Check the path.  We don't allow DLLs to be loaded from just anywhere:
     
    11831184     *      7. x86 variations of 4 & 5 - ditto.
    11841185     */
    1185     bool fSystem32 = false;
    11861186    Assert(g_SupLibHardenedExeNtPath.UniStr.Buffer[g_offSupLibHardenedExeNtName - 1] == '\\');
    11871187    uint32_t fFlags = 0;
    11881188    if (supHardViUniStrPathStartsWithUniStr(&uBuf.UniStr, &g_System32NtPath.UniStr, true /*fCheckSlash*/))
    1189     {
    1190         fSystem32 = true;
    11911189        fFlags |= SUPHNTVI_F_ALLOW_CAT_FILE_VERIFICATION | SUPHNTVI_F_TRUSTED_INSTALLER_OWNER;
    1192     }
    11931190    else if (supHardViUniStrPathStartsWithUniStr(&uBuf.UniStr, &g_WinSxSNtPath.UniStr, true /*fCheckSlash*/))
    11941191        fFlags |= SUPHNTVI_F_ALLOW_CAT_FILE_VERIFICATION | SUPHNTVI_F_TRUSTED_INSTALLER_OWNER;
     
    11971194                                            g_offSupLibHardenedExeNtName, false /*fCheckSlash*/))
    11981195        fFlags |= SUPHNTVI_F_REQUIRE_KERNEL_CODE_SIGNING | SUPHNTVI_F_REQUIRE_SIGNATURE_ENFORCEMENT;
    1199 #ifdef VBOX_PERMIT_MORE
     1196# ifdef VBOX_PERMIT_MORE
    12001197    else if (supHardViIsAppPatchDir(uBuf.UniStr.Buffer, uBuf.UniStr.Length / sizeof(WCHAR)))
    12011198        fFlags |= SUPHNTVI_F_ALLOW_CAT_FILE_VERIFICATION | SUPHNTVI_F_TRUSTED_INSTALLER_OWNER;
     
    12041201    else if (supHardViUniStrPathStartsWithUniStr(&uBuf.UniStr, &g_CommonFilesNtPath.UniStr, true /*fCheckSlash*/))
    12051202        fFlags |= SUPHNTVI_F_ALLOW_CAT_FILE_VERIFICATION | SUPHNTVI_F_TRUSTED_INSTALLER_OWNER;
    1206 # ifdef RT_ARCH_AMD64
     1203#  ifdef RT_ARCH_AMD64
    12071204    else if (supHardViUniStrPathStartsWithUniStr(&uBuf.UniStr, &g_ProgramFilesX86NtPath.UniStr, true /*fCheckSlash*/))
    12081205        fFlags |= SUPHNTVI_F_ALLOW_CAT_FILE_VERIFICATION | SUPHNTVI_F_TRUSTED_INSTALLER_OWNER;
    12091206    else if (supHardViUniStrPathStartsWithUniStr(&uBuf.UniStr, &g_CommonFilesX86NtPath.UniStr, true /*fCheckSlash*/))
    12101207        fFlags |= SUPHNTVI_F_ALLOW_CAT_FILE_VERIFICATION | SUPHNTVI_F_TRUSTED_INSTALLER_OWNER;
     1208#  endif
    12111209# endif
    1212 #endif
    1213 #ifdef VBOX_PERMIT_VISUAL_STUDIO_PROFILING
     1210# ifdef VBOX_PERMIT_VISUAL_STUDIO_PROFILING
    12141211    /* Hack to allow profiling our code with Visual Studio. */
    12151212    else if (   uBuf.UniStr.Length > sizeof(L"\\SamplingRuntime.dll")
     
    12221219        return STATUS_SUCCESS;
    12231220    }
    1224 #endif
     1221# endif
    12251222    else
    12261223    {
     
    12321229        return STATUS_TRUST_FAILURE;
    12331230    }
     1231
     1232#else  /* VBOX_PERMIT_EVEN_MORE */
     1233    /*
     1234     * Require trusted installer + some kind of signature on everything, except
     1235     * for the VBox bits where we require kernel code signing and special
     1236     * integrity checks.
     1237     */
     1238    Assert(g_SupLibHardenedExeNtPath.UniStr.Buffer[g_offSupLibHardenedExeNtName - 1] == '\\');
     1239    uint32_t fFlags = 0;
     1240    if (supHardViUtf16PathStartsWithEx(uBuf.UniStr.Buffer, uBuf.UniStr.Length / sizeof(WCHAR),
     1241                                       g_SupLibHardenedExeNtPath.UniStr.Buffer,
     1242                                       g_offSupLibHardenedExeNtName, false /*fCheckSlash*/))
     1243        fFlags |= SUPHNTVI_F_REQUIRE_KERNEL_CODE_SIGNING | SUPHNTVI_F_REQUIRE_SIGNATURE_ENFORCEMENT;
     1244    else
     1245        fFlags |= SUPHNTVI_F_ALLOW_CAT_FILE_VERIFICATION | SUPHNTVI_F_TRUSTED_INSTALLER_OWNER;
     1246#endif /* VBOX_PERMIT_EVEN_MORE */
    12341247
    12351248    /*
注意: 瀏覽 TracChangeset 來幫助您使用更動檢視器

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette