start	end	text
870	6070	Hi everyone, today we're going to talk about purple teaming and adversary emulation in the cloud.
6070	10450	We're also going to present an open source tool that I'm the maintainer of called Stratus Red Team.
11030	13070	My name is Christophe Tafani de Roper.
13130	16430	I work at Datadog and this is my handle on Twitter.
16430	19250	If you want to send me a message, feel free to do so.
19250	22810	We have a lot of positions open, so if you want to apply, have a look.
22810	29450	I think we have over 35 right now across security, operations, supply chain security, product security, etc.
30530	36830	Today we're going to start by talking a bit about detection engineering, purple teaming, and how they relate together.
36890	41110	We're going to see some pain points of doing purple teaming in the cloud.
41250	50570	We're going to introduce Stratus Red Team, an open source project that I've been working on, as well as ways to use it more in an advanced way.
50570	56490	And finally, I have two exciting announcements to make just for today for the Cloud Village attendees.
57690	60510	Let's talk about detection engineering.
60510	68090	Detection engineering is basically a fancy word to say how do we detect bad things and how do we maintain these detections as we go.
68170	80890	As an industry, we've been moving from detecting indicators of compromise, like IP addresses, hashes, domain names, to detecting things that look more like behaviors and tools.
80910	83670	You maybe have seen this this schema before.
83670	85410	It's called the pyramid of pain.
85590	91830	And basically, the idea is that as you move up to the pyramid, things are harder to change for an attacker.
92370	95110	But they are also harder to detect for a defender.
95190	101650	Typically, if you look at a file hash, it's very easy for an attacker to change, very easy for a defender to detect.
101770	110290	If you move up and you look at the behavior, it's very hard for an attacker to change that, and it's harder for a defender to detect behavior because it's not well defined.
111510	116790	If we start to detect behaviors, we need to have a way to model how attackers behave.
116870	120450	And that's what, for instance, Mitre ATT&CK is doing.
120450	126890	So they try to understand how attackers behave across the different stages of the attack.
127270	130090	Now, they also have a version for cloud.
130090	135850	I would argue that it's not great for cloud because they try to not be too specific about a single cloud provider.
135850	141290	So you really have the common denominator between all the providers.
141550	144810	There is one that is more specific, introduced by Microsoft.
144810	146970	It's called the Threat Matrix for Kubernetes.
146970	154490	And they use the same ATT&CK stages as Mitre ATT&CK, but they go into very much detail on how this works for Kubernetes.
155310	160870	Very recently, there's also the Azure Threat Research Matrix that was released.
160930	168670	Similarly, you have different ATT&CK stages and some ATT&CK techniques that are very specific to Azure and how they work.
169830	173070	Now, a few words about purple teaming, which is a buzzword.
173830	184050	So it's really about having, like, starting from having a blue team and a red team, but don't really work together and communicate, to having something like that, because blue and red makes purple.
184230	189450	And the idea is really that your blue team and your red team should work together towards a common goal.
189850	198650	For this talk, I'd like to define purple teaming as empowering defenders to understand, to reproduce, and to detect common attacker tactics.
198730	205090	So we see here that you have the concept of how do I understand things, how do I reproduce them, and how do I detect them.
205510	212550	And this is very much aligned to what an American psychologist named Kolb explained in the 1970s.
212550	216350	And the idea is that he tried to describe how people learn.
216630	219150	And it starts with an active experimentation.
219310	221790	Maybe you are going to touch something very hot.
221950	224390	Out of that, you get an experience.
224710	227410	So your experience is I touched something very hot.
227430	232130	Now you have something that is not only theoretical, but you experienced it in the real world.
232190	234590	Then based on that, you're going to make an observation.
234870	237830	Oh, I touched it, it was very hot, and now I got burned.
238270	244010	And based on that, you are going to update your view, your understanding of the world by conceptualizing that.
244450	250750	So you're going to say if I touch something very hot, it's likely I'm going to get burned, hence I'm not going to do it again.
251050	257370	And it's really the same for detection engineering in the sense that first you want to reproduce a specific attack.
258090	260630	You want to get your concrete experience of doing it.
260630	262830	You're going to observe what data you have.
262830	263930	What kind of logs do you get?
263930	265110	What kind of artifacts?
265110	266310	What kind of analytics?
266510	271370	And then you're going to try to conceptualize a detection based on that.
272330	276470	And today we're going to focus on this part of reproducing an attack.
276570	279690	And we're going to see that it's not that easy in the cloud.
280130	285910	So let's say that we want to detect when VPC flow logs in AWS are removed.
286130	292630	This is a popular thing for attackers because if you remove some logs, then a defender cannot know what you were up to.
292630	295790	So let's try to reproduce this attack.
295790	305190	So first we need to create a VPC and to enable the VPC flow logs to have the prerequisite infrastructure we need to be able to reproduce that.
305190	306670	And then we reproduce the attack.
306670	308850	We're going to delete the VPC flow logs.
309130	311050	So let's go to the AWS console.
311750	316070	We are going to create a VPC, give it a name, an IP range.
316070	319150	We are going to create a flow log configuration.
319610	323210	So AWS asks us where we want to send the logs.
323210	324110	Let's say CloudWatch.
324110	325030	It's the default.
325350	329090	So we are asked for a destination log group, but we don't have any.
329130	332610	Then for an IAM role, we don't have an IAM role either.
332610	333970	So we are not sure what to do.
334350	335390	So we go to the docs.
335390	339450	We see, okay, you need to create a role with this specific IAM policy.
339750	340470	Fair enough.
340670	350450	Then it says, also you need to add a trust policy to your role so that it allows the VPC flow logs delivery service to assume the role to deliver the logs for you.
350630	354190	And at this point, you are already even more confused.
354190	365610	And basically what happens is that you spend a lot of time trying to set up the right infrastructure you need to reproduce your attacks, sometimes to complain about the documentation, and very little time testing your threat detection.
366430	371330	And that's something that we see when we test threat detection for the cloud and that we wanted to make better.
371670	378370	So to sum up, the challenges that we found are really the testing prerequisites in the cloud can be very complex.
378370	383950	If you want to test a specific attack and you need some prerequisites, it's not straightforward to set them up.
384330	388230	The fact also that cloud security is still a pretty new field.
388310	392590	And I think we have to acknowledge as an industry that it's an emerging threat landscape.
392670	398130	So it's not very clear what are the threats and how they behave and how they evolve.
398270	405290	And finally, and it's related, is that we don't have a lot of data available on what cloud incidents happen in the real world.
405530	407930	And that's why we built Stratus Red Team.
408150	411970	So Stratus Red Team is an open source project that you can find on GitHub.
412250	416310	I like to pitch it as Atomic Red Team for the cloud, and we'll see why in a bit.
416470	424210	It's written in Go, so it comes as a single prepackaged binary, which comes with a bunch of attack techniques.
424670	427750	It currently supports AWS, Azure, and Kubernetes.
428590	435810	So the attack techniques in Stratus Red Team, we try to have high quality attack techniques that follow this philosophy.
435810	437430	First, that are threat informed.
437430	442250	So we want things that we think defenders should care about, and we tell you why.
442610	444670	It should be actionable for defenders.
445390	451910	So it's not really useful if we tell you this is a threat, but we don't explain how to defend or how to detect it.
452150	453350	It should be granular.
453350	456070	So typically, we don't try to have a full attack chain.
456070	459930	We only have specific attack techniques, like Atomic Red Team.
459930	461570	And finally, safe sufficient.
461570	464890	So when you run Stratus Red Team, it should work in any AWS account.
464890	469250	You shouldn't have any prerequisites, and Stratus Red Team is going to handle all the prerequisites for you.
469250	470890	And we'll see that in a bit as well.
472190	474910	So to sum up, Stratus Red Team is going to bring two things.
475130	477990	First is a catalog of cloud attack techniques.
478330	484230	A bit like MyAzure Attack, but much more specific to AWS, to Kubernetes, to Azure.
484530	490030	And secondly, a way to easily reproduce these attack techniques against a live environment.
490170	503310	So typically, you're going to take Stratus Red Team, you're going to point it at an existing AWS account, or Kubernetes cluster, or Azure subscription, and you're going to detonate the attack techniques against one of these live environments.
504930	514450	Currently, we have 27 AWS attack techniques, 7 for Kubernetes, and 3 for Azure, which is a quite recent platform.
514450	520390	You have a full list on the website, and you will see that they are organized by Mitre Attack Tactics.
520390	525870	So you have persistent, initial access, exfiltration, privileged escalation, etc.
526170	532370	Now let's dive a bit into what specifically an attack technique looks like in Stratus Red Team.
532730	537670	So if you use VCLI, you can do a Stratus show, and then the name of the attack technique.
537670	539430	It will give you a bit of information.
539750	544610	Here we are seeing an attack technique that consists in stopping a CloudTrail trail.
544830	546330	And you see that we have two things.
546330	549190	We have a warm-up phase and a detonation phase.
549430	552710	The warm-up phase is when we are going to create the prerequisites.
552870	555670	So here we are going to stop a CloudTrail trail from running.
555690	557230	So what are the prerequisites?
557230	563150	We need first a CloudTrail trail that logs into an S3 bucket with appropriate roles, etc.
563590	566990	And then the detonation is really when we're going to reproduce the attack.
566990	570370	Here it's going to be simple, just stop the trail from logging.
571390	582130	We have the same thing on the website as well, in addition to the mapping to Mitre Attack, the description that we saw before, and a few ideas on how this can be detected.
582310	591850	And the idea here is not to give a very precise rule, it's more to give you an idea of what logs you can use to detect the attack, if there are some guarantee findings for it, and things like that.
592870	598090	Now the first piece of code that handles the prerequisite infrastructure is based on Terraform.
598730	607030	It's going to be totally transparent for you, so you don't have to install Terraform, you don't have to manage it, but this is how it's done under the hood.
607030	612430	So this is going to create the S3 bucket and the CloudTrail trail that we need to be able to reproduce the attack.
613310	623190	Again, the Terraform instrumentation here is fully transparent, so typically it doesn't mess with your Terraform version, you don't need to install it, and it uses the official Terraform Go wrapper.
623450	627430	Again, you don't need to know it, it's just to understand how it works under the hood.
627890	633770	And then the second piece of code is going to be the actual attack written as imperative Go code.
633930	638530	So here it's very simple, it's going to be my attack is stopping the CloudTrail from logging.
638530	642950	I'm just going to use the AWS SDK to stop this trail from logging.
644890	649550	In terms of lifecycle, so initially your attack technique is going to be called.
649550	651310	It's going to be the initial state.
651310	655690	Then once you create the prerequisite, it's going to be warm.
655730	659710	And finally, when you detonate the attack, it's going to be detonated.
659710	669190	So here again, warming up our attack means creating the S3 bucket, the CloudTrail trail, and at this point we are ready to reproduce the attack.
669190	675510	We can do it right away, or we can maybe wait a few hours, a few days if we want, and it's going to be stopping the CloudTrail trail.
676710	678790	Now let's have a very quick demo.
680810	682530	So I have Stratus team installed there.
682530	685930	I can do Stratus version, I see a version 2.2.2.
686090	692530	If I do Stratus list dash dash platform AWS, I can see all the attack techniques for AWS.
692570	698290	I can be a bit more specific and look at AWS attack techniques for exfiltration.
698590	715030	Now if I copy-paste the name of an attack technique, I can go to the website and I will see the mapping to my attack, the description, you see we have the warm-up and the detonation phase, and the instructions on how to detonate the attack technique with Stratus Red Team.
715070	724330	If I go back to the console, I do Stratus warm-up with the name, I see that the warm-up phase is going to create a snapshot and a volume for me.
724370	730930	If I go to my console, I see that I now have a volume and a snapshot that was created for me.
731050	735250	And this is really the prerequisite infrastructure that I need to reproduce my attack.
735270	740590	And I can see that for now, the snapshot hasn't been shared with anything yet.
740590	749450	Now if I do Stratus detonate of my attack technique, it's going to share the volume with an external AWS account to simulate this attack.
749470	757150	And if I refresh, I will see that the permissions now show that the snapshot has been shared with a specific attacker account.
761110	765690	Now one other point of doing that is being able to see what logs I get.
765690	783010	So if I go to CloudTrail, I can have a query that says, show me the modify attribute events, and I will see that I have one event that was caused by Stratus Red Team for my specific snapshot, adding the create volume permission, essentially sharing it with an external account.
783650	785910	Now we can do the same for Kubernetes.
785910	789350	I'm here on a Kubernetes cluster with one node locally.
789350	793870	If I do Stratus list for Kubernetes, I will get the list of attack techniques.
797210	808310	And if I take this one, so stealing a service account token from a pod, I'm going to copy-paste that, go to the docs, it will show me what it means.
808310	812590	So this is going to attempt to steal a service account token from a running pod.
812590	820210	The warmup is going to create a namespace, service account, a pod, and the detonation is going to dump the service account token from the running pod.
820410	822470	I can just do the detonate directly here.
822470	831390	It's going to do the warmup, so spinning of the pod, and then do the detonation right away, showing me that it stole the service account token.
833670	842290	Now, if I do Stratus detonate with another one, so privilege escalation, privilege pod, it's going to run a privilege pod.
842290	847930	If I look at my pods running, I can now see that I have this malicious pod running.
848150	860810	And if I do a Stratus status, I will see that some attack techniques have been detonated, some are still called, and I can do a Stratus cleanup with the name of my attack techniques to clean up everything.
862170	866230	Let's have a look at the attack techniques we have in Stratus RATIM for AWS.
866230	867390	Let's take this one.
867390	888640	We're going to create a threat test scenario in GoCode, saying when we open a port 22 on a security group, and this is when we detonate this Stratus RATIM attack technique, then we expect a specific data log security signal that has this name, and we give it five minutes.
889310	897910	Now, we're going to create another one, so we copy-paste this code for another attack technique, and let's take the one about sharing an EBS snapshot.
897930	900510	We can just replace the attack technique name.
900510	909010	We rename the scenario to exfiltrating an EBS snapshot, and then we expect a different alert.
909010	913210	We give it five minutes, and then we're going to run threat test.
913610	933690	We expect that it doesn't return any error, and then we go ahead, we go test our source code, and we see it's going to detonate the attack technique using Stratus RATIM, the first one, and the second one, and then it's going to show us that it has created the expected alerts that we thought we would get in data log.
934210	940170	So, we see that this was closed also by the automation.
941370	942810	This one as well.
943190	945350	We are happy we get our alerts.
947580	954680	Great, so now that we have seen how we can use Stratus RATIM in practice, let's see how we can use it in a more advanced fashion.
954800	958820	And typically, you will see that Stratus RATIM works very well with automation.
959380	962560	The first thing that we're going to see is programmatic usage.
962560	974700	We're going to see also how we can automatically generate some logs data sets using the API from our CM, and we're going to see a few things about end-to-end testing our threat detection rules.
975400	983800	So, the programmatic interface basically means that you can use Stratus RATIM as a Go library, just as you can use it from CLI.
984400	993700	So, this is great if you want to automate some things, and you can just do a go get github.com data.stratus.ratim, and then use it from your code.
994200	1003180	It has an auto-generated documentation on the Go documentation, and basically the way to use it is very similar to how you would do it on the CLI.
1003300	1008660	So, first you're going to instantiate a new Stratus RATIM runner for a specific attack technique.
1008660	1012400	Then you say, at the end, I want to make sure it's cleaned up.
1012400	1014420	Then you're going to warm it up.
1014700	1018020	This is going to do under the hood, the terraform apply, etc.
1018520	1021260	And when it's warm, you're going to detonate it.
1021260	1022180	And that's it.
1022420	1024700	It's great if you want to do some automations.
1025640	1036800	Now, I worked in a SOG before, and one of the things that we like to do is to understand what a specific attack is going to generate in terms of logs.
1037760	1040640	So, really, if I launch this attack, what logs do I get?
1040640	1053320	And this is something that is hard to do manually because you need to go to detonate your attack, to go to see your logs, to understand what logs were created by your specific run, and what is just pollution coming from something else unrelated.
1054280	1059500	So, the way that we can help with Stratus RATIM is, first, you can detonate the attack technique.
1060240	1075820	Once you do the detonation, Stratus RATIM is going to automatically inject a specific unique ID in the user agent of the request that it makes to the AWS API, to the Azure API, or to the Kubernetes API.
1075940	1085140	And based on that, it means that you can go to your SIEM, and you can ask it through the API, give me all the logs where you see this specific user agent.
1085560	1088140	And what you get is, one, automation.
1088320	1095840	And two, you are sure that the logs that you retrieve are caused by your actual detonation of the attack technique, which is a great property.
1096820	1100120	So, we have some sample code for that on GitHub.
1100160	1108560	It was written for Datalog as a SIEM, because that's what we know how to use, but it can be easily adapted to use anything like Splunk or any other SIEM.
1108880	1110680	So, this is the way it works.
1110860	1119520	You would go ahead and write dump logs, the name of your attack techniques, and then the output file in which to store the logs.
1119520	1123640	It will use Stratus Red Team programmatically to detonate the attack technique.
1123760	1126900	It's going to show you the unique ID for the detonation.
1127500	1130260	It's going to search for the logs in your SIEM, here, Datalog.
1130740	1133000	And then it says, okay, I found one log.
1133220	1134180	I'm going to dump...
1135600	1137300	Okay, I found one log.
1137340	1153230	I'm going to dump this log to logs.json, which means that without leaving your terminal, you are able to detonate an attack and see what logs you get for that, which is a very nice property when you do detection engineering, as it makes the feedback loop quite easier and faster.
1155020	1160560	The last use case I want to mention today is about end-to-end testing of threat detection.
1161240	1166760	So, let's have a look at what a typical AWS detection pipeline looks like.
1166900	1174940	First, we have a bunch of AWS accounts that are going to log to a single CloudTrail trail, probably running inside a management account.
1175400	1183140	This is going to be logging to an S3 bucket, and probably you have some kind of forwarder that's going to take these logs and send them to your SIEM.
1183640	1189920	Now, your SIEM is going to ingest these logs, to parse them, to aggregate them, maybe to do some kind of enrichment.
1190360	1193440	And at the end, the detection rules that you have are going to run.
1193700	1195880	And based on that, you get some alerts.
1197140	1210540	Now, a lot of things can go wrong here, maybe your CloudTrail trail is not set up properly, maybe your forwarding is broken, you have a parsing issue, the rule that you expect to work is actually disabled, or you don't have enough license in your SIEM,
1210540	1212060	so the rules are not running.
1212340	1213700	A lot of things can go wrong.
1214100	1224940	So, the idea is really to take this as a black box and to poke at it from one end using Stratus Red Team, and then to see what comes out in terms of alerts.
1226960	1232480	And the workflow is really going to be, first, we detonate Stratus Red Team programmatically.
1233100	1238460	Two, we pull our SIEM to check if we have an alert that we expect to have.
1238540	1240340	If yes, we close the alert.
1240400	1250020	If not, we basically raise an error to say, we detonated this attack, we were expecting this alert to trigger, it didn't trigger, so something is going wrong.
1250920	1263060	And then it's easy to build some automation on top of that, to build some dashboards that say, you know, today we tested automatically these attacks, these are the results, everything looks fine, or you have some issues that you want to fix.
1263280	1266960	So, today I'm very happy to announce that we are releasing Threatest.
1267060	1270800	Threatest is a Go framework for end-to-end testing of threat detection rules.
1271040	1272580	And let's see how it works.
1273060	1280400	The idea is that you basically have detonators that you can use to detonate specific attack techniques, and matchers.
1280720	1283900	Detonators are going to be about, how do I run an attack?
1283900	1289800	And matchers are going to be, I expect a specific alert to have been triggered in a specific platform.
1290340	1293300	For the detonators, we have the ones that are more for the cloud.
1293540	1297620	So there is one using Stratus Red Team, one using the AWS SDK.
1298080	1303540	You have some detonators that you can use to run OS-level commands over SSH or locally.
1303780	1310340	And for the matchers, currently, you can use it to check if a specific alert was created on Datadog.
1310340	1316700	And we are hoping to get some contributions to add support for other platforms such as Greylog as well.
1317020	1318600	So let's see how this works.
1318660	1321200	First, you're going to create a scenario with Threatest.
1321200	1323040	So this is going to be using GoCode.
1323180	1328360	You say, I want a scenario where I do an AWS console login without MFA.
1328780	1333440	The detonation is going to be Stratus Red Team with this specific attack technique.
1333840	1340160	And as expectations, I expect to get a Datadog security alert with this name and this severity.
1340260	1343080	And I give it 15 minutes to be there.
1343920	1347920	So now let's have a demo on how Threatest works in practice.
1349040	1351440	All right, so that's pretty much it for today.
1351440	1353100	So now we're going to wrap up.
1353240	1355200	What's next for Stratus Red Team?
1355200	1358440	First, we want to increase the attack techniques coverage.
1359260	1365400	Typically, we want to add more techniques for Kubernetes for Azure and to have more platforms as well.
1365640	1367420	We are eager to hear from the community.
1367560	1380380	So typically, if you are involved in AWS security, especially incident response, I'm really interested to hear about what you see in the wild and when we have some attack techniques that make sense to help having them inside of Stratus Red Team.
1382360	1389840	So specifically focusing on attacks that we see in the wild or that are used by Red Teams, by pen testers, by tooling.
1390300	1394200	Then I want to say a big thank you to the contributors of Stratus Red Team.
1394400	1401380	So the four first public ones are Ryan Marcotte-Cobb, Marcus Rollwagen, Aydan Alvarez, and Dakota Reilly.
1401620	1403700	So they are the first contributors to Stratus Red Team.
1403700	1405080	I'm very proud of them.
1405260	1408020	And thanks again for all your contributions.
1409280	1417040	Then one more thing that I want to announce today is that just this morning, we have released GCP support for Stratus Red Team.
1417040	1423020	And this is thanks to Dakota Reilly from Acquia, who did the initial contribution.
1423020	1424820	And I'm very excited about this.
1424980	1427620	So we are going to have first three attack techniques.
1427620	1436360	First one is creating an admin GCP service account, creating a GCP service account key, and impersonating GCP service accounts.
1436360	1437820	So this is just fresh out.
1437820	1440180	It was released this morning over breakfast.
1440580	1441920	So go and check it out.
1441920	1443820	I'm very excited about it.
1445660	1448460	Thanks a lot for looking at this presentation.
1448820	1450840	The slides are available here.
1450940	1455040	If you have some questions, you can send them on Twitter or by email.
1455040	1457140	My contact information is on the first slide.
1457600	1460200	I hope you will find Stratus Red Team useful.
1460340	1463600	I'm looking forward to your comments, your ideas, and your contributions.
1463840	1464780	Have a nice day.
