It is my absolute pleasure to introduce these two first time DEF CON speakers, Alejandro and Boya. The title of their talk is Kill Chain Reloaded, Abusing Legacy Pass for Stealth Persistence. With that, take it away, guys. Hello, everyone. First of all, thank you for inviting us to DEF CON. It's an honor for us to be here. Our English is not perfect, but we will try to explain everything as clear as possible. We ask for your patience and please don't be too hard with us. This is my colleague, Alejandro Hernando. We both work in the hacking department at Accenture Spain in red team and research. We love breaking things and finding more abilities. Here is your social media just in case you want to contact us or ask anything about this talk. I am Borja Martinez. I also work in the hacking department at Accenture Spain. Sometimes I participate in Capture the Flag competition as a member of the team. But now we are retired. Here is my social network for any questions or doubts you may have after the presentation. Okay. In this part we will focus on how we do threat hunting to find vulnerable artifacts. Our methodology to look for these drivers. Specific software and drivers we use in our research. Vulnerabilities we found in UFI software to develop advanced boot kits and new persistent techniques. Finally how we use these vulnerable drivers to get persistent in real red team exercises. Okay. Before we go deeper we're going to explain why I think this topic is especially important today. In recent years we have seen that threats which look almost theoretical are now completely real. Boot kits like Black Lotus for example have managed to run malware on Windows 11 system with secure boot enabled. So system with all security enabled can still be fully compromised. And we are not talking about all APTS from 10 years ago. That is the reality we find when researching low level security. One common mistake is to think that if you have secure boot enabled you are protected. But it isn't that simple. Secure boot works with a list of trusted binaries and another list called DBX for revoked binaries. If a vulnerable binary is in the DBX secure boot will allow it anyway even if it's compromised. Also many vendors don't update that quickly. There are cases where it takes months to revoke binaries with critical vulnerabilities like Black Lotus. But not everything is caught by attackers. Sometimes there are failures from inside. In July 2024 a crash type update broke computers all over the world. The faulty agents could abuse this especially in corporate environment as airport, banks, hospital or were affected. And this was without malware, without exploit, only about binary running a critical part of the system. We mention this because boot kits won the single level of control but with a malicious and persistent goal. It's a good example of how one single binary can break everything. Here is a quick table with some of the most well known boot kits used in real operations. Many link to APTS. Most of them load before the operating system so no EDR, antivirus or side channel solution can see them. They control the system from the moment you turn it on. Okay. We have been researching all this for a long time. We want persistent, we have used vulnerable software, signed files in trusting drivers. And change everything to execution and total control. We will show how we did threat hunting for signed artifacts that lets us do this in real scenarios. You will see how we use virus total, retro hunt and the Microsoft catalog to find components with useful functions. Physical memory access, can I rewrite and so on. We will also explain how we exploit these pieces to inject code into UFI, manipulate the whole process and keep persistent without leaving traces. And the most important thing is how to use all this in real extreme exercises without raising alert. Okay. Demo time. Okay. Here you can see someone can link to a virus total enterprise account. In virus total we do two main things. Search basic things or use the other rules with retro hunt. For retro hunt as you can see our script uses pin port to select interesting functions. On the right you see all the drivers we use as a black list to avoid drivers that already work or known to be vulnerable. We do a quick demo run, as you can see it finds many drivers with those functions very fast. That's running and before we had already launched two more. One with 4,000 results and another with 10,000 results. On the other hand we sometimes search for things like WPBH which Alejandro will explain later. We attach for example to only see same binaries. And I will say it's by looking for certificates like Microsoft Windows UFI driver, publisher or Microsoft corporation UFI CR2011. There are more options but these are a few examples so I don't understand how we search for useful binaries. The demo is ‑‑ okay. Here for example you see 64 AFI and it's all the binary sign. Okay. Also based on research from GitHub project we made this script. The script inquires to a Microsoft catalog like we have done before with retro hunt. Searching for driver with interesting function. Now we run this script. It searches all the pages and when it finds a string like go away. Spoiler. It downloads all the files. So this is the first demo showing you how we found some drivers and EFI files which we will later use in our research. With the next demo you will see more clearly how we use these files. Okay. Before going to the technical part I'll give some context about what UFI is, what a loader is and why these are so important for our research. When we turn on a computer the first thing that runs is not Windows, not ADR, not antivirus. The firmware runs first. UFI. UFI is like a operating system without memory, heap, services and drivers. It has many phases but the most interesting for us is DXE where EFI modules are loaded. After initial UFI runs the loader which loads the system kernel. In Windows it's usually booting GFWUFI or booting GREFI. In Linux it can be grab, sim or something custom. And here is the key point. Everything that's happened before ExitBoot services it's outside the radar of formal security solutions. If we can put a signed EFI in loading path we can interbind, redirect, persist or exploit the boot before the OS can defend itself. And now I give the floor to my colleague Alejandro who will explain this part in more detail. Okay, just a second. All right. As we discussed before you can't just run an EFI binary on the system. We must consider the security mechanisms that Windows implement to block the execution in the preboot environment. Secureboot aims to block the execution of an authorized code from running in the preboot environment. It does so by allowing only signed trusted binaries to execute. However, there are a lot of vulnerable applications in the wild. For example, Neorizon DataSuite boot loaders. Neorizon DataSuite boot loaders before June 2022 were assigned. However, they were also vulnerable. They allow the loading of arbitrary unsigned EFI binaries. With arbitrary EFI execution an attacker can bypass platform security, install persistent boot gates, perform preboot attacks and fully control the system. Including settings and boot flow. On the other hand, Microsoft mitigates this class of secureboot bypasses like the Neorizon DataSuite boot loaders using the DVX. DVX is a UFI secureboot revocation list and it contains signatures of known binaries that are no longer trusted. Even if they were originally signed. Even though the binary is signed, secureboot refuses to execute if it matches any DVX entry. Microsoft distributes DVX through Windows updates. Usually as part of regular security patches. However, in 2024, Microsoft published the secureboot object repository on github to openly share the contents of the secureboot DVX list and related signature databases. This repository allows security researchers to inspect which UFI boot loaders and certificates have been revoked by secureboot updates. So, using this resource, we downloaded a publicly available edition of secureboot restore, we extracted the hashes, and we compared those hashes against the entries in the DVX. We found that some versions of shield loader are correctly listed in the DVX. Specifically, those matching the hash line above. This hash corresponds to the entries of the CVE we talked about before. However, we also found several other versions of the boot loader. These have different hashes and were not present in the DVX. This suggests that additional vulnerable variants of shield loader may exist in the wild. It has not been added to Microsoft's revocation list and may still be trusted by secureboot on system that rely on DVX protection. So, let's now take a closer look at how reboot restore actually works. Reboot restore is a software that restores a computer to a preset state every time it restarts. Its main EFI binary is shield loader. Before we get into the loader internals, here's how shield loader gets into the chain. First, looks for the ESP, the EFI system partition for the boot loader. Shield loader is renamed or copied over the boot loader. When the finger invokes boot loader, it actually runs shield loader first. Shield loader then implements its own logic, the compression, signature checks and so on, before finally loading the real boot manager. Okay, but what does shield loader do? We divide the shield loader operation in four phases. First, shield loader opened the ESP volume, located the file shield manager underscore, notice underscore, this is important. Allocate the file size and read all bytes into a buffer. If that works, we end up with the proprietary format binary, NAUI. In memory, if it fails, the loader falls back to scanning every installed finger volume. We'll talk about this proprietary format later. Then, the loader invokes parse heater. This routine first inspects the 200 byte heater at the start, it reads the ASCII magic and extracts both the compressed and uncompressed file length. After that, it goes through the chunks. And for every chunk, it calls decompress on the payload and if it doesn't compress it, it simply main copy the raw data. And this is how the proprietary format looks like. This is the EF underscore format. We have the 200 byte heaters, with magic, compressed and uncompressed file length. Then the chunks. Mark as compressed or not. And finally, the trailer where the signature is located. After that, the shield loader looks for the signature of the trailer, the last 800 bytes. So after decompressing and allocating the image, the boot loader goes into phase three. In this phase, the loader invokes check signature. Then it jumps to the last 800 bytes of the buffer where it inspects the trailer. If the magic is wrong, the prediction fails or something doesn't look good, check signature returns false and the loader aborts with EFI security violation. Finally, in phase four, the loader hands off to the standard EFI boot services. It calls load image and returns a new EFI handle. It then invokes a start image, which transfers control into the loaded P. And this is almost the full chain of shield loader. But we also found an interesting proprietary format EFI file. Remember that underscore EFI files like this. Additionally, in one finger version, we discover a containing name shell dot EF underscore. This is actually a sign UFI shell binary with only a small subset of command enable. Although if functionality is limited, we can leverage it later as a convenient trusted entry point into the UFI environment. Right, but what does shell loader do? Remember that shield loader loads shield manager. So after the compression, the EFI in shield manager, the loader skips the custom format and directly load another EFI image. Any EFI executable placed at shield dot EFI at ESP will be loaded and run without checks. This means two things. First, there's no security verification. Load unsigned EFI never calls check signature. Also, there is no container parsing. It expects an extra P image so you can drop any EFI file there. You can write your own EFI binary and compile it and put it as shield dot EFI into the ESP partition and shield manager will load it for you. So this is supported so we can abuse this to load our own unsigned EFI binary. So let's look at this in a demo. Okay, so this is the demo . Okay . Well, let's begin the demo. First, we verify that secure boot is enabled. If the publisher command returns true, it means secure boot is active and functioning properly. In this case, we can see that this is enabled. Next, we run our EFI install. This tool replaces the files in the ESP, EFI system partition, with our own. So what happens after the system reboots? Remember that we have replaced it, the original boot loader, with our install. At this point, shield loader loads shield manager. Shield manager then loads shield dot EFI, which is our custom unsigned binary. This binary calls and reallocates another image and at this point, this binary displays this custom SDR splash screen. And once the animation completes, we chain load the original boot manager and Windows boot success. Okay. So, but, what about the local protection? When you enable BitLocker on a noise volume, the VNK is sealed in the TPN against the current values of several PCRs. With secure boot enable, usually PCR7 records a hash of every EFI executable that runs from the kernel. Boot manager, VCD, early drivers, and so on. If any one PCR is different, after boot, the comparison, the unseal fails and Windows falls back to BitLocker recovery mode. Okay, so, what does our proof of concept do? First, we suspend BitLocker protection indefinitely. We achieve this by using WMI to run disabled key protectors with disabled count equal to zero. This prevents triggering BitLocker recovery after modifying EFI files in the ESP partition. Then, we mount the EFI system partition, backup original boot loaders, and save boot manager and boot 64 for later restoration. Finally, we apply the modified boot files. To do this, we override the boot loader with shield loader, and we continue by replacing the expected shield manager, the shield manager underscore, remember, with shell dot EF underscore, which is the sign EFI shell with a limited command set enable. We also need to copy a stage zero dot EFI that is a sign tool capable of enrolling unsigned binaries into machine owner key. And last but not least, we copy loader dot EFI that is our final unsigned payload into ESP. Okay, that was a lot of things. Let's see it in action. Okay. Good. In this demo, we start by verifying that BitLocker protection is enabled. Using the manage BD command, we confirm that BitLocker is indeed active. After that, we run our EFI installer and reboot the system. Remember that secure boot is also enabled at this point. As part of the installer process, it replaces the files in the ESP, EFI system partition, and disable BitLocker protection using WMI. After reboot, instead of the usual boot flow, we load shell dot EF underscore, which is the sign proprietary version of the EFI shell we talked about before. The EFI shell with a limited command set enable. From this restricted EFI shell, we download a stage zero. A sign EFI binary designed to enroll any binary into the machine owner key. In this case, we enroll loader dot EFI, which is actually a fully functional version of the EFI shell. Now that we have a fully capable shell, let's attempt to load and sign EFI binary. As expected, this fails because secure boot is still enforced. To bypass this, we can do a lot of things, but we locate the EFI protocol handles associated with the security architecture protocols. Once identified, we patch them with the opcodes XR, RAX, RAX, and then return. In this example, to bypass secure boot protection, we first need to identify the addresses of the security architecture protocols handles, and once located, we modify the corresponding opcodes. For demonstration purposes, we are applying the patch byte-by-byte, rather than using a more automated or optimized method. So we just show up the left, and then return. This should disable the secure boot validation mechanism. So now, we need to try to run our EFI and sign EFI binary again. And it works, because we previously disabled BitLocker using WMI, we are able to chain load the original boot manager, allowing Windows to boot successfully without any BitLocker recovery screen or recovery patch. All right. Thank you. Okay, let's continue. Well, enough of CR. Let's do something more interesting, like achieving persistence. One technique we can try to abuse is WPPT, the Windows Platform Binary Table. WPPT lets the firmware place one native application as C Windows System 32 and execute it in the session manager context. This is important. In other research, this approach appears to work when the binary is signed with an old certificate. However, in our test on Windows 11 2482, this doesn't work if the certificate is revoked. Since many of the leaked co-signing certificates are now revoked, we need to find new ways to achieve our goals. So we can simply drop in a native application and run it. That's a problem, because we need to modify it. But what if instead we find a signed native application that's vulnerable and exploit it to do whatever we want? And that's exactly what we've done. We've found a signed application from Lenovo. This binary was used by Lenovo Service Engine, LSA, to smuggle a big blob of PDF files, registry keys, and config data from firmware into Windows. It uses a proprietary ACP table called LUFT table that isn't part of the ACP specification. Only Lenovo's binary parses it. This lets an attacker to install an arbitrary driver or service completely from ACP. So you are installing after the boot from the pre-boot environment. This will be interesting. So no disk write needed until the session manager does it for you. So we need to construct a new LUFT table, a new Lenovo table. That needs to drop help.sys. Help.sys is a non-signed vulnerable driver we found over there. We use this to construct our LUFT table. Then we also need to fill our table to create a service key under, for example, two server driver. It can be whatever name. We also need to set display name, image path, type, error control values. And after that we reuse slot 6 in the STD. The slot 6 points to the SMT entry of the OEMs. We need that slot points to the start of our buffer that we filled with our LUFT table. After that we also need to fix the checksum. Okay, but what does the Lenovo native application do? Well, it looks for a custom ACP table named LUFT, writes the binary to this calling the function level as say binary to C, Windows system 32, drivers, whatever that is. Then it invokes create registry keys on every subdescriptors which in turn writes or patches the registry so the binary will launch automatically. Right, we also need to construct our WPBT. We need to find a readable random space or we can just allocate it because we have random execution, we have EFI execution. So we can allocate and copy our real payload that is the Lenovo native sign application there. We also need to overwrite the first 16 bytes in the SRAT with this WPBT heater. This silently turns the SRAT into a WPBT and the system observes it. We also need to fix the checksum. So to summarize what we are going to do. Finger first finish post enters accessible services and real time memory still contains our injected blobs. Windows loader, scan the STD, find our Lenovo proprietary table, put the rampage that used to be SRAT but now begins with WPBT, sees a valid length and checksums and asserts it as WPBT. After that the session manager copies the Lenovo sign application from the WPBT to this and executes it as NT process start. Then the Lenovo native sign app started by run service 1, parses the lab, drop help.sys, write the registry values and start the service or schedule it for the next boot depending on the flags. On the next boot, Windows sees a legitimate driver entry under services to service driver. Loads help.sys and the system is compromised. It's better to see it in action. In this demo we once again begin by verifying that secure boot is enabled. We also confirm that the target service that we are using does not exist on the system. We are going to do everything of this from the pre-boot environment. As usual we run our EFI installer and afterwards we validate that neither the help.sys driver nor the Lenovo native application file is present. We then proceed to reboot the machine. Upon reboot we chain load our custom EFI binary which launches an EFI shell for demonstration purposes. Wait a few seconds until the system reboots. Okay. So remember we modified the EFI system partition to replace the boot loader with shield loader then shield manager. Shield manager is loading our custom EFI file and this custom EFI file right now is loading a fully functional EFI shell. From this EFI shell then we need to patch the WPBT, the Windows platform binary table and create our custom LUFT table. The Lenovo custom table. As the system boots, the session manager executes the Lenovo native application before prompting the user to log in. So here it is. Then the application with the LUFT table loads our signed vulnerable driver, help.sys into memory and write this into this. And after that it configures the appropriate registry keys to register the service and ensure it starts automatically. Only two key left. So type and then arrow control values, start values, arrow control and then the system should start. Okay. We need to confirm at first we didn't have a help.sys driver, not the Lenovo native application on the system. We are trying to put those files from the pre-boot environment and we need to check if after boot, if those files exist. So once Windows finishes booting, we need to confirm the presence of the help.sys driver and the WPBT, the renamed Lenovo native application. So first we need to check if our help.sys driver is present on the system. And here it is. And we also need to confirm that the Lenovo native application is over there. And here it is. We also can check its signature to see if it belongs to Lenovo. And finally the most important part is that we need to verify that our new service exists. And here it is. We have two service drivers installed on the system. It's successfully loading a kernel driver and on the next reboot it will be launched automatically. So now we have a vulnerable driver installed from the pre-boot. And now Borja will show you some ways to express this. Okay. Okay. In this last part of our presentation, we'll show you how we completed the full persistent chain from the system boot using legitimate signed but vulnerable drivers. The key thing here, we found these vulnerabilities ourselves. And we are using the method that my colleagues have presented earlier to load this driver right from the system start up. This is essentially a big WOD. Brand young vulnerable driver technique but with full control. We analyze, choose and exploit driver that haven't previously been reported as vulnerable. Just provided direct kernel access. Would that this achieve real persistence? From the moment the system boot until our payload runs without detection by security solutions. The flow like this. At the F8 stage we place a signed AFI file loaded before the operating system starts. From there we automated the loading of one of these vulnerable driver. Once the driver is loaded, we gain kernel full access using primitives. With kernel level access we implant silent and persistent malware. We discover this driver by analyzing numerous artifacts from the Microsoft catalog using retro hand in virus total and exploring other repositories as we've mentioned earlier. Many of these driver came of major vendor yet they have no detection whatsoever. We identify vulnerabilities in our CTL handling allowing user land control memory to invoke sensitive function without validation and even modify critical system structures. With this vulnerability we can bypass driver signal to informant, EDRs and other run time protections. Hook a driver function by modifying the import of the state board from kernel mode and register system call back to hide our activity and evade detection. The critical point, there is nothing malicious from the system's perspective. Everything is signed, legitimate and it's completely vulnerable. This type of persistent is very hard to detect and even harder to remove. It plays in a real environment, it ensures total control after every reboot without touching disk or visible processes. This is a real and interesting case. A send driver from Huawei not originally intended for malicious use but whose features are perfect for persistent and kernel level protection. This driver installed with Huawei AI service just remains active even after you install the software. This persistent behavior is particularly useful for an offensive property. What does this actually do? It registers callbacks for process creation and termination using PSR create process notify routine monitoring specific user defined processes. But this goes further. It also registers process access filtered via OB register callbacks intercepting calls like open process. If it detects a dangerous permission like process terminate, it removes them on the fly protecting the process from being killed or injected. Even if someone manages to terminate the process, the driver automatically restarts it. It achieves this by injecting an EPC to legitimate processes like service X. Quietly executing hidden command to restart the target service. The most serious issue isn't just the driver protect and restart processes from kernel mode. But that all this power is available from user language that require a privileged signature or validation. The driver creates a device object accessible by any process. It's WAI gallery work driver controlling application can send command ignoring right signature authentication needed. Huawei even provide a tool Eagle check X communicating with the driver via OCTL. Internally this command trigger OCTL 0X222004 passing a unicode string with the process path like C Windows system 32 notepad X. It's pointing the driver to protect this process. Here the vulnerability, the driver validating nothing. No check of command sender identity, no validation of the process that works in error signature, no limits on which or how many processes can be protected. This means you can't seal any process including malware, protect your exploitation tools, prevent EDR or forensics tool from killing the processes. Moreover if the process dies the driver automatically restarted effectively becoming a functional rootkit distributing by legitimate vendor control by sending simple string from user LAN. From an offensive viewpoint it's perfect. Kernel level persistence, real time protection, user LAN control, zero validation, authentication, you don't even need to exploit it, the driver isn't inherently vulnerable. Once the driver receives a command from user LAN to protect a process , for example C Windows 32 notepad X, it's internally validation is extremely weak . Instead of checking digital signature, hashing binaries or validation executables, it's simple compare the command line as a plain text. It's called PS get process pip to access the target processes PEB and then uses KE stack attached process to read its command line directly from memory. Then it compares this command line of string with the one received via OCTL using RTL compare unicode string. What's wrong here? Comparison is case sensitive, no path normalization, no handling of symbolic link, space or path variance, only a test comparison, no binary signature hash or meta data verification. To see simplifications, you can easily bypass protection by slightly altering the path or casing. You can protect arbitrary processes even malicious ones fully in EDR. The design is fundamentally broken. A slight difference in case is enough to bypass or abuse the mechanism. For attackers this is an opportunity. Protect malicious payloads as legitimate, evade detection, bypass invalidation, automatically seal anything you run without complex techniques. Okay, this part of the driver is extremely dangerous for persistence. Even if the Huawei software is uninstalled, the driver is still loaded in memory with kernel privileges. Removing it requires manual intervention. Use command like AC stop, AC delete or remove. If someone kills a protected process, the driver automatically restarts it without the user line intervention. It uses APC injection, construct command like AC start my service, find an active thread, it's a trusted process, usually service X, uses key insert QAPC to execute command silently. The processor restarts silently, invisibly and automatically kernel persist without touching the disk. This method evades most CDRs because process creation occurs from kernel space rather than user line bypassing security hooks. For red teams this means stealth persistence, invisible process creation, active defense against terminations. This driver behavior makes it essentially a primitive rocket. It not only protects a process but also completely disables normal OS monitoring and control mechanism. It removes process terminate from kernel mode, blocking user level tools from terminate protected processes. Everything occurs in kernel space and detectable by user line tools like tax manager, EDRs or antivirus solutions. Command and control action inject directly into legitimate process like services X for the high end activity. No signature validation means malicious or custom binaries are protected without detection. Offensive implications, persistent execution, real time evasion of monitoring and hooks, no user line agents needed for protection. Okay. Demo time. Okay. First we develop a proof of concept that deploys a malicious service called hell. When we launch the POC register and start a hell service on the business system, the service directly interacts with the vulnerable driver that we have described earlier. Upon activation, the service establishes a reverser granting us a remote control over the compromising point. As a visual indicator, the service also pwned a prompt window displaying the message, hello DEF CON 33. Confirming successful execution and persistent on the target machine. Next, we attempt to terminate the malicious process using tax manager. However, when we took this process, the system immediately returned an access DNA message. It's a direct result of the kernel protection implemented through the vulnerable driver. The driver steals away the privileges required to terminate the process. Effectively hardening the malicious service against any action from EDR tools or local administrative attempts. The system is protected by an EDR solutions. Fully operational and configuring with all protection at the highest enforcement level phase 3. Remote payload execution at active protection against termination, the EDR doesn't generate any alert or suspicious events. The second part of the demo, we presented a variant leveraging another vulnerable driver to discover our research. In this case, our role is different. To bypass protective process light, PPL, and still see terminated process , protective processes such as antivirus or EDR actions. To achieve this, we exploited the functionality exposed the vulnerable driver, specifically on a CTL interface that allow us to invoke the sub W terminate process function directly from the kernel node. Using this technique, the driver can terminate highly privileged process including antivirus on EDR without restriction and without generating any alert in the console on the EDR event logs. As a proof of concept, we've created an executable that interacts with the health service and also leverages the vulnerable function to kill the antivirus on an EDR process, as can be seen in task manager. As we mentioned before, this is just a POC, but the entire process could be made significantly sturdier and more sophisticated for a real world team operation. Okay. Thank you. To sum up the talk, let's quickly go over the key points. Secure boot improves security, but this has clear limitations. We've found that legitimate signed binaries can still be abused, especially when the DVX revocation list isn't properly updated. UFI remains a critical and often overlooked attack surface. It's allowed code execution very early in the boot process, far before traditional security tools can react providing a perfect window for persistence. The bring your vulnerable driver lets us abuse legitimate driver to gain direct kernel access. We've demonstrated it has poorly implemented your CTL enabled privilege escalation and the ability to disable protections. Every component we use is legitimate, signed and allowed silently. We didn't need any traditional malware just public, just a tool that we've revered most offensively. This clearly shows that the most effective offensive techniques don't rely on obvious malware. With the right vulnerabilities and smart use of legitimate components, it's possible to fully compromise the system silently and persistently. If you are interested in digging deeper, here are the references we use for our research. Don't worry I won't copy them now, the slides will be uploaded after the talk so you can check everything later. Okay, thank you for your time and attention. The GitHub repository is now a bible. We hope you enjoyed the talk and maybe learned something new today. Also thank you to our friends who have supported us during the project. Thank you so much.