start	end	text
0	6020	So now, this is an interesting timing for a talk,
6020	12000	because I want to introduce an old friend of ours who is...
12520	16600	This is the first time we're going to have a talk,
16600	23180	but then immediately you're going to have to hop over to the next room for a workshop.
23180	27240	So this is like the prelude to your workshop, isn't it?
27240	29720	Without much ado, Jay Beal, everyone.
34180	36640	Hi, hi. Hi, hi.
36680	40780	I'm going to try really hard to stay within range of the mic.
42300	44240	And let's see how I can do with that.
44240	46280	I'm not really good at staying in one place.
46280	47840	I kind of like to walk around.
48900	52540	If you've seen me at many DEF CONs in the past, I like to dance.
52660	57460	So anyway, with that said, I'm going to talk to you about attacking and defending Kubernetes.
58100	64320	It's a topic that's become incredibly important to me and dear to me and interesting to me.
64420	69000	So I have a bio slide, but we all know bio slides are just big seas of text.
69100	72740	So I have a graphical bio slide, which basically says,
72740	76000	this is stuff I've done or stuff I'm interested in.
77260	82460	I really enjoy... this is stuff kind of going back way back to the...
82460	88860	back in the day writing at Security Focus and doing CIS work and giving some early, early DEF CON talks.
88860	97340	And nowadays teaching a class at Black Hat and enjoying a heck of a lot of work at Engardians as a CTO
98100	100980	who likes to still be a very technical CTO.
101040	104800	So anyway, let's get on with what you came for.
104800	105760	So what are we going to see today?
105760	108780	We're going to talk about Kubernetes.
109000	111420	I'm going to do a bunch of demos.
112080	114220	We'll do a little bit of choose-your-own-adventure.
114220	119580	If all my... if the tech works, the choose-your-own-adventure part is entirely new.
119580	122360	So the nice thing is cutting edge fresh.
122360	124480	The downside is, uh-oh.
125240	127700	So hopefully this is... hopefully this goes really well.
127700	129700	So I'm going to talk about what Kubernetes is.
129700	134380	I'm going to talk about how you... what you attack and how you attack it.
134380	136040	And then a little bit about how you defend.
136040	137400	We're going to do some demos.
137940	138940	Let's just start.
138940	144780	So the first thing I do any time I talk about Kubernetes is talk about what the heck this thing is for.
145380	150000	And because... and I want to make sure I'm coming through on the mic.
150100	152420	Am I coming through on the mic in the back of the room? Perfect.
152660	155120	Okay, so what the heck this thing is for?
155460	159520	And, you know, people are like, I know that this is hot.
159520	160820	I know that I should use it.
160820	163460	That's kind of the same way we all felt about Docker.
163640	168500	So, you know, why do we use this or what's made it so big?
168500	176420	And basically the Kubernetes came out of... in a lot of ways it came out of what Google is doing with the Borg, right?
176420	181820	It's an open source project that initially got released by Google and now has many, many, many contributors.
182320	185080	But Kubernetes basically came out of this need.
185240	190960	We know that Google... we know that Google had just... has a ton of computers and a ton of workloads.
191060	197500	To be clear, you know, it's not exactly the most transparent company all the time, but they have some public statements they've made.
197500	203060	One is back in 2014, they were launching 2 billion containers per week.
203060	207100	If that were evenly distributed, it'd be 3,300 containers per second.
207240	209220	What's a container? It's like a workload.
209220	211740	It's a program that's going to run for a little while and do something.
211740	213600	We don't know how long that while is.
213620	223100	But if you're launching 3,300 a second, you can't have a human being decide which virtual machine or which host, you know, each program, each workload is going to go on.
223100	226040	So you end up needing a tool for that.
226040	228060	Now, what else?
228420	230080	Well, they did this.
230080	234860	They were launching all of those workloads onto 2.5 million servers.
234860	237200	At least that was their number back in 2016.
237280	241660	And in 2016, hard drive failure rates were just right below 2%.
241660	247220	So if every server had just one drive, and that's a big, you know, hand-waving thing.
247220	254720	But if every server had one drive, that meant they had 133 drive failures a day, or one every nine minutes.
254720	258500	So now you've got a resiliency problem, right?
258500	270660	Like, you wanted to guarantee, you know, you wanted to guarantee so many nines of uptime, and yet your physical machines are going to, you know, entire physical machines are going to die on some regular basis.
270660	275120	Like, say, RAID, notwithstanding, one every nine minutes.
275120	290160	So what features would you want if you wanted to be able to stage a ton of workloads over a ton of servers, figure out how to use the servers at the greatest, as close to their capacity as you could, so you weren't buying lots of extra machines.
290260	298940	And you wanted to make sure that as programs crashed and as hard drives failed and so on, that you still had availability.
299720	305780	So you end up with what Kubernetes is, which is basically a software-defined data center.
306040	308720	And we do that by container orchestration.
308720	309940	So what do you get?
309940	312160	So basically, this is your feature set.
312160	313240	This is what you end up saying.
313240	322140	You end up saying, well, sometimes I have a lot of people checking their email on Gmail or searching right now for the thing that just happened in the news.
322180	323680	And sometimes I don't have as many.
323680	325240	So I'd like a whole lot of scaling.
325240	326680	I'd like that horizontal scaling.
327540	329480	I have four copies of that workload.
329480	331240	No wait, I have 400.
331240	332900	No wait, I have 50.
332960	333760	And so on.
333760	340200	And you get automatic bin packing, which is that, like, which workload should go on which machine so we can keep all the machines as full as we can.
340240	342700	And you get self-healing, like that hard drive crash thing.
342900	344780	And you get a whole bunch of other cool features.
344780	355620	You get, like, automated rollouts and rollbacks where you can basically deploy multiple versions at once and see if one of them ends up producing more sales or more of whatever it is you're trying to produce.
355740	361280	Or see if one's buggy and then be able to basically route all the traffic to the one that isn't and so on.
361320	366460	You get the other kinds of things you would need if you're going to do microservices.
366600	369960	So you get service discovery and you get load balancing.
369980	374200	And then you get orchestration of your storage and you get secrets and configuration management.
374200	376640	So that's kind of, that's what the purpose was.
376640	378160	I'm going to do a little bit more theory.
378160	382280	So just kind of, like, what's a pod, what's a container?
382280	386720	So, right, we, when we're talking about Kubernetes, we're talking about containers.
387220	389260	But we say pods a lot.
389260	392320	And basically pods are the smallest unit of compute in Kubernetes.
392320	396340	So all the containers in a pod are sharing an IP address.
396340	403400	The only reason you put multiple containers in a pod is if you want them to absolutely positively land on the same host.
403400	407880	Like they have need for very, very quick network access or what have you.
408020	410540	Maybe they need the same local storage.
411500	415580	An odd thing about pods is all the containers in a pod share an IP address.
416440	418980	Okay, so then you've got Kubernetes nodes.
419020	422020	Simply put, a node is any system you're going to run Kubernetes on.
422020	427580	A node is any of the systems in your cluster, whether those are virtual machines or physical hardware.
427580	435860	The nodes run a, well, first and foremost, the nodes, to be a node, you have to have a container runtime.
435860	438480	So you have to have something like Docker or RunC or what have you.
438480	446460	Something that's going to basically take instructions from Kubernetes about creating containers and create them.
446460	448800	And maybe destroy them and so on.
448800	451280	You also need a kubelet.
451280	456440	And a kubelet, Kubernetes kubelet, a kubelet is just this thing that runs in every Kubernetes node.
456440	463040	And it ties the container runtime or the node into the rest of Kubernetes.
463040	465680	It talks to the API servers and so on.
465880	467540	Then you've got a kubeproxy.
467540	471780	And that thing manipulates IP tables rules to create cool networking.
471780	474040	It also serves as an actual proxy.
474980	478180	So, yeah, we'll get into that a little bit more.
478400	480340	And then services.
481000	490540	Services are big because in Kubernetes, and services give me a great occasion to kind of describe how you talk about the names of things in Kubernetes.
490540	495620	When we're doing the attack demos, we're going to be talking about this pod and this pod and this pod.
495620	500660	But for the most part in Kubernetes, you don't ever think about which pod names you want.
500660	507160	The whole idea is that the individual pods, the containers, they're very, very much supposed to be cattle.
507160	508560	They're not supposed to have names.
508560	510000	They're supposed to be interchangeable.
510000	512960	I'm supposed to be able to trash them, start new ones up.
512960	516360	I have to... I'm going for... I'm going for that.
516580	518620	So, what does that mean?
518620	520800	I mean, if I want to talk to a pod, what do I do?
520800	521620	You don't.
521640	523800	I mean, you might, but rarely.
523800	525740	Mostly, you talk to a service.
525860	528640	And a service is mapped to multiple pods.
528640	530600	Think of it as an internal load balancer.
531300	536580	Now, if you've got, like, why do I say that would get me into something cool?
536580	537980	That gets me into labels.
537980	540920	And basically, you have a load balancer.
540920	544760	You can't say this load balancer should be pointed at these five pod names, right?
544760	546420	First, you're going to have a whole lot more.
546420	547260	They're going to get added.
547260	549740	Second, those pods are going to die at any moment.
549740	551660	Third, you're trying to go really, really fast.
551660	556380	Remember, you know, 3,300 containers per second being launched, right?
556440	558080	So, what do you do?
558080	560360	You end up basically labeling everything.
560360	561680	So, you label all the pods.
561680	562560	You give them labels.
562560	565300	And those labels are basically... sometimes they're by convention.
565300	566960	Sometimes they're whatever you chose.
566960	568560	But you label the pods.
568560	569860	And then you create a service.
569860	574960	And you say, everything that... you know, this service is going to be a name, an IP address, or port.
574960	585620	And everything that goes to that name and port, or IP address and port, is going to be sent to one of the pods that have the set of labels the service specifies.
585860	587740	It does kind of open an interesting question.
587740	599220	Like, if you are allowed to stage pods onto a cluster, could you start intercepting other people's traffic by just giving yourself the same labels that their services are looking to land things on?
599400	601860	Hmm. Okay. Interesting.
602800	604280	Last thing we talk about.
604280	609100	Last big, big, you know, kind of simple glossary concept we need is namespaces.
609160	612340	The namespaces are just a logical grouping for things.
612340	613940	So, we'll see those.
614460	624480	They're often used to separate projects, or to separate teams, to separate an individual, you know, maybe to separate, well, anything you choose.
624480	626880	So, there's some way of chopping things up.
626880	636420	And it's important to say a Kubernetes namespace is not the same as a Docker or Linux namespace, so much so that when I teach classes on this,
636420	645720	one of the other folks from Guardians, Jared Fredis, asked if we could please call Kubernetes namespaces, space names, since Docker and Linux, you know, already have namespaces.
645720	648220	So, it was, you know, don't overload the term.
648460	650440	So, here's a quick glossary slide.
650580	655040	I'm going to say a tiny bit more on theory, and then we'll have some fun.
655380	659880	So, Kubernetes basically works in this declarative model.
659880	665260	You don't generally say, you're going to see me generally, like, hey, do this thing right now.
665260	668120	But you don't generally tell Kubernetes to do a thing right now.
668120	674920	You don't say, hey, take this, you know, take this container image, start a container on that node over there with it, right?
674920	679800	You tend to say, you know, it's very delegating and hands-off, right?
679800	684680	So, the idea is you say, Kubernetes, I have this program.
684680	686240	I've created an image.
686240	688060	Maybe I've placed that image on Docker Hub.
688060	690580	Maybe I've put it on some other container registry.
690580	696900	And I'd like you to now, like, download that image, like, have some nodes, download that image.
696900	700120	I'd like at least, say, five to be running it.
700120	702240	Like, if you need more, scale up.
702420	705220	But, you know, I want five, no less than three.
705220	708260	Like, let's, you know, just do me a favor and get that running.
708260	709460	And Kubernetes says, sure.
709460	714300	And it's got a bunch of, like, control loops that basically first make that the state of the world.
714300	715800	So, you describe the state of the world you want.
715800	722120	It basically spends its whole life trying to keep the state of the world where you've said it has to be.
722120	723500	And then it basically loops.
723500	725180	And it says, ah, a machine fell down.
725180	727440	I guess I'll have to reassign those workloads.
727760	731160	Or, ah, looks like something's not responding.
731160	735000	I'll have to, you know, maybe I'll kill that off and I'll start something else.
735080	737420	So, you describe the state of the world.
737680	740500	I think this is basically my last theory.
740500	742800	And I hope I haven't given you too much.
742800	745820	So, the kind of target components.
745820	747460	There are a bunch of components you'll target.
747460	753320	The big ones that you hear about are especially on the first two slides here.
753320	755480	So, you'll target the API server.
755480	764620	The thing that everybody's basically doing all of these HTTPS and, God forbid, HTTP requests against and asking to do things.
764940	771740	And the kubelet, which we said bridged each node into the system.
771740	773240	The container runtime.
773380	778860	You can often think of Docker, and I'll often say Docker, but there are multiple container runtimes.
779300	784580	And that container runtime is the thing that pulls the container images from the registry, you know, like Docker Hub or what have you,
784580	786720	and instructs the kernel to start up a container.
787320	790480	You have an etcd server that maintains all the state.
790480	795620	And if you ever get access to that thing, yeah, there's not really a lot of chopped up authorization.
795620	803400	So, if you get access to it, you kind of own all the, you own all of the persistent idea of what the system is.
803400	805240	And so, that's very good for you.
805380	806860	A Kubernetes dashboard.
807180	810960	That was the thing that got, as I recall, that was the thing that got Tesla in trouble,
810960	818480	where their dashboard was available to the internet and, I think, was allowing anonymous access to do anything.
818640	822460	But that's a web interface, as I, I think it's being deprecated.
823440	828140	There's metrics components and different kinds of cluster services that will give you good information.
828740	830900	Those, those are your usual targets.
831100	836300	Just to throw in two more, two more components that people, that it's really helpful just, you know,
836300	839660	if you're operating Kubernetes, defending it or attacking it are useful to know.
839660	841260	One is the controller manager.
841260	846960	And the controller manager, it makes it sound like it's, like the controller manager would have lots of separate controller programs.
847040	851860	And it kind of does, but they're all just compiled into one big, you know, they're just compiled into one big program.
851860	854520	So the controller manager has all of the controllers.
854520	859500	The controllers are the things that basically do those loops and say, is everything the way it was supposed to be?
859500	862360	Is everything the way it was supposed to be? Ah, something's different.
862360	864720	I'm supposed to have five copies of this. I've got four.
864720	871440	I'll go talk to the next one, the scheduler, and say, excuse me, scheduler, can you find somewhere to, can you find somewhere to put this?
871600	874560	Can you find a node we can put things on?
874640	878060	We tend to target these components only through the API server.
879520	885520	So attacks on Kubernetes, this is where we start to finally get to attack and defense.
887400	892920	Attacks on Kubernetes, they start from, they start from the perspective of compromised pod.
892920	898200	So you can attack, you can attack a Kubernetes cluster from across the network.
898200	905760	And it's even less effective than attacking most companies, you know, across the Internet has been, right, lately.
905760	908000	It's, it's, we've gotten pretty good at perimeters.
908000	912160	Kubernetes is pretty darn good at perimeters because for the most part, it doesn't allow any traffic.
912160	920080	There's nothing, there's no traffic being allowed in unless it's had, unless it's had some kind of ingress defined for it.
920080	926160	So, so for the most part, you attack a Kubernetes cluster from the perspective that you are in a workload,
926160	930280	that you're in a container and that container is compromised or otherwise under your control.
930480	937040	So what are the, you know, what are the, what are the, what are the ways the attacker might end up with that kind of control?
937040	942680	Because, yeah, as you'll see in some, in our demos, this is the, this is the vector I like to, I like to show.
942680	948300	It's the, the attacker found a vulnerable thing that you were hosting in Kubernetes, got remote code execution,
948300	950380	and now they're in a container.
950380	955580	And from that container, they may have the ability to do much more far ranging things,
955580	958440	because we're in an orchestration system, a very automatic one.
958440	965640	They may be able to do far more wide ranging things than if they just busted that, you know,
965640	970880	some web server or some, or something that was in a, that was in a cloud environment or in a data,
970880	973220	or in a, or in an on-prem data center.
973700	976340	So, how else might the attacker have gotten in?
976340	978280	The attacker might have just phished somebody.
979140	983340	Brad Giesemann, who I'll, whose name I probably just butchered,
983340	985770	and whose Twitter handle I'll have at the end of these slides,
986120	991680	has a great slide in one of his presentations about how kube control apply,
991680	995620	and that a URL is the new curl URL into shell.
995620	1003520	Right, if you, one of the great ways to phish somebody would be if you put up a how-to article on Stack Overflow or what have you,
1003520	1009740	and the, you know, part of that article was, oh, just apply my, you know, apply my YAML from this URL.
1009980	1014840	You can get anyone to apply the YAML from the URL, then you've got places for your crypto mining to go.
1016340	1021180	So, and our attacker could just be some internal threat actor who's looking to escalate their privileges.
1021180	1027320	I often, you'll, you'll often hear me use the word user and attacker interchangeably.
1027340	1030720	On the defense side, that's not really because I think all my users are hostile.
1030720	1032580	I just don't know which ones of them might be.
1032580	1036380	I don't know who's being coerced. I don't know who's, you know, getting curious.
1036420	1039080	I don't know who's actually got an axe to grind.
1039180	1042140	And I think we all know least privilege is a good idea at this point.
1042400	1048880	So, okay, so, so if an attacker's going to be in a pod, what are they going to do with that?
1048880	1052780	I'm going to give you a few, I'm going to give you a few things. There's even more, I'm sure.
1052780	1054560	So this is kind of the general way.
1054560	1061080	So they could use just the network access that they get provided by the pod to access other services.
1061240	1065820	And I'll say very, very, very often, especially in the microservice model,
1065920	1069500	a Kubernetes cluster has a bunch of things that are all supposed to talk to each other.
1069540	1077160	And it's actually, it can be a little difficult or at least take some work to sit down and say, okay, what should and what shouldn't.
1077160	1081680	So once you're in the cluster, you have access to a whole bunch of things,
1081680	1086940	many of which might not be intended to be communicated with by anyone on the Internet
1086940	1095080	or anyone that the service that you've pwned is trying to serve.
1095080	1100180	So what else? So the attacker could attack other containers that are in their same pod.
1100440	1105600	Multiple containers in a pod, they share, well, I told you, they share an IP address.
1105600	1109920	They share a local host. So it's a cool little Linux namespace thing,
1109920	1112580	which we won't get into unless somebody asks me later on.
1113380	1118120	What else? So the attacker could make requests to the API server or to a kubelet
1118120	1124340	and ask those to maybe run commands in another pod, maybe even interactively,
1124340	1128260	to start a new pod that has privilege. And that privilege could be all kinds.
1128260	1132740	It could be a privileged pod, which means it'll start on the host and have access to system devices
1132740	1136420	and be able to, among other things, maybe mount the hard drive of the node.
1136420	1142220	But there's just all kinds of privilege you can get out of starting new pods,
1142220	1145860	and I'll show you that. They might gather secrets that Kubernetes provides to pods
1145860	1153420	because Kubernetes has a whole thing where it needs to provide configurations to pods
1153420	1158320	because you're really supposed to make those pods come up with a static image.
1158320	1162220	So the idea is the pod starts with a static, totally replaceable image
1162220	1166760	and pulls whatever information it needs from elsewhere.
1167280	1170120	You might connect to the Kubernetes dashboard to perform actions.
1170120	1174520	Maybe it wasn't accessible from outside the cluster. God hope, or gosh hope.
1175140	1179380	What else? The attacker might find a way to interact with the etcd server
1179380	1186520	and change the cluster state. A nice way if there are network access control rules,
1186520	1188820	network policies in place that are getting in your way.
1188820	1194140	If you can talk to the thing that stores them, yeah, you could potentially change them.
1194940	1202060	And the other one, the one that's really fun to me for anything that's either in a cloud provider
1202060	1208280	or even in an on-prem cloud, is that the attacker might interact with the cloud service provider.
1208380	1213700	And because many workloads will, one way or another, and I'll show this to you too,
1213700	1218000	will have privilege on the cloud provider.
1218060	1220920	So, I'm going to show you a bunch of demos.
1221320	1227240	And these demos are real. They're often things that we do in classes I teach.
1227240	1229840	They're also, I'm going to tell you later on, we have an open source project
1229840	1232760	and it's an intentionally vulnerable Kubernetes cluster.
1232760	1235420	Call it, like, damn vulnerable Kubernetes cluster.
1235420	1237380	This one's called BustaKube.
1238260	1243460	We've got an Easter egg BustaMove video that you can find if you go to the BustaKube.com website.
1244240	1250320	But, so, some of the things I'm showing you are basically available as scenarios that you can play
1250320	1254400	in this open source, free, damn vulnerable Kubernetes cluster.
1254440	1259220	So, I've done a thing where I've made my videos part of the slide.
1259300	1262220	And so now I'm going to see if that actually works.
1263200	1264580	Please work.
1266480	1270060	And if it doesn't, we'll have to use YouTube one way or another.
1270200	1272060	Or something else.
1274060	1275020	Okay.
1280050	1281850	Color me very embarrassed.
1282390	1284470	Let's just see if this one's the one.
1287900	1289860	You should always test your demos.
1290720	1292580	Even when you record them.
1292700	1297840	So, I tell you what, we're going to find another way to do it.
1298380	1304740	And I am going to, let's see, I'm going to unplug from the projector for a second.
1304740	1309100	Because that means I'm going to go and look at my own file system and I'd like to not share it.
1340880	1342100	And here we go.
1348060	1350360	Just embed the videos in the slides, they said.
1350460	1352100	It'll be fun, they said.
1354640	1360160	Anybody old enough to have played Warcraft and you click on the guy and he's like, what?
1360160	1362100	And you click on him again and he says something else.
1362100	1364960	And he says, you know, join the army, he said.
1364960	1366640	See the world, he said.
1366640	1370080	Okay, so here's our demo.
1373340	1377420	And hopefully entering, oh, well that's not a demo.
1382500	1384280	Is that a demo?
1385200	1387600	That's not a demo either.
1395340	1397200	Anybody seen my screen?
1397360	1398660	There we go.
1398800	1402040	Let's just hit this on mirror and call it a day.
1403340	1404380	Okay.
1406580	1407540	Cool.
1408900	1409540	So...
1410360	1411760	That's not the right...
1415540	1419520	Don't mind me, I'm clearly a noob.
1421780	1423860	I may need alcohol.
1425480	1431200	So this is one of the BustaCube scenarios.
1431200	1434380	So you go up and you see a WordPress site.
1434380	1440040	And the WordPress site, I will tell you, is hosted in Kubernetes.
1441840	1446640	And you fire up maybe Durbuster to go looking for hidden content.
1447320	1451840	And Durbuster takes a little bit of time, but we can run it.
1451840	1453680	And let's go a little faster.
1453680	1456020	And what we find is backdoor.php.
1456180	1459940	And so when we surf to backdoor.php, this is what happens.
1459940	1467600	I get this thing where basically this WordPress instance, like so many other WordPress instances, has been pre-compromised for your convenience.
1469300	1473900	So I type ID and it says your www data.
1474140	1478700	And hopefully I shut down Durbuster because it always chews a ton of resources.
1479000	1480400	Something we always say in class.
1480400	1481840	My laptop's running slow.
1481840	1483160	Have you turned off Durbuster?
1483160	1484100	No!
1484140	1486340	It's 500 requests a second.
1486340	1488640	Well, that'll do something.
1488640	1498420	So I'm going to stand up a quick little web server in Kali because I found that reverse shell.
1498420	1500500	So I'm going to stand up a little web server.
1500500	1512520	And my purpose of the web server is to be able to hand a meterpreter or if I wanted a whatever, some other kind of reverse shell.
1512520	1514500	But I'm going to go for a meterpreter.
1515840	1526060	And so I just put in here like, hey, could you please pull this meterpreter binary I've created from my web server and while you're at it, make it executable.
1526060	1527800	And while you're at it, run it.
1528120	1531280	And I like to fast forward my videos because who doesn't?
1531620	1538560	And you go look at the web server and Mrs. Bin has been pulled the meterpreter binary but also a copy of kubectl.
1538560	1546900	The command line utility that you use to do damage, I mean, to administer or use a Kubernetes cluster.
1548060	1550300	So I'm going to pull kubectl.
1550680	1554840	And the other thing I'm going to do is just make sure that it's landed here.
1554840	1557500	So here's Mrs. Bin, my meterpreter binary.
1557620	1559320	Here's kubectl.
1559500	1560500	Cool.
1566090	1572910	And now if recordedj will type a little faster, we'll run the meterpreter binary.
1573890	1582550	And I'm going to go over to my Metasploit console and actually be like, oh, wait, I have an incoming meterpreter that needs to connect to the console.
1582550	1583910	I should probably start the console.
1584890	1586750	This ordering is just great, huh?
1587550	1589270	But that's often how you work.
1589370	1591550	So I'll interact with that session.
1594430	1596570	And I'm now in a pod.
1596570	1597690	I know, it doesn't look like it.
1597690	1602410	It looks like an ordinary Metasploit, you know, pwned Metasploit instance.
1603950	1606890	So, but I see my copy of kubectl, I'm happy.
1606890	1610750	And when I run mount, I get a tremendous number of file systems.
1610750	1613470	I'm not looking at one hard disk or what have you.
1613650	1618550	And a bunch of them have been put there by Docker and by Kubernetes.
1618550	1624650	And so the one that's really interesting to me is this one that says run secrets Kubernetes service count IO service account.
1624650	1631010	As soon as I see that directory mounted, I know that I'm going to have some level of access to the API server and I'm happy.
1631330	1636730	So I'm going to go and first I'm just going to go and collect my flag.
1636730	1639650	I built this scenario as it captured the flag.
1639650	1641710	So let's look at our little flag.
1642510	1644610	And it says, hey, you've found the server's backdoor.
1644610	1646790	You might notice this isn't your usual Linux system.
1646790	1647610	You're in a cluster, my friend.
1647610	1649010	It's time to bust a cube.
1649010	1650830	This container doesn't have any more flags.
1650830	1652510	Can you find your way to another pod?
1652510	1653350	Hint, hint.
1653650	1659710	So cool thing in Kubernetes is, like I said, one of the things you can do is see if you can move to another workload.
1659810	1661190	So you're in a container.
1661190	1662710	Can you move to another one?
1662710	1665310	So I'm going to see what my service count can do.
1665310	1671090	I'm going to go and look in that directory and that run secrets Kubernetes IO service count directory.
1671090	1674530	If recorded J, we'll type just a little bit faster.
1677270	1680910	And I look at that namespace and it says you're in the marketing namespace.
1680910	1683010	So that directory has a token.
1683070	1685930	It has the certificate authorities public cert.
1686330	1690070	And it has a description of what namespace you're in.
1690070	1692710	And that namespace, like I said, is kind of a way of organizing.
1692710	1694310	So we're in the marketing namespace.
1694310	1695670	We'll come back to that later.
1695670	1700270	And then I'm also going to go and look at the environment variables that get pushed into every pod.
1700270	1704970	And my environment variables will tell me where to find the Kubernetes API server.
1705090	1710290	So there's this assumption in Kubernetes that every workload will need to ask Kubernetes to do things.
1710530	1713370	I don't know if that's really the greatest assumption.
1713370	1716850	But I think let's just call it not the strongest of defaults.
1717050	1720990	So I've got the API server's IP address and port.
1724580	1725980	And I'll clear my screen.
1725980	1733100	And I'm going to set up a quick little kubectl where I'm saying alias kubectl to the path to kubectl.
1733100	1736820	The token pasted in from this long path to the token.
1736820	1738460	The certificate authority path.
1738580	1739940	The namespace.
1739940	1741740	And the server that I just got.
1741880	1745160	And so every time I type kubectl, all that stuff will be passed in.
1747660	1751000	So let's just kind of skip and let's see what did I do.
1751060	1753860	So I said let's do a quick get pods.
1753860	1758780	And get pods is honestly my go-to just to figure out if my setup is working.
1759000	1760600	And so it says, oh, there's two pods.
1760600	1761780	You're the WordPress one.
1761780	1764080	And I ran host name and it says that's the one you're in.
1764120	1766160	And then the WordPress MySQL one.
1766740	1767820	And that's another one.
1767820	1769180	So let me see if I can move over to it.
1769180	1770620	Because that was what the hint said.
1770860	1772900	So I'll do kubectl exec it.
1772900	1775000	Looks a whole lot like docker exec it.
1776580	1778920	And what program I'd like to add to that container.
1778920	1779980	I'm going to add a shell.
1780100	1783240	I get this kind of error, but I'm in the container.
1783240	1784660	I've just moved over.
1784660	1786660	And I've probably moved over to a different host.
1786660	1788700	Like I'm probably somewhere else in the data center now.
1789460	1791200	So there's another flag.
1791420	1792980	And we'll go get our flag.
1798450	1800730	And I can't clear my screen because my terminal is not set.
1800730	1804450	So I set it to vt100 because that was one of my first back in the DBS days.
1804830	1806870	Because I'm exceedingly old.
1807530	1810050	And it says, hey, you found your way to another container.
1810050	1812170	Actually, you're on a whole new virtual machine.
1812890	1816490	Moving from one container to another in a Kubernetes system often means switching nodes.
1816490	1820070	Your end goal is to get to the developer's non-containerized host.
1820070	1827710	So it's to get not just to own the cluster potentially, but to get to a machine that's not in the cluster.
1827730	1829810	So to get there, you're going to want to see if you can hop tenants.
1829810	1832470	Tenants are usually separated by namespaces.
1832890	1834930	So let's see what we can do.
1836910	1839630	I know I'm fast-forwarding through my stuff, but...
1839630	1845290	So I'm in the other... I'm in that MySQL one. I try to get pods.
1845290	1848330	And the problem I'm running into is, hey, you're not allowed to get pods.
1848590	1851270	So the cool thing is, I'm in a different service account.
1851270	1855150	I was in the marketing WordPress service account. It's allowed to get pods.
1855310	1857470	The marketing MySQL one can't.
1858070	1863190	So over time, I might want to go around and pick up all these service accounts and hold on to them.
1863190	1864370	Remember, it was just tokens.
1864370	1871710	So if I can store all the tokens, I can end up building privilege wider than just what one thing had.
1871710	1875130	So I did get nodes, and I found out the IP address for a node.
1875410	1878230	Here's a name, but this node has an IP address.
1880130	1884770	This one is running in a cloud provider.
1885090	1886350	And there's a cool thing.
1886350	1888730	So you can talk to the kubelet.
1888770	1893570	And this is, thank gosh, finally not a default, but some clusters will have it.
1893570	1898670	You can talk to the kubelet on, it's got a couple ports, 10.2.50.
1898670	1900950	I'm going to go and say, can you give me a list of running pods?
1900970	1904650	And it gives me JSON, because everything in Kubernetes is JSON and YAML.
1904950	1909610	So I'll take that, and I'll run that again.
1909650	1912350	And I apologize for this big block here.
1912350	1915670	So I'll run that again, and I'll add some JQ, JSON query.
1915730	1917250	Really good tool to learn.
1917250	1923150	And I'm going to say, give me all the pods, kind of better formatted, give me their name and their namespace.
1923550	1930130	And what I'm looking for is to see if there's a pod that's in another namespace besides the marketing one.
1930130	1931490	And I quickly find one.
1931490	1932790	There's a devpod.
1942030	1944090	And that devpod...
1944090	1949710	So Kubernetes loves to tell you about anything you want, and that's really, really nice as an attacker, especially if you can script it.
1950030	1952910	So I've got devsync, I've got devweb.
1952910	1955950	These are two containers that are running in the same pod.
1955950	1958470	I've got the image they came from, so they're up on Docker Hub.
1958470	1960110	You could pull them yourself if you wanted.
1962190	1966210	And as an attacker, that's often what you're doing, is basically saying, well, what workloads are running?
1966210	1970330	And can I go look in container images and see if there are any secrets or anything that would be really helpful to me?
1970410	1974830	It's very, very nice of the defenders to hand you descriptions of their workloads.
1976410	1977750	So I'm going to look at that.
1977750	1979810	I'm going to run another command, and this is...
1979810	1980810	I did running pods.
1980810	1985310	I'm going to tell the kubelet, hey, would you mind just executing a command for me?
1985310	1990230	So I'm going to pass it run, and then the namespace, the pod, and the container name.
1990430	1993470	And I'll do command equals id.
1993850	1996090	And I get an error code that says basically no.
1996090	1999530	Either there's no shell in there, or I'm not allowed.
1999530	2002110	I will tell you that there's no shell in there.
2002630	2005730	But remember, there were two containers in that pod.
2005730	2012690	So I saw devsync and devweb, and that's a really common thing you see outside of containerized environments.
2012690	2020250	Like you have a web server, and you have something that's there to pull it content in from wherever that content's being created or stored.
2020370	2026270	So I was hoping I could get to devsync, because it'll have the credentials for pulling content.
2026270	2027710	It'll have an SSH key.
2027790	2030290	I couldn't, so let me try devweb.
2035690	2037350	So devweb I can run commands in.
2037350	2040630	I ran id. It says, yeah, that thing's even running as root.
2040630	2041650	Very nice.
2045420	2046940	And so let's try a different command.
2046980	2048380	Let's look at the file system.
2048380	2049560	Oh, look, another flag.
2051280	2052500	I like flags.
2054200	2060620	I love doing CTFs, and I love doing CTFs actually, like, first doing them as an attacker, and then going and basically doing them as a defender.
2060620	2065820	How much of the attack can I break with proactive stuff?
2065820	2069360	With stuff that you could have thought of before you knew that you had the vulnerability?
2069640	2072240	So this thing says, hey, you're not in the marketing department anymore.
2072240	2074220	You're in the development department's namespace.
2074320	2077900	So can you go take over the development department's non-containerized machines?
2077900	2086280	And they're big fans of The Matrix, so it's named Mainframe, named for the machine's mainframe that may or may not have been in the second and third movie, depending on your religious beliefs.
2086280	2096000	There are many people I know who acknowledge the truth as they believe it, that there were no second and third Matrix movies.
2097080	2099320	Only quests for more money.
2099700	2100700	So here we go.
2100700	2104940	So we've got... we're trying to do a get pods.
2104940	2118040	So I'm in one pod asking the kubelet on another host if it minds running commands in another pod, and I'm asking that pod to run kube control commands.
2118420	2124240	I find out, okay, dev app isn't allowed to list pods, but it's kind of cool.
2124240	2126280	I now know that I've got a third service account.
2126280	2128940	I've got the dev dev app one.
2128940	2130660	So I'll try get secrets.
2130940	2132540	Let's see what secrets are available.
2132540	2136220	Oh, nice. There's a mainframe login and an SSH key.
2136520	2142960	Well, the two pods in there, the two containers in there are going to likely have access to the same secret.
2143800	2145520	They've been placed in the same place.
2145520	2148520	They don't necessarily need it in dev web, but what the hell.
2149000	2151420	Let's go and ask for a copy of that secret.
2154260	2158620	And I promise the next demo is hackers themed and choose your own adventure.
2158620	2160360	So we're going to have some fun.
2162440	2164340	So here's our SSH key.
2164340	2165960	And you're like, that doesn't look like an SSH key.
2165960	2167480	And that's because it's a secret.
2167720	2170200	It's opaquely encoded.
2170260	2171900	It's base 64 encoded.
2171900	2174100	So we can decode it.
2175080	2177660	And boom, there's our SSH private key.
2178060	2181640	And we can do the same thing with the other secret here.
2181640	2184440	So we can find out basically what is it used for.
2184440	2193140	So I'm just going to fast forward a little bit and tell you that it's a user and a host in AWS.
2193580	2195420	But not part of the cluster.
2195660	2198600	So now we could SSH into that.
2198620	2200980	And we're in the developer's mainframe.
2201000	2203240	And it says, hey, you made it to the machine mainframe.
2203240	2206940	Can you, for extra credit, can you get credentials to take over the whole cloud environment?
2207740	2209260	And we can do that.
2209260	2214380	But I'm going to set the rest of that aside because we do that in another demo.
2214760	2217020	So let's see.
2218300	2220480	Let me go back to the slides for a second.
2223260	2227360	And here was our... and I'm sure that I'll be...
2227360	2232000	because of the vagaries of having the videos in a separate program,
2232000	2235460	I'm sure I'm going to be doing a little bit of going back and forth and having the whole screen do this.
2235460	2237100	So here's our attack path.
2237100	2239380	We got an interpreter in the WordPress container.
2239480	2242120	We moved in the MySQL container with the kubectl exec.
2242220	2247180	We used the MySQL container's totally unfettered network access inside the cluster
2247180	2252280	to reach a kubelet that we wouldn't have been able to reach from outside the cluster on the master node.
2252280	2256740	And that kubelet let us basically take a look at...
2257840	2261680	run commands in another container in another namespace.
2261720	2264760	And from that other container in that other namespace,
2264760	2267400	we figured out there were secrets.
2267400	2268440	There was an SSH key.
2268440	2269740	So we got that SSH key.
2269740	2272960	We authenticated to the high-value developer machine.
2273180	2277240	And later on, we ended up getting to take control of the AWS account.
2277240	2281780	And we're going to skip that right now because we're going to do that in a much more fun way.
2282760	2285800	So we're going to play Hacker's Choose Your Own Adventure.
2286540	2289340	And I'm going to drink some water for a second because whoa.
2292120	2292640	So...
2294400	2295960	I like the movie Hackers.
2295960	2297780	It's a fun movie.
2298120	2299740	It is an oldie but goodie.
2299740	2301720	It is thoroughly realistic.
2301720	2303700	We all know that whenever we're hacking,
2303700	2309720	we see strange translucent 3D models of buildings,
2309720	2312260	and we fly through a city, and it's really cool.
2312260	2318100	And all of that was clearly done with the technology that had Apple IIs and floppy disks.
2319580	2322660	So, I mean, I remember 3D rendering back then.
2322660	2324620	I wasn't doing it. I was watching people do it.
2324620	2326880	And yeah, no, none of that.
2327160	2328540	So here we go.
2328540	2330100	So we're going to start here.
2330560	2333940	And again, this is where I have embedded video.
2334580	2337840	So we will, unless I click on that and it works.
2338440	2339520	Let's see.
2340340	2341840	Oh, hey, look at that.
2343100	2346060	Now, can we full screen that?
2347980	2349720	Is there a way?
2350060	2353380	No, so we're going back to oldie but goodie.
2354000	2355680	And here we are.
2355680	2359080	So first, this is going to look a little familiar.
2359560	2363220	So we've got a, we've got, what's that?
2364380	2368500	Oh, well, you're on the slide and I'm on the video.
2368500	2370340	Okay, boom.
2372960	2374760	And switch.
2375340	2376620	Come on.
2377460	2379620	I'm going to Windows computers soon.
2381540	2384140	And that's a lot for me to say, trust me.
2384140	2386380	So anyway, here we go.
2386840	2390760	So we've got the, we've got the Gibson control room.
2390760	2406380	We have Penn from Penn and Tower, who's apparently a techno weenie, according to Ben from Short Circuit, who somehow was playing an Indian and talking about Mr. Johnny Five.
2406440	2409100	But Mr. Johnny Five here was the plague.
2409620	2414720	And, and we have this nice little form that's called the Gibson control room.
2414720	2418260	And the Gibson control room clearly lets you like leave a message.
2418260	2424140	So it's based on a, it's based on a actual, on a Kubernetes documentation vulnerable app.
2424140	2427660	They didn't mean for it to be vulnerable, but it's only a little vulnerable.
2427660	2429700	So I've added a vulnerability to that.
2429780	2439720	So the, so what we've got is I look at the source on that page and I find that the form is basically being provided by some JavaScript.
2439720	2454060	So if I go look at that JavaScript, what happens when you submit the form is you're, you're referencing guestbook.php, you're sending to guestbook.php, you're saying, hey, command set, key messages, value this.
2454420	2460900	Okay, really? You're going to let me, you're going to let me decide what, what key I'm going to set?
2460900	2464960	You're not just going to have me set whatever key, you know, was meant to be set by this form?
2465000	2466560	So that was their bug.
2467760	2473920	And what I've added to it is I have something that actually runs code out of a different Redis key in this, you know, back in Redis database.
2474180	2476500	So we go and take the Gibson control room.
2476760	2482540	And if we were to type a message, you know, it shows up, this is the intended, this is the intended purpose.
2482880	2491700	But instead, we're going to paste that same thing that happens when you submit the form, except instead of the message key, we're going to try a different key.
2491700	2495620	Or we'll try a, let's see how it works. We're going to hit foo.
2497640	2500660	And we'll put in just some key, some random key.
2500660	2504340	Oh, cool. Okay, so JavaScript's probably updating that key.
2504600	2507220	Let's try going to status PHP.
2507220	2511300	So I'm asking you to imagine that we did a DurrBuster or looked at robots.txt.
2511300	2512860	We found a status PHP.
2512860	2516080	I'm not doing it because, well, I'd like to spend our time on Kubernetes.
2516220	2518040	So I go to the status PHP page.
2518040	2519440	It says, hey, no command to run.
2519440	2525740	I'm going to set the Redis key, the Redis command key to this so that you can reload the page and that will get run.
2525840	2531040	So if I reload the page, I get the output of, you know, I get the output of crawling that web server.
2531040	2537460	It says all services are operational here at, what was it, Ellington Mineral or Ellington Mineral?
2537460	2538520	Ellington, I think.
2539620	2543300	So, well, as long as there's a command key, let's go and set it.
2543300	2553160	And I've set my command key now to environments, to run environments, like we did before, to find a Kubernetes cluster, to find the Kubernetes API server.
2553160	2554400	And here we go.
2554400	2562880	So we know that once we're in a workload, if we reach out to 10.96.01, we'll get to the Kubernetes API server.
2562880	2565540	So I'm going to go a little further, kind of similar to last time.
2565540	2567180	I'm going to curl in.
2567180	2573260	I'm going to tell this thing, excuse me, would you just pull in a reterpreter binary I created and connect back to me?
2573620	2575920	So I have it pull it in.
2575920	2577500	I set that key.
2577500	2579820	And now when I run status, the page hangs.
2579840	2585260	I love when pages hang when I've just given them binaries because it generally means the binary is running successfully.
2585600	2591780	So if I go over to my terminal where I've got a Metasploit handler waiting this time, I find there's a session waiting for me.
2591780	2604460	And the first thing I'm going to do before I start interacting with a shell there is I'm going to upload a copy of kubectl, which I've stored on this Kali system in this directory.
2604460	2608280	So I put kubectl and I'm going to upload some YAML, which we'll get to later.
2610500	2614680	So I've uploaded some YAML, which we may or may not get to later, depending on your choices.
2614680	2617720	And I've asked for a shell, hit PWD.
2618460	2620960	Looks like my video is cut off by one character.
2620960	2623700	I hit ID. It says you're wwwdata user.
2625280	2627120	I try SSHing.
2627840	2632500	Well, I don't know what I tried because that was the end of that part.
2632500	2636740	And now we're going to do this part so that we're a little bit gentler.
2637140	2640920	I'm going to ask you, so do you want to try...
2640920	2645960	The YAML files that I put up were ones that would mount a volume on the...
2645960	2647940	that would try to mount a volume on the host.
2647940	2650300	Like they'd try to mount the host's own directory.
2650300	2654700	The old, you know, Docker, you know, start a container mounting the host.
2654700	2661680	So do you want us to start the host mounting pod and see if we can take over a node?
2661720	2663960	Or do you want us to exec into another pod?
2666450	2670690	I heard the host mount first, so we'll try that.
2670690	2672850	So let's see.
2678520	2682020	Boom. And boom. Here we are.
2682600	2684320	Run that front end.
2685340	2689680	And we'll set kubectl executable so we can run it.
2689960	2693160	We'll go and set up our kubectl.
2693460	2695800	We'll try to run kubectl apply.
2695800	2698720	Realize, wait, we've got to set all those parameters we set before.
2698780	2700300	Sometimes you get lucky.
2700300	2705580	And so I'm going to take that same directory,
2705580	2709580	that same run secrets kubernetes.io service account that's being mounted into the pod.
2709860	2713120	I'll set a variable called dir to that, export dir to that,
2713120	2716040	just to make this a little bit easier to type, a little more manageable.
2716940	2721580	So if I look at the dir, got the cacert, namespace, token, just like before.
2722440	2724500	Let's go and run.
2724680	2728220	Alias kubectl is going to mean that, same way we did before.
2733150	2736130	So server's out on 1096.01.
2736130	2738190	That was what we found from that environment variable.
2738430	2742110	And now let's look at our alias.
2742110	2744290	That's that token being pasted in.
2744290	2746090	So kubectl get pods.
2746170	2747790	Cool, we've got front ends.
2747790	2749030	We've got front end pods.
2749030	2750530	We've got a Redis master.
2750750	2754130	We've got an Apache status, that thing we saw before.
2754130	2755610	We're in the front end.
2755930	2758730	So let's try launching a pod.
2758730	2761550	kubectl apply.
2762670	2764170	I like it as kubectl attack.
2764460	2765670	Attack pod.
2765670	2771990	And it says, sorry, your service count, front end, isn't allowed to create resources.
2772290	2773790	Wah, wah.
2775210	2775870	So...
2776550	2779850	And this is where I get to my slide.
2781590	2784450	So we'll do that real quick.
2787360	2790040	I was considering for this one...
2790040	2791260	Oh, damn it.
2791260	2793480	Let's just keep the screen mirrored.
2793640	2800200	So I was considering for this one doing a spandex quote from the movie.
2800200	2804280	And I decided that wasn't a sentiment I wanted to voice.
2805640	2806160	So...
2807100	2810840	I see that I'm going to make sure that I'm moving on time.
2810840	2813620	So at this point, we'll go back to our original...
2813920	2815760	We'll go back to the other thing we could do.
2815760	2818040	So our two options, where do we want to launch a pod?
2818040	2819320	Or exec in a back end?
2819460	2821380	So let's exec in a back end.
2822300	2824600	Or let's try execing into another pod.
2824980	2828360	So we'll go like we did in our other demo.
2828360	2829980	We'll try execing into a pod.
2831840	2833800	Keep wishing we had a better terminal.
2837440	2838460	kubectl get pods.
2838460	2841260	I see that there's a Redis, that Redis setup.
2841260	2844040	Remember I was pushing Redis keys.
2844040	2848080	I might try to investigate the Redis and see what else.
2848080	2850680	Now that I've got more direct access to it.
2850900	2855120	Because Redis is very often, well almost always, unauthenticated.
2855920	2858140	But let's go into the Redis pod.
2858140	2860680	So I'm rooted in there. I'm Redis master.
2860680	2863080	I'll grab a copy of the meterpreter binary I've been using.
2863080	2866460	Just because that's a very convenient way of putting files into something.
2866780	2868620	And I'll background that.
2868620	2871420	And I'm going to switch over.
2871420	2876600	Now that I've got the Redis master, that pod running my meterpreter.
2876600	2880820	So I'm going to switch over and catch that session.
2882520	2889920	And so in that session, I'll go and upload the same kubectl that I did before.
2889940	2893020	I'll also upload that attack pod that I just used before.
2893020	2896140	And I'll also add something called attack daemon set.
2896460	2898300	Just in case we need it.
2898300	2904950	So now we get another choice.
2904950	2906370	So you're in the back end.
2906370	2908470	Do you want to try host mounting pods?
2908470	2911250	Or do you want to check out the cloud APIs?
2913030	2915310	Cloud APIs. Cool.
2915410	2917570	Okay, so here we are.
2921020	2923680	And I'm going to show you this in two ways.
2925360	2928120	And can I get a rough time check?
2928120	2929800	How much time will you let me be late?
2929800	2931960	Oh, less than five.
2931960	2936360	Okay, so this is where I normally kick on the speed control.
2936660	2938280	So, okay, so we're in a pod.
2938280	2939940	We're in that Redis master pod.
2940220	2943280	And we say, hey, I'd like to talk to the metadata API.
2943280	2947780	So every cloud provider gives you 169254, 169254.
2947780	2949020	That part's common.
2949100	2952460	What the calls are that you make against it, they document wonderfully.
2952520	2954040	And you read the documentation.
2954080	2956400	So this is on GCP.
2957000	2961400	So I'm going to go and say, can you tell me what the project ID is?
2961400	2964180	I need that project ID to do API calls.
2964320	2968700	But then the more interesting one is usually where you say,
2968700	2972480	would you mind, in addition to the project ID, which I'm going to set into a variable,
2972980	2977800	would you mind telling me what service accounts are assigned to the machine I'm on?
2977800	2979560	So the machine this pod's running on.
2979560	2982340	And there are two, but default is mapped to that other one.
2982340	2984680	So I'm just going to use default because it's easier typing.
2985820	2989300	And I'm going to go and say, okay, for that service account,
2989300	2994520	would you do me a favor and just give me a bearer token that I can use to act as that service account?
2994900	2996060	And it says, sure.
2996760	2997920	Here's your token.
2997920	3002600	It expires in like a half an hour or an hour, but I've got a token.
3002600	3004440	So I'll set a variable to that.
3005220	3011500	And now what I'm going to do is say, let's go and I've set that token to that.
3011540	3013200	And I need to refresh that token.
3013200	3017260	So most of my commands will pull that token over and over, every command.
3017260	3022100	So I'm going to use that token, type out authorization bearer token where the token's provided.
3022100	3028160	Say I'll take JSON and now I'll say, hey, for this project, I'd like a list of buckets.
3028160	3030060	And it says, oh, there's only one.
3030320	3032400	Okay, well, what's in that bucket?
3032700	3035820	And so I basically say, give me a list of objects.
3037060	3041420	And the way I do that is it's like slash B for a list of buckets.
3041420	3045440	Then it's the slash B, that bucket slash O for a list of objects.
3045440	3048240	And then for those objects, I can run through them.
3048660	3053700	Now, on this one, I don't find anything that's all that useful.
3053700	3057660	I don't find, I find, I don't find what I find in some cloud environments.
3057660	3060620	I'm going to show you in another demo somehow.
3061640	3064300	And, but I do find a kubenv.
3064460	3070960	So I can pull in a metadata instance for this cluster that was set by the installer.
3070960	3078320	And when I do that, what I get out of it is, among other things, a couple service count tokens for the cluster.
3078320	3083880	And that ends up leading, which I won't now show you, but that ends up leading to win.
3083960	3093880	And so just for the end of our, for the end of that, that then leads to our crash and burn.
3095440	3102020	So if, if Ming will let me have one more minute, I will show you a cooler version of that.
3102020	3107380	We have a tool that we're, that we keep soft-releasing, but never kind of like putting up on Twitter.
3107380	3122980	So it's called Paradis and Paradis will, if I, if I actually just, I'm just nervous.
3122980	3135240	So it's in here, but somehow I'm, let's do this.
3136540	3142680	So Paradis is basically a remote access Trojan for, for Kubernetes.
3142680	3148020	You run this and it does all kinds of things. And I'm going to start this from the beginning,
3148020	3156460	but it is under two minutes and then I will get the heck off the stage and tell you that you should ask me for stickers.
3156700	3163100	So it's got a bunch of things. One of those I had said, okay, 13, go get the IM credentials from GCP.
3163240	3165620	The same thing we just did, get the cloud service account.
3165620	3170840	And then, come on Jay, type faster, highlight faster.
3170840	3177680	So that's for that same one I just got. And now let's take that and let's pull,
3177680	3183280	let's go looking in GCS in the storage buckets for service count tokens.
3183280	3192000	Oh look, this installer, this one was COPS and left, left service count tokens there for all the components,
3192000	3195020	including a cluster admin, which would be perfectly useful.
3195020	3200620	And so that's the, like, basically, that's probably roughly what happened to Capital One recently,
3200620	3213260	where it was talk to the metadata API, get your cloud account, use that to go rating for information or access.
3213940	3219220	So anyway, so now once I've done that, Paradis will basically store every account it gets.
3219220	3222100	And then you basically say, okay, I'm going to switch contexts.
3222100	3225760	And you go and you go through and you collect all of the service count tokens.
3225760	3230000	And then you basically have this big old store, that's your loot, and it keeps it in memory.
3230860	3234140	And you run around and basically get more access and get more access.
3234140	3240400	We've even got a, this video will be up on YouTube, but we've even got something that basically takes over the nodes.
3240480	3247660	If it's allowed to mount a host path volume, it'll go and add a cron job that will send a netcat shell back to your,
3247660	3250220	back to the IP address of your choice.
3250220	3255660	So once we have this cluster admin, we're allowed to, we can go and do everything which included like,
3255660	3257420	hey, now show me all the secrets.
3257420	3262060	And all the secrets includes all of the tokens, all the service counts for every component.
3263220	3267980	And Paradis will not just grab, will not just list these and get them, but it'll also store them and let you use them.
3268040	3269960	So it's a fun little pen test tool.
3270780	3274320	And it's up on GitHub, we'd love some help, we'd love some help producing it.
3274320	3277980	So it's an NGuardians tool, we do a ton of Kubernetes work in NGuardians.
3277980	3281680	And I will now get off the stage and take questions all the way out in the hallway.
3281860	3283920	So if you see me, please ask me for a sticker.
3287140	3288100	Thank you.
