VirtualBox

Changeset 53017 in vbox for trunk


Ignore:
Timestamp:
Oct 10, 2014 1:44:08 AM (10 years ago)
Author:
vboxsync
Message:

SUP: Try to work around sakfile.sys bsod and dgmaster.sys.

Location:
trunk
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/include/VBox/err.h

    r52962 r53017  
    25252525 * opened by the VM process. */
    25262526#define VERR_SUP_VP_STUB_THREAD_OPEN_ERROR          (-5672)
     2527/** Process Purification Failure: NtAllocateVirtualMemory failed to get us
     2528 * suitable replacement memory for a chunk of executable memory that
     2529 * shouldn't be present in our process.  (You will only see this message if you
     2530 * got potentially fatally buggy anti-virus software installed.) */
     2531#define VERR_SUP_VP_REPLACE_VIRTUAL_MEMORY_FAILED   (-5673)
    25272532
    25282533/** @} */
  • trunk/src/VBox/HostDrivers/Support/win/SUPDrv-win.cpp

    r53016 r53017  
    40634063        if (RT_SUCCESS(rc))
    40644064        {
    4065             rc = supHardenedWinVerifyProcess(NtCurrentProcess(), NtCurrentThread(), SUPHARDNTVPKIND_VERIFY_ONLY,
     4065            rc = supHardenedWinVerifyProcess(NtCurrentProcess(), NtCurrentThread(), SUPHARDNTVPKIND_VERIFY_ONLY, 0 /*fFlags*/,
    40664066                                             NULL /*pcFixes*/, &ErrInfo);
    40674067            if (RT_SUCCESS(rc) && pNtProtect->enmProcessKind >= kSupDrvNtProtectKind_VmProcessUnconfirmed)
  • trunk/src/VBox/HostDrivers/Support/win/SUPHardenedVerify-win.h

    r52954 r53017  
    5454    SUPHARDNTVPKIND_32BIT_HACK = 0x7fffffff
    5555} SUPHARDNTVPKIND;
    56 DECLHIDDEN(int)     supHardenedWinVerifyProcess(HANDLE hProcess, HANDLE hThread, SUPHARDNTVPKIND enmKind,
     56/** @name SUPHARDNTVP_F_XXX - Flags for supHardenedWinVerifyProcess
     57 * @{ */
     58/** Replace unwanted executable memory allocations with a new one that's filled
     59 * with zeros (default is just to free it).
     60 *
     61 * This is one way we attempt to work around buggy protection software that
     62 * either result in host BSOD or VBox application malfunction.  Here the current
     63 * shit list:
     64 *  - Trend Micro's data protection software includes a buggy driver called
     65 *    sakfile.sys that has been observed crashing accessing user memory that we
     66 *    probably freed.  I'd love to report this to Trend Micro, but unfortunately
     67 *    they doesn't advertise (or have?) an email address for reporting security
     68 *    vulnerabilities in the their software.  Having wasted time looking and not
     69 *    very sorry for having to disclosing the bug here.
     70 *  - Maybe one more.
     71 */
     72#define SUPHARDNTVP_F_EXEC_ALLOC_REPLACE_WITH_ZERO          RT_BIT_32(0)
     73/** @} */
     74DECLHIDDEN(int)     supHardenedWinVerifyProcess(HANDLE hProcess, HANDLE hThread, SUPHARDNTVPKIND enmKind, uint32_t fFlags,
    5775                                                uint32_t *pcFixes, PRTERRINFO pErrInfo);
    5876DECLHIDDEN(int)     supHardNtVpThread(HANDLE hProcess, HANDLE hThread, PRTERRINFO pErrInfo);
  • trunk/src/VBox/HostDrivers/Support/win/SUPHardenedVerifyProcess-win.cpp

    r52973 r53017  
    129129    /** Type of verification to perform. */
    130130    SUPHARDNTVPKIND         enmKind;
     131    /** Combination of SUPHARDNTVP_F_XXX. */
     132    uint32_t                fFlags;
    131133    /** The result. */
    132134    int                     rcResult;
     
    15001502                                            "NtFreeVirtualMemory (%p LB %#zx) failed: %#x",
    15011503                                            MemInfo.BaseAddress, MemInfo.RegionSize, rcNt);
     1504                    /* The Trend Micro sakfile.sys BSOD kludge. */
     1505                    if (pThis->fFlags & SUPHARDNTVP_F_EXEC_ALLOC_REPLACE_WITH_ZERO)
     1506                    {
     1507                        pvFree = MemInfo.BaseAddress;
     1508                        cbFree = MemInfo.RegionSize;
     1509                        rcNt = NtAllocateVirtualMemory(pThis->hProcess, &pvFree, 0, &cbFree, MEM_COMMIT, PAGE_READWRITE);
     1510                        if (!NT_SUCCESS(rcNt))
     1511                            supHardNtVpSetInfo2(pThis, VERR_SUP_VP_REPLACE_VIRTUAL_MEMORY_FAILED,
     1512                                                "NtAllocateVirtualMemory (%p LB %#zx) failed with rcNt=%#x allocating "
     1513                                                "replacement memory for working around buggy protection software. "
     1514                                                "See VBoxStartup.log for more details",
     1515                                                MemInfo.BaseAddress, MemInfo.RegionSize, rcNt);
     1516                        if (pvFree != MemInfo.BaseAddress)
     1517                            supHardNtVpSetInfo2(pThis, VERR_SUP_VP_REPLACE_VIRTUAL_MEMORY_FAILED,
     1518                                                "We wanted NtAllocateVirtualMemory to get us %p LB %#zx, but it returned %p LB %#zx.",
     1519                                                MemInfo.BaseAddress, MemInfo.RegionSize, pvFree, cbFree, rcNt);
     1520                    }
    15021521                }
    15031522                /*
     
    21242143 * @param   hThread             A thread in the process (the caller).
    21252144 * @param   enmKind             The kind of process verification to perform.
     2145 * @param   fFlags              Valid combination of SUPHARDNTVP_F_XXX flags.
    21262146 * @param   pErrInfo            Pointer to error info structure. Optional.
    21272147 * @param   pcFixes             Where to return the number of fixes made during
    21282148 *                              purification.  Optional.
    21292149 */
    2130 DECLHIDDEN(int) supHardenedWinVerifyProcess(HANDLE hProcess, HANDLE hThread, SUPHARDNTVPKIND enmKind,
     2150DECLHIDDEN(int) supHardenedWinVerifyProcess(HANDLE hProcess, HANDLE hThread, SUPHARDNTVPKIND enmKind, uint32_t fFlags,
    21312151                                            uint32_t *pcFixes, PRTERRINFO pErrInfo)
    21322152{
     
    21522172        {
    21532173            pThis->enmKind  = enmKind;
     2174            pThis->fFlags   = fFlags;
    21542175            pThis->rcResult = VINF_SUCCESS;
    21552176            pThis->hProcess = hProcess;
  • trunk/src/VBox/HostDrivers/Support/win/SUPR3HardenedMain-win.cpp

    r53003 r53017  
    340340/** TrendMicro OfficeScan and probably others. */
    341341#define SUPHARDNT_ADVERSARY_TRENDMICRO              RT_BIT_32(3)
     342/** TrendMicro potentially buggy sakfile.sys. */
     343#define SUPHARDNT_ADVERSARY_TRENDMICRO_SAKFILE      RT_BIT_32(4)
    342344/** McAfee.  */
    343 #define SUPHARDNT_ADVERSARY_MCAFEE                  RT_BIT_32(4)
     345#define SUPHARDNT_ADVERSARY_MCAFEE                  RT_BIT_32(5)
    344346/** Kaspersky or OEMs of it.  */
    345 #define SUPHARDNT_ADVERSARY_KASPERSKY               RT_BIT_32(5)
     347#define SUPHARDNT_ADVERSARY_KASPERSKY               RT_BIT_32(6)
    346348/** Malwarebytes Anti-Malware (MBAM). */
    347 #define SUPHARDNT_ADVERSARY_MBAM                    RT_BIT_32(6)
     349#define SUPHARDNT_ADVERSARY_MBAM                    RT_BIT_32(7)
    348350/** AVG Internet Security. */
    349 #define SUPHARDNT_ADVERSARY_AVG                     RT_BIT_32(7)
     351#define SUPHARDNT_ADVERSARY_AVG                     RT_BIT_32(8)
    350352/** Panda Security. */
    351 #define SUPHARDNT_ADVERSARY_PANDA                   RT_BIT_32(8)
     353#define SUPHARDNT_ADVERSARY_PANDA                   RT_BIT_32(9)
    352354/** Microsoft Security Essentials. */
    353 #define SUPHARDNT_ADVERSARY_MSE                     RT_BIT_32(9)
     355#define SUPHARDNT_ADVERSARY_MSE                     RT_BIT_32(10)
    354356/** Comodo. */
    355 #define SUPHARDNT_ADVERSARY_COMODO                  RT_BIT_32(10)
     357#define SUPHARDNT_ADVERSARY_COMODO                  RT_BIT_32(11)
    356358/** Check Point's Zone Alarm (may include Kaspersky).  */
    357 #define SUPHARDNT_ADVERSARY_ZONE_ALARM              RT_BIT_32(11)
     359#define SUPHARDNT_ADVERSARY_ZONE_ALARM              RT_BIT_32(12)
     360/** Digital guardian.  */
     361#define SUPHARDNT_ADVERSARY_DIGITAL_GUARDIAN        RT_BIT_32(13)
    358362/** Unknown adversary detected while waiting on child. */
    359363#define SUPHARDNT_ADVERSARY_UNKNOWN                 RT_BIT_32(31)
     
    35173521        cFixes = 0;
    35183522        int rc = supHardenedWinVerifyProcess(pThis->hProcess, pThis->hThread, SUPHARDNTVPKIND_CHILD_PURIFICATION,
     3523                                             g_fSupAdversaries & (  SUPHARDNT_ADVERSARY_TRENDMICRO_SAKFILE
     3524                                                                  | SUPHARDNT_ADVERSARY_DIGITAL_GUARDIAN)
     3525                                             ? SUPHARDNTVP_F_EXEC_ALLOC_REPLACE_WITH_ZERO : 0,
    35193526                                             &cFixes, RTErrInfoInitStatic(&g_ErrInfoStatic));
    35203527        if (RT_FAILURE(rc))
     
    46754682                cFixes = 0;
    46764683                rc = supHardenedWinVerifyProcess(NtCurrentProcess(), NtCurrentThread(), SUPHARDNTVPKIND_SELF_PURIFICATION,
    4677                                                  &cFixes, NULL /*pErrInfo*/);
     4684                                                 0 /*fFlags*/, &cFixes, NULL /*pErrInfo*/);
    46784685                if (RT_FAILURE(rc) || cFixes == 0)
    46794686                    break;
     
    51025109        { SUPHARDNT_ADVERSARY_COMODO, "cmdHlp" },
    51035110
     5111        { SUPHARDNT_ADVERSARY_DIGITAL_GUARDIAN, "dgmaster" }, /* Not verified. */
    51045112    };
    51055113
     
    51405148        { SUPHARDNT_ADVERSARY_TRENDMICRO, L"\\SystemRoot\\System32\\drivers\\tmeevw.sys" },
    51415149        { SUPHARDNT_ADVERSARY_TRENDMICRO, L"\\SystemRoot\\System32\\drivers\\tmciesc.sys" },
     5150        { SUPHARDNT_ADVERSARY_TRENDMICRO_SAKFILE, L"\\SystemRoot\\System32\\drivers\\sakfile.sys" },  /* Data Loss Prevention, not officescan. */
     5151        { SUPHARDNT_ADVERSARY_TRENDMICRO, L"\\SystemRoot\\System32\\drivers\\sakcd.sys" },  /* Data Loss Prevention, not officescan. */
     5152
    51425153
    51435154        { SUPHARDNT_ADVERSARY_MCAFEE, L"\\SystemRoot\\System32\\drivers\\cfwids.sys" },
     
    52115222        { SUPHARDNT_ADVERSARY_ZONE_ALARM, L"\\SystemRoot\\System32\\drivers\\vsdatant.sys" },
    52125223        { SUPHARDNT_ADVERSARY_ZONE_ALARM, L"\\SystemRoot\\System32\\AntiTheftCredentialProvider.dll" },
     5224
     5225        { SUPHARDNT_ADVERSARY_DIGITAL_GUARDIAN, L"\\SystemRoot\\System32\\drivers\\dgmaster.sys" },
    52135226    };
    52145227
Note: See TracChangeset for help on using the changeset viewer.

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