So it was a long time coming. I want to give a big thanks to my mate Alex. Flew in from Europe to help me road trip these ATMs to Vegas. We literally threw two ATMs in the back of an Escalade and gunned up from the Bay Area to Vegas thinking if we get pulled over for this, mate, we're going to have a hell of a way of trying to explain our way out of it. But we got here. So yeah, like two ATMs in the back of an Escalade and about 6,000 notes of novelty currency. What on earth are you boys up to then? So the attraction to target ATMs is fairly obvious, you know, they're full of cash. But for myself, it's kind of part of a bigger picture and a bigger plan and that's to explore systems that when compromised have direct and immediate consequences. So whether they be ATM machines, medical devices, smart meters, you know, the computer system in your vehicle. Because ATMs are very, very, very expensive. You know, particularly because they're not often designed with a secure methodology from the get-go. And as a result of that research, we can use that knowledge to design better and safer products in the future. So the goal of the talk is to spark discussion on ways to remediate and fix the vulnerabilities I'm going to be demonstrating. The goal isn't to give a cookbook recipe on how to hack ATMs. The process of finding vulnerabilities I think is always more interesting. You know, the journey of finding vulnerabilities is always more interesting. You know, the journey not the destination. Although the destination is pretty damn cool on this one too. And I hope to change the way people look at devices that from the outside are seemingly impenetrable. So current attacks. Probably all are aware of the skimmer, which is certainly a fan favorite. It's a small overlay that slides over the card slot and the pin pad. Manufactured to blend seamlessly with the ATM itself. Designed to capture both the tracked data and public and private data. And it's very easy to use. You can see the pin numbers. And the technology on some of these is no joke too. You know, it will send you the data over GPS. And some even have, like, tamper protection. So when they're found out, it will wipe itself out. Interesting. Physical theft and RAM raids. You've probably seen those various YouTube videos where a couple of good old boys hurl through the front window of a place, attach a chain to the ATM and the other end to the pickup truck and just gun it out of there. Not really the most subtle of attacks, of course. But it's kind of ninja status, compared to some of the other ones. And card trapping and card snooping. It's where someone inserts a small shim. It's commonly known as the Lebanese loop. It traps your card and it's designed in such a way that when your card's read, the card won't be returned. And it's often combined with shoulder surfing to get your pin. But sometimes they'll get your pin in ways which may not be quite as friendly. Safe cutting of frontal attacks. Basically going in an ATM with a pair of pins, which I find a little bit odd. Attack is literally tying a bunch of explosives to an ATM and blowing the crap out of it. Now, you'd think that would be somewhat counterproductive to what you're trying to accomplish there. And it's big in Australia. So go figure. And data breaches. Hacking the bank processor. Harvesting the card data and pins. I suppose the best example of that would certainly be the safest, most technically sophisticated attacks I've seen. And I think about 9 million were stolen during that attack. And of course, other. Or miscellaneous. So we have the default passcode attack from a couple of years back. That's where if the operator password was left unchanged on the ATM, you could reprogram the ATM to think there was a lower denomination than there really was. So you probably don't think it was full of $5 notes when it's really giving you $20. And I'll be adding more to the other category. Practical attacks, which I think I'll blow that. John Connor's attack right out of the water. So I've picked standalone ATMs. There's a few reasons. One, they're pretty easy to get a hold of. Like anything on the internet, you can jump online and just add to cart, basically. But getting the ATMs delivered to your house, on the other hand, is interesting. So I remember when one of the ATM delivery guys came in and he wheeled the ATM into my place. And he was just like, why on earth do you need an ATM in your house for? And I was feeling a bit cheeky that day so I just looked at him and was like, oh, I just don't like the transaction fees, mate. And also they're everywhere, right? Every bar, convenience store, market, whatever it may be. And they're often in secluded areas, hidden out by the restroom, tucked away in corners. But I'm going to discuss attack methods for both standalone and hole-in-the-wall ATMs. style attacks but then shift focus to the far more important vector in my opinion and that's the remote attack and what an attacker can leverage with a successful remote compromise. And when I mean remote, I mean remote default because that's the only way to roll really. So just to show how popular these ATMs are, this is literally one block just down the road from my place. Decided I'll just go on a bit of a pub crawl and see what I could find as far as ATMs go. Literally, yeah, this is half a mile. My favorite is this dude actually who owns a Mexican restaurant, he's a good sport, and then he's got a Tepetio resting on top of the ATM there. He doesn't exactly look chuffed to be in this picture. So the standard specs of a new model retail-style ATM, typically Windows CE running and ARM processor. New models support both TCP and WiFi. So you have the default network PIP and dial up by default. Wireless being CDMA not 802.11 so no drive by ATM hacks unfortunately. Thought it would be cool to drive by a store and have it spit out all its cash. No such luck. SSL support and the triple desk encrypted pin pads. Basically the pin pad itself performs all the encryption on the device. Has anti tampering mechanisms and I'll talk more about that beast a little bit later too. Is that better? Okay, so here's the ATM internals, receipt printer. Over to the right you can see the card reader. And there's a serial interface that leads down into the safe which is actually wired into the dispenser. And there's also various motherboard inputs, multiple USB, SD cards, network and some debugging ports. Now there's usually a cover that protects the circuit board and I've only removed it just to show the internals. I guarantee you it's not going to be a problem. But I do want to point out that these ATMs are completely stocked, completely unmodified, totally untouched. Now funnily enough of all the possible ways that an ATM talk could get disrupted, it was actually my cat who almost took it down for me. Had like a USB keyboard plugged in and he was running around chasing a moth or something and tripped over the USB cord, pulled it out and pulled out the processor plug in at the same time. But luckily it was easily soldered back in. But anyway, bad kitty. In my opinion, a presentation shouldn't really be a full blown technical tutorial, so I'm going to be following up later with a white paper that goes into more technical details. But rather than digging deep into the ins and outs of Windows CE internals, I will sum up the security hurdles I faced with this quote. We were concerned about protection but not about security. We weren't trying to design an airtight system like Windows NT. And this was from Thomas Fenwick, the guy who actually created the Windows CE kernel. And I got that from a book that was called Inside Windows CE, which was essentially just a bunch of interviews with the core developers. So obviously things have changed a little bit since that book was written, but to be honest, there were not a lot of roadblocks. So before we can even think about giving the guy from Terminator 2 a run for his money and actually start devising attacks, first step is to be able to interface with the ATM itself, gain access to the file system, and get access to the file system. And with access to the file system, we can then pull the executables off to be able to do some reverse engineering. Now unfortunately when the ATM boots, it boots directly to a proprietary application, so there's no Explorer shell. So we need a shell to make things easy, and originally I thought I could just naively, I thought I could just plug in a keyboard and just alt tab, but that wasn't to be the case, of course. So to get a shell, we'll need Explorer to somehow execute at boot time. The CE application boot sequence is pretty straightforward. It's a little bit more complicated, the kernel NKEXE runs filesys.exe, it initializes the registry in the file system, and then executes the applications listed in the HKLM in the registry key. So the trick is to patch the application we want executed into this boot list. So we want to get Explorer easy into the boot list, and there's two approaches. The first approach assumes you actually have a copy of the C ROM image, the registry file can then be extracted, modified, recompiled into the image, but this requires a way, of course, to rewrite the flash, whether it be over serial, Ethernet, JTAG, or what have you. Now the other approach is to patch and explore while you're debugging, which of course requires debugging capability, JTAG, and so on. So I decided to go with JTAG, because it's a fairly straightforward way to accomplish our goals. JTAG is essentially a hardware debugging interface, which will give you unrestricted debugging access to the processor core. Now the hardware for this stuff used to be pretty pricey, but these days with OpenOCD and some of the open source developments, you get the hardware, you get the debugger for less than a hundred bucks now. So with JTAG access, we can remotely debug with GDB, debug the kernel, bootload, and so on. JTAG's been talked about to death, so I'm not going to dwell on it too much. So this is the hardware debugger just connected to the motherboard. Now it probably seems obvious, but the use of hardware debuggers and things of that nature have absolutely nothing to do with the ATM attacks I'll be demonstrating, simply used to initially gain access to the file system so we can reverse engineer to find vulnerabilities. Now, speaking of JTAG, I learned a valuable lesson when I was actually messing around one of the ATMs. I had the JTAG hooked up, screwing around, and I accidentally wiped out a massive chunk of the firmware, which unfortunately overwrote some of the core ATM files. Now at the time, I was unable to get the software for the ATM to fix it, so I had to call a licensed ATM technician. And three of them came over to my house, and again, you know, why do you have ATMs? I don't know. So I had to call a licensed ATM fixer. Yeah, NEW Entertainment after you got the ATMs in your house. I said, oh, you know, I haven't moved into the Then Yeah. So anyway, yes, what happened? I've never seen something completely annihilated stuff like that, and I was like, just trying to change the splash screen. I put in this little card and it's crapped out, and he's like,desper Valley via actual app.s volt everybody completely stupid. It teaches me a lot about hacking ATMs. I got his business card, we kept in touch, but I think possibly after this presentation that relationship may be severed. So yeah, the lesson was always back up your firmware. So now that we can debug, we need a way to inject. Now, with the debugger connected, we set a break point on create process, offset found by dumping the memory from the ATM and just doing a byte compare with an offline version of core DLL. Now, when working with the ARM processor, the parameters and parser function are parsed via registers before they utilize the stack. So R0, being the first parameter, is going to have the executable that we want to execute. Now, we simply replace the string of the ATM executable, reads from the registry, overwrite it with explorer.exe. Now, explorer.exe has to exist in the image for this to actually work. If not, you need to put a copy of explorer on a removable disk and parse the full name to create process. But then you get a shell. So as simple as that, really. Now, when I was first playing with these ATMs, I was actually quite excited to have a shell on it, have my ATMs play movies and whatnot. But probably not really surprising, the ATMs are pretty crap for playing movies. Fairly slow frame rate and a six-inch screen, so they won't be replacing the home theater. Okay. So with explorer, we can plug in a USB drive and keyboard and copy off the files for reverse engineering. Modify the registry so explorer is always going to boot. Remote debugging with JTAG, of course, is not the ideal. With GDB, it's not the ideal way to debug a Windows machine. So the next step is to actually set up a more sort of user-friendly debugging environment. So there's a way to debug Windows C applications without having active sync, and that's a bug with Visual Studio over Ethernet. You simply build an empty project, overwrite the local executable with the executable from the device you want to debug. With the TCP settings correct, it will copy a file from the device, run it on a debugger, and then you can debug it. So that's the first step. The next step is to debugger, and then you have application debugging in Visual Studio. So now we finally have everything in place to be able to reverse engineer the software, to locate the vulnerabilities, but also to test any software we create for the ATM. So finally, we can get to planning an attack. Now, of course, there's a limited attack surface, obviously. We have the card reader, but assuming we have an overflow or some other string-based attack via the card tracks, there's an extremely limited amount of characters and a very restricted character set. I mean, I'm not going to say it's not going to be a very restrictive character set, but it's not possible, but I would say it would be unlikely to be practical or all that reliable. The keypads, possibly a long shot, but you never know, maybe master passwords left in by developers, back doors, what have you. And then the network, so any open ports, answering phone line, any options for any possible remote attacks. And, of course, the various inputs on the motherboard itself, but, of course, this requires access to the motherboard itself. Now, of course, progress is never really made without a few failures along the way, and in my attempt to come up with a Terminator 2-esque hack, I made this device. It's basically an electromagnet wired up to an amp, which is connected to a media player. A web file is created to simulate the data on a mag stripe. The electromagnet is plugged into the card slot. You play the web, and the ATM thinks it's just a random magnetic stripe. Technically it works fine, but it didn't help me for shit for finding vulnerabilities. Okay. So the walk-up attack. The goal, of course, is to execute code on the network. On the ATM. Now, the cash dispenser is housed, at the very least, by a safe. That's if you take the cheapest option. If you spend more, you can get some fairly heavy duty vault style protections. But the motherboard, on the other hand, is protected by one key fits all lock. And this is standard practice, as you can see. And, like everything else on the Internet, they're easily available to add to cart, and you can get keys for pretty much every major vendor. So one key, say, will open all the models from that same manufacturer, the cabinet. Now, funny enough, the D-ball keys used to be available last year, but they've somehow vanished. I'm sure with a little creativity they can still be acquired. So now with your master key, you have access to the USB slots and whatever other inputs. So you can pop open the motherboard compartment, insert a USB key within a couple of seconds. It's a lot faster than installing a USB key. So we'll talk about that in a minute. Now, even though the attack time here is short, of course, it's still the possibility for detection. That's the great thing about these retail and stand-alone type ATMs. They're in bars, they're out by the restrooms, out of sight, off by the SIGgy machine or something. But then there's also kind of the psychological aspect of ATMs. It's considered kind of rude to look over the shoulder of someone as they're using the ATM. Unless you're, of course, a criminal, and if he was looking over my shoulder, well, he would learn a trick or two, I suppose. Now, all ATMs need ways to upgrade. The ATMs need ways to upgrade the firmware. And this is most often leveraged via the removable drives. So the ATM application will check the drive for a valid upgrade. A valid firmware is found. It will load it up, install, and upgrade the device. And, of course, we can install whatever code we want to. Now, of course, the firmware is typically a proprietary format. Executables encapsulate in the firmware. There are checksums and encryption. But these algorithms are easily figured out by reverse engineering the code on the ATM side. So once you can create your own firmware package, it has the correct format. But you can then upgrade, but, of course, with a few modifications. Now the remote attack, which is obviously the most important vector. So most, if not all ATMs that are running some sort of Windows-based OS support some form of remote monitoring and remote configuration. So this allows you to log into your ATM remotely, review or change your settings, get stats, change splash screens, and so on. But another use case is when you're using the ATMs, and you're using the ATMs, and you're using the ATMs. The other useful feature is the ability to remotely upgrade the software. Now, this is sometimes a feature, but it's always something you can leverage if you have a vulnerability, right? Now, obviously, authentication is required to be able to do anything remotely. And this particular model, you require both a serial number and a password. And they're both made up of a combination of numbers and letters. Five-second delay is forced after each connection attempt. So brute force is basically out of the question. So we require a vulnerability within the authentication process itself. And it's just so happens. So introducing Dillinger. Dillinger is my remote ATM attack or administration tool, whatever way you want to look at it. So we've talked about loading code locally on an ATM machine. With the master key and the flash drive and the correctly formed firmware, you're basically set. But the obvious drawback here is that you need to interact with the machine in some way. So of course, the ultimate win is to be able to execute code or load software remotely, and that's where Dillinger comes in. Named after the bank robber, of course. So Dillinger takes advantage of a fairly serious vulnerability in the ATM remote management capability. And interestingly, although most operators don't actually use this capability, remote monitoring is enabled by default on all of this manufacturer's ATMs. So cha-ching. Now, typically, to log into the machine remotely will require both knowledge of the serial number and of the password. Now, due to a pretty awesome vulnerability, I'm able to bypass all on the device and the remote attack is 100% reliable. Now Dillinger supports both TCP IP and it also supports dial-up because I heard through a fairly knowledgeable source that approximately 95% of these standalone type ATMs are using a dial-up connection. So of course back in the day trying to find an ATM over the phone line would be a long process of nights and nights of wall-dialing but thanks to tools like H.D. Moore's Wallbox you can map out modems on exchange in a matter of hours then just write a custom tool to find ATMs and you're away. So Dillinger allows you to manage an unlimited amount of ATMs through its interface so you could add a group, say a city, under this city you can add each individual ATM that you've found and either its IP address or its phone number. Now the heart of the tool of course is the authentication bypass which is the stepping stone to doing anything useful really. So one feature in Dillinger is to be able to test the bypass in a way which confirms the vulnerability but doesn't actually modify. Okay. So I've added a feature which can pull the ATM settings which includes all the master passwords and the receipt data because you know each time you use an ATM you look at the bottom of the receipt as the location of where it is or at least the name of the business, right? Upload a rootkit so that's not really, that's not a bad feature. Bypasses authentication, initiates the software upload which lets me replace the firmware. So awesome. So in general someone's going to need to be at the ATM if you want to get a payout, right? So I've added another feature so it would be possible to carry out an attack without ever visiting the ATM. When someone inserts a card that track data is captured and I can retrieve that track data remotely. And finally the remote jackpot which I suppose speaks for itself really. Now introducing Scrooge, Scrooge is the rootkit I've developed specifically for ATMs. Implements a typical rootkit technologies. High performance. Hides itself by various C system calls, hooks, hides itself from the process list, hides itself from the file system, filtering the results and so on. Now there's a hidden pop-up menu which can be activated with both a special key sequence on the ATM or inserting a card that has some custom track data on it. It will run on any ARM or X scale based ATM, Intel with a few tweaks. Originally it was designed for both Intel and ARM but it turns out that CE on x86 is actually pretty rare. Basically nonexistent in the ATM world. So the code for interfacing with the ATMs has to be customized for different ATMs as they all use different peripherals and fairly non-stated protocols for communicating. So I just use a standard set windows hook for capturing the side buttons on the ATM and although the API is actually undocumented in Windows CE it still exists and it works as expected. So a combination of keys will trigger the menu. It's varied enough not to launch by accident but you know if maybe some kid's screwing around with it. The card reader is hooked via an inline detour style patch so essentially where you patch in a branch instruction to a piece of code you'd like to intercept, the branch jumps your code, your code executes and then returns the original function. Now with the hook and place there's a check on the rebuffer any time a card is entered and if the second track matches gimme dilute it will bring up the menu as well. So the menu functions are fairly standard for what you'd expect. You can dispense from each cassette. Print out stats. Which includes remaining bill count and of course exit. So to add my own functionality I've added a few inline patches where basically you patch in a few assembler stubs of the functions you want to hook. That stub calls functions in external DLL and executes any overwritten instructions and continues as normal. So this could be done dynamically but the fact that these specific ATM vulnerabilities allow me to replace the entire firmware and all the different executables I can make these patches permanent which is far more reliable. And it's also a lot easier on ARM as every instruction is 32 bits long. So I place hooks at the card reader, the pin pad and the parser that handles the remote configuration commands. So with those hooks we can add some fairly handy features, save the track data, capture the pin pad and a few custom remote commands. So get the track data remotely, sure, remote jackpot, might as well. So I blitz through these because there's a fair few demos I need to get through. So I may as well put my money where my mouth is now I suppose. There we go. So I guess there's a pun there somewhere. Let's start with the remote stuff first. All right. All right. All right. All right. Okay. So we can start by adding a group. So we'll make the group DEF CON, can now add an ATM, my ATM, location I guess would be on stage at DEF CON. And so even though I support both modem TCP IP, I just have this wired over crossover cable just for the ease of demonstration really. Okay. So of course I can test the bypass which is important. This will allow me to ensure that the authentication bypass. Bypass actually exists but won't modify anything on the system. So I'm going to attempt connection, connected, testing ATM authentication bypass, success. Now if you just want to quickly flick over to the ATM there and get that on screen. Is that possible? So all that's shown on the ATM is that RMS processes, just is RMS process basically. That's all. That's all that's seen. Okay. Now let's go back to the computer now please. Now of course the best is to be able to upload the rootkit which will leverage that same authentication bypass to get there. And I'm just going to reiterate that this is default on every single one of these ATMs. So I'll play the final version of Scrooge. Connects, sends the authentication bypass, access, initializes the software upload and now Scrooge is actually uploading to the ATM. That port is just default. Say again? No, I mean that's the port that they specify in the manual which interestingly enough can't be changed either. Okay. If we could flick back to the ATM now. So basically once the rootkit is being uploaded, the ATM should reboot. It just says RMS process. So it realizes someone is managing the ATM. They just don't realize that it's not legitimate, I suppose. There we go. So the rootkit got uploaded. The ATM is rebooting. So now as it boots up, it should have my rootkit surreptitiously running in the background. Okay. Just let me know when that boots back up. Well, I tried to cover the vendor's name, but what can you do? . Can I take one of those mics over there? Okay, so as I said, there's two ways to pop up this remote menu. One is by the gimme the loot cards and the other is by a special key sequence. So let's try it. . Okay. So it pops up my hidden menu there. Well, let me dispense 50 notes from A, B, C, or D, which are the four cassettes on the ATM. Print out statistics like I told earlier. So let's just try dump 50 bills from the first cassette. . . So these actually double as invites to the freak show party, by the way. So, yeah, you can pop up the menu by the card, but also by entering the special key sequence. And there you go. . . . . Okay. Can we go back to the computer again? So you've found this ATM, but of course you have no idea where it is. So that's where we can retrieve the ATM settings. Again, uses the authentication bypass. It's received the settings, saved them to disk. So at the top here you can see the master passwords for my ATM, Barnaby's ATM. I actually don't live at 123 Kiwi Street, by the way. But, yeah, so it has your location, the master passwords, as well as the phone numbers and also the IP address. . . . All of these attacks have actually required someone to be at the ATM, and I require a volunteer from the audience now. Is Brandon actually here? I think he has a specific card created for this. By the way, it was just any volunteers would have had all their credit card details displayed on the screen, so you have to be careful before you raise your hand. Yes, that's actually another interesting point. So they build the cameras, you can have the cameras built into these machines, but via this remote management you can actually turn off the cameras or retrieve the images or even replace the images. So... Thank you. Thank you. Thank you. Did you get your card back? Okay. So I assume Brandon knows how to use an ATM, so he's just entered his card. Okay. We'll stay on the computer for one sec. So now I should be able to remotely pull the track data. So this should have captured anyone's card that's been entered in there. Now you can see it captured the Gimme the loot card, which was my original one to pop up the menu. Brandon's card, Doctorate of the Bustacardi. I've never seen a credit card that says Leet, Leet, Leet, Leet, Leet, Leet, Leet, Leet, Leet, Leet, Leet, Leet, Leet before. Fair play. Okay. If we go back to the ATM again, please. Now of course you can't... You have to add the remote jackpot. It would just be rude not to, really. So let's try that one. It's connecting. Sending the... Will you have a winner and go down to the dispenser? What's that? Yeah. Oops. Oops. So I'll talk about that briefly at the end if I have time. But, yes. Okay, so, oh, actually, I almost forgot about the other ATM. I'm sorry. So you remember that the attack on the other ATM, actually, let me just make sure I have the correct firmware on it. One sec. Okay, so as you remember, the attack on the other ATM is to simply pop open the compartment with your master key, insert the USB that has the correct firmware. I'm not very good at this. It takes me a while, but it should hopefully be in within three seconds. So that's the attack essentially carried out on that one. I don't know if we could zoom in on that one. Actually, that's probably about perfect, yeah. It takes a while to boot ARM processors. You know, ARM9 is not the fastest. Now, you're going to have to forgive me because this was tailored originally for Black Hat, so there might be a bit of, oh, you'll see. It was also tailored for Vegas as well, which you'll also see. Okay, so that's just the Black Hat logo. It floats around the screen, and it's just doing this. This is the ATMs actually initializing. So right now, this is actually my firmware running on the device. It takes a little while to boot up. These aren't the fastest machines in the world, unfortunately. Any quick questions while this is happening? What's up? How much time have you invested in this? I would say a year here, on and off, you know. It's more of a hobby. Sort of a nighttime job. And if we go... I think it has a better effect if I just open that first cabinet. Yeah, it'll keep doing that. Um, I'm just going to disconnect the sound because it's kind of bugging me a bit. Uh, yeah. Yeah. Yeah. If you just go back to the, uh, computer again. So, countermeasures. So the obvious physical countermeasure, of course, is to prevent the walk-up attack, is to offer upgrade options on the physical locks. And so we have a unique key, uh, for each of the locks. Of course, if you want to take this into your own hands, you could just, uh, you know, drill a hole and put a padlock on it or something. Uh, if a trusted environment is set up which allows any signed executables to be run, this would have prevented the original attack. And although it wouldn't have prevented the attack vector of the remote, uh, it would have added another barrier for uploading these rogue executables. Now, unfortunately, in Windows CE5, implementing the trusted environment isn't as straightforward as it should be. Code has to be introduced into the build. And I think the option to implement a secure environment should be made a lot easier. Uh, but what can you do to now prevent the remote attack? Disable RMS. Uh, high chances are you're not using that functionality. Disable it, and that can be done from the office. Operate a menu. And finally, it's time to give these devices a proper rehaul. There hasn't been a secure development methodology in from the get-go. Uh, so there's, there's, you need to play catch-up at this stage. Have the code audited, penetration tests, implement these best practices from here on out. You know, there's been a noticeable surge in the community I've seen to research these proprietary devices like ATMs. And the simple fact is, these companies who manufacture these devices, you know, they're not Microsoft. They haven't had 10-plus years of continued attacks against their software, which is, for secure development. We've gotten where they are today. So I think it's important we dig in, research these devices, find vulnerabilities, find solutions, and ultimately ensure a more secure future. So, thank you. Thank you.