start	end	text
0	4960	All right, let's kick this thing off. So I found out today this was not in Hacker Tracker,
4960	11560	so everybody in here must read the old ink version of the schedule. So thank you for reading the old
11560	16280	paper version and showing up. Today we're going to learn how to break into buildings.
16480	21500	Plain and clear. Why do I like breaking into buildings? I've actually never broken into a
21500	26280	building for context, but when you can do a computer exploit and it touches the real world,
26280	30920	that has always been the ultimate for me. So I played CTF for a long time, done a lot of binary
30920	37020	exploitation, but seeing a pound sign pop up on your screen versus seeing a door unlock is a very
37020	45380	different adrenaline hit. So let's go back through the history and see all the different ways you can
45380	49720	break into buildings with laptops. So first we'll go over access control one-on-one. I'll just
49720	54940	explain how these systems work. That's step one. What a smart card is. This is actually a pretty
54940	59520	overloaded word. Everything looks like a smart card is just a piece of plastic with some
60220	63800	microcontrollers in it. And then I'll go over all of the attacks that we've seen come out over the
63800	69000	last couple decades. And then some food for thought on what the future might look like.
69700	75200	So if you look at a typical access control system, there's only a couple of components. This is the
75200	80240	most complicated system you would ever see. On the left side you'll see that there's a door reader.
80240	85380	This is the little box you tap your card to and it goes boop! And green or red or blue or whatever
85380	91800	color it turns. That then has a couple of wires that run all the way to the secure side into a
91800	96500	controller board that will ultimately make the yes-no decision. So it's going to compare that
96500	102000	number to some database and say, does this person have access? If it does, it opens the door. For
102000	107420	security reasons, if you're using a mag lock, which is just an electromagnet, you'll plug it
107420	113340	in to 12 or 24 volts. That electromagnet will hold the door shut. There's a problem here though,
113340	118560	that if you're on the inside of that building, you cannot get out unless you can pull harder than
118560	124740	that electromagnet, which is typically like 1500 kilograms for a cheap one, and they go way up.
125200	131480	So in the event of a fire, you need a button that you can push to cut the power. This actually was
131480	136100	not deployed well on the initial ones. A lot of people burned to death. So this is like fire
136100	141180	marshal enforced now. Every door that has an electromagnetic lock will have a motion sensor
141180	147900	and an exit button for egress. And by law, it has to be one motion. So if you hit the exit button,
147900	154180	that needs to be all you do, or a big bar. So that comes into play quite a bit when you
154180	160460	see some of the attacks and how to bypass these. So if we take away all the fluffy words and just
160460	164720	look at what this is, it's an Arduino project that any high school or middle school student
164720	171620	could build. There's just three relays. Ultimately, there's one that matters. So on the secure side,
171620	179200	if that relay trips, the power is either turned off or on, and the door will unlock. On the reader
179200	185100	side, there's just a little microcontroller that is going to do something over RF and then send a
185100	191220	number out over Wiegand, which is this unencrypted two-wire protocol that has a data zero line to
191220	196320	encode the number zero and a data one line to encode the number one. Once it gets the other
196320	203440	side, decision is made. The other two things are also just relays. The exit button, when you hit
203440	209640	it, it's just going to cut the power. And the motion sensor, again, when you wave at it, it just
209640	213840	touches a relay. These are either normally closed or normally open.
213840	220920	If you get any of those relays to chip, the door will unlock. So let's look at some of the worst
220920	225680	relay fails in honor of the Olympics. This is not a running relay we're talking about, though. This
225680	231820	is an electronic relay. I'm going to gamble that the internet works and show you how you can trip
231820	238180	these relays in not-so-sophisticated ways. We'll get to interesting computer hacks later, but you
238180	244160	see here in this video the exit button is on the left. You get yourself a nice sturdy piece of
244160	252620	metal, shove that thing through the door, and you just click that relay. Bang, you're in. We'll keep
252620	258240	going up in complexity. This is probably the least advanced way to trip one of those relays.
258780	266540	So I call this the hook key. There's also the magnet key. So if you're aware of the internal
266540	271300	mechanics in a relay, it's just two pieces of metal like this. You touch them together,
271300	276800	the connection is made. You separate them, the connection is not made. So some of these...
277800	283920	this is the locksmith, uh, lock picking lawyer. You hit the pin pad, the door unlocks. You can
283920	290160	literally take a magnet, touch it to where the relay is, and it just clicks the relay. So if you
290160	295260	buy this system, put it on the outside of your building, anyone can just come up with a magnet,
295260	303340	click, click, click, click the relay on. So don't do that. When you install these systems,
303340	308380	make sure the relay is on the inside of the building, not the outside. And then there's
308380	314880	the motion sensor. So for obvious reasons, when there's motion, it's going to trigger.
314960	320320	If you vape, it turns out the smoke in your vape for most of these motion sensors
320320	327300	is thick enough that it will actually trip the motion sensor. And you can just blow smoke through
327300	333880	the crack and walk right through the door. So we'll call these the very unsophisticated,
333880	340920	uninteresting, why the hell did I come to this talk hacks. There are much more fun ways to do
340920	345740	this. Just to note, when you're looking at these systems, so there's the electromagnets that are
345740	351080	huge, chunky electromagnets over the top. There's also electric strikes. So these are solenoids
351080	356800	that are going to have a pin that in its unpowered position is stuck down in the hole.
356900	362580	And then when you power it, it pulls the solenoid out. These are far better for various reasons.
362580	368640	You can't get locked into your building and die. They're a little harder to trip. You can't vape
368640	374380	into these and have them pull a solenoid up. So if you're given an option, you're installing these,
374380	380180	anytime you can put an electric strike. So now let's look at smart cards.
381160	386160	First, we need to answer the question, what do I mean by smart card? There's really, I think,
386160	391180	three different forms you'll see. There's the ones that look like our credit cards that have these
391180	396800	little pads on them. There's ones that are just pieces of plastic that do some RF stuff. And then
396800	404020	there's ones with the mag stripe on the back. So these are all very, very different technologies.
404020	408820	The end goal of all of this is to take stuff from our digital world and encode it somehow
408820	413800	in a physical piece of plastic that fits in our wallet and is the same size as our driver's license.
414520	422160	So if we look at a mag stripe, this one normally fascinates people. The stuff that is stored on
422160	427800	the magnetic strip of your credit card is exactly the data that is printed on the front of your
427800	435200	card. It is just a way to encode ASCII text effectively in a magnetic form. There is no
435200	439880	security involved. There is no encryption. If you want to clone some mag stripe cards,
439880	443720	we have them over in the physical security village. This was like, you know, attempt number
443720	448700	one at, hey, we're gonna use a physical thing to interface with a digital world. There is
449760	454540	nothing interesting or sophisticated there other than some physics with like magnetic poles.
454540	463960	Not smart at all. Then came the prox cards. These you literally just emanate radio waves at them.
463960	468800	They can be passively powered, which is really cool. So the radio waves actually give them the
468800	474940	power they need to power on. And then they respond with a number. You can actually hack
474940	478600	these things with AM radios. I have like a little kit when my sister was like five,
478600	483620	we were playing around and like emulating these kind of smart cards. They are not encrypted.
483620	488060	There is nothing really interesting from a cryptography standpoint going on there.
488180	492580	The only thing to figure out is how they encode the data that coming back. Is it
492580	497040	amplitude shift keying? Is it phase shift keying? How are they encoding the radio frequency? But
497680	502540	at the end of the day, it is just a number. And that number is typically printed on the card,
502540	507360	just to add to the security of the whole situation. These were never intended as a high
507360	512460	security thing. Yet, if you go to most enterprises on earth, including the one my wife works at,
512460	517300	they still use these exact cards today, as does the high rise that my company is in,
517300	522720	in downtown Houston. It's a bummer. Like I saw her come home first day of work, like why?
522720	529740	Like I know where you work. Don't do that. You have sensitive stuff. So then came along
529740	536140	the near field communication cards, NFC or high frequency cards. These run at 13.56 megahertz.
536140	541680	These do have cryptography on them. The way to think of the cryptography on all of these is as
541840	548020	a memory card. There is a symmetric key that is on the card. And if you have it, you can read and
548020	554020	write to that card. And if you don't, you cannot. So there is one key that will let you read and
554020	559580	write data from these cards. Otherwise, I colloquially call them dumb cards. They're
559580	564340	not doing anything sophisticated. They're just memory cards, but they are better than the mag
564340	572780	stripes and the prox cards. So there's going to be a shared key, which that screen still looks
572780	577340	like it's on. So there's gonna be a key on the card and a key on the reader. So for the reader
577340	582780	to read the card, it needs another key, which you can kind of see where this is going. If I'm
582780	588100	deploying, you know, a million of these, that means that that key has to be on all of the readers and
588100	597720	all 1 million cards. Now we look at what is actually considered a smart card. So our credit
597720	603120	cards that look like this with the little chip, these are actually little microprocessors.
603160	610200	They're not microcontrollers. They actually run Java OS. They have a CPU. They have memory. They
610200	615600	have non-volatile storage. They have, you know, dedicated crypto units. And they can do public
615600	622040	key cryptography. So these are actually smart in the sense that we would hope they are and do
622040	629140	proper security things. With the asymmetric encryption, this is much better than the symmetric
629140	633180	key encryption. It means if you break my card, you only get my private key and you're not going to
633180	640220	take down my whole company and be able to clone every employee's card, which is very good for the
640220	645580	scalability point. And I put this diagram there because I think it's interesting that I didn't
645580	650020	realize this until I started hacking smart cards in my career, that these really are just little
650020	656820	embedded systems. There's far more sophisticated stuff in there than I thought. And you can kind
656820	661980	of see the overlap. You have contact cards that speak one protocol. You have contactless cards.
661980	666140	And then you have the dual interface cards, which almost all credit cards are today. You can tap
666140	672600	to pay or you can shove that thing into the credit card reader. And if you look at the specs,
672600	678020	they have 1k mbit flash. There's an EEPROM that speaks I-squared seed and SPI. They have
678020	685160	segmented memory with a 64k bit EEPROM. Pretty decent specs for a credit card.
688080	693000	The way they work is if you look at those pads, only four matter. You have your power and your
693000	698200	ground to power the little computer on. You drive the clock externally, which is interesting from a
698200	703240	glitching perspective. So you control both the voltage and the clock. And then you just have a
703240	708460	single pin for I-O. So as you're driving the clock, use that I-O to read and write commands
708460	714760	and application data units. So APDUs, you're going to send commands. You can actually send
714760	720440	admin commands and install Java applets and manipulate the operating system. Or
721180	725020	unauthenticated commands that are just going to query this thing for a challenge response.
726400	731800	So I got my doctorate in embedded system security, where I was glitching and doing all sorts of
731800	736080	crazy things that break into embedded systems. So smart cards have always fascinated me because
736080	743100	they actually do a very, very good job at physical attacks. So it's common that you would drop your
743100	747820	credit card and somebody could pick it up, right? They can still go make payments, but actually
747820	753600	extracting that key, cloning cards is a big deal. So they actually lay, if you look at the IC
753600	759900	and delid it, between every single layer of logic, there is a layer of mesh that is a destroy
760620	765760	mechanism. If that is tampered and you break a single one of those traces, it actually will
765760	771340	self-destruct the card by deleting all of the sensitive material. They also have to have brownout
771340	776480	detection. Because you're controlling the voltage externally, there are glitching attacks you can do
776480	782020	on embedded systems, where while they are doing computation, you can brown the voltage out. So that
782020	786460	means you're going to take it from your positive five volts to negative five volts. That can make
786460	792140	your D flip-flops go crazy, and you can have an if statement evaluate to true that otherwise
792140	799200	should have been false or vice versa. They also, because you're controlling power, clock, all of
799200	806140	these things, you have to program the logic very specially. So one of these two statements on the
806140	813060	right is correct in an embedded system standpoint. If you're writing this for a computer software,
813060	818880	they're both probably fine. But this is the code to check the pin when I'm entering the
818880	826860	pin to say unlock my debit card. Does anybody have an inkling of which one is better than the other?
833750	841550	We think number two is better. Correct. Number two is better. So the reason that number one would
841550	846450	fall vulnerable on a smart card is because you can do side channel analysis to actually see
846450	852890	if that if statement evaluated to true or false. And what you can do in this attack is that if
852890	858150	you believe it evaluated to false, you cut the power immediately before it has time to increment
858150	863590	the counter and write that to the non-volatile storage. Which means you could then brute force
863590	868230	this with unlimited tries. Whereas if you increment the counter before you do the check,
868230	872490	you can still limit it to 10 or 15 pin attempts, whatever you have.
873110	878530	The awesome part is on these smart cards, this is all actually, they've thought about a lot of this
878530	883730	because it's used for financial transactions in the EU especially. So I read the whole book on
883730	888210	smart card security and these were the highlights that I thought were particularly interesting of
888210	894310	security done well. So before we go break all these, why did we even build these in the first
894310	900430	place? The real problem is that physical keys are one to one. There's one key that opens one door.
900430	905210	If I want 1,000 people to open that one door, they all have the exact same key. And if one of
905210	914370	those 1,000 people is bad and I have to fire them, I now have to give out 9,999 new keys and rekey
914370	920790	that door. So in enterprise, this sucks. Smart cards can be one to many. You can have many
920790	926210	different credentials that get into the same door. It used to be really complicated to carry a full
926210	930730	computer in your pocket. As you can see, modern smart cards are actually little mini computers.
930730	936450	Our smartphones are really big, fast computers. And you can put a picture on them. This should
936450	942350	not be ignored. It is nice that when you come to conferences and things, there is something around
942350	948050	everyone's neck that indicates they are meant to be here and should not be escorted out. So even
948050	952750	all the security and stuff aside, the fact that people have things hanging around the neck that
952750	958170	says that they belong is actually valuable. Enough with all that fluffy stuff. Let's go through
958170	964430	some exploits. That's why we're at DEF CON. So when you're doing a vulnerability assessment, you first
964430	969330	want to ask yourself, what's the goal, right? What's the worst that can happen? So we could use a card
969330	975670	without someone's permission. I could, you know, swipe it out of your back pocket. I can clone the
975670	981310	smart card or I can subvert the need for it altogether. So we already saw at the beginning
981310	985610	some of the ways that you can just completely ignore the card. If you go to the physical
985610	991110	security village, they have many, many, many more ways to get into buildings that have nothing to do
991110	996330	with computer science. And using the card without a person's permission is not particularly interesting
996330	1000950	because you're just stealing the card. There are ways that there are some smart cards that will
1000950	1006350	have like biometrics built into them, you know, other things like that. We're going to specifically
1006350	1014510	focus on cloning the smart cards. So the way it works when you have a good, you know, one of the
1014510	1021170	dumb cards, the 13.5 megahertz, 5, 6 megahertz cards, there's going to be two keys that really
1021170	1027230	have to work together to store this credential. So there's going to be one, an authentication key,
1027230	1032170	an in-transit key that lets you read and write data. And then you can also encrypt the data at
1032170	1039070	rest on the card. So if my employee credential is 1, 2, 3, 3, 4, 5, 6, 8, 9, 0, I will encrypt that
1039070	1045370	while it's on the card. And then I will also have effectively a key that encrypts the in-transit that
1045370	1051970	lets me even talk to the card. It doesn't matter what the key for the encryption on the card is,
1051970	1057290	if I'm just going to clone it outright. So that is worth noting because one of the fixes I'll
1057290	1064150	explain later, they fixed the in-transit key, or sorry, yeah, they changed the in-transit key, but
1064150	1071510	it didn't actually fix the problem. So the whole goal of this, when we're trying to break into
1071510	1076370	buildings with laptops, is just find that dang key. Whatever the key is that lets me read and
1076370	1081870	write data from the cards is game over for that security system. Because now I can walk up next
1081870	1089010	to anybody and just outright clone employee IDs. And in the case that I also know the at-rest key,
1089010	1093870	I can just fabricate whatever keys I want. And if it's printed on the badge, I can just read
1094370	1099690	someone's ID badge walking by and then go become them and just go in whatever door I know they can
1099690	1109870	go into. So how are these attacks done? These are almost all exclusively physical attacks on the
1109870	1116150	cards and their readers first. This one on the MyFairClassic, so this was the most prolific card
1117030	1123070	early in the smart card era. This was used for everything, public transit, cash cards, so you'd
1123070	1128590	actually store money in the value on the card. So breaking these was a really big deal in the
1128590	1133710	research world. There were a couple professors at UVA that actually delidded the chip. They
1133710	1139490	dissolved it in acid and went layer by layer delidding this chip and taking really high
1139490	1146690	resolution pictures that you see here of the actual ASIC, like the the circuitry of the IC.
1146690	1153470	And then they applied image recognition to all of these images to reverse engineer the algorithm
1153470	1159330	that was encoded in that chip. And then from there, we're able to start analyzing, you know,
1160170	1164310	cryptanalysis to figure out if there are any vulnerabilities in the cryptography on these
1164310	1171770	MyFairClassics. Spoiler alert, yes, there was. MyFairClassic at this point is quite broken.
1171770	1177150	Anybody with a Flipper Zero can just go to RFID, read, put it up to the back of the Flipper Zero
1177150	1182730	or to the back of the card, and it will run some version of this program. I wasn't involved in the
1182730	1187410	porting of it, but mostly a user of all these great tools. But this is what it looked like way
1187410	1193590	back in the day in your terminal window. Now it's a very awesome, you know, handheld little device.
1193590	1198070	But you can effectively brute force all of those keys, break the keys. Back to the beginning of
1198070	1201850	the talk, once you have the key, it's game over. You tap any card you're reading and writing.
1202730	1207350	You can again come over to our booth. There's still hotel key cards and public transit cards
1207350	1216110	and things today that are still using MyFairClassic. So in the enterprise environment, there's HID
1216110	1223630	dominated. They were by far the monopolist in, you know, enterprise access control. This thing
1223630	1227770	on the left probably looks very familiar to most of you. They're all around this
1227770	1232150	conference. You've seen them probably in tons of buildings, airports, financial institutions,
1232150	1238770	whatever. Every elevator here has one of these. These use symmetric keys, right? So we go back to
1238770	1243930	how would you deploy a system like this? Every single one of these on Earth that is sold
1243930	1250030	has the exact same symmetric key. Every single card, every single reader has the exact same
1250030	1254850	key. So they've sold millions of these to many different buildings, one of which we are standing
1254850	1262870	in today with the same key. So that would be absolutely terrible if that one key got leaked.
1263530	1269310	It took a while actually to get this key. They did pretty good security. Nobody dissolved the
1269310	1275170	cards in acid, didn't anything like that. Back in 2010, Baloch and Maryak was looking at the
1275170	1280310	back of one of these readers, I think it's the RW40, said, hey, that looks a lot like the pin
1280310	1288250	header on my PIC, my PIC kit, my PIC microcontroller. Turns out the way they secured this system was by
1288250	1293990	flipping pin one and pin three, because, you know, nobody on Earth would ever dream of flipping pin
1293990	1301950	one and pin three on their PIC kit. So he just swapped pins one and pin three, plugged it in.
1302570	1307070	Great. We're debugging it. There is a security feature on PIC, though, where you can't just
1307070	1311390	read memory. That would be catastrophic and extremely dumb. They did not do that.
1311550	1317110	This particular one, though, had a vulnerability where you could wipe individual sectors
1317790	1322410	and write data to individual sectors. So the way this should work is I'm going to write new
1322410	1327630	firmware, I have to wipe the whole firmware and write my own custom firmware. With this little
1327630	1334790	subtlety, you could erase sector zero, write code in there that would dump sectors one through n,
1334790	1341190	and then take another sacrificial reader, delete sectors one through n, and write code in all of
1341190	1347290	those that would dump sector zero. So by sacrificing two of these, you now put all of that together
1347290	1352910	and you have the complete firmware dumped on your computer that you can now analyze with IDA Pro.
1353690	1360170	They stored everything in PIC memory, including those keys. They weren't stored off chip in some
1360170	1365490	sort of secure RAM or anything like that. So once you reverse engineer this go through,
1365490	1372090	lo and behold, the keys just pop right out at you. That's game over. Since these are symmetric
1372090	1377170	keys, now when you go to clone an HID card, there is no brute brute forcing going on,
1377170	1384190	you just read the freaking card. They did add an iClass SE, so if you're in the industry and
1384190	1390010	you see this on the back of your card, the SE I think stands for secure encryption or something
1390010	1396250	like that, but they did encrypt the data at rest on the card. So it used to be you'd use this key,
1396250	1401290	you just read the the credential off, and you could write arbitrary credentials. With the SE,
1401290	1406710	they did use AES, that's good, they used a known algorithm to encrypt the blob on the card,
1406710	1410490	but you can still clone it outright. So if I want to become you, I just tap your card,
1410490	1416450	I take your blob, I put on my card, boom, I'm you. They also had a version that they would upsell you
1416450	1422910	on called HID Elite Class. So what Elite Class would do is it would just change that standard
1422910	1428010	key that's on every door on earth. For your organization, they would give you an organization
1428010	1433650	specific key, and then your cards, your employees would use a different key so people couldn't come
1433650	1439310	up and clone it. Sounds good. Unfortunately, the firmware at this point is, you know,
1439310	1443670	it's not open sourced, but it's out there if you know the right people and know where to look.
1443830	1449410	There were some researchers, Flavio Garcia, a couple other folks, looked at this algorithm
1449410	1455550	and found that there was actually a vulnerability in the way that the elite keys were derived,
1455550	1461250	and they were able to go up to an elite key reader, send I think it was seven failed attempts
1462010	1466050	of cards that wouldn't register at all. The backend, it would never spit them out,
1466050	1470790	they were total failed transactions, and then offline, you could brute force the elite key.
1471010	1476130	So even if you paid to upgrade to the elite key, somebody has had to walk by one of your readers,
1476130	1480370	tap their proxmark, boom, now they have the key, and we're back to where we started,
1480370	1485210	just clone and employee IDs. This was like, I don't know, at least in my career, this is like
1485210	1491450	the coolest, like, heyday couple of years in breaking into RFID things. And all these papers
1491450	1496450	are published, I'm like implementing the stuff as they're publishing it, like emailing these guys,
1496450	1500890	like, oh my god, like, I can't believe this works. Is this a typo? Like, is this algorithm real? And
1500890	1505670	then, yes, it's all real. I've like, wrote these on proxmarks, I wrote a version of Python, wrote
1505770	1511290	a version in C, and now it's all been ported to the Flipper Zero. I think the guy who ported it
1511290	1516710	was hanging out in the RFID village, actually, one of the co-authors. So, like, it's awesome.
1516710	1522730	Like, crazy stuff. Totally works. And people are literally flipping out these days. This used to
1522730	1527230	be something that, like, you know, there was a small group of us that knew about these things,
1527230	1530890	and we'd come to DEF CON, like, hey, you know, talk about these exploits, we had email threads
1530890	1536250	going back and forth. Now it is everybody here is walking around with one of these things on
1536250	1541110	their neck with the ability to just walk into pretty much any door they run, if they find the
1541110	1549170	correct employee, and kind of just nudge into them correctly. So, it is a pretty strange time
1549170	1554330	to be in this world. And that's why we're hosting at the Physical Security Village now, the decades
1554330	1558110	leading up to the Flipper Zero, I'm like, you know, this probably isn't the right time to talk about
1558110	1564150	this. Like, this is a pretty bad exploit. But now that it's commoditized, hey, come play with it.
1564530	1569770	So, the implications of this are actually huge. Most of the employee badges are, like, the world's
1569770	1574410	largest companies. I still today walk around and have friends, and I'm always looking at people's
1574410	1579270	IDs and trying to clone everything. And I have, like, way, way too many, oh, my God, moments,
1579270	1584730	given that this key was leaked back in 2010. Like, there's so many organizations that either have the
1584730	1590230	prox cards with no encryption at all, or still have these standard I-class cards. Like, in Houston,
1590230	1594810	there was a brand new building that was built. I was a tenant there for, like, six months. And on
1594810	1600130	day one, I just, like, cloned the card they gave me and started walking through doors. I'm like,
1600130	1608130	this is... why in 2024 did we just build this and buy this technology? So, there's still security
1608130	1612250	theater, though. So, this actually is interesting. There is something to be said about, like, keeping
1612250	1618290	the honest people honest. And, like, as long as it looks good on paper, you know, you have all
1618290	1622890	these security audits and SOC 2s and things like that, that, like, you do have to do these things.
1622890	1627870	And it is not highly publicized that this is out there. It's highly publicized at DEF CON.
1627870	1632030	But outside of this, you know, there's not big signs, like, your HID reader key was leaked in
1632030	1638550	2010. What version are you running? And it's just an absolute headache for admins. Like,
1638550	1642510	now you don't know if your keys have been cloned. Upgrading these is a huge hassle,
1642510	1646870	because this is your whole infrastructure. These readers aren't cheap. They can go up,
1646870	1651790	like, $1,500 a piece. Not to mention the labor of ripping one out and rewiring it.
1653690	1661030	So, just to take a step back, though, the only common feature here is bad implementation. Like,
1661030	1668530	trying to roll your own crypto, you know, doing things that in the grand scheme, you'd look back
1668530	1672810	and say, that was a terrible decision. I wasn't there making the decision. And normally, you don't
1672810	1677790	realize it at the time. Like, you know, encoding strings that ended in null bytes. At the time,
1677790	1681810	you're writing C, what could go wrong? And now we have buffer overflows forever. So,
1681810	1685810	the design process, I'm sure, never dreamed that it would get to the point where, my God,
1685810	1690730	there's too many of these on Earth and every building can be walked into. But otherwise,
1690730	1697770	the smart card community as a whole has really crushed it. I mean, to attack, like, the DoD
1697770	1704250	CAC or a modern credit card is actually pretty complicated. You'll see attacks here, kind of
1704250	1709050	few and far between. The last one I remember that was quite notable, when I was in the smart card
1709050	1714210	hacking world, there's somebody who found that on SIM cards, they use triple DES to authenticate.
1714850	1718390	And I remember going through this with my colleague and I'm like, man, everything actually
1718390	1723230	does look fine. It looks totally shady. But if anyone used single key DES instead of, like,
1723230	1728850	the triple keys on triple DES, this would be catastrophic. There was a talk at DEF CON that
1728850	1732930	was like, hey, every SIM card for this entire manufacturer only uses a single key and they
1732930	1738290	were just root SIM cards like crazy. Because SIM cards are these cards if you just cut more
1738290	1744570	plastic off and shove it in a phone. But the security of these at its core is actually
1744570	1751830	quite good if implemented well. So, okay, Chad, we have these ultra secure cards. Why don't we have
1751830	1757370	more of them then? Why don't I have one for my credit card? They don't scale well at all. Like,
1757370	1761730	they were intended to have a bunch of applets. We'd all have one card. I'd have my Chad card
1761730	1767970	and it has my bank ID and my gym pass and my employee ID. But the security architecture in
1767970	1773590	this Java OS has almost no isolation and it's pretty terrible. So you can't trust that Gold's
1773590	1779430	gym had the same security standards as Bank of America to throw those in the same memory space.
1779430	1783590	So now I need one card for everything. And if I'm using them to log into websites,
1783590	1788470	now we're talking a huge freaking nightmare, right? I'm gonna have a Rolodex of 800 cards
1788470	1793430	coming in here trying to log into a site. They also require extra hardware, which people don't
1793430	1797990	love. So like, for me to log into this computer with a smart card, I need some little dongle
1797990	1803550	thing that I'm gonna plug into. And then for all, you know, your wallets are just gonna be crazy fat
1804070	1808970	and they have no user interface. This one is actually pretty relevant. So going back to the
1808970	1813770	first attack of being able to use someone else's card, if you drop your smart card, someone else
1813770	1819090	picks it up, they become you instantly. There's no way to verify that. If you had a user interface
1819090	1823850	on there, even with just this, you know, four digit pin, you could pretty much mitigate that
1823850	1829190	attack. A four digit pin with some throttling or some, you know, threshold of five attempts,
1829190	1833090	anyone who picked up that card would be doomed. But these are passively powered,
1833090	1839650	so you can't have interfaces. So this is the research question I've asked myself my whole
1839650	1847110	career. Like, can we do better? I hate passwords, smart cards, things in my pocket. And this was
1847110	1853830	back in, God, I don't know, 2009. I'm like, why don't we use iPhones when they were new? And
1853830	1857930	everyone's like, no one will ever take their iPhone to work. It's a terrible idea. The security
1857930	1865230	on them was bad at the time. But I really do think we're at a point where smartphones can kind of
1865230	1871250	completely eliminate smart cards over the next 10, 20, 30 years. So they actually already put
1871250	1875910	smart cards in every single smartphone today. So if you take that exact chip that I'm telling you
1875910	1880810	that's in the SIM card, that's in your credit card, take all the plastic off of it. It's called
1880970	1884310	a secure element and it is soldered on the motherboard of every single person's phone in
1884310	1888970	here today. And when you do tap to pay, that's where you're interacting with. Everything is
1888970	1894070	stored in that secure element. In fact, all of the initial NFC stuff implemented on phones,
1894070	1898090	they kind of had a hybrid chip that would do NFC plus the secure element. They're just taking
1898090	1902010	everything they knew from a smart card, trying to put in a phone so that you can do your digital
1902010	1908890	payments. The other interesting thing that has unfolded on phones, every modern ARM processor
1908890	1913010	on earth, even the embedded processors, have something in there called a trusted execution
1913010	1919270	environment. In ARM's version, they call it trust zone. So when the phone boots, it boots into a
1919270	1924730	secure world that is your first stage bootloader. In there is where you're supposed to keep only
1924730	1930230	your most sacred secrets and code. So your cryptographic keys, anything you use for
1930230	1935910	authentication, payments, secure world. Then you create a sandbox called the non-secure world,
1935910	1942430	and that's where you let iOS and Android and the operating systems play. So now if iOS gets
1942430	1948750	totally rooted, 100% rooted, exploited, they still cannot touch the code in the secure world.
1948750	1952830	So if you've ever played around with your Android phone, it tells you to push the physical button.
1952830	1957270	That's because that code is, I don't work for Google, but it's very likely running in the
1957270	1962730	secure world, and they're getting the interface from the physical button. Nobody to date has written
1962890	1968490	a driver for all of the touchscreen, all the graphics in the secure world, but you can securely
1968490	1974070	detect, yes, somebody's physically hitting this button and wants to do this thing that is being
1974070	1979810	requested of me. Not just being used by malware or some proximity trying to read your phone.
1981530	1989990	So the future that I am hoping for and literally bet my career on is that we can put all of this
1989990	1994650	cool security that we've learned through the smart card world into these phones that we already carry,
1994650	1999010	and you get really amazing interactions because these can interact with everything. They can
1999010	2003210	interact with the smart card readers we already have, our computers, each other,
2003210	2007850	and then we can replace everything in our wallet with these phones. And once you have a private
2007850	2012130	key store, we can do something more akin to what they wanted to do with the applets, where we
2012130	2016950	actually can store multiple different credentials in here, and I could have my gym pass next to my
2016950	2026070	Bank of America card, next to my Defcon badge, or whatever. So I quit my job in academia, or I
2026070	2031710	declined all my professorship offers, and what I've built since is a company called Authenticate,
2031710	2038850	where we actually do that. We have an app that can talk to door readers. It all uses asymmetric
2038850	2043570	encryption, uses all the good stuff, but can also talk to computers, SSH servers,
2044230	2048770	websites, you name it. You can use that credential for all sorts of different protocols.
2049110	2055530	So I would now welcome any questions about breaking into buildings, or maybe securing
2055530	2060430	buildings if you're into that, as I've since switched my career to go from, I don't know,
2060430	2066270	the fun side to the not fun side of trying to patch all of these holes that I just showed you.
2066270	2081560	So thank you for attending. Question. And I think on time, I am very early,
2081560	2098000	so there's plenty of time for questions. Has anybody broken into the CAC card?
2098440	2103000	That's one of those questions where even if I knew the answer, I couldn't tell you.
2105460	2111420	There is a library that we published when I used to work in Lincoln Laboratory called LLSmartCard.
2111420	2117360	If you want to pull that on GitHub and play with it, it gives you a decent interface in Python to
2117360	2124000	fuzz smart card interfaces over both the contact and contactless interface. So if you want to look
2124000	2128400	for yourself and plug some cards in, it's... and I think we have some templates on there for
2128560	2161500	a Visa card and a CAC card of basic interactions with it. How well do trust execution environments
2161500	2167520	stand up against physical attacks? Is that a downgrade from smart cards that have all of
2167520	2173480	these physical anti-tamper in there? The answer is yes. There are some side channel attacks and
2173480	2178580	things that have been published on tees. The way you would implement this is really to couple the
2178580	2182980	tee with the secure element though. So you would keep all of your keying infrastructure
2183820	2188380	in the secure element. So all of your digital signatures, all of the cryptography, everything
2188380	2192780	is done in the secure element that has all this physical anti-tamper and side channel
2193600	2199820	defenses built in. And you really need the tee specifically for a trusted user interaction.
2199820	2205440	So you really want the tee to disable all of the accelerometers and side channels
2205440	2210540	and then anything that's mildly sensitive interacting with the secure element.
2210540	2219360	But the computation itself should not be in the tee because you don't want RSA side channels.
2219360	2223520	The one thing that I focused a lot of my PhD on, on the tee security in particular,
2223520	2228480	was glitching attacks. So the one thing you can do when you're booting into secure world
2228480	2233380	is if you can glitch at just the right time. This is actually how the Xbox One was hacked.
2233860	2238460	I love it. If that person is here, introduce me to them so I can like hug them and give them a high
2238460	2244200	five. But they actually, you're able to glitch it and skip the part where you would then put
2244200	2248680	everything in non-secure world. So then you could have unfettered access to the secure element
2248680	2254240	and start doing crazier attacks. So I actually looked extensively into how to write glitching
2254240	2260100	resistant code in software only with a clang pass. We published a paper on it. I wanted to call it
2260100	2266280	glitch please in honor of bitch please, but academics don't have the same sense of humor
2266280	2272080	that I do. So I had to change it to glitching demystified or something far more lame. But
2272080	2279600	we did show that in software only you can actually do an LLVM pass and make your code glitching
2279600	2284100	resistant for all practical purposes on your bootloader to keep the the T code at least in
2284260	2315000	a secure world where it belongs. So how effective are the RFID blocking badge holders and little
2315000	2321260	sleeves that they get you? They're very effective. When I was doing this research, that was actually
2321260	2326780	my number one thing I recommended to everybody and probably got the most enemies from. Because
2326780	2332720	I'm like, hey, these things are annoying, but they absolutely work. And I work here. I'm trying
2332720	2338680	to protect, you know, the stuff we're doing. So my favorite ones, they have these badge holders that
2338680	2343140	are plastic, and they're spring loaded, you can put your ID in them that has a Faraday cage in
2343140	2347760	the back. But then you can flip the plastic up, tap your badge and flip it back. Because otherwise
2347760	2352380	you're like in this fight every morning trying to like slide it out of this stupid metal thing.
2352440	2358640	They're not cheap. So they're hard to do at scale. But I don't know, they bought me one because I
2358640	2366120	exposed all this stuff. And they were not happy with me, but happy enough to get me the fancy one.
2366120	2371000	But they totally work, like RFID wallets and stuff. I guess the one thing I didn't mention
2371000	2375780	here, the one attack that can pretty much never be protected against in smart cards,
2375780	2380520	it's called the relay attack. So this is where I would come near you with a software defined radio,
2380520	2384920	I would touch somewhere near your card. And I have my friend anywhere on earth with another
2384920	2390420	software defined radio that just re-emits back and forth. So there's almost no way to defend
2390420	2395440	against that, unless you have some like capacitive touch on the smart card that would stop it.
2395500	2400140	And that's really like those RFID wallets. That's what those are all about. Because somebody could
2400140	2404120	come up to you, you're nowhere near the cash register. Someone else has a Proxmark up their
2404120	2408940	sleeve and then they just bought, you know, a really fancy dinner on you. Thank you very much.
2409060	2413540	So yeah, they totally work though. We've tested them in the lab and they do their job.
2442500	2448460	The question there was about the legal action since the, you know, this key has been leaked
2448460	2454380	since 2010. Has there any been class action suits? I don't know. And I don't know what
2454380	2459820	the law is around that. I actually have a friend who's a law professor in Texas and asked her to
2459820	2465040	speak recently about cybersecurity law in particular. And I came out of that talk with
2465040	2471380	far more questions than I got answers. It is extremely complicated and confusing. It does
2471380	2476900	seem to me though, just like a gut feeling that if there's a security vulnerability, the fix for
2476900	2484760	it should be free for customers. And it should be like strongly advertised, like, hey, you haven't
2484760	2491900	updated yet. Maybe you should consider this free firmware update. So I don't know. I mean,
2491900	2496840	that was part of the reason I also decided to throw my hat in the ring and try to build
2497320	2501140	products instead of staying in my ivory tower, just pointing fingers at people saying you did
2501140	2505980	it wrong. It is really freaking hard though. I will stress building a security product.
2505980	2510840	It is way harder than it sounds when you're on the offensive side your whole career. Like,
2510840	2514500	why didn't they just do this? And then you're on the other side. You're like, oh, damn, that is,
2515040	2520180	that's a lift there. That is not as easy as I made it sound in my publication.
2543120	2547220	Okay. I should have had this in my talk. Is there any way to secure your enterprise today
2547220	2551440	with smart cards that I didn't go over? Yes. A hundred percent. These are just the known
2551440	2556680	vulnerabilities. There are cards like the Dezfire, even like the Mifer Dezfire, Mifer
2556680	2561100	Ultralights. There are cards that are properly, like they're using Dez, they're using AES,
2561100	2565520	they're using good cryptography that is not broken. So you can get these cards with the
2565520	2570860	good cryptographic standards on them and key them to your organization. And, you know,
2570860	2577100	at least for now, there's no known vulnerabilities you're cruising. So yeah, there are card stocks
2577100	2582760	out there. HID even sells Dezfire cards. So it's not that like all of their cards have to be this
2582760	2589220	I-class or, you know, any brand. And most of these readers will read the good cards. So even if you
2589220	2593000	buy off-brand readers, they'll read Dezfire cards, they'll read whatever cards you want,
2593000	2597180	and you can set them up in a way that, you know, someone can't just come up with their flipper.
2597680	2602360	And we plan on our website, if we get time after DevCon, because I get this question a lot,
2602360	2606240	we want to publish all of the known vulnerabilities, kind of like the thumbs down,
2606780	2610880	and then, you know, some of the other card stocks, at least we'll try and keep a record of
2610880	2621280	what's been broken, what hasn't on our website. Any other questions about how to break into
2621280	2629460	buildings? You got me for... I'm legally allowed to stay up here for 10 more minutes before I
2629460	2633920	get ripped off the stage, is what I was told. So we can hang out for a little bit more.
2656570	2660230	This question, I never know the answer to it. Someone's been coming to DevCon forever. How
2660230	2665670	dangerous is it to walk around DevCon without your cards in a Faraday cage? Your credit cards
2665670	2670570	are fine, unless it's a relay attack. There's no known, like, wireless attack that I'm aware of
2670570	2677050	that can just clone cards. If it is your employee badge, I would say if you have a 125 kilohertz
2677050	2682190	card, it's pretty likely somebody here has read that card. Last year in the physical security
2682190	2685950	village, we had the wall of sheep for everybody that would walk in with their prox cards in their
2685950	2693670	pocket, and it caught quite a few people. Yeah, and if you have an iClass card that, you know,
2693670	2698210	if you're a target and someone bumped into you awkwardly, you know, maybe go get a new badge
2698210	2703510	when you get back to work. But I don't know. I generally think that, like, the shenanigans at
2703510	2708110	DevCon is... I hope it's overhyped as someone who's been coming my whole life, but someone
2708110	2713670	did steal something from our village this year, so now I'm like, more on your team. Like, no,
2713670	2719010	there's bad people here. We're not all good. We're not all honest hackers. But, you know,
2719010	2724510	credit cards and stuff, you know, I would put them potentially in, like, a Faraday wallet or something,
2724510	2737620	but you don't need to cancel them. You should be fine. Yeah, well, let's keep rifting.
2759290	2766250	Yeah, so if we... let's say we go from smart cards to phones, what risk would we open ourselves up to?
2766250	2773250	So the biggest one there, and the one that I've spent a lot of my research thinking about, was
2773250	2777810	the software attack, right? Our phones are on the internet. Our smart cards are not.
2777830	2783670	So the question that's kind of been, like, my brain itch for the past 15 years is, like, what if my phone
2783670	2789770	gets hacked, right? Like, that's now an attack factor that wouldn't have existed on a smart card.
2789890	2794750	So that's where the secure element, the trust execution environment, a lot of the hardware
2794750	2800590	architecture that's been built out on these phones. Back to the bad implementation, if done
2800590	2808010	well, if done correctly, you can actually mitigate that software-based attack. It'll never be fully
2808010	2812310	gone, right? There's always gonna be a chance that you didn't have before. It was zero percent chance
2812310	2819550	before. Now it's non-zero, but you really can push it down quite low to the point where, you know, I
2819550	2823810	think my hope is eventually we can use that to, like, vote for the president, right? You could
2823810	2828390	have your government ID on your phone and, like, election day comes out. You don't worry about
2828390	2833850	waiting in some line. You could just cast your vote in some secure way. The physical attacks on
2833850	2838330	the phone are going to be no better than the physical attacks on the card because it's the
2838330	2843270	same chip at the end of the day that you're going to be attacking. So you're not really opening
2843270	2847630	yourself up to another physical interface. But now that you do have all these radios, you have an
2847630	2855350	application processor, you have a lot more other ways to poke on that card remotely. That's the one
2855350	2859950	that I've spent most of my research freaking out about. And if you look at all my publications,
2859950	2865430	we're, like, fuzzing the trusted execution environment on smartphones to figure out are
2865430	2871850	other apps in there secure? You know, if we put our stuff in there, is a neighbor going to be the
2871850	2878950	one that actually crumbles the whole security? So that's the sticky part of putting things on
2878950	2884350	phones. It can be done well, but it's hard and it is going to take people to collaborate, which,
2884350	2921190	you know, and agree on security standards. Yeah. The question was, in 2010, Chase sent out a bunch
2921190	2927370	of, you know, tap-to-pay cards and then actually had a recall on them and had to send out new ones.
2927370	2934130	And the question was, was that because of a security vulnerability? I'm not sure. Probably.
2935030	2940110	That seems like a good reason. I know, like, that is the biggest issue with hardware tokens in
2940110	2944150	general. And back to the counterpoint on phones, you can actually push over their updates to phones
2944150	2949990	where you can't the physical security keys. Like, I know UBKey had an issue where they had some of
2949990	2954530	their FIPS keys that had a vulnerability in them, and you have to reissue hardware. So that is
2954530	2959250	actually another interesting thing. But then you run into these, like, Spectre meltdown attacks
2959250	2963970	where, you know, not only are you reissuing hardware, but you now have to, like, refab
2963970	2969630	processors. That's going to take 10 years. So it's a tough game, like trying to build secure
2969630	2975150	systems. It's really, really complicated. I do think we're getting much better at it, though.
2975150	2980050	Just if you look at the frequency of exploits, it actually is going down over time. I don't think
2980050	2984510	we're going to be out of jobs anytime soon, but, you know, we are doing a good job going forward.
2997660	3004260	Am I familiar with laser fault injection? Yes, like optical glitching attacks on hardware. I am
3004260	3009440	familiar with. I've actually done one of them, not with the intent to succeed, but with the intent to
3009440	3016580	learn, and it is freaking rad. Like, to look at an electron microscope, you're looking at, like, a
3016580	3023080	couple nanometer resolution on this chip, and, like, it's sweet. He's, like, red fuming nitric acid.
3023080	3027980	So how do I think that'll play into this going future? I think that's where you stand on the
3027980	3033680	shoulders of giants in the smart card world, right? So, like, these secure elements really are
3033680	3039640	done well to try to prevent against that stuff. Like, these physical attacks have really been
3039640	3045480	thought about in depth. So if we can take all of that learned, really leverage those secure elements
3045480	3050940	on the phone and all that same technology, you know, we start to move forward. The problem with
3050940	3055960	kind of the industry as a whole, as being a hardware industry, as it has been, you're using
3055960	3061240	all these low-end microcontrollers, right? You're trying to drive cross down. And I know PIX in
3061240	3066160	particular, that's what we had a PIX, is vulnerable to that attack. So we wanted to see that happen.
3066160	3070760	We're like, okay, we want to spread, hit UV light here, flip the right protect bit, and dump the
3070760	3077780	firmware. In particular, we were messing around with my Subaru WRX. So, like, we were able to
3077780	3083280	roll the odometer and make the odometer say leet. That was, like, one of the fun wins of that. And
3083280	3088220	then we just found some other things with known, some other processors with known attacks. So,
3088220	3095120	I mean, 100%. The more security we start putting in our phones, the more we need to beef up the
3095120	3098960	defense. And if you look at how phones have advanced, we're already at the point where,
3098960	3103900	like, they are really wildly impressive from a hardware architectural point of view.
3103900	3109560	And the more we throw in there, the better job we have to do. And I'll leave you with, like,
3109560	3115560	my adage on why I think that's a good thing. As a defender, and I worked for the DoD for a bit. So,
3115560	3120560	if you watch the movie 300, as a defender, you want to create a choke point, right? Like,
3120560	3124120	that's how you beat the Persians. You know exactly where they're coming, and you can focus all of
3124120	3128620	your attack power there and all your defensive power. So we really do put it all in the phone,
3128620	3134780	all in the secure element, and this one chip that has a single line for IO. Like, you now,
3134780	3142240	your parsers are very rudimentary, can actually be audited quite well. And if you get to the point
3142240	3148500	where all you're looking at is this one input, like, one input channel in and out, you actually
3148500	3152320	have a chance to defend that. Whereas now, you know, with passwords and credentials and smart
3152320	3158780	cards, you know, you have all these cards out in the wild, you have no clue what's happening where,
3158780	3162700	all these different technologies. So, if you really do put all your eggs in one basket and
3162700	3167560	guard that basket, it's not as crazy as it initially sounds, or I've at least convinced
3167560	3172620	myself of that after a 15-year academic career that, you know, I've convinced myself I'm not
3172620	3180240	crazy. I don't know if I've convinced others yet. I have two minutes for either a final question or
3180240	3194340	an awkward silence. All right. Thank you all so much. Hopefully, this was educational and useful.
3194340	3197260	Swing by the Physical Security Village if you want to play with any of this stuff
3197260	3200320	hands-on and see what it's actually like to clone a card.
