start	end	text
0	5500	I'm going to announce Chris McCoy. He's a good friend of mine. He's been at Cisco for 12 years.
5580	10100	He's in this super spooky group called ASIC, like he mentioned.
10100	17360	Nobody knows much about that village. I mean, much about that portion of Cisco.
17360	20340	He's going to explain quite a bit about what they do.
20480	24680	And then also open up some other information that I think you'll enjoy.
25220	29500	He's a... well, you can see. He's a principal engineer for Cisco.
29500	35060	He actually is going to be next door. He's been helping with setting up and running the village with us.
35060	38840	So give a warm welcome to Chris McCoy. Thank you.
39720	44420	Thank you, Joseph. Thank you. Thank you, Joseph.
44720	52320	So yeah, my name is Chris McCoy. I am with ASIC, the Advanced Security Initiatives Group in Cisco.
52720	56180	And we're primarily based out of Knoxville. We have people in Austin.
56180	59220	We have people in RTP and all over, really all over the world.
59220	65960	And what we do is we are the primary white hat hacker organization for Cisco.
65960	67620	So let me go ahead and get into this.
67620	75620	I'm actually going to show you a real security evaluation that we did on application-centric infrastructure and the results that we had.
76100	79780	And anyway, let's just get into it. Hopefully you can see this.
79780	82840	So these are the greats that fly. Nicholas, thank you so much.
82840	84460	Everett, thank you so much.
84460	86600	Amit, you know who you are.
86600	91900	Omar and the rest of the ASIC crew, Terry, I couldn't have done this without you, so thank you.
91900	94940	And audience, please save your questions until the end.
94940	97980	I have a lot to get through, and I have a lot I want to show you.
98120	102800	So just wait until the end, and then I'll answer any questions you have within reason.
102960	103540	Okay?
106180	109680	All right, so disclaimer. I am speaking for myself and not Cisco.
109680	113140	I am not officially here on behalf of Cisco.
113200	114640	I am in a Cisco group.
114640	116840	This information is three years old.
116960	120400	So these vulnerabilities that I am sharing with you have been around a long time.
120400	122820	Just to give you an idea about when we got started.
122820	131760	We got started on ACI just right after Cisco acquired NCME, which is the business unit that this came from.
132180	136260	And so this is... a lot of this stuff has already been disclosed.
136260	138820	It's already been released to customers a long time ago.
138820	143000	And if this stuff still affects your network customers, it's because you aren't patching.
143000	145080	Please patch. Okay.
145280	148360	And this is not a rebuttal to the Black Hat 2019 talk.
148360	152840	There was a talk called Apex Adventure in ACI Wonderland by Oliver and Frank Block.
153640	156500	The findings might be interesting to those that have seen that.
156500	160380	But if you haven't seen that before, it looks like I need to stay away from that speaker.
161180	164940	But the findings may be interesting if you've seen that talk.
164940	167660	But if you haven't seen that talk, then I'll actually go through this whole thing.
168240	172640	Security and Trust Organization is who I'm part of with the Advanced Security Initiatives Group.
172640	174360	And so we're security-focused.
174360	181140	We try to find security vulnerabilities as early as possible in the product lifecycle.
181140	186280	So we have... usually we work in about three or four team members.
186280	188180	And we just hammer on a product.
188180	190400	It could be for a month. It could be for six months.
190400	196500	It's basically like a red team that lasts a long, long time looking for vulnerabilities.
196500	200540	And we discover those zero days and we get them patched out and get our customers protected.
200540	201500	That's what we're here for.
203300	206440	I also wanted to tell you that networks are not that boring.
206440	209960	I've made an entire career out of hacking networks.
210220	211300	It's amazing.
211640	216580	There are so many things and so many opportunities for red teaming networks you have no idea.
217140	219740	Apps and operating systems I actually find a little bit boring.
219740	220900	I like the plumbing.
221140	227640	Because the plumbing has a lot of opportunities for attack surfaces and all kinds of things.
227640	228860	And I'm going to show you one.
229620	233080	Okay, so I'm going to get into software-defined networking, SDN.
233240	235240	SDN means a lot of things to a lot of people.
235240	236880	It has a bunch of different definitions.
237180	239680	This is really what it is, kind of boiling it down.
243460	247580	So, boiling down software-defined networking, it is really about a central point of management.
247580	248640	That's what you want.
248660	252940	You want to optimize your network for physical, virtual machines and containers.
253260	259040	You also want to do some kind of policy enforcement so that you have what are called micro-segmentation.
259040	262340	Where only certain services can talk to other services.
262340	264000	And I'll get into that a little bit more.
264380	267180	But really what you need is you need programmability.
267180	270360	You need to adapt the network to the endpoints, the agile forwarding path.
270360	272040	And you need to have some kind of discovery.
272040	274180	You need to know where things are located.
274500	278320	In ACI, in Cisco ACI, this is made for a data center.
278420	281860	It is designed to scale up to one million endpoints.
281900	285480	And an endpoint can be a VM, it's an IP address, MAC address.
285480	289860	It scales up to that large of a data center.
290200	294100	It also has the property of multi-tenancy.
294380	298860	So you have many different customers that are all connecting to the same data center network.
298860	301000	And they all want to be able to control their own policies.
301000	302800	So it's a multi-tenant environment.
303100	306320	You also want to control how endpoints communicate.
306320	310940	What TCP ports are available from one source to a destination.
311440	313700	You also want to be able to insert middle boxes.
313700	318780	You want to do things like load balancing, real firewalls, NAT.
318780	321640	If you're doing carrier-grade NAT, maybe you need something like that.
321680	327260	And so the answer to all of this is the application-centric infrastructure or ACI, Cisco's ACI.
327660	329460	And so this is the way the fabric looks.
329460	334900	The fabric is made up of switches that are in the rolls of leafs and spines.
335000	339680	So this is what's called a cloth network, if you've ever heard of this, a bipartite graph.
339680	346660	You have a spine, and the spines are really responsible for routing traffic from one leaf to the other.
346660	351280	The leafs are fully meshed up to the spines, and the spines are fully meshed down to the leafs.
351320	354480	And the idea is that you can load balance across the spines.
354760	356300	And this is just one layer.
356300	361000	You have very large networks, like at Facebook, where they have multiple layers of leaf and spines.
361800	365200	They also have other layers down here, too, where you have maybe top-of-rack switches.
365200	366960	But typically, this is what it looks like.
366960	372260	And then attached to the leafs, you have the controllers. Those are called your APICs.
372260	377320	That's your Advanced Policy Infrastructure Controller, is what an APIC stands for, APIC.
378560	381080	And attached to your leafs, you've got your servers.
381080	382580	You've also got something called VLEAFS.
382580	390320	This is your hypervisors that actually are running the code, the ACI code, to be able to do the fine-grained policy that I was talking about earlier.
390360	393180	You have virtual machines and containers that are running in there.
393180	399100	You've got your firewalls. These are your services, your Layer 4 through 7 services that you're doing for load balancing.
399320	403140	And then you have external networks of some kind. You have to connect this somewhere.
403480	408020	You have to connect to routers and switches that go outside.
408020	411980	You need to sometimes maybe connect to the Internet. You need to connect to your intranet.
411980	413420	And you'll have an external network.
413420	417300	And so the thing to keep in mind is, for the most part, you don't attach to the spines.
417300	418940	That's not always true.
418940	424620	But you attach to the leaf, and you'll have things like services for leafs that you attach to.
424860	426080	Is everybody with me so far?
426080	428200	This is an example of what these switches look like.
428200	430200	They are rather high-powered.
430480	435520	The ones on the top actually do power over Ethernet, so you can attach things like phones and cameras to them.
435780	443840	The one on the bottom, that has multiple 25 gigabit Ethernet connections, and it has, I believe, it's either 100 gig...
443840	446400	Yeah, I think it's 100 gig uplinks that it has.
446400	448400	So this is pretty high-powered stuff.
448400	452180	Many, many different connections, like I was talking about earlier, up to a million endpoints.
453160	454400	Okay, ACI, they have...
455240	456480	So I'm a CCIE.
456480	458860	I've been doing networking for about 25 years.
458920	465440	And I had to completely unlearn networking to really understand how this thing worked, because it was just boggling the heck out of my mind.
465440	466720	I just couldn't understand it.
466740	470520	But at first, really, I had to unlearn it and then relearn it to really understand what's going on.
470580	473100	When you have VLANs, they aren't really VLANs per se.
473100	474480	I mean, they're not bridge domains.
474480	479180	They represent what are called endpoint groups, EPGs, endpoint groups.
479180	484260	And endpoint groups are a grouping of endpoints, and they are allowed to freely communicate inside of the endpoint group.
484260	490580	So all of your endpoints that are inside of your endpoint group, they can talk to each other without any kind of policy, any kind of constraints.
490720	494160	You can go from one endpoint group to the other without any problems.
494200	499040	So the idea with this is that, you know, we're running out of IPv4 addresses, right?
499040	505040	I mean, and people have to make these very large networks, and you have to be able to constrain your network so that...
505720	511100	or you need to be able to design your network so that you don't have to be constrained by IP addresses and VLANs and all those things.
511100	513040	And that's what EPGs are all about.
513620	518020	Contracts. Contracts are what allow you to talk from one EPG to another.
518020	522170	These are basically saying you have a provider and consumer relationship that says,
522170	529830	I am providing TCP 443, HTTPS. I'm providing this to anybody that wants it.
529910	537150	And then if I have a contract that comes along and it consumes that endpoint group, then that endpoint group can use that TCP 443.
537250	541430	And if you're not part of that contract, then you don't get access to that port.
541430	542910	It's the way it's supposed to work.
543850	547490	Okay, inside of the fabric, the fabric is completely Layer 3.
547490	551150	Even when you're doing Layer 2 connectivity, when I say Layer 3 and Layer 2,
551150	553550	when I say Layer 3, you're actually going through a router.
554390	559450	When you're going through from one endpoint group to another endpoint group, you're always going to be routing.
559710	562070	And the way they do this is they use an overlay.
562070	564770	You've probably heard of things like VXLAN.
564810	570970	If you haven't learned VXLAN, you don't understand VXLAN, you really should, because everything is going that way.
570970	577130	And they're starting to even use VXLAN in the edge of your network in your access layer.
577130	581630	Cisco has software to find access, and I'm sure there's probably a lot of other ways out there.
581710	584930	But as it turns out, it makes it really easy to be able to do policies.
584930	588190	Please save your questions until the end of the presentation. Thank you.
589150	591270	Okay, your links are IP unnumbered.
591270	594790	We're using ISIS internally. That's the routing protocol that they use.
594790	600490	And one of the things about ISIS that makes it really interesting is that it runs on link, and it runs at Layer 2.
600530	605610	And it doesn't actually give you an opportunity to be able to inject things across broadcast domains.
605610	613270	So if you're on a switch, what this means, if you're on a switch, you're not able to actually get access to that link to be able to inject things into ISIS.
613270	614410	So it's a little better.
614710	621650	But it's always Layer 3 routed, and they advertise what are called VXLAN tunnel endpoint IP addresses.
621850	625670	So whenever you have a frame to send, it goes into the leaf switch.
625670	631510	The leaf switch encapsulates it in VXLAN and routes it across the fabric to the destination leaf switch.
631510	640830	The destination leaf switch then takes that encapsulated Ethernet packet frame, strips off the VXLAN stuff, and sends it on its way to where it needs to go.
642090	646130	And they use ISIS. It's been tuned for a densely connected fabric.
646130	650850	So of course you have many connections that are going all over the place, and it's been tuned so that it works.
650850	655610	And they use IK multicast. If you don't know where things are going, they use anycast.
655830	660610	So one of the things I'll talk about a little bit later on is that the spines are not dumb.
660610	665850	The spines are actually really smart. They're the ones that do all of the tracking of who's connected where.
667370	670450	We talk about tenants, VRFs, and bridge domains.
670630	679910	VRFs, and they call this a context inside of ACI, but it's basically when you get boiled down to it, you've got a VRF, which is a routing table.
679910	689190	You have a bridge domain, and the bridge domain contains subnets, and those subnets can be anywhere on any leaf switch that's in your fabric.
689190	692750	And you have multiple of these since you have multiple tenants.
694250	702930	So endpoint discovery. So when a device talks to the fabric for the first time, it will maybe send DHCP, send ARP, send something.
702930	705470	It doesn't know who it is and who it's talking to.
705470	710750	So what happens is the leaf switches are constantly listening on these things to do discovery.
710750	715650	So when a VM, for instance, sends a packet for the first time, the leaf switch will pick it up,
715650	719950	and it does a source lookup to see whether or not it knows where that leaf or that source is.
720110	724090	And once the endpoint is discovered, it sends through a proprietary protocol called COOP.
724090	729690	That's the Council of Oracle's protocol, and that's how it does location learning.
730370	737830	So just in this example here, I'm showing something different where we have a VM that's running in vSphere.
737830	744890	It's running VMware. It talks to the vSwitch. The vSwitch then sends it on to the vXLAN endpoint.
744890	749210	So this is supposed to be agnostic. Pretty much vXLAN has won out.
749210	752310	There's another encapsulation technology out there called Geneva.
753170	759230	But there used to be NVGRE, and I think Microsoft has also kind of moved away from that.
759250	763210	But once the ingress learns the MAC address and IP address of the arriving frame,
763210	771030	it sends that along with the ingress port vLAN and vXLAN to the switch,
771030	776890	and then the leaf forwards that endpoint address to the spines using the 0MQ protocol.
776890	783350	That's what they use. And then that information is spread out, or it's distributed to all of the spines.
783350	788430	So all of the spines know at any one time who's connected where. Hopefully that makes sense.
788730	793110	This will come important later. And then when you send the information,
793110	798890	when you send the frame to the egress leaf, the egress leaf then is able to learn the source address,
798890	803170	MAC address, and all that other information when it gets to where it's going, unless you tell it not to.
803170	805590	There's a flag in the frame that says don't learn this.
806810	809250	So what is this for? What are we going with this?
809250	812270	So just showing you, this is the life of the packet. This is how the packet works.
812270	817870	It's sent from the vSwitch to the vTEP. The leaf switch then, if you're using vXLAN,
817870	823950	it actually swaps out the vXLAN information for its own internal and semi-vXLAN protocol.
823950	833070	It goes across the fabric. If it doesn't know the destination, it sends it to a spine using an anycast IP address.
833070	837530	And it's just basically a range of IP addresses that are allocated to all of the spines,
837530	840910	and all the spines are listening on that IP address all the time.
840910	845390	Then in hardware, they're able to do that lookup to find out where that actual destination is.
845390	850770	And then it gets sent to the destination leaf switch. The leaf switch then strips off that information and replaces it.
850770	854510	If they're using VLANs for your endpoint groups, it can use VLANs.
854510	858330	If you're using NVGRE, which isn't as popular anymore, they may use that.
858750	860650	But that's basically how it all works.
862690	866410	So then we get into VRFs. I'm going to just zip through this a little bit.
866630	872850	But this just shows how tenants, VRFs, and bridge domains, and endpoint groups all work together.
872850	875770	How the frame source information is kept.
875770	879690	It's actually relayed from one leaf switch to the other through vXLAN.
879690	884770	And the APIC controls the allocation of VNID labels across the fabric.
884810	893010	By labels, I mean things like your actual VNIDS, that's your vXLAN network ID, and your source groups, and all those other things.
893010	897330	And it does policy enforcement either at the source or the destination.
897970	904110	And whether or not the policy has already been enforced is signaled through a flag in the label.
904110	905870	And this will become important later.
906890	912470	Central Management and ACI, they use a REST API that's load-shared through the APICs for everything.
912470	915970	In other words, you can put a load balancer in front of this thing and it would work just fine.
915970	918390	It doesn't matter which APIC it shows up on.
918770	923210	It uses what's called sharding, which sounds really dirty to me.
926030	928490	But everything is sharded.
930010	934170	In other words, they have different instances that run on different APICs.
934170	936910	I'm going to get into the security a little later on, I promise you.
937710	939790	But they use this API for everything.
939790	943550	They use it for the REST, they use it for the GUI, they even use it for the CLI.
943710	951470	So when you're on the command line interface and you're SSH'd in, they actually run a chroot jail when you're SSH'd into the box.
952110	958750	And even when you're talking to, even when you're configuring things through the CLI, that even gets translated up to the REST API.
958750	962050	So they really have only one way in or out of this system.
962050	965290	Which is good, because it only gives you one thing to secure.
966530	970890	And they also have a Python SDK called Cobra that they use to manage.
970890	974850	So let's actually get into the interior of this thing. This is how it all fits together.
974930	979690	These are your switches. These could be either leafs, these could be spines, and then you have your APICs.
979730	985790	And your APICs somehow magically can connect to and talk to the leaf switches or the spines.
985790	990910	And the APICs run these processes inside them. These are called data management engines, or DMEs.
990910	996130	And the DMEs have their own internal proprietary protocol called intrafabric messaging.
996390	1000190	And the primary front door through this whole thing is through NGINX.
1000750	1007750	So the DMEs are responsible for a little part of something called the Management Information Tree, or MIT.
1008310	1014590	And all communication happens through NGINX. So if you're going from the outside in, you're going through NGINX.
1014730	1020430	And they communicate to each other from the switch, from the APICs, all through IFM.
1020430	1026090	And it happens in between the VTAP IP addresses, and how they secure that I'll get into in a little bit.
1027030	1030310	This is just a gee whiz diagram of how this all works.
1030310	1036170	What's important here is that they have the intrafabric messaging that comes in over TCPIP.
1036170	1039230	So internally, this is all proprietary the way this all works.
1039730	1046270	They have the doer. They have this model that tells what they need to do in this Management Information Tree.
1046270	1049930	And they have a replicator to replicate it to other DMEs if you're doing sharding.
1049930	1053430	And then they have a persistifier which stores to an SQLite database.
1053610	1056310	And each of these has its own database.
1056370	1061310	And they also structured it so that if for sensitive data, they encrypt that data.
1061310	1064610	If it needs to be encrypted, it will be encrypted on the box.
1065690	1069170	It's actually not a bad design. I'm pretty impressed with it otherwise.
1069330	1075230	Communication of policy and ACI, they use DME to DME communication through IFM.
1075270	1078690	And they use TLS using mutual authentication.
1078690	1082770	So there is authentication not only of the client but also of the server.
1082770	1087030	And the certificates that they use are loaded on the switches in the APICs at the factory.
1088190	1093510	So the certificates that are used, they have a very long expiration date.
1093750	1100890	And the way they work is they use that certificate to authenticate the client and authenticate the server.
1101710	1104030	I think you guys can see where this is going.
1104710	1110850	The abstract policy on the APIC that they use, the endpoint groups, they actually take that and they make it concrete
1110850	1114530	and they enforce it in the leaf switches using the DMEs.
1115570	1122030	So for device discovery and ACI, if you were to plug an APIC into anything,
1122030	1127750	the only protocol that it speaks at first is LLDP. That's Link Layer Discovery Protocol.
1127810	1132770	If you were to plug into a switch, the only protocol that they use is LLDP.
1132770	1137270	That's all we saw. So I was like, oh great, what's the attack surface going to be?
1137390	1141030	Obviously, the LLDP. That's one of the main things that we're going to be using.
1141390	1146870	One of the things that I'm really kicking myself in the butt for is that the folks that I was telling you about earlier
1146870	1151910	that did the Black Hat talk, they found a buffer overflow in LLDP that we missed.
1152150	1156830	And I feel really bad about it and I wish we had found it earlier, but hey, it's patched.
1156850	1162310	And if you're listening to this video, please patch your fabric.
1163630	1169350	Custom TLV, they have their own little proprietary TLV that they use for discovering the fabric
1169350	1175970	so the fabric can discover the APICs. And when the switches see these custom TLV packets,
1175970	1180130	they will open the underlay to the device that's connected to it.
1180130	1184830	And one of the things about LLDP which makes it interesting is it doesn't travel over switches.
1184930	1188510	It only travels inside of a broadcast domain, actually a collision domain.
1188510	1190590	It's only from one point to the other point.
1190590	1195510	There are multiple MAC addresses, but one of the MAC addresses that they actually use here will only travel one hop.
1195510	1197190	It won't go any further than that.
1197530	1202190	And what that also means is that unless you really screwed up with your hypervisor configuration,
1202190	1205250	you have to be bare metal attached to be able to tinker with this.
1205250	1208210	You can't do it from a VM. Make sense?
1210390	1213530	So here's the real deal. Here's what we did.
1213530	1218850	I've given you all the background. You know about DMEs, you know about LLDP and all those wonderful things.
1218850	1222430	How are we going to do this? How are we going to actually own a datacenter? Here's what we're doing.
1222970	1224670	Sure, let's own the datacenter.
1224670	1229610	So in this case, in this situation, you have a device that maybe got owned.
1229610	1233010	It's a bare metal device. Let's say it's not a hypervisor.
1233010	1238130	Or maybe it could even be a hypervisor where somebody escalated privileges and got access to the hypervisor.
1238130	1241450	Or maybe they were in a container and they escalated privileges and got access to the hypervisor
1241810	1246110	so that they can send directly to that leaf switch and be able to talk LLDP.
1247490	1249650	So that's the situation here.
1249650	1253850	And what we want to do is we want to attack the APIC, which is more than one hop away.
1253850	1258670	And remember, this is a Layer 3 switch fabric and it has overlays.
1258670	1262710	And normally we can't even talk to the APIC because the APIC does not process packets.
1262810	1266850	The packets flow from leaf to spine to leaf. They don't go through the APIC.
1266850	1269330	We don't even have a way of talking to the APIC or touching the APIC.
1269330	1272550	So we need something to be able to get us access to that.
1272550	1276470	It's the central point of management for the entire ACI fabric.
1276910	1280890	Anything that an admin can do, they can do from there and it makes it for a very tempting target.
1280890	1284210	It's a sync target. It's the controller in your entire network.
1284370	1287770	If you have a million endpoints, they're all being controlled from the APIC.
1288650	1293270	So central management, we looked at the GUI and the GUI actually looks pretty good.
1293270	1297790	They use an off-the-shelf framework. I forget which one it is right now.
1297790	1300550	They probably have already changed it anyway because this is from...
1300550	1307130	When we did this eval, it was on 1.1 or 1.2 was the version and I think they're up to 4 something now.
1307130	1309030	So they've been around a long time.
1309170	1313550	So they had cross-site request forgery protections. That's one of the first things we'll look for.
1313630	1318050	They were very well protected from XSS but not for the reasons you would think.
1318710	1322130	Anytime they took any kind of data from the user for any field,
1322130	1327810	they would limit all of the fields to basically alphanumeric characters, spaces and things like that.
1327810	1330590	And that's all you could do. You could never do anything like brackets.
1331550	1336950	So we thought, well how can we do this by looking for some fields that may not be user input?
1337290	1342030	And so we did XSS, actually cross-channel scripting on LLDP.
1342430	1346230	So the idea is that you may do a social engineering attack.
1346510	1350090	And you say, hey admin, I'm having a problem. I'm not getting connected.
1350090	1351630	Can you make sure that I'm connected to something?
1351630	1356830	Can you go look at my interface and look at LLDP for me and see what you see?
1356830	1362470	Because I'm sending out LLDP and if you say that it's really attached to my machine, I'd really like to know.
1362470	1364350	And so you get somebody to look at it.
1364350	1368210	In the meantime, notice on the right hand side we have local users.
1368210	1372190	We're going to run this script that just sends an LLDP frame, single frame.
1372190	1373470	Boom. Did you see it?
1374890	1380930	Just by taking advantage of the access that the browser had, we're able to create our own user.
1380930	1384190	There's a user now called Hacker. And we'll just have this open at the same time.
1384190	1385730	That happened in real time.
1386410	1391950	So now if you look, we have access to pretty much everything on the APIC.
1391950	1394990	Well, that's fun. So let's go a little bit further.
1395850	1398670	We need a route. We need some way of getting to the APIC.
1398670	1401810	Let's say the APIC's behind a firewall, which hopefully they are.
1402030	1406430	We have no real way of getting to them, but we do have access to the fabric.
1406590	1408590	So let's see if we can get access to that.
1408990	1412050	So there is something called the infrastructure VLAN.
1412050	1418610	If you've used ACI before, there's this little checkbox on the port that says give access to the infrastructure VLAN.
1418810	1422570	That infrastructure VLAN is the crown jewels to your fabric.
1422570	1424550	Don't give it to just anything.
1425310	1428590	And the reason why is it gives you access to the underlay.
1428870	1435650	Even though it's called an infrastructure VLAN, what they did is they set aside a VLAN for accessing the underlay.
1436630	1440670	When we got into this, we knew that there was ISIS, we knew that things were routed,
1440670	1444150	and we were like, how the hell am I ever going to get my IP address into ISIS?
1444450	1446310	I was like, how is this going to work?
1446490	1449670	Well, as it turned out, later on we found out that they do DHCP.
1449670	1452410	When you have access to the infrastructure VLAN, that's one way.
1453050	1457310	Another way is they actually learn your IP address, which I'll talk about.
1458070	1461070	Enrollment of the APICs is automatic, so they do zero-touch provisioning.
1461070	1468310	Anytime you ever attack a fabric or a network for the first time, look at how they do day zero configuration.
1468450	1470570	Chances are you might find issues there.
1472390	1477110	Communications at Layer 2, we saw LLDP, and we know that there are custom TLVs,
1477110	1480810	so we wrote a Scapey plugin to generate these TLVs.
1481170	1484710	And there's no authentication before them, so what happens if we tweak and replay?
1484710	1488210	We find that it says, hey, you're a controller.
1488610	1492390	You have access to the controller endpoint group, and you have infrastructure.
1492390	1493690	So that's what we did.
1494050	1496590	And this is what it looks like in the underlay.
1496830	1498130	So you have the APICs.
1498130	1501630	The APICs are usually dual-attached to two leaf switches,
1501630	1504010	and then they have a set of subnets that are...
1504010	1509410	or there's a subnet that's set aside on that leaf switch that is advertised out,
1509410	1512410	and this whole thing is on the underlay IP address range
1512410	1515010	that you'll specify when you first set this thing up.
1515470	1518610	And you'll notice that it's all completely routed over ISIS,
1518610	1520710	and if we're the attacker, we can do the same thing
1520710	1523470	and represent ourselves up as an APIC.
1523470	1527570	So we're spoofing ourself to the network and saying that, hey, we're an APIC,
1527570	1530130	and it believes us and allows us onto the fabric.
1531410	1534830	Once we're on the underlay, we have a much larger attack surface.
1534830	1537090	We can get access to all of the different APICs.
1537090	1541270	We can get access to the hypervisors that happen to be attached to the infrastructure VLAN,
1541710	1545250	and all of the switch and APIC DME ports are accessible.
1545250	1548390	We can get to them, but they're protected by TLS.
1548930	1551210	They're using mutual authentication.
1551850	1556990	We need access. We need some kind of way of getting access to that TLS connection.
1557070	1559430	What do you think we did? Anybody guess?
1560490	1562750	We need a cert and we need a private key.
1562750	1565430	We could steal it from something. That's one way.
1566550	1568970	What's that? Spoof it?
1568970	1572650	Well, it has to be issued by Cisco because it's got a trust store.
1573410	1575090	And, yeah, you steal it.
1575430	1578690	The DMEs, they communicate policy throughout the fabric.
1578690	1582050	That includes all of the users and credentials on the APICs.
1582550	1586870	But we don't have access to the DMEs because we don't have access to TLS credentials.
1586870	1588690	We don't have the certs and the private keys.
1588990	1594190	So we looked at the certs, and the certs showed that they were issued by Cisco,
1594190	1597570	and we know that they are issued by Cisco at manufacturing time.
1597950	1600250	And they have an expiration date way, way, way out.
1600510	1603230	And there's really nothing else that was really special about them.
1603470	1609050	And so we tried another private key and certificate that was issued by a Cisco certificate authority.
1609790	1611430	What do you think we used?
1618710	1625310	If you're doing a tax against a PKI, keep a cache of certs and private keys available.
1625410	1628130	You can extract them out of these things. It's not that hard.
1628130	1629910	It's hard, but it's not that hard.
1630030	1633330	It's just basically on flash. It's kept by Cisco.
1633330	1636230	It's a certificate. It's a private key, and it's issued by Cisco.
1636230	1638130	And it comes from a Cisco PKI.
1638470	1640330	Not all things are that easy to get off.
1640330	1645370	We actually have a module called the TAM, the Trust Anchor Module, which is tamper-resistant.
1645370	1649730	And it's actually programmed somewhere else that's not in a contract manufacturer facility.
1649730	1653910	And they ship those chips to be embedded on a device.
1653910	1655590	Those are a little bit harder to get to.
1655590	1658890	But if it's something that's on flash, you can get to it.
1659230	1662270	So we use that. We get access to that key.
1662270	1666910	And this is a video from soup to nuts of owning an APIC.
1667830	1669690	And so we're going to get those credentials.
1669690	1673390	We're going to stick those on the APIC so that we can get access to SSH.
1673390	1676130	First thing we do is we're going to listen for LLDP.
1676630	1679470	And you can see that we're now sending LLDP.
1679510	1681310	And we have access to the endpoint group.
1681310	1683850	And these are all of the VLANs that we have access to.
1683850	1690610	Now from that point forward, then we can ping our default gateway that is on the infrastructure VLAN.
1690610	1692750	And once we do that, we've been learned.
1692970	1695170	And everybody now knows about us.
1695170	1698910	The Spines, the Leafs, they all know about that IP address that we're reusing.
1698910	1706570	Because they redistribute basically ARP into ISIS so that we're able to get discovered.
1707090	1708950	And then from that point forward, then...
1709610	1711810	So that's basically what I was telling you.
1713350	1717030	And now we'll connect to the APIC.
1717130	1721750	We'll do the same thing. We're going to create a user with our username and password.
1721930	1723950	Then we're going to be able to SSH in.
1723950	1727810	So when you have a username on the APIC, you can SSH in.
1727810	1730310	You can get access as admin but not root.
1730450	1735330	So we wanted root access to the APIC so that we could do something that I'll be showing you in a little bit.
1735330	1741990	And the way we did that, there was a open internal service that you could only get to if you were logged in locally.
1741990	1743850	It was not an external service.
1743970	1746370	And it had a command injection vulnerability in it.
1746370	1750530	And that service ran as root and that gave us access to the APIC as root.
1750910	1754190	And then once we had that access, then we installed a root kit.
1754290	1755370	I'll show you that.
1758050	1762270	Now we've completely withdrawn our LLDP frame.
1762270	1766550	So we no longer have access to the underlay because we don't want to attract attention to ourselves.
1766550	1768330	But we want to get access to the APIC.
1768330	1772930	And the APIC has a VLAN that it sets aside called in-band network.
1772930	1774450	So that gives us access to the APIC.
1774450	1779710	And we just netcad it directly in using our port, which is 1337.
1779710	1781570	And we logged in and that gives us a bind shell.
1781570	1783730	And that's something that we positioned ahead of time.
1783850	1789090	And then we run script dev null and that gives us access to an actual sudo terminal so we can run anything we want.
1789090	1791110	That's kind of a nice trick if you didn't know about that.
1792190	1794290	Type ID, we see that we're root.
1794290	1797810	And you'll notice that there's no processes that are listening on port 1337.
1797810	1798710	They're hidden.
1799030	1803210	There's also no directory there called rootkit.
1803210	1805890	And we just log in and there's the subversive rootkit.
1805910	1809210	The claim to fame with the subversive rootkit, which is really neat.
1809210	1811690	If you haven't played with it, I strongly suggest you do.
1811690	1812870	It runs on Linux.
1813030	1818270	And it does its hooking through the debug registers of Intel.
1818690	1821150	So you don't actually hook anything.
1821150	1824050	You don't modify the kernel in any way.
1824050	1827730	It uses the debug registers to be able to hook the different system calls.
1827730	1829910	And one of the system calls they have, of course, is write.
1829910	1835510	And you're hooking that and you're turning it into leetspeak by just turning lulz mode on and lulz mode off.
1835510	1837010	And you can see the other things you can do.
1837010	1838110	You can hide files.
1838110	1839490	You can hide processes.
1839870	1845870	But, of course, we didn't hide the kernel module even though we probably could have.
1847810	1849050	With me so far?
1850850	1851650	Okay.
1851690	1853170	So after that...
1853170	1855050	Oh, we're done.
1855130	1857430	So this is how it worked in summary.
1857970	1862190	So as a bare metal attacker, we spoofed the APIC VLLDP.
1862190	1864430	We get access to the infrastructure VLAN.
1864490	1865790	We use a static IP.
1865790	1867550	You could have also used DHCP.
1867790	1870290	And that gives us access to the local switch.
1870290	1872210	Then we inject our IP into ISIS.
1872210	1872910	That's automatic.
1872910	1874870	That was something I was like, how the heck are we going to do this?
1874870	1877110	Well, it turned out it was a lot easier to do than I thought.
1877470	1879270	We gain access to overlay 1.
1879270	1881190	That's the name of the infrastructure VLAN.
1881610	1886190	We steal a cert from an existing switch or use the cert or key from a phone.
1886250	1888030	We access the data management engine.
1888030	1891250	The one that we're interested in is called the policy manager engine.
1891350	1893490	And we connect to the shard leader for AAA.
1893490	1895510	We create a local admin user.
1895630	1898610	We then connect to the APIC over the overlay 1 via SSH.
1898610	1900010	We SSH in.
1900130	1903990	Skew the root user SSH keys, which we actually could have done.
1903990	1906450	We did that through a command injection vulnerability.
1906590	1908750	That gives us access to the APICs and the switches.
1908750	1911670	We install a root kit, remove the admin user, and now they're owned.
1917330	1918490	These are the kinds...
1918970	1920350	Clap, if you like.
1920630	1921550	Thank you.
1923450	1925770	These are the kinds of things that you'll see.
1926390	1929370	For our customers, you may be wondering, like, why am I doing this?
1929370	1931610	Why am I talking about Cisco in this in-depth?
1931610	1933990	I want you all to know that we work really hard.
1934390	1936170	The ASIC team works really hard.
1936170	1939650	I'm blessed every day that I get to work with such great people.
1940750	1942110	It's absolutely amazing.
1942110	1945370	Some of the smartest people on the earth are in ASIC.
1945370	1946330	I just love it.
1946490	1948350	I just go to work every day. I just love it.
1949830	1950630	Owned.
1952470	1955910	We have access to the APIC, but we want access to the endpoints.
1956430	1959390	In CME, they have VXLAN.
1959390	1961390	It is mostly standard.
1961390	1963730	I think that they use a weird UDP port.
1963730	1968090	But there are a couple of flags in there that says whether or not policy has been applied.
1968090	1969930	The source policy applied flag.
1970030	1980450	Once you have access to the infrastructure VLAN, you have direct access to be able to send NCME VXLAN encapsulated frames.
1980770	1985350	They get routed through the leaf switches, and then they can get to their target.
1985350	1988750	And you just say, hey, I've already done source policy.
1988750	1989650	Don't worry about it.
1989650	1993870	And then the destination leaf switch will forward it on to the destination.
1995210	1997090	It's just as simple as that.
1999690	2004870	Once you have that access, for instance, once you send something to it, you can spoof your IP address.
2005050	2008610	Maybe you may respond somewhere off your network.
2008610	2012170	Maybe you can get tumbled somewhere else, so then you can respond to it that way.
2013870	2016830	That's basically all there is to it. It's quite easy.
2017290	2019410	Here are the fixes that they did.
2019650	2022170	XSS, obviously, is very easy.
2022170	2026090	The XSS vulnerability was actually a DOM XSS vulnerability.
2026310	2031230	It was not stored. It was not reflected or anything like that. It was in the DOM.
2031230	2033310	So make sure you sanitize.
2033310	2037670	Don't just rely on your back end to provide safe data to your web app.
2037670	2041190	They used a single page web app. Everything was all done through single page.
2041570	2045270	So sanitizing and escape anything you put into the DOM.
2045390	2047810	Context, of course, matters, obviously.
2048590	2052010	Strict mode. This is one of the mistakes that we made.
2052050	2057530	They couldn't turn this on without breaking all the existing fabrics, so they had a flag.
2057650	2063230	It was a nerd flag that we probably couldn't really talk about very much, even to our customers,
2063230	2066690	because we didn't want them to know exactly how hard...
2066690	2069430	We just said, turn it on. It's one of those things.
2069530	2076790	Because if you don't have it turned on, then you're able to do the LLDB attack and then able to get to the underlay.
2077990	2082810	So strict mode, when you have it turned on, it fixes the LLDP underlay access issue,
2082810	2084870	and it wasn't, unfortunately, backwards compatible.
2084870	2087090	And that's why it had to be a flag that you turned on.
2087090	2091070	One of the things that just went out recently was they made it so that it was on by default.
2091070	2094890	Because this has been three years now, and people probably should have had this on already.
2094890	2096910	So they turned it on by default now.
2097650	2100310	So when the host claims to be an APIC over LLDP,
2100310	2107410	the switch will require a random bearer token to be inserted into LLDP TLV to open the underlay.
2107410	2111430	And the way it learns that token is through connecting to a DME that's on the leaf.
2111430	2116790	They have an ACL that they put on the port that says you can basically connect to the leaf, but no further.
2117850	2121550	Once you connect to that, you'll have access to that one DME,
2121550	2129310	and then that's authenticated using mutual TLS, using the certificates that have to be put in a whitelist ahead of time.
2129310	2134470	Once you have that access, then you have access to the underlay, and only then.
2135350	2139670	Another thing they did was they strengthened the subject distinguished name checking for certificates.
2139670	2145470	This is unfortunately very common, guys, especially in embedded products.
2145470	2149710	Just don't assume because they're using a PKI that they're not actually checking things.
2149710	2151070	You'd be surprised.
2151070	2155450	You can just go get a Let's Encrypt certificate, try to connect to something, and then it may say,
2155450	2158490	well, hey, this is on my trust store. I'm going to allow it.
2159150	2161270	They may not do the subject checking.
2161550	2168590	Make sure you look for that because it's been in five products, I think now, so far.
2169370	2173010	No reason an IP phone should be able to talk to the data management engines.
2173090	2175410	The admin registers these APICs and switches.
2175410	2178990	This is actually part of just what they do when they first set up the fabric,
2178990	2182810	is they'll go in and you'll put in the serial number ahead of time,
2182810	2185090	or you'll actually just say, accept this,
2185090	2188510	and it puts that into a whitelist that's actually used for checking this.
2189070	2191970	This check happens during the initial TLS exchange.
2192510	2195430	And then IVXLAN spoofing, unfortunately, by design,
2195430	2201190	it's part of the use cases that hypervisors be able to send directly to the leafs.
2201190	2202830	That's the VLEAF use case.
2202930	2205030	So, unfortunately, there's not really much you can do.
2205030	2208530	It's just you really want to protect the infrastructure VLAN from untrusted hosts.
2208530	2209870	Make sure you do this.
2209870	2214310	There is a new feature called CloudSec that's on the newer switches
2214310	2217790	that actually does encryption from VTEP to VTEP.
2218570	2222710	And, anyway, it's something that I'm kind of excited about to see,
2222710	2227130	but it uses something very similar to IPsec between the VTEPs.
2229190	2230430	Okay, so lessons learned.
2230430	2231990	Don't expect hardware to play nice.
2231990	2234670	Someone else's box is plugged into your switch's user input.
2234670	2237930	Don't ever trust unauthenticated information,
2237930	2239950	regardless of where it's coming from.
2239950	2240950	You'd be surprised.
2240950	2244450	Even if you're doing LLDP, you can actually do XSS through LLDP.
2244450	2245210	Who knew?
2247030	2250130	Context-sensitive sanitization before inserting into the DOM.
2250370	2253750	PKIs, public key infrastructures, especially in hardware, it's really hard.
2253750	2256350	Because once you've done it, you've done it, and you're stuck.
2257130	2259210	You can't revoke certificates.
2259810	2264690	You don't have OCSP, the Open Certificate SAS protocol, or CRLs.
2264870	2267110	Once you're stuck, you're stuck.
2267110	2269970	You can't really check those kinds of things.
2270390	2273310	Don't abuse protocols. LLDP is strictly for discovery.
2273310	2275110	It's just like Cisco Discovery Protocol.
2275630	2277650	Link-local discovery protocol.
2278910	2280590	Any questions now?
2280650	2282730	How am I doing on time?
2285570	2287870	I actually got through that faster than I thought.
2287870	2288550	Yes?
2295620	2300200	The new Cisco certs that are in Encore, are they going to be taken into account?
2300200	2301320	I don't know.
2301940	2303940	You can send me, drop me an email.
2304660	2307100	Or drop me a Twitter, and I'll see if I can find out.
2314460	2314960	VXLAN?
2317380	2319140	VXLAN is data plane.
2319440	2323640	And the certificates that they do is for control plane or management plane.
2323640	2324900	So they're kind of different.
2324900	2326520	They're orthogonal, but they're different.
2327220	2328340	Any other questions?
2334680	2340260	The script, what the script does, is it connects, so when we...
2340260	2341780	Yeah, it gives you a PTY.
2342440	2343420	A pseudo-terminal.
2343680	2346900	So normally, if you have a bind shell that's listening on a socket,
2346900	2348000	it doesn't really give you a terminal.
2348000	2350240	So if you try to run Vim or something like that, it won't work.
2350400	2353160	So if you run script dev null, that just gives you a PTY,
2353160	2354920	and it doesn't save it anymore, which is really nice.
2354920	2355380	So...
2357540	2360320	You'd be surprised how many little tricks that you learn,
2360320	2361720	you know, just from watching other things.
2364420	2366240	Yeah, I can't run anything.
2366240	2367980	How do I just run... yeah, script dev null.
2368400	2368960	Yes, sir?
2371460	2375440	Are there any similarities between ACI and UCS?
2375880	2379100	The APIC uses UCS server.
2379100	2382960	It actually is a re-imaged UCS server
2382960	2387240	that has its own certificate and ID for it.
2387240	2389500	But other than that, it's just a UCS server.
2390960	2392600	Good question. Any others?
2402750	2405490	Oh, the question was, is where do we run this?
2405490	2407110	We use testbeds.
2407110	2408990	So we set testbeds up ahead of time.
2408990	2411150	That's actually probably one of the most time-consuming parts
2411150	2412850	that we're not actually doing work,
2412850	2414530	is just getting testbeds to work.
2414530	2418170	And for those of you who are doing, like, red teams or cloud pentests,
2419250	2421450	it's the biggest... I hate doing cloud pentests,
2421450	2423490	because you're always depending on somebody else to set up,
2423490	2425170	like, a dev environment.
2425190	2428470	And hopefully it's exactly the same as the production environment,
2428470	2429550	and most of the time it isn't.
2429550	2432070	But what we do is we go through and we try to set up where we can.
2432070	2433590	We try to set up an on-prem environment
2434210	2437430	that looks fairly complex, you know, and real.
2444110	2445590	Any other questions?
2447130	2448850	Any of this interest you?
2450670	2455050	If you like this kind of work, please apply.
2455110	2457950	Go to jobs.cisco.com and type in ASIG.
2457950	2459750	I think there's only a couple jobs on there right now,
2459750	2461690	but we're always trying to hire good people.
2462650	2467070	Any other questions?
2467630	2471910	No questions about inner fabric messaging, TLS, leaf switches,
2471910	2474630	spine switches, connections, nothing like that?
2476390	2477610	Thank you.
2477610	2478790	Thanks for coming.
