start	end	text
0	6600	All right, welcome everyone to turning Microsoft's login page into our phishing infrastructure.
6720	12240	And most importantly, welcome to our special guests from Microsoft, right?
12240	16380	Welcome people from Microsoft, because you guys really have to be my biggest fans.
16380	27340	See, when my talk title and description got published by DEF CON, I finally quickly received an email from Microsoft Security Response Center asking me for a preview of my slides.
27340	37240	However, the thing is, before I actually published this presentation to DEF CON, I already made the decision that I would not be sharing anything with Microsoft.
37240	40720	And you'd be thinking, okay, but what about responsible disclosure then?
40720	61220	And I agree actually, but the thing is, if I would have reported this to Microsoft without this talk being a thing, I know for certain that they would just have returned there or provide me their classic response saying there's not a vulnerability, it does not meet the bar to do immediate servicing,
61220	61760	right?
61760	79800	So to save some time for the both of us, I responded to them and said, look, everything I will be sharing in my talk will not meet any bar for immediate servicing, so let's save some time for both of us and you don't need to worry about it.
79800	81560	But they weren't really happy with that.
81560	90640	They still encouraged me to submit my findings to the MSRC for review, even if they don't meet servicing requirements and bounty eligibility, right?
90640	94260	And when that didn't work, they were very persistent.
94260	103620	They sent me an invitation for a conversation with some free food and drinks, hoping that maybe that would get me to share my talk.
103620	107000	But once again, I said, okay, thank you for the invitation.
107000	108480	I have something else to do.
108480	113360	So I thought that would have been the end of that, but they were actually really, really persistent.
113380	126560	They upped their level a little bit and they invited me to the MSRC party with the Skyfall Panoramic Bar, which has this amazing view over Las Vegas with some great food, some swag as well.
127500	136540	So, yeah, this was a little bit too nice to turn down, so I went there, freeloading a little bit without sharing any of my talk.
137940	149020	I am very happy that I will now be able to share my slides with Microsoft and with the rest of DEF CON also watching, but I suppose you guys will do nothing malicious with that, right?
149100	152800	So before we start, let's do a quick introduction about myself.
152800	156120	I am Keanu Ness, also known as RedbyteOnline.
156120	160360	I lead a small offensive security team at a Belgian company called Spotted.
160360	171580	I'm also the author of Graspi, an offensive security toolkit used for initial access and post-compromise enumeration of EnterID and Microsoft 365 applications.
171580	177620	And I'm also the instructor for several Azure Red teaming trainings at Alta Security.
177680	178820	But enough about me.
178820	183660	Let's actually get into different stuff because I have a lot of new techniques I want to share with you guys.
184900	187140	I'll go over a quick introduction.
187140	193800	I'll keep this very brief because I want to use the majority of my time to actually go over the new techniques I want to share with you guys.
193900	208220	So if you have done any type of assessments requiring you to send out realistic phishing emails without any whitelisting in place, you'll probably relate to some of these challenges that you could encounter, right?
208220	215000	You have email security solutions that could block your suspicious links in there.
215000	223020	There is user awareness where they focus quite a lot on hoovering over the link and seeing if the domain name is legitimate, right?
223020	228860	Nothing we can't really get past to with a good pretext, of course.
228860	231440	But still something we need to take into consideration.
232100	236640	It takes quite a lot of time to get a benign domain categorization, of course.
236700	242040	And constantly recycling your domains when they are burned can be a little bit tedious, right?
242040	245540	So what alternatives do we actually have for that?
245580	264240	So we have, if we don't want to use a malicious domain name, we can, for example, use consent grant attacks where we will be using the legitimate Microsoft domain and be phishing a user for consent to their permissions over their emails, their files, whatever we want without phishing their passwords,
264240	264680	right?
264680	270600	However, most of the interesting permissions require admin approval, especially in hardened tenants.
270600	273640	You would see that admin approval would be required for everything.
273640	281100	There's also verified publish restrictions, which is not that big deal to get around to, but still it's there.
281100	283260	Device code phishing is still very useful.
283260	292960	We still use this very effectively quite a lot during our assessments, but it could be blocked in hardened tenants as well, with conditional access policies.
292960	298500	And then adversary in the middle is obviously very useful to make your website look very convincing.
298500	303560	You are basically interacting with a real website, but on a malicious domain name.
303560	305900	So that's also a drawback on that.
305900	308720	You're basically in the same situation as previously.
308900	314160	If your domain gets burned, you will need to rotate that and so forth, right?
314160	317380	So I was interested in this instead.
317380	325860	Can we use the TrustedLogin.MicrosoftOnline.com, so the login domain for use for all kinds of authentication purposes by Microsoft?
325860	328340	Can we use this domain for phishing purposes?
328420	339540	And I was looking into this, and I found that this was actually a little bit too easy, so I quickly changed that into, in how many ways can we abuse this Microsoft login page for phishing purposes, right?
339540	349620	And I will show you a couple of them, starting with some basic examples where you will still have some ways to actually see that something phishy is going on if you are a little bit tech-savvy.
349620	354620	At the end, we will be showing some very advanced techniques that completely destroy the login page.
354620	362320	We will be extracting clear text credentials and bypassing multi-factor authentication, all while staying on this legitimate login domain, right?
362320	365080	So without losing too much time, let's get into that.
365460	374020	Before we do that, let me give you some honorable mentions of things that I also found, but I didn't really have too much time to talk about that.
374300	377420	In general, these are some open redirects.
377420	378580	I will share a couple of them.
378580	383120	These are still working, as all of the other things that are still working, right?
383160	386380	First, you can use Federation as an open redirect.
386380	403180	So what you can do is you can configure a domain in your attacker tenant, set the sign-in URL for Federation to your phishing page, and then you can craft a URL that looks something like this, login.microsoftonline.com, and then with some parameters with the login hints of the domain that you set up for Federation.
403240	417040	And if you would forward that link to your victim, it would instantly redirect to that phishing domain where you can host something like E-Village and XO, whatever you want, to craft your credentials, right?
417040	423680	So basic open redirects, which is basically known of how Federation works.
423680	426340	So this is probably something that they can't really patch.
426340	446100	Additionally, another thing that you can do is you can create an app registration in your Enter ID tenant with a redirect URL to your phishing page, and then create a URL with the prompt equals non-parameter, and that would basically bypass the consent prompt being shown or any type of prompt being shown,
446100	451080	so no login page or whatever, and it would instantly redirect to your redirect URL, right?
451140	457460	Even if with the most restrictive consent settings, it would still instantly redirect.
457580	465200	And then a slight alternative to that, what you can do is create, once again, an app registration with your redirect URL to your phishing page.
465380	480000	However, here we will craft a URL with an invalid scope parameter, and what happens over here is the user will be redirected, but only after legitimate authentication, so they will still see a little bit of the login page.
480000	489540	They will stay there, sign in with their legitimate credentials, whatever they would need, and after they sign in, usually the consent prompt would be shown.
489540	495060	However, because we are using an invalid scope that Microsoft doesn't understand, it will throw an error.
495060	499200	It will not show an error, but it will instantly redirect to the redirect URL, right?
499220	501960	Even with the most restrictive user consent settings.
501960	505740	So a couple of open redirects, which I shared.
505740	509360	These three I shared with Microsoft to give them something.
509360	514860	I have not received a response about that, but I'm fairly certain that this is something they can fix.
515380	518100	I will show you a quick demo of the last one.
518840	522360	So at the left, you have the attacker point of view.
522360	524840	At the right, you have the user point of view.
524840	529780	So this is the URL we would send to the user, for example, that we want to phish.
529840	531020	So it's an invalid scope.
531020	532560	That's the most important one.
532600	535880	So we copy that one, paste that into the browser.
539600	543200	All right, and you would see the other ones would instantly redirect to your phishing page.
543200	546620	This one will stay on the Microsoft login website for a bit.
546620	551340	It would ask you to enter your password, whatever, do multi-factor authentication if that is required.
551340	566320	And as soon as that happens, you would see it would redirect to our malicious website, where we can, for example, say, okay, because you're accessing sensitive information, you are required to sign in once again, or you can say your password expired or whatever.
566800	571340	But something like this would be very useful for certain pretexts, right?
575260	585220	All right, and at the left, you can see we have Evo-GNX running, which is capturing the credentials, bypassing multi-factor authentication, and extracting the session cookies of the user.
585300	589140	All right, so this is how that would look like.
590380	598960	All right, so open redirects are nice, but I didn't want to talk too much about them, because, to be honest, they are not that impressive, of course.
598960	601940	Can be useful in certain use cases if you want to use that, right?
601940	604040	But let's look at some other approaches.
604540	608660	And for the first one, I will be using self-service sign-up.
608660	611000	So what is self-service sign-up?
611000	619960	So self-service sign-up basically allows external users to sign in to applications in your tenant with their own credentials.
619960	630320	So they will basically, when you set that up, be allowed to register a guest account in your Entra ID tenant without being invited already or anything, right?
630320	632560	This can be useful in certain use cases.
632560	638280	Obviously, by default, that is disabled, but you can enable that if you want that in your Entra ID tenants.
639480	646200	And the interesting thing about this is that you can collect custom attributes during the sign-up flow, right?
646200	653620	And you can collect certain types of default attributes, such as a job title, display name, anything you want.
653620	663260	However, nothing stops you of creating a custom attribute called password, for example, and an additional integer, for example, called MFA code, right?
663260	674200	So these attributes would be collected by Microsoft during the sign-in page, and the user would be requested to fill in whatever they want for these values, right?
674820	681480	So, and then you'll probably think, okay, but how do we validate whether the password is actually correct or not, right?
681480	684360	Because a user can fill in anything over there.
684360	686940	So with an API connector, we can actually do that.
686940	695540	What the API connector will allow us to do is it will allow us to do input validation of all of the inputs that is provided in these custom attributes, right?
695540	700480	So with this, we will be able to validate the password, return an error message if it's incorrect.
700480	702520	So let's look at how the attack would work.
702520	704040	We send a link to the user.
704040	705180	They would click on that.
705180	711940	They would go to the login.microsoftonline.com domain, obviously, as all of the examples that I will be showing.
712520	717460	And after that, they will need to sign in with their account of their home tenant, right?
717460	719400	They will need to accept a tenant invite.
719400	726060	And after that, they will be asked to fill in the attributes that we want, so the password and whatever, right?
726360	730160	They will fill that in on enter ID, which will forward that to our API connector.
730160	732660	The user does not directly interact with our domain, right?
732660	734740	So everything goes to enter ID.
735060	736460	So the attributes are collected.
736460	739280	They are forwarded in cleartext to us, right?
739280	744540	And at that point in time, we can actually validate that against enter ID if it's correct or not.
744540	748500	If it's incorrect, we can tell the user that they need to use a different password.
748500	752360	Otherwise, we have the credentials of the user and we compromise their account, right?
752360	756540	We basically continue this until they provide valid credentials.
757080	759980	All right, so this is what the URL would actually look like.
759980	769140	So login.microsoftonline.com, client ID of the application that we set up in our attacker tenant for self-service sign-up, and then a login hint of the...
769140	771460	This is our victim user, right?
771460	775860	So an email address of the victim user that would allow it to be pre-populated on the sign-in page.
775860	778980	So an additional step that the user does not need to do themselves.
779080	784180	And we use prompt create to force the registration page to show up.
784180	785780	Otherwise, they would need to click on something.
785780	789440	So the more things we can automate for the user, the better, right?
789440	795020	So prompt create plus the login hints will force the sign-in page with the pre-filled email address to be showing up.
795400	798320	User signs in with their credentials, accept the tenant invite.
798660	805200	This is not a consent prompt, so even if the most restrictive consent settings are configured, it would not really help there.
805200	812980	And at that point in time, the custom attributes collection page would be shown where we capture the credentials and validate that with our API connector, right?
812980	815920	So let's look at that with a demo.
816220	818320	So you know how it looks like.
818320	820560	At left, you have the attacker point of view.
820560	824440	At the right, you have the victim user point of view.
824460	826940	So we paste that URL that I shared previously.
827320	829320	This is what they would end up on.
829320	832060	So they sign in with their valid credentials.
834020	836460	They accept the tenant invite.
838180	842840	And then this is what the attribute collection flow would be looking like.
842840	847760	But the interesting thing is, this is all on the legitimate login.microsoft.com online domain, right?
847760	850700	So it has some trustworthiness to it.
850700	858660	You can see over here, if we enter an incorrect password, we can return custom error messages saying that the password is incorrect because we can validate that.
858660	865420	So provide a correct password with invalid MFA codes, we can return a different error message.
865940	875640	And if the user provides a correct MFA code and a correct password, you will see that we can return a custom error message.
875840	881540	So we can also redirect to users anywhere we want at this point in time, if we wanted to.
881540	883700	But we have everything we need right now.
883700	887100	We have access tokens, refresh tokens, session cookies.
887100	890180	The complete account of the user is now compromised.
890520	892680	All right.
896000	899480	If you find that impressive already, wait for the next ones.
899480	901740	So I have some backup slides.
902440	908360	So the next one, I will be looking at abusing custom company branding, right?
908360	915500	So custom company branding, this basically allows us to customize the look and feel of the Microsoft Entra ID sign-in page, right?
915500	917260	So what could go wrong?
917260	918680	Quite a lot we will see.
918680	926900	This is from the documentation from Microsoft, all of the things that, or a couple of the things that we would be able to customize.
926900	935120	This is used quite a lot by organizations, mostly to load a custom background for their sign-in page, for their organization.
935200	941800	However, I've noticed that you can actually customize quite a lot more than what the documentation describes.
942020	942360	All right.
942360	949940	And one of the interesting things that you can do with custom company branding is inserting a custom CSS file, right?
949940	954560	You cannot customize, luckily, any HTML or JavaScript, right?
954560	955800	That would be really bad.
955800	963460	However, you can customize a little bit what the page or what it would look like with CSS, right?
964060	969400	However, not all CSS is obviously allowed because the nasty CSS is filtered out.
969400	973660	I was looking into, okay, how does it define what is allowed and what isn't?
973660	987620	And basically, what happens is, when I was looking into that, it will always, if you load the login page, it will always return the completely unfiltered CSS file to the browser, and then it will filter the CSS with client-side JavaScript.
987620	992920	That basically means that we can actually see in the source code everything that it is filtering for.
992920	1004220	So for future reference, if you wanted to know, these are all the properties, CSS, add rules, functions, whatever that you are not allowed to utilize.
1004260	1007860	So this was very useful to look into what we could do.
1007920	1011980	So I was playing with this, looking with this, okay, what can I do with that?
1011980	1015440	I found that you could target the sign-in buttons, for example.
1015540	1016940	So what did we do?
1016940	1020780	I first hide the sign-in buttons, and they are gone right now.
1020780	1022680	So you're thinking, okay, what can we do with that?
1022680	1032660	Well, if we look at some of the other options in the custom company branding, we are basically also allowed to customize the self-service password reset, right?
1032660	1044580	And what this would allow us to do is we can basically show a custom link that would be redirecting to whatever domain that we want with any value that we want.
1044580	1046360	So we can do something like this.
1046360	1050960	The next button that we previously just hit, we can replace that with something like that.
1050960	1053460	Obviously, right now, no one would click on that.
1053460	1055940	No one would be too stupid to click on that.
1055940	1063500	However, if we customize that a little bit more with a little bit CSS, we can make that link look something like that.
1063860	1067460	So now it looks quite a little like this next button, right?
1067460	1075980	And even if you hover over it, it has some animation that it changes the background a little bit, but you say, okay, now it looks great, but it's at the wrong location, right?
1075980	1086340	And you're correct, but we can move that a little bit with some relative positioning, and now it's exactly to the pixel correct where the real next button would be, right?
1086340	1093120	So we can do this for the next button on the account fill-in page or on the next page to collect the password as well.
1093120	1096560	We can basically hijack these buttons, right?
1096700	1101340	So how would we abuse this, or what URL would we be using for that?
1101340	1110920	Once again, login.max.online.com, and we will just add our tenant ID in there, and that is basically enough to load our custom CSS from our tenant, right?
1110920	1121720	And these tenant IDs, these are GUIDs, so users would never actually know whether that's someone else's tenant, maybe if you're really tech-savvy, but no one is going to be looking at that, right?
1121900	1123540	And then what else do we have?
1123540	1124280	Prompt login.
1124280	1132100	This is basically to force Microsoft to show the sign-on page, even if you're already signed in with some cookies in your browser, right?
1132100	1134960	So prompt login forces to show the sign-on page.
1135320	1145080	User enters their email address on the domain, clicks on the next button, and then they are redirected to our malicious domain where we can capture their credentials, for example, with others in the middle, right?
1146560	1150100	All right, so what does this look like for the user?
1150100	1152680	So they are on login.microsoftonline.com.
1152680	1155000	For example, we are phishing the CEO of Microsoft.
1155000	1156300	They provide their email address.
1156300	1160080	They click on the next button, and they see the password fill-in page, right?
1160080	1162640	But this is on a different domain, but it's so seamless.
1162640	1163540	The user doesn't see it.
1163540	1169700	They click on the button, and they see the next page that they are expecting, but on a different domain, right?
1169700	1171400	So it's very, very powerful.
1171400	1173520	So let's look at an example of that.
1174040	1176580	So we go to that domain.
1179080	1182300	User fills in their email address, clicks.
1182300	1186000	You can see, if you hover over the button, there is this nice animation.
1186000	1186920	We click on that.
1186920	1190860	At the left, you can see EvilGNX loading already, loading the login page.
1190860	1192840	We will pre-fill the email address of the user.
1192840	1196440	We can load custom tenant branding of the user, whatever we want.
1196440	1202340	User enters their password, and if they sign in, they would get an MFA prompt or whatever.
1202340	1208400	Obviously, we don't know the password of the CEO of Microsoft, of course, but you can see where this is going, right?
1208400	1210020	This is just for a demonstration.
1211940	1212900	All right.
1213800	1218360	Let's look at something else we can do with password authentication.
1218980	1230640	So password authentication is one of the methods that you can use to allow your users to sign in with their on-premise credentials to any Entra.ID integrated application, right?
1230640	1248300	So the way that this works in the background is Entra.ID will literally forward the password in clear text to your on-prem PTA agents, which will decrypt the credentials and validate them against a domain controller, right?
1248300	1252540	So this is fairly abused quite a lot already.
1252540	1262960	It's a well-known post-compromise persistence attack technique where you backdoor the PTA agents and you basically wait for authentication attempts and you extract clear text credentials from that, right?
1262960	1265560	So this is usually done after full domain compromise.
1265560	1270740	You compromise someone's on-prem environment and then you install this backdoor, right?
1270740	1273360	Which requires quite a lot of high privileges.
1273660	1276040	So how does the authentication flow work?
1276040	1278660	So user goes through any application.
1278660	1281160	It will be redirected to Entra.ID, right?
1281160	1283500	Entra.ID will ask for the credentials.
1283500	1292100	So the credentials are added on Entra.ID's login page, which will then be forwarded to your on-prem PTA agent for validation.
1292120	1299140	At this point in time, your passwords are in clear text on this agent and they will validate that against the on-premise domain controller.
1299300	1307100	And what is also important to know, the PTA agent here is in charge of whether they want to accept or decline the authentication or not, right?
1307380	1309720	So that is how it works.
1309720	1314660	So as I said, it's a known technique to use this for persistent purposes.
1314660	1317920	However, what my idea was, can we use that for initial access?
1317920	1323080	Can we use password authentication set up in our attacker tenant, right?
1324000	1327560	And still clear text credentials of users and other tenants, right?
1327560	1329180	So this was my plan.
1329180	1332000	I set up password authentication in our tenant that I control.
1332000	1333140	So I can do that.
1333140	1337340	I backed over the PTA agents on-premise, which is running on a server that I control.
1337340	1338320	So I can do that as well.
1338320	1340280	So this is all fairly straightforward.
1340280	1350460	But then the tricky part becomes, we need to trick users from other tenants to sign into our domain, to our Entra ID tenant, right?
1350460	1353340	Otherwise, we wouldn't be able to get their credentials.
1353460	1357340	So this is one is easier said than done, but let's look at that in a little bit.
1357680	1359260	So let's first look at the first step.
1359260	1360700	I will go over this briefly.
1360700	1364200	It's very boring, but it's all documents from Microsoft, how we can set that up.
1364200	1366660	So we set up an Entra ID domain.
1366660	1369500	We set up Entra Connect Sync.
1369500	1373400	We set up password authentication over there, go through all the steps that are needed.
1373400	1377200	And eventually we see password authentication is enabled for our tenants, right?
1377200	1381080	Then second thing we need to do is we need to backdoor that password authentication agent.
1381080	1385580	Right here, we will be using PTA spy from AAD internals by Dr.
1385580	1386080	Azure AD.
1386080	1389280	But there are a lot of tools that do the same thing, basically.
1390460	1392540	But PTA spy is very easy to install.
1392540	1397300	We just use install AAD int PTA spy on our PTA agents.
1397300	1405760	And then after that, when we test that by signing into some accounts from our tenants, we will be able to see the clear text credentials, right?
1406100	1409200	So now let's look at the other part.
1409200	1413140	How can we force users from other tenants to sign into our tenants?
1413140	1422000	There are a couple of constraints to that of whether we are restricted to make it still collect the credentials with PTA, right?
1422000	1425120	So we can only target users in our own tenants.
1425120	1432860	Otherwise they wouldn't be able to sign into our tenant and then definitely it would not be able to use PTA from our tenant, right?
1433160	1436820	Password authentication also only works with hybrid users.
1436820	1438600	So cloud-only users will not work.
1438600	1441480	For example, guest accounts are cloud-only users.
1441480	1444000	So these can't be synced to on-prem.
1444000	1447000	So something like that would not be possible, right?
1447000	1448740	So what other options do we have?
1449880	1459740	I was looking into this setting, email as alternate login ID, because it is a very underestimated feature that can be fairly useful in some cases.
1459740	1471880	Basically what this allows you to do, if you enable that in your tenant, you can basically allow users in your tenant to sign in with any email address that is defined in their proxy address attributes.
1472000	1480340	And this proxy address attributes can, in certain cases, have email addresses from unverified domains that you do not own.
1480340	1484420	So I was looking into that for a cloud-only user just to test this really quickly.
1484500	1490440	If you set, you cannot control the proxy address directly, but you can, for example, update the email attributes.
1490440	1494840	And for cloud-only users, this gets propagated automatically to the proxy address fields.
1494840	1497920	So you can see over here, we set that to non-synced at microsoft.com.
1497920	1501060	We don't own the microsoft.com domain, but you can still do that.
1501060	1509760	And after that, with your previous setting, we can actually sign in with that account into our tenant and it will be linked to that specific user, right?
1509760	1519540	So this, you could think, that probably is something you can actually trick a user of a different tenant into signing in with our tenant, right?
1519540	1523680	Because their email address could be displayed on our login page, right?
1523820	1532440	When I looked into that for synced users, then we saw that this email property is not propagated.
1532440	1543440	I tried a lot of things to try to influence that, but even setting the proxy address fields on-prem, for example, it does not automatically propagate to the proxy address field in Enter ID.
1543440	1550140	So there was no way for synced users to influence that, to get unverified domain names in there.
1550140	1552560	This is documented by Microsoft as well, right?
1552560	1554520	So I needed to find something else.
1554520	1560760	And that's why, when I started looking into the custom CSS that I showed previously, right?
1560760	1568320	So I was thinking, okay, can we maybe modify how the email property is shown on the login page with custom CSS?
1568320	1580340	And I was looking at all the attributes that we can customize or the custom selectors that we have in CSS, but none of them allowed us to directly select the email address that is shown on the page.
1580340	1586680	However, the closest one that we do have is something like the sign-in box, or we can set CSS to the complete body.
1586680	1596280	That is still possible, but things like Ent child or anything similar that would allow us to only select that email address are all disallowed, so we can't do that.
1596280	1607400	What we would need to find is some way to set something on a parent element on the page that would only affect the email address property without modifying the rest of the page.
1607460	1610600	So I was looking in the other things that are allowed, and then I saw font-face.
1610600	1616900	And font-face allows you to basically select or define a custom font that would be used for your page.
1617500	1622720	And we can apply that to the complete body or to the sign-in container, doesn't really matter.
1622720	1630600	And then I was actually looking into, okay, how can I create a custom font?
1630760	1634340	So I found this neat application that would allow me to do that.
1634340	1637560	And as you can see over here, this looks quite a lot like an S.
1637560	1643180	However, if you look a little bit closer, this is actually a hyphen, right?
1643180	1647320	As a human, you would think that this is an S, but the computer will think that this is a hyphen.
1647320	1649720	This is a dash character, basically, right?
1649720	1653160	A really swirly dash character, but it's a dash character.
1653160	1666100	So what we can do is now purchase a domain, micro-auth.com, and the computer, your browser, will think that micro-auth.com will be there, but it will render it as microsoft.com, right?
1666100	1677860	So now we can, since we've verified that domain, we own that domain, we can create any users with that email address, like admin at micro-auth.com, for example.
1677860	1685580	We can set up some conditional access policies if we don't want the user to gain access to our tenants after we phish them, for example.
1686040	1690880	And then we set up this custom CSS to implement our custom font, right?
1690880	1695440	We load our custom font from a specific location, doesn't really matter.
1696280	1702460	And we set that font to only take place on when the hyphen character is loaded, right?
1702460	1708500	So only use that font for the hyphen character, which is 2D in hexadecimal, right?
1708500	1714480	And then all the other fonts are basically the normal fonts that Microsoft would otherwise use, right?
1714480	1716940	And this is what it would look like for the user.
1716940	1724380	So the user sees admin at microsoft.com, but if you look at the source code, it is admin at micro-auth.com, right?
1724380	1726420	So very convenient.
1726420	1738480	And our phishing URL can be as short as this, login.microsoft.online.com, and then a login hint with our email address we want of the user we want to phish with a slight modification at that.
1738480	1743020	Obviously, the user might see that, so you can use a little bit of obfuscation or encoding of that.
1743020	1745380	You can use some URL encoding over there.
1745380	1747900	You can encode whatever you want, a small part.
1748080	1755580	The complete email address, you can add any parameters in there to make the URL look more legitimate, right?
1755580	1761260	At the end, it will be very hard for the user to see that this small modification is in there, right?
1761260	1763400	So let's look at a demonstration of that.
1763400	1768740	So this is our attacker server where our PTA agent is running and PTA spy is running.
1768740	1772940	So right now you can see it is installed, but there are no credentials just yet.
1773400	1775700	So this is the victim point of view.
1775700	1778300	They go to our phishing domain.
1779160	1781600	Okay, they go to login.microsoft.online.com.
1781640	1792500	You will see it looks like admin.microsoft.com, and you can also see it will show up the credentials from their password manager as well, because they are on the legitimate Microsoft domain.
1792500	1796340	After they sign in, we get their credentials in clear text, basically.
1797420	1798080	Yes.
1799180	1800440	All right.
1803960	1805180	Thank you.
1805240	1808620	But there are still a little bit of limitations to that, right?
1808620	1812960	If you look at the previous demo, you might have seen that.
1812960	1821760	Obviously, a wrong password can be provided by the user because PTA spy will always return a successful authentication without validating the password, right?
1821760	1823920	So we need to take care of that.
1823920	1829660	And the second thing is clear text passwords are nice, but they are useless if multi-factor authentication is enforced, right?
1829660	1833540	So let's see what we can do to work with that, right?
1833540	1844940	So we will use the same CSS as previously, but we will add a little bit of extra CSS to that, basically to modify the title that will be shown on the sign-in page.
1844940	1845740	And what is the title?
1845740	1851260	This is basically the area between the email address and the password field, right?
1851260	1860460	So we will hide that title and we will actually load a custom image from a location that we control from our attacker web server, right?
1860660	1862600	So what will we be doing with that?
1862600	1867580	The first time that it loads, we will, and it will request that image, we will return this image.
1867580	1874040	Enter password, so just regularly as usual, this would be what would be shown the first time.
1874060	1881600	After we validate the password of the user, we will redirect them to the login page a second time, and then we will load this image.
1881700	1882800	Enter code.
1882800	1885900	And now the login page would look like this, right?
1886040	1898360	And yeah, since we are using password authentication, we will be actually capturing that OTP code once again with our vector over password authentication agent, right?
1898560	1911680	Then we also need to modify how the PTA spy works a little bit, because as we said, it will always return a valid authentication attempt that will not validate the credentials of the user.
1911680	1921680	So how PTA spy works is basically on the PTA agent, it will hook the login user API call from the Microsoft API, the Windows API, right?
1921680	1928460	What we will do is we will modify that hook a little bit, and we will actually implement a new function that will validate the credentials.
1928460	1930120	It's too big to actually show here.
1930120	1937600	I might share that on GitHub in a while, but for now, I will just show you a little bit of snippets from this.
1937760	1941800	And if the authentication is successful, we will return successful authentication.
1941800	1947300	Otherwise, we'll return an error, and Microsoft will show that error, and the user will enter a new password, right?
1947300	1951100	So how will this go in the background?
1951460	1956940	We send a link to the user, to our sign-in page of Android ID, right?
1956940	1961340	They will click on that, and obviously when the sign-in page loads, it will request that image.
1961340	1965180	So the first time it loads that image from our web server, we return this image.
1965180	1974660	The user will enter their password, because it is instructed to do that, which will be forwarded to Android ID, and Android ID will forward that to our password authentication agent, right?
1974660	1978620	At this point, we validate that password against Android ID, right?
1978620	1982320	And if the authentication is successful, we return that.
1982320	1985900	If it's unsuccessful, we return an error message, and they can try again, right?
1985900	1987240	Let's assume it is successful.
1987240	1998940	What we will do is we'll let our web server that's hosting our image know that the authentication was successful, so it knows next time if we need to load an image in the next couple of minutes, we know that it needs to return the other image, right?
1998940	2010000	At this point in time, we also redirect the user to the login page once again, and they will receive the image once again to be requesting their OTP code, right?
2010000	2015900	They will provide the OTP code in the password field, right, which will be forwarded to our PTA agent.
2015900	2018240	We can validate that once again to Android ID.
2018240	2020980	If it's unsuccessful, we can return an error once again.
2020980	2023140	If it's successful, we compromise the user account.
2023140	2024860	So this is the ID behind it.
2024860	2027040	What would our sign-in URL look like?
2027040	2029740	It's a little bit bigger, as you can see over here.
2029740	2046920	So once again, login.mysoftonline.com, and the client ID of our application that we have set up with the custom redirect URL, the prompt login to force the login page to be shown, even if the user has already signed in, which is required because we will need to sign in the user two times,
2046920	2047140	right?
2047140	2049660	And then the e-mail address of the user we want to target.
2049660	2054560	And then the redirect URL will redirect the user after successful authentication once again to the login page.
2054560	2056800	And you can see it's a little bit nested over there.
2056820	2064300	But then the third time, or the second time they successfully sign in, they will be redirected to wherever you want to go, Google, in this specific case.
2064880	2072180	One small note for the demo is that usually we would rewrite something like micro-auth.com authentication attempts.
2072180	2076540	For that, we would rewrite that to Microsoft.com and validate if the credentials are valid.
2076540	2077840	For that, I can't, right?
2077840	2085100	Obviously, since I don't have access to a Microsoft.com domain, and I asked them, but they said no.
2085160	2089800	I even told them, you can see my slides if you give me the account for the demo, and they said no.
2090120	2101120	So , because we do not have access to that Microsoft.com domain, what I will be doing is I will show you the demo where we capture the credentials for the user at Microsoft.com.
2101120	2110580	But instead of validating the credentials against a Microsoft account, you will validate them against an account that I have control over, that I know the password of, so I can fish myself, basically.
2110640	2114140	So, let's look into that.
2115460	2120440	So, over here, we have the victim point of view in the bottom left corner.
2120640	2125580	Everything will happen on the legitimate Microsoft login page so they will be asked to enter their password.
2125580	2131200	If they enter an invalid password, they will receive an error message, just to show that we are actually checking for that.
2131200	2134300	We still have the password, of course, but we know that it's invalid.
2134820	2144820	If the user provides the correct password, for example, the one that's saved in their password manager, then it will seamlessly load the enter code image.
2146080	2154580	And if they provide the correct MFA code over there, we can redirect them wherever we want, and we basically compromise the user.
2154580	2158140	Once again, we have their access token, session cookies, anything we need.
2163180	2164400	All right.
2165740	2171260	So, this is nice, once again, but there's still a couple of limitations to that.
2171680	2181280	First, we are capturing a MFA code in a password field, which is a little bit suspicious because usually the OTP code is in clear text, right?
2181520	2188660	Additionally, authenticator app notifications are a little bit more convenient in company environments, right?
2188660	2191680	They are used quite a lot more, and they are more convenient for the user.
2191680	2195960	So, I was looking at, okay, can we actually do something with that instead, right?
2195960	2198740	And for that, we will actually need two Enter ID tenants.
2198740	2201540	The first one will have the same CSS as we saw previously.
2201540	2205120	It will only replace the hyphen with an S character, right?
2205120	2208020	The other CSS that you saw previously, we don't use that.
2208200	2212440	And, yeah, it's basically the main sign-in page that you saw previously, right?
2212480	2218840	Then the second tenant, which we will redirect the user to after authentication, will have this CSS.
2218900	2224420	And basically, what this will be doing is it will replace the complete sign-in box with an image.
2224420	2225980	And you're thinking, okay, what image?
2225980	2228120	An image looking something like this, right?
2228260	2234400	Showing the two-digit code that they would need to sign in on their authenticator app, right?
2234400	2239720	And you're thinking, okay, but how do we know in advance which specific two-digit code that the user needs to enter?
2239720	2240740	Well, we don't know.
2240740	2245100	So, we just generate an image for all of them, right?
2245100	2246980	So, this took quite a while.
2246980	2250780	So, I have 100 images ready over here.
2250780	2255880	And basically, it doesn't matter what image or which code that Microsoft provides us.
2255880	2256960	We can return that.
2257280	2258820	And this is how the attack flow would go.
2258820	2267620	So, we send a link to the user to sign into the first tenant, right, which will...
2267620	2274520	There's not much modifications on that one, just replacing the hyphen with an S character in this specific case.
2274520	2279400	So, you would provide their credentials, which we will capture on our PTA server.
2279400	2280840	We can validate them.
2280840	2282680	If there is an error, we can return that.
2282680	2285040	If not, we return a successful authentication.
2285140	2291240	At this point in time, we will also receive a two-digit MFA code from EnterID if MFA is set up.
2291240	2294300	And we forward that to our web server, right?
2294300	2296140	So, for example, 42.
2296140	2301120	We redirect the user to now tenant two, where our different CSS is loaded.
2301120	2309720	And there, it will actually load the image, right, because we're replacing the complete sign-in prompt with an image and whatever code that is needed, right?
2309720	2316420	In the meantime, our attacker server is constantly polling, checking if the authentication already succeeded with MFA.
2316480	2318700	The user will see the two-digit code.
2318700	2324860	They will also look down, because they just received a notification on their phone to ask for the two-digit code.
2324860	2327720	So, they provide that, which will be forwarded to EnterID.
2327720	2330860	And at that point in time, we compromise the user's account.
2330920	2334880	So, let's look at our final demo over here.
2335680	2341960	Once again, login.microsoftonline.com with some custom properties, which you can see over there.
2342680	2347180	And the redirect URL will just redirect them once again to the login page of the second tenant.
2347180	2349420	So, you can see that in action over here.
2349420	2351640	First time we enter the password.
2353940	2356940	So, it's going to be an invalid password first time.
2356940	2360200	So, you can see no redirection if the user enters an invalid password.
2360200	2363140	If we take the correct password from our
2368180	2375520	Authenticator extension or whatever, the user will be redirected to the second tenant, where this image would be shown.
2375520	2381120	And as you can see over here, the user has entered their multi-factor authentication on their app.
2381120	2384300	We get their access token, refresh token, and their session cookies.
2384300	2386640	You will see they will not be redirected over here.
2386640	2389860	So, this could be something that they will note.
2389860	2394440	However, they are still on a legitimate Microsoft login page.
2394440	2397040	So, it is not that suspicious, right?
2397820	2398840	All right.
2399540	2402260	So, for that, we would actually need two tenants.
2402260	2410460	You can actually do something where you only use one tenant if you really want that, but then you would need to use this.
2410460	2412400	Browser language customization.
2412400	2419460	And what this allows you to do is specify custom tenant branding for a specific language, right?
2419460	2425760	So, for each language, you could load a custom CSS file, which would allow us to, for example, do something like this.
2426120	2429640	By default, in any language, it would return the normal login page.
2429640	2433880	If the language is set to French, for example, we return the MFA prompt.
2433880	2440260	And we can actually modify which language is used with this parameter, this LC parameter.
2440260	2444880	We provide an ID over there for French, for example, and then it would load the login page, right?
2444880	2448600	So, this would allow you to do this exact same attack with only one EnterID tenant.
2448600	2451620	However, you will note one slight difference.
2451680	2455840	If you change the language, it would also change the language and the page title.
2456300	2466420	So, this could be something that could be seen, but probably not too suspicious for the user, and they will probably not notice it because they just received a notification in their Authenticator app, right?
2467000	2470560	So, to summarize, I showed about eight techniques.
2470560	2473620	The OpenRedirect ones, I went over them fairly quickly.
2473620	2481420	If you are interested in that, the slides for that are at the back of my presentation as well because I first created some slides for that.
2481980	2483900	So, you will be able to see that still.
2483900	2493420	Four of these techniques, we can actually be using or staying completely within the legitimate login.microsoftonline.com domain, right?
2493420	2498820	Without going anywhere else, and a couple of them will also bypass multi-factor authentication, right?
2498820	2505340	So, to summarize, login.microsoftonline.com is a free redirector for phishing pages.
2505340	2508620	It can serve any image as it is imaged, right?
2508620	2513900	So, if you want to host cat memes on Microsoft's login page, you can do that if you want, right?
2513900	2521760	It is the most trusted credential harvester by far and is basically the perfect all-in-one phishing platform, phishing as a service platform, right?
2522100	2526240	Some references over here from, obviously, Dr.
2526240	2537880	Azure AD for his awesome work with AD internals and PTA Spy, which we use quite a lot over here, which is based on the research of Adam Chester, actually.
2538220	2546920	And also, a quick shout-out to Kuba, the creator of EvilGeneX, which allowed me to use the EvilGeneX Pro version for some of these demos over here.
2547280	2550800	If you have any questions, feel free to come ask me after the session.
2550800	2552660	I will reach out to me on my socials.
2552660	2553980	You can see that over here.
2553980	2563040	I just want to end over here with a picture that I took at the Microsoft party two days ago, which basically summarizes this entire talk.
2563040	2570140	I'm not sure if you can see it, but they had this small sign over there saying game over, and they allowed me to take some pictures over there.
2570200	2572280	So, yeah, thank you so much.
