1 00:00:00,000 --> 00:00:06,600 All right, welcome everyone to turning Microsoft's login page into our phishing infrastructure. 2 00:00:06,720 --> 00:00:12,240 And most importantly, welcome to our special guests from Microsoft, right? 3 00:00:12,240 --> 00:00:16,380 Welcome people from Microsoft, because you guys really have to be my biggest fans. 4 00:00:16,380 --> 00:00:27,340 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. 5 00:00:27,340 --> 00:00:37,240 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. 6 00:00:37,240 --> 00:00:40,720 And you'd be thinking, okay, but what about responsible disclosure then? 7 00:00:40,720 --> 00:01:01,220 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, 8 00:01:01,220 --> 00:01:01,760 right? 9 00:01:01,760 --> 00:01:19,800 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. 10 00:01:19,800 --> 00:01:21,560 But they weren't really happy with that. 11 00:01:21,560 --> 00:01:30,640 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? 12 00:01:30,640 --> 00:01:34,260 And when that didn't work, they were very persistent. 13 00:01:34,260 --> 00:01:43,620 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. 14 00:01:43,620 --> 00:01:47,000 But once again, I said, okay, thank you for the invitation. 15 00:01:47,000 --> 00:01:48,480 I have something else to do. 16 00:01:48,480 --> 00:01:53,360 So I thought that would have been the end of that, but they were actually really, really persistent. 17 00:01:53,380 --> 00:02:06,560 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. 18 00:02:07,500 --> 00:02:16,540 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. 19 00:02:17,940 --> 00:02:29,020 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? 20 00:02:29,100 --> 00:02:32,800 So before we start, let's do a quick introduction about myself. 21 00:02:32,800 --> 00:02:36,120 I am Keanu Ness, also known as RedbyteOnline. 22 00:02:36,120 --> 00:02:40,360 I lead a small offensive security team at a Belgian company called Spotted. 23 00:02:40,360 --> 00:02:51,580 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. 24 00:02:51,580 --> 00:02:57,620 And I'm also the instructor for several Azure Red teaming trainings at Alta Security. 25 00:02:57,680 --> 00:02:58,820 But enough about me. 26 00:02:58,820 --> 00:03:03,660 Let's actually get into different stuff because I have a lot of new techniques I want to share with you guys. 27 00:03:04,900 --> 00:03:07,140 I'll go over a quick introduction. 28 00:03:07,140 --> 00:03:13,800 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. 29 00:03:13,900 --> 00:03:28,220 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? 30 00:03:28,220 --> 00:03:35,000 You have email security solutions that could block your suspicious links in there. 31 00:03:35,000 --> 00:03:43,020 There is user awareness where they focus quite a lot on hoovering over the link and seeing if the domain name is legitimate, right? 32 00:03:43,020 --> 00:03:48,860 Nothing we can't really get past to with a good pretext, of course. 33 00:03:48,860 --> 00:03:51,440 But still something we need to take into consideration. 34 00:03:52,100 --> 00:03:56,640 It takes quite a lot of time to get a benign domain categorization, of course. 35 00:03:56,700 --> 00:04:02,040 And constantly recycling your domains when they are burned can be a little bit tedious, right? 36 00:04:02,040 --> 00:04:05,540 So what alternatives do we actually have for that? 37 00:04:05,580 --> 00:04:24,240 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, 38 00:04:24,240 --> 00:04:24,680 right? 39 00:04:24,680 --> 00:04:30,600 However, most of the interesting permissions require admin approval, especially in hardened tenants. 40 00:04:30,600 --> 00:04:33,640 You would see that admin approval would be required for everything. 41 00:04:33,640 --> 00:04:41,100 There's also verified publish restrictions, which is not that big deal to get around to, but still it's there. 42 00:04:41,100 --> 00:04:43,260 Device code phishing is still very useful. 43 00:04:43,260 --> 00:04:52,960 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. 44 00:04:52,960 --> 00:04:58,500 And then adversary in the middle is obviously very useful to make your website look very convincing. 45 00:04:58,500 --> 00:05:03,560 You are basically interacting with a real website, but on a malicious domain name. 46 00:05:03,560 --> 00:05:05,900 So that's also a drawback on that. 47 00:05:05,900 --> 00:05:08,720 You're basically in the same situation as previously. 48 00:05:08,900 --> 00:05:14,160 If your domain gets burned, you will need to rotate that and so forth, right? 49 00:05:14,160 --> 00:05:17,380 So I was interested in this instead. 50 00:05:17,380 --> 00:05:25,860 Can we use the TrustedLogin.MicrosoftOnline.com, so the login domain for use for all kinds of authentication purposes by Microsoft? 51 00:05:25,860 --> 00:05:28,340 Can we use this domain for phishing purposes? 52 00:05:28,420 --> 00:05:39,540 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? 53 00:05:39,540 --> 00:05:49,620 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. 54 00:05:49,620 --> 00:05:54,620 At the end, we will be showing some very advanced techniques that completely destroy the login page. 55 00:05:54,620 --> 00:06:02,320 We will be extracting clear text credentials and bypassing multi-factor authentication, all while staying on this legitimate login domain, right? 56 00:06:02,320 --> 00:06:05,080 So without losing too much time, let's get into that. 57 00:06:05,460 --> 00:06:14,020 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. 58 00:06:14,300 --> 00:06:17,420 In general, these are some open redirects. 59 00:06:17,420 --> 00:06:18,580 I will share a couple of them. 60 00:06:18,580 --> 00:06:23,120 These are still working, as all of the other things that are still working, right? 61 00:06:23,160 --> 00:06:26,380 First, you can use Federation as an open redirect. 62 00:06:26,380 --> 00:06:43,180 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. 63 00:06:43,240 --> 00:06:57,040 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? 64 00:06:57,040 --> 00:07:03,680 So basic open redirects, which is basically known of how Federation works. 65 00:07:03,680 --> 00:07:06,340 So this is probably something that they can't really patch. 66 00:07:06,340 --> 00:07:26,100 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, 67 00:07:26,100 --> 00:07:31,080 so no login page or whatever, and it would instantly redirect to your redirect URL, right? 68 00:07:31,140 --> 00:07:37,460 Even if with the most restrictive consent settings, it would still instantly redirect. 69 00:07:37,580 --> 00:07:45,200 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. 70 00:07:45,380 --> 00:08:00,000 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. 71 00:08:00,000 --> 00:08:09,540 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. 72 00:08:09,540 --> 00:08:15,060 However, because we are using an invalid scope that Microsoft doesn't understand, it will throw an error. 73 00:08:15,060 --> 00:08:19,200 It will not show an error, but it will instantly redirect to the redirect URL, right? 74 00:08:19,220 --> 00:08:21,960 Even with the most restrictive user consent settings. 75 00:08:21,960 --> 00:08:25,740 So a couple of open redirects, which I shared. 76 00:08:25,740 --> 00:08:29,360 These three I shared with Microsoft to give them something. 77 00:08:29,360 --> 00:08:34,860 I have not received a response about that, but I'm fairly certain that this is something they can fix. 78 00:08:35,380 --> 00:08:38,100 I will show you a quick demo of the last one. 79 00:08:38,840 --> 00:08:42,360 So at the left, you have the attacker point of view. 80 00:08:42,360 --> 00:08:44,840 At the right, you have the user point of view. 81 00:08:44,840 --> 00:08:49,780 So this is the URL we would send to the user, for example, that we want to phish. 82 00:08:49,840 --> 00:08:51,020 So it's an invalid scope. 83 00:08:51,020 --> 00:08:52,560 That's the most important one. 84 00:08:52,600 --> 00:08:55,880 So we copy that one, paste that into the browser. 85 00:08:59,600 --> 00:09:03,200 All right, and you would see the other ones would instantly redirect to your phishing page. 86 00:09:03,200 --> 00:09:06,620 This one will stay on the Microsoft login website for a bit. 87 00:09:06,620 --> 00:09:11,340 It would ask you to enter your password, whatever, do multi-factor authentication if that is required. 88 00:09:11,340 --> 00:09:26,320 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. 89 00:09:26,800 --> 00:09:31,340 But something like this would be very useful for certain pretexts, right? 90 00:09:35,260 --> 00:09:45,220 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. 91 00:09:45,300 --> 00:09:49,140 All right, so this is how that would look like. 92 00:09:50,380 --> 00:09:58,960 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. 93 00:09:58,960 --> 00:10:01,940 Can be useful in certain use cases if you want to use that, right? 94 00:10:01,940 --> 00:10:04,040 But let's look at some other approaches. 95 00:10:04,540 --> 00:10:08,660 And for the first one, I will be using self-service sign-up. 96 00:10:08,660 --> 00:10:11,000 So what is self-service sign-up? 97 00:10:11,000 --> 00:10:19,960 So self-service sign-up basically allows external users to sign in to applications in your tenant with their own credentials. 98 00:10:19,960 --> 00:10:30,320 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? 99 00:10:30,320 --> 00:10:32,560 This can be useful in certain use cases. 100 00:10:32,560 --> 00:10:38,280 Obviously, by default, that is disabled, but you can enable that if you want that in your Entra ID tenants. 101 00:10:39,480 --> 00:10:46,200 And the interesting thing about this is that you can collect custom attributes during the sign-up flow, right? 102 00:10:46,200 --> 00:10:53,620 And you can collect certain types of default attributes, such as a job title, display name, anything you want. 103 00:10:53,620 --> 00:11:03,260 However, nothing stops you of creating a custom attribute called password, for example, and an additional integer, for example, called MFA code, right? 104 00:11:03,260 --> 00:11:14,200 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? 105 00:11:14,820 --> 00:11:21,480 So, and then you'll probably think, okay, but how do we validate whether the password is actually correct or not, right? 106 00:11:21,480 --> 00:11:24,360 Because a user can fill in anything over there. 107 00:11:24,360 --> 00:11:26,940 So with an API connector, we can actually do that. 108 00:11:26,940 --> 00:11:35,540 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? 109 00:11:35,540 --> 00:11:40,480 So with this, we will be able to validate the password, return an error message if it's incorrect. 110 00:11:40,480 --> 00:11:42,520 So let's look at how the attack would work. 111 00:11:42,520 --> 00:11:44,040 We send a link to the user. 112 00:11:44,040 --> 00:11:45,180 They would click on that. 113 00:11:45,180 --> 00:11:51,940 They would go to the login.microsoftonline.com domain, obviously, as all of the examples that I will be showing. 114 00:11:52,520 --> 00:11:57,460 And after that, they will need to sign in with their account of their home tenant, right? 115 00:11:57,460 --> 00:11:59,400 They will need to accept a tenant invite. 116 00:11:59,400 --> 00:12:06,060 And after that, they will be asked to fill in the attributes that we want, so the password and whatever, right? 117 00:12:06,360 --> 00:12:10,160 They will fill that in on enter ID, which will forward that to our API connector. 118 00:12:10,160 --> 00:12:12,660 The user does not directly interact with our domain, right? 119 00:12:12,660 --> 00:12:14,740 So everything goes to enter ID. 120 00:12:15,060 --> 00:12:16,460 So the attributes are collected. 121 00:12:16,460 --> 00:12:19,280 They are forwarded in cleartext to us, right? 122 00:12:19,280 --> 00:12:24,540 And at that point in time, we can actually validate that against enter ID if it's correct or not. 123 00:12:24,540 --> 00:12:28,500 If it's incorrect, we can tell the user that they need to use a different password. 124 00:12:28,500 --> 00:12:32,360 Otherwise, we have the credentials of the user and we compromise their account, right? 125 00:12:32,360 --> 00:12:36,540 We basically continue this until they provide valid credentials. 126 00:12:37,080 --> 00:12:39,980 All right, so this is what the URL would actually look like. 127 00:12:39,980 --> 00:12:49,140 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... 128 00:12:49,140 --> 00:12:51,460 This is our victim user, right? 129 00:12:51,460 --> 00:12:55,860 So an email address of the victim user that would allow it to be pre-populated on the sign-in page. 130 00:12:55,860 --> 00:12:58,980 So an additional step that the user does not need to do themselves. 131 00:12:59,080 --> 00:13:04,180 And we use prompt create to force the registration page to show up. 132 00:13:04,180 --> 00:13:05,780 Otherwise, they would need to click on something. 133 00:13:05,780 --> 00:13:09,440 So the more things we can automate for the user, the better, right? 134 00:13:09,440 --> 00:13:15,020 So prompt create plus the login hints will force the sign-in page with the pre-filled email address to be showing up. 135 00:13:15,400 --> 00:13:18,320 User signs in with their credentials, accept the tenant invite. 136 00:13:18,660 --> 00:13:25,200 This is not a consent prompt, so even if the most restrictive consent settings are configured, it would not really help there. 137 00:13:25,200 --> 00:13:32,980 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? 138 00:13:32,980 --> 00:13:35,920 So let's look at that with a demo. 139 00:13:36,220 --> 00:13:38,320 So you know how it looks like. 140 00:13:38,320 --> 00:13:40,560 At left, you have the attacker point of view. 141 00:13:40,560 --> 00:13:44,440 At the right, you have the victim user point of view. 142 00:13:44,460 --> 00:13:46,940 So we paste that URL that I shared previously. 143 00:13:47,320 --> 00:13:49,320 This is what they would end up on. 144 00:13:49,320 --> 00:13:52,060 So they sign in with their valid credentials. 145 00:13:54,020 --> 00:13:56,460 They accept the tenant invite. 146 00:13:58,180 --> 00:14:02,840 And then this is what the attribute collection flow would be looking like. 147 00:14:02,840 --> 00:14:07,760 But the interesting thing is, this is all on the legitimate login.microsoft.com online domain, right? 148 00:14:07,760 --> 00:14:10,700 So it has some trustworthiness to it. 149 00:14:10,700 --> 00:14:18,660 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. 150 00:14:18,660 --> 00:14:25,420 So provide a correct password with invalid MFA codes, we can return a different error message. 151 00:14:25,940 --> 00:14:35,640 And if the user provides a correct MFA code and a correct password, you will see that we can return a custom error message. 152 00:14:35,840 --> 00:14:41,540 So we can also redirect to users anywhere we want at this point in time, if we wanted to. 153 00:14:41,540 --> 00:14:43,700 But we have everything we need right now. 154 00:14:43,700 --> 00:14:47,100 We have access tokens, refresh tokens, session cookies. 155 00:14:47,100 --> 00:14:50,180 The complete account of the user is now compromised. 156 00:14:50,520 --> 00:14:52,680 All right. 157 00:14:56,000 --> 00:14:59,480 If you find that impressive already, wait for the next ones. 158 00:14:59,480 --> 00:15:01,740 So I have some backup slides. 159 00:15:02,440 --> 00:15:08,360 So the next one, I will be looking at abusing custom company branding, right? 160 00:15:08,360 --> 00:15:15,500 So custom company branding, this basically allows us to customize the look and feel of the Microsoft Entra ID sign-in page, right? 161 00:15:15,500 --> 00:15:17,260 So what could go wrong? 162 00:15:17,260 --> 00:15:18,680 Quite a lot we will see. 163 00:15:18,680 --> 00:15:26,900 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. 164 00:15:26,900 --> 00:15:35,120 This is used quite a lot by organizations, mostly to load a custom background for their sign-in page, for their organization. 165 00:15:35,200 --> 00:15:41,800 However, I've noticed that you can actually customize quite a lot more than what the documentation describes. 166 00:15:42,020 --> 00:15:42,360 All right. 167 00:15:42,360 --> 00:15:49,940 And one of the interesting things that you can do with custom company branding is inserting a custom CSS file, right? 168 00:15:49,940 --> 00:15:54,560 You cannot customize, luckily, any HTML or JavaScript, right? 169 00:15:54,560 --> 00:15:55,800 That would be really bad. 170 00:15:55,800 --> 00:16:03,460 However, you can customize a little bit what the page or what it would look like with CSS, right? 171 00:16:04,060 --> 00:16:09,400 However, not all CSS is obviously allowed because the nasty CSS is filtered out. 172 00:16:09,400 --> 00:16:13,660 I was looking into, okay, how does it define what is allowed and what isn't? 173 00:16:13,660 --> 00:16:27,620 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. 174 00:16:27,620 --> 00:16:32,920 That basically means that we can actually see in the source code everything that it is filtering for. 175 00:16:32,920 --> 00:16:44,220 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. 176 00:16:44,260 --> 00:16:47,860 So this was very useful to look into what we could do. 177 00:16:47,920 --> 00:16:51,980 So I was playing with this, looking with this, okay, what can I do with that? 178 00:16:51,980 --> 00:16:55,440 I found that you could target the sign-in buttons, for example. 179 00:16:55,540 --> 00:16:56,940 So what did we do? 180 00:16:56,940 --> 00:17:00,780 I first hide the sign-in buttons, and they are gone right now. 181 00:17:00,780 --> 00:17:02,680 So you're thinking, okay, what can we do with that? 182 00:17:02,680 --> 00:17:12,660 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? 183 00:17:12,660 --> 00:17:24,580 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. 184 00:17:24,580 --> 00:17:26,360 So we can do something like this. 185 00:17:26,360 --> 00:17:30,960 The next button that we previously just hit, we can replace that with something like that. 186 00:17:30,960 --> 00:17:33,460 Obviously, right now, no one would click on that. 187 00:17:33,460 --> 00:17:35,940 No one would be too stupid to click on that. 188 00:17:35,940 --> 00:17:43,500 However, if we customize that a little bit more with a little bit CSS, we can make that link look something like that. 189 00:17:43,860 --> 00:17:47,460 So now it looks quite a little like this next button, right? 190 00:17:47,460 --> 00:17:55,980 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? 191 00:17:55,980 --> 00:18:06,340 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? 192 00:18:06,340 --> 00:18:13,120 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. 193 00:18:13,120 --> 00:18:16,560 We can basically hijack these buttons, right? 194 00:18:16,700 --> 00:18:21,340 So how would we abuse this, or what URL would we be using for that? 195 00:18:21,340 --> 00:18:30,920 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? 196 00:18:30,920 --> 00:18:41,720 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? 197 00:18:41,900 --> 00:18:43,540 And then what else do we have? 198 00:18:43,540 --> 00:18:44,280 Prompt login. 199 00:18:44,280 --> 00:18:52,100 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? 200 00:18:52,100 --> 00:18:54,960 So prompt login forces to show the sign-on page. 201 00:18:55,320 --> 00:19:05,080 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? 202 00:19:06,560 --> 00:19:10,100 All right, so what does this look like for the user? 203 00:19:10,100 --> 00:19:12,680 So they are on login.microsoftonline.com. 204 00:19:12,680 --> 00:19:15,000 For example, we are phishing the CEO of Microsoft. 205 00:19:15,000 --> 00:19:16,300 They provide their email address. 206 00:19:16,300 --> 00:19:20,080 They click on the next button, and they see the password fill-in page, right? 207 00:19:20,080 --> 00:19:22,640 But this is on a different domain, but it's so seamless. 208 00:19:22,640 --> 00:19:23,540 The user doesn't see it. 209 00:19:23,540 --> 00:19:29,700 They click on the button, and they see the next page that they are expecting, but on a different domain, right? 210 00:19:29,700 --> 00:19:31,400 So it's very, very powerful. 211 00:19:31,400 --> 00:19:33,520 So let's look at an example of that. 212 00:19:34,040 --> 00:19:36,580 So we go to that domain. 213 00:19:39,080 --> 00:19:42,300 User fills in their email address, clicks. 214 00:19:42,300 --> 00:19:46,000 You can see, if you hover over the button, there is this nice animation. 215 00:19:46,000 --> 00:19:46,920 We click on that. 216 00:19:46,920 --> 00:19:50,860 At the left, you can see EvilGNX loading already, loading the login page. 217 00:19:50,860 --> 00:19:52,840 We will pre-fill the email address of the user. 218 00:19:52,840 --> 00:19:56,440 We can load custom tenant branding of the user, whatever we want. 219 00:19:56,440 --> 00:20:02,340 User enters their password, and if they sign in, they would get an MFA prompt or whatever. 220 00:20:02,340 --> 00:20:08,400 Obviously, we don't know the password of the CEO of Microsoft, of course, but you can see where this is going, right? 221 00:20:08,400 --> 00:20:10,020 This is just for a demonstration. 222 00:20:11,940 --> 00:20:12,900 All right. 223 00:20:13,800 --> 00:20:18,360 Let's look at something else we can do with password authentication. 224 00:20:18,980 --> 00:20:30,640 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? 225 00:20:30,640 --> 00:20:48,300 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? 226 00:20:48,300 --> 00:20:52,540 So this is fairly abused quite a lot already. 227 00:20:52,540 --> 00:21:02,960 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? 228 00:21:02,960 --> 00:21:05,560 So this is usually done after full domain compromise. 229 00:21:05,560 --> 00:21:10,740 You compromise someone's on-prem environment and then you install this backdoor, right? 230 00:21:10,740 --> 00:21:13,360 Which requires quite a lot of high privileges. 231 00:21:13,660 --> 00:21:16,040 So how does the authentication flow work? 232 00:21:16,040 --> 00:21:18,660 So user goes through any application. 233 00:21:18,660 --> 00:21:21,160 It will be redirected to Entra.ID, right? 234 00:21:21,160 --> 00:21:23,500 Entra.ID will ask for the credentials. 235 00:21:23,500 --> 00:21:32,100 So the credentials are added on Entra.ID's login page, which will then be forwarded to your on-prem PTA agent for validation. 236 00:21:32,120 --> 00:21:39,140 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. 237 00:21:39,300 --> 00:21:47,100 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? 238 00:21:47,380 --> 00:21:49,720 So that is how it works. 239 00:21:49,720 --> 00:21:54,660 So as I said, it's a known technique to use this for persistent purposes. 240 00:21:54,660 --> 00:21:57,920 However, what my idea was, can we use that for initial access? 241 00:21:57,920 --> 00:22:03,080 Can we use password authentication set up in our attacker tenant, right? 242 00:22:04,000 --> 00:22:07,560 And still clear text credentials of users and other tenants, right? 243 00:22:07,560 --> 00:22:09,180 So this was my plan. 244 00:22:09,180 --> 00:22:12,000 I set up password authentication in our tenant that I control. 245 00:22:12,000 --> 00:22:13,140 So I can do that. 246 00:22:13,140 --> 00:22:17,340 I backed over the PTA agents on-premise, which is running on a server that I control. 247 00:22:17,340 --> 00:22:18,320 So I can do that as well. 248 00:22:18,320 --> 00:22:20,280 So this is all fairly straightforward. 249 00:22:20,280 --> 00:22:30,460 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? 250 00:22:30,460 --> 00:22:33,340 Otherwise, we wouldn't be able to get their credentials. 251 00:22:33,460 --> 00:22:37,340 So this is one is easier said than done, but let's look at that in a little bit. 252 00:22:37,680 --> 00:22:39,260 So let's first look at the first step. 253 00:22:39,260 --> 00:22:40,700 I will go over this briefly. 254 00:22:40,700 --> 00:22:44,200 It's very boring, but it's all documents from Microsoft, how we can set that up. 255 00:22:44,200 --> 00:22:46,660 So we set up an Entra ID domain. 256 00:22:46,660 --> 00:22:49,500 We set up Entra Connect Sync. 257 00:22:49,500 --> 00:22:53,400 We set up password authentication over there, go through all the steps that are needed. 258 00:22:53,400 --> 00:22:57,200 And eventually we see password authentication is enabled for our tenants, right? 259 00:22:57,200 --> 00:23:01,080 Then second thing we need to do is we need to backdoor that password authentication agent. 260 00:23:01,080 --> 00:23:05,580 Right here, we will be using PTA spy from AAD internals by Dr. 261 00:23:05,580 --> 00:23:06,080 Azure AD. 262 00:23:06,080 --> 00:23:09,280 But there are a lot of tools that do the same thing, basically. 263 00:23:10,460 --> 00:23:12,540 But PTA spy is very easy to install. 264 00:23:12,540 --> 00:23:17,300 We just use install AAD int PTA spy on our PTA agents. 265 00:23:17,300 --> 00:23:25,760 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? 266 00:23:26,100 --> 00:23:29,200 So now let's look at the other part. 267 00:23:29,200 --> 00:23:33,140 How can we force users from other tenants to sign into our tenants? 268 00:23:33,140 --> 00:23:42,000 There are a couple of constraints to that of whether we are restricted to make it still collect the credentials with PTA, right? 269 00:23:42,000 --> 00:23:45,120 So we can only target users in our own tenants. 270 00:23:45,120 --> 00:23:52,860 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? 271 00:23:53,160 --> 00:23:56,820 Password authentication also only works with hybrid users. 272 00:23:56,820 --> 00:23:58,600 So cloud-only users will not work. 273 00:23:58,600 --> 00:24:01,480 For example, guest accounts are cloud-only users. 274 00:24:01,480 --> 00:24:04,000 So these can't be synced to on-prem. 275 00:24:04,000 --> 00:24:07,000 So something like that would not be possible, right? 276 00:24:07,000 --> 00:24:08,740 So what other options do we have? 277 00:24:09,880 --> 00:24:19,740 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. 278 00:24:19,740 --> 00:24:31,880 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. 279 00:24:32,000 --> 00:24:40,340 And this proxy address attributes can, in certain cases, have email addresses from unverified domains that you do not own. 280 00:24:40,340 --> 00:24:44,420 So I was looking into that for a cloud-only user just to test this really quickly. 281 00:24:44,500 --> 00:24:50,440 If you set, you cannot control the proxy address directly, but you can, for example, update the email attributes. 282 00:24:50,440 --> 00:24:54,840 And for cloud-only users, this gets propagated automatically to the proxy address fields. 283 00:24:54,840 --> 00:24:57,920 So you can see over here, we set that to non-synced at microsoft.com. 284 00:24:57,920 --> 00:25:01,060 We don't own the microsoft.com domain, but you can still do that. 285 00:25:01,060 --> 00:25:09,760 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? 286 00:25:09,760 --> 00:25:19,540 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? 287 00:25:19,540 --> 00:25:23,680 Because their email address could be displayed on our login page, right? 288 00:25:23,820 --> 00:25:32,440 When I looked into that for synced users, then we saw that this email property is not propagated. 289 00:25:32,440 --> 00:25:43,440 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. 290 00:25:43,440 --> 00:25:50,140 So there was no way for synced users to influence that, to get unverified domain names in there. 291 00:25:50,140 --> 00:25:52,560 This is documented by Microsoft as well, right? 292 00:25:52,560 --> 00:25:54,520 So I needed to find something else. 293 00:25:54,520 --> 00:26:00,760 And that's why, when I started looking into the custom CSS that I showed previously, right? 294 00:26:00,760 --> 00:26:08,320 So I was thinking, okay, can we maybe modify how the email property is shown on the login page with custom CSS? 295 00:26:08,320 --> 00:26:20,340 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. 296 00:26:20,340 --> 00:26:26,680 However, the closest one that we do have is something like the sign-in box, or we can set CSS to the complete body. 297 00:26:26,680 --> 00:26:36,280 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. 298 00:26:36,280 --> 00:26:47,400 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. 299 00:26:47,460 --> 00:26:50,600 So I was looking in the other things that are allowed, and then I saw font-face. 300 00:26:50,600 --> 00:26:56,900 And font-face allows you to basically select or define a custom font that would be used for your page. 301 00:26:57,500 --> 00:27:02,720 And we can apply that to the complete body or to the sign-in container, doesn't really matter. 302 00:27:02,720 --> 00:27:10,600 And then I was actually looking into, okay, how can I create a custom font? 303 00:27:10,760 --> 00:27:14,340 So I found this neat application that would allow me to do that. 304 00:27:14,340 --> 00:27:17,560 And as you can see over here, this looks quite a lot like an S. 305 00:27:17,560 --> 00:27:23,180 However, if you look a little bit closer, this is actually a hyphen, right? 306 00:27:23,180 --> 00:27:27,320 As a human, you would think that this is an S, but the computer will think that this is a hyphen. 307 00:27:27,320 --> 00:27:29,720 This is a dash character, basically, right? 308 00:27:29,720 --> 00:27:33,160 A really swirly dash character, but it's a dash character. 309 00:27:33,160 --> 00:27:46,100 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? 310 00:27:46,100 --> 00:27:57,860 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. 311 00:27:57,860 --> 00:28:05,580 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. 312 00:28:06,040 --> 00:28:10,880 And then we set up this custom CSS to implement our custom font, right? 313 00:28:10,880 --> 00:28:15,440 We load our custom font from a specific location, doesn't really matter. 314 00:28:16,280 --> 00:28:22,460 And we set that font to only take place on when the hyphen character is loaded, right? 315 00:28:22,460 --> 00:28:28,500 So only use that font for the hyphen character, which is 2D in hexadecimal, right? 316 00:28:28,500 --> 00:28:34,480 And then all the other fonts are basically the normal fonts that Microsoft would otherwise use, right? 317 00:28:34,480 --> 00:28:36,940 And this is what it would look like for the user. 318 00:28:36,940 --> 00:28:44,380 So the user sees admin at microsoft.com, but if you look at the source code, it is admin at micro-auth.com, right? 319 00:28:44,380 --> 00:28:46,420 So very convenient. 320 00:28:46,420 --> 00:28:58,480 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. 321 00:28:58,480 --> 00:29:03,020 Obviously, the user might see that, so you can use a little bit of obfuscation or encoding of that. 322 00:29:03,020 --> 00:29:05,380 You can use some URL encoding over there. 323 00:29:05,380 --> 00:29:07,900 You can encode whatever you want, a small part. 324 00:29:08,080 --> 00:29:15,580 The complete email address, you can add any parameters in there to make the URL look more legitimate, right? 325 00:29:15,580 --> 00:29:21,260 At the end, it will be very hard for the user to see that this small modification is in there, right? 326 00:29:21,260 --> 00:29:23,400 So let's look at a demonstration of that. 327 00:29:23,400 --> 00:29:28,740 So this is our attacker server where our PTA agent is running and PTA spy is running. 328 00:29:28,740 --> 00:29:32,940 So right now you can see it is installed, but there are no credentials just yet. 329 00:29:33,400 --> 00:29:35,700 So this is the victim point of view. 330 00:29:35,700 --> 00:29:38,300 They go to our phishing domain. 331 00:29:39,160 --> 00:29:41,600 Okay, they go to login.microsoft.online.com. 332 00:29:41,640 --> 00:29:52,500 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. 333 00:29:52,500 --> 00:29:56,340 After they sign in, we get their credentials in clear text, basically. 334 00:29:57,420 --> 00:29:58,080 Yes. 335 00:29:59,180 --> 00:30:00,440 All right. 336 00:30:03,960 --> 00:30:05,180 Thank you. 337 00:30:05,240 --> 00:30:08,620 But there are still a little bit of limitations to that, right? 338 00:30:08,620 --> 00:30:12,960 If you look at the previous demo, you might have seen that. 339 00:30:12,960 --> 00:30:21,760 Obviously, a wrong password can be provided by the user because PTA spy will always return a successful authentication without validating the password, right? 340 00:30:21,760 --> 00:30:23,920 So we need to take care of that. 341 00:30:23,920 --> 00:30:29,660 And the second thing is clear text passwords are nice, but they are useless if multi-factor authentication is enforced, right? 342 00:30:29,660 --> 00:30:33,540 So let's see what we can do to work with that, right? 343 00:30:33,540 --> 00:30:44,940 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. 344 00:30:44,940 --> 00:30:45,740 And what is the title? 345 00:30:45,740 --> 00:30:51,260 This is basically the area between the email address and the password field, right? 346 00:30:51,260 --> 00:31:00,460 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? 347 00:31:00,660 --> 00:31:02,600 So what will we be doing with that? 348 00:31:02,600 --> 00:31:07,580 The first time that it loads, we will, and it will request that image, we will return this image. 349 00:31:07,580 --> 00:31:14,040 Enter password, so just regularly as usual, this would be what would be shown the first time. 350 00:31:14,060 --> 00:31:21,600 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. 351 00:31:21,700 --> 00:31:22,800 Enter code. 352 00:31:22,800 --> 00:31:25,900 And now the login page would look like this, right? 353 00:31:26,040 --> 00:31:38,360 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? 354 00:31:38,560 --> 00:31:51,680 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. 355 00:31:51,680 --> 00:32:01,680 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? 356 00:32:01,680 --> 00:32:08,460 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. 357 00:32:08,460 --> 00:32:10,120 It's too big to actually show here. 358 00:32:10,120 --> 00:32:17,600 I might share that on GitHub in a while, but for now, I will just show you a little bit of snippets from this. 359 00:32:17,760 --> 00:32:21,800 And if the authentication is successful, we will return successful authentication. 360 00:32:21,800 --> 00:32:27,300 Otherwise, we'll return an error, and Microsoft will show that error, and the user will enter a new password, right? 361 00:32:27,300 --> 00:32:31,100 So how will this go in the background? 362 00:32:31,460 --> 00:32:36,940 We send a link to the user, to our sign-in page of Android ID, right? 363 00:32:36,940 --> 00:32:41,340 They will click on that, and obviously when the sign-in page loads, it will request that image. 364 00:32:41,340 --> 00:32:45,180 So the first time it loads that image from our web server, we return this image. 365 00:32:45,180 --> 00:32:54,660 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? 366 00:32:54,660 --> 00:32:58,620 At this point, we validate that password against Android ID, right? 367 00:32:58,620 --> 00:33:02,320 And if the authentication is successful, we return that. 368 00:33:02,320 --> 00:33:05,900 If it's unsuccessful, we return an error message, and they can try again, right? 369 00:33:05,900 --> 00:33:07,240 Let's assume it is successful. 370 00:33:07,240 --> 00:33:18,940 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? 371 00:33:18,940 --> 00:33:30,000 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? 372 00:33:30,000 --> 00:33:35,900 They will provide the OTP code in the password field, right, which will be forwarded to our PTA agent. 373 00:33:35,900 --> 00:33:38,240 We can validate that once again to Android ID. 374 00:33:38,240 --> 00:33:40,980 If it's unsuccessful, we can return an error once again. 375 00:33:40,980 --> 00:33:43,140 If it's successful, we compromise the user account. 376 00:33:43,140 --> 00:33:44,860 So this is the ID behind it. 377 00:33:44,860 --> 00:33:47,040 What would our sign-in URL look like? 378 00:33:47,040 --> 00:33:49,740 It's a little bit bigger, as you can see over here. 379 00:33:49,740 --> 00:34:06,920 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, 380 00:34:06,920 --> 00:34:07,140 right? 381 00:34:07,140 --> 00:34:09,660 And then the e-mail address of the user we want to target. 382 00:34:09,660 --> 00:34:14,560 And then the redirect URL will redirect the user after successful authentication once again to the login page. 383 00:34:14,560 --> 00:34:16,800 And you can see it's a little bit nested over there. 384 00:34:16,820 --> 00:34:24,300 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. 385 00:34:24,880 --> 00:34:32,180 One small note for the demo is that usually we would rewrite something like micro-auth.com authentication attempts. 386 00:34:32,180 --> 00:34:36,540 For that, we would rewrite that to Microsoft.com and validate if the credentials are valid. 387 00:34:36,540 --> 00:34:37,840 For that, I can't, right? 388 00:34:37,840 --> 00:34:45,100 Obviously, since I don't have access to a Microsoft.com domain, and I asked them, but they said no. 389 00:34:45,160 --> 00:34:49,800 I even told them, you can see my slides if you give me the account for the demo, and they said no. 390 00:34:50,120 --> 00:35:01,120 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. 391 00:35:01,120 --> 00:35:10,580 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. 392 00:35:10,640 --> 00:35:14,140 So, let's look into that. 393 00:35:15,460 --> 00:35:20,440 So, over here, we have the victim point of view in the bottom left corner. 394 00:35:20,640 --> 00:35:25,580 Everything will happen on the legitimate Microsoft login page so they will be asked to enter their password. 395 00:35:25,580 --> 00:35:31,200 If they enter an invalid password, they will receive an error message, just to show that we are actually checking for that. 396 00:35:31,200 --> 00:35:34,300 We still have the password, of course, but we know that it's invalid. 397 00:35:34,820 --> 00:35:44,820 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. 398 00:35:46,080 --> 00:35:54,580 And if they provide the correct MFA code over there, we can redirect them wherever we want, and we basically compromise the user. 399 00:35:54,580 --> 00:35:58,140 Once again, we have their access token, session cookies, anything we need. 400 00:36:03,180 --> 00:36:04,400 All right. 401 00:36:05,740 --> 00:36:11,260 So, this is nice, once again, but there's still a couple of limitations to that. 402 00:36:11,680 --> 00:36:21,280 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? 403 00:36:21,520 --> 00:36:28,660 Additionally, authenticator app notifications are a little bit more convenient in company environments, right? 404 00:36:28,660 --> 00:36:31,680 They are used quite a lot more, and they are more convenient for the user. 405 00:36:31,680 --> 00:36:35,960 So, I was looking at, okay, can we actually do something with that instead, right? 406 00:36:35,960 --> 00:36:38,740 And for that, we will actually need two Enter ID tenants. 407 00:36:38,740 --> 00:36:41,540 The first one will have the same CSS as we saw previously. 408 00:36:41,540 --> 00:36:45,120 It will only replace the hyphen with an S character, right? 409 00:36:45,120 --> 00:36:48,020 The other CSS that you saw previously, we don't use that. 410 00:36:48,200 --> 00:36:52,440 And, yeah, it's basically the main sign-in page that you saw previously, right? 411 00:36:52,480 --> 00:36:58,840 Then the second tenant, which we will redirect the user to after authentication, will have this CSS. 412 00:36:58,900 --> 00:37:04,420 And basically, what this will be doing is it will replace the complete sign-in box with an image. 413 00:37:04,420 --> 00:37:05,980 And you're thinking, okay, what image? 414 00:37:05,980 --> 00:37:08,120 An image looking something like this, right? 415 00:37:08,260 --> 00:37:14,400 Showing the two-digit code that they would need to sign in on their authenticator app, right? 416 00:37:14,400 --> 00:37:19,720 And you're thinking, okay, but how do we know in advance which specific two-digit code that the user needs to enter? 417 00:37:19,720 --> 00:37:20,740 Well, we don't know. 418 00:37:20,740 --> 00:37:25,100 So, we just generate an image for all of them, right? 419 00:37:25,100 --> 00:37:26,980 So, this took quite a while. 420 00:37:26,980 --> 00:37:30,780 So, I have 100 images ready over here. 421 00:37:30,780 --> 00:37:35,880 And basically, it doesn't matter what image or which code that Microsoft provides us. 422 00:37:35,880 --> 00:37:36,960 We can return that. 423 00:37:37,280 --> 00:37:38,820 And this is how the attack flow would go. 424 00:37:38,820 --> 00:37:47,620 So, we send a link to the user to sign into the first tenant, right, which will... 425 00:37:47,620 --> 00:37:54,520 There's not much modifications on that one, just replacing the hyphen with an S character in this specific case. 426 00:37:54,520 --> 00:37:59,400 So, you would provide their credentials, which we will capture on our PTA server. 427 00:37:59,400 --> 00:38:00,840 We can validate them. 428 00:38:00,840 --> 00:38:02,680 If there is an error, we can return that. 429 00:38:02,680 --> 00:38:05,040 If not, we return a successful authentication. 430 00:38:05,140 --> 00:38:11,240 At this point in time, we will also receive a two-digit MFA code from EnterID if MFA is set up. 431 00:38:11,240 --> 00:38:14,300 And we forward that to our web server, right? 432 00:38:14,300 --> 00:38:16,140 So, for example, 42. 433 00:38:16,140 --> 00:38:21,120 We redirect the user to now tenant two, where our different CSS is loaded. 434 00:38:21,120 --> 00:38:29,720 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? 435 00:38:29,720 --> 00:38:36,420 In the meantime, our attacker server is constantly polling, checking if the authentication already succeeded with MFA. 436 00:38:36,480 --> 00:38:38,700 The user will see the two-digit code. 437 00:38:38,700 --> 00:38:44,860 They will also look down, because they just received a notification on their phone to ask for the two-digit code. 438 00:38:44,860 --> 00:38:47,720 So, they provide that, which will be forwarded to EnterID. 439 00:38:47,720 --> 00:38:50,860 And at that point in time, we compromise the user's account. 440 00:38:50,920 --> 00:38:54,880 So, let's look at our final demo over here. 441 00:38:55,680 --> 00:39:01,960 Once again, login.microsoftonline.com with some custom properties, which you can see over there. 442 00:39:02,680 --> 00:39:07,180 And the redirect URL will just redirect them once again to the login page of the second tenant. 443 00:39:07,180 --> 00:39:09,420 So, you can see that in action over here. 444 00:39:09,420 --> 00:39:11,640 First time we enter the password. 445 00:39:13,940 --> 00:39:16,940 So, it's going to be an invalid password first time. 446 00:39:16,940 --> 00:39:20,200 So, you can see no redirection if the user enters an invalid password. 447 00:39:20,200 --> 00:39:23,140 If we take the correct password from our 448 00:39:28,180 --> 00:39:35,520 Authenticator extension or whatever, the user will be redirected to the second tenant, where this image would be shown. 449 00:39:35,520 --> 00:39:41,120 And as you can see over here, the user has entered their multi-factor authentication on their app. 450 00:39:41,120 --> 00:39:44,300 We get their access token, refresh token, and their session cookies. 451 00:39:44,300 --> 00:39:46,640 You will see they will not be redirected over here. 452 00:39:46,640 --> 00:39:49,860 So, this could be something that they will note. 453 00:39:49,860 --> 00:39:54,440 However, they are still on a legitimate Microsoft login page. 454 00:39:54,440 --> 00:39:57,040 So, it is not that suspicious, right? 455 00:39:57,820 --> 00:39:58,840 All right. 456 00:39:59,540 --> 00:40:02,260 So, for that, we would actually need two tenants. 457 00:40:02,260 --> 00:40:10,460 You can actually do something where you only use one tenant if you really want that, but then you would need to use this. 458 00:40:10,460 --> 00:40:12,400 Browser language customization. 459 00:40:12,400 --> 00:40:19,460 And what this allows you to do is specify custom tenant branding for a specific language, right? 460 00:40:19,460 --> 00:40:25,760 So, for each language, you could load a custom CSS file, which would allow us to, for example, do something like this. 461 00:40:26,120 --> 00:40:29,640 By default, in any language, it would return the normal login page. 462 00:40:29,640 --> 00:40:33,880 If the language is set to French, for example, we return the MFA prompt. 463 00:40:33,880 --> 00:40:40,260 And we can actually modify which language is used with this parameter, this LC parameter. 464 00:40:40,260 --> 00:40:44,880 We provide an ID over there for French, for example, and then it would load the login page, right? 465 00:40:44,880 --> 00:40:48,600 So, this would allow you to do this exact same attack with only one EnterID tenant. 466 00:40:48,600 --> 00:40:51,620 However, you will note one slight difference. 467 00:40:51,680 --> 00:40:55,840 If you change the language, it would also change the language and the page title. 468 00:40:56,300 --> 00:41:06,420 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? 469 00:41:07,000 --> 00:41:10,560 So, to summarize, I showed about eight techniques. 470 00:41:10,560 --> 00:41:13,620 The OpenRedirect ones, I went over them fairly quickly. 471 00:41:13,620 --> 00:41:21,420 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. 472 00:41:21,980 --> 00:41:23,900 So, you will be able to see that still. 473 00:41:23,900 --> 00:41:33,420 Four of these techniques, we can actually be using or staying completely within the legitimate login.microsoftonline.com domain, right? 474 00:41:33,420 --> 00:41:38,820 Without going anywhere else, and a couple of them will also bypass multi-factor authentication, right? 475 00:41:38,820 --> 00:41:45,340 So, to summarize, login.microsoftonline.com is a free redirector for phishing pages. 476 00:41:45,340 --> 00:41:48,620 It can serve any image as it is imaged, right? 477 00:41:48,620 --> 00:41:53,900 So, if you want to host cat memes on Microsoft's login page, you can do that if you want, right? 478 00:41:53,900 --> 00:42:01,760 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? 479 00:42:02,100 --> 00:42:06,240 Some references over here from, obviously, Dr. 480 00:42:06,240 --> 00:42:17,880 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. 481 00:42:18,220 --> 00:42:26,920 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. 482 00:42:27,280 --> 00:42:30,800 If you have any questions, feel free to come ask me after the session. 483 00:42:30,800 --> 00:42:32,660 I will reach out to me on my socials. 484 00:42:32,660 --> 00:42:33,980 You can see that over here. 485 00:42:33,980 --> 00:42:43,040 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. 486 00:42:43,040 --> 00:42:50,140 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. 487 00:42:50,200 --> 00:42:52,280 So, yeah, thank you so much.