1 00:00:00,000 --> 00:00:01,020 Alright. 2 00:00:10,670 --> 00:00:12,830 Alright, so we finally made it. 3 00:00:12,830 --> 00:00:17,130 I want to give a big thanks to my mate Alex who flew over from Europe. 4 00:00:17,130 --> 00:00:21,750 He road-tripped the ATMs with me in an Escalade from San Jose to here. 5 00:00:21,770 --> 00:00:25,870 The whole time I'm thinking, please don't get pulled over, please don't get pulled over. 6 00:00:26,490 --> 00:00:31,630 Two ATMs in the back of an Escalade and about 6,000 notes of novelty currency. 7 00:00:31,630 --> 00:00:33,470 What are you boys up to, mate? 8 00:00:34,630 --> 00:00:37,630 We made it, we got into the casino, so we're all good. 9 00:00:38,030 --> 00:00:41,370 The attraction to target ATMs is fairly obvious. 10 00:00:41,370 --> 00:00:42,890 I mean, they're full of cash. 11 00:00:42,970 --> 00:00:46,770 But for myself, it's kind of part of a bigger picture and a bigger plan. 12 00:00:46,770 --> 00:00:52,590 And that's to explore systems that, when compromised, have direct and immediate consequences. 13 00:00:52,770 --> 00:01:02,730 You know, society relies on various proprietary systems, whether they be ATM machines, medical devices, smart meters, parking meters, or the computer system in a vehicle. 14 00:01:02,730 --> 00:01:04,750 It's important to research these systems. 15 00:01:04,750 --> 00:01:07,810 Particularly, they're often not designed with a secure methodology. 16 00:01:07,950 --> 00:01:12,610 As a result of that research, we can use that knowledge to design better and safer products in the future. 17 00:01:13,830 --> 00:01:15,050 So, my goal. 18 00:01:15,150 --> 00:01:21,990 The goal of the talk is to spark discussion on the best ways to remediate and prevent the attacks that I'm going to be demonstrating. 19 00:01:22,030 --> 00:01:26,070 The goal definitely isn't to give a cookbook recipe on how to hack ATMs. 20 00:01:27,210 --> 00:01:31,010 I find the process of finding vulnerabilities a little bit more interesting anyway. 21 00:01:31,010 --> 00:01:32,690 The journey, not the destination. 22 00:01:32,690 --> 00:01:36,130 Although, the destination is pretty cool in this one. 23 00:01:36,390 --> 00:01:42,490 And I hope to change the way people look at devices that, from the outside, are seemingly impenetrable. 24 00:01:44,090 --> 00:01:45,710 So, current attacks. 25 00:01:45,710 --> 00:01:48,390 The skimmer, which is certainly a fan favorite. 26 00:01:48,770 --> 00:01:52,550 A small overlay that slides over the card slot and the pin pads. 27 00:01:52,610 --> 00:01:57,370 Manufactured to blend seamlessly with whatever particular ATM it's manufactured for. 28 00:01:57,370 --> 00:02:01,350 Designed to both capture the track data on the cards as well as the pin numbers. 29 00:02:01,650 --> 00:02:04,090 And, you know, technology in some of these is no joke. 30 00:02:04,090 --> 00:02:06,150 Data that gets transmitted over GPS. 31 00:02:06,370 --> 00:02:08,270 Some even have tamper protection. 32 00:02:08,310 --> 00:02:12,270 They wipe themselves and find out and send the remaining data back to the attacker. 33 00:02:12,990 --> 00:02:14,590 Physical theft and ram raids. 34 00:02:14,590 --> 00:02:24,710 You may have all seen those YouTube videos where a couple of good old boys hurl through the front window of a store, attach a chain to an ATM and the other end to their pickup truck and take off with it. 35 00:02:24,710 --> 00:02:30,210 Not the most subtle of attacks, but that's ninja status compared to some of the other ones. 36 00:02:30,610 --> 00:02:32,990 And we have card trapping and card snooping. 37 00:02:33,030 --> 00:02:44,470 Card trapping where someone will insert a small shim, commonly known as a Lebanese loop, into a slot, traps the card, and they're designed in such a way that when the card's read, it'll be read but won't be returned to you. 38 00:02:44,470 --> 00:02:50,310 Often combined with shoulder surfing to get your pin, or they'll get your pin in ways that may not be quite as friendly. 39 00:02:50,310 --> 00:02:55,550 Then safe-cutting and frontal attacks, basically going at the ATM with a pair of pliers and a blowtorch. 40 00:02:56,610 --> 00:03:00,230 Explosives, which is surprisingly popular, which I find a bit odd. 41 00:03:00,450 --> 00:03:05,610 The attacker's literally tying a bunch of explosives to an ATM and blowing the crap out of it. 42 00:03:05,930 --> 00:03:12,070 Now, you'd think blowing up an ATM would be somewhat counterproductive, but this is bigger than Australia, so go figure. 43 00:03:12,570 --> 00:03:13,870 Sorry, Australians. 44 00:03:16,930 --> 00:03:18,710 And data breaches. 45 00:03:18,710 --> 00:03:22,810 Hacking the backend, so hacking the bank processor, harvesting the card data. 46 00:03:22,810 --> 00:03:27,630 An example of this would have been the compromise of the Royal Bank of Scotland's Wellpay backend. 47 00:03:27,750 --> 00:03:31,710 Certainly the safest and was the most technically sophisticated attack that I've seen. 48 00:03:31,710 --> 00:03:34,310 I think about 9 million was stolen during that attack. 49 00:03:35,690 --> 00:03:37,890 And then I guess we have miscellaneous. 50 00:03:39,190 --> 00:03:40,070 Other. 51 00:03:40,390 --> 00:03:53,510 So there would have been the default passcode attack from a couple of years back, where if the operator password was left unchanged on the machines, you could reprogram the ATM to think there was a lower denomination in the machine than there actually was. 52 00:03:53,510 --> 00:03:57,130 So you could probably think it's full of $5 notes, but it's really full of 20s. 53 00:03:57,130 --> 00:03:59,890 And I'll be adding some more to the other category. 54 00:03:59,930 --> 00:04:03,930 Practical attacks, which in my opinion blow John Connor's mind right out of order. 55 00:04:05,810 --> 00:04:10,270 So I've picked standalone ATMs, and there's a few reasons for that. 56 00:04:10,270 --> 00:04:12,750 First off, they're pretty easy to get a hold of. 57 00:04:12,750 --> 00:04:16,630 You jump online, and like anything on the internet, you just add to cart. 58 00:04:17,770 --> 00:04:21,670 Getting the ATMs delivered to your house, though, is actually quite interesting. 59 00:04:21,990 --> 00:04:26,070 I had the ATM delivery guy literally wheel in one of the ATMs. 60 00:04:26,950 --> 00:04:30,090 And he came in, he's like, why on earth do you need an ATM in your house for? 61 00:04:30,090 --> 00:04:38,970 And I was feeling a little bit cheeky at the time, so I just looked at him like, oh, I don't like the transaction fees, mate. 62 00:04:43,710 --> 00:04:46,590 And he just kind of shook his head and went on his way. 63 00:04:48,550 --> 00:04:56,510 But also, they're everywhere, you know, every bar, convenience store, market, and they're often in secluded areas, you know, they'll be out by the restroom, tucked away in corners. 64 00:04:56,510 --> 00:05:01,970 But I will be discussing attack methods for both stand-alones and hole-in-the-wall ATMs. 65 00:05:02,050 --> 00:05:08,270 I'll go over walk-up style attacks, but then I'll shift focus to a far more important vector, and that's remote attacks. 66 00:05:08,350 --> 00:05:11,990 And particularly what an attacker can leverage through a successful remote compromise. 67 00:05:12,210 --> 00:05:15,930 And when I say remote, I mean remote default, because that's the only way to roll, really. 68 00:05:17,490 --> 00:05:24,370 So just to get an idea of how popular these ATMs are, this is just one block on my street from a bit of a pub crawl. 69 00:05:26,510 --> 00:05:33,430 I must say my favorite is the guy who owns a Mexican restaurant here, holding his bottle of Tapatio over the top of the ATM. 70 00:05:33,850 --> 00:05:36,470 It doesn't exactly look chuffed to be there, though. 71 00:05:40,610 --> 00:05:44,970 So this is standard specs of a new model retail-style ATM. 72 00:05:44,970 --> 00:05:47,670 Generally Windows CE running an ARM processor. 73 00:05:47,810 --> 00:05:52,650 Our new models support both TCPIP and dial-up by default, optional wireless. 74 00:05:52,650 --> 00:05:56,070 When I say wireless, I mean CDMA, not 802.11. 75 00:05:56,070 --> 00:05:59,370 So no drive-by ATM attacks, unfortunately. 76 00:05:59,370 --> 00:06:02,890 Though it would be kind of cool to ride by and just have ATMs spit out cash. 77 00:06:03,450 --> 00:06:06,530 Although maybe the Grug could possibly do something with this. 78 00:06:07,290 --> 00:06:09,990 SSL support and a triple-desk encrypted PIN pad. 79 00:06:09,990 --> 00:06:18,650 So the PIN pad performs all the encryption within the device itself, has anti-tampering mechanisms, and I may talk a bit more about that beast a little later. 80 00:06:20,270 --> 00:06:23,070 So this is a typical ATM internals. 81 00:06:23,070 --> 00:06:30,490 A bit hard to see, but there's a receipt printer over to the right, a card reader, and there's a serial interface that leads down to the safe, which is wired to the dispenser. 82 00:06:30,890 --> 00:06:38,490 And there's various motherboard inputs, multiple USB, SD cards, the network connection, and some debugging ports. 83 00:06:38,570 --> 00:06:41,970 On this one, there's actually a cover in there that's protecting the circuit board. 84 00:06:41,970 --> 00:06:48,910 I simply just removed it for photo purposes, but I guarantee both of these ATMs are completely untouched and completely unmodified. 85 00:06:48,910 --> 00:06:57,110 Now, funnily enough, all the ways that an ATM could possibly be disrupted, it was actually almost my cat who took it down for me. 86 00:06:57,290 --> 00:07:09,930 I had a USB keyboard plugged in and he was chasing a moth or something, and he ripped out the USB port and then pulled out the processor plug-in at the same time, but luckily the only damage was the USB plug that was easily soldered back in. 87 00:07:09,930 --> 00:07:11,370 But anyway, bad kitty. 88 00:07:13,870 --> 00:07:19,430 So in my opinion, a presentation shouldn't really be a full-blown technical tutorial. 89 00:07:19,710 --> 00:07:26,250 So I'll be following up later with a white paper that goes into more technical details. 90 00:07:26,250 --> 00:07:33,450 But rather than digging deep into the ins and outs of C internals, I thought I'd sum up the security hurdles I faced with this quote. 91 00:07:33,570 --> 00:07:37,030 We were concerned about protection, but not about security. 92 00:07:37,030 --> 00:07:40,250 We weren't trying to design an airtight system like Windows NT. 93 00:07:40,250 --> 00:07:46,110 And this is from Thomas Fenwick, who was the creator of the Windows CE kernel. 94 00:07:46,110 --> 00:07:52,270 And this quote came from a book called Inside Windows CE, which is interviews with the core developers of CE. 95 00:07:52,350 --> 00:07:58,550 And it's an interesting read on the design approach that was taken, but essentially there were not many roadblocks. 96 00:07:58,550 --> 00:08:03,490 The technical information I think lends itself better to a white paper, which I'll be following up with. 97 00:08:04,890 --> 00:08:16,750 So before we can even think about giving that dude from Terminator 2 a run for his money and actually start devising attacks, the first step is to be able to interface with the ATM and gain access to the file system. 98 00:08:16,910 --> 00:08:22,050 So once we have access to the file system, we can then pull the executables and be able to do some reverse engineering. 99 00:08:22,650 --> 00:08:28,330 Now unfortunately, when the ATM boots, it boots directly to its own proprietary application, so there's no explorer shell. 100 00:08:28,450 --> 00:08:30,790 And we need a shell to be able to make things easier. 101 00:08:30,890 --> 00:08:36,670 Originally, I suppose naively, I thought I could just plug in a keyboard and alt-tab, but of course that wasn't to be the case. 102 00:08:36,670 --> 00:08:40,510 But to get a shell, we'll need to have explorer execute at boot time. 103 00:08:42,570 --> 00:08:46,410 So the CE application boot sequence is fairly straightforward. 104 00:08:46,410 --> 00:08:57,450 The kernel nkexe runs filesys.exe, filesys sets up the registry and file system, and then it executes the applications that are listed in the registry key, hklm, and that. 105 00:08:57,450 --> 00:09:01,530 So the trick is to patch the application we want, execute it into that boot list. 106 00:09:02,990 --> 00:09:07,030 So of course we want to get explorer into the boot list, and there's two approaches basically. 107 00:09:07,030 --> 00:09:11,310 The first approach assumes you have a copy of the CE ROM image. 108 00:09:11,710 --> 00:09:15,870 The registry file can then be extracted, modified, recompiled into the image. 109 00:09:15,870 --> 00:09:20,310 This requires a way to rewrite the flash, whether it be serial, ethernet, JTAG, or what have you. 110 00:09:20,610 --> 00:09:23,870 The other approach is to patch in explorer while you're debugging. 111 00:09:23,890 --> 00:09:28,030 And this of course requires some sort of debugging capability, JTAG, ethernet, serial, et cetera. 112 00:09:29,030 --> 00:09:34,070 So I decided to go with JTAG, because it's a fairly straightforward way to accomplish our goals. 113 00:09:34,270 --> 00:09:39,730 JTAG is a hardware debugging interface, which essentially gives you unrestricted debugging access to the processor core. 114 00:09:39,990 --> 00:09:48,810 Now the hardware to do this used to be pretty pricey, but these days with OpenOCD and some of the open source projects, you get the needed hardware for less than a hundred bucks. 115 00:09:49,130 --> 00:09:54,490 Now with JTAG access, you can remotely debug with GDB, debug the kernel, the boot loader, and so on. 116 00:09:54,490 --> 00:09:57,230 Now JTAG has been talked about to death, and I won't dwell on it. 117 00:09:57,230 --> 00:09:59,690 There's a lot of resources online with a lot more information. 118 00:10:00,830 --> 00:10:03,990 So here's just the hardware debugger connected to the motherboard. 119 00:10:03,990 --> 00:10:11,250 Now it's probably obvious, but the use of hardware debuggers and things of that nature have absolutely nothing to do with the ATM attacks that I'll be demonstrating. 120 00:10:11,250 --> 00:10:17,230 They're simply used to initially gain access so we can then go on to find real vulnerabilities. 121 00:10:21,110 --> 00:10:26,090 Speaking of JTAG, I actually learned a valuable lesson when I was messing with one of the ATMs. 122 00:10:26,090 --> 00:10:35,590 I had the JTAG hooked up and I was screwing around and I accidentally wiped out a massive chunk of the firmware and overwrote all the ATM files on it. 123 00:10:35,670 --> 00:10:40,990 Now at the time I couldn't get a hold of the software to reflash it because I wasn't an ATM distributor. 124 00:10:41,070 --> 00:10:45,990 So I actually had to call a licensed ATM technician to come around to my house. 125 00:10:48,330 --> 00:10:53,210 Now three guys arrive and of course they ask again, you know, why are these ATMs in your house? 126 00:10:53,210 --> 00:10:56,330 And I say, oh, I haven't moved them into my store yet and all this type of thing. 127 00:10:57,030 --> 00:10:58,570 But anyway, see, what happened? 128 00:10:58,570 --> 00:10:59,950 How did you remove all this? 129 00:10:59,950 --> 00:11:03,750 Oh, I had it on a card, I was trying to change a splash screen, it all just wiped out. 130 00:11:03,750 --> 00:11:06,290 He's like, yeah, no, they'll do that, they'll do that. 131 00:11:08,790 --> 00:11:11,770 You know, so he starts going to work on the ATM. 132 00:11:11,770 --> 00:11:13,790 I'm like, firmware, what is that, mate? 133 00:11:14,090 --> 00:11:15,710 Acting completely stupid. 134 00:11:16,070 --> 00:11:19,050 He ends up teaching me a hell of a lot about hacking ATMs. 135 00:11:19,050 --> 00:11:21,310 I got his business card, we kept in touch. 136 00:11:21,310 --> 00:11:25,850 Unfortunately, after this presentation, that relationship may be severed. 137 00:11:27,950 --> 00:11:31,550 Oh yeah, so the lesson is always back up the firmware first. 138 00:11:33,610 --> 00:11:36,890 So now that we can debug, we need a way to inject. 139 00:11:36,910 --> 00:11:40,910 With the debugger connected, simply set a breakpoint on create process. 140 00:11:42,030 --> 00:11:48,630 And the opposite was found by simply dumping the memory from the ATM and just doing a byte compare to an offline version of Core DLL. 141 00:11:48,890 --> 00:11:56,150 Now when working with the ARM processor, the parameters when they pass the function are passed in registers before they utilize the stack. 142 00:11:56,150 --> 00:12:00,570 So R0 will have the first parameter, which is the executable, what you want to execute. 143 00:12:00,570 --> 00:12:07,450 We simply replace that string with what would normally be the ATM executable and overwrite it with explorer.exe. 144 00:12:07,450 --> 00:12:16,170 Now if explorer doesn't exist on the image, then you can just put a copy of explorer on a removable drive and pass that full path to create process. 145 00:12:17,290 --> 00:12:19,990 And so then you get a shell on the ATM. 146 00:12:19,990 --> 00:12:26,810 When I first was playing around with the ATMs, I was quite excited just to have a little shell on them, so I had them playing movies and whatnot. 147 00:12:27,110 --> 00:12:32,430 But not really surprisingly, ATMs are pretty crap for playing movies. 148 00:12:33,070 --> 00:12:38,170 Slow frame rate and the 6-inch screen, so it will not be replacing the flat screen. 149 00:12:40,470 --> 00:12:46,950 So now with Explorer, we can plug in a USB drive and a keyboard and copy off the files for reverse engineering. 150 00:12:46,950 --> 00:12:50,170 Then we can modify the registry so Explorer will always boot. 151 00:12:50,370 --> 00:12:59,270 Now remote debugging with JTAG over GDB is not the ideal way to debug a Windows machine, so the next step is to set up a better debugging environment. 152 00:12:59,330 --> 00:13:07,090 And there's a way to debug Windows CE applications without having ActiveSync installed, and that's to debug with Visual Studio over Ethernet. 153 00:13:07,090 --> 00:13:19,870 So you simply build an empty project, overwrite the local executable with the executable from the device that you want to debug, set the correct TCP settings, copy the file over, run it under the debugger, and you have application debugging with Visual Studio. 154 00:13:19,990 --> 00:13:28,070 So now finally we have everything in place to be able to reverse engineer the software to locate vulnerabilities, but to also test any software that we create for the ATM. 155 00:13:29,410 --> 00:13:31,170 So planning an attack. 156 00:13:31,170 --> 00:13:33,950 There's a fairly limited attack surface really. 157 00:13:33,950 --> 00:13:43,730 We have the card reader, but assuming we have an overflow or some other string-based attack via the card tracks, there's a limited amount of characters and a very restricted character set. 158 00:13:43,730 --> 00:13:48,730 So I'm not going to say it's not possible, but I will say it would be unlikely to be practical or reliable. 159 00:13:49,190 --> 00:13:55,010 The keypad, another long shot, but maybe there's possible master passwords or backdoors left in by the developers. 160 00:13:55,310 --> 00:14:00,990 Then the network, so any open ports, an answering phone line, any options for a remote attack. 161 00:14:01,470 --> 00:14:06,410 And we also have the various inputs on the motherboard itself, but of course this requires access to the motherboard. 162 00:14:08,210 --> 00:14:17,090 So 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 SCAC, I made this little device. 163 00:14:17,170 --> 00:14:26,250 It's basically an electromagnet wired up to an amp which is connected to a media player, and you create a web file which is created to simulate the data on a magnetic stripe. 164 00:14:26,290 --> 00:14:34,610 The electromagnet, plug into the ATM, flick the switch, play the web file, and the ATM will think of magnetic stripes being read. 165 00:14:34,610 --> 00:14:37,350 Technically it works fine, but it was actually bugger all help. 166 00:14:40,050 --> 00:14:43,990 So the goal, of course, is to execute code on the ATM. 167 00:14:44,590 --> 00:14:46,790 So I'll talk about these walk-up attacks first. 168 00:14:46,810 --> 00:14:51,450 Now the cash dispenser is housed at the very least by a safe, if you take the cheapest option. 169 00:14:51,450 --> 00:14:53,970 If you spend a bit more, you can get even more heavy-duty protection. 170 00:14:54,090 --> 00:14:59,710 The motherboard, on the other hand, is protected by a one-key-fits-all lock. 171 00:15:01,730 --> 00:15:11,890 And this is actually standard practice across the boards, and these keys, like almost everything else on the internet, are easily available to add to cart. 172 00:15:12,670 --> 00:15:20,850 And, funnily enough, there used to be Diebold keys, last year when I was looking, but they've since vanished, but I'm sure with a little creativity they could be found. 173 00:15:20,890 --> 00:15:25,390 As you can see, most manufacturers take this approach. 174 00:15:27,650 --> 00:15:29,150 So, the walk-up attack. 175 00:15:29,150 --> 00:15:33,670 So now with your master key, you have access to the USB slots and what other inputs. 176 00:15:33,670 --> 00:15:40,210 So you can pop open the motherboard compartment, insert a USB key in a couple of seconds, a lot faster than installing a skimmer, right? 177 00:15:40,510 --> 00:15:45,110 Now, even though the attack time here is short, there's still the possibility of being detected. 178 00:15:45,270 --> 00:15:49,130 But, you know, I suppose that's a great thing about these retail and stand-alone type ATMs. 179 00:15:49,130 --> 00:15:53,390 They're out by the restrooms, they're out of sight, off by the SIGGY machine or something. 180 00:15:53,730 --> 00:15:57,950 And I suppose then there's that psychological aspect of using an ATM machine. 181 00:15:57,950 --> 00:16:00,550 It's kind of considered rude to look over someone's shoulder. 182 00:16:01,090 --> 00:16:04,830 Unless, of course, you're a criminal, and then he would probably learn a trick or two anyway. 183 00:16:05,450 --> 00:16:08,670 Now, all ATMs need a way to upgrade their firmware. 184 00:16:08,750 --> 00:16:12,190 And this is most often leveraged via their removable drives. 185 00:16:12,190 --> 00:16:20,010 So the ATM application checks the drive for a valid upgrade, the valid firmware is found, upgrades, install whatever we decide to add in there. 186 00:16:20,130 --> 00:16:23,870 Now, of course, the firmware is typically a proprietary format. 187 00:16:24,130 --> 00:16:31,590 There are checksums, encryption, and the algorithms are easily figured out by reversing the code on the ATM side. 188 00:16:31,910 --> 00:16:37,610 So once you can create your own firmware package that adheres to the correct format, well, then you can upgrade. 189 00:16:37,610 --> 00:16:40,370 But upgrade with a few modifications, of course. 190 00:16:41,830 --> 00:16:46,070 Now, the most important attack is the remote attack. 191 00:16:46,070 --> 00:16:53,290 Now, most, if not all, ATMs that run on a Windows-based OS support some form of remote monitoring or remote configuration. 192 00:16:53,610 --> 00:17:01,730 So this allows you to log into your ATM remotely, review or change the settings, get stats, change the splash screens, and so on. 193 00:17:01,730 --> 00:17:06,250 Another quite useful feature is the ability to remotely upgrade the software. 194 00:17:06,350 --> 00:17:10,910 Now, this is sometimes a feature, but always something you can leverage if you have a vulnerability. 195 00:17:11,210 --> 00:17:15,210 Now, obviously, authentication is required to be able to do anything useful. 196 00:17:15,470 --> 00:17:27,110 With the particular model I'll be demonstrating, both a serial number and a remote password are required, and they're both made up of a combination of numbers and letters, and a five-second delay is forced after each connection attempt. 197 00:17:27,110 --> 00:17:29,570 So a brute force is basically out of the question. 198 00:17:29,570 --> 00:17:35,230 So we require vulnerability within the authentication process, and it just so happens. 199 00:17:35,890 --> 00:17:37,830 So let me introduce Dillinger. 200 00:17:37,990 --> 00:17:43,470 Dillinger is my remote ATM attack or administration tool, whatever way you want to look at it. 201 00:17:43,470 --> 00:17:46,050 Dillinger named after the bank robber, of course. 202 00:17:46,730 --> 00:17:54,690 So we've talked about loading code on a local ATM machine with a master key and a flash drive and the correctly formed firmware, you're basically set. 203 00:17:54,690 --> 00:17:58,650 But the obvious drawback here is you have to interact with the machine itself. 204 00:17:58,650 --> 00:18:04,850 So the ultimate win would be able to execute code or load code remotely, and that's where Dillinger comes in. 205 00:18:05,090 --> 00:18:10,350 So Dillinger takes advantage of a fairly severe vulnerability in the ATM management capability. 206 00:18:10,870 --> 00:18:20,070 And interestingly, although most operators don't use the remote monitoring, it's enabled by default on this particular manufacturer, so shushing! 207 00:18:20,390 --> 00:18:31,170 Now, typically to log into the machine remotely we require the knowledge of the serial number and the password, but due to an awesome vulnerability, I can bypass all authentication on the device. 208 00:18:31,590 --> 00:18:33,930 And the remote attack is 100% reliable. 209 00:18:34,710 --> 00:18:38,970 So Dillinger supports TCP IP and it supports dial-up as well. 210 00:18:39,130 --> 00:18:49,370 And I heard through a fairly knowledgeable source that most of these stand-ups, stand-alones, about approximately 95% of them are still on a dial-up connection. 211 00:18:49,470 --> 00:18:57,510 Now, of course, back in the day, finding an ATM over the phone line would be a long process of nights and nights of wall dialing, but thanks to tools like H.G. 212 00:18:57,510 --> 00:19:01,550 Moore's Wallbox, you can map out modems on exchange in a matter of hours. 213 00:19:01,550 --> 00:19:05,750 Then write a custom tool to find the ATM responses and you're away. 214 00:19:07,970 --> 00:19:09,370 So, Dillinger features. 215 00:19:09,370 --> 00:19:13,570 So Dillinger will allow you to manage an unlimited amount of ATMs through its interface. 216 00:19:13,710 --> 00:19:20,890 You can add a group, say you add a city, under the city you add each individual ATM, either its IP address or its phone number. 217 00:19:20,890 --> 00:19:25,110 Now, the heart of the tool, of course, is the authentication bypass that it exploits. 218 00:19:25,110 --> 00:19:27,890 And this is the stepping stone to be able to do anything useful. 219 00:19:28,470 --> 00:19:37,410 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 the remote ATM in any way or leave any trace. 220 00:19:38,050 --> 00:19:42,390 So, the obvious problem with finding a remote ATM is that you have no idea of the location. 221 00:19:42,570 --> 00:19:48,930 So, Dillinger can pull the ATM settings from the device which includes all the master passwords but it also includes the receipt data. 222 00:19:48,930 --> 00:19:53,950 And you know when you use an ATM at the bottom of the receipt, it always has the location or the name of the business. 223 00:19:54,670 --> 00:19:58,450 So, even if it doesn't have the exact location, it will have the name of the business. 224 00:19:58,950 --> 00:20:02,770 And, of course, the best feature is to upload my rootkit. 225 00:20:03,190 --> 00:20:12,650 Again, bypasses all authentication, initializes the software, uploads the rootkit, and then basically lets me overwrite the entire firmware of the device. 226 00:20:13,370 --> 00:20:17,730 So, in general, someone is going to need to be at the ATM if you want to get any sort of payout. 227 00:20:17,730 --> 00:20:23,590 So, again, I added a feature so it would be possible to carry out an attack without ever visiting the ATM at all. 228 00:20:23,590 --> 00:20:30,550 So, when someone inserts a card, the track data is captured and saved and I can then retrieve that track data remotely. 229 00:20:31,050 --> 00:20:34,510 And finally, the remote jackpot, which kind of speaks for itself. 230 00:20:36,650 --> 00:20:43,950 So, Scrooge is the ATM rootkit developed specifically for ATMs running on Windows CE. 231 00:20:44,110 --> 00:20:48,030 Scrooge implements the typical rootkit technology you'd expect. 232 00:20:48,030 --> 00:20:51,950 Hides itself and its friends by various CE system hooks. 233 00:20:52,050 --> 00:20:54,130 Hides itself from the process list. 234 00:20:54,130 --> 00:20:57,850 Hides itself from the file system by hooking syscalls and filtering the results. 235 00:20:58,210 --> 00:21:06,230 And there's a hidden pop-up menu which can be activated by both a special key sequence on the ATM or by inserting a card with custom track data. 236 00:21:06,750 --> 00:21:11,270 Now, it'll run on any ARM or XScale based ATM, Intel with a few tweaks. 237 00:21:11,270 --> 00:21:19,770 Originally, I was designing for both Intel and ARM, but it turns out that CE on x86 is actually pretty rare and basically non-existent in the ATM world. 238 00:21:20,410 --> 00:21:28,430 So, the code for interfacing the ATMs has to be customized for the different ATMs as they all use different peripherals and kind of non-standard ways of communicating. 239 00:21:29,710 --> 00:21:31,110 So, Scrooge's hidden menu. 240 00:21:31,110 --> 00:21:35,950 I just use a standard set windows hook filter to capture the side buttons on the ATM. 241 00:21:36,190 --> 00:21:42,110 Although set windows hook is actually undocumented in CE, it still exists and it works as expected. 242 00:21:42,330 --> 00:21:51,390 So, a combination of keys will trigger the hidden menu and it's varied enough not to be launched by accident, but maybe if there's a kid playing around with the ATM, he may end up scoring big, who knows. 243 00:21:52,270 --> 00:21:56,090 And the card reader is hooked by an inline detour style patch. 244 00:21:56,090 --> 00:22:05,230 So, this is where you essentially patch a branch instruction into a piece of code you'd like to intercept, the branch jumps to your code, your code executes , then returns the original function. 245 00:22:05,750 --> 00:22:14,270 Now, with the hook in place, there's a check on the read buffer for track data that matches gimme the loot, and if it matches, the menu is brought up in that way as well. 246 00:22:14,470 --> 00:22:16,890 So, the menu functions are fairly standard for what you'd expect. 247 00:22:16,890 --> 00:22:21,970 You can dispense from each cassette, print out stats, which include the remaining bill count, and you can exit. 248 00:22:24,010 --> 00:22:27,710 So, yeah, to add my own functionality, I've added a few inline patches. 249 00:22:29,170 --> 00:22:32,790 Essentially, you can patch a small assembler stub into the functions you want to hook. 250 00:22:32,910 --> 00:22:39,210 The stub then calls a function external DLL, overwrites any overwritten instructions, and then continues as normal. 251 00:22:39,390 --> 00:22:48,170 This could be done dynamically, but the fact that the ATM vulnerabilities allow me to replace the executables entirely, we can make these patches permanent, which is actually far more reliable. 252 00:22:48,450 --> 00:22:52,230 And it's also a lot easier on ARM, as every instruction is 32 bits long as well. 253 00:22:52,670 --> 00:22:58,190 So, I place hooks at the card reader, the pinpad, and the parser that handles remote configuration commands. 254 00:22:58,230 --> 00:23:05,990 So, with those hooks, I can now add my own handy features, so I can save the track data, capture the pinpad, have a few custom remote commands. 255 00:23:05,990 --> 00:23:07,730 So, pull the track data, sure. 256 00:23:07,890 --> 00:23:09,590 Remote jackpot, might as well. 257 00:23:10,830 --> 00:23:11,490 Alright. 258 00:23:11,730 --> 00:23:19,390 So, there's going to be quite a lot of demos, so I went through that a bit quick, because I think there's probably a good 25 or so minutes of demos. 259 00:23:19,390 --> 00:23:23,830 So, I might as well put my money where my mouth is, or the ATM's money where its mouth is, I guess. 260 00:23:52,730 --> 00:23:55,650 Okay, so this is Dillinger's interface. 261 00:23:58,740 --> 00:24:01,740 I can add a group, so we'll say blackhat. 262 00:24:05,510 --> 00:24:07,670 Add an ATM. 263 00:24:08,950 --> 00:24:10,890 Barnaby's ATM. 264 00:24:13,900 --> 00:24:17,340 Location, onstage at blackhat. 265 00:24:19,040 --> 00:24:27,180 And Dillinger supports both dial-up and TCPIP, so in this case, I'm using TCPIP of course. 266 00:24:28,000 --> 00:24:37,520 By the way, just to reiterate, this is by default remote functionalities enabled on all of these ATMs as they ship out. 267 00:24:38,260 --> 00:24:40,220 This one here at least, not the other one. 268 00:24:46,440 --> 00:24:57,260 Okay, so now I can right-click on my ATM, I can then test the bypass, upload the rootkit, reset to default, get the track settings, get ATM settings, etc. 269 00:24:58,020 --> 00:25:02,020 So, let's see, I'm trying to think if we should switch to the ATM. 270 00:25:02,900 --> 00:25:04,440 You know, not just yet, okay. 271 00:25:04,440 --> 00:25:12,800 So, I can test the bypass, connects to the ATM, testing ATM authentication bypass success, and it disconnects. 272 00:25:14,960 --> 00:25:23,160 Now, we'll actually blow up the ATMs in a sec, but all that shows on the ATMs is just RMS process. 273 00:25:23,420 --> 00:25:25,520 I have to wait till that goes away. 274 00:25:27,720 --> 00:25:32,080 So, it's nothing too noticeable, you know, if you're if you see this ATM. 275 00:25:36,030 --> 00:25:40,910 Actually, if someone close to the thing could let me know when it's gone? 276 00:25:40,910 --> 00:25:41,770 Okay. 277 00:25:42,290 --> 00:25:47,030 So, now, the most important feature, of course, is to upload the rootkit. 278 00:25:48,310 --> 00:26:01,930 So, we'll upload Scrooge, the final version, connects, sends a bypass successful, initiates upload, and it's uploading it to the ATM now. 279 00:26:01,930 --> 00:26:06,410 This is bypassing all authentication in the ATM, and by default. 280 00:26:11,400 --> 00:26:20,460 Now, even though it's over the network, it takes a little while, because they have their own proprietary protocol, which acknowledges each packet, and then has a small delay, and so on. 281 00:26:21,140 --> 00:26:27,060 Proprietary protocol, of course, has its own proprietary encryption, and you all know what happens when people implement proprietary encryption. 282 00:26:27,920 --> 00:26:29,940 It's fairly easy to make your own. 283 00:26:37,460 --> 00:26:44,780 Okay, so, when it finishes uploading, the ATM should reboot, and if we could flick to the ATM now, on the screen. 284 00:27:00,390 --> 00:27:04,910 Takes a little while, Windows CE, you know, it's not the fastest beast out there. 285 00:27:19,380 --> 00:27:22,020 Yeah, if we could just pan out just a bit, too. 286 00:27:29,220 --> 00:27:31,860 If we could get the screen and the dispenser. 287 00:27:38,830 --> 00:27:40,210 Yeah, that's cool. 288 00:27:44,520 --> 00:27:45,520 What's that? 289 00:27:47,320 --> 00:27:49,920 Oh, they'll be spitting money, don't worry about that. 290 00:27:58,100 --> 00:27:59,060 Okay. 291 00:28:00,740 --> 00:28:03,540 Let me make sure I have my little card here. 292 00:28:06,540 --> 00:28:12,900 So, as I said, there's two ways to get the remote menu or the hidden menu to pop up. 293 00:28:12,900 --> 00:28:15,920 One is with special cards with the track data. 294 00:28:15,920 --> 00:28:17,140 So, if we insert... 295 00:28:21,100 --> 00:28:22,060 Okay. 296 00:28:23,300 --> 00:28:26,720 I always say it's 100% reliable, and why doesn't it work? 297 00:28:30,140 --> 00:28:31,220 There we go. 298 00:28:31,460 --> 00:28:34,180 Okay, so that card now has popped up my hidden menu. 299 00:28:34,620 --> 00:28:40,200 You can dispense 50 bills from A, B, C, or D, which are the four cassettes in the dispenser. 300 00:28:40,400 --> 00:28:45,300 You can print statistics, which give you the master passwords and so on, or you can exit. 301 00:28:45,400 --> 00:28:49,500 So, I'll just dispense 50 from the first cassette. 302 00:29:08,070 --> 00:29:12,070 So, these are million dollar bills, but it will... 303 00:29:12,790 --> 00:29:15,250 probably not much use at the craps table. 304 00:29:18,680 --> 00:29:21,700 The other one will spit out a bit of currency. 305 00:29:24,340 --> 00:29:30,800 Okay, so now we can exit, and I said there was a key sequence, which you could also enter to pop up their menu. 306 00:29:34,760 --> 00:29:37,120 These buttons are a bit bugged. 307 00:29:41,260 --> 00:29:42,900 Let's try that again. 308 00:29:44,000 --> 00:29:47,360 I've obviously pressed these buttons a fair few times. 309 00:29:47,360 --> 00:29:48,060 There we go. 310 00:29:48,060 --> 00:29:49,540 So, we can exit from that too. 311 00:29:50,060 --> 00:29:50,840 Okay. 312 00:29:52,520 --> 00:29:55,620 So, can we cut back to the computer? 313 00:29:57,940 --> 00:30:04,920 Okay, and it would be nice to know where this ATM actually is as well. 314 00:30:04,920 --> 00:30:07,580 So, we can retrieve the ATM settings. 315 00:30:07,580 --> 00:30:13,640 It connects, retrieves the settings, and saves them to disk. 316 00:30:18,780 --> 00:30:24,880 Now, you can see, so up here are the passwords to the ATM itself. 317 00:30:25,080 --> 00:30:31,200 I don't actually live on 123 Kiwi Street, by the way, but I do live in San Jose. 318 00:30:31,200 --> 00:30:37,740 And then it has the phone numbers as well as the IP addresses and the receipt coupons and all that type of thing. 319 00:30:40,640 --> 00:30:49,660 Now, of course, one of the greatest things about this is the fact that you can retrieve track data from people who insert cards. 320 00:30:49,660 --> 00:30:51,860 So, would anyone like to volunteer? 321 00:30:55,040 --> 00:30:56,980 Is Brandon here? 322 00:30:58,420 --> 00:30:59,740 There he is. 323 00:30:59,740 --> 00:31:03,300 Brandon, I think, has a custom credit card especially for this. 324 00:31:16,550 --> 00:31:19,150 So, can we flick to the ATM again, please? 325 00:31:26,270 --> 00:31:27,930 Can we cross to the ATM? 326 00:31:29,810 --> 00:31:33,530 Okay, so just insert your card as you normally would use an ATM. 327 00:31:40,150 --> 00:31:42,050 Alright, thank you, sir. 328 00:31:42,370 --> 00:31:44,470 So, back to the computer, please. 329 00:31:45,510 --> 00:31:49,750 So, now, let's see if we can get the track data that he just inserted. 330 00:31:51,610 --> 00:31:56,630 Connects, retrieves the stripe card data, saves it to disk. 331 00:31:58,490 --> 00:32:07,790 Okay, so you can actually see from the first one was the gimme the loot where I actually had my demo card. 332 00:32:07,950 --> 00:32:11,810 And then the next track data, this doesn't look like a credit card, Brandon. 333 00:32:12,390 --> 00:32:16,830 Doctorate of the Bustacardi with the card leet-leet-leet-leet-leet-leet-leet-leet-leet. 334 00:32:24,100 --> 00:32:28,880 But, of course, it will capture any credit card that's entered into the machine. 335 00:32:30,700 --> 00:32:37,280 And finally, the remote jackpot, which is always handy. 336 00:32:37,280 --> 00:32:39,380 So, go back to the ATM. 337 00:32:44,650 --> 00:32:46,870 Issue the jackpot command. 338 00:32:47,470 --> 00:32:48,910 We have a winner! 339 00:33:09,020 --> 00:33:13,960 Now, before I... I'm not going to let the other one get off scot-free. 340 00:33:14,440 --> 00:33:18,000 So, I will quickly demo the walk-up style attack. 341 00:33:18,000 --> 00:33:21,400 Now, I'm not as fast as this as I should be, but I will try it anyway. 342 00:33:22,480 --> 00:33:28,800 So, remember, the walk-up attack is simply popping open the cabinet, inserting a USB, and restarting it. 343 00:33:36,720 --> 00:33:38,360 Right, so that's the attack done. 344 00:33:38,360 --> 00:33:40,740 I wouldn't be spotted if I was out by the restroom. 345 00:33:46,290 --> 00:33:47,910 I think, just for... 346 00:33:48,970 --> 00:33:53,110 just to make it look a little better on stage, I might just open the cabinet here. 347 00:33:53,110 --> 00:33:55,470 Not opening the safe, of course, just the cabinet. 348 00:34:01,450 --> 00:34:04,030 So, the other attack was somewhat practical. 349 00:34:04,030 --> 00:34:08,570 This one, you'd probably end up on World's Dumbest Criminals, as you'll probably see soon. 350 00:34:09,330 --> 00:34:10,690 Okay, so it boots. 351 00:34:10,690 --> 00:34:14,670 Right now, it should be reading the firmware off that USB drive. 352 00:34:28,060 --> 00:34:34,920 It copies the firmware over as it initializes the little BlackHat logo floating around the screen. 353 00:34:35,440 --> 00:34:39,180 Obviously, in the real world, it would be a rootkit, not a BlackHat logo. 354 00:34:41,400 --> 00:34:46,220 So, I kind of tailored this for both BlackHat and for Vegas, as you'll see. 355 00:35:03,910 --> 00:35:06,650 ARM 9 processes are not the fastest. 356 00:35:23,940 --> 00:35:24,420 ... 357 00:35:54,940 --> 00:35:55,420 ... 358 00:35:56,800 --> 00:35:57,280 ... 359 00:35:57,280 --> 00:36:01,600 I just want to see how long it actually takes to dump its entire dispenser. 360 00:36:05,490 --> 00:36:12,470 It will start with million dollar bills and it's going to switch to IOActive currency, which also doubles as invites for the party. 361 00:36:12,470 --> 00:36:13,830 So , 362 00:36:20,280 --> 00:36:22,980 I want there to be a big pile at the end. 363 00:36:23,460 --> 00:36:23,480 ... 364 00:36:23,480 --> 00:36:24,060 ... 365 00:36:55,410 --> 00:36:55,970 ... 366 00:36:55,970 --> 00:36:58,150 It still hasn't got to the IOActive currency. 367 00:36:58,150 --> 00:37:00,210 I should have put that first, I guess. 368 00:37:00,590 --> 00:37:00,970 ... 369 00:37:25,900 --> 00:37:27,380 There we go. 370 00:37:27,680 --> 00:37:28,160 ... 371 00:37:36,780 --> 00:37:40,980 Okay, we can probably flick back to the presentation now. 372 00:37:42,260 --> 00:37:42,820 ... 373 00:37:49,560 --> 00:37:52,040 Okay, so, countermeasures. 374 00:37:54,040 --> 00:37:54,600 ... 375 00:37:54,600 --> 00:37:55,020 ... 376 00:37:55,020 --> 00:37:56,500 The obvious physical... 377 00:37:57,020 --> 00:38:00,620 I may just disconnect the sounds really quick. 378 00:38:00,860 --> 00:38:01,580 ... 379 00:38:12,150 --> 00:38:12,870 ... 380 00:38:13,910 --> 00:38:14,270 ... 381 00:38:14,630 --> 00:38:15,210 ... 382 00:38:28,320 --> 00:38:35,420 So, the obvious physical countermeasure to prevent the walk-up attack is to offer upgrade options on the locks themselves. 383 00:38:35,420 --> 00:38:38,840 So, there's a unique key for each ATM. 384 00:38:38,840 --> 00:38:43,840 Now, of course, if you want to take this into your own hands, just drill a hole and throw a padlock on it. 385 00:38:44,880 --> 00:38:45,320 ... 386 00:38:47,100 --> 00:38:47,540 ... 387 00:38:49,600 --> 00:38:50,040 ... 388 00:38:53,500 --> 00:38:53,940 ... 389 00:38:53,940 --> 00:38:54,460 ... 390 00:38:55,560 --> 00:38:56,000 ... 391 00:38:58,760 --> 00:38:59,200 ... 392 00:38:59,200 --> 00:38:59,740 ... 393 00:39:00,760 --> 00:39:01,200 ... 394 00:39:02,060 --> 00:39:02,500 ... 395 00:39:02,500 --> 00:39:03,260 ... 396 00:39:05,620 --> 00:39:06,500 ... 397 00:39:09,160 --> 00:39:10,560 ... 398 00:39:10,560 --> 00:39:10,960 ... 399 00:39:14,780 --> 00:39:16,180 ... 400 00:39:16,180 --> 00:39:17,040 ... 401 00:39:17,040 --> 00:39:17,060 ... 402 00:39:17,060 --> 00:39:17,120 ... 403 00:39:19,140 --> 00:39:20,540 ... 404 00:39:20,540 --> 00:39:22,560 ... 405 00:39:22,560 --> 00:39:22,900 ... 406 00:39:22,900 --> 00:39:22,980 ... 407 00:39:22,980 --> 00:39:26,520 And finally, it's time to give these devices a rehaul. 408 00:39:26,600 --> 00:39:30,940 There hasn't been a secure development in methodology in from the get-go. 409 00:39:30,940 --> 00:39:37,360 So there's a need to play catch-up, have the code audited, have penetration tests, and implement best practices from here on out. 410 00:39:39,680 --> 00:39:45,300 So there's been a noticeable surge in the community of researching proprietary devices like ATMs. 411 00:39:45,340 --> 00:39:48,840 And the simple fact is that the companies who manufacture the devices aren't Microsoft. 412 00:39:48,840 --> 00:39:52,100 They haven't had 10 years of continual attacks against them. 413 00:39:52,100 --> 00:39:58,360 So the software that Microsoft got forced into a secure development, they've gotten where they are today. 414 00:39:58,360 --> 00:40:02,680 We're talking about devices that were developed without secure principles in mind. 415 00:40:02,680 --> 00:40:10,600 I think it's important to dig in, research these devices, find vulnerabilities, find solutions, and ultimately ensure a more secure future. 416 00:40:10,600 --> 00:40:12,180 So, cheers.