start	end	text
740	1460	Jeez.
4440	9080	Hi, my name is Zero Chaos. Welcome to the Wireless Village. Do I really need an amplifier?
9080	13980	I am loud enough on my own. But unfortunately, the man behind me is very shy. He's a little
13980	18180	new to the industry. As a matter of fact, he's so new to the world in general that the
18180	23480	first time we met, he thought that I was actually Yosemite Sam. We spent a lot of time talking
23480	27460	online and he said, you know, I thought you'd look different. I imagine kind of a cartoon
27460	35100	man of some kind with a cowboy hat. Fortunately, his weird predilections for cartoon characters
35100	39440	do not spill over into the wireless world, so he actually knows a few things about Bluetooth,
39440	45160	but we're going to have to give him this microphone because he's so shy. He's so shy. It's really
45160	48340	sad. But he's got awesome hair, so here you go, Mike.
49000	55680	Thank you, Zero Chaos. Oh, this is weird. Hey, good morning, everybody. Who here likes
55680	60640	Bluetooth? I like Bluetooth. Bluetooth is awesome. I know a thing or two about Bluetooth.
60640	67420	He wasn't lying. But let's get right into it. Oh, yeah, my name is Mike. I'm a pen tester.
67420	73560	I work for iSEC Partners. Anybody from iSEC here? Hey, iSEC Partners. Yay, part of NCC
73560	78700	group. So before we get started, my standard note, you're going to hear me say Bluetooth
78700	84000	Smart, BLE, maybe Bluetooth Low Energy. They're all interchangeable names for the same thing.
84000	99020	So don't get confused. So this is an NSA playset talk. The NSA leaks... sorry. Game face. Okay.
99020	107380	So, as everybody here knows, last July, there were some minor leaks, and we got a partial
107380	114720	copy of the NSA ant catalog. And that is pretty much a catalog of all their capabilities
114720	122140	for attacking targets. And the best thing from the catalog is, of course, the codenames.
122140	130520	A couple codenames from the actual catalog. Deity Bounce is a Dell BIOS and RAID controller
130520	139720	software implant that allows them to remotely take control. Night Stand is a portable system
139720	145520	that wirelessly installs Microsoft Windows exploits from a distance of up to 8 miles.
145520	152160	A very remarkably specific distance. And so these are some of the tools that the NSA uses
152160	158920	in their SIGINT work to attack targets. Well, the NSA, they're not magical. They're not
158920	164580	privy to any technology that we're not privy to. So we thought it would be a great idea
164580	169100	to reimplement some of their capabilities and maybe introduce a few capabilities of
169100	176540	our own. So here are a couple other playset... other codenames from the NSA playset. These
176540	183920	are created and released by humans, just like you and me. So Twilight Vegetable, that's
184020	190440	a GSM interceptor. I think it's like a Kali image that you just boot up and plug in a
190440	198960	hack RF and boom, you can intercept GSM. And Slot Screamer, which is a tool for accessing
198960	204200	memory on exposed buses. So like Thunderbolt exposed on Mac, you can get into PCI Express,
204200	209380	that sort of thing. So fundamentally, the playset is about... well, fundamentally the
209380	216920	Ant Catalog and the playset are about capabilities. And before we dig into new material, I actually
216920	221260	wanted to talk about the capabilities that we already have in tools that already exist
221260	228160	today. You can plug them in and use them. So here are kind of the tools of the trade
228160	232840	when it comes to Bluetooth and BLE exploitation. You've got Ubertooth, you've got Crackle,
232840	240820	and you've got BlueZ, the standard Linux Bluetooth stack. So Ubertooth 1 is a great device made
240820	247680	by this guy up in the front row who's tweeting instead of paying attention. It is capable
247680	253080	of some pretty cool stuff, like discovering undiscoverable devices. So even if your Bluetooth
253080	259100	is on, even if you're undiscoverable, in a lot of cases, we can still find you. Undiscoverability
259100	264140	is not a security mitigation. It can do some rudimentary BR sniffing. I don't think I'm
264140	268880	telling a lie. And it has very robust BLE sniffing capabilities, which I've spent the
268880	272260	last year and a half talking about. So I'm not going to talk about them today. And actually
272260	278860	right now I'm working on some work in progress of having a complete Bluetooth dongle on the
278860	284260	Ubertooth. So stay tuned for that. You buy an Ubertooth today, you can do at least the
284260	290980	top three right out of the box. That's right, Dominic, right? Rudimentary BR sniffing? Rudimentary.
290980	296720	He says it's fair. So ruling on the field. Crackle is something I talked about a lot
296720	304420	last year. This cracks the BLE key exchange. And once you have the key, it doesn't matter
304420	308600	that they're using really good crypto, because once you've got the key, whatever, if you've
308600	313680	got the best lock in the world on your door, somebody with a key can still open it. And
313680	317660	on top of that, it can also decrypt data if you give it the key. It's not that useful
317660	322560	on its own. It needs to be paired with some kind of a sniffer. It works great with Ubertooth.
322560	329000	If you've got a fancier, more expensive sniffer, it will work with that, too. So again, today,
329000	334760	you go out, you download Crackle, shove some data into it, you can do all this stuff. And
334760	339320	then finally, Blue Z. That's not their actual logo. That's a logo from some club in L.A.
339320	347000	But they don't have a real logo, so I thought this was good. So Blue Z is actually the best
347000	352900	Bluetooth stack in existence, in my opinion. It's better than anything else. And it is
352900	359360	fully functional, basic rate, BLE, and it's able to act as a BLE master and a slave, which
359360	365560	is kind of cool. You think of a laptop as a BLE master, like, oh, you're going to use
365560	370980	the laptop to connect to some peripheral device. But that's not actually the only thing you
370980	378300	can do. You can actually use a regular Linux laptop as a BLE peripheral. You can, say,
378300	384340	pretend to be, like, a smartwatch or a Fitbit or anything. And that's all built into Blue
384340	389120	Z. You have to write a little bit of code, but it's all there. So that's awesome. And
389120	393660	it also comes with some multipurpose utilities for... they're intended to do things like
393660	399620	debugging and, you know, general Bluetooth stuff, but it turns out they're great for
399620	404760	doing recon. And if you want to learn more about that, you should check out my blog or
404760	408540	Josh Wright's got a book coming out this year, which is excellent. I highly recommend it.
409160	415000	So that's it for existing capabilities. Zero effort. You can do all this stuff today, which
415000	422260	is really cool. But moving back on to the Ant Catalog, what kind of Bluetooth capabilities
422560	428360	does the NSA have today? Well, it turns out they don't have any, at least according to
428360	433240	the Ant Catalog that we have, which might lead you to think that even the NSA doesn't
433240	441600	care about Bluetooth. But that's what's called wishful thinking. I'm pretty sure they've
441600	447440	got some pretty nasty Bluetooth capabilities, partially because we probably don't have the
447440	453360	full catalog. We didn't get a complete copy with the leaks. And also the catalog that
453360	459100	we have is really old. It's from like 2008, I want to say. And that's like, you know,
459100	464280	it's like internet years. It's crazy. And one of the main reasons I think that this
464280	469480	is the case is because there's a company called Ellasys, and they make pretty much the Cadillac
469480	475180	of Bluetooth sniffers. It can sniff basic grade, it can sniff EDR, it can sniff basically
475180	481740	anything. It's got built-in capabilities for cracking pins and decrypting audio from headsets.
481740	486860	So the fact that this is available commercially, I'm pretty sure the NSA's got like ten of
486860	492500	these. The only problem for you and me is they cost like $30,000. So, you know, more
492500	499880	like Ellasys, right? See what I did there? So we're in kind of a unique position. One
499880	509800	sec. Everybody look at me while I swallow. So we're in a unique situation where we kind
509800	515100	of have to guess at what the NSA can do based on the capabilities that they have in other
515100	520740	areas and what they're likely to do. So actually, it's kind of a fun exercise. So I'm guessing
520740	524220	they probably have the ability to intercept headsets. Like if you've got a Bluetooth headset
524220	528460	paired with your phone, they can probably listen into your audio that way. And it's
528460	533280	probably easier than trying to listen in on it through a GSM network, because Bluetooth
533280	538740	is pretty simple, even VR Bluetooth. They probably do some surveillance, some movement,
538740	544180	just tracking you based on Bluetooth. I'm going to assume they do some stack exploitation
544180	548300	and remote code execution. And if you're interested in that at all, check out my handset talk
548300	555120	where I did some of that on Android's Bluetooth stack. Remote keystroke surveillance jumps
555120	561500	out at me as something they probably do, because a lot of people use Bluetooth keyboards. You
561500	565740	type a lot of sensitive information in on Bluetooth keyboards. They can probably do
565740	571100	something with that. And as long as they're doing surveillance, it's probably true that
571100	578520	they're doing some injection too. So let's kind of focus on keyboards and mice, because
579560	584120	they're one of the more common Bluetooth peripherals out there. I'm sure a lot of people in this
584120	589480	room use a Bluetooth keyboard or a Bluetooth mouse. So the protocol they use is HID. It's
589480	595580	pretty much the exact same protocol as HID over USB. It's just adapted to work over Bluetooth.
595580	600920	And in fact, the specs for it constantly refer back to the USB HID spec. So it's basically
600920	606640	the same thing. And when you do it over BLE, it's called HID over GAT. So if you see H-O-G-P
606640	613720	or HID over GAT, that's all HID over BLE. So again, keystroke surveillance, if you can
613720	618360	capture the Bluetooth packets that contain these HID reports, you can tell what people
618360	624340	are typing. And furthermore, if you have any Bluetooth injection capabilities, it's pretty
624340	631180	easy to inject HID reports and pretend that you're a keyboard, which is kind of like a
631180	635820	rubber ducky, like a USB rubber ducky, except a blue ducky.
639000	646860	So, the next question that you should be asking is, do BLE keyboards actually exist? And the
646860	653220	answer is, no, not yet. There are some companies producing prototypes that you can get that
653220	657500	work with certain OSs, but there are no commercially available ones that I've been able to find
657500	664560	yet. But these guys are going to exist very soon. Because BLE is cheaper, it's lower power
664560	670040	and it has longer battery life. And the thing is, BLE might totally exist. Like, this is
670180	678180	a commercial BLE mouse that I got off of Amazon and works with any OS that has BLE capabilities
678800	684440	and also comes with a little dongle in case your OS doesn't support it. It speaks BLE
684440	689700	and then turns that into USB HID for the OS. And the pretty amazing thing about this is
689700	697180	that this thing runs off of two AAA batteries for six months. That kind of power consumption
697180	702680	is not possible with classic Bluetooth. And these chips are cheap enough that they give
702680	707720	you a Bluetooth chip inside a dongle that you might not even need to use. It's like
707720	715320	$2. So, from my perspective, BLE keyboards are an inevitability. I mean, the classic
715320	720800	Bluetooth keyboards are going to die out. Everything is going to be BLE. And the thing
720800	724960	about HID is that HID is HID is HID. It doesn't matter if you're a mouse. It doesn't matter
724960	730600	if you're a keyboard. From the OS's perspective, if you speak HID, even if you're just a mouse,
730600	735560	it's likely that you can act like a keyboard. So despite the fact that BLE keyboards don't
735560	739300	yet exist, there's still a lot of possibility in this space.
741100	749660	So, let's talk about targets. If you're trying to attack BLE keyboards and do surveillance
749660	754600	and injection, you have to have an OS that supports HID over GAT. Or you have to deal
754600	758420	with one of these little dongles that comes with it. But this is less interesting. The
758420	764640	OS's that actually have support for this are Android 4.4, BlueDroid. I tested that. You
764640	769920	compare this BLE mouse with an Android tablet, and you get a mouse pointer on the screen.
769920	777460	And it's really weird. I've never seen anything quite like it. iOS 7, only on the iPad. Kind
777460	782540	of an odd limitation. All iOS 7 devices are running pretty much the same OS with pretty
782540	789620	much the same hardware. But only the iPad has keyboard and mouse support. Because, you
791820	797560	know, Mac OS 10.9, native BLE mouse support. You can pair this guy with Mac OS 10.9 and
797560	804480	use it as a mouse. You don't have to use a little dongle. Linux, BlueZ5. So Fedora 20,
804480	809300	Arch Linux, not Ubuntu. These guys all have native BLE over GAT support, or HID over GAT
809300	816000	support. And Windows 8 and Windows Phone 8. Blackberry 10 and Android less than 4.4 don't
816000	822620	have support. So we've got five major OSs that could be used as targets for this type
822620	828860	of attack. And these five major OSs pretty much represent the next couple years of computing,
828860	838960	in my opinion. The one thing about HID is that the HID spec requires encryption. For
838960	842520	obvious reasons. You don't want your keystrokes sent over in plain text, and you need authentication
842940	848040	as well. And the link layer in BLE provides authenticated encryption. Not just encryption,
848040	854920	but actual authentication. And I wanted to take a moment to talk about pairing versus
854920	860080	encryption, because this is a really common confusion point. Pairing and encryption are
860080	866420	not the same thing. Not in classic Bluetooth, and certainly not in BLE. You can have a link
866420	871680	layer connection between two BLE devices, no encryption whatsoever, no authentication.
871680	878880	They can just talk to each other and speak at. Now, if the device is properly secured,
878880	884400	it will reject most requests unless the encryption is enabled. But it's totally possible to have
884400	891280	an unencrypted connection pretty much between any two devices. Now, if you want to have
891480	894620	a secured connection between two devices, the first thing you have to do is pair the
894620	900440	devices, which is a fancy term for doing a key exchange process. Once you've done that
900440	906020	pairing and you've got a shared key between the two devices, then after two devices establish
906260	910860	a link layer connection, either end of the conversation can say, let's start doing encryption
910860	917260	now. And then at that point, they both provide their secret keys and they do all sorts of
917260	920860	little magic. And then since it's authenticated encryption, they can tell that both ends are
920860	925860	using the same key, both ends are encrypted, and that part of the process is actually pretty
925860	930740	secure. The pairing process, as I've discussed in the past, totally broken, totally crackable.
930740	934920	Check out Crackle if you're interested in that. But the main takeaway is you can have
934920	941540	BLE connections without encryption, you can have encrypted connections after you've paired,
941540	948080	but pairing and encryption are not the same thing. Is that clear? Anybody confused? This
948080	953920	guy shook his head no, gave me a thumbs up. Excellent. I like the feedback. So here's
953920	958480	the life cycle of a typical HID device. Say this mouse, you're talking about this mouse.
958600	963660	So a user pairs the HID device with a host. There's a special button sequence that you
963660	968340	can press with this guy that puts it into pairing mode. Then on your host, you search
968340	973180	for devices, you click the mouse, you pair with it, and at that point a key exchange
973180	979300	occurs and the host and the mouse both have the same shared key. There's an authentication
979300	985400	step that, depending on your device's capabilities, you may or may not be able to do more advanced
985400	989960	authentication. Like if you've got a display and a keypad, you can do a numeric comparison
989960	994140	to make sure nobody's man-in-the-middle view. This mouse is not capable of that. It only
994140	998600	uses the just works pairing method, which pretty much provides no man-in-the-middle
998600	1005720	protection even in the best case. Sorry, tangent. Then after that, the host will connect to
1005720	1010740	the HID device. It'll make a link layer connection, which is unencrypted. Then the host attempts
1010740	1015680	to start encryption. It says, hey, let's start encryption. The devices set their controllers
1015680	1022000	to do encryption. They set the key. And once that encrypted, authenticated connection is
1022000	1027460	established, the HID device sends HID reports. The HID device will not send HID reports unless
1027460	1034560	the connection is encrypted. There are a couple attack techniques that exploit weaknesses
1034560	1041880	either in BLE or the host OS or other things. And I'll talk about all three of those in
1041880	1048840	detail right now. So the first technique, you sniff the pairing and you crack the key.
1048840	1053280	That's nothing new. That's just using uber teeth to sniff the pairing, using crackle
1053280	1059380	to crack the key. Once you do that, you can impersonate the mouse and do all sorts of
1059380	1066040	nasty stuff. Exploiting OS weaknesses is cool. And I'll explain that after I do a little
1066040	1069500	diagram of the first one. And finally, forcing on pairing, which a lot of people have been
1069500	1071860	asking me about. It's totally possible. It's pretty cool.
1072300	1080900	So first, sniffing the pairing. You've got your laptop. You've got a BLE keyboard. I'm
1080900	1086680	using keyboards and mice kind of interchangeably here. Just go with it. They establish a connection
1087320	1095180	and they do their pairing and they do a key exchange and everything's golden. Meanwhile,
1095180	1100160	the NSA is listening in with an uber tooth or an ELISA sniffer and they feed that data
1100160	1105100	into crackle, which gives them, so at this point the NSA knows the Bluetooth address
1105100	1115220	of the keyboard. They know the key that's used to secure the connection. Then an evil
1115220	1122200	keyboard comes in, uses the same Bluetooth address, and the same key, and is able to
1122200	1127340	talk to the host device. At this point, the host device can't tell that it's not talking
1127340	1134500	to the original keyboard. And the NSA, or whoever is using this play set tool, can inject
1134500	1140780	keystrokes into the host OS. This is all something that you can do today with stuff that exists.
1140780	1143240	You don't have to write any code to do this.
1144640	1150220	This is the least invasive technique. You cannot distinguish the fake keyboard from
1150220	1154640	the real keyboard. The downside is that you must observe the pairing, and normally that
1154640	1160000	only happens once. And furthermore, even if you do observe the pairing, it's pretty likely
1160000	1163620	that you're going to miss one of the packets that gets transmitted during pairing, and
1163620	1168410	if you don't have every single packet from pairing, you can't crack it. However, as a
1168410	1173270	bonus, you get keystroke surveillance for free. All the data is encrypted with that
1173270	1179550	same key that is exchanged during the pairing. So if you're the NSA and you want to passively
1179550	1181810	observe people, this is the way to do it.
1183110	1188090	So the second technique is OS exploitation. You've got your keyboard and your laptop,
1188090	1193790	they're talking to each other, the NSA did not observe the pairing, everything is hunky-dory.
1195690	1201690	The regular keyboard goes to sleep because you haven't typed on it in a long time. Meanwhile,
1201690	1206750	an evil keyboard comes along, purporting to be this keyboard by using the same Bluetooth
1206750	1211070	address, and it's about as hard to spoof a Bluetooth address as it is to spoof a Mac
1211070	1217650	address, which is, say, trivial. So this guy claims to be this keyboard, and establishes
1217850	1222190	a link layer connection with the host OS. The host OS, the first thing it's going to
1222190	1230450	do is say, hey, let's start encryption. Meanwhile, the keyboard says, sorry, I don't have that
1230450	1236550	encryption key. A properly behaved host OS at this point should disconnect the connection
1236550	1245090	and say, fuck off, we're not friends. Certain host OSes say, nah, don't worry about it,
1245090	1252030	we'll just do unencrypted, unauthenticated communication. And the evil keyboard can inject
1252030	1260050	keystrokes into such a host OS. So this is more invasive. It's distinguished, the evil
1260050	1264610	keyboard is distinguishable from a legitimate keyboard in that it doesn't have the key.
1264610	1270450	So if you're trying to detect this attack, it's actually possible. And it also relies
1270450	1276810	on OS bugs. So it's not universally applicable, but there are two major OSes on that list
1276810	1282710	of targets that have this weakness. And unfortunately I can't name names at this point because disclosures
1282710	1289390	are still in process, but, yeah, it's kind of nasty. And then finally, the last attack
1289390	1296090	is the unpairing attack. This is the hardest attack to do, because most devices don't support
1296630	1301730	unpairing, but some devices do. So you've got your keyboard and your host, they've got
1301730	1308570	a Bluetooth connection going on, evil keyboard comes along, jams the connection, and then
1308570	1313670	forces the devices to unpair by establishing a link layer connection with the host and
1313670	1321410	saying, I don't have that key. Well, certain hosts in this situation will not try to do
1321410	1325670	an unencrypted connection, will not say buzz off, they'll say, you don't have the key?
1325670	1330990	Let's pair again. The only host I've found that has this problem is the little dongle
1330990	1336590	that comes with a mouse, but if you're using a little dongle that comes with a mouse, you've
1336590	1342590	got this problem. This is the most invasive attack. You can totally detect it because
1342590	1348730	you're pairing with some wrong person. You just paired with the NSA, which is bad times.
1349050	1353310	It's also the least broadly applicable. Like I said, this is the only device that I've
1353310	1359810	found that this works with. So the user could notice that this is happening. Do you think
1359810	1369800	the user is more likely to blame the NSA or their shitty Bluetooth keyboard? So that brings
1369800	1377020	us to Tiny Alamo, my entry into the NSA play set. And because every NSA play set thing
1377020	1381780	needs to have a sweet code name, I came up with mine. It actually handles all three scenarios.
1382000	1387500	So I've got keystroke injection working in all three of the scenarios that I just described,
1387500	1392320	and I even implemented DuckyScript from the USB rubber ducky, so you can reuse all of
1392320	1399140	your favorite USB rubber ducky scripts. And now that brings us to the demo. So I have
1399280	1404740	a victim laptop up here, very nicely provided by Dominic. So I'm going to switch the projector
1404740	1411140	over to that keyboard, and I'm going to plug in the dongle that came with this Bluetooth
1411140	1426960	mouse. And yeah, that works. So what's going to happen here is, so this mouse is paired
1426960	1432360	with the dongle that he's plugging in right now. What I'm going to do from this laptop
1432360	1439860	here is do the last attack, the forced unpairing attack that I just described. So I'm going
1439860	1445420	to run some code on this laptop. It's going to impersonate this mouse using its Bluetooth
1445420	1451420	address, and it's going to say, hey, I'm not just a mouse, I'm actually a keyboard, and
1451420	1463420	try to inject keystrokes. So let's see if that works. So this is all pretty much turn
1463420	1469140	key. It takes about 15 seconds right now. And oh, there it's connected, there it's sent
1469140	1492540	the key. So yeah. So yeah. Yeah, can you just switch it back? Yeah. The code's not
1492540	1508040	available yet. We're working on it. Thank you, Dominic. Great. This is the best projector
1508040	1514140	I've ever used. So I can't name any names right now. I really wish I could tell you
1514140	1518900	which host OSes are broken, but we just got the disclosures out to them. I'm probably
1519600	1523860	going to get in trouble for demonstrating as much as I have, but I'll take that risk.
1524380	1528560	So these are the ingredients that made that attack possible. It took one regular Bluetooth
1528560	1535680	dongle, a Linux kernel capability called HCI user socket, SCAPI, some new code called PyBT,
1535860	1542120	a little bit of Python glue, and optionally you can use an Ubertooth. And before I go
1542120	1548100	on, the neat thing about this is you can use, you could actually implement this attack on
1548280	1553280	a phone. It doesn't require any specialized hardware. All it needs is a regular Bluetooth
1553280	1561920	dongle. So this is a pretty nasty attack. So HCI and HCI user socket are kind of key
1561920	1567980	to this. HCI is the language that all Bluetooth dongles speak. It's sort of a high level language
1567980	1573500	for telling the Bluetooth dongle to do things like set the Bluetooth address, enable advertising,
1573500	1577100	try to connect to this guy, that sort of thing. It's all high level operations. They all speak
1577100	1582280	pretty much the same language. And you can actually sniff this using a recent version
1582280	1586280	of Wireshark. You can fire up Wireshark and see all the HCI commands that your Bluetooth
1586280	1593680	stack is sending out to your dongle. So you can also send totally illegal stuff this way.
1593680	1598080	And if you're interested in that, check out my CanSecWest talk where I use this to fuzz
1598080	1604800	some Android stacks and actually implement an attack using it. HCI user socket is the
1604800	1610900	magic that makes it easy. Normally the kernel does a lot of HCI for you on Linux and it
1610900	1614980	kind of gets in the way if you're trying to break the rules. So HCI user socket is a capability
1614980	1619640	that just tells the kernel, get out of the way. I will handle all the details of talking
1619640	1626340	HCI. I don't need you. And this is something that a guy named Marcel Holtman, the BlueZ
1626340	1631980	maintainer, implemented about eight months ago and it's finally made it into the main
1631980	1636660	line Linux kernel. So if you're running a recent Linux distro, you have this. You can
1636660	1644960	just with a Linux 3.15, which is available on Ubuntu 14.04 and Fedora 20 and Arch Linux,
1644980	1650880	you can use HCI user socket to do low-level Bluetooth attacks. I will note that Kali is
1650880	1656720	still using 3.14, so you're not going to have this capability there. And this is actually
1656860	1660680	a screenshot of Wireshark sniffing some of the HCI that's going into the controller.
1660680	1668760	So you can see it's writing some extended inquiry requests and setting BLE scan parameters
1668760	1672220	and stuff like that. So if you're interested in playing with HCI and doing these low-level
1672220	1677600	attacks, fire up Wireshark and see if you've got an interface like Bluetooth zero and just
1677600	1682080	start sniffing it and you'll learn a heck of a lot about it. And if you don't have a
1682080	1686540	recent enough Wireshark, you can use HCI dump, which comes with BlueZ since like ten years
1686540	1690520	ago. And that'll produce capture files that Wireshark can open.
1690520	1696300	The next ingredient is SCAPI. Who here has used SCAPI before? If you didn't raise your
1696300	1702880	hand, get out of this room. No, but seriously, check it out. SCAPI is really, really, really
1702880	1709780	good for not just Bluetooth stuff. It's actually really good for any kind of IP packet construction.
1709780	1715980	It makes it really easy to construct both valid and totally invalid packets. So definitely
1715980	1721140	check it out. It actually had some Bluetooth capabilities before, but I added a whole ton
1721140	1724160	of crap to really flesh it out and make all this possible.
1724160	1729000	So before, it had some rudimentary HCI and L2 cap support. I added tons of commands.
1729000	1735240	I added support for the security manager protocol, which is how you do BLE pairing, and ADD and
1735240	1740600	GATT, which are the high-level Bluetooth protocols. And I also added support for the Bluetooth
1740600	1745940	user socket. So if you want to use HCI user socket, that's how much code it takes. It's
1745940	1754140	super, super awesome. So I pushed the Bluetooth stuff to those guys in a pull request, and
1754160	1759720	I think eventually it will make it into their main branch. But if you want to check this
1759720	1764460	out, just talk to me after the talk. Or be patient.
1765000	1768840	And then the other ingredient that makes this work is some software that I haven't released
1768840	1773240	yet called PyBT. So in the process of doing this, I was just kind of hacking on Scappy
1773240	1779380	and adding HCI commands and stuff, and it turns out I accidentally had a Bluetooth stack.
1779380	1786620	So PyBT is pretty much a pure Python Bluetooth stack that uses Scappy for constructing packets
1786620	1790920	and sends them off to HCI user socket. And this guy supports... right now it only supports
1790920	1797760	BLE, but it has full pairing and key management support. It has a rudimentary GATT server.
1797760	1801620	And this software is coming soon, once the disclosures get cleared up. It will probably
1801620	1804700	be on my company's GitHub, but I'll tweet about it when it's available.
1804700	1810560	But this is... so BlueZ is already a really good, really hackable Bluetooth stack, but
1811320	1816500	it's too well behaved. It tries to handle all the edge cases in a way that won't cause
1816500	1821280	your system to crash, instead of making it super hackable. So having this all available
1821280	1826880	in Python makes that a lot easier. So check this out once this is available.
1826880	1831640	And some people were asking about unpairing attacks earlier. This is where I've done all
1831640	1839400	my implementations of BLE unpairing attacks. So you can try doing it in BlueZ. I don't
1839400	1846240	recommend it. Hack on PyBT instead. And then the last thing is Ubertooth, which
1846240	1852960	is an optional component that makes it really, really a lot easier. So what Ubertooth can
1852960	1858640	do is pull addresses out of the air. It's not always necessary. A lot of times you can
1858640	1864320	get away with just doing a regular BLE scan using HCI tool, which comes with BlueZ, but
1864320	1869940	that will miss a lot of addresses that are otherwise right for the picking. So I recommend
1869940	1875360	using an Ubertooth, because nobody uses BLE private addresses correctly. There are some
1875360	1879920	super awesome privacy features that are a part of BLE, but literally nobody is using
1879920	1885540	them properly. So you can just pull addresses out of thin air, which makes it super, super
1885540	1893720	easy to impersonate devices. So kind of wrapping it all up and putting it all together to do
1893720	1899660	the attack that I just demonstrated, use an Ubertooth to grab the Bluetooth address out
1899660	1904480	of the air. I didn't do that because I just know this mouse's Bluetooth address. I kind
1904480	1911580	of cheated. But there are enough moving parts. You launch PyBT, and that will talk to your
1911580	1916880	legitimate Bluetooth dongle via HCI user socket that builds up all the packets using Scappy,
1916880	1922520	and it pretty much acts like a regular Bluetooth stack up until this point. It's like, oh,
1922520	1929180	set my advertising parameters, set my Bluetooth address, all that sort of stuff. And then
1929180	1933080	it starts to advertise with the address of the mouse. You just send a couple of HCI commands
1933080	1939220	and it will do that. You wait for the connection from the host, and then when the host says,
1939220	1943920	hey, let's start doing encryption, you say, you send a message that says, sorry, I don't
1943920	1951240	have the key. At that point, you start sending key strokes and you profit. That clear? Any
1951240	1956260	steps that you need more explanation on, please let me know. I had like eight pieces of sushi
1956260	1966200	for lunch, so I'm not firing on all eight cylinders. Okay. Yeah. That's a really good
1966200	1970720	question. So the question was, if the other mouse is active, do you have to wait for that
1970720	1977220	connection to die or kick it off or what? So, yes. The other mouse cannot be connected
1977220	1981880	when you're trying to do this attack, but there are two ways you can get around that.
1981880	1987220	The first is that these guys tend to put themselves to sleep after there hasn't been movement
1987220	1992840	for a little while to save battery life. And the other thing is, I've got some pretty robust
1992840	1996900	jamming code that I haven't published yet, but it's pretty easy to jam a Bluetooth connection
1996900	2005980	or BLE connection, rather. That was a really fast presentation. I'm wrapping it up. So
2005980	2011040	these are some URLs that you should check out. We've got Ubertooth, we've got Crackle,
2011040	2016460	we've got Scaffy, we've got Blues, and I'm going to give a tweet for PyBT as soon as
2016460	2023900	that's available, which will probably be not too long from now. I don't know. I was trying
2023900	2028720	to send out disclosures during the week where everyone is at Black Hat and doesn't have
2028720	2035160	their word computer, so maybe next time I should start a little bit earlier. I see lots
2035160	2039140	of cameras, so I'm going to sit on this slide for a little while. I see more Isaac people
2039140	2062950	show up. Hey Isaac! Question? A full MAC address is 6 bytes. So the question was, does Ubertooth
2062950	2067630	get you the full MAC address or only the upper portion and the lower portion? That's only
2067630	2072370	in classic Bluetooth. Since we're talking about BLE, you get all 6 bytes of the Bluetooth
2074290	2085330	address. Yeah. BLE doesn't have the same UIP and LAP that classic Bluetooth does. Okay.
2085810	2089510	That's actually pretty much it. I just want to give a lot of people thanks before we clap.
2089510	2094390	Marcel Holtman is awesome. He's the best Bluetooth maintainer in the world and just totally added
2094390	2099410	HCI user socket when I asked him to. Obviously need to thank Mike Osman, Dominic Spill, and
2099410	2104150	the rest of the Ubertooth team for being awesome. I want to thank Marcel Holtman again because
2104150	2109110	he really, without him this would not have been possible. Of course, thank you Zero Chaos
2109110	2113910	and the DEF CON Wireless Village. I forgot to add thanks to Isaac Partners because they
2113910	2127370	actually funded a ton of this stuff. And thank you. And that's it. So this time slot has
2127370	2135250	about 20 minutes left in it. So if anyone wants to beat box, just come on up. Any questions?
2136270	2137790	More from the back.
2143970	2150210	So the question was, does BLE have the same channel hopping problems that classic Bluetooth
2150210	2156210	had? And no, it's way, way, way easier to sniff. Way simpler channel hopping, way easier
2156210	2162010	to sniff, like Ubertooth is a turnkey BLE sniffer, more or less. Mike Osman.
2173680	2179680	So if you crack and spoof the first attack using Ubertooth and Crackle, can you inject
2179680	2183980	keys while the original device is active? No, you can't. You have to either wait for
2183980	2187180	it to go to sleep due to inactivity or jam the connection.
2189710	2193170	More questions. More comments.
2199990	2205830	Have I tried porting any of the existing Bluesey tools over to Pi BT?
2205830	2214210	The other Bluetooth hacking tools, like BT pin crack and stuff from the Stone Age?
2223390	2227390	I haven't tried implementing any other attacks on top of this, but I'm interested in it.
2227390	2230150	So if you come up with a list of capabilities, shoot them my way.
2232470	2236270	I wasn't planning on doing it, but I can try to sniff a pairing conversation since I've
2236270	2238890	got some time to kill here. Unless...
2239550	2243770	Okay. Show off some Ubertooth and Wireshark.
2245050	2247730	Sorry? I've got...
2247730	2255250	So up here I've got three Ubertooth, because in a BLE there are three advertising channels,
2255250	2260150	so a connection can start on any one of those three. You need at minimum three Ubertooth
2260150	2266330	to capture a given connection, under the assumption that these guys can capture every single packet.
2266330	2270690	Which they can't, but this is better. So I'm going to go ahead and plug these guys in.
2279210	2280810	Is Wireshark coming?
2282970	2288690	Okay, so I've got Wireshark set up over here, and I've actually got it capturing from pipes
2288690	2292770	right now, which you can kind of see down here.
2293030	2297630	Wow, this is really hard. I use a track point most of the time, so this touchpad sucks.
2298850	2304510	So Wireshark can capture from pipes, so if you've got anything that produces PCAP files,
2304510	2307770	you can plug it into Wireshark directly, just by having it use pipes.
2307790	2311530	The next version of Wireshark should actually have an interface that simplifies this a whole bunch.
2311530	2316550	It's something I worked on with Mike Hershaw, but that still hasn't made it into the main branch yet.
2316570	2320130	So I'm going to start these guys capturing.
2324150	2325630	Give me one second.
2354490	2358990	Okay, so what you're looking at now are just tons of Bluetooth packets that are flying by,
2359990	2363230	from BLE advertising packets from devices that are in the room.
2363910	2366750	I could put up some Wall of Sheep stuff if you want.
2369940	2373320	So I just turned on this mouse, and I'm going to put it into advertising mode.
2376430	2379830	And you'll see some packets just start screaming by in a second.
2380530	2384210	They're not screaming, but... oh yeah, they are. You just can't see it.
2384210	2387190	So I'm going to plug this into Dominic's laptop.
2388790	2392850	And now, if we're lucky, we'll actually see a connection.
2395390	2397710	I don't know if we caught it this time.
2399330	2401410	I don't think it's actually paired yet.
2405410	2408570	I know it's thrilling watching packets come by in Wireshark.
2412210	2415410	Okay, so it paired. I don't think we caught the conversation.
2415410	2422290	So Wireshark 1.12 has BLE support built in.
2422290	2427030	So you can actually expand this and look at what the actual BLE packet looks like.
2427030	2432470	And you can see somebody's... oh, this looks like somebody's tracking beacon.
2432470	2434650	I mean, Fitbit.
2440220	2446700	Okay, so right now I'm filtering on the pairing protocol for BLE, and that's not working.
2446700	2451520	So I didn't catch an actual connection.
2451620	2452940	So I'll try this again.
2453840	2459700	So, Ubertooth is a pretty robust BLE sniffer, but it's not as good as a dedicated device.
2459960	2463080	So I'll try that one more time before giving it up.
2468320	2470420	So these guys should be pairing now.
2470420	2475000	I got a pairing request, but it's not all the packets.
2483060	2489660	So if this works, we should see about ten packets come by that are all the pairing packets.
2489660	2494120	I don't think this is working right now, because we're only seeing the one.
2496080	2500440	Try one last time. One more try. Third time's the charm, right?
2500660	2505040	Kill this. Kill this.
2506620	2514680	But I highly recommend anybody who wants to do some BLE sniffing, you should get not one, but three Ubertooth.
2516280	2519020	And by the way, Mike, I'll be accepting beers later.
2524920	2528320	Yeah, if you really want to go overboard, you could get 79 Ubertooth.
2530500	2534040	I highly encourage everyone to get 79 Ubertooth.
2536160	2540560	Yeah, and call Dominic. What's your day rate, Dominic?
2542920	2544860	More than 79 Ubertooth.
2547200	2550300	79 Ubertooth, one laptop. That sounds like a shock site.
2554720	2555600	Okay.
2556600	2560280	If anybody has like a lucky rabbit's foot or something, throw it at me.
2564840	2566660	A lucky rabbit's foot?
2568320	2569640	Lucky beer bottle?
2570700	2573540	Maybe something a little bit less solid.
2579720	2583460	Actually, I'd also appreciate it if somebody played Yackety Sax right now.
2586220	2590080	We got every packet that we needed, except for one.
2590080	2599520	So a full pairing conversation consists of a pairing request, a pairing response, two pairing confirms, and two pairing randoms.
2599520	2606520	And unless we get all of those packets, we cannot actually decrypt the key.
2606520	2614480	But what I can show you is what the actual unencrypted and encrypted data looks like.
2617140	2620240	.dataheader.length greater than zero.
2620400	2622700	Oh, that's not what I want to do.
2634850	2641070	So you can see all the packets that we've captured here. These are the non-zero length packets.
2641790	2647930	Long story. So this is the encryption request that we get immediately following the pairing conversation.
2647930	2654830	And then these unknown packets, unknown data, these are the encrypted L2CAP packets.
2654830	2661270	So if we had that one missing packet, we could crack the key and decrypt all these guys.
2661430	2666090	And Crackle does that totally automatically. It's pretty nice.
2666390	2676130	So I gave it three tries. If you guys want to see it again, we should sit down somewhere where I don't have a microphone, and we can try this until it works.
2676570	2679250	But yeah, I'm done. Thank you very much.
2679250	2679650	.
