1 00:00:00,000 --> 00:00:01,680 Okay, so hello everyone. 2 00:00:01,680 --> 00:00:02,800 Thank you for joining us today. 3 00:00:02,800 --> 00:00:07,600 Welcome to our talk, Bit Unlocker Leveraging Windows Recovery to Extract BitLocker Secrets. 4 00:00:13,880 --> 00:00:15,220 Can you hear me? 5 00:00:15,400 --> 00:00:16,400 Let's go. 6 00:00:17,240 --> 00:00:20,820 Today we'll take you inside our journey of attacking and securing BitLocker. 7 00:00:20,820 --> 00:00:29,160 We show you how we found and exploited and fixed new vulnerabilities in the Windows recovery environment that allowed extracting all the BitLocker protected secrets. 8 00:00:29,400 --> 00:00:31,960 But just before we dive in, a quick introduction. 9 00:00:32,820 --> 00:00:35,920 So my name is Alon and here with me on stage is Nathaniel. 10 00:00:35,920 --> 00:00:42,240 We're both security researchers working with a security testing and offensive research team at Microsoft, also known as STORM. 11 00:00:42,360 --> 00:00:50,400 Our expertise is in vulnerability research focused on everything that happens before the operating system fully loads, covering the various boot stages and its security features. 12 00:00:50,400 --> 00:00:52,960 So a secure boot, BitLocker and others. 13 00:00:52,980 --> 00:00:55,860 But enough about us and let's dive into our agenda. 14 00:00:57,400 --> 00:01:01,480 So we'll start with the research background and give an overview of BitLocker and WinRE. 15 00:01:01,620 --> 00:01:05,600 Then we'll dive into the vulnerabilities that we discovered, how we exploited them. 16 00:01:05,600 --> 00:01:12,100 And finally we'll wrap up with the research results, the fixes and actionable BitLocker countermeasures that you can apply today. 17 00:01:13,420 --> 00:01:15,680 So starting with the research background. 18 00:01:16,600 --> 00:01:21,400 Today we'll explore a security feature that is designed to protect your sensitive data at rest. 19 00:01:21,400 --> 00:01:30,300 It aims to defend against theft scenarios where an attacker steals your laptop, aiming to extract your sensitive information, compromise your machine and even backdoor it. 20 00:01:30,480 --> 00:01:37,940 You're here at DEF CON surrounded by some of the brightest minds in cyber security and let's be honest, some of the juiciest targets for hackers. 21 00:01:38,900 --> 00:01:44,100 Now picture this, you step away for a quick coffee break and when you come back your laptop is gone. 22 00:01:44,100 --> 00:01:49,360 Stolen by a thief that is after your research, internal tools, credentials and personal data. 23 00:01:50,200 --> 00:02:01,220 Without data at rest protection, the thief can directly access the contents of the hard disk, extract sensitive data and even modify system files to install a backdoor, then even return the computer without detection. 24 00:02:01,920 --> 00:02:09,880 Data at rest protection ensures that even if your laptop is stolen, your data remains encrypted and inaccessible and your system remains untampered. 25 00:02:11,680 --> 00:02:18,720 Now I know what you're thinking, the odds of your device getting stolen are so low that you're probably wondering if you should even bother worrying. 26 00:02:19,020 --> 00:02:20,420 So consider this. 27 00:02:20,860 --> 00:02:24,200 Studies show that the laptop is stolen every 53 seconds. 28 00:02:24,520 --> 00:02:30,640 The odds of a laptop being stolen are 1 in 10 and the average cost of a stolen laptop around $49,000. 29 00:02:31,020 --> 00:02:40,120 This figure reflects replacement costs, productivity loss, legal expenses but most importantly, the loss of sensitive data and intellectual property. 30 00:02:40,360 --> 00:02:49,880 These numbers emphasize the criticality of data at rest protection features and with that, let's dive into our journey of attacking and securing BitLocker which is Windows' data at rest protection feature. 31 00:02:51,220 --> 00:02:57,160 So BitLocker is a full volume encryption technology that is designed to protect individual disk volumes. 32 00:02:57,260 --> 00:03:01,340 Once enabled, it encrypts the target disk volume protecting all data stored in it. 33 00:03:01,600 --> 00:03:13,560 Users have the flexibility to choose which volumes to encrypt based on their specific needs and by default, BitLocker targets the OS volume ensuring that all data stored within the OS environment is protected and encrypted. 34 00:03:13,760 --> 00:03:20,680 So with BitLocker encryption in place, even if your laptop is stolen, the protected data remains unreadable because it's encrypted. 35 00:03:22,860 --> 00:03:34,020 Now the BitLocker threat model assumes an attacker similar to a common thief which means someone with full physical access to the device but without advanced credentials such as user names or passwords. 36 00:03:35,500 --> 00:03:42,100 Not only the BitLocker attack surfaces are shaped by the interfaces accessible to an attacker fitting within this threat model. 37 00:03:42,720 --> 00:03:48,400 And as we examined the different attack surfaces and interfaces, a surface, one surface stood out. 38 00:03:48,400 --> 00:03:54,540 A surface with significant vulnerability potential that surprisingly has received very little attention in period research. 39 00:03:54,840 --> 00:03:58,560 This surface is the Windows recovery environment also known as WinRE. 40 00:03:59,500 --> 00:04:08,620 Any BitLocker attacker can directly boot into WinRE by holding the shift key while selecting restart from logon UI rendering it a potential candidate for deeper inspection. 41 00:04:09,940 --> 00:04:26,740 Given WinRE's fit within the BitLocker threat model , the lack of period research and its high vulnerability potential, we decided to conduct a security review that is dedicated towards finding new vulnerabilities, exploiting them, fixing them and then hardening WinRE while reducing its exposed attack surfaces. 42 00:04:26,840 --> 00:04:32,460 The end goal of our review was to make both WinRE and BitLocker more secure and resilient. 43 00:04:34,040 --> 00:04:42,300 So let's take a closer look at WinRE, what it is, how it functions and which areas present the most promising opportunities for vulnerability research. 44 00:04:44,140 --> 00:04:53,860 So WinRE is Windows' recovery platform and it's designed to address critical system issues such as startup failures, persistent crashes, BitLocker errors and more. 45 00:04:54,280 --> 00:05:03,060 For instance, if your machine crashes, WinRE is the component responsible for analyzing the crash, identifying corruptions and resolving it by using its recovery tools. 46 00:05:03,260 --> 00:05:08,460 Now if you use Windows, the chances are that you have encountered WinRE at least a few times in your lifetime. 47 00:05:10,400 --> 00:05:16,180 Architecturally, WinRE operates with its own standalone operating system known as the recovery OS. 48 00:05:16,400 --> 00:05:21,460 This recovery OS is a lean version of Windows with recovery specific customizations. 49 00:05:23,140 --> 00:05:29,500 These customizations include a unique set of recovery tools that are all integrated to the known blue screen recovery UI. 50 00:05:29,500 --> 00:05:36,140 Among the exposed tools are familiar options such as startup repair, system reset, system restore and others. 51 00:05:37,260 --> 00:05:49,400 For storage, this entire recovery OS including all of the DLLs, executables, drivers, they're all compressed into a single WIM file named WinRE.WIM and this WIM file is then stored on disk. 52 00:05:50,940 --> 00:06:01,140 Then when WinRE boots up, the entire WIM is decompressed from disk into RAM creating a temporary RAM disk that hosts the entire recovery OS run time. 53 00:06:01,340 --> 00:06:10,760 Any changes made within this environment within the RAM disk are not saved back to the original WinRE WIM file making the recovery OS inherently volatile. 54 00:06:11,180 --> 00:06:14,580 So modifications to the RAM disk are discarded upon reboot. 55 00:06:17,140 --> 00:06:22,920 Now when BitLocker was first introduced, WinRE had to evolve to support recovery from BitLocker related failures. 56 00:06:22,920 --> 00:06:27,860 And this led to several architectural and design level changes to enable that recovery functionality. 57 00:06:28,060 --> 00:06:32,220 We wondered what impact these changes had so let's take a closer look at them. 58 00:06:33,640 --> 00:06:37,400 The first design change focused on the location of WinRE WIM. 59 00:06:37,800 --> 00:06:44,480 It was moved from residing in the OS volume which is now encrypted by BitLocker to a dedicated recovery volume which is not encrypted. 60 00:06:44,760 --> 00:06:50,680 This change was necessary because WinRE must be able to recover from BitLocker related failures. 61 00:06:50,680 --> 00:07:00,600 And if the OS volume is encrypted by BitLocker and becomes inaccessible for example because of a decryption failure, storing WinRE in that location would prevent future recovery. 62 00:07:01,440 --> 00:07:10,700 Since WinRE is a critical component that must always be available, it was moved to a separate recovery volume and this ensures that it can function even if the OS volume is not accessible. 63 00:07:11,760 --> 00:07:16,640 The second design change focused on the integrity of the WinRE WIM file itself. 64 00:07:16,640 --> 00:07:21,920 So to support integrity validation of WinRE, a feature called trusted WIM boot was introduced. 65 00:07:22,040 --> 00:07:28,180 It verifies the integrity of WinRE WIM by comparing its hash to a known trusted hash. 66 00:07:28,180 --> 00:07:30,060 So a simple hash comparison here. 67 00:07:30,060 --> 00:07:36,840 If the hashes match, the OS volume is automatically unlocked and if the hashes don't match, the OS remains locked. 68 00:07:38,740 --> 00:07:44,860 Now these two states, auto-unlocked and locked, define the level of access that WinRE has to the main OS. 69 00:07:44,860 --> 00:07:48,020 So in the auto-unlocked state, WinRE has full access to the OS. 70 00:07:48,020 --> 00:07:51,120 It can perform recovery operations without any user intervention. 71 00:07:51,160 --> 00:07:55,480 While in the locked state, WinRE has no access at all to the encrypted OS volume. 72 00:07:56,140 --> 00:08:02,760 Now this change was necessary because WinRE now resides on an unprotected recovery volume and it can no longer be blindly trusted, right? 73 00:08:02,760 --> 00:08:07,020 Because physical users can mount this recovery volume, change WinRE WIM and boot. 74 00:08:07,020 --> 00:08:08,760 And we want to prevent it of course. 75 00:08:08,920 --> 00:08:15,320 So with trusted WIM boot, any unauthorized modification to the WIM file breaks its trust effectively blocking any tampering. 76 00:08:16,900 --> 00:08:22,660 The third design change and the last one focused on limiting recovery tools that are inherently risky to BitLocker. 77 00:08:22,660 --> 00:08:26,720 So for example, among the exposed recovery tools is the command prompt. 78 00:08:27,000 --> 00:08:34,360 To prevent a scenario where an attacker abuses a command prompt to access the BitLocker protected data, a volume re-lock functionality was added into WinRE. 79 00:08:34,540 --> 00:08:40,900 This functionality is triggered every time that a risky recovery tool is selected and it basically re-locks the OS volume. 80 00:08:41,600 --> 00:08:46,420 Then to regain access to the OS, the user must manually insert the BitLocker recovery key. 81 00:08:46,680 --> 00:08:49,340 Otherwise all contents remain completely inaccessible. 82 00:08:51,000 --> 00:08:53,020 So this is how it looks like in practice. 83 00:08:53,020 --> 00:08:57,500 If an attacker launches the command prompt, WinRE WIM is trusted, auto-unlock occurred. 84 00:08:57,500 --> 00:09:04,960 But if it launches the command prompt without inserting the recovery key, access to the BitLocker encrypted volume will be denied resulting in the following lock error. 85 00:09:07,630 --> 00:09:20,550 So to summarize the impact of the design changes, as long as WinRE WIM is trusted and no risky recovery tools are triggered, the OS volume is unlocked allowing WinRE to recover it automatically without user intervention. 86 00:09:20,850 --> 00:09:31,750 In contrast, if WinRE WIM is modified without authorization by a physical attacker for example, or if a risky recovery tool is triggered, the OS volume is re-locked preventing WinRE from accessing it. 87 00:09:32,750 --> 00:09:39,110 So now the critical question arises, any attack surface is exposed because of these design adjustments? 88 00:09:39,810 --> 00:09:50,910 So as it turned out, the auto-unlock state, during the auto-unlock state, WinRE parses files from unprotected volumes, specifically the EFI volume and the recovery volume. 89 00:09:51,230 --> 00:09:57,550 This parsing presents a very interesting attack surface which wasn't valuable to explore before BitLocker's introduction. 90 00:09:58,290 --> 00:10:01,450 Because before BitLocker there was no security boundary here. 91 00:10:01,710 --> 00:10:08,830 So even with full code execution within WinRE and if a physical attacker didn't grab any new capabilities, but this is no longer the case. 92 00:10:08,830 --> 00:10:16,430 With BitLocker, any code execution within WinRE in the auto-unlock state can be utilized to bypass BitLocker and extract all the protected secrets. 93 00:10:16,930 --> 00:10:26,550 So we decided to take a look at this parsing of WinRE during auto-unlock and to see if we can attack the parsers, maybe find memory corruptions or logical vulnerabilities and potentially bypass BitLocker. 94 00:10:27,550 --> 00:10:34,230 So we decided to dig deeper into these files and their parsing and specifically the files that we will be focusing on today. 95 00:10:34,410 --> 00:10:43,570 Or the RA agent XML and boot SDI files residing in the recovery volume and the boot configuration data store, the BCD store, residing in the EFI volume. 96 00:10:44,790 --> 00:10:51,270 So without further ado, I'm going to pass it on to Nathaniel who will walk us through the research process of the parsed external files. 97 00:10:57,060 --> 00:10:58,280 Thank you. 98 00:10:59,980 --> 00:11:02,600 So let's begin with the boot SDI file. 99 00:11:03,500 --> 00:11:10,440 The SDI stands for system deployment image format and it is optionally used for booting from virtual disk into RAM disk. 100 00:11:10,440 --> 00:11:17,480 This format consists of multiple binary blobs with certain blobs being essential for the RAM disk boot process. 101 00:11:18,660 --> 00:11:25,680 Below you can see the layout of RAM disk in memory which contains the OS disk image and more. 102 00:11:25,760 --> 00:11:31,860 When an SDI file is specified, it gets prepended to the virtual disk within the allocated RAM disk memory region. 103 00:11:33,460 --> 00:11:37,160 In our scenario, we are trying to boot Windows recovery from a WIM file. 104 00:11:37,320 --> 00:11:42,320 The boot SDI will contain a WIM blob which contain an offset to the appended trusted WIM. 105 00:11:43,120 --> 00:11:47,840 Additionally, the boot SDI must contain an empty NTFS volume. 106 00:11:49,160 --> 00:11:58,000 This empty volume enables the in-memory WIM to be presented as NTFS volume, ensuring compatibility with other Windows components. 107 00:11:58,860 --> 00:12:01,940 Now let's briefly examine a pseudocode that demonstrates this process. 108 00:12:02,360 --> 00:12:07,740 The code retrieves the sizes of both the SDI and the WIM files, then allocates buffer large enough for both. 109 00:12:08,880 --> 00:12:13,380 Next, the SDI data is copied to the beginning of the RAM disk image buffer. 110 00:12:14,320 --> 00:12:18,440 Then the WIM data is loaded and positioned immediately after the SDI data. 111 00:12:18,660 --> 00:12:22,760 During this process, the loading API computes the WIM hash for validation. 112 00:12:23,360 --> 00:12:28,060 If the hash validation fails, the main OS volume gets re-locked. 113 00:12:29,040 --> 00:12:35,720 Finally, the WIM address is determined by adding the WIM offset stored in the SDI to the RAM disk buffer address. 114 00:12:35,900 --> 00:12:45,020 Notably, there is no verification linking between the WIM being used to the one that was hashed earlier, allowing the offset to be set arbitrarily. 115 00:12:45,200 --> 00:12:47,920 With that in mind, let's dive into our first vulnerability. 116 00:12:49,960 --> 00:12:54,580 We know that WinRE WIM must pass hash validation when loaded immediately after the SDI. 117 00:12:54,760 --> 00:12:58,440 However, the boot SDI itself undergoes no validation whatsoever. 118 00:12:58,620 --> 00:13:08,320 And since we can manipulate the WIM offset to point to an arbitrary location, we could append an untrusted WIM to the SDI and adjust the offset to point to it. 119 00:13:08,480 --> 00:13:13,840 The hash validation for the trusted WIM will succeed, but the untrusted WIM will be executed in its place. 120 00:13:14,060 --> 00:13:19,800 This allows us to load and execute any WIM we choose while keeping the main OS volume still unlocked. 121 00:13:20,100 --> 00:13:22,100 Now let's see a demo for the first vulnerability. 122 00:13:23,800 --> 00:13:26,820 Here is a locked machine which we don't have the password for it. 123 00:13:27,600 --> 00:13:30,960 We press on shift restart to reboot into WinRE. 124 00:13:32,360 --> 00:13:35,900 Once we are in WinRE, we will execute the exploit we prepared beforehand. 125 00:13:35,940 --> 00:13:40,320 Now during boot, the main OS volume gets automatically unlocked by BitLocker. 126 00:13:42,360 --> 00:13:46,600 We reach WinRE UI actions, we select troubleshoot, then we select advanced options. 127 00:13:47,740 --> 00:13:49,100 Then we select command prompt. 128 00:13:49,100 --> 00:13:51,340 Now the main OS volume got relocked. 129 00:13:51,360 --> 00:13:53,820 We don't have the key, so we skip this drive. 130 00:13:55,320 --> 00:13:57,960 Now if we try to access C drive, we can't access it. 131 00:13:57,960 --> 00:13:59,760 It's locked by BitLocker. 132 00:14:00,060 --> 00:14:04,200 If we check the BitLocker status, you can see it is locked. 133 00:14:05,560 --> 00:14:10,420 So we change path to the D drive which is the recovery volume, the unprotected volume. 134 00:14:10,740 --> 00:14:13,400 We execute the exploit we prepared beforehand. 135 00:14:14,260 --> 00:14:19,720 It adds the custom WIM to the boot SDI and then adjusts the offset to it. 136 00:14:20,100 --> 00:14:23,840 And once the exploit completed, reboot the machine back to WinRE. 137 00:14:27,240 --> 00:14:34,140 Now instead of the WinRE UI actions you've seen before, we expect our custom WIM to be loaded and we set it to launch CMD. 138 00:14:34,340 --> 00:14:35,660 So here is the CMD. 139 00:14:35,780 --> 00:14:37,820 We can change path to C drive. 140 00:14:37,840 --> 00:14:42,900 If we check now the BitLocker status, you can see it says unlocked. 141 00:14:43,120 --> 00:14:48,320 And if we list all the files under the C drive, here are the secrets. 142 00:14:56,210 --> 00:14:57,090 Thanks. 143 00:15:04,200 --> 00:15:09,000 After we completed our review for the boot SDI, we shifted our attention to the ARIA agent XML. 144 00:15:10,920 --> 00:15:16,780 The ARIA agent XML file contains the current recovery state and other configuration settings for WinRE. 145 00:15:16,780 --> 00:15:21,720 Upon WinRE startup, it immediately consumes and parses this XML file. 146 00:15:22,700 --> 00:15:31,120 When WinRE state is configured to execute a scheduled operation, it will run the designated recovery operation such as startup repair or other tasks. 147 00:15:31,280 --> 00:15:35,060 All of this occurs prior to reaching the UI actions you've seen before. 148 00:15:35,820 --> 00:15:43,600 Today, we will talk about two scheduled recovery operations that can get arbitrarily executed by modifying the state in ARIA agent XML. 149 00:15:43,600 --> 00:15:46,280 First offline scanning and then WinRE applications. 150 00:15:47,200 --> 00:15:49,640 Starting with offline scanning operation. 151 00:15:50,080 --> 00:15:56,820 These operations allow AV run, allow running AV scan from within WinRE against the main OS. 152 00:15:56,980 --> 00:16:00,620 It is mainly used against malware that does not run inside WinRE. 153 00:16:02,620 --> 00:16:08,260 We found we can control which app performs the scanning, though there are a couple of limitations. 154 00:16:08,420 --> 00:16:14,820 First, the offline scanning is performed only by executing applications from within the main OS volume. 155 00:16:15,520 --> 00:16:19,880 Second, this application must be digitally signed by Microsoft or WHQL. 156 00:16:20,520 --> 00:16:24,540 Third, the signatures must be embedded within the binary itself. 157 00:16:26,580 --> 00:16:32,260 We search for all different applications that satisfy these requirements and we discover approximately 30. 158 00:16:32,320 --> 00:16:34,280 No CMD is not among them. 159 00:16:34,440 --> 00:16:39,000 And we could not execute all the applications on that list mainly due to compatibility reasons. 160 00:16:43,860 --> 00:16:47,840 We reviewed them one by one until we got to an application named TT Tracer. 161 00:16:48,320 --> 00:16:55,160 This application is a time travel debugger utility that allows tracing and arbitrary executable. 162 00:16:55,540 --> 00:17:00,820 Okay, so if we can trace any binary we want, let's trace CMD then, right? 163 00:17:03,640 --> 00:17:05,800 Now let's go over the complete flow. 164 00:17:06,920 --> 00:17:12,840 Before starting the machine, we set the recovery state in our agent XML to schedule offline scanning operation. 165 00:17:12,880 --> 00:17:15,320 The XML is then parsed by WinRE. 166 00:17:19,410 --> 00:17:24,690 Then according to the state we just set, WinRE performs the scheduled operation, which is offline scanning. 167 00:17:25,650 --> 00:17:29,270 It will execute TT Tracer, which will trace any binary we set. 168 00:17:29,750 --> 00:17:33,470 We specified CMD, so in our case it will launch and trace CMD. 169 00:17:34,570 --> 00:17:39,910 And at this point, while still in auto unlock state, we have a full shell access with the main OS volume unencrypted. 170 00:17:41,110 --> 00:17:42,990 Now let's see a demo for the second vulnerability. 171 00:17:45,270 --> 00:17:47,830 Again, here's a locked machine which we don't have the password. 172 00:17:48,250 --> 00:17:50,410 We shift restart again to reboot to WinRE. 173 00:17:50,410 --> 00:17:52,950 We will execute an exploit we prepared beforehand. 174 00:18:00,020 --> 00:18:06,080 Now once we reach WinRE, we select troubleshoot, then advanced options, then command prompt. 175 00:18:08,240 --> 00:18:10,720 It prompts to ask for the BitLocker key. 176 00:18:10,720 --> 00:18:12,380 We don't have it, so we skip this drive. 177 00:18:15,940 --> 00:18:20,620 Again, if we check the, if we try to access C drive, you can see it says locked by BitLocker. 178 00:18:23,120 --> 00:18:26,400 If we check the BitLocker status again, it will say it's locked. 179 00:18:29,770 --> 00:18:33,530 Now we change path to the D drive, which is the recovery volume, unprotected volume. 180 00:18:33,530 --> 00:18:35,890 We execute the exploit we prepared beforehand. 181 00:18:35,890 --> 00:18:40,070 It sets TT Tracer to the scheduled offline operation. 182 00:18:40,730 --> 00:18:44,990 And once the exploit completed, we just reboot the machine back to WinRE. 183 00:18:45,250 --> 00:18:47,910 Remember, this is the recovery volume unprotected volume. 184 00:18:47,910 --> 00:18:49,450 We can do anything we want in it. 185 00:18:49,970 --> 00:18:54,850 Now instead of UI actions, we expect an application to spawn. 186 00:18:55,130 --> 00:18:56,530 So here is TT Tracer. 187 00:18:57,570 --> 00:18:59,450 And it asks us to accept the ULA. 188 00:18:59,450 --> 00:19:00,450 We accept it. 189 00:19:01,510 --> 00:19:03,790 And CMD is launching, as you can see. 190 00:19:03,790 --> 00:19:05,670 Now we can change path to C drive. 191 00:19:06,950 --> 00:19:12,070 And if we check the BitLocker status, you can see it says protection on and unlocked. 192 00:19:12,630 --> 00:19:16,510 If we list the files under the C drive, we can see again the secrets. 193 00:19:16,510 --> 00:19:17,230 There are. 194 00:19:26,320 --> 00:19:29,400 Okay, so we completely go and offer the offline scanning. 195 00:19:29,560 --> 00:19:31,560 Let's proceed with WinRE applications. 196 00:19:33,680 --> 00:19:40,320 Another scheduled operation we can configure is WinRE apps, which allows us to run applications within WinRE. 197 00:19:40,340 --> 00:19:46,020 If these applications are trusted, they get executed while the system remains in auto unlock state. 198 00:19:46,020 --> 00:19:50,240 Otherwise, they run after the main OS volume has been re-locked. 199 00:19:51,760 --> 00:20:02,400 We went looking for the hash validation process, and we found that trusted applications are registered within the WinRE registry using their executable name and the file hash. 200 00:20:02,560 --> 00:20:07,680 The registry resides within the WIM file, and a physical attacker cannot modify it. 201 00:20:07,680 --> 00:20:15,940 Any alterations to the WIM would change its hash, causing the main OS volume to be re-locked during the boot hash validation. 202 00:20:18,380 --> 00:20:26,780 Now when WinRE is scheduled to run a trusted application, it first calculates the hash of the target application, then searches for a match in the registry. 203 00:20:26,940 --> 00:20:29,000 If a match is found, the application is marked as trusted. 204 00:20:29,000 --> 00:20:32,460 If no match exists, the application is marked as untrusted. 205 00:20:32,520 --> 00:20:38,440 The main OS volume gets re-locked, and then later the application still gets executed, but with the main OS locked. 206 00:20:40,240 --> 00:20:45,940 So overall, that sound as WinRE trusted apps validation is solid and works properly, right? 207 00:20:46,220 --> 00:20:53,260 Well, we wondered if an already registered application can expose an attack surface, so we went hunting for registered applications. 208 00:20:55,600 --> 00:21:01,140 We found a legitimate usage of this feature by a program named setup platform. 209 00:21:01,240 --> 00:21:08,380 This program is, this application is registered as trusted app and used during Windows upgrade. 210 00:21:08,820 --> 00:21:14,380 Only once the upgrade completes, the trusted app entry remains in the registry, and it is not removed. 211 00:21:15,680 --> 00:21:19,840 So we can execute setup platform, but what else can we do with it? 212 00:21:21,140 --> 00:21:25,320 We found that it registered shift plus F10 hotkey to launch CMD. 213 00:21:26,000 --> 00:21:27,340 Convenient, right? 214 00:21:28,620 --> 00:21:34,940 Well, we tried that, but it fails to execute due to missing configuration file on the main OS volume. 215 00:21:35,140 --> 00:21:41,120 Since this configuration file resides on the bit locker protected main OS volume, it cannot be created or edited. 216 00:21:42,400 --> 00:21:49,620 This configuration requirement caused setup platform to terminate early due to this file being absent. 217 00:21:51,240 --> 00:21:56,120 Now, the time window between the hotkey registration and the process exit is very short. 218 00:21:56,120 --> 00:21:59,640 It's quite impossible to trigger this hotkey manually. 219 00:22:00,180 --> 00:22:03,360 So we wanted to find another way to trigger CMD. 220 00:22:03,760 --> 00:22:06,240 We went back to analyze setup platform. 221 00:22:08,220 --> 00:22:10,700 That is when we discovered something really interesting. 222 00:22:10,960 --> 00:22:21,240 Immediately after registering the CMD hotkey, the application searches for a file named setup platform INI on the recovery volume, which is the unprotected volume. 223 00:22:22,120 --> 00:22:24,680 And we can fully control it. 224 00:22:25,080 --> 00:22:33,560 Now, by configuring this file properly, setup platform will trigger a message box, which prevents applications from continuing the execution. 225 00:22:33,560 --> 00:22:37,380 Essentially, blocking the application from early termination. 226 00:22:37,620 --> 00:22:43,280 That will open an infinite time window to spawn CMD and type any thing we want in it. 227 00:22:46,120 --> 00:22:49,560 Now, let's see the complete flow. 228 00:22:49,860 --> 00:22:53,360 We modify the XML and set the state for scheduled and trusted app. 229 00:22:53,360 --> 00:22:56,260 More specifically, we set setup platform to get executed. 230 00:22:57,420 --> 00:22:59,640 We validate this app can be trusted. 231 00:22:59,640 --> 00:23:03,400 The validation succeeds and the main OS volume remains unlocked. 232 00:23:05,000 --> 00:23:07,080 Next, setup platform gets executed. 233 00:23:08,080 --> 00:23:12,720 It registers the hotkey for CMD, which is shift plus F10. 234 00:23:13,760 --> 00:23:20,220 It then looks for setup platform INI file and loads it, which will trigger a message box. 235 00:23:20,420 --> 00:23:24,460 This way, the process got blocked and won't continue until we press okay. 236 00:23:25,440 --> 00:23:29,820 Now, we can simply press on shift plus F10 to trigger the CMD. 237 00:23:35,890 --> 00:23:39,710 And we got a shell up and running while the main OS volume is still unlocked. 238 00:23:40,390 --> 00:23:42,270 Now, let's see a demo for deferred vulnerability. 239 00:23:44,150 --> 00:23:45,550 So, again, here's a locked machine. 240 00:23:45,550 --> 00:23:46,430 We don't have the password. 241 00:23:46,430 --> 00:23:49,150 We shift restart to reboot into WinRE. 242 00:23:55,850 --> 00:23:59,530 In the action, select troubleshoot, advanced options, command prompt. 243 00:24:00,790 --> 00:24:02,850 We don't have the key, so we skip this drive. 244 00:24:04,790 --> 00:24:06,990 Now, we will try to access again the C drive. 245 00:24:06,990 --> 00:24:08,250 You can see it says locked. 246 00:24:09,110 --> 00:24:11,130 We'll check BitLocker status again. 247 00:24:11,790 --> 00:24:12,470 It says locked. 248 00:24:12,470 --> 00:24:13,630 Protection is on. 249 00:24:16,620 --> 00:24:20,280 Now, we change back to the D drive, the unprotected volume. 250 00:24:20,280 --> 00:24:22,660 We execute the exploit we prepared beforehand. 251 00:24:22,660 --> 00:24:24,540 We set a platform to get executed. 252 00:24:24,700 --> 00:24:27,280 We write down the setup platform INI file. 253 00:24:27,420 --> 00:24:28,820 And next, we reboot the machine. 254 00:24:28,820 --> 00:24:33,660 Now, instead of DUI actions this time, we expect our setup platform to get executed. 255 00:24:33,660 --> 00:24:35,040 And we set setup platform INI. 256 00:24:35,040 --> 00:24:36,940 So, we expect a message box. 257 00:24:39,160 --> 00:24:40,880 And here's the message box. 258 00:24:40,880 --> 00:24:44,740 Now, we can simply press on shift F10, we spawn the CMD. 259 00:24:44,840 --> 00:24:48,500 If we change path to C, we can change it. 260 00:24:49,100 --> 00:24:52,120 If we check the BitLocker status, it says protection on. 261 00:24:52,360 --> 00:24:55,800 And the BitLocker status is still unlocked. 262 00:24:57,440 --> 00:25:01,620 Now, we can just list the files under the G drive, get the secrets. 263 00:25:01,700 --> 00:25:02,640 Here it is. 264 00:25:10,640 --> 00:25:20,500 Now, we'll continue to talk about the BCD. 265 00:25:20,560 --> 00:25:23,780 So, let's move on to attacking the BCD parsing. 266 00:25:25,240 --> 00:25:31,600 So, first things first, for those of you who are unfamiliar with BCD and what it stands for, BCD stands for Boot Configuration Data. 267 00:25:31,720 --> 00:25:34,360 And it's basically the file that defines how Windows boots. 268 00:25:34,720 --> 00:25:40,120 It stores the boot entries, controls the boot parameters, recovery settings, and many more boot related configurations. 269 00:25:42,660 --> 00:25:47,000 Now, in the context of WinRE, the usage of BCD is considerably minimal. 270 00:25:47,220 --> 00:25:55,460 WinRE uses the BCD mainly to determine the location of the target OS volume on the disk so that WinRE knows which volume to end the recovery operations to, right? 271 00:25:55,460 --> 00:26:00,460 Because we have multiple volumes on the disk, WinRE must know which volume is the OS volume to recover. 272 00:26:00,600 --> 00:26:09,400 So, when WinRE starts, it reads the BCD store, queries the target OS volume location from that store, and then ends the recovery operations to this volume. 273 00:26:10,980 --> 00:26:18,260 So, the first question that came into our minds when we investigated WinRE BCD usage is what can we potentially gain from targeting it? 274 00:26:19,000 --> 00:26:25,140 As it turned out, WinRE places full trust in the target OS, assuming it's out of attacker's reach. 275 00:26:25,620 --> 00:26:34,200 Now, generally speaking, this assumption is solid from a design perspective because with BitLocker enabled, the target OS is encrypted and the attacker has no access whatsoever. 276 00:26:34,220 --> 00:26:42,660 So, it's safe to store the configurations, query these configurations, and not further validate them because again, a physical attacker can't change anything in the main OS. 277 00:26:42,660 --> 00:26:43,680 It's encrypted. 278 00:26:44,280 --> 00:26:52,380 Having said that, since the target OS location is defined in the BCD, which we could modify, we began to question this trust assumption. 279 00:26:53,020 --> 00:26:56,260 Could BCD manipulations allow us to undermine it? 280 00:26:57,960 --> 00:27:05,700 So, what if we could trick WinRE into thinking that an attacker controlled volume is actually the trusted BitLocker encrypted one? 281 00:27:06,000 --> 00:27:12,000 Our focus has shifted towards identifying a primitive that allows impersonating the target OS location. 282 00:27:12,140 --> 00:27:20,560 The goal is to manipulate the target OS volume to point to an attacker volume, such as the recovery volume, instead of pointing to the trusted BitLocker encrypted one. 283 00:27:21,620 --> 00:27:31,260 So, any time that WinRE then, if we gain this primitive, if WinRE queries configuration assuming it's out of attacker's reach, the attacker can modify it because it will be in the recovery volume and not in the encrypted volume. 284 00:27:31,260 --> 00:27:34,480 So, this primitive if gained would break the trust assumption. 285 00:27:36,580 --> 00:27:42,880 So, we already know that the target OS location is controlled in the BCD, as we just mentioned, which we can directly modify. 286 00:27:42,880 --> 00:27:46,600 So, what happens if we change the location directly in the BCD? 287 00:27:47,460 --> 00:27:50,400 Well, theoretically it's possible, but it isn't valuable. 288 00:27:50,440 --> 00:27:51,580 Let me explain. 289 00:27:52,060 --> 00:28:01,500 The target OS location isn't used only by WinRE, but also by the boot manager which uses it to know which volume it should auto unlock for WinRE so that WinRE is able to access the OS. 290 00:28:01,820 --> 00:28:06,800 So, any change to the BCD store would affect both the boot phase and the OS phase. 291 00:28:07,060 --> 00:28:16,000 In this specific scenario, if we modify the target OS to point to the recovery volume, it would prevent the boot manager from auto unlocking the BitLocker encrypted OS volume. 292 00:28:16,000 --> 00:28:19,180 And this encrypted volume contains the secrets that we are after. 293 00:28:20,040 --> 00:28:26,480 So, in this state, even it breaks the trust assumption, but even with full code execution within WinRE, we are not able to access the secrets. 294 00:28:26,480 --> 00:28:27,860 And that's why it's not valuable. 295 00:28:28,320 --> 00:28:31,980 Our primitive must not interfere with the boot procedure and the auto unlock functionality. 296 00:28:31,980 --> 00:28:33,420 We must go deeper. 297 00:28:35,060 --> 00:28:38,900 So, we decided to dig deeper into the way that WinRE searches for the BCD store. 298 00:28:38,900 --> 00:28:44,180 Any potential flaws at this stage would not interfere with the auto unlock functionality because it executes afterwards. 299 00:28:45,060 --> 00:28:50,480 So, to locate the BCD store, WinRE iterates over these volumes and searches each one for the store. 300 00:28:50,480 --> 00:28:54,680 The first store that is found is the one used to further calculate the target OS location. 301 00:28:54,720 --> 00:28:57,040 So, a simple volume iteration logic. 302 00:28:57,820 --> 00:29:05,380 Now, this iteration logic is actually an interesting point to further inspect because if you think about it, only the EFI volume contained the BCD store. 303 00:29:05,380 --> 00:29:12,640 So, any attempt to locate the store on other volumes, especially if they are not protected, could potentially be abused. 304 00:29:14,440 --> 00:29:19,480 Internally, the functions that are used to iterate over the volumes are find first volume and find next volume. 305 00:29:19,480 --> 00:29:26,020 These are two standard Windows APIs and notably, the remark section highlights a very interesting point. 306 00:29:26,020 --> 00:29:34,000 It says that one should not assume any correlation between the order of the volumes that are returned by these functions and the order of the volumes that are on the computer. 307 00:29:34,260 --> 00:29:40,620 So, under the hood, these two functions perform further filtering and sorting which causes an inconsistency in the returned volume order. 308 00:29:41,700 --> 00:29:46,880 So, for example, on the monitor, you can see the typical volume order returned by the disk part list command. 309 00:29:47,380 --> 00:29:51,520 The order is first the OS, then EFI and only then the recovery volume. 310 00:29:53,340 --> 00:29:57,260 However, the volume iteration functions would return a different order. 311 00:29:57,380 --> 00:30:01,880 It would return first the OS volume, then the recovery and only then the EFI volume. 312 00:30:02,000 --> 00:30:03,740 Can you spot the inconsistency? 313 00:30:04,760 --> 00:30:11,400 With this iteration logic, the recovery volume is iterated over and checked for a BCD store before the EFI volume. 314 00:30:12,600 --> 00:30:20,220 By placing a custom attacker control store in the recovery volume, we can trick WinRAR into using it instead of using the EFI BCD store. 315 00:30:20,300 --> 00:30:26,740 So, with this setup, WinRAR doesn't even reach the point of querying the EFI volume which contains the real store used to boot the machine. 316 00:30:26,840 --> 00:30:33,220 So, any modification or corruption we make to that custom store will only impact WinRAR and will not disrupt the boot procedure at all. 317 00:30:34,740 --> 00:30:37,560 This flow allows us to achieve the desired primitive. 318 00:30:37,560 --> 00:30:44,180 During the boot phase, the boot manager locates and uses the legitimate store from the EFI volume to unlock the encrypted OS. 319 00:30:44,200 --> 00:30:45,860 And this OS contains the secrets. 320 00:30:45,860 --> 00:30:47,740 So, during the boot, it's unlocked. 321 00:30:47,920 --> 00:30:55,460 However, during the OS phase, WinRAR instead locates and uses the attacker control BCD store due to the iteration logic that we just explored. 322 00:30:55,620 --> 00:31:01,680 And it uses this attacker store, leading it to consider an attacker volume as the BitLocker encrypted one. 323 00:31:01,680 --> 00:31:01,960 Right? 324 00:31:01,960 --> 00:31:10,840 Because once we control the store, instead of pointing the volume location to the main OS volume, the encrypted one, we just point it to a different volume that we control. 325 00:31:12,340 --> 00:31:22,040 So, with this primitive, any configuration that WinRAR retrieves from the target OS, previously assumed to be beyond an attacker's reach, is now entirely under the attacker's control. 326 00:31:22,160 --> 00:31:27,420 So, any sensitive configuration it queries, which we weren't be able to modify, now we're able to modify. 327 00:31:29,140 --> 00:31:35,720 To further exploit this powerful primitive for bypassing BitLocker, we need to find a WinRAR flow with three characteristics. 328 00:31:35,900 --> 00:31:43,300 First, a flow that can be triggered either from the WinRAR UI or from RE-agent XML schedule operations , so that we're able to trigger this flow freely. 329 00:31:43,800 --> 00:31:48,280 Second, a flow that doesn't trigger the wheel of functionality so that we won't lose access to the secrets. 330 00:31:48,280 --> 00:31:54,000 Because we don't want a flow that when we trigger it, relocks the volumes and we lose access to the secrets. 331 00:31:54,300 --> 00:32:00,240 Third characteristic is a flow that queries configuration from the target OS to perform sensitive operations. 332 00:32:00,240 --> 00:32:02,440 And this is actually the interesting part here. 333 00:32:02,440 --> 00:32:08,900 The idea is to chain this flow with the gained impersonation primitive to trigger sensitive operations in the auto-unlock state. 334 00:32:08,900 --> 00:32:11,760 Such operations that we wouldn't be able to trigger beforehand. 335 00:32:13,640 --> 00:32:17,860 So, after exploring different WinRAR behaviors, we found a potential candidate. 336 00:32:17,940 --> 00:32:21,240 This is the push button reset feature, also known as PBR. 337 00:32:21,960 --> 00:32:26,080 PBR is Windows assistant reset tool and it provides various reset functionalities. 338 00:32:27,640 --> 00:32:35,240 It supports multiple trigger modes with one of its modes known as online PBR meeting the characteristics that we defined for the exploit. 339 00:32:35,440 --> 00:32:40,820 So, first, only PBR can be triggered freely as a scheduled operation in RE-agent XML. 340 00:32:41,060 --> 00:32:45,700 Second, this flow doesn't trigger the wheel of functionality thereby benefiting auto-unlock. 341 00:32:45,700 --> 00:32:47,460 We won't lose access to the secrets. 342 00:32:47,460 --> 00:32:54,880 And third, it queries configuration from the target OS to perform sensitive operations, thereby can be controlled with the impersonation primitive. 343 00:32:56,320 --> 00:33:05,280 Specifically, the sensitive configuration that we identified was an XML file named reset session dot XML which defines all the operations executed by PBR. 344 00:33:05,680 --> 00:33:13,000 Notably, it included the decrypt volume directive which instructs PBR to decrypt any arbitrary BitLocker encrypted volume. 345 00:33:15,140 --> 00:33:21,380 So we now have all the pieces that are required for the full BitLocker bypass exploit chain. 346 00:33:21,840 --> 00:33:24,460 The exploit required modifying a few files on the recovery volume. 347 00:33:24,460 --> 00:33:27,900 So first, the XML file with online PBR scheduled operation. 348 00:33:27,960 --> 00:33:33,220 Second, the BCD store with the OS device element pointing to the recovery volume instead of the encrypted OS. 349 00:33:33,220 --> 00:33:41,480 And third, the PBR configuration with the decrypt volume directive specifying the target OS volume to decrypt as the OS volume, the encrypted one. 350 00:33:42,620 --> 00:33:48,720 With this setup, what will happen is that in the next WinRAR reboot, WinRAR will go through the online PBR flow. 351 00:33:48,800 --> 00:33:55,960 During the BCD store look up, PBR locates the attacker BCD store and mistakenly identifies its target volume as a recovery volume. 352 00:33:57,200 --> 00:34:03,880 Then PBR loads its configuration from that recovery volume which instructs it to decrypt the BitLocker encrypted OS volume. 353 00:34:03,880 --> 00:34:11,400 Once this entire process completes, BitLocker secrets become freely accessible as BitLocker was essentially disabled by PBR. 354 00:34:11,520 --> 00:34:19,000 So we went from a considerably scoped OS impersonation primitive to an arbitrary BitLocker decryption primitive . 355 00:34:20,140 --> 00:34:25,280 With that, let's see the demo, the last demo of the day of the full exploitation chain . 356 00:34:27,120 --> 00:34:30,840 So we have here a locked machine which we don't have the password to this machine. 357 00:34:30,840 --> 00:34:35,940 So we select shift and restart into WinRE in order to execute the exploit. 358 00:34:39,230 --> 00:34:44,230 Inside WinRE, we select troubleshoot advanced options and then command prompt. 359 00:34:44,890 --> 00:34:46,770 Here the recovery key is requested. 360 00:34:46,790 --> 00:34:47,630 We don't have this key. 361 00:34:47,630 --> 00:34:48,670 We skip this drive. 362 00:34:48,670 --> 00:34:53,050 Now you will see that we don't have access to the C drive that contains all the BitLocker secrets. 363 00:34:55,430 --> 00:34:58,670 So now what we need to do is to change drive to the D drive. 364 00:34:58,670 --> 00:35:00,790 That's the mounted recovery volume which we control. 365 00:35:00,790 --> 00:35:03,230 We placed our exploit in that volume. 366 00:35:03,830 --> 00:35:05,550 So we now execute this exploit. 367 00:35:07,710 --> 00:35:11,090 And once the exploit finishes, we will reboot into WinRE. 368 00:35:12,230 --> 00:35:16,250 Now you will see during the reboot that PBR gets executed. 369 00:35:16,290 --> 00:35:18,010 This process takes a few minutes. 370 00:35:18,810 --> 00:35:21,870 This is what you will see now on the screen so we fast forward a bit . 371 00:35:21,890 --> 00:35:23,790 In the meantime, let me tell you what the exploit did. 372 00:35:23,790 --> 00:35:27,910 So it placed this XML file with online PBR and the recovery volume. 373 00:35:28,470 --> 00:35:34,970 It then created the BCD store on that recovery volume as well so that the iteration logic considered this store. 374 00:35:35,170 --> 00:35:40,110 And the volume, the target volume on that BCD store pointed to the recovery volume instead of the encrypted volume. 375 00:35:40,110 --> 00:35:45,390 So now when PBR looks for its configuration, it queries it from the recovery volume instead of from the encrypted volume. 376 00:35:45,390 --> 00:35:50,690 This configuration tells PBR to decrypt the OS volume that we are after its secrets. 377 00:35:50,750 --> 00:35:56,790 So what happens now under the hood, what you see on the screen is actually PBR decrypting the OS volume. 378 00:35:56,810 --> 00:35:59,450 Essentially disabling BeatLocker on that volume. 379 00:36:00,070 --> 00:36:05,830 So once PBR completes, we'll go back into the main OS. 380 00:36:07,610 --> 00:36:10,150 You see now the logon screen. 381 00:36:12,650 --> 00:36:17,430 And of course we still don't have the password right so we'll restart into WinRE. 382 00:36:17,790 --> 00:36:21,750 And once we're in WinRE, we'll check what is the current status of BeatLocker. 383 00:36:24,190 --> 00:36:27,410 So select troubleshoot, advanced options, command prompt. 384 00:36:27,410 --> 00:36:30,350 At this point you will see that the recovery key is not requested. 385 00:36:30,450 --> 00:36:32,190 We change drive to the C drive. 386 00:36:32,550 --> 00:36:38,190 List the files and you can see that we have full access to the C drive that contains all of the secrets. 387 00:36:38,190 --> 00:36:46,270 Now if you wonder why this is possible, if we check the status of BeatLocker, you will see that the protection is off and the drive is fully decrypted. 388 00:36:46,270 --> 00:36:50,630 So we bypass BeatLocker by disabling it, able to extract all of the secrets. 389 00:36:53,950 --> 00:36:55,290 Thank you. 390 00:36:58,000 --> 00:37:00,000 So closing remarks. 391 00:37:00,580 --> 00:37:02,200 Starting with the vulnerability fixes. 392 00:37:02,200 --> 00:37:06,880 So all the discovered vulnerabilities and exploitation techniques were fixed in July's Pitch Tuesday. 393 00:37:07,040 --> 00:37:10,960 The CVs for the vulnerabilities that we presented today are displayed on the screen. 394 00:37:12,660 --> 00:37:18,520 To further enhance the security of BeatLocker, we recommend enabling TPM plus PIN for pre-boot authentication. 395 00:37:18,560 --> 00:37:24,200 This significantly reduces the attack surfaces and limiting the services only to the TPM. 396 00:37:24,200 --> 00:37:32,780 So if TPM plus PIN is already enabled in your machine, you are protected from BeatLocker bypasses that originate from WinRE, the boot components, logon screen and other attack surfaces. 397 00:37:33,120 --> 00:37:35,980 Because to get the BeatLocker key, you have to insert a PIN . 398 00:37:36,540 --> 00:37:41,460 So to mitigate BeatLocker downgrade attacks, we advise enabling the revised mitigation. 399 00:37:41,540 --> 00:37:49,780 This mechanism enforces secure versioning across critical boot components, preventing downgrades that could reintroduce known vulnerabilities in BeatLocker and secure boot. 400 00:37:50,180 --> 00:37:54,100 For the full article on BeatLocker countermeasures, please scan the QR code on the screen. 401 00:37:56,000 --> 00:37:58,720 Lastly, we want to emphasize that our journey never ends. 402 00:37:58,720 --> 00:38:05,660 We continue to proactively research BeatLocker, WinRE and the related components with a never ending goal of increasing their security and resiliency. 403 00:38:07,840 --> 00:38:13,000 It was a pleasure for us to share with you our research project and the security work that we do on WinRE and BeatLocker. 404 00:38:13,020 --> 00:38:17,600 If you have any questions, please catch us in the hallway and also feel free to reach out on social media. 405 00:38:18,220 --> 00:38:22,520 And with that, we would like to thank you all for joining us today and we wish you a great rest of your day. 406 00:38:23,240 --> 00:38:24,060 Thank you.