start	end	text
0	5760	So, our next speaker is a veteran to the cloud village.
5760	7060	This is Jenco Huang.
7060	10440	Jenco is a principal researcher... Yeah, yeah, no, give it up.
16160	23360	So Jenco is a principal researcher on Netscope's Threat Research Team, where he focuses on cloud threats and vectors.
23360	31860	He spent time in engineering and product roles at various security startups, focusing on vulnerability scanning, pen testing, threat intel, and Windows security.
31940	42580	In this talk, he's going to demonstrate how a handful of SSO attacks work, what's the difference between them, how the underlying SSO protocols and features are abused, and where defensive measures fail.
42580	45040	So, please give another warm welcome to Jenco.
46980	48520	Thanks, Mike.
49280	52100	I will take your applause, even if it's out of pity.
52100	53080	Thank you.
53080	57680	Thanks for coming, if you just woke up, or if you're still up from last night.
57680	58960	Hope you're having a great time.
59420	64660	Alright, we are going to start here, and I'm going to give you a few things to level set.
64660	68940	So, we've got a couple themes when we talk about SSO, just to frame it.
69000	71980	We're going to talk about different chains, attack chains, trust chains.
71980	78180	We're going to focus a lot on protocols at the design and implementation level, which is where I think it goes wrong.
78760	81980	Concepts and principles, and I personally have a few goals here.
81980	83800	So, just so you know where I'm coming from.
84320	86440	I actually have about 80 minutes of content.
86440	88600	We've got to shrink it into about 39 minutes.
88600	93220	So, I'm going to amp it up to 2x speed, but this is a shared responsibility model.
93220	95320	So, you're going to have to listen at 2x speed, right?
95980	99360	And I like this graphic because it just had ecstasy in it.
99360	105260	So, I have a stretch goal of making this, you know, go through ecstatic feelings for you.
105540	107900	I can stay untangled here.
108880	111420	If you don't get informed, we'll just try to entertain you.
111420	113120	Got a few vendor jokes.
113120	115160	Hopefully, you'll laugh at those.
115580	122460	And if those don't work, I think you'll feel better about yourself because, you know, it's probably because you don't have the problems I'm going to go over.
122460	123700	So, let's see how we do.
124660	126680	Alright, so let's get into SSO.
126680	132380	Let's do it in one minute, sort of review what it is and why should we even be talking about it.
132380	136440	Well, you probably think, look, it's been around for 10, 20 years.
136440	138380	Let's look at SAML, right?
138380	139680	SAML 2.0.
139680	142620	Do I have a clicker here?
142620	144460	Or am I going to be running back and forth?
146760	148200	Thank you.
151820	154600	Well, that was a faux pas audio.
157180	158260	Which button?
160920	162540	Okay, I'm good.
162720	164000	So, SAML.
164800	166780	We have an identity provider.
166780	169060	It can be separate, pure play, like Okta.
169060	171720	It could be built into your apps and resources.
171720	174200	Okay, nothing to be surprised there.
174200	177060	But the flow can be initiated on two sides.
177060	178880	You can start at the identity provider.
178880	179780	Go to Okta.
179780	180600	Log in.
180600	181540	Get the dashboard, right?
181540	182460	No surprise here.
182460	185160	Bunch of enterprise apps.
185440	186680	Click on one.
187220	188380	Maybe it's Jira.
188460	189500	Hop right in.
189500	193860	So, although we're architecturally separating them, of course the user sees us in one browser, right?
193860	195300	So, they see a few pop-ups.
195300	195960	They're happy.
195960	197160	Log in once.
197160	198780	Maybe they go to a second app.
198780	200080	Don't have to log in.
200080	202140	Pop into Salesforce, right?
202140	205740	There's redirects happening underneath of some kind off in HTTP.
205740	206840	Okay, great.
207240	208540	So far, so good.
209320	212680	It can also start at the service provider where your apps and data are.
212680	213760	Okay , great.
213760	215220	So, someone goes to Jira.
215480	217100	And then usually there's a choice.
217100	219200	Do you want to do SSO or sort of direct log in?
219200	220320	And they pick it, right?
220320	222640	We have these buttons down here that we see.
222840	225840	And it gets redirected and they see a log in.
226180	227360	And then they come back in.
227360	231360	So, the user sort of sees the same experience, but they went to a different point.
231660	233280	Okay, no surprise there.
233280	234980	We come to conventional wisdom.
235820	238720	And I am talking fast because I've got 80 minutes to fit into 40.
238740	240720	I've got too many drugs, too little sleep.
240720	241960	So, stay with me, all right?
242360	243500	Don't fall behind.
243500	245160	You're going to miss something like a joke.
245480	245820	All right.
245920	246800	SSO is a good thing.
246800	247900	It's a best practice.
248040	251420	I don't think you'll find anyone saying it's a bad thing if you Google.
251640	253100	Centrally managed, of course.
253100	256240	That allows you to do better authentication policies if it's in one place.
256240	257340	It's more consistent.
257340	258500	No argument there.
258500	262920	Of course, then you can do a better job at enforcing stronger authentication policies.
262920	263480	Whatever it is.
263480	266660	MFA, password shrink, rotating credentials.
266660	267340	Great.
267920	273860	And, of course, the attack surface is smaller because you don't have your users juggling, keeping track of a million passwords.
274500	274960	Right?
274960	277140	And that's great because they're the weak link.
277760	282180	And it's probably one of the areas where security aligns with the user.
282180	289680	This is better security if you believe the first few bullet points and your users are happy because it's more convenient.
292260	294320	But... so I went out of security.
294320	296720	Went to Disney for a quote.
296720	299580	Just thinking the status quo is a good idea.
299580	301400	Especially if it's 10 or 15 years old.
301400	302620	Could be risky.
303080	306560	And it's hard to find a good meme, but let's say Cinderella.
306620	309560	Her status quo is mopping floors for her stepmom.
309560	311360	Or maybe she's at the ball.
311360	314860	And I just like that disdain age.
315240	317680	Strong women quote.
318260	325840	The point is we can't assume that what we're doing is safe because things change.
327040	330420	So let's start talking about the tax, which is really the meat of it.
330420	337100	I'm going to start with assumptions because that certainly makes an ass out of you and I or whoever's assuming.
337460	340100	So one assumption is centrally managed is better.
340100	341820	Or more secure.
342020	347640	But there's a risk there because it's like the big red button that allows you to easily do things.
348060	350780	You can really F it up, right?
350960	359200	In this case, you have a central point of compromise and you have a huge blast radius, which is all the apps and data under the SSO umbrella.
359200	360420	Makes sense, right?
360420	362000	I'm just going to point out one thing.
362000	365340	It's also contrary to security principles.
365340	377500	Ask yourself what companies out there of any size have their production environment under the same SSO umbrella as development or everyday user.
377500	378520	None.
378520	380780	Other than the startups that play loose and fast.
380780	383720	But any company that wants to stay in business doesn't do that.
383720	388460	So already you have islands of SSO or authentication domains.
388460	394520	That should be a warning flag to all of us that the conventional wisdom requires sort of review.
395000	398440	So what really is the opening for abuse?
398440	405520	So let's start with a classic one, Golden SAML, which is really a supply chain abuse of trust.
405520	414700	But when it's combined with an SSO impact, it's once you have an upstream attack, you now have this huge blast radius.
415340	420960	And to quickly review it, I don't want to go into SAML, but I'm going to point out a little bit of the complexity.
420960	422700	You have all this interchange, right?
422700	425680	Identity provider, user, service provider.
427040	437000	And the Golden SAML attack, although this diagram shows it as a man-in-the-middle attack, the key to it is you have stolen signing keys, right?
437000	438840	Shown here in the client.
439000	442560	And although they're using AWS, it could be any resource manager.
442560	451660	The key here is that they can sign a SAML assertion and just send it to where the app in question and it will take it.
451660	453680	There's no other setup here.
453680	454680	There's no state.
454680	457580	This is really step three right here.
457660	467800	So the protocol itself is stateless in the sense of the service provider with all the valuable data might just receive a SAML assertion and be like, oh, is this validly signed?
467800	469520	Great, you're in.
470160	478280	And that's sort of an example of how the protocol, although it's not a flaw, opens itself up to abuse.
478860	485500	Although this is CyberArk's good work in 2017, this is part of SolarWinds, which is more recent, right?
485500	487320	So you think about that.
487400	498320	Although this is a harder attack to pull off because you have to compromise internally with ADFS, once you do that, and it's been done, you have huge, huge impact.
498320	510200	Impact for access, persistence, lateral movement, because you essentially can create a SAML assertion and gain access to the whole SSO umbrella of that organization, all the apps and data.
511680	514260	So let's move to a second assumption.
514300	516700	We're moving laterally and we'll jump deep.
516800	520620	So I'm sort of stretching your minds horizontally and vertically, right?
520620	523040	Think of it as sort of mental bondage, right?
523040	524420	I'm going to really stretch you guys.
524420	526500	I'm the dominant one, by the way.
527860	531640	I am trying to introduce terms that you wouldn't normally hear.
531880	533080	Keep you entertained.
533160	534000	Ecstasy.
534040	534960	Bondage.
535200	535860	Keep track.
535860	537360	We'll have a little bingo game.
542200	542840	Nice.
542840	544780	I'm going to use that in the next presentation.
545620	546320	Alright.
548300	549220	Okay.
549760	551540	You're cutting into my minutes.
552020	553480	I like you, but...
553480	554420	First I'm going to take this off.
554420	555640	It's probably blinding you.
555640	556560	I apologize.
557340	558680	I did cover my head.
558680	559940	That won't blind you.
559940	560240	Alright.
560240	561420	Let's get back to it.
561420	567800	Assumption number two, ASS number two for short, is we at least understand SSO.
567800	570820	So even if there's risk, we can deal with it, right?
571240	573580	I mean, we do that in security all the time.
574360	578240	The problem is SSO is way too high level a term.
578240	579480	It's not even a protocol.
579480	581220	You have to sort of jump beneath it.
581220	582120	Is it SAML?
582560	584320	Is it OIDC?
584320	592680	Which is grafted on top of OAuth, an authorization protocol, to do authentication, right?
592680	594680	Warning, warning.
594740	598240	We're using authorization for authentication.
598260	602980	It might work, but why would you do that, right?
602980	608560	That would be the warning if we were reviewing software and talking to developers.
609020	612560	So really, these protocols are all different.
612560	614180	They're implemented differently.
614180	616360	They have their own abuse areas.
616360	623320	And OAuth introduces more remote access because it has well-formed REST APIs.
623320	626040	Like SAML rides on top of HTTP.
626040	630740	It's a little bit harder to inject yourself in there and intercept traffic.
631200	639680	However, OAuth, if you've ever worked with that, it's got well-documented APIs of how you make a REST API call to participate.
639680	649160	So there's a lot of differences and openings for abuse, which really gets us into protocol abuse.
649160	654440	So let's take a look at SAML and a phishing variant.
658560	662020	Jordan Potti, let me shout out the references.
662200	664140	This is 2019.
665160	667060	And it's still there in Okta.
667060	668640	It's not particular Okta.
668640	677240	They allow you to provide a custom identity provider that you have your own code to do the authentication part.
677240	680700	But they will handle the traffic and they'll redirect traffic.
680700	682440	So what do you see as a user?
682540	685220	As an Okta user, someone could configure it.
685220	688480	You receive an email, which looks like a normal email.
689160	691720	Okta domain, no games there.
692060	697780	Something about sign up, do this with your SSO credentials.
698500	710240	And what happens is once you click on that, you will get redirected or immediately reference what is a subdomain of Okta.com.
710240	713180	Now Jordan Potti, the researcher, just put his own name.
713180	715920	If we were an attacker, we would try to make it realistic.
716280	721120	That redirects to the attacker's site.
721580	723260	Now, let's pause.
723260	724840	I'm not saying this is the end of the world.
724840	729060	The user could notice this, but the attacker could also be crafty and rewrite URLs.
729440	731940	Underneath, we would see these different domains.
731940	733880	So there is a chance to catch this.
733880	735800	I'm not saying this is the end of the world.
736440	747180	But we're abusing trust because someone or some secure web gateway or filter may not actually detect subdomains of Okta.com.
747180	750140	They may just trust Okta.com.
750520	753140	And really, architecturally, this is what's happening.
753140	756380	The user, or the victim, gets this email that we just saw.
756380	761700	They click on it, and it gets redirected to the attacker's site, which can play man-in-the-middle.
761700	766600	Take MFA codes, submit them, do whatever it needs, and go back and forth.
766780	769340	And it's a new feature, relatively.
769560	771560	It's not really part of SAML.
772020	773980	And we may not even be aware of it.
774280	778440	But attacker could use this to obfuscate what they're doing.
778440	780600	And when we look at SAML, we don't have to understand this.
780600	784600	We just have to know that there's nine-ish pieces to the protocol.
784600	785680	So it's still pretty complicated.
785680	786820	Three parties.
788000	793400	And normally in a phish, we would impersonate one of the identity provider or service provider.
793420	799000	This particular one doesn't really take the place of the identity provider.
799000	806020	It uses a well-known feature that they sell to hook into the existing identity provider, Okta.
806020	807500	Okta provides this.
807500	808640	How nice.
808640	815720	So people trust Okta, and they may actually land on code controlled by the attacker.
815740	820060	And it gets worse because there are built-in features.
820060	826980	We know phishing as a service platforms, if you want to do phishing, self-phishing, or just for attack purposes.
826980	838260	Well, built into Okta are features that allow you to craft emails, email templates, register domains, enter people.
838260	846300	Of course, these would normally be SSO users, but an attacker could use it for targets and send them on its way.
846720	849640	So new features sort of allow abuse of that.
849640	855780	Now, that's just showing how SAML has sort of changed because vendors extend it.
856040	858700	They want to provide more value, stay in the picture.
858700	860760	Well, let's look at a different example.
860980	865820	So now we move to AWS.
865820	868180	Anyone from AWS?
869140	871020	Okay, that's good.
875240	878920	So AWS can do SSO.
879900	885180	And if you're first doing cloud on AWS, you're used to hard-coded API keys, right?
885180	890300	But let's look at AWS, or what they call Identity Center.
891220	897660	And there has been some work on different kinds of attacks, just so you see that.
897660	901680	From 21 and 20, Berger and Tufani to Reaper.
901820	903260	So I want to go over that.
903260	906500	So what, as a user, do you see when SSO is configured?
906500	909900	Very similar to SAML dashboards, okay?
909900	913340	You log in, right, as an SSO user.
913340	915040	You might go through MFA.
915040	917100	You hop into a dashboard.
917220	918080	It's my simple one.
918080	919760	You only have three apps.
920000	922020	So some of these are obvious.
922020	923760	Salesforce, right?
923760	924760	You're in the browser.
924760	927620	User clicks, logs in once, clicks away.
928580	930240	Atlassian, so on.
930820	934180	Now, here's where you have to do some thinking.
934540	937860	AWS itself is an app.
938520	943720	Now, if you've done this yourself, you know, you can just save it.
943720	945000	But everyone else, think about this.
945000	946420	What does that mean?
948000	951520	Well, is it all of AWS or different services?
951520	953580	Well, it turns out it's all of AWS.
954000	955600	That's just one big app.
957000	959580	Of course, there's IAM policies to control it.
959580	965340	I'm not saying it's the end of the world, but that's what's called an app, AWS's app.
966240	967080	All right.
968220	969620	Here's a question and quiz.
969620	971540	I'm not going to have you shout it out.
971540	973180	But think mentally.
975660	978080	There's also SSO.
978080	979960	This is AWS, by the way.
980280	984140	Said, hey, let's extend SSO to the CLI.
984900	990360	So your mental exercise right now for about five seconds is, what the fuck does that mean?
991640	992680	Seriously.
993880	995240	Let's step back from this.
995240	996960	You guys probably are way too technical.
997400	1001220	SSO has for like 20 years meant I go through a browser.
1001220	1005060	I log in once and there's a bunch of websites or web apps, right?
1005960	1008160	I've got this CLI.
1008160	1009980	Maybe it's on the same computer.
1010380	1012120	It doesn't run all the time.
1012120	1014080	You run it once and it ends.
1014100	1018280	So I'm going to log in to the browser with maybe AWS credentials.
1018440	1019560	What's it mean?
1019800	1021180	Think about it.
1021300	1024660	Next time I start up the CLI, it's logged in.
1026380	1029260	I mean, I guess you could technically do that.
1029260	1032140	But how does that know I'm doing that?
1032280	1034620	What if Joe comes by and starts my CLI?
1034620	1036860	What if my CLI is in the cloud?
1036880	1040320	How the hell does it know I've logged in through a browser?
1040500	1047480	So anyway, your exercise when you go home is, think about you came up with this great idea.
1047620	1049060	You're pitching management.
1049060	1052400	We should put our CLI under SSO.
1052400	1053880	Great, what does that mean?
1053880	1055960	Just tell me if you come up with a story.
1056760	1058300	All right, let's see what it means.
1058300	1059920	Here's AWS.
1061400	1062640	You click on that.
1062640	1063900	I'm in the browser.
1064700	1066500	I see information.
1067040	1068560	Anyone see anything wrong with this?
1068560	1069860	That's your second little quiz.
1069860	1070960	This is interactive.
1070960	1072500	Don't fall asleep on me.
1073060	1074800	All right, we'll just jump to it.
1074800	1075960	Mine are what?
1076980	1078860	Look at the different versions up there.
1078860	1081360	We're looking at macOS and Linux combined.
1082260	1084160	We're environment variables.
1084160	1086480	These are AWS credentials.
1086480	1087180	There's Windows.
1087180	1088480	There's PowerShell.
1088800	1095380	I always love it when we mix operating systems and programming language like it's Windows, like BAT, DOSBAT.
1095700	1099480	Sloppy thinking in one area, just warning signs.
1099580	1106340	But more importantly, this will strike any AWS people as problematic.
1106660	1108660	They're blurred out.
1108800	1112640	But these contain not just ID, but the secrets.
1112640	1125940	So for our AWS fans, nowhere in AWS Cloud, forget the SSO, can you look at a secret post-generation.
1126300	1130860	You get to it, generate a key, download it, copy it.
1130860	1133300	Because once you hide it, it's gone.
1133300	1136320	And that's not strange.
1136320	1140640	If I get access to your Windows system, I don't get your password.
1140640	1142000	I might get a hash.
1142000	1143460	Get your password.
1143460	1147080	We compartmentalize secrets.
1147320	1152420	So why, if you do SSO, do you get the secret?
1152420	1167320	Someone at AWS thought it was a good idea, when they implemented SSO, to break their own siloed basic fundamental technique of isolating secrets.
1167320	1178840	It means if I compromise the browser, I get an API key, which is far more valuable, because I can scale automatically everything I do.
1178840	1182740	I'm much more effective with a key than a browser login.
1183020	1184420	These are different.
1184420	1186080	I am your console log.
1186380	1187480	Okay.
1187640	1189140	It gets worse.
1189300	1189980	Where are we?
1189980	1191420	We have time for a demo.
1194280	1196460	I am going to.
1197160	1198160	All right.
1198160	1199420	I'm going to go through a demo of...
1200600	1207020	It's a little bit of how AWS recommends you do the CLI SSO thing.
1207020	1210060	It also shows how you would abuse that as an attacker.
1211500	1213420	And imagine you have an organization...
1214440	1218260	Well, Sam Brinkman Freed is in the news, so this is actually very timely.
1218260	1223840	Might have a bucket with some Bitcoin and some billions of dollars that you stole from someone.
1223840	1224500	Okay.
1226440	1228560	$250 million bond, by the way.
1228560	1230140	I have never heard of that.
1230140	1230860	Wow.
1231220	1231960	Okay.
1231960	1233000	Enough politics.
1233000	1234180	Let's move on.
1234940	1237500	So, that's...
1237500	1239920	Imagine SSO is pre-configured.
1240060	1241580	You have a dashboard.
1241580	1246180	But really, we're interested in what is...
1246880	1248220	What's going to happen...
1248220	1250080	This is really small, isn't it?
1250160	1260060	I'm going to talk about a few things that a CLI would do or an attacker script that's trying to abuse SSO would do in the AWS world.
1260160	1263820	First thing it does is...
1263820	1267420	So, first you have to know that AWS calls this OIDC.
1267420	1275320	So, they would have you believe they are doing SSO on top of OAuth using the official OIDC, which does work.
1275320	1276380	Google does that.
1276820	1284980	And first thing they do is get an application ID dynamically, which is part of OAuth, OIDC.
1284980	1286640	It's hardly ever used.
1287100	1291600	And it's very dangerous because the app ID is part of identity.
1291600	1298180	And if you're thinking forensics and incident handling, sort of figuring out what app is doing what activity, what access.
1298380	1301480	When you do it dynamically, it's on the fly.
1301480	1303340	You don't have to supply any secrets.
1303340	1304860	You can generate this.
1304860	1312520	It means an attacker can start to play by just getting an app ID that's randomly generated effectively.
1312880	1314720	So, then what happens?
1315440	1316520	Okay.
1317220	1320240	You suddenly get an ID, secret.
1320240	1325800	And now you start to do a device code, which is a different part of OAuth, not OIDC.
1326200	1327860	Warning, warning.
1328440	1330880	So, we're not actually doing OIDC.
1330880	1332920	We're doing a different part of OAuth.
1333420	1337060	And device code is known to be open to abuse.
1337060	1338920	It's a lot easier to phish people.
1338920	1344020	We'll have a better example when we come to another vendor, Microsoft, about the pitfalls of device code.
1344020	1348680	All we have to know is that someone stretched the truth.
1349060	1351920	And underneath, we're not doing OIDC on OAuth.
1351940	1353600	We're doing device code flow.
1354220	1354580	All right.
1354580	1355580	Let's continue.
1355840	1360640	So, what a real CLI would do, it's also what an attacker would do.
1362260	1363560	I'm going to sign out of this.
1363560	1364740	We're going to continue.
1365260	1369240	And let's move this along here because it suddenly went backwards.
1371240	1374960	Now, the attacker is in charge.
1374960	1376920	Whoever writes the CLI is in charge.
1377220	1379420	What happens after the device code?
1380280	1383700	I know you can't see this, but you can see it in the slides or afterwards.
1384120	1390760	What happens afterwards is that we continue with device code flow.
1390760	1392100	You get some codes.
1392100	1399780	And what the CLI or script is going to do is launch the user to go log in to SSO.
1400860	1401420	All right.
1401860	1405700	Presumably, it will feed them a code that they generated.
1405980	1408060	And the user, this is real AWS.
1408060	1409580	There's nothing funny there.
1410140	1412840	They'll go through MFA if that's part of it.
1413020	1418020	And what they'll see is just a simple dialogue, hey, approve this.
1418020	1420100	It's done, which is part of device code flow.
1420100	1422820	There's not a lot of information to the user.
1422820	1428600	What's just happened is they've approved a token for the CLI or the attacker script.
1428600	1433740	And they now get OAuth tokens, which essentially is their credential to go do what they want to do.
1433960	1438500	But it gets more confusing after that.
1438640	1446960	The CLI, and I want to point this out, is speaking OAuth at this stage, gets access tokens.
1446960	1450740	But really, AWS doesn't really understand that.
1451280	1456140	And what it does is it trades them in for API keys.
1456880	1462920	And then it can do stuff like access AWS within the environment.
1462920	1466160	So, who cares?
1466700	1468300	Here's the problem.
1468860	1470700	One, there are a lot of steps.
1470700	1478820	But if you notice, we started with saying we did one protocol, which was OIDC, which wasn't true.
1478820	1481200	We were doing more base OAuth.
1481460	1484020	But that's useless within AWS.
1484540	1486480	And we got to API keys.
1486480	1491600	So the problem is, what's happening underneath switches context.
1493240	1497120	We start thinking we're doing browser and SAML when you're in the browser.
1497120	1501520	But once that CLI is brought under the umbrella, we have to switch to a CLI.
1501520	1503480	And then we start speaking OAuth.
1503780	1508280	And then, that OAuth dance is this complicated.
1510480	1513040	And we end up with API keys.
1513040	1516840	Because that's really what you need for CLI to do anything with AWS.
1517160	1522720	So we switch context from browser SAML to CLI OAuth to CLI keys.
1522720	1526720	And that confusion complexity is ripe for abuse.
1526720	1527920	There's way too many interchanges.
1527920	1530940	You're translating tokens to different formats.
1530940	1532660	It's a bad idea.
1532660	1537840	Because basically, the attacker can be the script instead of the CLI.
1537840	1540780	And can start phishing easier with these short codes.
1540780	1545000	Convince users to log in and approve tokens.
1546860	1549600	So let's move to task number three.
1549600	1550440	I've got ten minutes.
1550440	1553380	So we're going to have to really get going here.
1553380	1558100	So even with all of this, we might think, look, we have different pieces.
1558220	1559500	Just contain them.
1559500	1560740	Focus on each one.
1560740	1561780	Piecemeal security.
1561780	1564760	It'll add up to total security.
1564760	1571320	The problem is, the complexity of the protocols allows chaining that is extremely hard to figure out.
1571540	1572680	And what do I mean by that?
1572680	1577660	Well, the best example that I found was maybe a year ago.
1577660	1580080	A Facebook account takeover attack.
1580240	1582120	It was using Google SSO.
1582120	1585240	Facebook configured as Google SSO.
1585720	1588720	This is the work of Samuda.
1588900	1593980	I think he makes six figures doing bug bounties on Facebook.
1593980	1595440	He's really good at it.
1596120	1598960	We start with this weird state.
1598960	1600600	Facebook.com.
1600600	1601960	You're a user there.
1601960	1605160	You can set up SSO with your Google account.
1605160	1606320	Nothing weird there.
1606320	1609100	It speaks OAuth, OIDC.
1609860	1615040	They have a sandbox so that you can prototype HTML stuff.
1615040	1615360	Who knows?
1615360	1616940	It's like Facebook groups or something.
1616940	1618280	Maybe the home page.
1618760	1622600	Because it's a sandbox, you as a user can upload anything there.
1622600	1624700	So you could, of course, inject code.
1624700	1625980	But it's for your own purpose.
1625980	1627280	So nothing weird there.
1627280	1628500	Salesforce does it.
1628500	1631000	It's not uncommon to have a sandbox.
1631000	1632080	Different domain.
1632380	1638060	The kicker is, what's the problem here?
1638060	1645300	Facebook connected in a trust relationship their main domain with this sandbox.
1645980	1647640	We obviously know the sandbox.
1647640	1651000	You can, as a user, create an account and upload code.
1651340	1656680	We know there's a relationship here where tokens are passed back and forth between an SSO and the system.
1656680	1667400	What ties it all together is that when you reset your password, the CAPTCHA is hosted on the sandbox domain.
1667400	1669260	We don't know why they did it.
1671120	1673180	Further, there's data leakage.
1673980	1679440	When you're resetting the password and you try to go to Facebook, that URL doesn't work.
1679440	1681600	It says, hey, no, you're in a reset stage.
1681600	1687160	But it passes it as a referrer and the referrer as a parameter.
1688640	1692920	So you can see that tying these together is non-obvious.
1692920	1697140	Because if you're a tester, you might be testing these individually and say, oh, there's no risk.
1697140	1700520	Once you chain it together, you can follow the path.
1700520	1710320	Maybe there's an authentication token that can be passed to this sandbox domain, which someone has put in some injectable code for cross-site scripting.
1710320	1712320	And that's exactly what submitted2did.
1712320	1726120	He created some code, enticed a user to hit that code, which puts them in this reset stage on the main domain, as well as forces a reset of the password.
1726120	1729960	The token gets passed back, data leakage to the sandbox.
1730100	1739840	He had to do some work on crossing domains, but ultimately he controlled the page, gets the OAuth code, and can do a full password reset.
1739860	1740960	Now look at this.
1740960	1744220	We could spend an hour and it would still be this complicated.
1744680	1746680	I've looked at this for a year.
1747000	1747980	I've talked to Samuda.
1747980	1752200	It's not well explained publicly because he probably wants to make more money.
1752840	1754140	Don't blame him.
1754140	1756280	Look at this.
1756400	1758840	This is non-obvious.
1758840	1765940	And it shows how a chained attack is really hard in this mixed protocol stage.
1765960	1766780	All right.
1767040	1770600	Let's talk about the final sort of example.
1770600	1773560	I think we're on ask number four.
1773860	1777040	We could just say, look, this is just authentication stuff.
1777040	1780260	Let's use our best practices like MFA, etc.
1780280	1787500	Well, MFA usually doesn't work with token systems because tokens are after you've gone through MFA and they're good.
1787500	1789180	You'll never go through a challenge.
1789920	1797220	And you still have the problem that everything's at risk once those tokens are stolen.
1798280	1804260	And probably the best example of that is what's well known is Microsoft's SSO.
1805200	1810200	A lot of the reason they used device code OAuth was to implement SSO.
1810200	1814340	And so I'm going to cruise through this.
1814340	1816840	I've actually shown this before.
1817480	1829340	But when you do Microsoft SSO, let's say you're a user, what you can do...
1829340	1833500	Okay, I'm going to jump to the architecture diagram.
1833500	1835300	Here's the problem.
1835500	1839080	You can do this complicated OAuth piece.
1839080	1844540	I can phish you as a Microsoft user pretending to be Microsoft Office 365.
1844620	1846000	You'll approve it, right?
1846000	1847540	I've got a good phish.
1847800	1854080	But because this was done for SSO purposes, they used OAuth for SSO in the browser.
1855040	1860660	They also implemented the OAuth, I would say, in a customized fashion.
1860660	1873460	I not only get access to your Office 365 assets, I can trade that token to get access to anything under the SSO umbrella, including Azure, as an example.
1874960	1880560	So at the time, this is outdated, there were some 20-some apps.
1880560	1881320	It's up there.
1881340	1883040	Secureworks does great work.
1883040	1883280	Dr.
1883280	1888460	Azure AD, he's here, did great work on sort of publicly showing this.
1888460	1890020	It's not just a phish.
1890020	1900100	Langvik, at a prior DEF CON, had a tool that brute-forced passwords, and then had access to all of the data here and data X-filled it.
1900100	1903440	Because you had an OAuth token, you could do it with API calls.
1903540	1904720	Here's the problem.
1904780	1918780	NetNet, to do SSO, Microsoft implemented a custom version of OAuth that exposed it to more phishing attacks, brute-force attacks, and APIs to get that X-fill.
1919360	1927160	If you just look at it from an SSO perspective, it's like, of course, if a user gets their credential compromised, of course you get access to all those apps.
1927860	1936080	But when you look at it from, no, you used OAuth, and you have other risk areas to being attacked, it's a bad, bad idea.
1936080	1942420	I can convince a user that I'm doing things just for Office 365 and get access to everything.
1943420	1949680	And so, in wrapping up, this won't stop.
1949780	1954260	We're going to continue to have problems here, mainly because of the protocol complexity.
1954600	1959440	SAML, OAuth, and then implementation differs.
1959940	1966060	We have diagrams that are complicated like this, and they're just hard to implement cleanly.
1966600	1969660	OAuth is worse than SAML.
1969660	1973580	It has different kinds of flows, like device code flow.
1974500	1980120	And all that leads to obfuscation, really hard to defend, really easy to find new attacks.
1980400	1988980	And all this mixing of models is a warning point, or at least the opportunity to attack in sort of crafty new ways.
1990100	1993100	So, I'm going to finish up.
1993100	1997500	If you need to reach me, email the service.
1997500	1999760	We don't know what the hell to call it anymore.
2000200	2001540	And Mastodon.
2002760	2004900	Please do reach out if you have further questions.
2004900	2005960	Thanks for coming.
2016150	2020030	Alright, if anyone has questions, Jake will be available out in the hall.
2020670	2021510	Thanks so much.
