1 00:00:00,960 --> 00:00:03,080 Welcome. We're going to be talking about some email stuff today. 2 00:00:04,440 --> 00:00:07,180 A couple of disclaimers. There's going to be a number of disclaimers throughout the talk. 3 00:00:07,620 --> 00:00:12,260 First two tend to curse a lot during presentations. I'm going to try to curb it to an absolute 4 00:00:12,260 --> 00:00:17,940 minimum because I know it can be annoying. Number two is I'm going to be going very fast 5 00:00:17,940 --> 00:00:22,620 throughout these slides, so just bear with me. I have a lot of content. It was really hard to 6 00:00:22,620 --> 00:00:29,060 push this to 80 slides in 45 minutes, but unfortunately, because of the timeline and 7 00:00:29,060 --> 00:00:35,160 everything, it was almost impossible. Really quickly, who am I? My name is Marcello. I go by 8 00:00:35,160 --> 00:00:39,640 Bipe Leader a little bit everywhere. I'm an open source developer, researcher, engineer. I like to 9 00:00:39,640 --> 00:00:45,060 call myself an Infinity Stones teamer because I collected all the colors. And hey, fresh off the 10 00:00:45,060 --> 00:00:49,200 press, I'm looking for a new gig, so if you're hiring, come grab me after the talk. Even if 11 00:00:49,200 --> 00:00:52,760 you're not hiring, come grab me after the talk and chat. I'm a friendly guy. I like talking to 12 00:00:52,760 --> 00:00:58,540 people. Second, this third disclaimer, rather, please don't do crimes. 13 00:00:59,940 --> 00:01:04,260 This is going to be apparent when I'm saying this towards the end of the talk, but you're just 14 00:01:04,260 --> 00:01:11,040 going to get in trouble. And yeah, please don't. I know doing that here is like going to a heroin 15 00:01:11,040 --> 00:01:18,320 convention and asking them not to do heroin, but, you know, just please don't. So how did this 16 00:01:18,320 --> 00:01:23,620 all get started? I just wanted to send an e-mail, programmatically and through a Cloudflare 17 00:01:23,620 --> 00:01:29,040 worker. If you're asking yourself why through a Cloudflare worker, it's because I backed myself in 18 00:01:29,060 --> 00:01:32,880 a corner from a tech stack perspective. I had no other option. I built this entire backend 19 00:01:32,880 --> 00:01:37,240 website using Cloudflare workers because I wanted to be the hip person, you know, using the latest 20 00:01:37,240 --> 00:01:42,120 stuff. And if you're not familiar with Cloudflare workers, they're like sort of akin to AWS 21 00:01:42,120 --> 00:01:48,660 Lambdas, so it's a serverless computing platform. And it's a little bit edgy, though, in the sense 22 00:01:48,660 --> 00:01:53,060 that, like, there's a twist to the Cloudflare solution, which is, like, they take your code and 23 00:01:53,060 --> 00:01:57,100 they distribute it automatically throughout their CDN, so it's always, like, the person hitting your 24 00:01:57,100 --> 00:01:59,040 service is always latency-optimized. Like, you know, it's always, like, you know, it's always, like, 25 00:01:59,060 --> 00:02:04,700 geographically to where you're trying to hit the service. And you can also only write them in 26 00:02:04,700 --> 00:02:09,600 JavaScript, TypeScript, and anything that emits WebAssembly, so they're also slightly depressed as 27 00:02:09,600 --> 00:02:18,640 well because they can only be living in TypeScript land. This is basically how you start out with 28 00:02:18,640 --> 00:02:23,480 Cloudflare workers. You basically just run a command, creates a directory structure, then 29 00:02:23,480 --> 00:02:28,780 Cloudflare provides a tool called Wrangler that automatically, like, you can use it to manage and 30 00:02:28,780 --> 00:02:33,640 upload your Wrangler and your worker code. And then your worker code is just automatically 31 00:02:33,640 --> 00:02:39,760 available at an HTTPS-enabled URL that everybody can access. And the main takeaway here is that, by 32 00:02:39,760 --> 00:02:44,620 default, the worker code is public because, like, that's the whole point. Like, people need one and 33 00:02:44,620 --> 00:02:52,100 access your service so they can use it, right? So just for some context here, this is, like, you know, 34 00:02:52,100 --> 00:02:56,560 imagine, like, 1 a.m., you know, I'm just trying to work on this freaking website. I want to go to 35 00:02:56,560 --> 00:02:58,540 bed so I can actually get to my day job, you know? 36 00:02:59,000 --> 00:03:07,920 It's late, maybe even a little drunk. And I just need this website backend to send an email, right? So I'm just 37 00:03:07,920 --> 00:03:14,140 drunkenly, like, Googling, you know, send email Cloudflare workers. And I stumble across this blog post from 38 00:03:14,140 --> 00:03:17,940 Cloudflare. It's like, send email using workers with something called mail channels. I've never heard of 39 00:03:17,940 --> 00:03:22,760 whatever mail channels is, but at the time I didn't care. Hey, it's got code. Great. Copy-paste this thing 40 00:03:22,760 --> 00:03:28,760 into my worker. Works. First try. And we'll go back to that code in a second. But it's, like, you know, it's, like, 41 00:03:28,760 --> 00:03:34,520 it works first try, which in hindsight, red flag. Nothing really ever works first try. But, hey, I get an 42 00:03:34,520 --> 00:03:39,500 email, and it goes to my spam inbox, which is somewhat normal, I think, right? Because I didn't set up any 43 00:03:39,500 --> 00:03:45,420 email security stuff, which I had very little about at the time. But, yeah, hey. So I leave this 44 00:03:45,420 --> 00:03:52,300 behind, like, come back a couple days later, and I see that there was an open browser tab, like, 45 00:03:52,320 --> 00:03:55,880 throughout the gazillions that I had open from when I was working on this a couple days ago, where 46 00:03:55,880 --> 00:03:58,740 there's this person asking on the Cloudflare community forum, like, hey, can I get an email from 47 00:03:58,740 --> 00:04:05,360 you? Or I'm saying, hey, so, like, if I use this feature, this mail channels thing, like, doesn't 48 00:04:05,360 --> 00:04:10,820 this allow anybody to impersonate my domain and send emails from my domain? And I'm, like, why, as 49 00:04:10,820 --> 00:04:15,360 the kids say, that's pretty sus, right? Why are you even asking that? Like, that's a weird 50 00:04:15,360 --> 00:04:19,820 question to be asking just randomly out of the blue. And then there's a mail channels person, and 51 00:04:19,820 --> 00:04:23,920 they're saying, yeah, this is just how the email works, though. So, like, you know, there's 52 00:04:23,920 --> 00:04:28,360 nothing really going to do about it. Which, at this point, I'm completely nerd sniped. So I just 53 00:04:28,360 --> 00:04:32,460 keep Googling, like, what's going on with this mail channels thing. I've never heard of this before. 54 00:04:32,980 --> 00:04:38,960 And a bunch of people asking a little bit all over the place, hey, like, can't people just impersonate 55 00:04:38,960 --> 00:04:41,920 my domain with this? And I'm, like, okay, well, what's going on? And then there's this guy on 56 00:04:41,920 --> 00:04:46,220 Reddit that's, like, hey, like, asks a really important question, because I didn't even think of 57 00:04:46,220 --> 00:04:51,400 this. Like, why is this free? Like, why aren't you monetizing this? Like, this seems weird. Like, 58 00:04:51,440 --> 00:04:54,720 you're just allowing people to send emails for free? And they're, like, yeah, no, no, no, we 59 00:04:55,200 --> 00:04:58,000 don't care about the money, right? We just care. 60 00:04:58,360 --> 00:05:06,520 about sending an email. It's fine. So they just went full joker. So I'm, like, okay, let me just 61 00:05:06,520 --> 00:05:11,560 go back to the code that I just, like, in my sleepless stupor just copy-pasted into my worker 62 00:05:11,560 --> 00:05:16,700 code. And I stare at this for, like, a good two minutes. And for those of you not TypeScript 63 00:05:16,700 --> 00:05:21,980 inclined, first off, I envy you. Second off, basically all this is doing is just sending an 64 00:05:21,980 --> 00:05:27,800 HTTP post request to some mail channels API, right, with the contents of the email that you 65 00:05:27,800 --> 00:05:28,180 want to send. 66 00:05:28,360 --> 00:05:32,640 Right? And if you stare at this for a while, you're, like, wait a second. There's no 67 00:05:32,640 --> 00:05:38,840 authentication here, right? Like, there's no, like, username and passwords or, like, API key in 68 00:05:38,840 --> 00:05:44,260 this shit, right? There's nothing. So that's really weird. So I dig a little more. And it 69 00:05:44,260 --> 00:05:49,800 turns out the Cloud Flares and Mail Channels partnership entailed Mail Channels creating this 70 00:05:49,800 --> 00:05:56,300 API, no auth required. However, the twist is that it's only allow listed at the network level to 71 00:05:56,300 --> 00:05:57,280 Cloud Flare ISP space. 72 00:05:57,400 --> 00:05:58,320 So you'll only be able to hit the 73 00:05:58,360 --> 00:06:03,560 API if you come from a Cloud Flare IP. Well, anybody on the internet can just create a Cloud Flare 74 00:06:03,560 --> 00:06:10,260 account for free and hit this API. So, you know, just, like, connecting the dots at, like, 1 a.m. 75 00:06:10,260 --> 00:06:14,540 in the morning here, it's, like, okay, so is this, like, I just need to create a Cloud Flare 76 00:06:14,540 --> 00:06:17,660 account, which I already did. I just uploaded the worker code, which I already did. And then you 77 00:06:17,660 --> 00:06:22,840 could just send emails through Mail Channels for real. And, yeah, that's basically how it works, 78 00:06:22,900 --> 00:06:27,760 which is really weird. And then there was this other user in the same community forum after all, 79 00:06:27,800 --> 00:06:28,260 like, this. 80 00:06:28,360 --> 00:06:32,820 Snarky comments also asking the same issue about work impersonation, which I still don't, like, 81 00:06:32,860 --> 00:06:38,140 understand at that point. And the person's, like, hey, so I created, like, a Cloud Flare worker that 82 00:06:38,140 --> 00:06:42,300 demonstrates this capability, right? This demonstrates this partnership between Cloud Flare 83 00:06:42,300 --> 00:06:45,960 and Mail Channels. And it's just an HTML form where you just put in the contents of the email, 84 00:06:46,140 --> 00:06:52,360 right? It's publicly available. I blacked out the URL because I don't want you guys running up this 85 00:06:52,360 --> 00:06:58,080 person's Cloud Flare bill. But it's publicly available and you just put in, oh, sorry. It's 86 00:06:58,080 --> 00:06:58,340 publicly available. And then you just put in the contents of the email. And then you just put in the 87 00:06:58,360 --> 00:07:03,400 contents of the email. And then you just put in the contents of the email. And you just submit. And you 88 00:07:03,400 --> 00:07:08,600 send the email, which, okay. And I'm, like, okay, for testing purposes, this is fantastic. And I guess 89 00:07:08,600 --> 00:07:13,460 since I'm completely nerd sniped at this point, I'm just going to, like, what's the first three or 90 00:07:13,460 --> 00:07:17,640 four test cases that I can think of in order to possibly figure out, like, what these other people 91 00:07:17,640 --> 00:07:21,660 are talking about in terms of impersonation? So test case number one, what happens if I just, like, 92 00:07:21,680 --> 00:07:27,340 put a domain that doesn't exist in the HTML form of the worker? 93 00:07:27,340 --> 00:07:34,660 So I put in as a sender test.waterhogger.com, which is a domain that didn't exist at the time. And I get an 94 00:07:34,660 --> 00:07:39,800 error back saying, hey, failed to send email because the domain doesn't exist dummy, which, yeah, makes 95 00:07:39,800 --> 00:07:45,460 sense. If this worked, that would be completely foobar, right? And then how about a domain that does 96 00:07:45,460 --> 00:07:51,080 exist but I don't control? So as the sender, then I put in test.example.com. And it gives me back null. 97 00:07:51,740 --> 00:07:55,140 Yay. I don't know what null means, but it turns out null means it works. 98 00:07:58,540 --> 00:08:03,920 So, and I got the email, right? But it goes to spam again, which is normal because I don't control the 99 00:08:03,920 --> 00:08:08,260 domain. So I'm like, okay, this seems completely normal. What are these people talking about with 100 00:08:08,260 --> 00:08:11,960 impersonation? And I don't know much about email security, but I look up the headers and they're 101 00:08:11,960 --> 00:08:16,100 like, yeah, it's fail, soft fail, everything's bad, like, go back, whatever you're doing, stop doing 102 00:08:16,100 --> 00:08:22,180 it. But test case three, I'm like, okay, what's the next logical step? What happens out of sheer 103 00:08:22,180 --> 00:08:26,740 curiosity if I use a domain that actually uses this thing called mail channels, which I still don't 104 00:08:26,740 --> 00:08:31,280 know what the hell it is at this point, right? So I just Google, okay, websites that use mail 105 00:08:31,280 --> 00:08:35,740 channels. And at this point, I'm just thinking, you know, I've never heard of this. This must be 106 00:08:35,740 --> 00:08:40,500 like some bottom of the barrel email service that maybe like your grandma used in the 1980s or 107 00:08:40,500 --> 00:08:45,640 something, right? Nobody, maybe like a thousand people use this, if not less. Nope, nope, nope, 108 00:08:45,740 --> 00:08:51,180 nope, nope, nope. So 2 million somewhat domains, at least according to builtwith.com, 109 00:08:52,160 --> 00:08:56,240 which is a site that like aggregates technology that a bunch of like websites use and stuff. 110 00:08:56,760 --> 00:09:02,440 And this might be a little small there, but there's a some, some, a few heavy hitters in terms of 111 00:09:02,440 --> 00:09:08,380 people who use this mail channel service is like boston.gov. There's notepad++.org, which is really 112 00:09:08,380 --> 00:09:13,460 funny. There's, and then everything else, though, is more like just random ass websites that host 113 00:09:13,460 --> 00:09:17,260 everything and everything. And I really like builtwith.com because, you know, if you were like 114 00:09:17,260 --> 00:09:23,020 someone trying to target people, the filter, you know, mail channels, websites with estimated sales 115 00:09:23,020 --> 00:09:26,720 revenue over $1 million, just really just preem stuff, right? And I think that's a really good 116 00:09:26,740 --> 00:09:30,640 example right there. Turns out I didn't even need to do this because mail channels also has a list 117 00:09:30,640 --> 00:09:36,700 of all their customers on the website. Yay. So then I'm like, okay, so then I go back to the worker 118 00:09:36,700 --> 00:09:41,160 and I put in like, you know, lobsters at boston.gov, because boston.gov was the one that popped 119 00:09:41,160 --> 00:09:47,780 out and, you know, go big or go home. Yeah. And it goes straight to my inbox. No, doesn't pass go, 120 00:09:47,960 --> 00:09:52,680 doesn't collect $200, just goes straight into my inbox. And on top of that, if you take a look at 121 00:09:52,680 --> 00:09:56,720 the headers, SPF and DMARC both passed. Okay. So I'm like, oh, that's a good thing. So I'm like, 122 00:09:56,720 --> 00:10:01,040 okay. And just to be clear at this point, I'm like, like this is a worker publicly available, 123 00:10:01,180 --> 00:10:04,120 just on random on the internet that anyone can hit. They could just put in the details of the 124 00:10:04,120 --> 00:10:09,000 email and they'll just be able to spoof any of these, those mains. And then I, so I try 125 00:10:09,000 --> 00:10:16,680 another, like how about minus at notepad++.org, right? That's, yeah. So, and then I try another, 126 00:10:16,820 --> 00:10:21,000 same deal, like goes to my inbox and another and another and another. There's a lot of humorous 127 00:10:21,000 --> 00:10:25,720 websites. You can, you can pull from buildwith.com about this. And yeah, they all land in my 128 00:10:25,720 --> 00:10:25,980 inbox. 129 00:10:26,760 --> 00:10:31,180 So at this point, I'm like, okay, this is obviously a problem, but what the hell is Mail 130 00:10:31,180 --> 00:10:36,600 Channels? I've been, I've been using this thing for like at least a few hours now. I still don't 131 00:10:36,600 --> 00:10:42,700 know like the who. I know the how, I guess, but not the who. So it turns out, surprise, 132 00:10:42,780 --> 00:10:48,200 surprise, Mail Channels is an email transactional service. And, and just to be on the same 133 00:10:48,200 --> 00:10:51,840 page, transactional email is like your automated emails. So like these are emails going from 134 00:10:51,840 --> 00:10:56,640 robot to human. So like your password resets, your notifications, your emails, new, new 135 00:10:56,720 --> 00:11:02,300 newsletters, that kind of stuff. But what was really weird and just like really confusing at the 136 00:11:02,300 --> 00:11:06,920 time is that also they're sort of like almost like a cybersecurity company. Well, at least like 137 00:11:06,920 --> 00:11:10,740 they're trying to market that, yeah, we're an email transaction service, but we also stop, you 138 00:11:10,740 --> 00:11:15,820 know, the bad hackers with the spam and stuff, which is very ironic because, you know, the 139 00:11:15,820 --> 00:11:23,120 boston.gov email tends to prove otherwise. But, you know, you find out too that when you start 140 00:11:23,120 --> 00:11:27,480 digging into the Mail Channels website, it's its own little microcosm, you know, like it's like a 141 00:11:27,480 --> 00:11:31,200 multi-universe of things that you never really thought could be possible. Like you got people 142 00:11:31,200 --> 00:11:36,660 putting like RDP credentials in the comment sections of blog posts. You know, like it's its 143 00:11:36,660 --> 00:11:41,900 own little universe of things that you never knew could be possible. And, and it turns out, 144 00:11:41,920 --> 00:11:46,080 Mail Channels, I was the ignorant one because it turns out Mail Channels is the biggest player in 145 00:11:46,080 --> 00:11:51,620 the email transactional space. It's got 42% of the market share and it's got double, more than 146 00:11:51,620 --> 00:11:52,580 double the amount of domains. 147 00:11:52,760 --> 00:11:53,100 Yeah. 148 00:11:53,120 --> 00:11:57,640 Or clients rather than like SendGrid, Mailgun, and all the ones that I knew that I've 149 00:11:57,640 --> 00:12:02,320 heard of before. But Mail Channels turns out to be double, more than double the bit like 150 00:12:02,320 --> 00:12:07,940 SendGrid, for example. So at this point, like, I'm like, okay, how is this possible? I know 151 00:12:07,940 --> 00:12:12,260 some of the basics and just so we're on the same page, like SPF. So sender policy framework. 152 00:12:13,540 --> 00:12:16,820 This, what you got to know is that in every email there's like two from fields. There's one 153 00:12:16,820 --> 00:12:22,720 in the SMTP, at the SMTP level and the one that the user sees in the actual email. So SPF aka 154 00:12:22,720 --> 00:12:28,020 sender policy framework allows you to set a security control on the front field in SMTP. So the one 155 00:12:28,020 --> 00:12:32,680 that the user doesn't see. And it basically just allows you to say, hey, these are the IPs and 156 00:12:32,680 --> 00:12:37,820 host names that are allowed to send email on behalf of my domain. Okay? So this is what it 157 00:12:37,820 --> 00:12:43,120 looks like in practice. It might be a little small, but that's the SPF record of like 158 00:12:43,120 --> 00:12:47,920 Boston.gov. And there's a bunch of IPs that basically are saying, hey, these IPs are allowed 159 00:12:47,920 --> 00:12:52,380 to send emails on behalf of my domain. But there's also a include statement that includes 160 00:12:52,380 --> 00:12:56,640 relay.mailchannels.net, which I'm like, okay, that kind of makes sense because like, you know, 161 00:12:56,660 --> 00:13:02,160 they use mail channels, right? And then I try another SPF of another domain that builtwith.com 162 00:13:02,160 --> 00:13:07,220 said uses it. Same deal. Always had that include statement with relay.mailchannels.net. Try a few 163 00:13:07,220 --> 00:13:11,780 others, same thing. And lo and behold, turns out like that's part of the setup process of using 164 00:13:11,780 --> 00:13:16,040 this mail channel service that they tell people to put this include statement in their SPF in 165 00:13:16,040 --> 00:13:22,200 order to use their service. But the thing is, if you start thinking about it, right, that also 166 00:13:22,200 --> 00:13:28,840 means that all their customers can spoof each other. Because if like they all have the same SPF, 167 00:13:28,860 --> 00:13:33,380 that means all of the other domains that have the same SPF record are authorized to send on behalf 168 00:13:33,380 --> 00:13:38,220 of each other, right? And couple that with this Cloudflare worker thing, all of a sudden, like 169 00:13:38,220 --> 00:13:42,240 it's almost like an open relay situation where like anybody can just go to the Cloudflare worker 170 00:13:42,240 --> 00:13:47,900 URL and just put in the emails, the email details that they want to see and bam, you can just spoof 171 00:13:47,900 --> 00:13:51,460 their emails. And I'm like, okay, there's no way, like this is a little bit too simple. Like how is 172 00:13:52,440 --> 00:13:56,400 this going to work? And it turns out people like back in 2016 were already saying, like doing the 173 00:13:56,400 --> 00:14:02,340 same calculations like I was doing. I'm like, hey, so if like website A is using mail channels and 174 00:14:02,340 --> 00:14:09,360 website B has the same SPF record, like can't they spoof each other? And again, mail channels in 175 00:14:09,360 --> 00:14:13,340 the comments section, they're like, yeah, so wait, gee, the great thing about using us is you just 176 00:14:13,340 --> 00:14:21,160 call us and we'll stop the spammer. So and again, like I don't want to misrepresent, I mean, this 177 00:14:21,160 --> 00:14:22,180 might be there. I mean, this might be there. I mean, this might be there. I mean, this might be 178 00:14:22,200 --> 00:14:26,200 there. This was 2016. So they might have some other stuff. But you know, this is like, this is a 179 00:14:26,200 --> 00:14:30,640 fine, this is fine situation, you know, in my head going off here. So I'm like, okay, these guys 180 00:14:30,640 --> 00:14:34,780 obviously know about this, because like, people were complaining about it since like 2016. But 181 00:14:34,780 --> 00:14:38,280 I'm just gonna email them, they had no official vulnerability reporting channel, I'm just gonna 182 00:14:38,280 --> 00:14:43,420 email him saying, hey, I found some stuff, whatever. And I emailed him. And within two minutes, 183 00:14:43,500 --> 00:14:50,220 the CEO replies to me, like this guy had this email and speed dial, like it was crazy. I thought 184 00:14:53,100 --> 00:14:56,480 And he was like, yeah, so you're probably talking about the SPF issue, right? 185 00:14:56,560 --> 00:14:57,600 Yeah, no, we know about that. 186 00:14:57,940 --> 00:15:01,100 We don't consider that a vulnerability or an issue whatsoever. 187 00:15:01,520 --> 00:15:06,240 And I emailed him about, okay, but you got the Cloudflare worker thing now. 188 00:15:06,340 --> 00:15:09,720 Don't you think that requires a little bit of a different kind of thinking, 189 00:15:09,840 --> 00:15:10,700 like at least mitigate that? 190 00:15:10,840 --> 00:15:12,980 And they're like, no, and radio silence after that. 191 00:15:13,560 --> 00:15:14,520 There was no response. 192 00:15:15,580 --> 00:15:19,180 And at that point, I'm also questioning myself because it's like, wow, okay, 193 00:15:19,220 --> 00:15:20,600 this guy seemed very assertive. 194 00:15:20,600 --> 00:15:22,800 Am I the idiot here? 195 00:15:22,980 --> 00:15:25,720 Is this just how these services work? 196 00:15:26,100 --> 00:15:27,000 But it turns out, no. 197 00:15:28,840 --> 00:15:33,160 Other people, other companies like Sangre and Mailgun have a bunch of stuff 198 00:15:33,160 --> 00:15:37,040 that solves this situation completely, and especially regarding the SPF headers. 199 00:15:37,400 --> 00:15:40,420 So there's sender identity verification, which is basically like what you do 200 00:15:40,420 --> 00:15:43,180 with Let's Encrypt certificates to prove domain ownership. 201 00:15:43,460 --> 00:15:47,240 You have dedicated sending IPs, which allows you to actually put unique SPF records 202 00:15:47,840 --> 00:15:50,580 in your DNS technology. 203 00:15:51,280 --> 00:15:52,420 And then you have the API authentication, which allows you to verify your domain 204 00:15:52,420 --> 00:15:55,720 and then you have the actual authentication on their API, which ties back the verified domains 205 00:15:55,720 --> 00:15:59,660 when you actually try to send an email through the service, right? 206 00:15:59,780 --> 00:16:03,400 And this is what, like, if you try to do the same thing with SendGrid, for example, 207 00:16:04,100 --> 00:16:06,480 you basically, like, you put in the API key. 208 00:16:06,700 --> 00:16:08,560 You have to first verify you own a domain. 209 00:16:08,760 --> 00:16:12,920 But if you try to send an email from a domain that you haven't verified you own, 210 00:16:13,080 --> 00:16:15,480 it just says, get out of here, bucko. 211 00:16:15,580 --> 00:16:17,700 Like, you're not, this is not how this works. 212 00:16:17,800 --> 00:16:18,760 Like, stop doing this. 213 00:16:19,040 --> 00:16:20,140 You're not allowed to do it. 214 00:16:20,600 --> 00:16:23,360 So at this point, I'm like, okay, I need a bigger picture and I don't understand stuff. 215 00:16:23,600 --> 00:16:28,280 And I heard, like, through just random research that there's this thing called Project Sonar 216 00:16:28,280 --> 00:16:33,540 from Rapid7, and they aggregate internet-wide data regarding, like, HTTP, DNS, and stuff. 217 00:16:33,760 --> 00:16:39,100 So I hit them up in order to get access to this database in order to, like, check, 218 00:16:39,600 --> 00:16:43,880 like, check all these assumptions of, like, hey, are two million domains actually using this? 219 00:16:43,940 --> 00:16:48,660 Like, what's the, like, and other very important information if we want to go forward with this. 220 00:16:49,020 --> 00:16:50,000 And so I hit them up. 221 00:16:50,000 --> 00:16:50,580 They give me access. 222 00:16:50,700 --> 00:16:54,540 And not only do they give me access, they're like, hey, yeah, we're going to help you with this because this is really weird. 223 00:16:55,020 --> 00:16:57,200 So shout out to these people over at Rapid7. 224 00:16:57,540 --> 00:17:01,560 There were a few that I think don't work there anymore, but they used to work at a time. 225 00:17:01,700 --> 00:17:02,760 So shout out to them. 226 00:17:03,840 --> 00:17:07,240 And once we start digging through data, it turns out builtwith.com is accurate. 227 00:17:07,920 --> 00:17:12,880 And there are around 2,200,000 domains as of January 2023 that usually use mail channels. 228 00:17:13,080 --> 00:17:18,180 And at this point, Rapid7 reaches out to them as well as part of the standard vulnerability disclosure process. 229 00:17:18,320 --> 00:17:19,480 And they're like, hey. 230 00:17:20,000 --> 00:17:21,700 Like, you know, we're working with Marcello now. 231 00:17:21,880 --> 00:17:27,620 And the CEO, again, replies in two minutes saying, so we don't consider this SPF thing an issue. 232 00:17:28,100 --> 00:17:31,820 But this is the piece of the puzzle that we are missing here. 233 00:17:32,140 --> 00:17:38,980 Most of our clients are web hosting providers that don't necessarily own the domains that they send e-mails from. 234 00:17:39,680 --> 00:17:40,200 Okay? 235 00:17:40,440 --> 00:17:42,040 So it's a feature. 236 00:17:43,640 --> 00:17:49,020 So what you have to understand is that apparently there's a niche market out there for, 237 00:17:50,000 --> 00:17:52,860 like, web hosting providers to send e-mails on behalf of their clients. 238 00:17:53,040 --> 00:17:56,320 And mail channels is, like, sort of like a middleman in order to do that. 239 00:17:56,440 --> 00:17:58,480 So it's a feature, not a bug. 240 00:17:58,640 --> 00:18:03,260 So it turns out you're probably asking yourself, well, how do they stop this from being, like, Wild West? 241 00:18:03,440 --> 00:18:08,740 Well, mail channels has a bunch of, like, compensating controls, at least, you know, according to them, 242 00:18:08,800 --> 00:18:12,700 that they do, like, signature checking, math, statistics, trends, IP domain reputation. 243 00:18:13,200 --> 00:18:18,140 They also analyze the e-mail responses from people that, like, receive the e-mails. 244 00:18:18,140 --> 00:18:22,160 So, like, if that means, I don't know if that means, like, if I just tell someone to fuck off, do they block them? 245 00:18:22,300 --> 00:18:22,920 Like, I don't know. 246 00:18:23,460 --> 00:18:25,560 In the reply, like, I'm not sure how that works. 247 00:18:25,980 --> 00:18:27,980 But they also do, like, OCR stuff. 248 00:18:28,220 --> 00:18:28,940 But, okay, fine. 249 00:18:29,100 --> 00:18:35,060 I couldn't really tell you how good these compensating controls are because in none of our testing, like, none of the e-mails were blocked. 250 00:18:35,420 --> 00:18:41,200 We probably sent, like, a hundred domains between me and Rapid, a hundred e-mails between me and Rapid7, and none of them were blocked. 251 00:18:41,980 --> 00:18:47,080 That being said, it was, our e-mails were clearly labeled as test, right? 252 00:18:47,240 --> 00:18:48,120 So this was a test. 253 00:18:48,140 --> 00:18:49,560 I don't want to misrepresent things. 254 00:18:49,680 --> 00:18:53,140 However, I did try to send myself, like, legit phishing e-mails, and they weren't blocked. 255 00:18:53,260 --> 00:18:53,940 So I don't know. 256 00:18:54,860 --> 00:18:57,000 But then he says something very interesting. 257 00:18:57,160 --> 00:19:03,580 He says, domain owners are welcome to secure their domain against impersonation by signing messages with DKIM and setting up an appropriate DMARC policy. 258 00:19:04,460 --> 00:19:11,660 So the MailChannels is basically saying, yeah, I mean, we have this SPF issue, but you just set up a DMARC record in DKIM, and you're fine. 259 00:19:11,780 --> 00:19:12,760 Nobody can impersonate you. 260 00:19:12,860 --> 00:19:14,140 But here's the thing. 261 00:19:14,180 --> 00:19:15,600 Remember that Boston.gov e-mail? 262 00:19:16,140 --> 00:19:18,120 SPF passed, but also DMARC. 263 00:19:18,140 --> 00:19:18,980 DMARC was passing as well. 264 00:19:19,260 --> 00:19:21,620 So, like, what the hell is that all about? 265 00:19:21,940 --> 00:19:27,100 So DMARC really quickly is a way of putting a security control on the from field that the user does see. 266 00:19:27,220 --> 00:19:39,300 So when we're talking about DMARC alignment, we're talking about, hey, does the from field that the user does see match the from field in SMTP, and does it match also any domain sent with any DKIM signature, right? 267 00:19:39,400 --> 00:19:41,540 So that's when we talk about DMARC alignment. 268 00:19:42,580 --> 00:19:47,700 And in order to, like, test if DMARC does actually stop impersonation from this. 269 00:19:48,140 --> 00:19:57,320 We had to grab a bunch of, like, MailChannels customers' domains that had DMARC set up and DKIM set up, right, in order to test that. 270 00:19:57,880 --> 00:20:05,280 So it turns out out of the 2 million domains using MailChannels, only 407 actually have any DMARC record whatsoever, right? 271 00:20:05,400 --> 00:20:09,300 And out of that, only 105 actually use DKIM. 272 00:20:09,360 --> 00:20:14,660 So this whole encouraging customers to do the right thing is definitely, like, it needs a little bit more encouragement, if you ask me. 273 00:20:16,080 --> 00:20:17,920 So test case number four, right? 274 00:20:18,140 --> 00:20:19,320 So this is, like, the obvious next step. 275 00:20:19,440 --> 00:20:25,820 It's like, okay, let's try to spoof an email from a domain that does use MailChannels, right, in their SPF, but also has DMARC and DKIM set up. 276 00:20:26,220 --> 00:20:30,200 Gits.com, I don't know what the hell this is, but they are serious about email. 277 00:20:30,840 --> 00:20:38,640 They are using MailChannels, but they have DMARC set to strict mode in regards to DKIM alignment and their SPF record. 278 00:20:38,820 --> 00:20:47,240 So what this means is basically if the from field doesn't match, right, the one that the user sees in the email, that doesn't match the one in SMTP and doesn't match the one in DKIM signature, 279 00:20:47,480 --> 00:20:48,120 it just rejects the email. 280 00:20:48,140 --> 00:20:50,960 Like, the end person doesn't even get the email at all. 281 00:20:51,040 --> 00:20:53,460 So this is, like, very serious about email stuff. 282 00:20:54,000 --> 00:20:56,540 So, you know, gits.com, and it goes straight to inbox. 283 00:20:56,740 --> 00:21:02,100 So at this point, we're like, okay, I don't know what's going on here. 284 00:21:02,260 --> 00:21:10,020 And it turns out that DMARC and DKIM don't really actually fix this because DMARC passes if SPF or DKIM passes. 285 00:21:10,140 --> 00:21:11,900 The or is the important part there. 286 00:21:12,480 --> 00:21:15,780 As long as you pass SPF, you're also guaranteed to parse DMARC. 287 00:21:15,880 --> 00:21:17,600 Like, that's the gist here. 288 00:21:18,140 --> 00:21:26,000 And there's no actual proper way to tell receivers to strictly enforce DKIM, apparently, at least from what we understand. 289 00:21:26,500 --> 00:21:32,580 So in summary, you're also guaranteed to pass DMARC by using the CloudFlare worker that uses mail channels. 290 00:21:32,840 --> 00:21:38,260 And we verified this really quickly as well through MailTester because if you just send the email through MailTester, 291 00:21:38,380 --> 00:21:44,480 which is a service that actually tests the delivery, like, the chances of delivery of your email, right, 292 00:21:44,540 --> 00:21:47,680 you can see, hey, DMARC passed, SPF passed, and we get a 9 out of 10. 293 00:21:48,140 --> 00:21:50,100 So, like, this is, you know, we're good to go here. 294 00:21:50,220 --> 00:21:51,220 There's no problems here. 295 00:21:51,380 --> 00:21:57,200 We get docked a point for missing DKIM signature, but, like, it'll still hit the inbox. 296 00:21:57,600 --> 00:22:05,200 And at this point, you're probably wondering, but wait, like, what could there possibly else be? 297 00:22:05,380 --> 00:22:06,900 And, yeah, I'm here to tell you, yeah, there's more. 298 00:22:07,000 --> 00:22:07,340 Hold on. 299 00:22:08,720 --> 00:22:15,300 So we, while analyzing the emails, we found a bunch of ARC stuff. 300 00:22:15,580 --> 00:22:17,140 And we weren't really sure what this was. 301 00:22:18,140 --> 00:22:19,140 We had a bunch of headers before in an email. 302 00:22:19,840 --> 00:22:24,000 We, there was, like, ARC seal, ARC message signature, ARC authentication results. 303 00:22:24,300 --> 00:22:26,560 And we were, like, wondering, what is this? 304 00:22:26,700 --> 00:22:28,360 Like, I've never seen this before. 305 00:22:28,740 --> 00:22:31,780 So let me introduce you to authenticated receive chain. 306 00:22:32,320 --> 00:22:34,300 Okay, so that's what ARC stands for. 307 00:22:34,480 --> 00:22:39,860 And I quote here, ARC allows an intermediate mail server to sign the message's original authentication results 308 00:22:39,860 --> 00:22:43,040 so that even when SPF or DKIM fails at the receiver end, 309 00:22:43,200 --> 00:22:47,980 the receiver can still check the chain of authentication records to determine whether the message can be, 310 00:22:48,140 --> 00:22:49,040 okay, accepted, okay? 311 00:22:49,100 --> 00:22:54,060 So what the important thing to know about ARC is that it guarantees chain of custody. 312 00:22:54,300 --> 00:22:59,460 It doesn't necessarily mean that the email wasn't spoofed, okay? 313 00:22:59,640 --> 00:23:08,020 And ARC was made specifically for email forwarding scenarios because, like, 314 00:23:08,120 --> 00:23:11,440 if you want to send a newsletter out, what happens is 315 00:23:11,440 --> 00:23:17,100 that the newsletter service sometimes modifies the body of the message and stuff with, like, unsubscribe links. 316 00:23:17,100 --> 00:23:19,200 And subject links and that kind of stuff. 317 00:23:19,360 --> 00:23:25,140 And so that makes it impossible to use DKIM, for example, in order to actually forward that mail securely. 318 00:23:25,460 --> 00:23:29,200 And ARC, it's a relatively experimental protocol. 319 00:23:29,540 --> 00:23:31,440 Like, it was written up, I think, in 2016. 320 00:23:31,640 --> 00:23:32,420 It was published in 2019. 321 00:23:33,120 --> 00:23:37,120 However, that hasn't stopped some few brave souls in adopting it. 322 00:23:37,220 --> 00:23:41,400 And by a few brave souls, I mean, like, Gmail, Outlook, Zoho, Fastmail, like, all the big ones. 323 00:23:42,080 --> 00:23:46,800 And ProtonMail, new, which I've found out, which you'll see in a second. 324 00:23:47,100 --> 00:23:47,500 It's pretty hilarious. 325 00:23:48,500 --> 00:23:50,760 So this is what ARC looks like in practice. 326 00:23:50,980 --> 00:23:56,980 So when you want to forward an email, right, ARC basically records the authentication results, 327 00:23:57,260 --> 00:23:59,320 hence the ARC authentication results header. 328 00:23:59,520 --> 00:24:02,120 Each hop the email goes through. 329 00:24:02,240 --> 00:24:05,300 So, like, you send it from your email server. 330 00:24:05,520 --> 00:24:07,620 It gets sent through multiple other email servers. 331 00:24:08,400 --> 00:24:15,760 Each hop puts the AAR header, the AMS header, and the AS header each step of the way in the email 332 00:24:15,760 --> 00:24:17,000 in order to record those. 333 00:24:17,100 --> 00:24:22,720 And for the sake of this talk, we're only going to talk about the AAR header, 334 00:24:22,920 --> 00:24:27,100 because that's where the juice comes in. 335 00:24:27,660 --> 00:24:34,240 And, again, like, ARC is meant to determine that the chain of custody hasn't been broken in the email. 336 00:24:34,320 --> 00:24:35,920 So, like, the message hasn't been tampered with. 337 00:24:36,140 --> 00:24:45,280 It's not really meant to – it's left up to the end receiver to determine if the email was spoofed with the AAR header. 338 00:24:45,600 --> 00:24:46,540 So they did. 339 00:24:46,540 --> 00:24:52,520 The end receiver has to look at the AAR header, look at the SPF, DKIM, and DMARC results in that header 340 00:24:52,520 --> 00:24:54,660 to determine if the email was spoofed or not. 341 00:24:55,080 --> 00:25:01,660 So, according to the RFC, this is what an AAR header is supposed to look like. 342 00:25:02,060 --> 00:25:05,540 So you got your hop, which is the I property there. 343 00:25:05,760 --> 00:25:09,260 And then you got the results of SPF, DKIM, and DMARC. 344 00:25:09,360 --> 00:25:12,300 So you can see, like, in the RFC example, they all passed. 345 00:25:12,560 --> 00:25:16,440 And the end receiver has to take these results and interpret. 346 00:25:16,440 --> 00:25:22,920 And put that in sort of in the calculations of the spam score in order to determine if the email should go to inbox or should go to spam. 347 00:25:23,740 --> 00:25:26,820 This is what MailChannel's AAR looks like – header looks like. 348 00:25:29,400 --> 00:25:33,440 So, basically, they're not checking SPF, DMARC, or DKIM at all. 349 00:25:34,260 --> 00:25:40,920 And what happens is they put in these properties that aren't really necessarily, like, representing what the – 350 00:25:40,920 --> 00:25:43,920 like, at least what the header is supposed to do. 351 00:25:44,420 --> 00:25:46,200 They put, like, this auth equals pass. 352 00:25:46,440 --> 00:25:46,720 What auth? 353 00:25:46,920 --> 00:25:47,500 There's no auth. 354 00:25:47,700 --> 00:25:48,720 Like, you just do this. 355 00:25:48,920 --> 00:25:50,740 Like, you just put the workers public. 356 00:25:50,820 --> 00:25:51,880 You don't need auth to do this. 357 00:25:52,340 --> 00:25:56,860 So they don't actually check the SPF, DMARC, or DKIM results. 358 00:25:57,300 --> 00:26:02,000 And at this point, we're just like, you know, like, please, like, why can't you just be normal? 359 00:26:02,500 --> 00:26:03,380 Like, I don't know. 360 00:26:03,480 --> 00:26:05,780 Like, this is the weirdest freaking thing we've ever seen. 361 00:26:07,080 --> 00:26:10,900 And it always claims auth equals pass in the AAR header. 362 00:26:11,080 --> 00:26:13,640 So we were really confused about that. 363 00:26:15,040 --> 00:26:16,420 And unfortunately, though… 364 00:26:16,440 --> 00:26:22,620 Well, because it's left up to the end receiver to take this information and calculate the spam score with it, 365 00:26:22,680 --> 00:26:30,180 it's really impossible to know how, like, putting bad values in this header will influence, like, email delivery. 366 00:26:31,460 --> 00:26:37,020 So with Fortinet, for example, they have – well, Fortinet is a good example of anything, to be clear. 367 00:26:38,740 --> 00:26:44,080 However, they have documentation out there that states, hey, you can check this checkbox in our product, 368 00:26:44,140 --> 00:26:46,180 and we can basically override. 369 00:26:46,440 --> 00:26:50,420 All of the SPF, DMARC, and DKIM results with the results of the AAR header, right? 370 00:26:50,500 --> 00:26:52,120 So you could potentially – yeah. 371 00:26:52,260 --> 00:26:53,760 So it's great. 372 00:26:53,840 --> 00:26:54,300 It's fantastic. 373 00:26:55,880 --> 00:27:02,940 So – and again, there's no way to actually know how this gets interpreted at the end of the receiver, unfortunately. 374 00:27:03,760 --> 00:27:14,940 But what we've found through research is that the presence – the sheer presence of AARC passing in the email headers guarantees a better spam score. 375 00:27:15,380 --> 00:27:16,420 And we confirm that. 376 00:27:16,420 --> 00:27:22,700 We confirm this with ProtonMail because ProtonMail actually gives you the spam score result – like, it breaks down how it calculated the spam score. 377 00:27:22,940 --> 00:27:26,900 With Gmail and Outlook, there really isn't a good way of knowing that. 378 00:27:27,040 --> 00:27:30,200 However, in our tests, it seems like it sort of behaves the same way. 379 00:27:30,360 --> 00:27:33,900 So AARC passing generally guarantees a better spam score. 380 00:27:34,040 --> 00:27:42,480 So if you're, like, conducting phishing engagements, all you have to do is adopt AARC, and you'll have – you know, you'll have a better chance of landing that email in people's inbox. 381 00:27:42,660 --> 00:27:44,280 You know, a little Red Team probe tip right there. 382 00:27:46,420 --> 00:28:03,260 As a consequence of this, which is very interesting, is that if a domain doesn't have any SPF, DMARC, or DKIM record at all, using mail channels, you can actually potentially spoof them at a higher success rate. 383 00:28:04,060 --> 00:28:16,000 So – and then this sort of increases the blast radius a bit, where you can basically spoof emails from domains that aren't set up to send email, and you have a very high chance of actually landing that email in the inbox. 384 00:28:16,580 --> 00:28:23,440 So this opens up the blast radius from, like, 2 million domains to, like, over 3 billion, which is very interesting. 385 00:28:23,640 --> 00:28:32,380 And again, like, the caveat being that as long as the end service adopted AARC here, you have a higher chance of doing this, which is very interesting. 386 00:28:35,160 --> 00:28:44,920 So in order to prove this, I was like, okay, well, first off, I have to find – I have to find a domain without any SPF and DMARC record. 387 00:28:45,100 --> 00:28:46,400 And – which is really interesting. 388 00:28:46,420 --> 00:28:47,000 It's pretty easy. 389 00:28:47,120 --> 00:28:50,240 But there was one in particular that was super interesting to me. 390 00:28:50,420 --> 00:28:54,320 And about that time, I – my Black Hat talk about this got accepted. 391 00:28:54,580 --> 00:28:59,540 So that was really weird also because, like, I didn't actually submit the Black Hat talk. 392 00:29:02,040 --> 00:29:02,560 Yeah. 393 00:29:02,800 --> 00:29:06,120 And so it turns out that I spoofed blackhat.com. 394 00:29:06,220 --> 00:29:08,340 So that's – so blackhat.com – 395 00:29:17,120 --> 00:29:21,980 So blackhat.com didn't have an SPF or DMARC record until February 2023. 396 00:29:23,340 --> 00:29:34,780 And because ProtonMail, which is the service I use for my mail, takes AARC into consideration, through the Cloudflare worker that used mail channels, I was able to spoof blackhat.com. 397 00:29:35,240 --> 00:29:41,920 Because of their adoption of AARC, ProtonMail calculated that into the spam score, and it just landed straight into the inbox. 398 00:29:42,240 --> 00:29:43,820 And these are the headers to prove it. 399 00:29:43,820 --> 00:29:50,740 Where you can see, like, ProtonMail is like, okay, blackhat.com doesn't have a DMARC, SPF, or DKIM record, right? 400 00:29:50,860 --> 00:29:53,560 So that calculates – that adds zero to the spam score. 401 00:29:53,760 --> 00:29:54,160 It's neutral. 402 00:29:54,360 --> 00:29:55,800 But, hey, AARC passed. 403 00:29:56,660 --> 00:29:58,620 So, hey, that minus one. 404 00:29:58,860 --> 00:30:03,160 And apparently that's all that was needed to get that email into the inbox. 405 00:30:04,060 --> 00:30:05,840 That little minus one. 406 00:30:05,980 --> 00:30:13,660 And, again, like, there's no way of, like, knowing this, like, for sure outside of ProtonMail. 407 00:30:13,660 --> 00:30:20,300 Because, like, Gmail and Outlook, from what we've seen, doesn't actually give you the spam score calculations like this. 408 00:30:20,820 --> 00:30:23,180 But, yeah, this is very interesting. 409 00:30:23,380 --> 00:30:27,440 So, another disclaimer before I do the demo here. 410 00:30:28,740 --> 00:30:30,120 Don't do crimes, again. 411 00:30:31,540 --> 00:30:39,680 But, yeah, I'm basically now – this is public, where you can go to spamchannel.hacks with three x's, .worker.dev. 412 00:30:39,820 --> 00:30:43,560 And you can basically spoof all of mail channels. 413 00:30:45,260 --> 00:30:45,740 Domains. 414 00:30:45,780 --> 00:30:50,240 And any domain that potentially doesn't have a DMARC SPF record. 415 00:30:50,620 --> 00:30:55,920 And this was based off of Isangan's Cloudflare worker code, which is the original person who wrote this. 416 00:30:56,000 --> 00:30:56,960 So shout out to him or her. 417 00:30:57,680 --> 00:30:59,880 But, yeah, and it only tests on domains you control. 418 00:31:00,040 --> 00:31:02,840 The code for this will be available after the talk as well. 419 00:31:03,380 --> 00:31:04,780 So quick demo here. 420 00:31:06,120 --> 00:31:06,880 One second. 421 00:31:14,900 --> 00:31:15,360 Oh. 422 00:31:26,560 --> 00:31:27,720 Just thinking about it. 423 00:31:27,820 --> 00:31:28,220 Uh-oh. 424 00:31:33,600 --> 00:31:34,520 All right. 425 00:31:34,540 --> 00:31:35,080 I'm going to try that again. 426 00:31:40,120 --> 00:31:40,580 Wow. 427 00:31:41,400 --> 00:31:41,860 Wow. 428 00:31:41,860 --> 00:31:43,200 Demo gods really hate me. 429 00:31:43,280 --> 00:31:43,760 How about this one? 430 00:31:46,660 --> 00:31:47,880 Well, there are videos here. 431 00:31:51,480 --> 00:31:51,800 Oh. 432 00:31:57,620 --> 00:31:59,720 I don't know if we're going to be able to fix that in time. 433 00:32:01,340 --> 00:32:02,340 But maybe we will. 434 00:32:02,440 --> 00:32:03,000 I don't know. 435 00:32:03,100 --> 00:32:03,460 Well, let's see. 436 00:32:03,560 --> 00:32:05,360 Well, anyway, I'm going to continue the presentation. 437 00:32:06,920 --> 00:32:09,040 Is there – am I allowed to connect to the Internet? 438 00:32:13,660 --> 00:32:16,080 Well, at this point, I think I'm not going to get invited to Black Hat. 439 00:32:16,180 --> 00:32:17,660 So I think at this point, I'm just going to – 440 00:32:28,800 --> 00:32:29,600 I mean, I don't know. 441 00:32:30,120 --> 00:32:30,460 All right. 442 00:32:30,500 --> 00:32:34,460 Well, if – I don't know. 443 00:32:34,700 --> 00:32:35,680 I don't know what's going on. 444 00:32:35,740 --> 00:32:36,360 But I'm going to continue. 445 00:32:36,360 --> 00:32:39,780 And maybe somebody can come up here and figure that out. 446 00:32:40,000 --> 00:32:40,240 Okay. 447 00:32:40,940 --> 00:32:41,640 Let's see. 448 00:32:42,200 --> 00:32:43,920 Where is the presentation button? 449 00:32:43,980 --> 00:32:44,420 There it is. 450 00:32:44,600 --> 00:32:44,960 Okay. 451 00:32:45,760 --> 00:32:46,120 Perfect. 452 00:32:46,980 --> 00:32:48,640 Well, hopefully, I'll be able to show you a video of this. 453 00:32:48,720 --> 00:32:50,320 If not, you can literally just try it yourself. 454 00:32:50,560 --> 00:32:51,240 You just go to that URL. 455 00:32:53,080 --> 00:32:54,140 So disclosure timeline. 456 00:32:54,700 --> 00:32:56,360 This all started in November of 2022. 457 00:32:56,740 --> 00:33:00,820 I initially contacted MailChannels and told them, hey, you know, this is a thing. 458 00:33:02,440 --> 00:33:05,920 You should probably, like, reconsider considering, like, the Cloudflare workers. 459 00:33:05,920 --> 00:33:09,640 You did this partnership with Cloudflare now, and you got the Cloudflare worker thing going on. 460 00:33:09,780 --> 00:33:11,080 And no further response after that. 461 00:33:11,920 --> 00:33:14,380 January 2023, they were contacted by Rapid7. 462 00:33:15,520 --> 00:33:19,700 And they were, again, response immediately saying, we don't consider this an issue. 463 00:33:20,460 --> 00:33:23,040 But then no further response. 464 00:33:23,960 --> 00:33:30,020 Then in June of 2023, I sent the final update to them saying, hey, you know, I got accepted at DEF CON. 465 00:33:30,200 --> 00:33:33,080 And I summarized all the findings and everything. 466 00:33:33,200 --> 00:33:33,800 Again, no response. 467 00:33:34,080 --> 00:33:35,420 And then July of 2023. 468 00:33:36,280 --> 00:33:40,240 My MailChannel sends me a random email saying, hey, we noticed that you're speaking at DEF CON. 469 00:33:40,480 --> 00:33:42,360 Can you please share your findings with us? 470 00:33:44,380 --> 00:33:49,820 To which I said, well, I mean, I've been literally talking to your CEO since November of 2022, but okay. 471 00:33:50,480 --> 00:33:56,220 And then so it turns out my vulnerability reporting was going straight to spam. 472 00:33:58,720 --> 00:34:00,160 Which is very ironic. 473 00:34:00,400 --> 00:34:02,340 I should have used MailChannels for that, apparently. 474 00:34:05,140 --> 00:34:05,820 So, yeah. 475 00:34:05,920 --> 00:34:09,240 I had like a Gmail filter on that was literally sending my emails to spam for some reason. 476 00:34:10,400 --> 00:34:15,940 But after that, they basically said, hey, we introduced this thing called domain lockdown mode. 477 00:34:16,140 --> 00:34:32,920 So the takeaway here is as of June 2023, if you're a MailChannels customer, you have this domain lockdown record that they implemented, which basically allows you to specify the worker, the Cloudflare worker that is actually allowed to send emails on behalf of your domain. 478 00:34:33,080 --> 00:34:35,900 Or you can completely disallow MailChannels from sending emails. 479 00:34:35,920 --> 00:34:36,220 So there's a lot of things that can happen with that. 480 00:34:36,220 --> 00:34:37,360 It's not like, when we have a domain lockdown record, you can't send emails from your domain at all. 481 00:34:38,140 --> 00:34:39,020 So that's nice. 482 00:34:39,140 --> 00:34:47,340 Now, the kicker here, though, is that, like, you can still send emails without the domain lockdown record. 483 00:34:47,600 --> 00:34:54,440 So it's not like, you don't need a domain lockdown record in order for people to randomly just send emails from your domain. 484 00:34:54,600 --> 00:34:58,760 So you need to actively go in there and put the record, and otherwise people can just spoof your domain. 485 00:34:59,340 --> 00:35:05,820 It's to be announced when this will be like a default thing where you're not going to be allowed to send emails. 486 00:35:05,820 --> 00:35:07,580 through Cloudflare, through Mailchannels, 487 00:35:08,280 --> 00:35:10,300 unless you put in the domain lockdown record. 488 00:35:10,920 --> 00:35:13,660 So as of now, you can still spoof 489 00:35:13,660 --> 00:35:15,360 all of their customer domains with this. 490 00:35:18,140 --> 00:35:21,240 And so if you're an org that uses Mailchannels, 491 00:35:22,000 --> 00:35:23,860 you should, well, if you don't know, 492 00:35:23,900 --> 00:35:25,400 you should check your SPF record, number one. 493 00:35:25,520 --> 00:35:28,020 And if you do use Mailchannels, put in the domain lockdown record. 494 00:35:28,700 --> 00:35:30,940 You should probably go through all of your also domains 495 00:35:30,940 --> 00:35:35,040 and just make sure that you have an SPF record there set. 496 00:35:38,000 --> 00:35:41,040 And if it's a thing, you can also have, like, 497 00:35:41,100 --> 00:35:42,500 you can potentially display a banner 498 00:35:42,500 --> 00:35:45,340 if an email that doesn't have a DKIM signature 499 00:35:45,340 --> 00:35:47,400 comes from a domain that has implemented DKIM. 500 00:35:47,480 --> 00:35:49,380 I've never seen that. I don't even know if that's a thing. 501 00:35:49,520 --> 00:35:51,020 But that's potentially something you can do. 502 00:35:51,320 --> 00:35:56,460 So if you're an email service provider, like Gmail, Outlook, 503 00:35:57,800 --> 00:36:00,240 don't just bump the spam score of an email 504 00:36:00,240 --> 00:36:01,680 just because ARC is passing. 505 00:36:02,180 --> 00:36:05,320 That's, I don't know why, like, why that's a thing. 506 00:36:05,440 --> 00:36:05,800 But... 507 00:36:05,820 --> 00:36:07,420 But you should probably, like, not do that 508 00:36:07,420 --> 00:36:12,100 because I don't think that's how the protocol is intended to work. 509 00:36:13,200 --> 00:36:15,020 And if you're an email transaction service, 510 00:36:15,200 --> 00:36:16,160 just don't do this. 511 00:36:16,300 --> 00:36:19,180 Like, just use centered identity verification 512 00:36:19,180 --> 00:36:20,960 and dedicated sending IPs 513 00:36:21,560 --> 00:36:25,480 because, like, this solves this entire swath of problems. 514 00:36:25,640 --> 00:36:27,980 And everybody uses this except Mailchannels, apparently. 515 00:36:28,680 --> 00:36:31,680 And so the final takeaway is email security is very brittle. 516 00:36:31,860 --> 00:36:35,300 It relies on, still relies on users and orgs to do the right things. 517 00:36:35,820 --> 00:36:38,520 And ARC potentially could incentivize, like, 518 00:36:38,540 --> 00:36:39,800 a trend of gaming the system, 519 00:36:39,980 --> 00:36:41,760 which is something to consider as well. 520 00:36:42,440 --> 00:36:44,400 And then finally, I want to shout out 521 00:36:44,400 --> 00:36:47,120 two researchers, Shengkai and Gang, 522 00:36:47,400 --> 00:36:50,600 who basically is who I stole all the awesome graphics 523 00:36:50,600 --> 00:36:52,940 for DMARC and SPF explanations and stuff. 524 00:36:53,060 --> 00:36:55,560 And they did a lot of the initial research into ARC as well. 525 00:36:55,880 --> 00:36:59,540 As well as Yisang Gun, who made the initial worker code 526 00:36:59,540 --> 00:37:01,640 that I based the tool that I released off of. 527 00:37:02,560 --> 00:37:05,120 And a huge shout out to the Rapid7 folks as well. 528 00:37:05,320 --> 00:37:05,800 Thank you. 529 00:37:05,820 --> 00:37:06,620 Thank you for coming out to help me through this research. 530 00:37:07,500 --> 00:37:07,940 Thank you. 531 00:37:19,060 --> 00:37:19,380 Perfect. 532 00:37:19,620 --> 00:37:20,680 I just want to double check that.