Welcome to my talk, Where's the Money? Defeating ATM Disk Encryption. This is a Encore presentation to the MainStage Act I had just done earlier today. And before I came on stage you just found out I got a Wired article published. So all right. So starting off, my name is Matt Birch. I'm an independent security researcher with a passion for IOT and hardware devices. I am the developer of several MFA bypass tools affecting various MDM solutions. I have performed expert opinion against a major ATM manufacturer. And I've also had the opportunity of examining cartel designed ATM black box devices. For today's agenda, we'll take a brief look at the ATM industry, introduce Diebold Nixdorf's dynamic security suite, then dive a little bit deeper into the preboot authentication process of that software. And finally, we'll wrap up with a little bit of cat and mouse. So starting off, let's look at the industry. Essentially the ATM market is constructed of both consumer and financial class systems. The consumer devices are your standard ATMs that you see at your grocer, your gas station. Typically they run Windows CE and they're present everywhere in the market. They also lack a lot of the enterprise security controls that you typically see on most systems. However, the financial class systems are the enterprise ATM. These are the ones at your bank, the standalone units, through uh through wall units, and they're typically running Windows Embedded 10, uh some are now doing 11. And each manufacturer has their own ATM security stack. That security stack is designed to harden the ATM, provide endpoint protection and full disk encryption. Yep. So when you open up the ATM, uh it's essentially constructed across two hemispheres. You have the top half, which uh contains all the PC peripherals and computer components. And then you have the bottom half, aka the vault, which carries the cash cassettes and all the system's currency. Each halves are physically isolated from one another. And the physical security controls between the two vary drastically. The bottom half requires multi-factor authentication, has a digital combination lock, and uses an I button for secondary authorization. It's constructed with about an inch thick steel, has heavy bolt locking mechanisms. It is also equipped with seismic uh detection and tamper detection switches. However, the top half's significantly different. It's about one-eighth inch thick steel, has tons of vent holes, syst- uh the systems come with default tubular locks. And those locks leverage a cantilever locking mechanism where a cable's hooked up to the cylinder, so when you turn the key, the cantilevers come up and the front of the ATM will open. Uh additionally, the front of the ATM usually has a lot of plastic components, which makes it very easy for uh malicious entry- entry or destructive entry, maybe just stick a coat hanger in and pull the wire. Um and when we start looking at the attack vectors affecting ATMs, uh most of them all require some level of physical access. And with that, some of the most common attacks we usually see are black box devices, which are usually placed inside or outside the ATM, with the objective of intercepting the communications and getting the ATM to withdraw or dispense more funds than what was requested. Everyone knows the card skimmers, you plop those on the front, you steal people's card information, super interesting. Uh and then you have the heavy destructive attacks. Uh this involves RAM raiding. Uh you wrap a chain around an ATM, hook it up to your fork pickup, just rip the thing right out of the ground. Or you borrow your local construction company equipment, rip a hole right through the wall, and run away with the ATM. Some of the less common attacks we see here in the U.S. are explosive-derived attacks because our money ha- uh has a heavy paper consistency. Uh usually when you involve fire, it ignites and is counterproductive to theft. However, internationally, uh with the plastic-based currency that's not necessarily the case, and you see more of these attacks. Uh the ATM landscape is constructed of thousands of ATMs, all of which hold very large sums of cash. And despite the need for physical access, the criminal element against these systems has grown exponentially over the last few years. This is mostly associated to the deficiencies within the logical infrastructure of the ATM. Mainly the use of an unauthenticated API known as XFS that interacts between the software and hardware, allowing funds to be dispensed out of the ATM. Most of the applications on the ATM also are executed in the context of local admin. And then the ATMs are also designed with layers of default accounts for system administration, OS access, and other various activities. All of these have made the devices very attractive to organized crime. And we can't necessarily talk about ATMs without briefly mentioning the ATM network, which is what the ATM must be connected to so you can save your money from the bank. The ATM network is essentially a private connection that's restricted from the hosting provider or gatekeeper. And access to the ATM network requires some level of certification from that gatekeeper. And pieces of software and hardware are individually certified, so in environments where you have multiple different ATM vendors, it becomes very difficult for a financial institution to administer those systems. And usually they'll partner with some kind of managed services provider to ease that overhead. This all brings us to the subject of today's talk, which is Diebold Nixdorf and their proprietary Vynamic Security Suite software. Unlike all the other ATM security stacks, Vynamic Security has multi-vendor certification, allowing their software to be installed on any ATM platform and granting access to the ATM network. In 2015, they were assumed to represent about 35% of the ATM market. And in 2018 and 2019, they partnered with two of the largest financial institutions representing the U.S. gaming industry. AKA, Vynamic Security is present in almost every casino in the United States, if not most, right here on the Vegas Strip. It's cool. So now that we understand uh the landscape, let's take a look at the software. So just like all other security stacks, Vynamic Security has a number of default protections. USB filtering, firewall policy, delegated access, and disk encryption. However, it's not full disk encryption, where there's two partitions that are unencrypted. There's a UEFI partition, which is pretty common in your corporate image. But then there's also a Linux partition, which is somewhat of a red herring in a Windows-designed system. So taking a closer look of that Linux architecture, it self-identifies itself as Super's Chaff. Which, doing online reconnaissance didn't actually re- result in a whole lot of information being associated with that, but did identify this really cool game known as Worm's Armageddon. And in this game, you launch sheep as mobile projectiles against your enemies. The game was a lot of fun to play, I think we wasted at least 30 minutes on it, but that has nothing to do with ATMs at all. But what it did identify, because I'm really bad at foreign language, is Super's Chaff is actually German for Super Sheep. And Super Sheep was also an installation directly within the user directory path. And online reconnaissance of Super Sheep was much more resourceful. Specifically, in 2016 a consulting firm known as SecConsult released a blog article detailing code execution deficiency in a piece of software known as Cryptware, CryptoPro, and their underlying Super Sheep operating system. In this blog article there were a lot of similarities between dynamic security and Super Sheep, leading us to go back and then take a look at Debulb's user license agreements. And lo and behold, they specifically designated CryptoPro as being a third party licensed vendor. But that was only relevant in version 3.0 and all references to CryptoPro are removed from all later versions of dynamic security. So who is CryptoPro? It's a cryptographic spin-off started in 2002 designed to enhance the functionality of Microsoft BitLocker through pre-boot authentication. Today the organization is represented across numerous countries and a number of different domains, each one having a very unique and uh different online presence. However despite this suspicious representation they advertise over half a million licenses sold and they also uh state that employees love their encryption. So, you know, they got that going for them. So let's take a little bit deeper dive into how the pre-boot authentication function actually works. So powering on the ATM it executes a dual boot cycle. From UEFI a Linux partition is bootstrapped aka super sheep, does some black magic to the disk, shuts down, goes back through UEFI and then launches Windows. Windows performs an auto logon, bootstraps all the ATM software and the system comes up and becomes fully operational. Any attempt to modify the content of the Linux partition results into an integrity error page to be presented. But not all files are treated the same and modifying other directories or files results in a completely different integrity error uh to be shown. But this one has significantly more details represented in it and identifies about 253 elements are validated on the desk. Which uh leads us to need to understand what files are actually being checked. Going back to the Linux system we then start scouring the drive and looking to locate any uh hash sum indexes, tables or files that may have uh a list of what's actually being checked. Ultimately we found a log directory and in there there was a sum index of about 2500 files. Significantly larger than 253 however it did give us some indication of what was being checked. Uh the Linux partition itself had a little under 11,000 files giving us a delta of about 8200 files that needed to be validated as part of the integrity check. Or that weren't validated as part of the integrity check. So that's a whole lot of files to attempt to validate and identify a loophole in the validation uh process. But what I generally like to do is go back and take a look at a background image. I mean who really looks at background images uh and they have a very high visual representation when anything's modified. So we randomly pick an image, modify it, reboot the system and uh the default background is then presented. However just a few seconds later we got our hacked background. Being able to do this essentially establishes the foundation that the preboot authentication process is not completely infallible and there is an opportunity to redirect the execution workflow of the system. Ultimately with our modified background we were able to map out the authentic uh authentication process to occur across two phases. The first of which is executed within UEFI across the boot XSA or boot XSA2 system binaries. This is where the 253 contents of the disk were validated. Upon completing the UEFI validation uh Linux is then bootstrapped and from Linux out of root's profile phase two is initialized scanning the other 2500 files. Those 2500 files are then used as a seed to unlock the TPM. Unfortunately the ATM is configured with secure boots and all the binaries on the UEFI partition are digitally signed with the BIOS. Meaning we can't actually modify any of that content to gain control of the system. But what we can do is identify what files are validated during phase one. Identify anything that might be overlooked during the Linux initialization process allowing us to redirect the process of code execution prior to phase two being initialized. With that, challenge accepted. Let's play cat and mouse. We'll start off in version 18.X. In version 18.X we have uh the pre-boot authentication process carried out in UEFI. It's part of boot XSA2. 253 elements are validated. Uh the system is then initialized through uh the SysV architecture and several RC initialization scripts. Upon completing the RC initialization process, root performs an auto logon and then phase two is launched out of root's profile. When we take a look at the running environment of the Linux operating system, it's designed on the back of several temporary uh mount points. Temporary file system mount points. This is used to give a pseudo read only perspective of the disk cause the contents of those temporary file systems are then populated from tar archives. Again, those tar archives are also validated as part of phase one and not a valid attack surface. So this leaves us with a challenge. We know the index of phase one, what files are being checked and we need to compare that to the full initialization process of phase two in the SysV architecture. 253 elements though covers most of the RC initialization script and there's not a whole lot of uh attack surface or thread that we can take advantage of. Except they made one exception. Etsy init tab was overlooked. With that we have our uh initial foothold to perform code execution but we still need a staging directory to place uh things on the disk. Luckily like any good security solution, it ignores validation of most of its own integrity files and since the goal of this exercise was code execution, what better directory to use as a staging directory than super sheep of Europe. So with that, let's jackpot an ATM. Uh we cloned the RC initialization process over to our safe directory, patch global variables, inject uh proof of concept into the call to X, and then execute our new run level three from the unexamined Etsy init tab. With that, here's a demo, 2023-24064. Sorry guys. Okay. Unfortunately I have some technical difficulties with that. I apologize. Uh the videos are published as part of uh the media server. Apparently they don't execute well on this Macbook. Um anyhow in this video what I was demonstrating is we power on the virtualized file system. Uh it receives a preboot authentication error. We shut down the desk. We relocates uh our initialization files over to the uh staging directory. This then once root performs its auto log on, we receive code execution and a callback shell. So uh having code execution on the system uh essentially just having access to the Linux system itself. Uh the vanilla code execution is actually never enough. And uh the Windows partition is still technically encrypted. Uh however, Super Sheep comes with an app for that uh known as Mount Winpart. Uh Mount Winpart takes the TPM recovered disk encryption key and then passes that as a command line argument decrypting uh the Windows partition and giving it the uh opportunity to then execute a third phase of the integrity validation. So from uh having code execution on the Linux system, essentially all we need to do is uh resume the integrity validation process, monitor the proc command line, and then recover that TPM disk encryption key. From there, uh re-initializing the process just a few seconds later, we're able to recover the TPM disk encryption key, decrypt Windows, and uh load malware onto the system, interacting with the XFS API, giving us the ability to dispense funds from the ATM on demand. So uh doing the research essentially the timeline uh this vulnerability was observed to only impact version 18.X. Uh the vulnerability was identified in December of 21 and then confirmed remediated just a few days later in the next major release. At the time of this discovery, uh version 18 was designated to be end of life and uh Diebold Mixdorf had moved from uh to a new versioning number to introduce minor uh revision updates to their update. That's why it goes from 18 to 3.0. The way the attack surface was mitigated is phase one now validates Etsy and NetApp. So there's no opportunity to redirect code execution for the RC initialization process. However, what they also do is the PBA integrity process is decreased from 253 elements to only 56, about a 20% reduction. Reporting this to Diebold however, they did not designate this as a vulnerability and it indicated it was working by design because of the security protections that IMO provides. So what is IMO? Well IMO is an uh kernel integrity process where uh every binary on the system is digitally signed and that signature's also loaded into the Linux kernel. That signature carries details about the file name, the file path, very I know de- various I know details and that's appended as an extended attribute to every executable on the system. When you go to call those executables in a child or parent child relationship, uh the execution workflow and the signature is validated against the Linux kernel to decide whether or not that's allowed to be executed. However, the one thing that IMO doesn't do is it doesn't validate uh signature script interpretation. For example, if you call the system shell, which is an authorized signed binary, it's able to read uh the interpreted scripts, for example, root's profile script and then carry that execution workflow in the context of an authorized system binary. So let's carry on into service release nine. In service release nine, the Linux architecture is relatively unchanged. Uh however, examining the mountfs initialization script, there's a delete call that's initialized before the architecture of the system is actually mounted. Since the entire architecture of the system is mostly derived around the concept of a temporary file system, uh all we need to do is uh move fs tab to m tab. Then fs tab will be deleted before the mount command is called, removing all the instructions to build a temporary file system, allowing us to regain persistence to root's home directory. We patch the profile script and then again, gain code execution. Um I had a demo for this, uh 2023, 24063, uh unfortunately I I it's not playing properly on the Macbook, so I do uh apologize greatly for that. Uh but anyhow in the demo, uh if it were to play, it's uh we patch the offline disk, we uh move fs tab to m tab, uh the system auto boots back up, and then once root logs in, we get code execution and receive a callback to the initialization process. So this time, uh the scope and the timeline, uh this was observed to impact all prior versions of 330 as part of the dynamic security suites. Uh the vulnerability was identified in June of 22, and then confirm remediated the day after magically in uh version or service release 10. In service release 10, the mitigations were enforced by an uh update to the mount fs initialization script, now removing the delete call from uh to etsy m tab. So without etsy m tab there, uh we don't long we no longer have the opportunity to remove fs tab. Carrying on into service release 10. So as part of service release 10, uh we now have init tab validated, m tab does nothing, but what about the mount logic of the architecture? So mount is actually a very interesting command. Uh again, most of the security architecture of the security stack requires building a temporary file system. However, if we're able to use mount to stop uh that architecture from getting mounted, uh we then have an advantage to regain uh persistence to root's home directory. One very interesting limitation to mount is if you happen to execute mount against the mount point that's previously been leveraged, the call to mount will fail. In a Linux architecture, what's the default uh mount point that's used by the system? The root file system. So if we flatten the file system and then redirect root bar and temp to root, uh we're able to regain persistence to root's home directory because when those temporary file systems go to mount, the mount point already exists and that call will fail. This then gives us the opportunity to uh jackpot root's profile and regain code execution on the system. Again, I had a demo uh 2023-24064 uh where we uh flatten the file system and uh are able to redirect code execution powering back on the system uh once root logs in, we receive code execution. So this time going through uh going through the timeline, uh all prior versions of 330 were known to be vulnerable including uh this time 4.0, 4.1 and 4.2. The vulnerabilities were identified in June of 2022 and then confirmed remediated in version in service release 12 immediate uh in December of 22. In service release 12, the mountfs initialization script was then updated with several uh additional delete calls. Now we're moving root bar and temp and mount and uh removing any opportunities for us to do sim links or redirect the execution essentially ensuring those directories are empty. Let's carry on in service release 12. In service release 12, how do you work around a delete call? Well, mount still has some magic logic tied into it where earlier on in the initialization process, uh the kernel uh kernel run space is mounted to specific mount points. And whenever you place a file on a mount point, it no longer becomes accessible. Since all the previous mitigation uh steps were initiated as part of mountfs, uh essentially we just move mountfs to proc. Once the uh kernel initializes, the temporary file systems are built allowing us to regain persistence to root's profile script. Again, this was recognized as CVE-2023-28865 uh in the demo if it had played. Uh it would show that um we're able to uh redirect uh the file location uh move that over to proc and once the Linux kernel powers on, we receive code execution and our callback. Just as before, all prior versions of 330 were known to be vulnerable to this attack surface, including uh all versions of 4.0, 4.1, and 4.2. Essentially representing the entire security stack of dynamic security at this time. The vulnerabilities were identified in December of 2022 and then confirmed or mediated in February of 23 as part of service release 15. In service release 15, the uh phase one integrity check was further updated to include a number of null sum values. Essentially validating a number of critical mount points to truly be empty before the Linux partition was allowed to boot. With this, uh we don't have much opportunity to modify the disk and it closes a lot of the previous attack surfaces. So let's carry on with service release 15. So in service release 15, introducing those null sum values, uh I like to come across the idea that the more complex a security control is, the more likely that something is gonna be overlooked as part of that validation process. If we try to create a file or create a sim link to a known file, that produces a hash hash sum as part of the phase one integrity check and the pre-boot authentication process fails. However, if we establish a directory or a tree of uh empty directories, no sum value is created. Additionally, broken sim links also do not produce a hash sum value. However, to take advantage of this, we need this new staging directory. Uh to identify one, we would return to the previous attack surface and look to identify any directory structures that are created once the Linux kernel is initialized, but don't have a presence on the offline disk. Essentially allowing us to establish a transversal point to redirect uh to a new staging directory. Luckily after just a few seconds, we're able to locate dev block, which was a special mount point mod gate or uh associated to the block device of the Linux partition itself. This was also observed to be present in all versions of dynamic security. So, what we need to do is move uh our uh critical mount points over to a new staging location. For example, root to root 2. And then we link to those through our transversal point dev block. Offline on the disk, those sim links are then broken. However, once the Linux kernel initializes, those links then become valid, allowing us to redirect code execution and regain persistence to root's home directory. Uh this was identified as CVE-2023-33206. Again, uh in the demo, had it played uh properly, it would show that we uh create the new staging directories and redirect to our staging points. Once the virtualized system powers on, we would receive code execution and our callback shell. So, just as before and all the previous attacks, this vulnerability impacted all prior versions of dynamic security, including all versions, prior versions of 4.0, 4.1, 4.2, and 4.3. The vulnerability was identified in April of 2023 and then confirmed remediated in July of 23 as part of service release 16. In service release 16, the phase 1 integrity process was further updated, this time validating uh whether or not sim links were broken or valid uh on the Linux partition. Broken sim links now produce a uh pre-boot authentication failure, disabling the system to boot up. But, interestingly enough, they also, dbold also walked back the previous mitigation strategies that were observed in the mount FS uh initialization script. Although it doesn't necessarily reproduce the same attack surfaces, because now we're doing null sum validation and sim link validation, uh it is interesting that uh mitigation strategies are are backwalked. So, finally, this brings us to service release 16. As part of service release 16, we have sim link validation and null sums. The attack surface of the Linux architecture is relatively reduced. However, the whole architecture of the system is based around the requirement of hash sum values. You know what doesn't change a file's hash sum? The file attributes associated to that hash sum. So, for example, if we remove uh the execute permission of a file, the file still has the hash the same hash sum value. For example, if we just remove the execute permission from IMA, we're able to disable all signature verification processes of the Linux architecture entirely and then obtain the ability to execute any code that we want. This vulnerability was identified as CVE-2023-40261. Again, the video is not playing, um, but in the video, uh, we disabled the execute permissions of IMA and uh power on the virtualized file system. Once root performs its auto logon, we then re-regain code execution and receive our callback shell, essentially defeating the whole system once again. Just as before, this attack surface was observed to impact all prior versions of 330, including all prior versions of 4.0, 4.1, 4.2, and 4.3. Again, representing, uh, an impact against the entire dynamic security suite software. The vulnerability was identified in July of 23, and then DBolt had designated it was patched as part, as a November 2023 patch and service release 17. Additionally, version 3.3 was designated to be end of life in December of 23. So, with that, uh, through this talk, I've essentially demonstrated that the entire dynamic security suite can be impacted by a single vulnerability, and that attack surface represents a recursive impact against all prior versions. Although, although the system is still patched, the root cause is still derived around the fact that the Linux partition itself is unencrypted. So there is a high likelihood that new vulnerabilities or new attack surfaces are going to be identified. However, uh, you can rest assured because there are still some requirements of physical access in order to take advantage of this attack surface. So, with that, let's discuss some mitigation strategies. Uh, first and foremost, the, uh, ATM software should be patched up to the latest version representing each major version that any environment, uh, is currently running. With the goal of ultimately moving into version 4.4. I'm proud to announce as a direct result of the security research and working with Deepold next door, they have redesigned the SuperSheep architecture and now offer full encryption of the Linux partition. This was released this year in April of 24. Additionally, there's a security check known as enable signature check. Disabling this prevents the TPM disk encryption key from being handed over to mount Winpart, essentially reducing the attack surface from Linux to recover the TPM encryption key. Additionally, you could just replace dynamic security with an industry recognized, uh, full disk encryption solution. Several secondary actions are also monitor for any malicious top hat entry, disable u- disable the USB ports, and ensure the hard drive can't be easily removed. There is no business pur- purpose for the hard drive to be able to pull- be pulled out of the system. With that, I apologize, uh, my demo videos weren't great, but, uh, please feel free to reach out to me, uh, via social if there's any comments or questions. ... .. ... ... ... ... ... ... ... ... ...