|
| 1 | +## WindowsD - Fixing broken windows (DSE and WinTcb protection levels) |
| 2 | + |
| 3 | +WinD is a 3rd party "jailberak" so administrators can remove some |
| 4 | +mal-features introduced in modern versions windows. Currently, it can disable: |
| 5 | + |
| 6 | +* Driver signing, including WHQL-only locked systems (secureboot tablets). |
| 7 | +* Protected processes (used for DRM, "WinTcb"). |
| 8 | + |
| 9 | +WinD works similiarly to other tools [1] [2] which disable DSE, but is |
| 10 | +designed to be more user friendly - that is, be mostly transparent and |
| 11 | +simply unlock the system, with no need for user to further intervene manually. |
| 12 | + |
| 13 | +It is also designed to be "transparent", that is anything probing for |
| 14 | +"integrity" - typically DRM - will still see the system as locked down, |
| 15 | +even if drivers and processes are accessible to system administrator. |
| 16 | + |
| 17 | +Only accounts with SeLoadDriverPrivilege (admin) can use it. |
| 18 | + |
| 19 | +### Supported windows versions |
| 20 | + |
| 21 | +Windows 7, 8, 8.1 and 10, 32bit and 64bit on Intel CPUs. |
| 22 | +You need to use specific WinD32/64 .exe according to bit-ness of your system. |
| 23 | + |
| 24 | +Vista and server editions *may* work, but are untested. |
| 25 | + |
| 26 | +### Usage |
| 27 | + |
| 28 | +Download Wind32/64 according to bit edition of windows and simply click the |
| 29 | +exe. An installation wizard should start guiding through installation (it |
| 30 | +should be enough to answer y to everything). After that, your system should |
| 31 | +be unlocked and software with unsigned drivers should start working |
| 32 | +normally again. |
| 33 | + |
| 34 | +### Advanced usage |
| 35 | + |
| 36 | +If you don't want to install on-boot loader, but only load particular |
| 37 | +service/driver while bypassing DSE, type: |
| 38 | + |
| 39 | +``` |
| 40 | +> wind64 /l yourdriver.sys |
| 41 | +``` |
| 42 | +\- or - |
| 43 | +``` |
| 44 | +> wind64 /l DriverServiceName |
| 45 | +``` |
| 46 | + |
| 47 | +But if you want your system to ignore signatures as a whole (ie load installed |
| 48 | +drivers at boot), use: |
| 49 | + |
| 50 | +``` |
| 51 | +> wind64 /i |
| 52 | +``` |
| 53 | + |
| 54 | +Which will install it as a service permanently. It is recommended you create |
| 55 | +a system restore point beforehand, in the event something will not go as planned. |
| 56 | + |
| 57 | +In case you want to uninstall the service (and re-lock your system), use: |
| 58 | + |
| 59 | +``` |
| 60 | +> wind64 /u |
| 61 | +``` |
| 62 | + |
| 63 | +### Process protection |
| 64 | + |
| 65 | +Windows has a concept of "protected process" - one which cannot be tampered |
| 66 | +with. Of course this is only a fiat restriction, and we can disable it with: |
| 67 | + |
| 68 | +``` |
| 69 | +> wind64 /d 1234 |
| 70 | +``` |
| 71 | + |
| 72 | +Where 1234 is PID of the process you want to unprotect. Once unprotected, |
| 73 | +a debugger can be attached, hooks can be injected etc. Re-protection is not |
| 74 | +supported from command line at this time, you have to use C API for that. |
| 75 | + |
| 76 | +### Bugs |
| 77 | + |
| 78 | +The tool depends on many undocumented windows internals, as such, may break |
| 79 | +every windows update. Usually, it will simply refuse to load and you'll see |
| 80 | +all restrictions in effect again. There is a small chance it will render system |
| 81 | +unbootable too, so before installing via `wind /i`, USE the system restore. |
| 82 | + |
| 83 | +If you get a BSOD, open an issue with exact version of windows and build number. |
| 84 | + |
| 85 | +### API |
| 86 | + |
| 87 | +There is header-only C API - `wind.h` Usage goes like: |
| 88 | + |
| 89 | +* `handle = wind_open()` - open the control device, NULL handle on error |
| 90 | +* `wind_ioctl(handle,command,buffer,buflen)` - send command(s) |
| 91 | +* `wind_close(handle)` - close the control device |
| 92 | + |
| 93 | +`command` can be one of: |
| 94 | + |
| 95 | +`WIND_IOCTL_INSMOD` - load driver, bypassing DSE. Service entry must already |
| 96 | +exist for the driver. Buffer is UTF16 service registry path, length is size of |
| 97 | +buffer in bytes, including terminating zeros. |
| 98 | + |
| 99 | +`WIND_IOCTL_PROT` - set/unset process protection. buffer points to `wind_prot_t` |
| 100 | +typed buffer. |
| 101 | + |
| 102 | +`buf->pid` - set to pid you want to change protection flags for. |
| 103 | +`buf->prot` - contents of this struct are copied to process protection flags, |
| 104 | +but original protection flags of process will be returned back in the same |
| 105 | +buffer - ie contents will be swapped. |
| 106 | + |
| 107 | +You can re-protect a process after you're done with it, simply by calling the |
| 108 | +ioctl again with same buffer (it holds the original flags) and the `buf->prot` |
| 109 | +will be swapped again. |
| 110 | + |
| 111 | +### Internals |
| 112 | + |
| 113 | +Just like DSEfix and things similiar to it, we simply load a signed driver, |
| 114 | +exploit vulnerability in it to gain access to kernel, and override the |
| 115 | +policy with whatever we want. There are some differences too: |
| 116 | + |
| 117 | +* Custom signed driver 0day is used. |
| 118 | +* 32bit support (Win8+ secureboot). |
| 119 | +* It can actually coexist with vbox, does not depend on VT support in CPU |
| 120 | + and it even triggers if the driver is already present as we try to load it |
| 121 | + under different name. |
| 122 | +* The vulnerable driver is WHQL signed, so it works even on systems restricted |
| 123 | + to WHQL via secureboot env. |
| 124 | +* We automate `reset ci_Options` -> `load unsigned` -> `ci_Options restore` |
| 125 | + PatchGuard dance by hooking services.exe to use our NtLoadDriver wrapper DLL. |
| 126 | + |
0 commit comments