start	end	text
0	3060	So, thanks everyone.
3380	4440	I'm John.
4440	10540	So today we are starting to share about how we steal the PRT cookie on macOS.
10920	13960	And use the PRT cookie persistent in Android.
14140	25940	That's a very funny fact is we realize Microsoft implementation on macOS for PRT cookie is more security implementation than on Windows.
26340	30560	So I will starting first and I will hand over to the next speaker.
31340	32320	I'm John.
32320	34860	I'm the director of research at Sidecraft.
35020	37700	And I have a blogger called HackerPenisJohn.
37720	41240	And I'm a researcher so of course I speak at several conferences.
41240	43020	But it's my first time in DEF CON.
43620	45940	So let's jump in on today's topic.
47640	50760	Because macOS has a lot of different type of service.
50760	52600	Maybe 100, 200.
53460	65080	And if you don't want our computer asking the password again and again, we need to ask our computer single sign-on to help us single sign-on to this service.
65080	71300	You can log in all of them using the Android ID account or we call, consumer site we call Microsoft account.
71920	74680	So you can use this account to do a single sign-on.
74680	75980	But how it work?
77240	82860	This is how it work when Windows generate SSL token for your browser.
83580	89260	I will explain about Windows part and later on Cosmo will introduce about the macOS part.
90480	95860	There's a two component, LSAS, which is handle the authentication process.
95860	99680	And there's inside LSAS, there's a plugin called CloudAT.
99700	104860	CloudAT will interact with the TPN, which is trust platform module.
105520	111640	The TPN is designed for make sure the private key and secret key never leave on this device.
112460	116420	And then there's a two element stored in the TPNs.
116740	120680	PRT, primary refresh token, represent the user identity.
120940	123800	And the session key is a device identity.
125800	130780	So if you have a PRT, we can exchange everything we want.
130780	135720	But by the design, the PRT will not directly single out the TPN.
135720	139700	We need to calculate the PRT to the PRT cookie.
139800	142760	The PRT cookie only has a 50 minutes lifetime.
143620	149420	And we can use the PRT cookie to token exchange to the refresh token and access token.
149420	151860	The max lifetime is 24 hours.
152160	156320	And then we can use the access token to log in the cloud service.
160180	164800	And here is how it go in detail process in the Windows system.
165040	175120	There's a browser like Edge, Chrome, Firefox, they can have a pass announce to the browser code which is building binary inside of Windows.
175960	183680	And the browser code will interact with Microsoft account token provider DLL and send a request to LSATS process.
183680	188120	LSATS process will calculate the PRT cookie sent to the browser.
188540	199020	And in this process, there's at least three way to abuse the process and get a PRT cookie.
199020	206080	First, the raw tools and the second is request a refresh token and the token broker.
206080	215220	They are leveraging a different stage and abuse until today they can still can get a PRT cookie from the Windows system.
217900	222080	The PRT cookie will contain some information very important for us.
222080	225320	Like a user identity and the link device information.
226280	234460	Which means if you have a PRT cookie from a device, usually we can get the MFA claim and the device claim.
234460	241640	Which means I'm from, I'm coming from, I'm user A, I'm coming from a trust device and I comply with some requirement.
241700	245900	This can help us pass some condition as a policy check.
245900	249100	So it's why stealing a PRT cookie is so valuable.
250900	253160	Here is our today's objective.
253500	260880	We will steal the PRT cookie from macOS because Windows have already researched it but macOS are not.
261540	266380	But a PRT cookie only has a short term lifetime so we want a long term persistence.
266980	273160	And comply some security requirement for the condition as a policy and as a critical resource.
273160	277120	And now I will hand it over to Kazuma to introduce macOS part.
281510	284350	Thanks John for the great overview.
284730	288550	And welcome everyone to the wonderful world of Apple.
288730	294430	Today in my session I'm going to talk about how do we steal the macOS PRT cookie.
295450	298350	Before we dive in let me introduce myself first.
298350	302210	My name is Kazuma, but feel free to just call me Kazuma.
302450	306850	And I'm a university student from Taiwan and also I'm a CD player.
307350	315770	For the past few years I've been leading a pretty active team called Beef Soup and we've managed to bring home quite a few trophies along the way.
316430	321410	Recently I'm just transitioning from the intern to researcher at Cycler Technology.
321950	328970	So I'm still learning a lot every day and I really appreciate the chance to be here and share research with all of you.
329690	331950	So let's dive in with one question.
332690	336190	Why do we research steal the macOS PRT cookies?
336970	344050	Today many organizations rely on Intune as their end-to-end solution for both Windows and macOS.
344370	352530	And with conditional access now extending to the macOS part, zero trust policy is no longer just a Windows story.
353170	354550	But here's the thing.
354550	358110	Most research and detection still focus on the Windows.
358230	362150	And macOS on the other hand remains largely unsolved.
362390	369630	And of course Dirk Jong and Olaf's research on macOS was a huge inspiration for us and gave us a solid starting point.
369670	377590	From there we decided to dive deeper into how macOS handles the PRT cookies and more importantly where the weaknesses are.
379390	387810	So if we want to steal the macOS PRT cookie, we must enroll our macOS device into Entral ID first.
388130	396510	And according to the Microsoft documentation we can see that it needs us to download and use this company portal app.
397710	400390	And the company portal app has two main parts.
400570	404950	On the left you can see it's interrelated part for device management.
405190	408610	But what we really care about here is on the right.
408610	412990	This is where even like the macOS apps and even Safari go through.
412990	415050	It's SSL extension for it.
415470	418310	You need to do the single sign thing to the Entral ID.
419110	425590	And it used to be called platform SSL but as we all know Microsoft loves to rename things so it's not a good name.
429240	435100	And now let me put out some components that are related to the SSL part in the company portal.
435760	444100	There are two main plugins and one is the SSL extension what we mentioned earlier and it used to be called platform SSL extension.
444820	449400	And the other one start with the autofill which we are not going to cover today.
449400	456740	Also we can see there is a framework under the SSL extension called the authentication broker macOS.
457160	463720	And this is the library most of performing more for the color validation checks.
464320	469920	And a framework on the macOS is kind of like DL on the Windows.
469920	475820	Both provide libraries but a framework on the macOS contains more bundle resources.
476360	479000	But it's pretty much the same concept though.
480040	484740	Also at the same time we can see there is browser core under the resources folder.
484740	488860	Which also appear earlier in the Windows SSL floor.
490500	499680	And earlier in John's session we can see that the browser core is playing the key role handling SSL requests from- initiated by the Google Chrome.
500360	505900	So as we saw that company portal also has this app is cross core.
505900	512740	We immediately suspect it might serve a similar purpose for handling SSL requests on the macOS as well.
514460	522760	So to help visualize the comparison I put together the macOS diagram from the Windows one.
522880	527980	We can see that Apple provide app SSL agent to do the SSL part.
528020	530360	Handle requests from different vendors.
530660	533120	But this diagram is a little simplifier.
533120	538640	Actually it has authentication framework to offer API and do the front end part.
538680	541700	And the app SSL agent is just doing the back end part.
541700	544040	But it's easier to understand that.
544860	547180	And macOS doesn't have LSS.
547180	554460	So the component responsible for computing the final PID cookie is the SSL extension under the company portal.
555640	564920	And any request passed into the company portal will go through its ID authentication framework to do the color validation checks.
566900	574800	And after we have the basic understanding of the macOS ecosystem, now we have let's summarize what we have found.
574960	579880	Totally we found three methods to fill the macOS PID cookie.
580640	584560	Next I will get through each of them and explain how they work.
585500	589220	The first one is head browser pass method.
589660	598020	The first one is pretty straight forward but Microsoft provide us this extension called Microsoft SSL Chrome extension.
598220	603660	And we can just initiate an SSL request and directly retrieve the output there.
603660	616800	So when we compromise a macOS device, we can just initiate a headless browser and install this extension and then we can initiate an SSL request and get the PID cookie right away.
617640	627500	And from the logs we can also confirm that a browser core is handling the SSL request, playing the key role in the SSL flow like the Windows one.
629620	637220	But this method does come with some limitations is that we need the victim to be logging into their desktop session.
637300	641000	Because headless browser doesn't mean there's no GUI dependencies.
641240	645440	It's more like a transparent browser running in the background.
645520	649680	So we need it to log in their session.
649740	657540	And also there's also another limitation is that this technique only works with official Chrome and Microsoft Edge.
658080	660840	And we'll know why when we get to the third method.
661980	671600	So to wrap up the first method, we found that this first method has specific dependencies, but of course we won't satisfy with just that.
672040	674880	Next we'll move to the second one.
676380	679000	The bypass browser core's parent process check.
679840	694700	So after some reverse engineering of the browser core, we found that whenever the browser core needs to check its coder, it will first call running application with process identifier, this function, and get the parent process info.
695280	706840	And then it will concatenate like it can get the PID from the info and concatenate coside HDV to execute this command and get bundle ID and team ID.
707540	714380	Also when it has this two value, it will concatenate it and hash it and check against internal wireless.
715040	725420	And here's the fun part is that until very last our research, we found that this running application function only work with direct process.
725420	731500	So later in our POC, you will see that we package the whole script into a direct process.
733780	740720	And here you might find some terms that I'm familiar with, which is team ID and the bundle ID.
741520	743300	And let me explain them quickly.
743300	749460	The team ID is the identifier included in the certificate issued by Apple to each developer.
749540	755840	So only the developer owns the certificate can sign the app with their own team ID.
756180	760620	But bundle ID on the other hand is just a string for identification.
760680	762840	It has no real security value.
762840	765320	So we can change it to whatever we want.
765940	770620	In short, attacker can affect the bundle ID but team ID doesn't.
771500	777620	Also we can found that there are some similar mechanism on the Windows 4.
777620	781720	It's called security identifier or somebody call it SID.
782260	791140	In this flow we can see that security identifier is more like a bundle ID is just for identification.
791160	794680	So we can also change it to whatever we want.
795140	802640	And this is interesting because that Microsoft never implement something like the team ID on their operating system.
802640	807080	So they check this security identifier is a bit pointless.
808940	816600	And also we found that this SSL flow involves a lot of components and that means a lot of coders.
816600	820000	And more coders means more coder validation checks.
820000	824940	So let me clear things up and focus on the most two important one.
824940	827780	The first one is the coder of the browser core.
828000	831260	And of course as the name suggests is the browser.
831260	835780	And in this case it can be the Google Chrome or Microsoft Edge.
836420	841040	And also it is the parent in the parent process check in our earlier talk.
842280	848420	And this is what we have mentioned about here in the diagram.
848420	852320	This is the part like the Google Chrome call into the browser core.
854020	856840	So let me read off the attack strategy.
856840	864640	First we create a parallel binary and second we have a fake call site and put it in the slash TMP directly.
864640	870180	And we have it use the binary ID for Google Chrome and the team ID.
870520	881020	Also we package the whole process into a process and that the browser core can retrieve the parent process info since the running application function.
881700	890000	And here's the real problem is that browser core runs this call site HDB function just without the absolute pass.
890000	898260	So we can use pass in the session to change the environment variable to slash TMP to let it run the fake one instead of the real one.
900200	902680	And here's the screen shot of our POC.
902840	909000	And this execution is clients and so running it, showing the video will be kind of funny.
909080	912560	But we will release this tool at the end of our talk.
914360	918540	And here's let me share some little funny story here.
919480	927720	At first, when we try to do the second method, we first do the pass to browser core.
927720	932180	And when we run it from the terminal, we found it running an error.
932480	934400	Caller is not allowed to invoke.
934400	936680	With an error call, it's minus 6,000.
937200	941620	So we decided to use the LDB to dynamic debug it.
942160	946120	And to our surprise, we just get the PID cookie right here.
946120	950000	So that led us to dig into what happened behind the scenes.
950960	957500	And from the logs, we can see that in the fail run, it can't retrieve the bundle ID and team ID.
958140	963320	And the component responsible for this function is app SSL agent.
963420	979640	So later, we started to analyze it and we found that the key point is that whenever app SSL agent need to retrieve the process, team ID and the bundle ID, it will check if it has CS value flake or the CS debug flake.
979920	988640	So this explain everything because earlier when we patched the browser core, the CS value flake became false.
988640	993160	And when we attach it with the LDB, the CS debug flake was true.
996600	1002940	Somebody will think that maybe LDB can be one of our method to get the PID cookie.
1002940	1005680	But actually, we think about that too.
1005680	1016280	But it need us to disable the system integrated protection and also we need to use touch ID or the password to pass the developer tools SS prompt.
1016820	1022420	So if we want to use it with LDB, we must need some extra privilege escalation.
1022580	1027340	So we want to try find some method just in the browser core to get the user privilege.
1029020	1030880	And here come the second caller.
1030880	1033660	It's called caller of the app SSL agent.
1033680	1035640	And in this case, it's browser core.
1035640	1039380	Also, it can be other vendors helper tool.
1040040	1051400	And whenever you are the caller to call app SSL agent, you need this CS value flake or the CS debug flake to that app SSL agent to retrieve your team ID or bundle ID.
1052250	1054700	And this is why we are talking right now.
1054700	1059640	Is the browser core calling to the app SSL agent part here.
1060800	1068800	So to wrap up the second method, this method can run without any dependency and also it can run in the user privilege.
1070420	1082020	So that little LDB twist story make us dig into the ID authentication framework and we found that this browser core method is just the tip of the iceberg.
1083740	1088220	Actually, we found that there are four paths for the SSL.
1088380	1090800	And that lead us to the third method.
1092400	1095540	Direct SSL invocation via the Apple's API.
1096720	1101100	And this SSL method, the first one is browser native message.
1101100	1103740	This is the same route of the browser core.
1103940	1107120	And the second one is passkey credential operation.
1107320	1112420	And this two method checks bundle ID and the team ID.
1112420	1114760	So there's no problem with that.
1114900	1119320	But the problem is there are two paths not check the team ID at all.
1119320	1122000	Is the general SSL extension request.
1122000	1129120	This is mainly used by the Microsoft apps like the PowerPoint, Outlook, Teams, Excel, something like that.
1129220	1136220	And there are also cookie SSL acquisition is for the third party apps like the Firefox or the Opera.
1137540	1144320	And like the cookie SSL one, it also, this bundle ID is content for three subsets.
1144380	1150740	It's like edge bundle IDs, third party browser bundle IDs, non-native browser bundle IDs.
1150740	1153600	Totally there are 39 bundle IDs.
1153720	1159920	And if it only checks the bundle IDs, what we need to do here is only pick anything we like.
1160760	1164040	And just like that, we can also get a PID cookie right here.
1164340	1169380	And this tool will also like the second one releasing at the end of our talk.
1170660	1178900	So to wrap up the third method, we can also see that it can run without any dependencies and also run in the user privilege.
1180920	1187820	So here in my session, I'm successfully make the PID cookie thief into a reality.
1187960	1189740	But here's some problem.
1191700	1195820	PID cookies only survives for about 15 minute-ish.
1195980	1199900	And how can we achieve persistence and keep the attack going?
1203140	1205840	So, how can we achieve persistence?
1206380	1210940	Before we started, allow me to first introduce myself.
1210940	1212240	My name is Echo.
1212240	1214860	I'm also a cloud security researcher at Sidecraft.
1214860	1222000	I have presented in multiple security conferences, such as RootCon and FIRST, and most of my research focus on cloud security.
1222760	1226140	So back to our subject, why do we need persistence?
1226320	1230820	As Kazuma said, PRT cookie is only valid for a few minutes.
1230820	1245000	However, the core reason of this question is that we don't have the TPM, the PRT, and the session key is stored in the hardware, which as an adversary, we cannot access it, even we have the administrative privilege.
1245000	1247100	So how do we achieve persistence?
1247100	1250560	A general solution is to abuse the device during scenarios.
1251100	1261740	A attacker, by registering a new device, they can have their own PRT and session key, so they can generate their own PRT cookie continuously whenever they need it.
1261740	1270400	However, by registering a new device, we cannot only achieve persistence, we could also bypass some conditional access policies.
1270540	1285900	However, registering a device has a requirement that it requires an access token without device ID, which means we cannot use the stolen PRT cookie from a device to register another device.
1286600	1290920	And as I just said, we also want to bypass conditional access policy.
1290920	1295520	And the most common conditional access policy is to require multi-factor authentication.
1296340	1302660	However, token issued through passwordless authentication also contain the MFA claim.
1302840	1315200	And sometimes conditional access has a stricter policy, such as it requires passwordless authentication or phishing-resistant authentication, such as Windows Holo for Business or FIDO.
1315200	1326860	So we also want to register our own Windows Holo for Business key or platform credential on macOS, which is basically the same thing for MSHOP, but just a different name on different OS systems.
1327420	1340420	And however, registering a new Windows Holo for Business key requires an access token that contains something called an NGC MFA claim, which stands for Next Generation Credential Multi-Factor Authentication.
1340420	1346200	And to have an access token with NGC MFA claim, you have to pass the MFA authentication again.
1346440	1352540	And then within the last 10 minutes, the token will be validated and you will be able to register a new Windows Holo for Business key.
1352540	1371740	Well, long story short, you can consider an NGC MFA claim as something as a fresh MFA status, which prevent adversary from stealing access token containing a cache MFA status to register a new Windows Holo for Business key.
1372980	1378700	And another common conditional access policy is required device to be marked as compliant.
1378780	1383860	And this could be achieved by PyTune that is released last year in Black Hat Europe.
1384520	1387920	And however, PyTune does not support macOS for now.
1389140	1392360	Okay, so here is our persistent flows.
1392360	1403380	First, we get a token without device ID, then we find a way to re-authenticate via multi-factor authentication, register a new device and make the device compliant, then register a new Windows Holo for Business key.
1403700	1408740	And the step three and step five can be done by Duracron's rule tool.
1408800	1411740	And the step for device compliance can be done by a U.S.
1411740	1413580	Trudeau's project, PyTune.
1413780	1427740	So the true difficulty of our persistent flow lies on the initial step, which we cannot use a stolen PRT cookie with a cache MFA status to get a token without device ID and a token with NGC MFA claim.
1427920	1435700	And this problem does not exist in the past, since Microsoft fixed them all.
1435780	1444300	And we can no longer use the single-sign-on token for device registration, and the MFA claim would not transfer to the PRT after registration.
1444660	1455220	And there are some other topics we are not mentioning here, but if you are interested in this topic, feel free to... I highly recommend you to read Duracron's blog post.
1456120	1460300	So how do we get a token without device ID?
1460460	1469900	Well, it is easy for a legitimate user to do it, since they just need to enter their ClearTask password on a non-single-sign-on device.
1470740	1480100	However, it is difficult, a challenge for our adversary, since even if we compromise the victim's device, we don't know their ClearTask password.
1481220	1486700	And so, a common technique to get a token without device ID is through phishing.
1487120	1491480	And the upside of phishing is that it does not require compromising a device.
1491860	1495120	It just needs to convince the user to enter their credential.
1495600	1499100	And the downside of it is that phishing is unreliable.
1499100	1509140	So since in our scenario, we would already compromise a device, we suggest another approach, which is abusing Kerbal's Simply Single Sign-On.
1509140	1512580	The upside of it is that it keeps the noise level low.
1512580	1516520	You don't need to unmodify with the authentication methods.
1516520	1520400	You just need a service ticket in exchange for an SS token.
1520460	1526020	And the downside of it is that only less than 25% of tenants have this setting enabled.
1526020	1530640	And it can only abuse on a Windows system that is hybrid joined .
1530640	1535060	So we start thinking that, could we just simply reset the victim's password?
1535100	1536940	And the downside of it is obvious.
1536940	1541740	It could use across all operating systems, regardless of its joint type.
1541740	1545880	And the downside of it is that resetting the password may trigger some alerts.
1546020	1552860	But the biggest problem here is that, could we reset the password without knowing the current one?
1553020	1564820	Well, if we look into the MySign service of Microsoft and try to log in with an SS token containing password and MFA claim, then we can reset the password directly without knowing the original one.
1564820	1569160	And in this case, we will call the API, API password reset.
1569160	1575100	However, if we log in with passwordless authentication, it only contains MFA claim.
1575100	1581460	So we have to enter the current password since we don't have the password claim in our SS token.
1581460	1585600	And in this case, it will call the API password change.
1585600	1589600	So of course, as adversary, we tend to abuse API password reset.
1589600	1597280	But it seems this abuse is limited to password authentication user, not passwordless authentication user.
1597280	1599320	But this is not true.
1600120	1607200	And we found out there is inconsistent logic between the front-end and back-end logic of the MySign service.
1607340	1611600	Actually, calling API password reset only requires the MFA claim.
1611600	1613680	The password claim is not required.
1613680	1620320	So we could also reset a password on passwordless authentication user without knowing their current password.
1621020	1631820	And something you need to notice is that we can always reset a password without considering the SSPR, self-service password reset is enabled or not.
1631820	1634660	So we can always reset user's password.
1635760	1642980	And our last approach is adding a passkey in Microsoft Authenticator or your mobile device.
1642980	1646080	And the upside of it, it keeps the noise level low.
1646080	1650420	You add a new authentication method without modifying the old one.
1650480	1657540	And since passkey is a passwordless authentication via FIDO, you also get a token with MFA claim.
1657540	1669360	The only downside of it is that it requires user interaction with your browser and your mobile device, since you need to store your passkey in your mobile device.
1670780	1680780	And however you may consider that adding a passkey is some sort of MFA bypass, well, it's not entirely correct.
1680780	1686100	But it's not easy to get an SS token with an MFA claim.
1686100	1688300	Is there something that I didn't mention?
1688300	1689860	Other requirements?
1689980	1695120	Let's talk about how do we find a way to re-authenticate via multi-factor authentication.
1695840	1703860	So, as we said, general solution, if we try to reset the password, we have to know the current password.
1703860	1708860	But we know in the last NASDAQ, Microsoft kind of like threw up.
1708860	1718320	But they did a better protection for Windows Hello for Business, as they require a fresh MFA to add a new Windows Hello for Business key.
1719500	1734880	However, if we just try to register a new MFA method or a single multi-factor authentication, such as a passkey or TLTP key, we don't need a fresh MFA token, which means we could use the stolen PRT to add a new one.
1734880	1745500	And that makes the NGC MFA protection useless, since a hacker can register their own MFA to bypass the NGC MFA protection.
1745940	1750340	So, the NGC MFA protection is a good idea.
1750340	1756320	However, its actual implement is flawed, just like this French fries in the door.
1757760	1765360	So, interesting thing is we report to Microsoft with a title, MFA bypass.
1765360	1775460	And the response is that they determine this is not a vulnerability and claim that MFA bypass is a hyperhole.
1775460	1782440	We agree with them, since we have to have a PRT cookie with a cache MFA status.
1782440	1785180	However, this is not an MFA bypass.
1785180	1791500	Actually, this is a next generation credential MFA bypass, which makes it sound even worse.
1792980	1802880	So, it seems to imply that Microsoft forbid us from using stolen device credential, which is our PRT cookie, to directly register a new device.
1802880	1812020	However, if we multiply the authentication info first and then register a new device, Microsoft seems to be okay with it.
1812020	1816700	So, we think it's unreasonable, but we accept the result.
1817100	1826860	However, Microsoft changed their mind in like July 30, and after we provide them with our slide with this picture on it.
1826860	1837980	So, they determined that they have to provide stronger authentication in the future, such as fresh MFA to better protect Microsoft's service.
1838780	1842840	And John will talk about the detail first, but I will rather show you the demo.
1845930	1847570	So, okay.
1848250	1850330	Here is our attachment.
1850330	1857070	We'll first request a PRT cookie directly to a single sign invocation by an Apple API.
1857310	1860810	And then, we'll abuse a device join scenario.
1860810	1869310	First, we'll reset the password, get a token with our device ID, register a fake new device, add MFA, and register a new Windows Hello for Business key.
1869570	1875910	And we skip the device compliance part to shorten the demo.
1876030	1881430	And if the device registration requires multi-factor authentication, you just need to switch the step.
1881530	1885770	Just add MFA before we register the fake device.
1885970	1888030	So, here is our demo.
1889670	1898720	First, we need to check our compliance policy or conditional access policy.
1898720	1906260	It requires our user to pass multi-factor authentication to access to our target resource.
1906260	1910900	Then, we are looking at the victim's device, which is a Mac OS system.
1912920	1916020	And we know our victim's name is called Adele.
1916280	1919540	And we request for a PRT cookie.
1919580	1925620	And then we pass the PRT cookie from Mac OS to our attacker's machine.
1925680	1928680	And we exchange for a MySignService token.
1929200	1935960	And since we don't know the victim's password, we need to reset it to have a new one.
1936840	1942940	Now, we try to call the API password reset to get a new password.
1947720	1950700	Now, the password is reset successfully.
1959310	1965510	Then, we can register our new device with our new password.
1965730	1967730	And that is successfully.
1967730	1973670	So, we try to log into Office 365 with our new password and our username.
1983200	1986140	And now we are blocked by the multi-factor authentication.
1986280	1992360	So, we try to the PRT cookie again and add a new multi-factor authentication.
1996600	2000200	And this time, we'll not done by direct API call.
2000200	2005180	We will open up the browser so that it's more easy to understand.
2006960	2007700	Okay.
2007700	2014200	We log into the MySignService website and try to add a new MFA.
2015340	2016620	Okay.
2019040	2024980	And in this process, we'll try to add our TOTP key into the key pass.
2026580	2029600	And Microsoft will ask us to verify it again.
2038520	2039180	Okay.
2039180	2046000	Now, we successfully add our new MFA without prompting down another authentication.
2046700	2052320	Now, we'll try to register our new Windows Hello for Business key.
2052940	2055480	But we need a token with NGC MFA claim.
2055480	2060020	So, we need to pass the MFA again and check our access token.
2060040	2063420	It actually contains NGC MFA claim.
2064700	2065300	Yeah.
2069220	2069860	Okay.
2069860	2077980	Now, we got our own Windows Hello for Business key and we try to log in on our new device with the Windows Hello for Business key.
2077980	2082640	Now, we successfully log into the Office 365 and bypass the multi-factor authentication.
2082640	2085620	And finally, we check our authentication method.
2086740	2092900	And we register a new Windows Hello for Business key on our demo machine, which does not physically exist.
2093460	2096980	And this is all for our demo.
2099340	2100340	Okay.
2100560	2104020	And if you like it, feel free to give us some applause.
2104020	2104460	Thank you.
2111110	2112030	Okay.
2112030	2113990	Thanks for the demonstration.
2114010	2115970	So, let me review what I just saw.
2115970	2124310	In this demonstration, actually we got a PRT and a very strong MFA just like Microsoft say, they love the Windows Hello for Business.
2124350	2126130	So, you have a strong MFA.
2126130	2130870	And all this element is coming from the fake device.
2132290	2141250	So, we are not just accessing the cloud resource, but also if we will have a PRT, we can let them run between the NHID joint device.
2141250	2149390	This is a talk in this year in Troopers has mentioned about how to let them run movement in NHID joint device .
2149390	2158750	By default setting, global administrator and device owner are local admin in NHID joint device.
2158750	2166670	So, you can use the PRT, exchange it to the P2P certificate and the login in NHID joint device.
2169780	2174760	You just saw a demo and you might think if you are familiar with the condition as a policy .
2174800	2182380	You might think, hey, why require the MFA for joint device and I require MFA for update their security information.
2182720	2188440	Actually it's not enough and you might encounter some deadlock problem in this scenario.
2188440	2196080	I just share with my friend this tech master and he just apply this condition as policy and he encounter some problem.
2197220	2203400	If you have new employee on boarding, you just give them your password and the account name.
2203400	2204700	They just log in.
2204700	2206440	The first time log in, they don't have MFA.
2206440	2211960	NHID asking, hey, you need the MFA, but you have to pass MFA first.
2212140	2213660	So, they encounter some problem.
2213660	2216320	The new employee cannot add their own MFA.
2216440	2221420	So, only way to escape out is on the documentation for the Microsoft.
2221420	2224800	You need to log in with the tab for the initial login.
2224800	2228080	This is the only way to escape out in this deadlock situation.
2230340	2234680	If you apply this condition as policy, actually it's not enough.
2234780	2243060	Just in case you didn't film the video, yeah, so I prepare a diagram for the easy to understand whole attack pass.
2243060	2246780	We assume we have a compromise in tune or window hollow for business device.
2246780	2249660	We extract the PRT cookie with MFA.
2250520	2253700	And then we have a two thing need to do.
2253700	2255520	First, add a new MFA.
2255640	2262420	The conditional access require us need to pass MFA first and add in the new MFA.
2262680	2267440	But we already have MFA client, so we can easily satisfy this policy check.
2267660	2272040	And on the reset password, we just want to add on the fake device.
2272080	2277600	So, we can change the user password without we know, we don't know the current password.
2278260	2282020	It's a UI inconsistency in front end and back end.
2283880	2289000	We are easy to get the new MFA and control the user password.
2289000	2291340	And now we can persistence in Android ID.
2291340	2292880	We can reduce a new device.
2292880	2297620	And then you need, we're trying to reduce device user require MFA.
2297620	2302700	But we already add our own MFA, so we can easily satisfy this policy check too.
2303720	2307920	And then we can upgrade our fake device to windows hollow for business.
2307920	2310980	We can easily authenticate MFA in five minutes.
2311220	2313600	And then persistence in Android ID.
2315120	2317540	How Microsoft response us our finding?
2317540	2318860	This is very interesting.
2319060	2323220	Because Microsoft for the Mac OS they already fix.
2323220	2325160	But for the windows side, they never fix this.
2325160	2327840	It still can get the PRT cookie on windows.
2327840	2330360	But now it's not on the Mac OS.
2331060	2338740	And for the Android ID persistence method, the first time the response, you have to compromise someone windows.
2338740	2340500	Maybe very hard, right?
2341140	2348380	So, just one week ago, they know we are speaking at DEF CON, they decide to fix it.
2348380	2352580	Maybe one month or one week later, they will fix it.
2353340	2357300	They also have a recommendation for the make a cookie PRT safe.
2357300	2358480	Just update.
2358640	2364060	If you cannot update yet, you can just monitor following criteria, like a call sign.
2364060	2367160	It should be always running on the user bin folder.
2367480	2369500	And monitor the header browser.
2369660	2379400	If there is a binary, has a bundle ID we mentioned today, but there is a binary don't have enough, just trigger the.
2379400	2386280	Also, even Microsoft implement this update, but you should check your Intune's policy.
2386280	2390620	Because if you want some bundle ID, you still encounter some problem.
2390980	2396080	You still possibly get the PRT cookie safe on your Mac OS system.
2399260	2400800	And here is a summary.
2400880	2404980	We found that the PRT cookie safe on Mac OS is now a reality.
2405180	2412360	And we've also noticed other vendors, not just Microsoft, other vendors have implemented the SSO extension on Mac OS.
2412360	2414900	We think there might be a similar problem.
2415920	2422620	You are a Mac OS developer, you should choose a team ID, not a bundle ID to verify the binary.
2423660	2430460	And before Microsoft already implement the patch, just pray for your end point never being compromised.
2430920	2435420	And here is some mitigation for the persistent method.
2435940	2439960	You can create a weak criteria from the condition as a policy.
2439960	2448960	Like the IP location, user agent, just make the attacker very hard to add a new device or add a new MFA.
2449020	2453600	And then monitor the new joint device and then add a new MFA.
2453600	2459240	If you have an employee add a new device, you can trigger alert, but it's kind of annoying.
2459420	2459860	Yeah.
2460760	2461720	And thanks.
2461720	2463200	And here is our cool release.
2463200	2466020	You can check on this for Mac OS cookie safe.
2466020	2467020	And thank you.
