VirtualBox

Changeset 52973 in vbox


Ignore:
Timestamp:
Oct 7, 2014 12:15:09 PM (10 years ago)
Author:
vboxsync
Message:

SUP: Handle denormalized command line string pointer and always ignore LdrInitializeThunk when verify or purifying processes.

Location:
trunk/src/VBox/HostDrivers/Support/win
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/HostDrivers/Support/win/SUPHardenedVerifyProcess-win.cpp

    r52967 r52973  
    853853        }
    854854
    855         if (   pThis->enmKind == SUPHARDNTVPKIND_SELF_PURIFICATION
    856             || pThis->enmKind == SUPHARDNTVPKIND_VERIFY_ONLY)
    857         {
    858             /* Ignore our patched LdrInitializeThunk hack. */
    859             rc = RTLdrGetSymbolEx(pImage->pCacheEntry->hLdrMod, pbBits, 0, UINT32_MAX, "LdrInitializeThunk", &uValue);
    860             if (RT_FAILURE(rc))
    861                 return supHardNtVpSetInfo2(pThis, rc, "%s: Failed to find 'LdrInitializeThunk': %Rrc", pImage->pszName, rc);
    862             aSkipAreas[cSkipAreas].uRva = (uint32_t)uValue;
    863             aSkipAreas[cSkipAreas++].cb = 14;
    864         }
     855        /* Ignore our patched LdrInitializeThunk hack. */
     856        rc = RTLdrGetSymbolEx(pImage->pCacheEntry->hLdrMod, pbBits, 0, UINT32_MAX, "LdrInitializeThunk", &uValue);
     857        if (RT_FAILURE(rc))
     858            return supHardNtVpSetInfo2(pThis, rc, "%s: Failed to find 'LdrInitializeThunk': %Rrc", pImage->pszName, rc);
     859        aSkipAreas[cSkipAreas].uRva = (uint32_t)uValue;
     860        aSkipAreas[cSkipAreas++].cb = 14;
    865861
    866862        /* LdrSystemDllInitBlock is filled in by the kernel. It mainly contains addresses of 32-bit ntdll method for wow64. */
  • trunk/src/VBox/HostDrivers/Support/win/SUPR3HardenedMain-win.cpp

    r52972 r52973  
    54895489    /*
    54905490     * Convert the arguments to UTF-8 so we can open the log file if specified.
     5491     * We may have to normalize the pointer on older windows version (not w7/64 +).
    54915492     * Note! This leaks memory at present.
    54925493     */
    5493     PUNICODE_STRING pCmdLineStr = &NtCurrentPeb()->ProcessParameters->CommandLine;
     5494    PRTL_USER_PROCESS_PARAMETERS pUserProcParams = NtCurrentPeb()->ProcessParameters;
     5495    UNICODE_STRING CmdLineStr = pUserProcParams->CommandLine;
     5496    if (   CmdLineStr.Buffer != NULL
     5497        && !(pUserProcParams->Flags & RTL_USER_PROCESS_PARAMS_FLAG_NORMALIZED) )
     5498        CmdLineStr.Buffer = (WCHAR *)((uintptr_t)CmdLineStr.Buffer + (uintptr_t)pUserProcParams);
    54945499    int    cArgs;
    5495     char **papszArgs = suplibCommandLineToArgvWStub(pCmdLineStr->Buffer, pCmdLineStr->Length / sizeof(WCHAR), &cArgs);
     5500    char **papszArgs = suplibCommandLineToArgvWStub(CmdLineStr.Buffer, CmdLineStr.Length / sizeof(WCHAR), &cArgs);
    54965501    supR3HardenedOpenLog(&cArgs, papszArgs);
    54975502    SUP_DPRINTF(("supR3HardenedVmProcessInit: uNtDllAddr=%p\n", uNtDllAddr));
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