1 00:00:00,000 --> 00:00:01,320 Hi, everybody. 2 00:00:01,320 --> 00:00:05,660 Welcome to the online version of my talk at the DEF CON Cloud Village. 3 00:00:05,660 --> 00:00:07,800 Cloud defaults are easy, not secure. 4 00:00:07,800 --> 00:00:09,360 I am Igal Flegman. 5 00:00:09,900 --> 00:00:17,260 And I am an identity security engineer with years of experience creating identity and PKI services at Microsoft. 6 00:00:17,260 --> 00:00:25,540 And then after a few years, I left and cofounded KETOS, where we create identity and PKI solutions for customers. 7 00:00:26,100 --> 00:00:28,660 And my Twitter is igal underscore FS. 8 00:00:28,660 --> 00:00:32,660 So if you have any questions, feel free to send them my way that way. 9 00:00:33,040 --> 00:00:38,160 So we're going to start the talk with a quick video of me creating a VM in Azure. 10 00:00:38,360 --> 00:00:49,220 And in here, I just want you to pay attention and see what are some of the misconfigurations that I created as being a novice user creating a Windows server in Azure. 11 00:01:05,890 --> 00:01:12,730 So as you can see, Azure enabled me to create a VM in a few seconds. 12 00:01:13,130 --> 00:01:16,490 However, there were two big misconfigurations there. 13 00:01:16,730 --> 00:01:20,030 And I'm just going to talk a little bit about all the things we're going to talk. 14 00:01:20,030 --> 00:01:25,170 And in the Vegas talk, I was able to ask the people what they thought the things were. 15 00:01:25,170 --> 00:01:30,570 And I didn't want to show all what we were going to talk about, because they would be able to guess real quick of what it was. 16 00:01:30,570 --> 00:01:33,830 So we're going to talk about default passwords and open ports. 17 00:01:33,830 --> 00:01:40,490 If you guessed default password and open port for what were my misconfigurations, you got them correct. 18 00:01:40,490 --> 00:01:43,770 And I'm going to jump into details in a few minutes. 19 00:01:44,310 --> 00:01:49,110 And then there's insecure cryptographic defaults, as well as subdomain takeover. 20 00:01:49,710 --> 00:01:52,370 So let's get jump into it with default passwords. 21 00:01:52,370 --> 00:01:57,950 So default passwords is something that is kind of getting fixed and hopefully will be fully fixed in a few months. 22 00:01:58,250 --> 00:02:02,610 This one actually used to drive me crazy, finally got fixed. 23 00:02:02,690 --> 00:02:13,650 Now when you create a SQL database, you have been able to use Azure Active Directory for a while, but you still had to set up a default username and password for the local account. 24 00:02:13,650 --> 00:02:19,450 Now that's fixed and you can only use Azure Active Directory, which congrats on fixing. 25 00:02:20,970 --> 00:02:23,670 And however, VMs are still not there. 26 00:02:23,670 --> 00:02:28,670 So for VMs, you still have to create a default password or a default SSH key. 27 00:02:28,870 --> 00:02:34,590 You can use the same for all your VMs, kind of like making it a got a key for all your VMs. 28 00:02:34,610 --> 00:02:36,690 You can start using AD auth. 29 00:02:36,690 --> 00:02:38,310 It's still sometimes in preview. 30 00:02:38,310 --> 00:02:41,430 They pull it out of preview and so on, but it's getting there. 31 00:02:41,430 --> 00:02:47,830 And hopefully there's going to be a point where you can just create a VM and not have a local credential. 32 00:02:48,730 --> 00:02:50,150 So we're getting there. 33 00:02:50,150 --> 00:02:51,470 And then open ports. 34 00:02:51,470 --> 00:02:55,730 So as you saw in the video, the port was default to be open. 35 00:02:55,730 --> 00:02:57,790 So I didn't have to select anything. 36 00:02:57,790 --> 00:03:03,450 I actually would have to have gone into networking and make it to close that port. 37 00:03:03,890 --> 00:03:06,630 And there was a quick warning saying like, hey, your port is open. 38 00:03:06,630 --> 00:03:12,850 But if I'm an engineer that has no clue about networking and I just have to deploy a website, they're like, oh, okay, cool. 39 00:03:12,850 --> 00:03:13,770 Like whatever. 40 00:03:13,910 --> 00:03:16,430 Or I'll say, hey, I'll close it later. 41 00:03:16,730 --> 00:03:17,950 That's future me problem. 42 00:03:17,950 --> 00:03:19,430 Then forget and leave it open. 43 00:03:19,810 --> 00:03:21,930 And it could be solved really easy. 44 00:03:21,930 --> 00:03:27,730 It could be solved by either defaulting to your current IP address or even better using Azure networking JIT. 45 00:03:27,730 --> 00:03:29,410 So this is something I asked in Vegas. 46 00:03:29,410 --> 00:03:33,170 And I was like, does anybody know what Azure networking JIT is? 47 00:03:33,170 --> 00:03:40,150 And only one person, the whole audience, knew that it is a solution that creates just-in-time access in the network. 48 00:03:40,150 --> 00:03:43,390 So basically your RDP port is always closed. 49 00:03:43,390 --> 00:03:44,550 You go to Azure. 50 00:03:44,630 --> 00:03:47,010 You request access for let's say 20 minutes. 51 00:03:47,010 --> 00:03:50,850 And it will open your RDP port just to your IP address. 52 00:03:50,970 --> 00:04:02,930 So if it's a solution that would be kind of talked about more, it would be great for all Azure customers to be able to close the ports and then just use just-in-time access to access the ports. 53 00:04:03,290 --> 00:04:07,650 You put those two together, default passwords and open ports, and it's a disaster . 54 00:04:07,970 --> 00:04:19,790 We actually ran a study where we opened some Azure machines and we left SSH open and we got an average of 2.25 million SSH attempts per year. 55 00:04:19,790 --> 00:04:25,470 And I like saying that if your password is one in a million, they're going to break in twice a year. 56 00:04:25,470 --> 00:04:32,290 And unfortunately, we have seen that with a lot of companies that leave ports open or there's a network misconfiguration. 57 00:04:32,410 --> 00:04:40,910 People are able to force in because the engineer quickly set up a password that was short and they're like, well, it doesn't matter because we're going to use something else. 58 00:04:40,910 --> 00:04:45,830 But that password stayed there and that gives you root access to the machine. 59 00:04:45,830 --> 00:04:49,290 So it is very important to make sure we close our ports. 60 00:04:49,350 --> 00:04:56,110 And we also use security in depth by creating that identity perimeter to lock down those VMs. 61 00:04:56,730 --> 00:05:02,050 So the next thing is weak SSH cryptographic defaults. 62 00:05:03,010 --> 00:05:08,170 So in here we have the kind of like Mozilla scoring and it gives it a D. 63 00:05:08,170 --> 00:05:13,130 And the reason for it is, as I said in the title, cloud defaults are made to be easy. 64 00:05:13,130 --> 00:05:14,710 So we have password enabled. 65 00:05:14,790 --> 00:05:22,370 We have a bunch of key exchange algorithms that are kind of obsolete, but they leave them open. 66 00:05:22,370 --> 00:05:29,970 So anybody from any computer, even if it's an old Windows machine, can SSH because they don't want to have the problem of someone calling support on me. 67 00:05:29,970 --> 00:05:34,750 Like I can't SSH into my Azure machine to then learn that they're running Windows XP. 68 00:05:35,030 --> 00:05:38,810 So they prefer kind of like opening it up, being a little less secure. 69 00:05:38,870 --> 00:05:45,790 And people that are conscious about this disable these algorithms to be more secure. 70 00:05:46,330 --> 00:05:51,050 And we observe the same with TLS cryptographic defaults in the web applications. 71 00:05:51,270 --> 00:05:56,850 So if you run an Azure web application and you just open TLS 1.2, you might think like, all right, we're good. 72 00:05:57,110 --> 00:05:58,090 We close 1.1. 73 00:05:58,090 --> 00:05:59,950 We close 1.0. 74 00:06:00,170 --> 00:06:01,390 We're only using 1.2. 75 00:06:01,390 --> 00:06:12,350 But actually, if you run a scanner, there's still 1.2 algorithms, cipher suites that are not good enough, that have been proven to be not as secure as we would want. 76 00:06:12,350 --> 00:06:14,310 And those ones are enabled for the same reason. 77 00:06:14,310 --> 00:06:20,430 If you have a Windows 7 or 8 computer, they wouldn't be able to do the secure one. 78 00:06:20,430 --> 00:06:28,310 So Azure kind of like leaves it open, just so you don't have the same call of like, hey, some of my users are reporting issues with my website. 79 00:06:28,590 --> 00:06:43,010 And if you want to close it, you have to get really deep into the configuration or just put an Azure Front Door, which is what I recommend, just because Azure Front Door not only helps you with this, but it also creates a WAF and you can have a CDN. 80 00:06:43,010 --> 00:06:48,530 So it is actually the best way to kind of like protect your application while also optimizing it. 81 00:06:48,530 --> 00:06:55,350 So that's something to keep in mind and make sure that you're running these kind of tests and making sure your organization is secure. 82 00:06:56,470 --> 00:06:59,170 So now we're going to do a second video. 83 00:06:59,770 --> 00:07:11,830 So in this demo, we're going to create... we already created a website, but now I wanted to point from my website because azurewebsites.com, it's not that great of a domain if you want to be memorable. 84 00:07:12,510 --> 00:07:18,710 So I'm going to use my Coding Flamingo, which is my YouTube channel, and I'm just going to create Defcon C name. 85 00:07:18,710 --> 00:07:24,850 So it will be Defcon.CodingFlamingo, and it's just going to point to that Azure websites and we'll be able to point it there. 86 00:07:30,530 --> 00:07:34,610 So in here, I just have to type Defcon.CodingFlamingo.com, 87 00:07:37,880 --> 00:07:40,840 and it's going to validate that it's pointing to the host name. 88 00:07:41,520 --> 00:07:43,120 And now I can add it. 89 00:07:43,140 --> 00:07:48,520 And the cool thing about Azure and cloud is that it can also create a TLS certificate for me. 90 00:07:48,520 --> 00:07:49,940 So I don't have to worry about TLS. 91 00:07:49,940 --> 00:07:51,860 I don't have to worry about rotating it. 92 00:07:53,340 --> 00:07:58,560 All I have to do is create an app service managed certificate, select the domain I want. 93 00:07:58,560 --> 00:08:02,100 It's going to check that it's pointing there and it's going to create it. 94 00:08:02,360 --> 00:08:13,200 Then I go to custom domains and I just have to bind that certificate to that domain and click save, which has been covered by my face, but I just click the save button down there. 95 00:08:14,920 --> 00:08:22,840 And now if we go to the actual website, so Defcon.CodingFlamingo.com, it's just going to work and it's going to send you to the same Azure website. 96 00:08:22,840 --> 00:08:25,660 And as you can see, it actually has a certificate in there. 97 00:08:32,970 --> 00:08:35,990 And now I'm just going to go and delete the application. 98 00:08:45,360 --> 00:08:47,960 And so here I went and deleted the application. 99 00:08:48,480 --> 00:08:56,940 And here I actually ask once again to the people in the audience, what was the problem with this video? 100 00:08:57,320 --> 00:09:06,320 And actually someone was really quick, raised his hand and he's like, the answer is they didn't actually check you on the website. 101 00:09:06,320 --> 00:09:08,980 They just checked that you were pointing at it. 102 00:09:08,980 --> 00:09:12,500 And I was like, yep, you kind of ruined it because you did it too quickly. 103 00:09:12,500 --> 00:09:14,440 And I thought it was going to take a little bit while. 104 00:09:14,500 --> 00:09:18,620 I still owe that guy a drink, but yeah, that's basically what happened. 105 00:09:18,660 --> 00:09:26,800 So basically how it works is we have our Defcon.CodingFlamingo and it's pointing to the Azure websites.net and then that returns the website. 106 00:09:26,800 --> 00:09:34,220 That's how the CNAME works and the actual DNS and all Azure was verifying is that this is pointing to this. 107 00:09:34,540 --> 00:09:39,480 But as I deleted it, there was no warning or anything of like, hey, this is still pointing to this. 108 00:09:40,580 --> 00:09:49,400 And so anybody else can go create Defcon.2.azurewebsites.com, register that domain and impersonate CodingFlamingo.com. 109 00:09:49,820 --> 00:09:58,820 And we actually when we found this, we actually searched and we found over 35,000 domains that had that problem. 110 00:09:58,820 --> 00:10:03,520 So the problem with this, you might be thinking like, well, like, what can I do with that? 111 00:10:03,680 --> 00:10:05,360 First of all, you can take over the domain. 112 00:10:05,360 --> 00:10:14,740 So if it's like coupons.CodingFlamingo.com, you can create a great phishing site and people will fall for it and create a website to impersonate the company. 113 00:10:15,160 --> 00:10:20,940 And the best part out of it is since it's using the same domain, so like, you know, computers read right to left. 114 00:10:20,940 --> 00:10:22,520 So it's still using CodingFlamingo.com. 115 00:10:22,520 --> 00:10:24,420 It doesn't matter what this subdomain is. 116 00:10:24,700 --> 00:10:27,640 Password managers will actually say like, oh, this is a legit domain. 117 00:10:27,640 --> 00:10:29,720 Let me put the password in. 118 00:10:29,720 --> 00:10:33,360 So if you have a password field, it will automatically fill it up. 119 00:10:33,440 --> 00:10:37,500 And if the attackers are smart, they can take the credential even if you don't click submit. 120 00:10:37,500 --> 00:10:42,760 So by just opening it, which if you're a trained user, you would still open it because it's a real domain. 121 00:10:42,760 --> 00:10:44,580 It's CodingFlamingo.com. 122 00:10:44,880 --> 00:10:48,520 Your credentials will be automatically entered and stolen. 123 00:10:48,520 --> 00:10:54,620 So it is kind of the goldmine for phishing and even your best trained users would fall for it. 124 00:10:54,620 --> 00:11:05,860 So for that one, let's make sure that we're being aware of that and making sure we are deleting those subdomains whenever an app is created and deleted. 125 00:11:06,840 --> 00:11:11,940 So those are kind of like the cloud defaults that I focused on in this talk. 126 00:11:13,460 --> 00:11:16,140 Usually in here, I would open it for questions. 127 00:11:16,620 --> 00:11:21,680 And if you guys have any questions, feel free to send them over on Twitter, and I'll happily respond. 128 00:11:21,680 --> 00:11:29,240 So thank you so much for watching this video, and I hope you enjoy it and have a safe rest of the year.