start	end	text
0	1120	Thank you.
1480	2740	Can you hear me?
3300	4420	Good.
4620	7660	Who here is first time to DEF CON?
8340	9320	Woohoo.
9580	12720	How many of you are aspiring hackers?
14700	16540	Aspiring hardware hackers?
17120	19880	How many of you are hardware hacking experts?
21140	22100	Or hacking experts?
22100	25980	So like, all you aspiring hackers, see, experts, raise your hand.
26320	28940	All you aspiring people, go talk to those experts.
29320	31240	Make some connections, okay?
31920	35180	So yeah, your homework, say hello to an expert after this talk.
35600	38380	This is direct memory access everywhere.
38500	44420	Kind of try to tie into the theme of access everywhere with the pun of direct memory access.
44500	45220	Haha.
45780	47340	I'm Joe Fitzpatrick.
47340	52480	I have been spending probably more than ten years of time doing fun stuff with hardware.
52780	59940	I did silicon debug and some security research for a rapidly shrinking CPU company a while back.
60420	63360	And now I do hardware security training.
64340	71980	And I do actually own a pair of shoes with white LEDs in them because that's the kind of work attire that you need in this industry.
72020	72920	And Grace?
75480	76600	Hello.
76600	77800	Hello.
78340	80180	I'm Grace Parrish.
80180	90680	I am a current OSU student, Oregon State University, working on cyber security degree.
90800	94960	And I am also currently a SOC analyst.
95100	108760	In the last nine years before I went back to school, I was a board level repair technician and also taught industrial control systems.
108760	112020	I should be graduating in December.
112040	116480	And I look forward to a career in offensive security.
122940	125480	So this is PCIE.
125540	132180	I'm sure many of you who have opened your computers at some point or other probably recognize it.
132180	142480	And for those of you who don't, it is a add-on card and interface to be able to add capabilities to your computer.
142480	152460	Some examples include networking, RAID controllers, and probably the one most people are familiar with, GPUs.
155620	160920	And you may be wondering, well, why are we talking about PCIE here?
160920	168640	Well, so the whole revolutionary thing about PCIE is that it uses DMA.
168700	186160	Back before DMA, direct memory access, our CPU would take data and move it from a system memory to a peripheral or possibly from a peripheral to system memory.
186460	189580	And this took up a lot of resources.
189940	195500	And because while the CPU was doing that, it couldn't do any other processing.
195500	208040	And so we decided maybe instead we should have the CPU ask for memory to be moved or for data to be moved from the peripheral to system memory and vice versa.
208300	221700	And this sped things up significantly because not only can we have a controller that's probably fast to do the moving, the CPU can continue to do whatever other processing it needs to do in the meantime.
229780	231400	And so PCIE is a great way to do that .
231400	234920	You may be wondering, well, why is there a talk about this?
234920	250280	Well, that's fine for a CPU to be able to or for a device to be able to move data around arbitrarily to and from memory if you trust the device.
250280	252140	But what if the device isn't trustable?
252140	253440	What if it's malicious ?
253620	260420	Well, now the device has arbitrary read and write to the entirety of system memory.
260580	272400	Now the first kind of exploration into this was the Tribble made by Joe Grand back in 2003.
272500	280080	And this is actually the predecessor to PCIE, just PCI.
280080	282300	This one's not extended.
282800	292840	And you may notice we have a card, again it's PCI, and then from that card we have a cable going off the screen.
293080	304920	Well, what that is, is actually it's going to another computer and that computer can use the cable and the card to arbitrarily read and write to memory on the victim machine.
305180	311860	Now, this isn't particularly, you know, easy to go unnoticed.
311860	313480	It's kind of obvious.
313480	317320	Which brings us to Firewire.
317760	325800	Firewire is a cable that is used to move data from one device to another.
326160	328040	And it does it pretty fast.
328040	331740	I'm sure you all could probably guess why.
332060	333360	DMA.
333780	342360	And so this cable was used primarily for cameras and used a lot in Macs.
342560	343480	But now it's used for cameras .
343480	347020	And now suddenly we have DMA outside of the case.
347540	361980	So instead of having to like tear open a case and put it in a card and a cable going out, we can instead just walk up with a computer and a cable, plug it in and perform a DMA attack all with parts completely off the shelf .
366310	367310	Cool.
368770	371030	I got to do this slide because I'm the pro.
371870	375330	So this is a tale of epic procrastination.
375330	378250	Because this spans over a decade at this point.
379070	381470	Way back in 2014 I presented here at DEF CON.
381470	387470	It was my first time at DEF CON presenting about slot screamer which was a PC express device that did DMA attacks.
387470	388590	Sounds familiar, huh?
389070	396190	And a couple years later Ulf Frisk did some amazing work and I basically got a card that was mostly off the shelf.
396190	398670	Changed a few registers and did a cool demo.
398890	409530	Ulf then took that and turned it into this incredible suite of tools that will let you go and own any operating system using the same hardware but a bit more configuration and a bit more software.
409530	412710	So it was aware of like operating system structures in memory.
412710	415450	It could go and modify them, inject processes, get files.
415450	416530	It was pretty amazing.
416530	418930	Far more than I had the patience to ever do.
419450	422050	Yeah, attention span, procrastination.
422110	425470	Anyway, then as a follow on there was an FPGA version.
425510	427890	So using a starting with a Xilinx reference board.
427890	433590	You could basically use an FPGA to overcome some of the limitations that Slot Screamer had such as 32 bit addressing.
434410	437270	And actually past that there were a couple of other projects.
437410	449810	Thunderclap from University of Cambridge put together a tiny little like 3 or 4 thousand dollar board that they used to go and poke at some Thunderbolt and IOMMU issues.
449850	451270	Thunderspy in 2020.
451450	460230	So yeah, there's been a steady progression of stuff like this and I've been keeping my eyes on it and perhaps, you know, meaning to do a lot of work and never actually getting around to it.
460230	463130	But luckily other people were getting some of it done too, which is even better.
464530	467170	As we're going to go through though, we're going to talk a little bit about threat modeling.
467250	468570	Who likes threat modeling?
469690	472730	I used to, I used to joke about like armchair hacking.
472850	476390	It's where you just like sit and think about things and like throw darts at the wall.
476390	479530	And then I realized if you want to build hours, you just call it threat modeling.
481070	485650	So four question threat model that Adam Shostak's been using is pretty cool.
485970	492410	It's way less structured than a lot of the other things but it actually kind of does a good job of getting straight to the important stuff.
492990	494950	So basically what are we working on?
495070	497550	We're going to go through a couple different aspects of PCI express.
497870	499010	What can go wrong?
499150	500750	We've seen some examples of that already.
500750	504190	We can use that to inform our answers or we can kind of speculate.
504530	505970	What are we going to do about it?
506090	507010	Do we fix it?
507010	508550	Do we just tell people not to do it?
508550	509890	Like what's the solution?
510110	518890	And then did we do a good job is kind of a good follow up because you know if we're not doing a good job why are we wasting our time doing this armchair hacking when we could be like taking a nap or going on vacation.
520170	522270	So for PCI express what's the threat model?
522270	522850	What are we working on?
522850	524210	We're working on high speed interconnects.
524210	526750	We need a way to connect devices in a system very quickly.
527110	528230	What can go wrong?
528230	534210	Some malicious devices, errant devices, devices that get programmed with malicious firmware or something like that.
534630	536070	What are we going to do about it?
536130	538670	Basically the decision was just keep it inside the case.
538870	541730	Oh well the trust barrier is the case of the computer.
541730	547430	We're going to have an intrusion alarm that like lights a light up or something or tells the BIOS something happened if you open the case.
547450	549650	Which maybe was fine 20 years ago.
549690	551090	So did we do a good job?
551490	552070	Maybe.
552070	555350	Based on the threats at the time if we kept it inside the case we probably did an okay job.
556950	559150	So yeah, grace.
561770	565990	So now you may be wondering well what are the steps of attacking PCI D .
565990	570150	So first you're going to connect your hardware.
570390	576150	Then the computer is going to enumerate that hardware.
576150	582570	Finally then the device is going to enable bus master.
582570	585670	And then read and write memory.
585670	590130	And then finally you get to present a talk at DEF CON.
590930	593690	So connecting hardware.
593690	597950	So here are some examples of various hardware.
598030	603390	You may notice that PCI E comes in various shapes and sizes.
604590	620410	There's 1X, 4X, 8X, 16X and even some interfaces that you may not recognize or you may not realize is PCI E such as M.2.
621210	628690	You may also realize or notice that there are USB 3.0 ports on many of these cards.
629590	632670	So fun fact, those are not actually USB.
633010	642570	One of the things about making implants for machines is sometimes you don't have the space that you want.
642570	644810	Or the space is elsewhere in the machine.
644810	655370	So what that actually is, is it is a port that connects to a cable that will then connect to our actual implant.
655370	657450	So it may look like USB.
657450	660630	That's because it's the port reused.
660630	666230	But it is actually PCI E over a USB cable.
668360	673760	So after we've connected some hardware, now we have to get into enumeration.
673760	679040	So the root complex enumerates buses.
679040	684960	And I'm sorry, but the lines connecting the buses aren't super visible on the dark background.
684960	689760	But I will try to illustrate where I am talking about.
689760	698380	So the first bus or the 0th bus is from the root complex on the left to the switch.
698680	701240	And that's going to be bus 0.
702100	709720	Then the switch also has a bus going from the switch back to the root complex.
709720	711040	That's 1.
711600	718400	Then from the switch to the left PCI E end point, that's 2.
718400	722040	From the switch to the diagonal PCI E component, that's 3.
722040	726400	From the switch to the legacy end point, that's 4.
727160	731320	And so far we've been going depth first search.
731320	734100	And that's how PCI E is enumerated.
734100	742680	So next we're going to go from the root complex at the center to the PCI E end point.
742680	747600	And that's going to be 4.
749260	750380	5.
752240	759340	And then from the root complex on the right to the PCI E bridge, that's going to be 6.
759340	771200	And then it's really hard to see, PCI bridge, and then it's really hard to see, there is actually a PCI E bus down below the bridge.
771200	772840	And that would be 7.
772840	781620	And the root complex connects all of these end points to the memory so that the devices can write directly to the memory.
783400	792940	Here is an example of LSPCI output showing all of the various devices enumerated.
797440	800700	Do you want to help me with like a little ad hoc hack right here?
801040	801920	Yeah?
802000	805800	So I'm listening to Micah Flee's talk across the way because I can hear it.
805800	809780	And I bet if we all yelled like, great talk Micah, he would hear us.
809780	811140	So you want to help me with that?
811140	813780	So on three, great talk Micah.
813780	814380	Ready?
814460	816380	One, two, three.
816460	818540	Great talk Micah!
819720	821340	I don't know if he heard that.
821400	825780	But back on topic, you came for PCI Express, didn't you?
825780	827960	This is why I procrastinate a lot.
827960	828940	I get distracted.
828940	830460	So we want to read and write memory.
830460	833180	We get to the point where we've got transaction level packets.
833240	840500	So TLPs, these are the things that we get to the point, hooked all the wires up, we enumerated, we know who's who, and we just start sending these packets back and forth.
840540	841940	The first group of them are about memory.
841940	846740	We want to read memory and we want to write memory, which does basically what you expect, reading and writing memory.
847740	852500	Configuration read and message requests are our special type of PCI Express transactions.
852540	853720	We're not as interested in those.
853720	857380	They're not used nearly as much as the memory read and write, especially when we're doing DMA attacks.
857740	859020	And last we've got completions.
859020	860160	These are the responses.
860160	863120	So when you do a read, your response is a completion with data.
864800	865860	So that's all complicated.
865860	867780	You don't want to sit there writing TLPs one at a time.
867780	870920	That's what's great about PCI Leach is it kind of does all that work for you.
870920	879040	You want to read a certain block of memory, it does the TLPs, sends them to the hardware, whether it's a slot screamer or an FPGA, which goes and grabs memory, gives it back to you, and it does stuff with it.
879040	882460	It parses tables, does whatever it needs to find processes and memory.
882520	883380	It's pretty cool.
885480	888460	So I'm going to skip over this example based on time.
888460	893580	First example I had was dumping memory where you basically plug this card in and dump all of memory.
893580	896860	So you grab 4 gigabytes of memory and whoop-de-doo, you've got a memory image.
896860	898400	You can go and look for cool stuff.
898740	899860	I'm going to show this next one though.
899860	901120	This is the lock screen bypass.
901360	903060	So this is using an older piece of hardware.
903060	904140	This is using slot screamer.
904140	909940	You plug it in the system and this is a Wi-Fi router that happens to have PCI Express.
909940	911480	It's a mini PCIe slot.
911480	914100	We hook it up over USB to this computer.
914980	916580	We've got a console as well.
916820	921700	So on the console we're going to try and log into this thing and actually we're already logged in, but we want to look at a file.
921860	924020	Let's say we want to check the shadow file.
926100	927180	Come on.
927360	929340	So shadow file is owned by root.
929340	931060	I'm not supposed to be able to read it.
931260	934460	And if I go and cat it, I get my permission denied.
934640	938200	So I'll go over and run my little script, which is going to go in the other window.
938740	945220	This script is going to talk to that PCI Express device and tell it, hey, go find this address in memory, patch it and see what happens.
945220	946880	So we found our device.
946880	948600	It's this net chip technology board.
948600	951480	We patch it, patch the generic permission function in Linux.
951560	953600	That's what checks the permission on file accesses.
953700	956600	That little thing over there, read and wrote to the memory for the CPU.
956960	960760	And if we go back and we try and cat Etsy shadow, it should work.
963140	964680	And it works.
964680	965380	There we go.
965400	966120	Yay.
966620	967280	Okay.
971010	974210	So we can also unpatch it and, you know, make it go back to normal.
974210	976410	But we're going to call it done.
977430	978570	Is this you or me?
978570	979350	Okay.
979350	982390	So key take away, PCI Express is permissive by design.
982390	986230	And that demo isn't anything different than what we did 10 years ago.
986230	988430	So let's talk about what's changed since then.
988970	994210	So there's been a lot more approaches and ideas behind what to do.
994210	997230	So here's my DMA attacks, DMA attack taxonomy.
997230	998470	I just made this up.
998870	1002490	There's tethered attacks, there's drive by attacks and there are embedded attacks.
1002490	1004990	So a tethered attack looks kind of like this.
1005230	1007990	We've got the system on the left, that's our target system.
1008070	1011350	We see there's a cable running over to the thing on the right.
1011410	1012530	And that is the attack device.
1012530	1017990	That's actually a Xilinx FPGA board.
1018790	1024770	And attached to it on the far right is a little blue board that's a FTDI high speed IO board.
1024770	1033370	And you can barely see there's a little itty bitty, there's a cursor there, a little bitty thing over there, that little USB cable, that connects to the computer that actually does all the real work.
1033370	1036910	So you're not going to sneak up to someone's laptop and do this to it.
1037170	1041910	This is, it's slotted into a machine , you've got a lot of hardware, it's kind of a pain in the butt.
1042210	1043730	So that's a tethered attack .
1044530	1049730	Now a drive by attack would be something like you just walk up to the system, plug something in and do your whole thing.
1049890	1053890	And so what we've got here is we've got an express card reader , thunderbolt to express card.
1053890	1056430	So you plug this into a thunderbolt port, you've got an express card.
1056430	1063930	In the express card reader you have an express card to mini PCI adapter and in the mini PCI adapter slot you have one of the old slot screamer boards.
1064410	1065790	And this can do the same thing, right?
1065790	1072130	So if you don't have any thunderbolt protections turned on, which we'll talk about in a second, then you could just like walk up to a system, plug it in and do some DMA.
1073270	1075790	And last we've got embedded type attacks.
1075790	1080110	And this is where we, you know, actually like stick the thing inside the system, close it up and leave it there for a while.
1080130	1084950	So this is Pico DMA, which is a project of a few, from a few years ago, I believe 2019.
1086150	1089370	And what they used is they used that board on top, which is called Pico EVB.
1089370	1092110	It was a little Xilinx development board.
1092510	1099910	And they paired it up with these Pycom modules, which let them do either wireless, you know, Bluetooth or 4G connectivity to this device.
1099910	1104750	And they could package it all inside the case of a laptop and, you know, no one would be the wiser.
1105290	1109670	You'd be surprised, you know, how many of you have opened up your laptop and looked inside?
1109670	1112470	How many of you know what every one of those chips does in there?
1113150	1113690	Not many.
1113690	1114430	I don't.
1114430	1118850	So like, it's pretty, pretty, pretty interesting what you can cram in those places.
1118950	1122890	Luckily, things are getting smaller, so it's harder to, like, hide stuff like this, but whatever.
1122970	1124830	So this is an embedded kind of attack.
1125090	1126830	So, you know, here's my little chart.
1126830	1131050	If it's quick access, it's a hot plug, it's short term, you're right, that's a drive-by attack.
1131110	1138890	If we're sticking it in there, we're leaving it there for a long time, we're reboot, persisting over reboots, you know, that's an embedded, everything else is kind of like in between those tether attacks.
1139110	1140290	They're a little more complicated.
1141530	1143730	So let's, let's kind of change gears a little bit.
1143730	1146090	Let's talk about, like, the multi-tenant threat model.
1146170	1148290	So this is like the cloud provider situation.
1148670	1152790	So we've got a lot of cloud providers that want to give, uh, access to computers.
1152790	1155530	Some of them want to, like , give you bare metal, some of them want to give you VMs.
1155530	1160990	Some of those VMs, they want to have FPGAs or GPUs attached to them, which are PCI Express attached devices.
1161010	1163010	So, like, there's some, there's some things to worry about.
1163010	1164050	So what, what are we working on?
1164050	1165990	We're working on making money by sharing hardware.
1166330	1166870	Okay?
1166870	1169510	It's pretty much the, the, the threat, like, their objective, right?
1169510	1170530	What can go wrong?
1170670	1172090	Hardware assisted tenant hopping.
1172090	1180670	So if you go and get a, a VM on a system with a GPU and you can do something with that GPU to access another tenant on the same system, that would be bad.
1180810	1181890	So what are we going to do about it?
1181890	1184850	We're going to use an IOMMU to go and protect devices from each other.
1184850	1186670	An IOMMU, memory management unit.
1186750	1187390	Okay?
1187390	1188410	Did we go to a job?
1188410	1190130	Um, it kind of works.
1190130	1192590	So, Grace, you want to tell us about that?
1192870	1193390	Sure.
1195590	1206530	So, um, in order to understand IOMMU, you first have to understand kind of what the problem IOMMU is trying to solve.
1206530	1218670	So, um, as Joe just said, we're trying to prevent, uh, crossing, uh, boundaries, um, using hardware.
1218670	1230550	And so, uh, how we originally did this is we used a, um, our virtual machine, uh, emulated a device.
1230590	1245270	And so instead of our virtual machine just being able to talk directly to that device, um, it had a driver instead for a virtual device, uh, provided by the virtual machine.
1246410	1259270	Then the virtual machine has to take time to process, or the, the hypervisor has to take time to process that device, um, emulating it.
1259270	1263390	And then it itself has to have a driver for the actual hardware.
1264110	1266810	That's a lot of processing.
1266930	1284830	Um, so instead, uh, what IOMMU allows us to do is our hypervisor actually uses the IOMMU to remap hardware, um, so that the hardware just appears directly in the virtual machine's memory.
1285070	1287670	Um, and this makes things a lot faster.
1287670	1294870	The virtual machine can just use the normal, uh, device driver and it can just talk directly to the hardware.
1297210	1319970	Um, and one of the things that's kind of a byproduct of this is, um, because the IOMMU has to map devices to various address spaces, um, that device, those devices can't just arbitrarily read and write to memory outside of the address that it was written to.
1326030	1328730	Someone keeps moving this microphone up too high.
1328890	1331970	Um, so take away from that, like, the mitigations exist.
1331970	1340730	There is features built into CPUs for nearly 20 years that can let us go and protect hardware devices from our system, our system from hardware devices and hardware devices from each other.
1341550	1345710	Um, so, of course, you know, once we have something figured out, we always kind of make it harder.
1345710	1347210	So let's talk about Thunderbolt for a minute.
1347370	1349370	Um, so Thunderbolt threat model, what are we working on?
1349370	1351690	We want high speed peripherals, okay?
1351690	1359850	We want them outside the case, you want to plug them in, you use them and then leave them at home or take them with us and bring them to another computer, like a high speed drive or, uh, data capture devices.
1359970	1361150	Um, what can go wrong?
1361150	1363410	Malicious Thunderbolt devices, okay?
1363410	1366790	That's kind of like the answer to all of the what can go wrong in this talk.
1366970	1368230	Um, what are we going to do about it?
1368230	1372770	Well, at this point, we do actually a pretty good job of, uh, authenticating and isolating devices.
1372970	1374950	Um, and did we do a job?
1374950	1377950	It took time, but, like, we eventually got there.
1378170	1379550	So there are mitigations, right?
1379550	1382930	Thunderbolt was released in 2011, right?
1382930	1384330	That's a long time ago.
1384430	1386650	Um, how many of you were born in 2011?
1386670	1401010	Okay, most, uh, anyway, um, and before the IOMU's existed, even before then, um, Mac OS 10.8.2 was pretty quick to, uh, have, uh, basically built in support for the IOMU to protect Thunderbolt devices.
1401010	1406550	Of course, like, Macs were the only computers that had Thunderbolt devices for a while, so maybe that's why.
1406550	1415450	Um, but eventually Windows 10 8, build 1802 got support for using IOMU and their kernel DMA protection, uh, in 2018, uh, a scant seven years later.
1415570	1417910	Um, and even Linux got in on the action.
1417910	1424830	So in Linux kernel five in 2019, uh, eight years after Thunderbolt was released, um, they also had some of these protections built in.
1424910	1426810	Now, they're not perfect.
1426830	1433150	I'm sure there are issues in them, but the fact is, like, it was eight years before they existed at all.
1433390	1438030	Um, so my takeaway from that is, like, Thunderbolt got fixed eventually, right?
1438030	1448950	I actually, when I, uh, yeah, I've been working on this for a long time, so like, I was like, wait, okay, so by now I'm sure that all these protections have been built into the operating systems and I get, I check, I'm like, oh, wait, no.
1449150	1451210	Uh, anyway, so eventually got fixed.
1451210	1455110	So Thunderbolt isn't the easy way to just plug in and do a drive by attack anymore.
1455130	1456010	Grace?
1458470	1466790	So, um, you may be thinking now that, uh, Thunderbolt got fixed, um, how are we going to do drive by DMA attacks?
1467050	1470410	Well, um, DMA finds a way.
1473320	1477380	Who here by show of hands recognizes this port?
1477840	1481940	If you are thinking that is display ports, you are wrong.
1481940	1484100	That is in fact, Oculink.
1484100	1487220	Um, so what is Oculink?
1487400	1498520	Oculink is a, um, interface that we came up with because we wanted to be able to attach our GPUs to our laptops.
1498640	1504340	Um, now you may be thinking, wait, we just finished, we just fixed Thunderbolt.
1504340	1506260	Why aren't we using Thunderbolt?
1506280	1520720	Um, well, Thunderbolt, um, while it is more secure, it's also, um, have, um, Thunderbolt has, uh, quite a bit of overhead.
1520720	1525440	Um, and also it's significantly more expensive.
1525440	1532800	Um, so what we decided to do instead was, uh, once again, we brought PCIe outside of the case.
1533000	1538280	So Oculink is basically just PCIe over a cable.
1538280	1544740	Um, amusingly a cable, uh, from server, uh, storage.
1545100	1556580	So I don't think that's really meant to be plugged and unplugged as many times as they're thinking it will be for connecting a GPU to a mobile device.
1556580	1558260	But I digress.
1559360	1562820	Um, and this is actually really kind of cool.
1562820	1570480	Uh, we've taken this thing that's not supposed to be used this way and we've decided to use it.
1570480	1574000	Um, and isn't that what hacking is?
1577460	1579740	So some more armchair hacking.
1579840	1581060	So what are we working on?
1581060	1583480	We want, um, high speed peripherals again, just like Thunderbolt.
1583480	1584360	Same thing.
1584360	1585180	What can go wrong?
1585180	1585700	Same thing.
1585700	1587180	We can have malicious devices.
1587920	1589600	Anybody want to guess what we're going to do about it?
1590360	1591500	Probably, yeah, nothing.
1591600	1593840	Only, only use it in secured locations.
1593900	1594780	Like, yeah.
1594960	1596640	Who here uses any GPU?
1598540	1601660	So when you, like, you, you leave your Oculink GPU at home, right?
1601660	1606040	And then you take your laptop with you, which has the Oculink port on it wherever you go.
1606040	1607740	Like, but you never leave it out of your sight, right?
1607740	1610100	So anyway, did we do a good job?
1610100	1611080	Uh, not really.
1611080	1613080	So now we got, um, Oculink, right?
1613080	1614220	Let's, let's go and use it.
1614220	1615000	Let's, let's do it.
1615000	1618860	Let's figure out a new drive by attack for a cool demo for, for the talk.
1618920	1627120	Um, and I, you know, I like to do like junk hacking and I kind of feel like crypto's junk hacking because it's all crap.
1627200	1631360	Um, and so, uh, MetaMask is, uh, so I, I got some help.
1631360	1632680	So is Dean here?
1632680	1633540	Thanks Dean.
1633540	1634800	Dean helped me out with this demo.
1634920	1639220	Um, like, so we've got this device.
1639580	1640380	Um, what can we do?
1640380	1645160	Can we like go and mess with MetaMask somehow if we have the ability to read and write all of memory?
1645300	1647500	And of course the answer is yes.
1648040	1648760	Is it playing?
1648760	1649120	Here we go.
1649120	1653040	So we got MetaMask running and you can see here we want to go and send some money.
1653960	1660360	Um, and so some just random name that we choose, send, send some random person a dollar of USDC.
1661100	1663260	Um, and so this is all on a computer.
1663260	1669920	This is a browser extension inside of a browser, inside of a sandbox and all that crap inside of this machine.
1670280	1673180	Um, and we're about to go send it, but let's go like run this thing.
1673180	1675000	You see who it's going to, right?
1675000	1676080	Well, that's just stored in memory.
1676460	1679040	And so like, let's just send it to this other address instead.
1679160	1683220	I mean, we just put a bunch of sixes in there to like make it a little easier to make sure we got it working wrong.
1683360	1685120	But anyway, so let's cancel that.
1685120	1690240	We still have this, this process running in the background continuously going and doing a DMA scan for the right string.
1690640	1697320	But if we go and we get another transaction, we want to send some magic money, some Chuck E.
1697320	1699380	Cheese coins over to some dude.
1700540	1705740	Um, and yeah, who cares how many gallons of fuel we took, but whatever.
1706120	1710940	So let's boil, boil a pot full of frogs and continue and it's running.
1710940	1715500	And so you'll see, it'll take a moment, but as soon as we find it in memory, bam, it's overwritten.
1715500	1717260	But oh, wow, what was that?
1717260	1719320	That's okay, we keep looking, we keep looking.
1719540	1726200	Memory is a pretty crazy how fragmented it is and how like when you, when you free and renew stuff, like it shows up all over the place.
1726200	1730380	So it's not easy to go and find out exactly where this is without scanning through all of memory.
1730500	1745400	Anyway, we never clicked continue, we never clicked confirm, but like we were able to pretty much, you know, change that address in the time between setting up the transaction and going to go confirm and send that, that $1 to some stranger whose address ends in 6s.
1745520	1748080	So, I thought that was kind of cool.
1748100	1752720	So Dean actually threw together this, this, this framework to help me put together this demo, um, passive.
1752740	1756760	So, um, you've seen the movie Inception, right?
1756760	1766440	There's a tool, there's a, there's a tool called Inception for DMA access and firewire access and so, uh, Dean thought that passive peripheral attack simulation introspection vehicle would be a good way to do this.
1766440	1773460	So, um, disclosure, that was not on hardware, that was in a VM, um, because it's a lot easier.
1773500	1780740	Um, and, but the reality is, you know, whether you have a VM or whether you have a hardware attached device, we're still doing memory access and we'll talk a little bit more about that in just a moment.
1780800	1784520	Um, but first, let's like diverge into some game cheating stuff.
1787570	1793270	Okay, so, first off, show of hands, who here cheats at games?
1795630	1796410	Why?
1799940	1806640	Um, and, and for that matter, uh, how do you, how do you have a time to play video games?
1808720	1812380	See, that's what I was thinking, because, probably because you cheat.
1812780	1817020	Uh, yeah, but, uh, who, who, who pays other people to develop cheats for them?
1817860	1826160	Uh, yeah, that's like, if you're gonna do, if you're gonna cheat, like if you develop yourself, I think it's cool, but like, I don't know, I think paying for cheats is kinda cheap, but, actually it's really expensive, never mind.
1826200	1826980	Grace, go ahead.
1827840	1831720	But yeah, so, um, I don't really understand why people cheat.
1831720	1843480	Uh, developing cheats, that I can understand, that sounds like a pretty cool puzzle, but actually using that cheat to, um, not play a game, kinda defeats the purpose in my opinion.
1843480	1845500	But, I digress.
1845640	1851120	Um, so, here is a website that sells game cheats.
1851120	1857060	So, if you notice, on the left, we have, uh, just a cheat.
1857060	1863520	And I know it's tiny text, but this is, uh, this is for one month.
1863520	1870640	And even tinier text, it does not include the hardware you actually need to run the cheat, nor the firmware.
1871340	1878080	In the center, we have the basic package for a measly $720.
1878220	1884640	And what this includes is the cheat for, again, for only one month.
1884640	1889620	Uh, DMA card, um, and firmware for that card.
1889620	1897500	And then, finally, on the right, we have something more for yet another ridiculous amount of money.
1897500	1900060	Um, again, only for one month.
1900060	1911160	Um, and the thing about this is, is it's actually all built off of the stuff that people have developed and open sourced that we have talked about.
1911160	1915440	Things like, uh, slot screamer, PCI leach.
1915540	1922880	They are basically repackaging this and selling it to you when you have it, basically, for free.
1928610	1932090	So, yeah, it's always interesting to see what people will sell on the internet.
1932110	1937530	Um, and, you know, like the whole monthly service fee, it seems silly, but, like, it's a, it's a, it's an arms race.
1937530	1946850	So, between the game developers and the cheaters, like, so, it actually is, you need to come up with new ways of deceiving the game to thinking that, like, you don't have a malicious device in.
1946850	1956930	So, for example, it's like this PCI, PCI DMA, NVME, uh, thingy, is gonna basically, like, look like an NVME so that your anti-cheat doesn't say, oh, you've got a cheat device in there.
1956930	1960410	It says, oh, you just got an NVME, a hard drive, and that's what you're running from.
1960550	1965530	Um, so, it's, it's pretty crafty, the levels of, uh, of, uh, stuff going into this .
1965530	1968110	Um, a lot of them are based on, uh, PCI leach.
1968110	1970350	Um, some of them ship with PCI leach generic firmware.
1970350	1977090	Some of them customize it a bit, um, which is good, but, like, the number of people who actually go back and support PCI leach.
1977090	1983470	So, you'll see over there that, like, a few of these, uh, Screamers, uh, Squirrel, the ZDMA and LeetDMA, they're all project sponsors of PCI leach.
1983470	1987370	So, if you do wanna go and mess around with PCI leach, um, that's the way you should go.
1988250	1993630	Um, one of the key takeaways, though, is that changing the form factor is changing the threat model, right?
1993630	2006610	So, you know, changing to, um, this game situation, like, you're, we, we have the owner of the PC being the person, so even, even if we had stuff inside the case, it's not really the same, because, you know, you're the owner of the machine, you can get inside the case.
2006790	2013650	Um, another difference of, of changing the form factor is, uh, maybe going to a different , uh, type of device.
2013650	2014610	And so, Grace?
2015590	2016390	Okay.
2018270	2021830	Um, so, how many of you have seen these before ?
2021990	2026950	So, we have, uh, CF Express on the left and ST Express on the right.
2027150	2032730	Um, these are both relatively new, um, devices, uh, storage devices.
2032830	2042930	And, um, you may recognize them from some, uh, devices that you own, uh, especially if, no.
2042930	2043850	Yeah.
2043890	2049810	Um, who, who has, who has used a CF Express device?
2050070	2050870	Okay.
2050870	2054170	Who, who has used an ST Express device?
2054270	2055330	Okay.
2055450	2057730	So, I don't know if you know what they are, though.
2058950	2066990	Um, and so, basically, um, uh, you probably have seen these.
2066990	2075590	The, the interesting thing about these, though, is, um, once again, they are PCIe, um, and support DMA.
2075750	2094330	Uh, so, on the right, on the ST Express, you may notice, uh, we have a few extra contacts, and what those are is actually, uh, PCIe lanes, uh, just like you would find on, like, a network card or M.2 device.
2096970	2097750	Yeah.
2098010	2103950	And so, uh, what threat model are they working with?
2103950	2111490	Um, so, we know, uh, they are working with high speed small storage.
2111910	2114530	Um, what could possibly go wrong?
2114530	2118590	Well, I think you may have caught on to a theme at this point.
2118590	2120670	It's malicious devices.
2120750	2123350	And what are we going to do about it?
2123350	2127790	We, of course, being the manufacturers of devices that use these.
2128470	2130250	We don't actually know.
2130250	2136790	We're kind of, they kind of don't invite us to other threat modeling, uh, meetings.
2136890	2142150	Um, so, did they do a good job of, of preventing attacks?
2142250	2144490	We also don't know yet.
2144550	2157450	Um, and so, one of the things is, uh, so, how many of you have, like, tried attacking any of these devices?
2158350	2159510	Few.
2159510	2163250	Um, so, you may be wondering why is an Xbox up there?
2163250	2174470	Well, actually, that aforementioned, uh, CF Express card is the exact same card that they're using for the memory expansion cards.
2174650	2179910	Um, it's just packaged in a nice piece of plastic.
2179950	2187530	Um, also, we have the Nikon, uh, which also uses that, uh, CF Express, uh, card.
2188010	2191910	And then finally, this one is really new.
2191910	2196010	Uh, this is the Switch 2, uh, just came out a little bit ago.
2196010	2198750	And it uses SD Express.
2200850	2208530	Uh, and so, an example of SD Express.
2209210	2209930	Sure.
2210490	2214870	So, so, this is still, uh, you know, in research.
2214870	2216670	Um, so, CF Express, right?
2216670	2217730	It's a device.
2217730	2218650	It has NVMe.
2218650	2220130	It has, um, what's it called?
2220130	2220990	PCI Express.
2220990	2225810	And so, what we can basically do is, uh, instead of plugging our, you know, excuse us.
2225810	2232550	So, this is a card reader for, uh, XQD, which is pinout compatible and also PCI Express compatible with, uh, SD Express.
2232550	2234530	So, the reader is pretty much not, not much to it.
2234530	2238770	Uh, it basically is a, wires it up to, uh, PCI Express.
2238770	2241750	Um, but if we wanted to, we could go and do something stupid like this.
2241750	2250770	And we can hook up our, uh, camera with a adapter, which goes and takes the SD Express outside to an M.2 slot, where if we pop, put in our malicious device.
2250950	2253970	And you can see on the screen, it says, uh, card not currently supported.
2254230	2257230	Um, so, it does, uh, it does check the device.
2257230	2258110	It does enumerate.
2258110	2261370	It does check to see if it's, uh, the right type of NVMe device.
2261430	2269750	Um, and then there's probably some magic that I need to be getting figured out to go and actually let it stay enumerated and not get the, throw the error up and disconnect.
2269750	2277630	Um, once we've got that, like, we'll have to see what this little SOC on here actually does in terms of, you know, I'm not sure that camera has an IOMU.
2277630	2280870	This is a seven-year-old camera, but, you know, you can be surprised.
2281250	2284550	Um, so it'll be interesting to see what, what we can get off of the device that way.
2285870	2291530	Um, so we've got to switch to, switch to is like the first device that actually uses SD Express, which is pretty cool.
2291530	2295230	Um, I actually grabbed some SD Express cards a while ago and some readers.
2295270	2299750	Um, I was not really surprised to see that most, uh, these are two different SD Express readers.
2299750	2303790	One's, uh, Sabrent and one is, uh, uh, SanDisk.
2303890	2305790	Um, they're using the exact same chips.
2305790	2311690	The one on the left is the green board has two of these little, uh, SD Express, uh, controller chips from Realtek.
2311690	2314250	The one on the right has the same exact chip, but only one.
2314330	2323150	Um, and these chips actually hook up to this other chip, which is, you know, billed as a multi -purpose one, but, uh, basically it's a, it's an NVIB and a USB adapter, right?
2323150	2325970	So we take SD Express and turn it into NVME.
2325970	2332410	We take the NVME and turn it into USB and we plug it into our system and we store it, mount it as a mass storage device.
2333070	2336290	So, um, you know, Switch, brand new.
2336290	2338950	I literally just got one last week.
2339430	2341510	Who wants to see a Switch 2 jailbreak?
2342450	2343250	Yeah?
2343270	2344370	You want to see one?
2344610	2347390	We only, we only have seven minutes left though.
2347550	2349330	So do you want to see it?
2349670	2351070	Yeah, so do I.
2351070	2353810	So, um, sorry.
2353970	2357150	Um, so the takeaway here is, uh, PCI Express is pervasive.
2357150	2359610	I literally got the Switch the day I left to come to Las Vegas.
2359630	2363230	So, like, haven't had a chance to poke around too much, but maybe some of you will.
2363230	2367110	Um, there are some, um, boards you can get.
2367110	2371550	A couple folks have already made the adapter boards to break out the Switch into the NVME pieces.
2371550	2372810	You can get some adapters.
2372950	2377570	Um, so hopefully in time we'll get all the rigging hooked up and maybe we can poke at it some more.
2378050	2379930	So we're going to kind of scramble through.
2379930	2382930	Uh, let's resume this continuing tale of epic procrastination.
2383090	2385990	Um, I procrastinate and put it off all the way to the end of the presentation.
2386250	2389210	Um, so 2021, we finally got together a schematic for Erebus.
2389210	2396050	Uh, we got PCBs put together in 2022 and had a panic because suddenly you couldn't buy the chips that we needed to put the thing together.
2396050	2400350	So we actually had to do a redesign of some of the PCB to replace components that were discontinued.
2400550	2405590	Uh, we, uh, uh, uh, you know, uh, bought, you know, we're, we're, we're, we're chip preppers.
2405590	2409430	So we, we bought a lot of compatible chips to hopefully last us for a long time.
2409450	2411590	So we wouldn't be blocked by not having chips.
2411610	2414790	Uh, it would have been fine though because we were blocked by our own procrastination.
2414950	2417610	We finally got the test jig together in 2023.
2417610	2419770	And once we had the test jig together, we assembled the boards.
2419850	2422110	Um, and now it's time to profit, right?
2422710	2423890	Um, we're getting there.
2423910	2425750	Um, so this is Erebus.
2425750	2431670	Um, how many of you came here thinking you're gonna, I'd show off like a completely working functioning Erebus board.
2431670	2433290	Yeah, I apologize.
2433830	2435650	I'm a, I'm a procrastinator.
2435770	2442010	Um, but what I do want to go is talk about why Erebus exists and what we put into like make designing it and what for.
2442330	2445070	Um, so it does power on, it does work.
2445070	2446930	We don't have PCI express fully working yet.
2446930	2449470	We have some reset issues that we need to deal with.
2449750	2451490	Um, how do I get to escape?
2451710	2456330	Um, the objective here is we've got a, a lot of ECP5 FPGA.
2456370	2458230	Um, we've got DRAM built into it.
2458230	2459790	I'm not showing this picture on the backside.
2459790	2461230	We've got a spot to put an SD card.
2461230	2466270	So this thing fits where your wifi module might go and you can pop it in a system and leave it there.
2466270	2471530	If you got a two terabyte SD card in there, you can do a lot of memory dumps on a system before you go and retrieve it.
2471530	2477190	So this is like the embedded, like, uh, DMA attack device, uh, dream once it works.
2477370	2481250	Um, you can see we've got some test code running flashing lights.
2481270	2486710	Um, one of the things we wanted to address is that like a lot of devices, this is from PCI leach's repository.
2486710	2491430	A lot of these devices are using Xilinx's proprietary IP cores for PCI express.
2491650	2493830	Um, one of the issues with that is licensing.
2493830	2497070	They're actually not probably licensed properly and that shouldn't be sold the way they are.
2497070	2501450	Um, but more importantly, like it limits what you can do in terms of messing with the TLP level stuff.
2501450	2506350	A couple of the, the, the, the PCI leach devices do let you get that level of control, but not all of them.
2506350	2512950	So we wanted a fully open tool chain, fully open implementation that we could use PCI express to do all the stuff we wanted to do.
2513450	2517990	Um, you can see in the upper left, we, we're, we're planning on putting this on crowd supply.
2518110	2524390	Um, I'm working with, uh, Peter Eszentemski who has done, uh, the icebreaker, um, at Glasgow and a few other hardware tools.
2524390	2531610	So we're trying to make this actually a tool that is available and lasts and doesn't, you know, contain pirated IP and all this stuff.
2531610	2533150	Um, but we'll see how that goes.
2533690	2534830	Um, why Erebus?
2534830	2536650	My objective is platform security.
2536790	2542670	Um, I don't care about game cheaters in, except for maybe as customers to buy a bunch of these boards, right?
2542670	2546070	To fund the development, to actually get IOMUs used properly.
2546110	2547690	Cause right now they're not.
2547990	2551050	Um, so you want to, you want me to like breeze through?
2551050	2551370	Go ahead.
2551370	2551730	Okay.
2551730	2554230	So yeah, you see there's a bunch of PCI express devices here.
2554230	2563130	It's a lot more diverse group of devices than we had on the first slide because there's a whole lot of stuff that is PCI express these days that, that like, it's basically the standard interface anymore.
2563130	2567030	It's kind of like if USB isn't cutting it for you, it's going to be PCIe.
2567550	2568450	Takeaways, right?
2568450	2569790	It's permissive by design.
2569790	2570690	Mitigations exist.
2570690	2571670	We can use them.
2571670	2575250	It took time, but finally Thunderbolt is getting some of that stuff fixed.
2575430	2578350	Um, these form factor changes do affect your threat model.
2578350	2581090	Um, but again, PCV, PCIe is pervasive.
2581090	2583770	Um, progress has been made, but there's still plenty more to do.
2583770	2590030	The fact that I've been procrastinating on this for 10 years means that all of you can probably make more progress on this than I can.
2590030	2595470	So if you're interested in like poking at this stuff, the tools are available and like the, the information's available.
2595470	2601230	Like let's try and work together to make this happen because I'm not doing a good job of getting it moving.
2601670	2606210	Um, there is the forecasting question threat model we talked about a bit and another, another shameless plug.
2606210	2612250	Um, I've been working with Adam Shostak and Eric Abinchik to kind of come up with a, a more formulated model for applying threat modeling to hardware.
2612250	2615990	Uh, we'll hopefully present that at sector, but enough shameless plugs.
2616630	2617930	There's Arabis.
2617930	2619530	Um, what did I forget to say?
2620190	2620670	Stickers.
2620930	2621870	I've got stickers.
2621870	2622130	Oh yeah.
2622130	2622790	Thanks.
2623110	2627010	Um, there's a lot of people who helped with the support and the tooling of getting this up and running.
2627090	2629970	I've been working on Arabis with me trying to get it to work.
2629970	2636430	Um, there's a lot of prior art inspiration that led me into this in the first place and led us to kind of like choose the things that we did.
2636470	2638550	Um, so thanks to all these folks and more.
2638750	2642130	Um, there's some links on there and that is the last slide of our presentation.
2642130	2642970	I'll go back to the links.
2642970	2643710	Thank you.
2645670	2647150	And thank you, Grace.
2650240	2651040	Questions?
2653620	2655940	Did you like that switch 2 thing?
2657900	2658660	That was cool.
2658840	2661480	Hardware to break out PCI for what platform?
2661560	2662660	For the switch?
2663080	2669300	Um, I will put those links on the, um, the direct memory access everywhere, uh, repository once I put something on there.
2669560	2671060	Hold on, there's a question at the mic.
2671060	2672300	Uh, that was great.
2672300	2675200	You said you wanted to motivate platform security.
2675200	2678060	What would you like to see out of the platforms?
2678340	2681060	I would like to see IOMMUs properly configured.
2681060	2684200	I would like to see users actually having control about how they're configured.
2684220	2690760	I would like to see BIOSes that properly, uh, allocate domains to different devices as opposed to just throwing everything into a single domain.
2690880	2699560	Um, it's a, it's a lot to wish for, but you know, when we have the real threat of stuff like this happening, um, that's what drives manufacturers to fix this stuff.
2699560	2700180	Thanks.
2701420	2702320	Okay.
2702320	2703720	More questions out there.
2703720	2704200	Thank you.
