[00:00.000 --> 00:10.000] Hi, I'm Chef. Good morning. I'm the guest MC for this one, because your next speaker, Matt Nash, is a friend and colleague of mine. [00:10.000 --> 00:17.080] He and I worked together for NCC Group in Texas. So I've worked with Matt for the last four years, [00:17.080 --> 00:21.860] and when I heard about this research he was working on, I encouraged him to submit, [00:21.860 --> 00:26.140] because I think this is a wonderful topic for the Packet Acting Village. [00:26.140 --> 00:32.520] And so, Matt, I'll let you talk about yourself a little bit more, but welcome to the wall of sheep and break a leg. [00:32.620 --> 00:44.200] Thanks, Chef. So, as Chef said, I am Matt Nash. I am a security consultant with NCC Group, [00:44.200 --> 00:49.480] and this is my talk, Head in the Clouds. So what are we going to be doing today? [00:49.480 --> 00:58.840] We're going to be looking at the configuration of accounts within Amazon's AWS and then also Microsoft's Azure. [00:58.840 --> 01:08.700] Some of the resources that were put into this talk were native tooling developed by Amazon and Microsoft, [01:08.700 --> 01:15.120] security purpose tooling that was developed by NCC Group, and a third-party best practice reference. [01:16.660 --> 01:22.080] So, configuration reviews typically fall into two different categories. [01:22.080 --> 01:26.280] We're looking at services or the hosts or VMs themselves. [01:26.280 --> 01:30.920] Today, we're not going to be looking at the hosts. We're going to be focusing specifically on the services. [01:31.780 --> 01:39.420] So the first thing we're going to look at is Amazon's AWS. AWS is Amazon's web services. [01:39.500 --> 01:47.440] It is on-demand infrastructure, computing resources, storage resources, analytics, application services. [01:47.440 --> 01:56.400] They are available and scalable. And most people think of Amazon's AWS as infrastructure as a service, [01:56.400 --> 02:01.860] which contrasts with Microsoft's Azure, which we'll talk about a little bit later. [02:02.400 --> 02:16.460] So the tooling that we're going to use here is AWS CLI. It's developed by Amazon for querying AWS and interacting with the API. [02:16.460 --> 02:27.820] Another thing we're going to look at is Scout Suite, which is a tool that we developed for doing automated collection of data on AWS. [02:28.020 --> 02:33.380] And then CIS Benchmarks, which is a third-party best practice reference. [02:34.220 --> 02:42.800] So the first thing that we want to do when we're going to assess an AWS environment is we want to set up our auditing account. [02:42.800 --> 02:50.800] We want to apply a couple managed policies to it. The first one is read-only access, and the second one is security audit. [02:51.140 --> 02:58.820] We also want to establish programmatic access for the API, which is an access key and secret key pair. [02:59.260 --> 03:11.340] And then, not absolutely necessary, but it's nice to have access to the web console so that you can actually go through and click in the UI and look at that representation of the configuration. [03:12.600 --> 03:21.540] So with the access and secret key, we need to put those into something that we can feed into AWS CLI. [03:22.260 --> 03:28.640] There are a few other methods here that we're not going to cover today. The one that we're going to look at is the credentials file. [03:28.640 --> 03:42.440] And that credentials file looks something like this. If you run the AWS configure without a profile argument, you will get a default entry, which is the top one you see there. [03:42.480 --> 03:49.480] And if you run it with a profile name, in this case I used profile one, you'll get that second entry there. [03:50.840 --> 04:00.060] So the first thing that we want to do when assessing an AWS account is we'll dump out the account number so we know which one we're looking at. [04:00.120 --> 04:07.940] And we can also apply this to any findings that we come up with. So we'll run this command and we get the account number. [04:08.020 --> 04:12.760] We'll use that for our reporting so that we can identify what account the findings go to. [04:13.540 --> 04:21.840] And so the first service we're going to look at is IAM. IAM is the Identity and Access Management Service. [04:21.880 --> 04:31.560] This deals with authentication, or how your users sign in, authorization, which is permissions against resources or anything else in the account. [04:33.640 --> 04:39.080] So in IAM, the first thing we want to look at is the list of users on the account. [04:39.080 --> 04:49.100] So we'll run this command. We get some output. You can see here I've truncated it. You'll see an ellipsis on several slides just because we're dealing with a lot of data. [04:49.620 --> 04:54.880] So we see a user here, AWalters. We'll go ahead and take a look at that account. [04:55.640 --> 05:03.920] It was created on May 16th of 2015, so it's probably an older account. Probably good to look at. [05:03.920 --> 05:14.380] So first thing we want to do on a user is get a list of the access keys. So this is what gives them programmatic access to the API. [05:14.940 --> 05:23.820] So we'll run this command, specifying the username. We get some output here. We've got the access key ID for that user. [05:24.160 --> 05:33.320] And we see that that access key was created May 27th of 2015, so not long after the account was created. Probably an old key. [05:34.500 --> 05:40.420] And so we'll grab this access key ID and we'll use it in some future queries here. [05:41.900 --> 05:47.220] So the last time that this access key was used, when did the user actually use the API? [05:48.040 --> 05:53.840] So we'll take that access key from before, plug it into this command, get some output. [05:54.300 --> 06:02.140] We see the last time that they used it was June 16th of 2015, so this account hasn't been used in over four years. [06:02.140 --> 06:04.400] Probably a good thing to audit. [06:06.080 --> 06:13.320] So in the previous command, we looked at some user data on their access key specifically. [06:13.580 --> 06:20.440] Another thing you can do is you can generate a credential report, which gives you multiple access keys associated with the account [06:20.440 --> 06:26.420] and anything else associated with that user, like the last time they logged in, things like that. [06:26.420 --> 06:34.180] And you can generate these every four hours. Amazon doesn't want you just hammering with requests, so they put a time limit on there. [06:34.180 --> 06:43.520] So we'll run this command, we get the output of started, because we haven't actually run the generate credential report on this account before. [06:44.840 --> 06:49.200] And next thing you want to do is actually collect the report. [06:49.200 --> 06:59.240] So we'll run this next command here, and you'll get a very large Base64 encoded string. I've truncated it here. [07:00.180 --> 07:07.760] What we need to do to be able to read this credential report is decode it. [07:07.760 --> 07:18.280] So I've got a little cut command that I'm piping this into that's looking for the columns associated with the rotation dates of the keys. [07:18.280 --> 07:28.140] So we'll run this command, get some output. We see that Awalter's key was last rotated May 27th. [07:28.140 --> 07:38.860] So this is definitely an old access key. We need to go and audit and see if maybe that user still works with the company and maybe revoke their access. [07:40.320 --> 07:48.440] Next thing that we want to look at is root account usage. So root account in AWS is all-powerful. [07:48.440 --> 07:54.420] We don't like to see that account used habitually for administrative functions. [07:54.420 --> 08:02.120] We like to see an IAM role created for any of the permissions that you want an admin user to perform. [08:02.120 --> 08:09.340] So this is a very similar command. It's looking for the last login date of the root account. [08:09.620 --> 08:16.480] So we run this command. We can see the last time that this root account was used was July 2nd of this year. [08:16.480 --> 08:26.820] So probably habitual. The recommendation would be to lock away that root account, change any of their access keys, and just not use it if at all possible. [08:28.160 --> 08:35.880] Next thing that we want to look at is the account password policy. So this affects all users on the account. [08:36.100 --> 08:46.160] So we'll run this command. We get the password policy here. You can see that the minimum password length is 8 characters. It's pretty short. [08:46.300 --> 08:55.280] But what is also problematic is a user can use a password as long as it's not one of the last three used. [08:55.280 --> 09:02.980] So if a user figures out, hey, I changed my password three times, I can reuse my old password, you can see how that might be a problem. [09:04.080 --> 09:13.500] And what could be problematic with this configuration, depending on how they have the environment set up, passwords are set to not expire. [09:13.720 --> 09:22.100] That may be intentional. It may not be. You would want to go back to whoever runs this account and make sure that that's what they want. [09:22.100 --> 09:29.040] And also users are not able to change their password. That may also be a design decision. So we want to verify that. [09:30.260 --> 09:40.000] So some other common issues that we see with IAM. Policies that allow IAM pass role and STS assume role with a wildcard. [09:40.000 --> 09:49.040] So this could be for wildcard resources. This could be for wildcard principles or users. [09:49.040 --> 09:55.120] If you had wildcard for principles, that means anybody can do whatever this specific action is. [09:55.180 --> 09:59.780] And if you had resources, they could perform it against any resources. [10:00.080 --> 10:06.140] Another thing that we see is users without multi-factor authentication. That's a second factor. [10:06.140 --> 10:19.300] So if their access key and private or secret key were compromised or if their password were compromised, you would have a second factor there preventing an attacker from compromising the account further. [10:19.700 --> 10:31.240] Policies that allow not actions. So these are effectively blacklists. We like to see actions that are specified because that follows the principle of least privilege. [10:31.240 --> 10:35.840] So not actions essentially say you can perform everything except this action. [10:36.200 --> 10:43.460] And also cross-account assume role policies that lack an external ID or MFA. [10:43.460 --> 10:50.920] So the external ID can either be an account number for the account that you want to access your account's resources. [10:50.920 --> 10:57.040] Or it can just be a random string that you come up with that's unique to that third-party account. [10:57.040 --> 11:01.520] And then MFA, we've already discussed why that's a good thing. [11:01.520 --> 11:10.380] If the third-party account is compromised, this adds an additional step to keep an attacker from compromising your account's resources. [11:10.700 --> 11:13.900] So next service we want to look at is EC2. [11:14.020 --> 11:17.100] This is the Elastic Compute Cloud. [11:17.100 --> 11:29.900] It deals with scalable computing resources, which includes instances or VMs, network interfaces on the account, network access control, security groups, and any load balancing that's in place. [11:30.820 --> 11:37.200] So the first thing we want to do in EC2 is get a list of the VPCs, or Virtual Private Clouds. [11:37.200 --> 11:39.140] So we'll run this command. [11:39.160 --> 11:43.800] We get a list of VPCs, again truncated output. [11:43.800 --> 11:49.240] We see VPC IDs, we've got CIDR blocks that are associated with the VPCs. [11:49.240 --> 11:53.760] So we'll take this VPC ID and we'll use it in some next queries. [11:54.840 --> 11:59.020] Do the VPCs that we've found have flow logs enabled? [11:59.440 --> 12:06.660] So flow logs allow you to gain insight into the network actions that are going on relative to the VPCs. [12:06.660 --> 12:14.620] So we'll take that VPC ID from before, plug it into this command, and we get some output here on the flow logs. [12:14.700 --> 12:19.860] And you can see that flow log status active shows up in this output. [12:20.020 --> 12:27.320] If the flow logs were not enabled on the VPC that you're querying against, you would just get an empty set like here. [12:28.520 --> 12:31.880] So the next thing we want to do is get a list of network interfaces. [12:31.880 --> 12:36.540] So we'll run this command, which is the describe network interfaces command. [12:36.800 --> 12:41.340] We get some output. This is actually going to be one of those queries that generates a lot. [12:41.340 --> 12:45.520] So you'll probably have to scroll through to find the information that you want or grep it. [12:46.300 --> 12:49.160] So we see a network interface ID here. [12:49.560 --> 12:57.500] If we scroll down through the output, we can look for interfaces that are exposed to the internet. [12:57.500 --> 13:04.320] And in this case, we do see a public IP, and we also see public DNS. [13:04.320 --> 13:06.940] So this interface is exposed to the internet. [13:08.260 --> 13:12.540] Another thing we want to do is get a list of subnets on the account. [13:13.560 --> 13:18.540] So we run this command. We get CIDR blocks that are associated with that subnet, [13:18.540 --> 13:23.660] and also subnet ID and the VPC that it is associated with. [13:23.660 --> 13:29.700] We also get the availability zone and the ID of that zone. [13:30.380 --> 13:36.420] So we'll take this subnet ID and we'll use this in some future queries. [13:37.180 --> 13:43.020] So what NACLs are associated with this subnet? [13:43.260 --> 13:47.100] We'll run this command. We'll get a list of NACLs. [13:47.100 --> 13:57.560] And we can see this subnet ID has a rule action of allow for egress false. [13:57.560 --> 14:00.400] And in this case, egress false means ingress. [14:00.400 --> 14:06.520] So inbound connections for the CIDR block 0000 slash 0, or everyone. [14:07.900 --> 14:11.320] So the next thing we want to do is get a list of security groups. [14:11.320 --> 14:15.920] So NACLs and security groups are similar, but they are different. [14:15.920 --> 14:22.800] Security groups are in front of instances, whereas NACLs are in front of subnets. [14:23.620 --> 14:28.360] So we'll run this command. We get a list of security groups on the account. [14:30.060 --> 14:36.260] And so something we look for is default and Launch Wizard 1 security groups. [14:36.700 --> 14:41.580] And in this case, we see that both of those are in this listing of security groups. [14:42.620 --> 14:47.960] We'll probably focus a lot on this Launch Wizard 1 for the next queries. [14:49.360 --> 14:53.680] We'll grab the SG ID for that security group. [14:54.460 --> 14:56.840] And we'll use it in our next query. [14:56.840 --> 15:03.140] So something we want to look at is, is SSH exposed to the internet? [15:03.140 --> 15:10.360] So this is kind of a lengthy query, but essentially what it does is it looks for a port range from port 22 to port 22 [15:11.220 --> 15:16.680] for the CIDR block 0000 slash 0, or everyone. [15:16.980 --> 15:23.240] And it will output the name and ID of the groups that it finds. [15:23.900 --> 15:27.600] So we do see this Launch Wizard 1 again. [15:27.600 --> 15:30.640] We also see an OpenSSH group. [15:31.160 --> 15:35.720] OpenSSH, that's probably okay, but we definitely want to go back and verify, [15:35.720 --> 15:43.160] make sure it's not going to be a group that should be for only developers or a specific group. [15:43.720 --> 15:50.040] Since it is open to the internet, they probably want to lock that down if it's supposed to be for a smaller group. [15:50.600 --> 15:53.500] So let's focus on this Launch Wizard 1. [15:55.880 --> 15:59.980] What instances are associated with that security group? [15:59.980 --> 16:02.680] What instances or VMs are behind it? [16:02.680 --> 16:07.920] So we'll run this command, plugging in the SG value that we grabbed, [16:07.920 --> 16:11.940] and we'll get a list of instances that are associated with it. [16:11.940 --> 16:14.780] So we see here there are actually two instances. [16:14.800 --> 16:23.320] If you remember from the NACLs, the NACL that we saw before opened up SSH to the world, [16:23.320 --> 16:27.760] which is associated with this security group. [16:27.760 --> 16:33.440] So if there's any SSH services or services running on port 22 on these instances, [16:33.440 --> 16:35.100] that's going to be exposed to the internet. [16:35.100 --> 16:38.180] So that's our external attack surface. [16:38.800 --> 16:45.460] Some other common issues that we see with EC2 are security groups that whitelist AWS CIDRs. [16:45.460 --> 16:49.520] So these are network blocks within AWS. [16:49.520 --> 16:58.840] We like to see specific IPs for any instances that you want to be able to access resources [16:59.520 --> 17:02.440] rather than an entire net block. [17:03.280 --> 17:06.340] If somebody else gets an instance within that block, [17:06.340 --> 17:10.180] then that would allow them access to whatever these resources are. [17:10.680 --> 17:14.740] Another thing we see is EBS volumes that don't have encryption enabled. [17:14.740 --> 17:20.620] So if the storage mechanism for the EBS volume becomes compromised, [17:20.620 --> 17:23.620] if it's not encrypted, the data is also compromised. [17:23.880 --> 17:27.120] If it's encrypted, it should be safe. [17:27.700 --> 17:31.460] So another thing we see is all ports that are open to all. [17:31.740 --> 17:34.240] This does not follow the principle of least privilege. [17:34.240 --> 17:40.180] We want to see specific ports open for services that you intend to have exposed. [17:40.180 --> 17:47.020] And then also we see secrets in the instance metadata user data. [17:47.020 --> 17:54.240] So if an instance is set up using a script, it essentially gets recorded like bash history. [17:54.240 --> 18:01.180] So if there are hard-coded passwords in that script or anything that points to sensitive data, [18:01.180 --> 18:07.600] that would be exposed if somebody goes to the user metadata on the instance. [18:08.600 --> 18:12.320] So the next service we want to look at is the S3 service. [18:12.900 --> 18:17.780] That is simple storage service, and it deals with object storage. [18:17.780 --> 18:20.520] You may be familiar with the term buckets. [18:22.280 --> 18:26.760] So the first thing we want to do is get a listing of the buckets on the account. [18:26.760 --> 18:31.460] So we'll run this query, which will dump out a listing of the bucket names. [18:32.440 --> 18:36.500] So we see here we've got a bucket named devraven. [18:37.340 --> 18:40.160] Let's go ahead and take that for our next queries. [18:42.360 --> 18:48.620] So we want to look and see if the bucket is world-listable or world-writable. [18:48.640 --> 18:55.860] So can people browse and see that bucket, or can they write data to the bucket? [18:56.020 --> 19:00.740] So we'll take the devraven bucket name, throw it into this command. [19:00.740 --> 19:02.950] Get some output here. [19:03.340 --> 19:08.030] We scroll through and we see that the group global all users. [19:08.400 --> 19:14.140] If you're looking in the web UI of AWS, you'll see this listed as everybody. [19:14.540 --> 19:19.900] We can see that that has read and write permissions on this bucket. [19:20.080 --> 19:23.680] So it is world-listable and it is world-writable. [19:24.500 --> 19:28.440] So next thing we want to look at is objects within that bucket. [19:28.440 --> 19:31.660] Are they world-readable and world-writable? [19:32.020 --> 19:36.900] So from the output before, we've got a bucket named test. [19:36.900 --> 19:39.840] So we'll query that with this command. [19:39.860 --> 19:46.600] And we can see that this bucket policy for test allows wildcard for principles, [19:46.600 --> 19:52.820] so all principles, any users, to do S3 get object and S3 put object. [19:52.820 --> 20:00.100] So it is world-readable and world-writable for any bucket objects or objects within this bucket. [20:01.300 --> 20:05.500] Next thing we want to look at is versioning for the buckets. [20:06.660 --> 20:11.240] Versioning allows you to keep a record of changes that occur on a bucket. [20:11.240 --> 20:16.120] So if somebody deletes data, you should be able to recover it if you have versioning enabled. [20:16.520 --> 20:21.720] So we'll run this command against devraven and we see a status of enabled. [20:21.720 --> 20:24.960] So versioning is enabled for this bucket. [20:25.120 --> 20:30.020] If you did not have versioning enabled, you would just get no data back from the query. [20:31.040 --> 20:34.620] So next thing we want to look at is access logging for the buckets. [20:34.620 --> 20:41.440] So seeing what type of access requests are coming in for the buckets and for the data. [20:41.540 --> 20:45.080] So we'll again query devraven using this command. [20:45.080 --> 20:51.740] And we can see here that not only is a logging enabled in the output, [20:51.740 --> 20:57.140] but we also get the bucket that the logs are going to and a directory in that bucket. [20:57.140 --> 20:59.060] So logging is enabled. [20:59.360 --> 21:04.380] If you did not have logging enabled, you would just get no data back from the query. [21:05.280 --> 21:11.940] So some other common issues that we see with S3 version buckets that don't have MFA delete. [21:11.940 --> 21:17.960] So this is a second step before buckets or data can be deleted. [21:19.480 --> 21:24.280] Another thing we see is buckets that don't have the default encryption enabled. [21:24.280 --> 21:29.300] This is very similar to the EBS that we spoke about before. [21:30.180 --> 21:35.640] Data at rest, if it's encrypted, should be safe if the storage mechanism is compromised. [21:36.060 --> 21:40.860] Another thing we see is buckets that allow clear text or HTTP communication. [21:40.860 --> 21:47.500] So one of the issues that you could see here is if this bucket is serving software updates to clients, [21:47.500 --> 21:55.640] anybody with a suitable position between that user and the bucket could intercept the communication. [21:55.640 --> 21:58.160] They could modify the packages as they're coming through. [21:58.160 --> 22:00.980] And then your user may actually be infected with malware. [22:00.980 --> 22:05.100] So we like to see secure communication enabled for buckets. [22:06.200 --> 22:09.320] All right, so now we're going to look at Microsoft Azure. [22:10.460 --> 22:16.060] Azure is software-as-a-service, platform-as-a-service, infrastructure-as-a-service. [22:16.060 --> 22:17.820] It's also available and scalable. [22:17.820 --> 22:19.560] Very similar to AWS. [22:19.640 --> 22:23.040] However, people see it more as a platform-as-a-service. [22:23.040 --> 22:31.420] So they kind of handle the OS updates and other things that you would be responsible for within AWS. [22:31.420 --> 22:34.300] They kind of manage the behind-the-scenes stuff. [22:36.060 --> 22:41.620] So some of the tools that we're going to use for querying Azure is Azure CLI, [22:41.620 --> 22:48.500] which is developed by Microsoft for doing very similar functions as we saw in AWS. [22:48.820 --> 22:54.560] Scout Suite, which is developed by NCC Group, and also the CIS Benchmarks. [22:55.480 --> 22:59.160] So account setup within Azure is a little bit different from AWS. [22:59.160 --> 23:01.380] They use role-based access control. [23:01.380 --> 23:07.660] We like to see at least read access on any of the resources that you intend on auditing. [23:07.940 --> 23:10.640] And Security Reader is a good role to use. [23:13.140 --> 23:18.580] So credentials, they handle it quite different from AWS. [23:19.740 --> 23:24.080] The login flow, you use the az login command. [23:24.080 --> 23:28.060] It will then throw up a prompt in your browser, your default browser. [23:28.060 --> 23:31.160] You will log in using your Microsoft ID. [23:31.200 --> 23:38.260] And then a token will get passed to the Azure CLI client that will then get used for any of your queries. [23:38.860 --> 23:42.340] So we'll log in using that az login command. [23:43.620 --> 23:51.300] And there's also a legacy option to use a device code rather than logging in through the web UI. [23:51.660 --> 23:53.720] You'll get a bunch of output here. [23:53.720 --> 23:56.100] Azure is very noisy with its output. [23:56.100 --> 24:03.440] You'll get the cloud name that you've just logged into as well as the Microsoft ID that you've used. [24:04.160 --> 24:08.700] And the user type that you have. [24:08.700 --> 24:16.280] And we can see here our audit account, pentester, at sharklasercorp3742.onmicrosoft.com. [24:17.120 --> 24:23.320] So similar to AWS, first thing we want to do is grab the account ID, make sure that we're hitting the right account, [24:23.320 --> 24:26.040] and then we can use that for any of our reporting. [24:26.100 --> 24:30.220] So we'll run this command and we get the account ID. [24:31.780 --> 24:34.640] So we'll use that for any of our findings. [24:35.240 --> 24:39.880] The first service that we're going to look at is Azure AD or Active Directory. [24:40.040 --> 24:43.700] Azure AD is quite a bit different from on-prem AD. [24:43.700 --> 24:47.020] They handle a lot of things very different from it. [24:47.020 --> 24:51.620] So if you're familiar with on-prem AD, this is a different beast. [24:52.480 --> 24:57.540] The first thing we want to do is get a list of the users in Active Directory. [24:57.760 --> 25:02.940] So we'll run this command, which will get the user name and then their job titles. [25:04.000 --> 25:08.440] So we see here we've got a System Administrator 3, probably a good account to audit. [25:09.420 --> 25:13.040] And their ID is A. Adams at the same company. [25:15.220 --> 25:20.620] So first thing we want to do once we've got a username that we want to audit, we want to get some additional information about the user. [25:20.620 --> 25:24.240] So we'll run this command, specifying the user ID. [25:24.500 --> 25:26.960] And we get a bunch more output. [25:27.380 --> 25:31.340] And we can see that the user's name is Arthur Adams. [25:31.340 --> 25:34.740] Arthur works in the Information Technology Department. [25:34.820 --> 25:39.660] And Arthur's account was created in March of this year. [25:39.660 --> 25:41.340] So, pretty new user. [25:43.220 --> 25:47.660] Next thing we want to do is see what groups this user is associated with. [25:47.660 --> 25:51.320] So we'll run this command, again specifying the user ID. [25:51.640 --> 25:55.500] And we can see that Arthur is part of InfoTech and SysAdmins. [25:55.500 --> 25:58.600] Not surprising, Arthur is a technology worker. [25:59.380 --> 26:03.860] And we've got the object IDs also for those groups. [26:05.140 --> 26:08.340] Another thing we want to look for is guest users in the account. [26:08.340 --> 26:12.400] So these are not managed by your organization. [26:13.460 --> 26:17.640] They have been added with permissions to be able to do things on your account. [26:18.220 --> 26:19.600] So we run this command. [26:19.600 --> 26:26.080] We see that TammyRogers256bq8 with a tag of ext. [26:26.140 --> 26:28.940] So it shows you that it's an external user. [26:29.180 --> 26:31.020] Has been added to the account. [26:33.140 --> 26:37.560] Like I kind of alluded to before, these are users that you don't manage. [26:38.100 --> 26:41.480] So any problems with their account, if they have a weak password, [26:41.480 --> 26:47.040] it makes it much harder for you to make sure that they are secure. [26:47.040 --> 26:53.700] So we like to see specific AD accounts created for anybody who needs access to your environment. [26:54.660 --> 26:57.780] And if you didn't have any guest users, you would get an empty set. [26:59.000 --> 27:02.620] So the next service we want to look at in Azure is the Key Vault. [27:03.960 --> 27:08.640] So we will run this command. We'll get a list of the Key Vaults that are on the account. [27:09.440 --> 27:14.520] So we scroll through. We see we've got this vault name. [27:14.520 --> 27:20.660] You also get the location of it and the ID within Azure. [27:21.800 --> 27:28.600] So we'll take that ID and we'll look and see if this vault is recoverable. [27:28.600 --> 27:32.840] So if the vault is deleted, can we revert that? [27:33.460 --> 27:41.240] And we're going to look for the Enable Purge Protection or the Enable Soft Delete in the output. [27:41.740 --> 27:44.660] And so we'll specify that ID from before. [27:45.780 --> 27:51.840] And we see we don't actually get data back. So this vault is not recoverable. If it's deleted, it's gone. [27:53.240 --> 27:57.460] So the next thing we want to look at is the keys within the Key Vault. [27:57.480 --> 28:00.020] Do they have an expiration date set? [28:00.020 --> 28:06.230] So we'll run this command. It's looking for the Attributes Enabled and Attributes Expired. [28:07.140 --> 28:18.380] So we see a key here. We notice that it expires January 1st of 2020. So that's good. It does have an expiration date. [28:19.160 --> 28:24.260] Next thing we want to look at is the secrets in the vault. Do those also have an expiration date? [28:24.260 --> 28:32.400] So we get similar output here. We see that this secret also expires January 1st, 2020. [28:33.620 --> 28:37.200] So next service that we're going to look at is Logging and Monitoring. [28:38.400 --> 28:50.360] These commands are going to be much longer. You'll see a slide with just the command on it, and then the next slide will actually have the output just due to how we have to query this service. [28:51.120 --> 28:58.740] So the first thing we're going to look at is Activity Logging Alerts for creating or updating Network Security Groups. [28:58.820 --> 29:06.820] And we are going to look for the operation name of Microsoft Network, Network Security Groups, right action. [29:07.260 --> 29:14.180] And we get some output here. We see that it's set to global. The scope is properly set for the subscription. [29:14.180 --> 29:23.080] And enabled is true. So Activity Logging Alerts is enabled for creating and updating Network Security Groups. [29:24.000 --> 29:31.220] So let's look and see if Logging Alerts are also enabled for Delete Network Security Group. [29:31.220 --> 29:37.520] Very similar command, but the action is going to be Microsoft Network, Network Security Groups, Delete. [29:37.520 --> 29:45.780] So we get some output here. We see this is also set to global. The subscription is properly set, and enabled is true. [29:45.980 --> 29:50.640] So Logging Alerts are enabled for deleting Network Security Groups. [29:51.540 --> 29:59.680] Next thing we want to look at is creating and updating Network Security Rules. So these are the rules associated with those groups. [30:00.100 --> 30:04.140] Very similar command, but we're looking at the Security Rules, right action. [30:04.620 --> 30:12.120] We get some output here. We see that it's set to global. The subscription is properly set on the account, and enabled is true. [30:13.240 --> 30:21.100] Same thing for Delete. Run a very similar command, but with the Security Rules, Delete action. [30:21.500 --> 30:30.020] We get some output here. We see that the location is also set to global. Subscription is properly set on the account, and enabled is true. [30:30.760 --> 30:36.980] So this next query is going to look for any actions for SQL Server Firewall Rules. [30:37.200 --> 30:42.640] Similar command, but we're looking at Microsoft SQL Server's Firewall Rules, right. [30:43.100 --> 30:50.500] So we get more output here. The location is set to global. Subscription is properly set, and enabled is true. [30:50.600 --> 30:54.420] So Alert Logs are also set on this action. [30:55.380 --> 31:03.720] So for updating a security policy, very similar command, but we're looking at the Microsoft Security Policies, right action. [31:04.400 --> 31:14.820] We get some output here. We see global. Subscription is also set properly on the account, and enabled is true. So we have logs there as well. [31:15.380 --> 31:18.280] Next service we want to look at is networking. [31:19.900 --> 31:23.940] First thing we want to look for is RDP. Is that exposed to the internet? [31:24.420 --> 31:33.500] So we'll run this command that will get a list of network security groups, and then it will print out the name as well as the rules associated. [31:34.020 --> 31:43.560] So we get a bunch of output here. We look through and we see that there is an allow rule for inbound connections to port 3389. [31:44.040 --> 31:51.040] And the source address is wildcard. So any source address can connect to the service. [31:51.540 --> 31:53.580] So it is open to the internet. [31:54.420 --> 31:58.760] Next thing we want to look at is SSH. Is SSH also open to the internet? [31:59.900 --> 32:12.020] Same command, same output. We're going to scroll through. We see that access is allowed for inbound connections on port 22 for any source address again. [32:12.020 --> 32:14.520] So SSH is also open to the internet. [32:16.860 --> 32:29.200] So the next thing we want to look at is network watchers. These enable flow logging or insight into network actions that are occurring. [32:29.200 --> 32:35.360] So this command will output a list of the network watchers on the account. [32:35.740 --> 32:39.300] We're looking for the provisioning state succeeded. [32:39.340 --> 32:44.480] And if you didn't have any network watchers enabled, you would have an empty set like this. [32:45.860 --> 32:52.480] So flow log retention period, is this sufficient for any of the flow logs? [32:52.640 --> 32:58.340] So we'll run this command specifying a resource group and a network security group. [32:58.340 --> 33:01.760] And we're going to look for the retention policy attribute. [33:02.140 --> 33:08.260] In this case, we've got one that has days set to 30. We like to see this at at least 90 days. [33:10.320 --> 33:16.180] So NCC Group Scout Suite. This is a tool we spoke about in the beginning of the presentation. [33:17.600 --> 33:23.160] Scout Suite is an automated tool that does a lot of this stuff in mere minutes. [33:23.460 --> 33:31.220] So a lot of those commands were pretty long. And I hope they didn't make your eyes bleed. This should be a lot better. [33:31.220 --> 33:38.680] Multicloud. So right now it supports Amazon's AWS, Microsoft Azure, Google Cloud Platform. [33:38.780 --> 33:46.340] And we recently released updates that include Alibaba Cloud and Oracle Cloud Infrastructure. [33:47.000 --> 33:50.500] So using Scout Suite against AWS. [33:50.780 --> 33:56.940] When you run Scout Suite against an AWS account, you will get a very similar interface to this. [33:56.940 --> 34:03.460] You'll get the account number. You'll see the services that Scout Suite looked at. [34:03.460 --> 34:09.400] And we've got some drop down menus up top that allow you to get to different dashboards. [34:09.740 --> 34:16.720] Here we're looking at the IAM dashboard. So you see all of the findings that were associated with IAM. [34:17.580 --> 34:22.520] And here we've got a finding for password expiration disabled. [34:22.520 --> 34:27.800] So we'll click on this. We get a nice output of that password policy. [34:27.800 --> 34:33.800] And we can see that Scout Suite has identified that password expiration is false. And it's highlighted that. [34:33.800 --> 34:39.960] So you can very quickly go through and see what things are enabled or not enabled on your account. [34:40.640 --> 34:46.980] We can go to the S3 dashboard. And we see some more findings here for S3. [34:47.420 --> 34:51.780] And we see a finding for get actions authorized to all principles. [34:52.520 --> 35:02.440] So this is the readable to everyone. So we click on that. We actually get the listing of the bucket. [35:02.560 --> 35:09.500] And then the configuration data. And you can actually see down in the bottom right corner, there's a little details button. [35:09.500 --> 35:13.940] So you can get the details of the policy itself for that bucket. [35:14.940 --> 35:17.660] Alright, running Scout Suite against Azure. [35:17.660 --> 35:31.940] Very familiar web page. Here we have fewer services because Azure's API is not as mature as AWS, but they are adding features. [35:32.260 --> 35:40.780] So here we've got five different services. Key Vault, Network, Security Center, SQL Database, and Storage Accounts. [35:40.780 --> 35:48.580] So we'll go up here to the Storage Accounts dashboard. And we see a finding for access keys not rotated. [35:48.580 --> 35:58.540] So if we click the little plus sign over there, it drops down and you get some details on why Scout Suite identified that. [35:58.740 --> 36:08.460] So the keys were rotated greater than 90 days from today. And there's also a reference to the CIS benchmarks. [36:08.460 --> 36:15.880] So CIS benchmarks, what are these? They are developed by the Center for Internet Security. [36:15.880 --> 36:22.040] They are best practice guides that provide step-by-step audit queries. [36:22.100 --> 36:27.900] And they also provide step-by-step fixes once you've identified some issues. [36:27.900 --> 36:39.260] And they're available for almost any technology you can think of. Red Hat, Server 2016, any kind of technology, they probably have a benchmark for it. [36:39.320 --> 36:47.500] And the ones that we used for this presentation were the Amazon Web Services Foundations and the Microsoft Azure Foundations. [36:47.500 --> 36:50.260] These are the cover pages for the PDFs. [36:50.260 --> 36:59.960] And they provide a table of contents that is... you can navigate through it. You can click on whatever findings you're wanting to look at. [37:00.880 --> 37:10.240] And they provide a step-by-step... on the left here you see the audit for using the AWS CLI. [37:10.340 --> 37:15.520] But they also provide steps if you're going through the UI or the API. [37:15.520 --> 37:22.880] And then they also provide some references as to why those findings were identified. [37:23.160 --> 37:29.140] And on the right here you see a remediation for going through the Azure web console. [37:29.140 --> 37:31.460] And also some references. [37:31.940 --> 37:33.400] And that's it.