|
| 1 | +.. _Windows-Exceptions: |
| 2 | + |
| 3 | +Windows Exception Errors |
| 4 | +======================== |
| 5 | + |
| 6 | +Windows exception errors have many different causes and at least as many possible solutions. |
| 7 | +The below 'fixes' may need to be used in combination to fix any of these issues. |
| 8 | + |
| 9 | + |
| 10 | +STATUS_PRIVILEGED_INSTRUCTION (0xC0000096) |
| 11 | +------------------------------------------ |
| 12 | + |
| 13 | +This type of error often occurs on newer Windows OSes, often caused by the Windows `Device Guard` feature. |
| 14 | +THIS IS A KNOWN ISSUE WITH WINDOWS AND NOT A CHIPSEC BUG. |
| 15 | + |
| 16 | +For CHIPSEC to work, the Windows `Device Guard` feature needs to be disabled. |
| 17 | + |
| 18 | +Example errors: |
| 19 | + |
| 20 | +:: |
| 21 | + |
| 22 | + ERROR: HW Access Violation: DeviceIoControl returned STATUS_PRIVILEGED_INSTRUCTION (0xC0000096) |
| 23 | + |
| 24 | + chipsec.helper.oshelper.HWAccessViolationError: HW Access Violation: DeviceIoControl returned STATUS_PRIVILEGED_INSTRUCTION (0xC0000096) |
| 25 | + |
| 26 | + |
| 27 | +**Device Guard and Credential Guard hardware readiness tool** |
| 28 | + |
| 29 | +`Device Guard and Credential Guard hardware readiness tool <https://www.microsoft.com/en-us/download/details.aspx?id=53337>`_ |
| 30 | + |
| 31 | +Steps to disable Device Guard: |
| 32 | + #. Download the Microsoft `Device Guard and Credential Guard hardware readiness tool` |
| 33 | + #. Extract zip contents |
| 34 | + #. Run this command (via PowerShell): ``DG_Readiness.ps1 -Disable`` |
| 35 | + #. Reboot system and press **<F3>** when prompted (twice) |
| 36 | + #. May take several reboots before finishing |
| 37 | + |
| 38 | +.. note:: |
| 39 | + |
| 40 | + Microsoft seems to no longer use “Device Guard”, instead now uses WDAC (Windows Defender Application Control). |
| 41 | + |
| 42 | + |
| 43 | +**If the readiness tool doesn't work...** |
| 44 | + |
| 45 | +Workaround: |
| 46 | + |
| 47 | +1. Launch `Local Group Policy Editor` |
| 48 | + |
| 49 | + a. Run -> ``gpedit.msc`` |
| 50 | + |
| 51 | +2. Change `Device Guard` setting to `Disabled` |
| 52 | + |
| 53 | + a. Computer Configuration > Administrative Templates > System > Device Guard |
| 54 | + b. Switch `Device Guard` from "Not Configured" to "Disabled" |
| 55 | + |
| 56 | +3. Save changes and exit `Group Policy Editor` |
| 57 | + |
| 58 | + 4. Reboot |
| 59 | + |
| 60 | +.. note:: |
| 61 | + |
| 62 | + Windows Home version may NOT have `Group Policy Editor` loaded by default. |
| 63 | + |
| 64 | + |
| 65 | +**Windows Home workaround:** |
| 66 | + |
| 67 | +There is no guarantee that these steps will work. If they don't, it is recommended to use `Windows Pro` or `Windows Enterprise` versions that include the `Group Policy Editor`. |
| 68 | + |
| 69 | +1. From a Windows PowerShell, `Run as Administrator`, run these commands sequentially: |
| 70 | + |
| 71 | +:: |
| 72 | + |
| 73 | + FOR %F IN ("%SystemRoot%\servicing\Packages\Microsoft-Windows-GroupPolicy-ClientTools-Package~*.mum") DO ( |
| 74 | + DISM /Online /NoRestart /Add-Package:"%F" |
| 75 | + ) |
| 76 | + |
| 77 | + FOR %F IN ("%SystemRoot%\servicing\Packages\Microsoft-Windows-GroupPolicy-ClientExtensions-Package~*.mum") DO ( |
| 78 | + DISM /Online /NoRestart /Add-Package:"%F" |
| 79 | + ) |
| 80 | + |
| 81 | +2. After these commands complete, reboot the system. The `Group Policy Editor` should now be installed and ready to run the above steps to disable `Device Guard`. |
| 82 | + |
| 83 | +.. note:: |
| 84 | + |
| 85 | + Occasionally Windows does not include the needed `Administrative template` for `Device Guard` to be visible and the template will have to be updated. |
| 86 | + In this case, download the below update and run it on the system. Reboot the system and verify that `Device Guard` is now visible. |
| 87 | + |
| 88 | + Updated Windows 10 Administrative Template: |
| 89 | + https://www.microsoft.com/en-us/download/100591 |
| 90 | + |
| 91 | + It is possible that the template update does NOT have the needed permissions to properly update the template. |
| 92 | + A manual update may be needed. Don't forget to reboot after. |
| 93 | + |
| 94 | +3. Manually copy the **.admx** and **.adml** files from the update folder |
| 95 | +**C:\\Program Files (x86)\\Microsoft Group Policy\\Windows 10 November 2019 Update (1909)\\PolicyDefinitions\\** to **C:\\Windows\\PolicyDefinitions** |
| 96 | + |
| 97 | +If this last step does not work, you will have to use a different OS. |
| 98 | + |
| 99 | + |
| 100 | +**ERROR: Exception occurred during …** |
| 101 | + |
| 102 | +This error, like the previous issue, appears to be related to a Windows Server OS and its security protections. Often happening when trying to read an MSR, MMIO, or device. |
| 103 | +Windows Server OS appears to be blocking read access to them. MSR and MMIO reads will simply fail with this error message. |
| 104 | +Device (PCI) reads appear to mask the device and return all 0xF's, causing an error parsing them. |
| 105 | + |
| 106 | +One or more of the above mentioned solutions *may* fix this. |
| 107 | + |
| 108 | +Example MSR/MMIO error: |
| 109 | + |
| 110 | +:: |
| 111 | + |
| 112 | + ERROR: Exception occurred during chipsec.modules.common.smm_dma.run(): ''TSEGMB'' |
| 113 | + |
| 114 | +Example PCI error: |
| 115 | + |
| 116 | +:: |
| 117 | + |
| 118 | + ERROR: Exception occurred during chipsec.modules.common.bios_smi.run(): 'integer out of range for 'H' format code' |
| 119 | + |
| 120 | + |
| 121 | +Windows driver: StartService error |
| 122 | +---------------------------------- |
| 123 | + |
| 124 | +A Windows security feature called HVCI can cause issues running CHIPSEC. HVCI should be disabled. |
| 125 | +Follow the steps described above to disable HVCI. |
| 126 | + |
| 127 | +Follow these steps to disable HVCI: |
| 128 | + |
| 129 | + `How to disable HVCI <https://docs.microsoft.com/en-us/windows/security/threat-protection/device-guard/enable-virtualization-based-protection-of-code-integrity#how-to-turn-off-hvci>`_ |
| 130 | + |
| 131 | + `Full details on HVCI <https://docs.microsoft.com/en-us/windows/security/threat-protection/device-guard/enable-virtualization-based-protection-of-code-integrity>`_ |
| 132 | + |
| 133 | + |
| 134 | +Example error messages: |
| 135 | + |
| 136 | +:: |
| 137 | + |
| 138 | + ERROR: service 'chipsec' didn't start: The parameter is incorrect. (87) |
| 139 | + [-] Traceback (most recent call last): |
| 140 | + File "\chipsec\helper\win\win32helper.py", line 434, in start |
| 141 | + win32serviceutil.StartService( SERVICE_NAME ) |
| 142 | + File "\lib\site-packages\win32\lib\win32serviceutil.py", line 417, in StartService |
| 143 | + win32service.StartService(hs, args) |
| 144 | + pywintypes.error: (87, 'StartService', 'The parameter is incorrect.') |
| 145 | + |
| 146 | + |
| 147 | +And... |
| 148 | + |
| 149 | +:: |
| 150 | + |
| 151 | + chipsec.helper.oshelper.OsHelperError: service 'chipsec' didn't start: The parameter is incorrect. (87) |
| 152 | + |
| 153 | + |
| 154 | + |
| 155 | +Additional details |
| 156 | +------------------ |
| 157 | + |
| 158 | + `Windows Device Guard <https://docs.microsoft.com/en-us/windows/security/threat-protection/device-guard/introduction-to-device-guard-virtualization-based-security-and-windows-defender-application-control>`_ |
| 159 | + |
| 160 | + `Windows Credential Guard <https://docs.microsoft.com/en-us/windows/security/identity-protection/credential-guard/credential-guard>`_ |
| 161 | + |
| 162 | + `WDAC – Windows Defender Application Control <https://docs.microsoft.com/en-us/windows/security/threat-protection/windows-defender-application-control/windows-defender-application-control>`_ |
| 163 | + |
| 164 | + `Hypervisor-Protected Code Integrity (HVCI) <https://docs.microsoft.com/en-us/windows-hardware/drivers/bringup/device-guard-and-credential-guard>`_ |
| 165 | + |
| 166 | + |
0 commit comments