start	end	text
0	4920	To start our day, we've got a good friend of the Cloud Village speaking, Jenko Hong.
4920	11400	Jenko is a principal researcher on Netscope's threat research team, focusing on cloud threats and identity abuse.
11400	20960	In this talk, Jenko is going to cover research and tooling to improve cloud defenses in AWS, Azure, and GCP, using more stealthy measures which complement existing techniques.
20960	25160	The title of the talk is Cloud Tripwires Fighting Stealth with Stealth.
25160	27840	Everyone please give a warm welcome to Jenko.
29140	30540	Thank you, Mike.
30540	34900	And thank you, everyone, for coming Sunday morning.
35080	38160	You look as tired as I feel.
38360	39680	So thanks.
39680	41480	Hope your con is going well.
42700	50620	So as you might gather from the title, I'm talking about something a little less common, maybe a little less popular.
50660	51780	Defense!
51860	53980	Yeah, I've got my blue hat on.
54060	54840	That's right.
54840	64980	So we spend so much energy, and it's good energy, at DEF CON talking about research on the attack side, the red side.
64980	69160	And ultimately, that helps us in the security community improve things, right?
69160	74640	The vendors are a little bit slower than we'd like, but they ultimately do listen.
74680	84980	So I'd like to sort of switch our brainpower, if you're willing, to the defense side, because I don't think we spend nearly as much time there.
85380	86560	And we really need it.
86560	88540	So I'm going to go through a few things.
88540	94340	And I'm going to start with a demo, which I translated to screenshots just because of time constraints.
94380	99480	And it's about a technique that is several years old.
99480	105100	And if you're into Azure and Microsoft, and you don't know about Dr.
105100	106900	Azure AD and Dr.
107040	109580	Cinema, he's awesome.
109580	110740	You should follow him.
110740	113700	A lot of research has spawned off of that.
113740	119020	His blog is sort of down because he's joined Microsoft from SecureWorks.
119020	135740	But this is sort of an ode to something he published three and a half years ago, which is Microsoft's device code flow implementation being highly susceptible to phishing, as well as carry on lateral movement and privilege escalation.
135740	139940	So I've got screenshots from a demo, and I'll talk you through it.
140220	145480	And I basically want to point out how advanced and moving the research is.
145480	148540	And even if it's three and a half years old, this is highly relevant.
148540	150500	Not enough time is spent on this.
150500	155100	So on the left, imagine you have a regular Microsoft user logging in.
155100	157900	This is one of my throwaway accounts.
157900	159760	And it actually has MFA on it.
159760	163460	It's actually a global admin in Azure.
163520	169960	It is cached, so I don't go through the MFA process, but normally I would.
170000	171060	And I pop into Outlook.
171060	172220	So nothing surprising there.
172220	179140	On the right is the attacker executing device code flow in OAuth.
179580	183920	Now, you may have to look at the slides to actually see it.
183920	186460	I'll talk through the important points.
186460	189340	Device code flow is really easy to execute.
189340	199200	This is payload of invoke rest method in PowerShell, which is as close to raw curl with post get that you can get.
199200	204040	There are two attributes supplied to kick this off as an attacker, right?
204040	206980	A valid application obviously would do the same.
207060	212080	One is the resource, which in Microsoft land is the API being requested, API.
212080	220180	The client ID in OAuth terms is the application client ID when you as a developer of an OAuth app register it in your tenant.
220180	221540	You get a unique ID.
221540	222800	I have two things.
222800	232120	These are sitting in a loop querying Microsoft saying as soon as that user logs in, give me the OAuth tokens as soon as they approve.
232320	238500	So popping on the left is the phishing email.
238640	242660	I want you to just appreciate my HTML capabilities.
242660	246620	So this is an Office 365 phish for extra storage.
246620	254440	Promo code, which is the user code I got as an attacker from Microsoft, from the device code flow.
254440	257160	That's the official Microsoft device code login.
257160	258480	There's nothing funny there.
258480	262380	This is exactly what you would see in any device code phish.
262380	265780	So if the user follows it, they pop in the code I sent.
265780	268020	They go through normal login.
268020	272180	It's cached, but again, normally this would be an MFA login, right?
272180	275600	So one of the things we'll get is bypass of MFA.
275600	278540	We're going to have the user put in their one-time code.
278540	279720	We don't have to intercept it.
279720	281160	We don't have to do whatever.
281220	284020	It's a one technique to bypass MFA.
284560	287040	I want you to focus on this endgame.
287040	288900	This is all the user sees.
289140	291140	Are you trying to sign into Microsoft Office?
291140	292480	Why does that text appear?
292480	294480	Because I use the client ID.
294480	300460	If I'd use my own ID, some app I created, I pick a name when I develop it and register it.
300460	302740	And I can't choose Microsoft Office.
302740	305960	They prevent you from doing common derivatives of their own products.
305960	307980	But I chose their app ID.
307980	308800	So great.
308800	312760	This looks all official to the user, right?
312780	316100	No reason not to trust it once you get to this process.
316100	317260	The domain is Microsoft.
317260	319400	Nothing funny there, right?
319960	321780	What does the attacker see?
321960	326160	So finally, after you set next on the left, you just get a simple confirmation.
326160	326340	Good.
326340	327100	You're done.
327340	328700	What's the attacker see?
328700	334200	Well, they return from that polling call and they get an OAuth token right there on the bottom.
334200	335180	Access token.
335180	337960	They also get scopes, which is part of OAuth.
337960	343380	I want to point out that at no point to this up till now did the attacker have to specify scopes.
343380	348180	In normal OAuth world, you specify scopes as an application.
348180	352420	You are going to ask the user for their permissions for the such and such.
352420	355760	These are directory scopes, graph API scopes.
355760	358640	Microsoft decided to implement default scopes.
358720	359800	That's stupid.
359800	362240	That's not really common or part of OAuth.
362240	363480	But they did it.
364400	367600	I also get a refresh token, which is part of OAuth.
367600	373400	The dirty secret is, everyone says temporary token systems are more secure because they're temporary.
373400	377540	Yet we have a refresh token that for all intents and purposes is permanent.
377540	381480	Yes, you can revoke it on the user side.
381480	394700	But if you don't, if you use it like every four months, it just says fresh and you will have permanent access because, of course, third-party apps like your email client or something needs to continue to get email without having you re-log in.
395300	398460	Back on the user side, they do have an Azure account.
398460	399560	They happen to be global admin.
399560	400780	Here's some resources.
401220	407120	What the attacker is going to do with this graph API token is, of course, do graph calls.
407120	410820	They will get the users out of AD because that's a Microsoft thing.
410820	413520	You can enumerate users very easily.
413860	416580	They will get email as well.
416580	418340	Another graph API piece.
418340	421960	Now, here's the kicker with this technique.
422000	424440	Microsoft implemented a really bad thing.
424440	433400	In OAuth land, you don't get to switch your permissions once you have a token without going back to the user to ask them for new permissions.
433480	442620	This case, the attacker faking or impersonating Outlook asked for graph API and whatever scopes there were.
442840	452840	Now, they're going to use the refresh token because Microsoft allows them to get a token, a new token with Azure access, which is what's highlighted there.
453120	460100	That breaks the OAuth model and there's a reason why Microsoft did that besides being stupid.
460100	461960	It's for SSO reasons.
462600	465940	They're using OAuth for SSO, which is also stupid.
465940	470520	Don't use authorization protocols for authentication, but they did it.
470760	475800	So, because as an attacker, they're continuing on their flow, they've got a new token.
475800	479560	It's Azure management API enabled.
479560	481660	They can now enumerate all resources.
481860	483380	Okay, it's the user's permissions.
483380	485460	This case is global admin, so it's everything.
485460	486480	Okay, great.
486480	490380	We just went through this flow as a user and attacker.
490400	501060	It's fairly complicated, but I want to point out that normally, if this weren't an attack, there's a step one, which is the user installs an app and then they're expecting all of this prompting.
501060	503080	Well, we convert it to a phish.
503080	506080	The attacker starts with step two.
506080	507780	They're fully in control.
507800	514280	And again, the client ID is not even something they had to create that traces back to them in the logs.
514280	517980	It is Microsoft Office client ID.
518680	534100	The other piece at the tail end was we switched permissions and did a lateral move, which could also call privilege escalation by trading our token, refreshing, and getting Azure management resource permissions.
535120	549940	From a logging perspective, when you look at the logs, when the attacker script actually gets the first token that is logged, yay, when they refresh and pivot to Azure, it is not logged.
549940	557700	You might guess that developers didn't want to busy up the logs with a refresh, which might have to happen like every hour.
557700	558600	Who knows why?
558600	562460	It's dumb because you're not seeing the lateral movement.
563740	570060	The details of the actual log are what you get in the sign-in logs.
570060	570880	It's not bad.
570880	575020	It means you have a chance to mitigate this with conditional access policies.
575020	577900	That is the recommended way to do it.
578940	581760	Conditional access policies are a bit of a Swiss cheese thing.
581760	582720	They are imperfect.
582720	586780	If you do research, you'll find that there are ways still to bypass it.
586780	589160	Knowing this, Microsoft didn't stand still.
589160	592020	They added device code as an attribute.
592020	594300	You can put that in conditional access policies.
594300	597160	You can prevent all apps from using device code.
597160	602180	That's not a bad idea, other than the fact that Azure CLI uses device code.
602180	605620	So you're going to have to be creative to actually get the right policy.
605620	612040	Second, there's an enumeration, a static list that they keep adding to of apps.
612040	616560	Microsoft Office, the actual app ID I picked, is not in that list.
617020	628600	It just means fine-grained control of conditional access policies with this app that I impersonated is still very, very tricky to get right, even if you know all of this.
628800	630140	So there we have it.
630140	636600	A three-and-a-half-year-old attack that is still popular, not well educated.
636600	644560	So when we look at the big picture, let's just go to Microsoft, since we're bashing them a bit, and look at their unfortunate incidents.
644560	650720	So we have Blizzard from March, a favorite nation-state, maybe along with China, Russian hackers.
650720	653140	I'm sure you all have reviewed it.
653140	667880	Some techniques are old, like password spraying, exchange or email as a target, proxies with a little twist of residential, and then OAuth apps coming more and more common if you've been reading the news.
667880	679860	In there, maintain access, persistence, elevated access, privilege escalation, being a little clever, using a legacy app to create a new user account, and then bless another app, right?
679860	682140	Leave your, you know, a little creativity.
682960	685420	Let's switch to Storm last summer.
685420	688340	Let's switch nation-state actors to China.
688980	703140	Now we're going through a common attack vector of email again, but it's more complicated because underneath we have MSA tokens from the consumer side of email, and somehow there's a bug that allows that to sort of switch over to corporate email.
703860	707900	At the end, I'm not here to say Microsoft's bad.
707900	709700	They've got smart people.
709800	712060	They've got legacy code and a big installed base.
712060	712980	Defense is hard.
712980	726200	When you look through Storm's techniques, anyone who's read, and I applaud Microsoft for disclosing their process, but if you read it closely, Microsoft got confused in their own analysis.
726200	732060	They'd be like, oh, we think it's a race condition, and we think there's a crash dump, but we don't actually have that evidence.
732160	736640	But it seems that, you know, out of code review, it seems very, very plausible.
736680	745680	So steps one, two, three, four, five, it looks like a perfect storm that allowed this to, pun I guess intended, to actually happen.
745680	754620	Obviously a very sophisticated APT-level nation-state actor, but the point is defense is hard, even for the best who have money and expertise.
755060	761820	All this to say, before we talk about defense, the question is why do we even have to talk about new defense?
761860	766420	Because attackers are winning, and we know which side of the field they're on, right?
766780	771480	And it's not just buzzwords and headlines, which is easy to paint a story.
772120	786740	What I appreciate about DEF CON is you meet some of the greatest researchers sharing their work, and here's just a smattering from the last couple years that I've just jotted down and are somewhat related to things I think about.
786760	790180	Every year, there's another 20 of these.
790180	792040	So enumeration without logging.
792040	800020	I think Nick Frechette, big fan of his, he spoke last year, he spoke in that black hat, he spoke, he's speaking after me.
800060	805020	AWS enumeration without logging and other sophisticated techniques.
805020	807200	Obviously, we know about Rhino Labs.
807200	814120	There's classic techniques, though, still sitting around to enumerate SharePoint URLs without authentication, right?
814120	819960	Enumeration is tough to stop, even if the vendor plugs a hole.
819960	827760	There's access and persistence in unmanaged, or at least less commonly thought of, full-blown virtual machine environments.
827760	828220	Guess what?
828220	829780	Cloud Shell runs in a VM.
829780	830160	Guess what?
830160	832960	The protections there are pretty low.
832960	834140	Guess what?
834500	838700	They want to push it for free to everyone because it's really easy.
838700	842500	Pre-configured environment with a CLI set up and full access.
842620	851860	So open ports have been spoken about by my colleague Hubert Lin at this DEF CON of how you can abuse that to get access to a whole bunch of services.
852120	859660	We just went over number three a couple years ago, Matthew Bryant, server-side scripting in Google Apps.
859660	863960	I didn't know that existed until he talked about that with loose permissioning, right?
863960	874820	As if Microsoft didn't tell the world and Adobe that embedding scripting code and documents was a bad idea, Google had to go copy them and say, no, we're going to put it in the server.
874820	877560	An ability to open a doc and execute code.
877560	879600	What could go wrong, right?
880720	883580	Five, service principles at this DEF CON.
883580	885860	I loved Cloud Village talks.
885860	898080	There were at least three, four people that I listed that were diving into Azure service principles, managed identities, enterprise apps, app registrations, cross-tenant access, and the admin roles.
898120	900700	And there is so much there to mine.
900700	904080	We're just scratching the surface of abuse there, right?
904080	908040	It's being talked about a lot more, and a lot more is coming from that.
908040	927260	And then, Asterix a couple years ago had a GCP attack where they used the temporary deletion of a project for 30 days to hide stuff, because once you deleted it, it disappeared from APIs and portal views, and in there was an OAuth app, so it's a persistence move.
927260	937080	You need access, set it up, you undelete the project, you use the app for whatever privilege escalation, you delete it again, just make sure you come back in 30 days.
937100	951160	And so, as I'm working this year's CTF a little bit, creating a challenge, Azure has a similar temporary delete status folder for Azure objects, including service principles, right?
951160	955520	So, ability to hide code and privilege really easily, right?
955520	958880	So, this is just off the top of my head.
958880	964860	The point is, attackers are winning, they're smart, even our research shows that, right?
964860	966460	Our greatest minds.
966460	986380	So, you can feel like you're going to a gunfight , but the attacker is the one who has the gun, and you're walking uphill, they change the rules, the asymmetry, and what I mean by that is every dollar and every hour they spend causes like an order of magnitude on the defensive side.
986880	991300	They have stealth, almost by the get-go and default.
991540	998920	They take advantage of every single ability to execute code within our blue hat environments.
998920	1014940	That is, like, VMs, the obvious one, then there's serverless functions, then those things hiding as VMs, like Cloud Shell, or as I think Nick Frechette pointed out, VPC endpoints in AWS are just running on some kind of VM.
1014940	1024080	OAuth apps, which is code, and privileges, and app scripting in Google, among other things, with a ton of backdoors.
1024080	1032580	This ghost token, these OAuth apps, this code, and then, of course, they can attack the human layer, which we know is the weak link, right?
1032580	1040500	All of this, while the defensive reality is you feel like you're fighting with a butter knife, okay?
1041280	1046820	And unfortunately, here's where I think security, we've fallen into a rut.
1046820	1048360	We don't challenge ourselves.
1048360	1052520	I think security is too much done by checklist.
1053120	1054460	You think about it.
1054460	1056840	What's a good best practice by a vendor?
1056840	1064280	It's a checklist of usually configuration, sometimes some detection, sometimes some remediation.
1064280	1067800	So you feel good if that's your job, you're done with the list.
1067800	1070760	Your boss is good, compliance will pass you.
1070760	1071720	Are you really secure?
1071720	1073020	We all know better.
1073020	1074960	You have to actually think about it.
1075520	1084160	But we don't really think about the design issues, software issues, the things that are causing havoc, like the demo screenshots.
1084580	1088700	Is OAuth really designed well in Microsoft?
1088700	1090080	The answer is no.
1090340	1095760	So that should cause you a different stance rather than here's the best practice for securing Microsoft OAuth.
1095760	1098580	Put in a conditional access policy and be done with it.
1098580	1101340	No, you're still exposed, you know that, right?
1101540	1114980	Staying behind the moat is this idea that it's great, we paint these analogies, the moat is our outer perimeter, then we hide behind it with a good drawbridge, we throw some alligators in the moat, we go with a high wall, put some archers on top.
1115300	1124460	Okay, do that, but how about send some peasant spies out into the barbarian lands and do something a little more proactive?
1124600	1131820	Because that's what the red team's doing, that's what the attackers are doing, that's what social engineering is doing, right?
1131820	1136700	Why don't we borrow and apply the same brainpower on the blue side?
1136740	1140540	Now, defense in depth leads to layered defenses, which is great.
1140540	1145620	The problem is the implementation at the human level, I think, leads to isolation.
1145620	1155760	My firewall team doesn't talk to the IPS team, which definitely doesn't talk to the malware team, much less my machine learning risk analysis sim team.
1155980	1159860	So we've broken the problem into three discrete components.
1159860	1161960	The attacker's like, you're a fool.
1161960	1170960	I'll social engineer the network guy through the help desk, I'll pivot and I'll get app credentials and blah, blah, blah, and we have groups not talking to each other.
1170960	1178160	The threat and attack vector and attack chain cuts across everything, but we're organized in layers that don't talk to each other.
1178160	1179240	What's an example of that?
1179240	1181840	Here's a minor one, which could be a major one.
1181840	1184560	It shows itself in product features.
1184560	1192320	Google Cloud has a session timeout for your cloud logins through the portal, as well as the tokens you might get.
1192320	1193640	Good idea.
1193640	1195800	Default sucks, but it's a good idea.
1195800	1199120	Where is that located in API land or the portal?
1199120	1201280	In Google Workspace.
1201340	1210880	I get we have a common identity service, but that might be two separate groups in a large organization who don't talk to each other.
1211040	1215460	Imagine an incident happens and you have to revoke access and force a revocation.
1215860	1221660	Are you trusting the guy on the Google Cloud side to know where to go to set the timeout?
1221660	1226680	Of course it's not going to happen, but this is the the world we have fallen into.
1227080	1228040	Defenses are static.
1228040	1229400	They don't change much.
1229640	1232120	Same for all attackers and all environments.
1232120	1233380	They tend to be pretty generic.
1233380	1237240	Not completely, but we tend to be like, let's go through the checklist.
1237240	1237720	We're done.
1237720	1238580	Let's move on.
1238580	1240500	And everything's in plain sight.
1240500	1242860	So what could the future be?
1242860	1247260	My whole premise is think more about design and less about checklists.
1247400	1249200	Go towards the attacker.
1249200	1253660	Yes, think in their mind and be in their shoes, but get closer to them.
1253660	1254660	Do recon.
1254940	1256740	Figure out how that fits.
1257260	1259900	Cut across your organizational boundaries.
1259960	1263540	If we're going to do stuff, we've got to start with engineering teams within organizations.
1263540	1267220	They're developing crap and sending it through DevOps, right?
1267700	1270960	Insecure apps are going to cause havoc on the ops side.
1270960	1273460	And then you get to threat hunting and risk assessment.
1273460	1275100	Everyone's got to be working together.
1275100	1280580	Now I get this is stuff that we may not be able to control, but the advantage is I'm not trying to create a product.
1280580	1285340	I'm trying to burn everything to the ground and rethink how would we do this better?
1285340	1287940	And we would definitely address some of these.
1287940	1290800	We would be dynamic and changing and make things stealthy.
1290800	1294620	To the extent that it doesn't screw us up, we would be changing things.
1294620	1307140	So attackers, the analogy would be change the bank vault code every day because if you get an ex-employee or a paid insider, it makes it harder for the thieves to break into your vault.
1307140	1309720	Not perfect, I would rotate the key.
1309880	1312080	Instead, we tend to be static, right?
1312080	1318100	And all of this is about tailoring things to buy CSP because every CSP is different.
1318100	1321600	AWS is different, obviously, than every other one.
1321600	1324940	We would also tailor it to the attacker techniques.
1324940	1332700	To the extent I can intuit attackers shifting their techniques in a fundamental way, I have to change and create new defenses.
1333500	1335640	We do do some of that.
1335640	1337180	It tends to just be reactive.
1337180	1339520	Come to DEF CON, wait for someone to publish something.
1339520	1341220	Oh, there's a CVE.
1341220	1341580	I did.
1341580	1342400	I mitigated it.
1342400	1343100	Move on.
1343100	1344840	I think we need to think more fundamentally.
1345940	1353580	I think in the coming year will be a whole bunch of service principle attacks and related ones on Azure because that's the gold mine.
1353580	1356200	It's complex and it's a way to escalate privileges.
1356200	1359760	Let's get out of the curve, think about that design, put in defenses.
1359760	1361020	Okay, enough of that.
1361020	1362140	That's really high level.
1362140	1362860	I get it.
1362860	1365320	Let me tell you a story to try to make this real.
1365320	1367120	It's an old school story.
1367120	1368020	Unix.
1368180	1370860	This is before Linus ate the world.
1370860	1372260	So Solaris was still around.
1372260	1374440	It was probably 20 years ago.
1375700	1381480	The idea is if you have an inner sanctum kind of server, super important data.
1381480	1385240	Maybe it's you know, Hunter Biden's real laptop.
1385600	1392020	Maybe it's the Zelensky audio that got hidden or the video of Trump in Russia, whatever it is.
1393020	1394920	You put in protection, right?
1394920	1395940	Layer defenses.
1395940	1400940	But you got to be thinking, what if someone breaches the ring zero?
1401000	1401960	What am I going to do?
1401960	1403160	How do I detect?
1403160	1405500	And then how do I do?
1405500	1407160	It's not really remediation.
1407160	1409100	It's just save the jewels.
1409100	1412900	How do I, you know, pull the plug, take it offline?
1413620	1417540	So you think about, it's likely they'll be on a shell.
1417540	1422960	Even if they have a sophisticated RCE, usually at some point the attacker is going to get shell.
1423440	1429700	Then you think about, this is a story told by a really good CTO boss of mine.
1429880	1432320	Then you think about the attacker, what they might do.
1432320	1436560	Well, they're likely going to do LS in the first like two commands, right?
1436960	1441040	And then you switch it up on the attacker.
1441620	1447040	So instead of the real LS, you make it execute shut down now in some form.
1447040	1450800	Now you might not do this crappy little shell script, but you get the idea.
1450800	1452900	If you can read jokes in Unix, right?
1452900	1454440	In bash or shell.
1454460	1460800	The idea is you fool the attacker so that it not only detects it, it fixes the problem.
1460800	1462100	Yes, it shuts it down.
1462100	1467660	Someone has to probably physically or remote get into it, but just save the crown jewels.
1468840	1473180	Now, that's all well and good, but you do have to use this, right?
1473180	1475640	It's not just a fake trap.
1475640	1477360	So what do the good guys do?
1477580	1478780	They train themselves.
1478780	1482840	Now, I know this is a little hard, but this is the true story.
1482840	1488220	They learn how to do echo star and shell expansion as their poor man's LS.
1488220	1491360	So for, you know, Unix guys, that's the story.
1491360	1498200	True story, but what it represents is this idea of tripwires and this whole point.
1498200	1502880	Can you identify choke points that are likely to be traversed by the bad guys?
1502880	1507460	Can you create a tripwire that is stealthy that they will trip themselves?
1507500	1509540	Three, can you create a grenade?
1509540	1523540	And it could be something a little less than a grenade, like a video logging, whatever alert, but you get the idea, something for an action, but don't kill the good guys and don't confuse yourself.
1523540	1535720	So in Unix land 20 years ago, this was an anecdote, but it sat in my mind for 20 years of how can we do this in the cloud?
1535900	1540280	So I think I got about five minutes.
1540280	1542880	So I'm going to have to get into the good stuff really quickly.
1542880	1544240	You guys got to keep up.
1544240	1544640	All right.
1544640	1550460	There are some common techniques that I think we can incorporate in detection.
1550460	1557320	The trouble with trying to stop an individual technique, as you've seen, is they're very sophisticated.
1557320	1558320	They change.
1558320	1562300	You stop Nick Frechette's cool, awesome enumeration technique.
1562300	1563500	He's got another one.
1563500	1565440	I guarantee it next year.
1565440	1566300	He's that good.
1566300	1568480	If you've been following him, it doesn't matter.
1568480	1573560	Think about, you know, China, APT zero, we got smart guys.
1573880	1577300	So instead I wanted to look at choke points.
1577300	1582480	What do attackers, pen testers, and you guys feel free to disagree, think about it.
1582480	1585680	What do you do once you get initial access?
1586020	1592920	Even after you get privilege escalation, you often do more recon because you don't want to leave money on the table.
1592920	1594060	You could.
1594200	1606020	I'm not trying to solve every case, when you do discovery, you might, to take an AWS example, enumerate resources or security principles, right?
1606080	1608080	What buckets are there?
1608200	1610420	Do a list on buckets.
1610560	1612960	And then go probe, right?
1612960	1625840	You might be worried about being detected and think about what's in CloudTrail or not, but some of this is in CloudTrail and you're just going to be like, let me go slam into the Apple store, grab the stuff, I'll be out of here by the time they come, doesn't matter,
1625840	1626560	right?
1627020	1627980	Of course you will.
1627980	1629260	What else might you do?
1629260	1640240	You might check your own permissions, list your IM policies or equivalent, because that'll tell you what the admins granted that user.
1640240	1654960	And there might be explicit listings of an AWS LAN generic sort of policy of, oh, I can do things like assume role, that's interesting, privilege escalation on, you know, such and such service.
1654960	1658640	I can get and list this bucket called finance, right?
1658640	1659820	So on and so forth.
1659820	1661560	I might have wild cards.
1661560	1663220	I've got stuff to work with.
1663220	1668040	Directly try or do a little bit more discovery.
1668040	1669500	So what's my premise?
1669500	1670780	This is pretty common.
1670780	1674440	Enumeration, resource access, security principle access.
1675520	1677540	Back to tripwires.
1677540	1679740	I'm going to set up some fake ones.
1680260	1688760	Very enticing ones that are highly monitored, that are unlikely to be used by my good users or valid users.
1688760	1693720	Simple enough concept, hard to implement without false positives, but it can be done.
1693720	1705820	And my point is, if we don't start the hard thinking now, we'll just be in checklist security forever, which is good job security for everyone in the room, but not great for society at large.
1705900	1708100	So what do I mean by that?
1708160	1715800	I might allow finance acme.com, of course, to be a fake bucket, among others that they can enumerate.
1715800	1720100	The real finance one is inaccessible or it's named something else.
1720100	1726500	It's just one method among dozens I want to bring to even that playing field.
1726920	1733060	If they assume role, I can see what roles this user is allowed to list.
1733060	1734860	There might be the default admin.
1736700	1743440	And so I might want to be smart about setting up fake roles that are real, but maybe with stunted permissions.
1743740	1746020	And in explaining that, I want to point to tools.
1752880	1760720	I will use a very nice, sophisticated technique to check if it can assume it and it's not logged.
1761540	1766980	Well, if this is a popular tool, I'm not just going to get the benefit as a red teamer.
1766980	1769540	I'm going to set up some fake ones based on this.
1769540	1777840	Yes, admin I can get to on my own, but how about, I don't know why they have Aaron in there, but API gateway and AWS, I don't use this in my org.
1777840	1782120	I'm going to set up some fake ones with restricted permissions, monitor the hell out of it.
1782120	1788000	And my valid users shouldn't be running Paku internally.
1788160	1793140	And so I'm thinking ahead, maybe this gives me low false positives.
1793140	1802380	Someone who hits a account or Abram, as an example, might be a high true positive detection that I can act on.
1802380	1804960	And it's just a tripwire that I've set up.
1804960	1806460	Be tool specific.
1806680	1807580	It's dumb.
1807580	1810480	Why would I set up defenses ignoring all the tools?
1810480	1813100	So the dictionary lists are a big one.
1813100	1817300	Let's shift gears to compute, which is highly open-ended.
1817300	1822100	This brings us into the old world that the fully open ports run any code.
1822100	1822960	It's a nightmare, right?
1822960	1824760	But of course it has to be provided.
1824880	1829060	Netflix security team does awesome work and this is years old.
1829080	1831840	And of course they have the resources to know how to implement this.
1831840	1833980	So it's sort of guidance with a little bit of code.
1834220	1837120	They took the normal process.
1837120	1839480	This is a big attack vector.
1839480	1846360	Grab the credentials of the EC2 instance if you can get on it or hit the metadata service, right?
1846360	1854100	So normally application will hit that locally on the server and grab credentials and have it returned to them.
1854120	1859600	But what Netflix did is said, uh-uh, I want to IP restrict that credential.
1859600	1864580	So if it's used off board, I detect it or it won't work or I can monitor it.
1864580	1867700	So instead they did some sophisticated things.
1867700	1871320	They set up their own proxy, reworked IP tables.
1871360	1875900	So any request to the metadata service hit their proxy right there in white.
1876520	1880840	At boot up time, that proxy got the IP address of the EC2 instance.
1880840	1881460	It did.
1881460	1883360	They did something really clever.
1883400	1884680	They assumed role.
1884680	1888720	They set it up so they could assume the role of the EC2 instance in step three.
1888780	1890080	They can wrap.
1890080	1896000	When you do that, you can optionally set a policy when you assume a role and get those credentials back.
1896000	1900540	So they've set an IP policy like this in red.
1900540	1902500	And that IP is the EC2 instance.
1902500	1910420	They effectively are getting temporary tokens that they created that are bound to the IP address.
1910520	1912400	And they can do whatever they want with it.
1912400	1915260	It can be a straight out deny, right?
1915480	1916940	Very clever.
1916940	1918260	Takes some work.
1918260	1919740	Very clever.
1920120	1925460	And it's doing to, it's going to mitigate breaching and compromise of your EC2 instance.
1925460	1929840	I want to take that idea and be a little more subtle.
1929840	1931240	I may not want to stop it.
1931240	1933580	I just may want to log it, right?
1933580	1938400	I know my policies and procedures are to do certain things, never go off board.
1938400	1945740	But if someone steals it, I might want to just record their IP address and do something else with it and not just outright block them, right?
1945740	1947780	I'm thinking defense and detection.
1947780	1952120	I might want to give them some fishing line, let them do it.
1952120	1953460	Or I might want to block them.
1953460	1957280	My point is, we got to think about prevention in a new way.
1957280	1962840	If you prevent something, I don't want you to drop that deny block on the floor.
1962840	1964380	Think about firewalls.
1964380	1966360	Gets really noisy on the perimeter.
1966460	1968080	Denies usually are not logged.
1968080	1970220	Because of that, they get dropped on the floor.
1970220	1973760	They're also false positive land, like a Tor exit node.
1973760	1976040	You get down on the firewall, what's the use of logging that?
1976040	1977500	Are you going to really act on it?
1977500	1980260	Better just to deny it and drop it.
1980260	1981860	No, I want to change that.
1981860	1988420	I want you to do the job, but I want to collect information that I got traffic from China or a Tor exit node.
1988420	1993560	And if I ever see that elsewhere in my environment, that helps me.
1993960	2002220	My defenses internal to the moat get helped by perhaps defensive measures outside at the perimeter.
2003060	2005460	Really, really nuanced view.
2005560	2009620	Let me cover one last cache, sort of external credential.
2009620	2011480	I want to move forward towards attackers.
2011480	2013740	I don't want to sit behind my moat.
2013740	2019720	So, most of the external programs, including the CLIs, cache credentials.
2019840	2023020	Most all of them, put them in clear text.
2023320	2027540	You ask the vendors, they're sort of like, well, yeah, if you're in points, compromise, you're screwed.
2027540	2028600	Sorry, good luck.
2028600	2031340	You know, that's CrowdStrike's problem, not AWS's problem.
2031900	2035340	That's what, don't use static API keys.
2035340	2036500	Oh, great, thanks.
2036500	2038780	But I do need something.
2038980	2044160	So, in their SQLite database, this is Google, everyone's the same.
2045900	2049580	What I want to do from a detection perspective is put fake credentials in there.
2049580	2055520	If they actually work, are highly limited, they go to empty accounts, monitor the hell out of them.
2055620	2057840	These survive updates, they're config.
2057840	2066200	I can plant that one time on my admins who work from home or over whatever VPN, plant them.
2066600	2071600	They'll probably stay live forever with the most tokens the way that they work.
2071940	2077520	If they're ever compromised, and I detect that activity in an account, boom.
2077520	2079960	Low chance of the admin using it, they'll be trained.
2079960	2089200	But unless they're looking in their own config or listening configs, I want to think more like this, right?
2089200	2097500	Choke points, tripwires, specific to the design of cloud providers, grenades or actions have to be really thought about carefully.
2097820	2100140	And don't killing the good guys is probably the key here.
2100140	2106460	Because even if you buy that there's ways to detect advanced attackers, the key is, how do you not screw yourself?
2106460	2113240	Because you screw yourself, create work for yourself, if you're a blue hat, you're out of a job, your boss gets pissed, blah, blah, I get it.
2113240	2116500	So what do message of the days do in honeypots?
2116500	2122500	They probably in some way, disinvite or invite the bad guys or good guys, right?
2122500	2129160	It says, hey, this is not allowed as a site, you really should log off the server, right?
2129160	2131220	That's the message of the day in a honeypot.
2131220	2132720	And the attacker ignores that.
2132720	2135560	So when they do further activity, you have a higher probability.
2135560	2137900	What's the example in S3 bucket?
2137900	2141300	It's the top level file because everyone's going to enumerate from the top.
2141420	2149560	So yeah, a valid user might go there, but I've got to read me that says, you know what, this is the old finance bucket and it's only, you know, authorized for finance personnel.
2149560	2151880	If you're looking at it, you should really not look at it.
2151880	2165520	Three levels deep in the path, I have all the interesting finance files with further warnings of, hey, this is not really current, you should ask your administrator for access to the current one, but this is current as of a month ago.
2165520	2173200	And if there's enumeration down that path, ignoring the signs, then you have a higher probability.
2173240	2178460	You add this into the mix to refine and lower your false positives, right?
2178460	2182400	You take a simple access to a resource and you try to make it work for you.
2182760	2184620	You restrict admin roles.
2184680	2185940	What do I mean by that?
2185940	2190240	It depends on CSP, but maybe you keep the real admin role.
2190240	2192580	You create a custom role that has that privilege.
2192580	2194420	That's what the valid users use.
2194420	2196160	What do you do with the real admin role?
2196160	2197100	You restrict it.
2197100	2202340	If the CSP allows you to do it, take root, for example, in AWS, right?
2202340	2206400	Common wisdom when you first get on AWS is root can do everything.
2206460	2215800	Well, not actually, you can have a VPC or you can have a, at the org level, you can have a boundary control, right?
2215800	2219100	That you implement that can prevent root from doing things.
2219160	2224260	So if there's a capability, you can stunt the default admin roles.
2224340	2226500	Use a copy or custom role.
2226640	2234080	Now you have a way to distinguish valid users, don't kill them, versus attackers who always go after the default admin roles.
2234300	2235500	Not doesn't work everywhere.
2235500	2237640	You got to put your mind and design.
2237740	2239200	So you keep doing these things.
2239200	2242400	You also add in signing and tagging.
2243060	2248600	Session tags in AWS, when you assume a role, you can basically pass along some tags.
2248740	2251060	You can incorporate that into workflow.
2251160	2253420	Valid users, pass in the right ID.
2253420	2260680	It doesn't prevent them from assuming role, it just identifies them as, I know the current month's secret ID.
2260680	2264940	Attacker wouldn't do that, they would get success, they would plow ahead.
2265000	2267480	They're not stopped, they would plow ahead.
2267480	2271240	They wouldn't bother backtracking trying to figure out if an ID is being used.
2271240	2275160	Okay, that's the AWS session role.
2275160	2278320	I got to wrap this up so I don't cut too much.
2278320	2280100	So this is my last slide.
2280200	2281900	What's the practical of all this?
2281900	2291180	If you've heard the theory and you think there's a chance of this approach, there's some requirements for this to even see the light of day.
2291180	2292880	So I'm starting in the middle.
2293180	2294880	There's got to be comprehensive research.
2294880	2297680	That's my job and anyone who's interested.
2297680	2305880	You got to look at everything to try to see where are the choke points across APIs, not just the CSPs, but the app APIs.
2306180	2310060	They have to actually work and not kill the good guys, efficacy.
2310220	2317740	The cost of using this has to be low enough because none of us are going to do a lot of work for little return on the blue side.
2317920	2322060	And it has to sort of pass that open source kind of sniff test.
2322060	2331740	If you're a red hat and you know this is in place, are you still slowed down so that it's a more of a level playing field?
2331740	2338300	And the point I would say is even if you know I have fake roles and resources in play, you don't know exactly which ones they are.
2338300	2341620	And at a minimum, you are slowed down when you enumerate.
2341620	2346040	And before you assume a role, you have to think about whether that's real or not.
2346040	2352000	And you likely can't a priori know that if I've set up the environment right.
2352000	2353640	You have to try it.
2353640	2359220	And when you try it, I'm counting on I've set things up to distinguish you from a good guy.
2359560	2373840	So practically speaking in next coming weeks, I'll be publicizing some tool set as a POC, some software to sort of show how you can implement these, do CRUD operations, report on and delete them.
2374400	2387360	The idea that you could have a CLI that helps you with creation of tripwires and not have it be a hassle like wondering what the heck is in place, how do I delete it, did it actually work, and so on.
2387920	2400180	But we have to keep publishing research, keep thinking about this, putting as much time and effort as we do on all the good stuff on the red side.
2400380	2404300	So I think I'm over time and I apologize.
2405540	2406360	That's the end.
2406360	2410020	I would love if you have comments, even if that's the dumbest idea I've ever heard.
2410020	2413800	Love to hear it because that just makes me work harder on this effort.
2413800	2420260	It's a long -running research project and it's just something of we got to think different is the bottom line and we've got to try it.
2420260	2430860	I'm convinced if we took the smart people at Khan, we would make greater strides than just a tool of the day which fixes an issue of the day on a checklist.
2430860	2431780	Those are important.
2431780	2433020	I'm not saying don't do it.
2433020	2440340	I'm saying what prevents us from doing the same damn thing every Khan with just a different list.
2440660	2446080	Only if we're as creative and smart on the sort of long term with some implementation.
2446080	2447100	Thank you.
