<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
	<channel>
		<title>Summit Route</title>
		<description></description>
		<link>https://summitroute.com</link>
		<atom:link href="http://summitroute.com/blog/feed.xml" rel="self" type="application/rss+xml" />
		
			<item>
				<title>Lightsail object storage concerns - Part 2</title>
				<description>&lt;style&gt; @media print { a[href]::after { content: none !important; } } &lt;/style&gt;

&lt;p&gt;This is part two of a two part series about AWS’s new &lt;a href=&quot;https://aws.amazon.com/about-aws/whats-new/2021/06/amazon-lightsail-now-offers-object-storage-for-storing-static-content/&quot;&gt;Lightsail object storage&lt;/a&gt;. In &lt;a href=&quot;/blog/2021/08/05/lightsail_object_storage_concerns-part_1/&quot;&gt;part 1&lt;/a&gt;, I looked at the new Lightsail access key capability. In this second part we’ll look more closely at the buckets created.&lt;/p&gt;

&lt;p&gt;It was over 7 months ago when I posted part 1, so why the delay? I was waiting for AWS to fix something, and it was low enough risk and impact that I didn’t feel a need to “encourage” them with a public post, but I’m glad it’s finally fixed.&lt;/p&gt;

&lt;h2 id=&quot;making-a-public-bucket&quot;&gt;Making a public bucket&lt;/h2&gt;
&lt;p&gt;In part 1, I identified that Lightsail object storage creates an S3 bucket in a special Lightsail account. Let’s look at that bucket.&lt;/p&gt;

&lt;p&gt;The first thing that jumped out at me in the announcement was an indication that these buckets could be made public. AWS has been trying for a decade to stop the almost weekly news stories of public S3 buckets found with sensitive data in them.  Lightsail in one aggressive move decided to add yet another way of making these public, bypassing all the previously created defenses.&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;/img/lightsail_bucket_public.png&quot;&gt;
&lt;img style=&quot;max-width:500px&quot; src=&quot;/img/lightsail_bucket_public.png&quot; alt=&quot;Lightsail bucket public&quot; title=&quot;Lightsail bucket public&quot; /&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;This S3 bucket is created in another AWS account outside of your own, so the &lt;a href=&quot;https://aws.amazon.com/blogs/aws/amazon-s3-block-public-access-another-layer-of-protection-for-your-accounts-and-buckets/&quot;&gt;S3 Public Block Access&lt;/a&gt; control that you may have set in your account did not apply to this. This was what I was waiting for them to fix.  Now S3 Public Block Access does prevent this Lightsail bucket from being made public. I was asked to hold off on posting this until that was fixed, and I figure Lightsail is rare enough among folks that have stronger cloud security concerns and few people would expect “S3” public block access to impact Lightsail, so I agreed to hold off, then I forgot about it, then AWS fixed it and told me they fixed it, so now I’m posting it.&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;/img/lightsail_object_permissions.png&quot;&gt;
&lt;img style=&quot;max-width:300px&quot; src=&quot;/img/lightsail_object_permissions.png&quot; alt=&quot;Lightsail object permissions&quot; title=&quot;Lightsail object permissions&quot; /&gt;&lt;/a&gt;
From the screenshot, there was an option for “individual objects can be made public”, which means S3 object ACLs can also be used, which is yet another violation of best practices, as you should avoid using those. This is however prevented with S3 Public Block Access.&lt;/p&gt;

&lt;h2 id=&quot;looking-closer-at-the-bucket&quot;&gt;Looking closer at the bucket&lt;/h2&gt;
&lt;p&gt;I was curious if I could get more info about the account this S3 bucket was creatd in, so I guessed that I would be able to read the object ACL from the public bucket, and I was able to.&lt;/p&gt;

&lt;div class=&quot;highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;$ aws s3api get-object-acl --bucket bucket-kgxqi8 --key test_object.txt
{
    &quot;Owner&quot;: {
        &quot;DisplayName&quot;: &quot;lightsail-shadow+386-0944&quot;,
        &quot;ID&quot;: &quot;09ee0cfc526e2171e2fcc2848eb3218e6ff3627e7296cce899b09876c8a43eb4&quot;
    },
    &quot;Grants&quot;: [
        {
            &quot;Grantee&quot;: {
                &quot;DisplayName&quot;: &quot;lightsail-shadow+386-0944&quot;,
                &quot;ID&quot;: &quot;09ee0cfc526e2171e2fcc2848eb3218e6ff3627e7296cce899b09876c8a43eb4&quot;,
                &quot;Type&quot;: &quot;CanonicalUser&quot;
            },
            &quot;Permission&quot;: &quot;FULL_CONTROL&quot;
        }
    ]
}
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;So the name of the account is &lt;code class=&quot;highlighter-rouge&quot;&gt;lightsail-shadow+386-0944&lt;/code&gt;.  In the last post we figured out what the account ID was using the access key we had, but I actually had looked into the S3 bucket before I started using the access key, and identified the account ID using only the S3 bucket by translating the canonical ID of the account from the ACL.  To do this, in an actual S3 bucket in my account, I changed the bucket policy to the following and saved it:&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;/img/lightsail_bucket_policy_canonical_id.png&quot;&gt;
&lt;img style=&quot;max-width:600px&quot; src=&quot;/img/lightsail_bucket_policy_canonical_id.png&quot; alt=&quot;Lightsail bucket policy with canonical id&quot; title=&quot;Lightsail bucket policy with canonical id&quot; /&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Once AWS saves an S3 bucket policy with a Canonical ID it will automatically translate it to an account ID.&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;/img/lightsail_bucket_policy_account_id.png&quot;&gt;
&lt;img style=&quot;max-width:600px&quot; src=&quot;/img/lightsail_bucket_policy_account_id.png&quot; alt=&quot;Lightsail bucket policy with account id&quot; title=&quot;Lightsail bucket policy with account id&quot; /&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;So this S3 bucket is hosted in some AWS lightsail account with id &lt;code class=&quot;highlighter-rouge&quot;&gt;850260390076&lt;/code&gt;.&lt;/p&gt;

&lt;h1 id=&quot;why-this-bucket-is-a-problem&quot;&gt;Why this bucket is a problem&lt;/h1&gt;
&lt;p&gt;Similar to the access key from part 1, having a resource in another account creates a number of problems. S3 Public Access Block now is able to stop this bucket from being made public, but enabling Cloudtrail data events in your account will not log access to this bucket.  In November 2021, they did add the ability to enable S3 access logs, but those will not appear in your Cloudtrail logs like normal S3 object logs do.&lt;/p&gt;

&lt;h2 id=&quot;conclusion&quot;&gt;Conclusion&lt;/h2&gt;
&lt;p&gt;You should apply an SCP from your organization to deny use of the Lightsail service. Lightsail is a useful service for personal users and maybe small businesses, but it’s not aligned with the interests of larger organizations. The addition of yet another ability to make data public, which originally circumvented the S3 public block access mitigation, and to make long-lived credentials that you have little visibility into, is a step in the opposite direction of the security best practices that AWS has tried to move people toward.&lt;/p&gt;

&lt;p&gt;&lt;br /&gt;&lt;br /&gt;&lt;/p&gt;
&lt;hr /&gt;

 &lt;br&gt;...&lt;a href="https://SummitRoute.com/blog/2022/03/17/lightsail_object_storage_concerns-part_2/"&gt;Read more ...&lt;/a&gt; </description>
				<pubDate>Thu, 17 Mar 2022 13:00:00 -0700</pubDate>
				<link>https://summitroute.com/blog/2022/03/17/lightsail_object_storage_concerns-part_2/</link>
				<guid isPermaLink="true">https://SummitRoute.com/blog/2022/03/17/lightsail_object_storage_concerns-part_2/</guid>
			</item>
		
			<item>
				<title>Lightsail object storage concerns - Part 1</title>
				<description>&lt;p&gt;This is part one of a two part series that will discuss AWS’s new &lt;a href=&quot;https://aws.amazon.com/about-aws/whats-new/2021/06/amazon-lightsail-now-offers-object-storage-for-storing-static-content/&quot;&gt;Lightsail object storage&lt;/a&gt;. In this first part, we’ll look at the new access key capability and a security issue I discovered that has been fixed. In the second part we’ll look more closely at the buckets created.&lt;/p&gt;

&lt;h1 id=&quot;what-is-lightsail&quot;&gt;What is Lightsail?&lt;/h1&gt;

&lt;p&gt;In &lt;a href=&quot;https://aws.amazon.com/about-aws/whats-new/2016/11/introducing-amazon-lightsail/&quot;&gt;2016&lt;/a&gt;, AWS released Lightsail as a way of providing a simpler version of AWS in response to DigitalOcean.  Instead of having to worry about configuring your networks and paying for bandwidth and all the other little details of setting up and running an EC2, Lightsail advertised an easier way for a flat rate of $5/mo.  Over the years, Lightsail has expanded to incorporate more functionality than just a simpler EC2, and this service within AWS is now seen as being a mini-AWS within AWS that expands to achieve feature parity of where AWS was a number of years ago.&lt;/p&gt;

&lt;p&gt;Here’s a table comparing the Lightsail features to AWS services and their respective launch dates.&lt;/p&gt;

&lt;table&gt;
&lt;tr&gt;&lt;th&gt;Lightsail feature&lt;/th&gt;&lt;th&gt;AWS service&lt;/th&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;Compute and DNS, 2016&lt;/td&gt;&lt;td&gt;EC2, 2006; Route53, 2010&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;Load balancers, &lt;a href=&quot;https://aws.amazon.com/about-aws/whats-new/2017/11/amazon-lightsail-adds-load-balancers-with-integrated-certificate-management/&quot;&gt;2017&lt;/a&gt;&lt;/td&gt;&lt;td&gt;ELB, 2009&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;Block storage, &lt;a href=&quot;https://aws.amazon.com/about-aws/whats-new/2017/11/introducing-additional-block-storage-for-amazon-lightsail/&quot;&gt;2017&lt;/a&gt;&lt;/td&gt;&lt;td&gt;EBS, 2008&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;Databases, &lt;a href=&quot;https://aws.amazon.com/blogs/aws/new-managed-databases-for-amazon-lightsail/&quot;&gt;2018&lt;/a&gt;&lt;/td&gt;&lt;td&gt;RDS, 2009&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;Automatic snapshots, &lt;a href=&quot;https://aws.amazon.com/about-aws/whats-new/2019/10/amazon-lightsail-now-provides-automatic-snapshots/&quot;&gt;2019&lt;/a&gt;&lt;/td&gt;&lt;td&gt;Backup, 2019&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;Containers, &lt;a href=&quot;https://aws.amazon.com/blogs/aws/lightsail-containers-an-easy-way-to-run-your-containers-in-the-cloud/&quot;&gt;2020&lt;/a&gt;&lt;/td&gt;&lt;td&gt;ECS, 2014&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;Resource monitoring and notifications, &lt;a href=&quot;https://aws.amazon.com/about-aws/whats-new/2020/02/amazon-lightsail-now-supports-resource-monitoring-alarming-and-notifications/&quot;&gt;2020&lt;/a&gt;&lt;/td&gt;&lt;td&gt;CloudWatch, 2009; SNS, 2011&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;CDN, &lt;a href=&quot;https://aws.amazon.com/about-aws/whats-new/2020/07/amazon-lightsail-now-offers-cdn-distributions-to-accelerate-content-delivery/&quot;&gt;2020&lt;/a&gt;&lt;/td&gt;&lt;td&gt;Cloudfront, 2008&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;Object storage, &lt;a href=&quot;https://aws.amazon.com/about-aws/whats-new/2021/06/amazon-lightsail-now-offers-object-storage-for-storing-static-content/&quot;&gt;2021&lt;/a&gt;&lt;/td&gt;&lt;td&gt;S3, 2006&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;

&lt;h1 id=&quot;trying-out-lightsail-object-storage&quot;&gt;Trying out Lightsail object storage&lt;/h1&gt;
&lt;p&gt;On &lt;a href=&quot;https://aws.amazon.com/about-aws/whats-new/2021/06/amazon-lightsail-now-offers-object-storage-for-storing-static-content/&quot;&gt;July 14&lt;/a&gt;, AWS announced Lightsail object storage, a capability that sounds like S3. The SDK commit mentions a new API &lt;a href=&quot;https://github.com/aws/aws-sdk-go/commit/d1c997498fd43019b43d52fcd74e402e16630636#diff-5a6179b4e5f5d9255890a587d6df77227a75e539120b585f57091b3be60a138cR173&quot;&gt;CreateBucketAccessKey&lt;/a&gt; which seems like a wild circumvention of IAM credentials.  This looks exciting.&lt;/p&gt;

&lt;p&gt;I decided to start from the web console for Lightsail, which does not conform to any of the standards of the rest of the console.
&lt;a href=&quot;/img/lightsail_console.png&quot;&gt;
&lt;img style=&quot;max-width:600px&quot; src=&quot;/img/lightsail_console.png&quot; alt=&quot;Lightsail console&quot; title=&quot;Lightsail console&quot; /&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;I went over to create a bucket, and quite clearly you can see by the domain name, that this is an abstraction layer over S3.
&lt;a href=&quot;/img/lightsail_bucket_creation.png&quot;&gt;
&lt;img style=&quot;max-width:550px&quot; src=&quot;/img/lightsail_bucket_creation.png&quot; alt=&quot;Lightsail bucket creation&quot; title=&quot;Lightsail bucket creation&quot; /&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;I created my bucket and quickly jumped to the S3 service console, but did not see any trace of my Lightsail bucket! Sometimes one AWS service will provide an abstraction over another AWS service and resources will appear in your account for that other service, but this must be created in a different AWS account.  We’ll look more at that bucket in part 2.&lt;/p&gt;

&lt;h2 id=&quot;getting-an-access-key&quot;&gt;Getting an access key&lt;/h2&gt;
&lt;p&gt;From the Lightsail console I created an access key, which is said to be used only for Lightsail bucket access.  The first thing I did was figure out what account that key belongs to:&lt;/p&gt;

&lt;div class=&quot;highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;$ aws sts get-access-key-info --access-key-id AKIA4L53X6C6KXW6KH6W
{
    &quot;Account&quot;: &quot;850260390076&quot;
}
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;That account ID is not mine, so this access key was created in a special Lightsail account.  Let’s go ahead and use it and find out more information.&lt;/p&gt;

&lt;div class=&quot;highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;$ aws sts get-caller-identity
{
    &quot;UserId&quot;: &quot;AIDA4L53X6C6AEGC7HIQA&quot;,
    &quot;Account&quot;: &quot;850260390076&quot;,
    &quot;Arn&quot;: &quot;arn:aws:iam::850260390076:user/bucket-kgxqi8.obj-mgmt&quot;
}
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;So the username matches the bucket name, plus the &lt;code class=&quot;highlighter-rouge&quot;&gt;.obj-mgmt&lt;/code&gt; suffix, which is interesting as that makes any IAM policies for this harder for AWS to write for restricting it to the same name as the IAM user.&lt;/p&gt;

&lt;p&gt;This access key is used for S3 bucket access, so let’s try listing the buckets.&lt;/p&gt;

&lt;div class=&quot;highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;$ aws s3 ls
2021-07-23 11:13:23 bucket-kgxqi8
2018-12-26 00:57:12 cloudtrail-logs-850260390076-amazon-lightsail
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;Well now that is odd. I didn’t expect to be able to list the buckets in the account, and also didn’t expect there would already be another bucket there.  I’m unable to list the objects in that cloudtrail S3 bucket, and that creation date is a few years old even though this is the first time I believe I’ve used lightsail in this account.  That date is also not the same as the creation date of my account.&lt;/p&gt;

&lt;p&gt;I wasn’t able to do much else with the key, beyond the expected use case of interacting with my bucket, and not in any ways I found interesting.&lt;/p&gt;

&lt;p&gt;Back in my original account, I was curious to play with these new Lightsail APIs.  You can see here that in order to find the Lightsail bucket access keys, you have to provide the Lightsail bucket name, so you have to iterate through all Lightsail buckets in the account to find possible credentials.  For those that want to ensure they have no long-lived credentials in their accounts, this makes it slightly more annoying to check.&lt;/p&gt;

&lt;div class=&quot;highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;$ aws lightsail get-bucket-access-keys --bucket-name bucket-kgxqi8
{
    &quot;accessKeys&quot;: [
        {
            &quot;accessKeyId&quot;: &quot;AKIA4L53X6C6KXW6KH6W&quot;,
            &quot;status&quot;: &quot;Active&quot;,
            &quot;createdAt&quot;: &quot;2021-07-23T12:48:56-06:00&quot;
        }
    ]
}
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h1 id=&quot;why-this-access-key-is-a-problem&quot;&gt;Why this access key is a problem&lt;/h1&gt;
&lt;p&gt;A best practice on AWS is to avoid using long-lived IAM user access keys, so the creation of these seems like a step backward.  Another best practice is applying a least privileges strategy, and specifically with S3 buckets, you should avoid granting the ability to list buckets. These keys allow listing the lightsail buckets and you cannot restrict this.&lt;/p&gt;

&lt;p&gt;This key lives in another account and you do not have the same privileges over this key as you would if it was in your own account.  &lt;strike&gt;Specifically, you cannot get information about when this key was last used, so you you cannot identify unused access keys, which is another best practice to identify and revoke those.&lt;/strike&gt; Update 2021.08.08: AWS added the ability to see the last used time on these keys.&lt;/p&gt;

&lt;p&gt;In the event of a credential compromise where you wanted to revoke that access key, you could revoke the key, but you could not apply an IAM policy in order to revoke any sessions, and because &lt;code class=&quot;highlighter-rouge&quot;&gt;aws sts get-session-token&lt;/code&gt; is always possible with an access key, an attacker would be able to create their own sessions. This makes AWS’s recommendations for incident response impossible to perform.&lt;/p&gt;

&lt;h2 id=&quot;the-security-issue-cloudtrail-logs&quot;&gt;The security issue: Cloudtrail logs&lt;/h2&gt;
&lt;p&gt;The above issues make me dislike this feature, but they don’t meet the bar of being a security issue that AWS needs to fix. So this brings us to an actual security issue with these that I reported and AWS fixed.&lt;/p&gt;

&lt;p&gt;After playing with these for a bit, I looked at the Cloudtrail logs for the activities in my account, and everything aligned with my expectations, except when I looked at the call to &lt;code class=&quot;highlighter-rouge&quot;&gt;CreateBucketAccessKey&lt;/code&gt;. This was in the &lt;code class=&quot;highlighter-rouge&quot;&gt;responseElements&lt;/code&gt;&lt;/p&gt;

&lt;div class=&quot;highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&quot;accessKey&quot;: {
    &quot;secretAccessKey&quot;: &quot;gKk4ZzUFwWspe8Gx+x5iRfbDLfq7/tHH3Olss62T&quot;,
    &quot;status&quot;: &quot;Active&quot;,
    &quot;accessKeyId&quot;: &quot;HIDDEN_DUE_TO_SECURITY_REASONS&quot;,
    &quot;createdAt&quot;: &quot;Jul 23, 2021 6:48:56 PM&quot;
}
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;They redacted the wrong value! They are supposed to redact the &lt;code class=&quot;highlighter-rouge&quot;&gt;secretAccessKey&lt;/code&gt; (that’s why the name includes the word “secret”), not the access key id. This is a problem because Cloudtrail logs are not supposed to contain secrets.&lt;/p&gt;

&lt;p&gt;I immediately reported this to AWS, which unfortunately was at 8pm Mountain time on a Friday on July 23. Two hours later they emailed me an acknowledgement of the issue, and on Saturday afternoon they had a call with me to let me know a fix was being deployed and by Monday it had been fixed globally.  I really appreciate how quickly the AWS security team responds to issues and is able to get the relevant teams to produce fixes.  This issue would have required an attacker to have access to the Cloudtrail logs and be able to find out the access key id, so personally I would have ranked this as low severity and not something the team needed to work late on or over the weekend, but I was glad to see how seriously AWS took it.&lt;/p&gt;

&lt;p&gt;Unfortunately, the fix for this problem was to set the &lt;code class=&quot;highlighter-rouge&quot;&gt;responseElements&lt;/code&gt; to &lt;code class=&quot;highlighter-rouge&quot;&gt;null&lt;/code&gt;, which means you can no longer see information about which access keys were created.  This means that if you do happen to use Lightsail access keys in your account, and you have a compromise where the attacker creates new Lightsail access keys, you will not be able to easily figure out which ones they created.  You will need to identify these &lt;code class=&quot;highlighter-rouge&quot;&gt;CreateBucketAccessKey&lt;/code&gt; calls and then look at the creation dates of the Lightsail access keys to identify which ones were created during the incident so you can revoke them.&lt;/p&gt;

&lt;h1 id=&quot;conclusion&quot;&gt;Conclusion&lt;/h1&gt;
&lt;p&gt;Lightsail is a simplified version of AWS, and in order to simplify it, AWS has ignored some security best practices, such as not having long-lived access keys and issues that will be discussed in part 2.  This service is directionally not aligned with the best practices advocated by the rest of AWS.  Although Lightsail serves a certain type of customer, for most businesses, my recommendation is that you should apply an SCP over your organization to deny use of the Lightsail service, ideally by crreating an allow list of allowed services as described &lt;a href=&quot;https://summitroute.com/blog/2020/03/25/aws_scp_best_practices/#allow-only-approved-services&quot;&gt;here&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;&lt;br /&gt;&lt;br /&gt;&lt;/p&gt;
&lt;hr /&gt;

 &lt;br&gt;...&lt;a href="https://SummitRoute.com/blog/2021/08/05/lightsail_object_storage_concerns-part_1/"&gt;Read more ...&lt;/a&gt; </description>
				<pubDate>Thu, 05 Aug 2021 13:00:00 -0700</pubDate>
				<link>https://summitroute.com/blog/2021/08/05/lightsail_object_storage_concerns-part_1/</link>
				<guid isPermaLink="true">https://SummitRoute.com/blog/2021/08/05/lightsail_object_storage_concerns-part_1/</guid>
			</item>
		
			<item>
				<title>S3 backups and other strategies for ensuring data durability through ransomware attacks</title>
				<description>&lt;p&gt;Ransomware has become a primary concern for infosec. This post will discuss options for ensuring the durability of data stored on S3, through protections in place and backup strategies. The AWS backup service on AWS unfortunately does not backup S3 buckets and a lot of discussions of backups and data durability on AWS do not describe the implementation in sufficient detail, which allows a number of potential dangers. This post will show you the two best options (s3 object locks and replication policies), explains how to use these, and what to watch out for.&lt;/p&gt;

&lt;h1 id=&quot;ransom-attacks-in-aws&quot;&gt;Ransom attacks in AWS?&lt;/h1&gt;
&lt;p&gt;Wherever critical data lives, ransomware attackers will go. Although I’m not currently aware of ransomware groups that specifically targets AWS environments or S3, I have heard of ransom based attacks in AWS, along with scorched earth attacks where attackers just deleted all of the resources including data in the S3 buckets in accounts they compromised or in S3 buckets they were able to access.  One of the most infamous breaches of an AWS account, the &lt;a href=&quot;https://www.infoworld.com/article/2608076/murder-in-the-amazon-cloud.html&quot;&gt;Code Spaces breach&lt;/a&gt; back in 2014, involved a decision not to pay a ransom, the deletion of everything in an AWS account, and the subsequent shutdown of the business within 12 hours of the breach as all data (and backups) had been destroyed.&lt;/p&gt;

&lt;p&gt;On &lt;a href=&quot;https://twitter.com/0xdabbad00/status/1375511344586223619&quot;&gt;March 26&lt;/a&gt;, AWS added an inline policy to one of my IAM users (for &lt;a href=&quot;http://flaws.cloud/&quot;&gt;flaws.cloud&lt;/a&gt;) that they believed was compromised by adding a deny on &lt;code class=&quot;highlighter-rouge&quot;&gt;s3:*&lt;/code&gt;, and on &lt;a href=&quot;https://github.com/z0ph/MAMIP/commit/9b34528#diff-efaeb4a3c03d2d9aae6a25d883a74dca4696de28ecfded7a7942d7a88c05010e&quot;&gt;April 21&lt;/a&gt;, AWS released a new IAM managed policy named &lt;code class=&quot;highlighter-rouge&quot;&gt;AWSCompromisedKeyQuarantineV2&lt;/code&gt; which included a deny on &lt;code class=&quot;highlighter-rouge&quot;&gt;s3:DeleteObject&lt;/code&gt; and similar actions that would be used by an attacker to delete data. Both of those moves by AWS hint at some sort of attack they saw.&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://www.diffchecker.com/TxXkOVeE&quot;&gt;
&lt;img style=&quot;max-width:100%&quot; src=&quot;/img/diff_AWSCompromisedKeyQuarantine_vs_V2.png&quot; alt=&quot;Diff of AWSCompromisedKeyQuarantine vs v2&quot; title=&quot;Diff of AWSCompromisedKeyQuarantine vs v2&quot; /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;div class=&quot;caption&quot;&gt;Diff of AWSCompromisedKeyQuarantine vs v2&lt;/div&gt;

&lt;p&gt;&lt;br /&gt;
Spencer Gietzen, who sadly passed away earlier this year, had published research in 2019 in his posts &lt;a href=&quot;https://rhinosecuritylabs.com/aws/s3-ransomware-part-1-attack-vector/&quot;&gt;S3 Ransomware Part 1: Attack Vector&lt;/a&gt; and &lt;a href=&quot;https://rhinosecuritylabs.com/aws/s3-ransomware-part-2-prevention-and-defense/&quot;&gt;Part 2: Prevention and Defense&lt;/a&gt;, and presentation &lt;a href=&quot;https://www.youtube.com/watch?v=8QdZ2-sAQFs&quot;&gt;Ransom in the Cloud&lt;/a&gt;. Since that time, there have been some improved mitigations, that I’ll discuss.&lt;/p&gt;

&lt;h2 id=&quot;the-threat-and-constraints-im-considering&quot;&gt;The threat and constraints I’m considering&lt;/h2&gt;
&lt;p&gt;The threat I consider is having an attacker obtain admin access to an account that contains critical data in an S3 bucket.  At one end of the spectrum, this could simply be a legit admin accidentally running an aggressive script that deletes the wrong S3 bucket, and at the other end this could be a sophisticated attacker that knows their way around an AWS environment and the potential mistakes that could be made in attempting to ensure data durability.&lt;/p&gt;

&lt;p&gt;Even if you have many controls in place, ransomware groups are making enough money (supposedly over &lt;a href=&quot;https://www.bleepingcomputer.com/news/security/revil-ransomware-gang-claims-over-100-million-profit-in-a-year/&quot;&gt;$100M/yr&lt;/a&gt; for REvil) that there is a possibility of them buying effective 0-days to target your AWS admins or IT staff (that likely has the ability to do things like password resets on your AWS admins or grant themselves privileged access to your AWS accounts). So we want to ensure our controls are as good as they can be.&lt;/p&gt;

&lt;p&gt;S3 has 99.999999999% data durability of objects over a given year, and stores copies of your data redundantly across 3 AZs, meaning that even if two entire AZs in a region get destroyed at the same time, your data will persist. So we’re not concerned with a hard-drive failure at AWS resulting in our data loss.  Of interest on this topic though, be aware that AWS has &lt;a href=&quot;https://aws.amazon.com/blogs/aws/amazon-s3s-15th-birthday-it-is-still-day-1-after-5475-days-100-trillion-objects/&quot;&gt;stated&lt;/a&gt; they store over 100 trillion objects in S3, so the way the math works out, this means they lose 1,000 S3 objects per year. At scale, rare events aren’t rare. Unfortunately I’ve never heard of what this looks like when it happens (does AWS notify you? Return an error when you try reading it? Return a corrupted object? Not show it listed anymore?).&lt;/p&gt;

&lt;p&gt;For our solution, we want to maintain the existing usability of the S3 bucket as much as possible, meaning we still want the ability to modify and delete objects in this bucket, but we may wish to recover to an earlier time.  For this reason, &lt;a href=&quot;https://docs.aws.amazon.com/AmazonS3/latest/userguide/MultiFactorAuthenticationDelete.html&quot;&gt;MFA delete&lt;/a&gt; is not an acceptable solution, because to delete an object you must use the AWS root account with an MFA device and provide the MFA code for every object deletion.&lt;/p&gt;

&lt;p&gt;We want an RPO (&lt;a href=&quot;https://en.wikipedia.org/wiki/Disaster_recovery#Recovery_Point_Objective&quot;&gt;Recovery Point Objective&lt;/a&gt;) on the order of 15 minutes (meaning we are willing to lose up to the most recent 15 minutes worth of data in an incident) and RTO (&lt;a href=&quot;https://en.wikipedia.org/wiki/Disaster_recovery#Recovery_Time_Objective&quot;&gt;Recovery Time Objective&lt;/a&gt;) of a day (meaning we accept that it may take 24 hours to recover from an incident).  Understand that if you want to improve those numbers, you may need to dramatically re-architect for a better solution.&lt;/p&gt;

&lt;p&gt;We want to minimize costs. This mostly means we want to avoid having too many copies of our data and may want to use less expensive storage classes for any backups.  Copying all our data to &lt;a href=&quot;https://aws.amazon.com/snowball/pricing/&quot;&gt;Snowballs&lt;/a&gt; everynight and shipping them to different physical locations is thus not acceptable as this minimally will cost $9K/mo to cover the $300/Snowball cost, but you’ll additionally have data transfer of $0.03/GB (which is more than normal S3 charges) and shipping fees. This also will not meet our RPO and RTO goals.&lt;/p&gt;

&lt;p&gt;We assume that the need to recover is apparent when an incident happens.  If an attacker has corrupted only a single file, and then waits a year to demand a ransom to tell you which file changed, it may be very difficult to detect and is out of scope of this article.&lt;/p&gt;

&lt;h2 id=&quot;what-about-cross-region-backups&quot;&gt;What about cross-region backups?&lt;/h2&gt;
&lt;p&gt;One concept you’ll often hear about for data durability is to backup your data to another region, but there are some issues with this:&lt;/p&gt;
&lt;ol&gt;
  &lt;li&gt;Copying your data to another region incurs data transfer costs. It costs nearly as much for S3 to replicate your data to another region ($0.02/GB) as it does to store a GB in S3 for a month ($0.023), with some regional differences. Therefore if you backup your data to S3 standard in another region, you’ve nearly tripled your cost of that data. Attempting to use less expensive storage classes to save money will not work how you might expect as will be discussed later.&lt;/li&gt;
  &lt;li&gt;The possible situations that would result in the permanent loss of 3 AZs simultaneously may mean a physical disaster of significant enough impact that your business continuity may be the least of your worries.&lt;/li&gt;
  &lt;li&gt;If you’re concerned about risks that could impact an entire AWS region, your concerns are likely better addressed by backing up your data to another cloud provider in another region as well. Going multi-cloud for your backup strategy would ultimately address more risks more effectively than going multi-region within AWS.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;You may need to backup to another region for compliance reasons though, and the ideas I propose will still be useful for that scenario.&lt;/p&gt;

&lt;h1 id=&quot;protecting-the-data-in-place&quot;&gt;Protecting the data in place&lt;/h1&gt;

&lt;h2 id=&quot;least-privilege&quot;&gt;Least privilege&lt;/h2&gt;
&lt;p&gt;You should always strive to ensure least privileged access to your AWS accounts and avoid situations where an attacker would have access to your critical data. Putting your critical data in a dedicated AWS account is helpful for accomplishing this, especially if privileged users are regularly accessing your production account.&lt;/p&gt;

&lt;p&gt;Restricting access to your S3 buckets can be further enhanced via &lt;a href=&quot;https://docs.aws.amazon.com/vpc/latest/privatelink/vpc-endpoints-s3.html&quot;&gt;VPC endpoints&lt;/a&gt; to only allow access from specific VPCs. This can help ensure that even if an admin user makes a terrible mistake or is compromised, they will not be able to impact the critical S3 buckets unless they do so from the allowed VPC.&lt;/p&gt;

&lt;p&gt;When working with S3 buckets, you need to be very aware of how resource policies can grant access to principles even if that principle does not have associated IAM policies that have granted them access.  The following graph warrants its own blog post, but the critical take-away is there are two green end states, meaning two ways you can grant someone access to a resource.&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://docs.aws.amazon.com/IAM/latest/UserGuide/reference_policies_evaluation-logic.html&quot;&gt;
&lt;img style=&quot;max-width:100%&quot; src=&quot;/img/policy_evaluation_graph.png&quot; alt=&quot;Policy evaluation graph&quot; title=&quot;Policy evaluation graph&quot; /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;div class=&quot;caption&quot;&gt;AWS policy evaluation graph&lt;/div&gt;

&lt;p&gt;To explain this concept, a common issue I’ve seen is that an S3 bucket will have a statement similar to the following in its resource policy:&lt;/p&gt;

&lt;div class=&quot;highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;{
    &quot;Sid&quot;: &quot;DO_NOT_DO_THIS&quot;,
    &quot;Effect&quot;: &quot;Allow&quot;,
    &quot;Principal&quot;: &quot;*&quot;,
    &quot;Action&quot;: &quot;s3:*&quot;,
    &quot;Resource&quot;: [
        &quot;arn:aws:s3:::bucket&quot;,
        &quot;arn:aws:s3:::bucket/*&quot;
    ],
    &quot;Condition&quot;: {
        &quot;StringEquals&quot;: {
            &quot;aws:PrincipalOrgID&quot;: &quot;o-abcd1234&quot;
        }
    }
}
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;The person who set this policy wanted to make sure that it was possible for others in the organization to be able to access this bucket, but did not realize that they are actually granting access, especially to those within the same account as the bucket.  When I would do assessments, I would be given &lt;code class=&quot;highlighter-rouge&quot;&gt;SecurityAudit&lt;/code&gt; privileges, which should not allow me to read or write sensitive data, but because of this resource policy, myself and other vendors that had least privilege roles in the account would actually be given full access to that S3 bucket!&lt;/p&gt;

&lt;h2 id=&quot;random-naming&quot;&gt;Random naming&lt;/h2&gt;
&lt;p&gt;As part of least privilege you should avoid giving the ability to list the S3 buckets in the account (&lt;code class=&quot;highlighter-rouge&quot;&gt;s3:ListAllMyBuckets&lt;/code&gt;) or the objects within those buckets (&lt;code class=&quot;highlighter-rouge&quot;&gt;s3:ListBucket&lt;/code&gt;). But let’s say you give only &lt;code class=&quot;highlighter-rouge&quot;&gt;s3:PutObject&lt;/code&gt; for something that produces a critical set of logs each day that are named &lt;code class=&quot;highlighter-rouge&quot;&gt;2021-01-01.log&lt;/code&gt;, &lt;code class=&quot;highlighter-rouge&quot;&gt;2021-01-02.log&lt;/code&gt;, etc.  If someone compromises that service and knows the naming pattern, they could overwrite these log files.  There is not a way on AWS to give permissions to write an object, but not overwrite existing objects (at least not in the way most want, but object versioning discussed below helps with this). It would be better to name the files with something random, such as &lt;code class=&quot;highlighter-rouge&quot;&gt;2021-01-01-fdc1127f-7a1d-4721-a081-a66a536649ae.log&lt;/code&gt;.  You’ll still be able to identify when this log was created, but an attacker would not be able to blindly overwrite it.&lt;/p&gt;

&lt;h1 id=&quot;the-foundations-of-our-durability-options&quot;&gt;The foundations of our durability options&lt;/h1&gt;

&lt;h3 id=&quot;s3-object-versioning&quot;&gt;S3 object versioning&lt;/h3&gt;
&lt;p&gt;Many of the strategies to be discussed for data durability require &lt;a href=&quot;https://docs.aws.amazon.com/AmazonS3/latest/userguide/Versioning.html&quot;&gt;S3 object versioning&lt;/a&gt; to be enabled for the bucket (this includes S3 object locks and replication policies).  With object versioning, anytime an object is modified, it results in a new version, and when the object is deleted, it only results in the object being given a delete marker. This allows an object to be recovered if it has been overwritten or marked for deletion.  However, it is still possible for someone with sufficient privileges to permanently delete all objects and their versions, so this alone is not sufficient.&lt;/p&gt;

&lt;p&gt;When using object versioning, deleting old versions permanently is done with the call &lt;code class=&quot;highlighter-rouge&quot;&gt;s3:DeleteObjectVersion&lt;/code&gt;, as opposed to the usual &lt;code class=&quot;highlighter-rouge&quot;&gt;s3:DeleteObject&lt;/code&gt;, which means that you can apply least privilege restrictions to deny someone from deleting the old versions.  This can help mitigate some issues, but you should still do more to ensure data durability.&lt;/p&gt;

&lt;h3 id=&quot;life-cycle-policies&quot;&gt;Life cycle policies&lt;/h3&gt;
&lt;p&gt;Old versions of objects will stick around forever, and each version is an entire object, not a diff of the previous version.  So if you have a 100MB file that you change frequently, you’ll have many copies of this entire file.  AWS acknowledges in the &lt;a href=&quot;https://docs.aws.amazon.com/AmazonS3/latest/userguide/versioning-workflows.html&quot;&gt;documentation&lt;/a&gt; “you might have one or more objects in the bucket for which there are millions of versions”.  In order to reduce the number of old versions, you use &lt;a href=&quot;https://docs.aws.amazon.com/AmazonS3/latest/userguide/object-lifecycle-mgmt.html&quot;&gt;lifecycle policies&lt;/a&gt;.&lt;/p&gt;

&lt;div class=&quot;audit_tip&quot;&gt;
&lt;u&gt;Audit tip&lt;/u&gt;: It should be a considered a misconfiguration if you have object versioning enabled and no lifecycle policy on the bucket. Every versioned S3 bucket should have a `NoncurrentVersionExpiration` lifecycle policy to eventually remove objects that are no longer the latest version. For data durability, you may wish to set this to 30 days. If this data is being backed up, you may wish to set this to as little as one day on the primary data and 30 days on the backup.
&lt;/div&gt;

&lt;p&gt;If you are constantly updating the same objects multiple times per day, you may need a different solution to avoid unwanted costs.&lt;/p&gt;

&lt;div class=&quot;audit_tip&quot;&gt;
&lt;u&gt;Audit tip&lt;/u&gt;: In 2019, I audited the AWS IAM managed policies and found some issues, including what I called 
&lt;a href=&quot;https://summitroute.com/blog/2019/06/18/aws_iam_managed_policy_review/#resource-policy-privilege-escalation&quot;&gt;Resource policy privilege escalation&lt;/a&gt;. In a handful of cases AWS had attempted to create limited policies that did not allow `s3:Delete*`, but still allowed some form of `s3:Put*`.   The danger here is the ability to call `s3:PutBucketPolicy` in order to grant an external account full access to an S3 bucket to delete the objects and versions within it, or `s3:PutLifecycleConfiguration` with an expiration of 1 day for all objects which will delete all objects and their versions in the bucket.
&lt;/div&gt;

&lt;h3 id=&quot;storage-classes&quot;&gt;Storage classes&lt;/h3&gt;

&lt;p&gt;With lifecycle policies, you have the ability to transition objects to less expensive storage classes.  Be aware that there are many &lt;a href=&quot;https://docs.aws.amazon.com/AmazonS3/latest/userguide/lifecycle-transition-general-considerations.html&quot;&gt;constraints&lt;/a&gt;, specifically around the size of the object and how long you have to keep it before transitioning or deleting it.  Objects in the S3 Standard storage class  must be kept there for at least 30 days until they can be transitioned.  Further, once an object is in the S3 Intelligent-Tiering, S3 Standard-IA, and S3 One Zone-IA, those objects must be kept there for 30 days before deletion.  Objects in Glacier must be kept for 90 days before deleting, and objects in Glacier Deep Archive must be kept for 180 days.  So if you had plans of immediately transitioning all non-current object versions to Glacier Deep Archive to save money, and then deleting them after 30 days, you will not be able to.&lt;/p&gt;

&lt;h1 id=&quot;s3-object-locks&quot;&gt;S3 object locks&lt;/h1&gt;
&lt;p&gt;&lt;a href=&quot;https://aws.amazon.com/blogs/storage/protecting-data-with-amazon-s3-object-lock/&quot;&gt;S3 object locks&lt;/a&gt; are a powerful feature that allows you to ensure that an S3 object cannot be deleted until a set date, no matter what.  This is great for our data durability, but this can also be potentially dangerous because an attacker could sync in a lot of large files from a public S3 bucket, and then lock these files for up to 100 years, and by design, not even AWS can undo this.  The only way to stop paying for locked files that you don’t care about is to have AWS delete the account, which first means transitioning all your resources (except these locked files) to another account, which is often a big lift.  To help mitigate this, the &lt;a href=&quot;https://docs.aws.amazon.com/AmazonS3/latest/userguide/object-lock-managing.html&quot;&gt;AWS documentation&lt;/a&gt; has a statement that you can apply to your bucket policy, or as an SCP, that restricts people from locking objects for too long.&lt;/p&gt;

&lt;div class=&quot;highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;{
    &quot;Effect&quot;: &quot;Deny&quot;,
    &quot;Principal&quot;: &quot;*&quot;,
    &quot;Action&quot;:  &quot;s3:PutObjectRetention&quot;,
    &quot;Resource&quot;: &quot;arn:aws:s3:::bucket/*&quot;,
    &quot;Condition&quot;: {
        &quot;NumericGreaterThan&quot;: {
            &quot;s3:object-lock-remaining-retention-days&quot;: &quot;30&quot;
        }
    }
}
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;&lt;a href=&quot;https://twitter.com/iann0036&quot;&gt;Ian McKay&lt;/a&gt; put together a great &lt;a href=&quot;https://gist.github.com/iann0036/b473bbb3097c5f4c656ed3d07b4d2222&quot;&gt;list of privileges&lt;/a&gt; you should disable at the SCP level to limit some &lt;a href=&quot;https://summitroute.com/blog/2020/06/08/denial_of_wallet_attacks_on_aws/&quot;&gt;Denial of Wallet&lt;/a&gt; attacks and mistakes, such as someone using object locks (&lt;code class=&quot;highlighter-rouge&quot;&gt;s3:PutObjectRetention&lt;/code&gt;) or setting a default object lock policy (&lt;code class=&quot;highlighter-rouge&quot;&gt;s3:PutBucketObjectLockConfiguration&lt;/code&gt;).  Denying the privilege &lt;code class=&quot;highlighter-rouge&quot;&gt;s3:PutBucketObjectLockConfiguration&lt;/code&gt; will prevent someone from creating an S3 bucket that has S3 object lock enabled, but if one already exists, and the attacker has sufficient privileges, even with the above SCPs in place, the attacker could change the bucket policy to allow access from their attacker account, and because SCPs do not apply to principals in external accounts, the attacker could then fill the bucket up with objects that are locked for the next 100 years.&lt;/p&gt;

&lt;div class=&quot;audit_tip&quot;&gt;
&lt;u&gt;Audit tip&lt;/u&gt;: Ensure you apply SCPs to your accounts to prevent Denial of Wallet attacks using object locking and prevent locking objects for more than a duration you are comfortable with.
&lt;/div&gt;

&lt;p&gt;Despite the above concern, S3 object lock is the most powerful feature on AWS for ensuring your data cannot be deleted. You can also apply a default object lock retention period to an S3 bucket which means how you interact with the S3 bucket will not change.  Objects can still be marked for deletion as happens normally with S3 object versioning, but the object cannot be deleted until the lock expiration date happens.&lt;/p&gt;

&lt;p&gt;The problem I have with S3 object lock from a data durability perspective, is there isn’t a concept of a rolling lock. I want to say “Allow objects to be marked for deletion, but don’t allow them to be permanently deleted for 30 days after that”. To explain this, imagine you have an object lock configuration that locks your objects for 30 days.  You then put some critical objects in it.  If your account is breached on day 1, the attacker will not be able to permanently delete these objects.  If the attacker breaches the account on day 31 with sufficient privileges, they can wipe out all your critical data that you had put there on day 1.&lt;/p&gt;

&lt;p&gt;One possible solution is to run a nightly process to iterate through all your objects and put an object lock on the latest object versions.  This can be done with the &lt;a href=&quot;https://aws.amazon.com/blogs/aws/new-amazon-s3-batch-operations/&quot;&gt;S3 Batch service&lt;/a&gt; as documented &lt;a href=&quot;https://docs.aws.amazon.com/AmazonS3/latest/userguide/batch-ops-retention-date.html&quot;&gt;here&lt;/a&gt;.&lt;/p&gt;

&lt;h1 id=&quot;replication-policies&quot;&gt;Replication policies&lt;/h1&gt;
&lt;p&gt;The classic approach to data durability is to create backups and ensure the backups are separate from the primary data.  In AWS, in order to have a strong security boundary, this must be done in a separate AWS account. Ideally, this would be completely separate from your other accounts (separate AWS organization, not accessed through your normal SSO process, accessed only with special unmanaged laptops, etc.), but there are good arguments for not going to this extreme, especially because it often means attempting to duplicate many of your security controls.  Another important concern is that you will likely have multiple sets of critical data that have potentially been strongly isolated, all being backed up to the same AWS account.  In doing so, the backup account becomes an attractive target full of sensitive data.&lt;/p&gt;

&lt;div class=&quot;audit_tip&quot;&gt;
&lt;u&gt;Audit tip&lt;/u&gt;: Ensure sufficient isolation of the backup account.  You should be fully aware of, and acknowledge the risks or take steps to mitigate, situations where:
&lt;ul&gt;
&lt;li&gt; The same people have access to both the primary data and backup data.&lt;/li&gt;
&lt;li&gt; The IT or help team has the ability to reset credentials or deploy software updates to the people with access to the backup data, or to add themselves to the groups that have access.&lt;/li&gt;
&lt;li&gt; Any cross-account AWS roles that grant write or delete access into the backup account from other accounts.&lt;/li&gt;
&lt;li&gt;Monitoring or security controls on the backup account are not aligned with how other accounts are secured.&lt;/li&gt;
&lt;/ul&gt;
&lt;/div&gt;

&lt;p&gt;The easiest way to setup S3 backups is through &lt;a href=&quot;https://docs.aws.amazon.com/AmazonS3/latest/userguide/replication.html&quot;&gt;replication policies&lt;/a&gt;, which can copy objects to an S3 bucket in a different account in the same region or a different region.  To do this, you need to:&lt;/p&gt;
&lt;ul&gt;
  &lt;li&gt;Create an &lt;a href=&quot;https://docs.aws.amazon.com/AmazonS3/latest/userguide/setting-repl-config-perm-overview.html#setting-repl-config-same-acctowner&quot;&gt;IAM role&lt;/a&gt; that will replicate this data.&lt;/li&gt;
  &lt;li&gt;Set the bucket resource policy in the target bucket in the backup account to allow the source account to send data to it, as documented &lt;a href=&quot;https://docs.aws.amazon.com/AmazonS3/latest/userguide/replication-walkthrough-2.html&quot;&gt;here&lt;/a&gt;.&lt;/li&gt;
  &lt;li&gt;Set replication policy on the source bucket in primary account.
    &lt;ul&gt;
      &lt;li&gt;Ensure &lt;a href=&quot;https://docs.aws.amazon.com/AmazonS3/latest/userguide/delete-marker-replication.html&quot;&gt;delete markers&lt;/a&gt; are replicated.&lt;/li&gt;
      &lt;li&gt;Include &lt;a href=&quot;https://docs.aws.amazon.com/AmazonS3/latest/userguide/replication-change-owner.html&quot;&gt;changing the replica owner&lt;/a&gt; to the policy.&lt;/li&gt;
      &lt;li&gt;Set a less expensive storage class for the replicated data.&lt;/li&gt;
      &lt;li&gt;Optional: Ensure &lt;a href=&quot;https://docs.aws.amazon.com/AmazonS3/latest/userguide/replication-walkthrough-5.html&quot;&gt;Replication Time Control&lt;/a&gt; is enabled to ensure the objects are replicated within 15 minutes for 99.99% of objects.&lt;/li&gt;
    &lt;/ul&gt;
  &lt;/li&gt;
  &lt;li&gt;Set lifecycle polices on the source and destination buckets to clean out the non-latest version of objects.&lt;/li&gt;
  &lt;li&gt;Optional: Monitor &lt;a href=&quot;https://docs.aws.amazon.com/AmazonS3/latest/userguide/replication-metrics.html&quot;&gt;notification events&lt;/a&gt; for replication failures.&lt;/li&gt;
&lt;/ul&gt;

&lt;div class=&quot;audit_tip&quot;&gt;
&lt;u&gt;Audit tip&lt;/u&gt;: You must ensure the bucket policy on the destination (backup) bucket is not too open. If this grants the source account too much access, then the attacker, from the source account, will be able to delete the logs in the backup bucket. The bucket policy should only allow the IAM role in the source account the following actions, limited to the backup bucket: `s3:ReplicateDelete`, `s3:ReplicateObject`, `s3:List*`, and `s3:GetBucketVersioning`.  The documentation lists `s3:PutBucketVersioning` but this seems unnecessary.
&lt;/div&gt;

&lt;div class=&quot;audit_tip&quot;&gt;
&lt;u&gt;Audit tip&lt;/u&gt;: 
If the backup objects are encrypted, you should consider whether the attacker can delete the key that would be used to decrypt the backups, or else your backups could become useless in an incident.
&lt;/div&gt;

&lt;h2 id=&quot;recovery&quot;&gt;Recovery&lt;/h2&gt;
&lt;p&gt;In the event that an attacker has compromised and destroyed your primary data, your backup bucket will have deletion markers on it that you’ll need to remove. You’ll then need to copy your data back from your backup bucket to the primary bucket.  Be mindful in how you do this that you do not enable an attacker that may still be around to have write access to your backups. AWS is &lt;a href=&quot;https://aws.amazon.com/premiumsupport/knowledge-center/s3-large-transfer-between-buckets/&quot;&gt;not clear&lt;/a&gt; on what the fastest method is for this, but I think &lt;a href=&quot;https://aws.amazon.com/datasync/&quot;&gt;AWS DataSync&lt;/a&gt; may be the best solution.  You should work with your TAM or AWS support on this recovery process.  A problem with many ransomware cases I’ve heard is that recovering from backups takes longer than just paying the ransom and recovering that way, but I don’t think this would be the case for data stored in S3.&lt;/p&gt;

&lt;h1 id=&quot;further-considerations&quot;&gt;Further considerations&lt;/h1&gt;

&lt;p&gt;With object locking and replication policies, when these are applied to an existing S3 bucket, the objects that already exist in the S3 bucket will not be impacted.  So if you have an existing S3 with critical data in it, you must take actions to replicate or lock the existing files. AWS support can assist with replicating files and enabling object locking on existing S3 buckets.&lt;/p&gt;

&lt;h2 id=&quot;detections&quot;&gt;Detections&lt;/h2&gt;
&lt;p&gt;You should setup monitoring to detect and alert on the following:&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;Detect &lt;code class=&quot;highlighter-rouge&quot;&gt;s3:PutBucketLifecycleConfiguration&lt;/code&gt; as this can be used to delete objects. Mark it has high severity if it is less than some amount, say 30 days, or when it is not on the non-current object version.&lt;/li&gt;
  &lt;li&gt;Detect &lt;code class=&quot;highlighter-rouge&quot;&gt;s3:PutBucketPolicy&lt;/code&gt; calls on any critical S3 buckets.&lt;/li&gt;
  &lt;li&gt;For data events:
    &lt;ul&gt;
      &lt;li&gt;Detect calls to &lt;code class=&quot;highlighter-rouge&quot;&gt;s3:DeleteObjectVersion&lt;/code&gt;.&lt;/li&gt;
      &lt;li&gt;Detect access denied calls to &lt;code class=&quot;highlighter-rouge&quot;&gt;s3:DeleteObject&lt;/code&gt;&lt;/li&gt;
    &lt;/ul&gt;
  &lt;/li&gt;
  &lt;li&gt;Detect the creation of any S3 bucket with object locking enabled and auto-remediate.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Cloudtrail data events can get expensive (both to record and to monitor), but you can use &lt;a href=&quot;https://aws.amazon.com/about-aws/whats-new/2020/12/aws-cloudtrail-provides-more-granular-control-of-data-event-logging/&quot;&gt;advanced event selectors&lt;/a&gt; to look for specific object level APIs and filter on specific S3 buckets.&lt;/p&gt;

&lt;h1 id=&quot;conclusion&quot;&gt;Conclusion&lt;/h1&gt;
&lt;p&gt;Ensuring S3 data cannot be deleted by an attacker is not entirely trivial, but hopefully this guide has explained the better options (s3 object locking and replication policies) and pointed out some common problems to watch out for.&lt;/p&gt;

&lt;h2 id=&quot;references&quot;&gt;References&lt;/h2&gt;

&lt;ul&gt;
  &lt;li&gt;&lt;a href=&quot;https://securingthe.cloud/aws/protecting-amazon-s3-data-from-ransomware/&quot;&gt;Protecting Amazon S3 Data from Ransomware&lt;/a&gt; by &lt;a href=&quot;https://twitter.com/benji_potter&quot;&gt;Ben Potter&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;br /&gt;&lt;br /&gt;&lt;/p&gt;
&lt;hr /&gt;

 &lt;br&gt;...&lt;a href="https://SummitRoute.com/blog/2021/08/03/S3_backups_and_other_strategies_for_ensuring_data_durability_through_ransomware_attacks/"&gt;Read more ...&lt;/a&gt; </description>
				<pubDate>Tue, 03 Aug 2021 13:00:00 -0700</pubDate>
				<link>https://summitroute.com/blog/2021/08/03/S3_backups_and_other_strategies_for_ensuring_data_durability_through_ransomware_attacks/</link>
				<guid isPermaLink="true">https://SummitRoute.com/blog/2021/08/03/S3_backups_and_other_strategies_for_ensuring_data_durability_through_ransomware_attacks/</guid>
			</item>
		
			<item>
				<title>AWS security project ideas</title>
				<description>&lt;p&gt;I’m excited to announce that I’ve taken a new job and am shutting down my consulting business.  This post will discuss some project ideas I never got to, but first I want to briefly discuss this move. It’s weird to move on from something I built over the past 3.5 years and that was by all definitions a success. I’ve had dozens of clients across 5 continents, was quoted in the WSJ, keynoted a conference in Switzerland, travelled to South Africa to train people, obtained over 10,000 followers on Twitter, worked with Duo Security to create some of the most popular open-source cloud security tools, and generally have become one of the goto people in the world for AWS security.&lt;/p&gt;

&lt;p&gt;It all started with the release of &lt;a href=&quot;https://summitroute.com/blog/2017/02/26/flaws_challenge/&quot;&gt;flaws.cloud&lt;/a&gt; almost 4 years ago to this day, which motivated me to quit my job and start that new adventure.  I’ve had a ton of personal and professional growth along the way. I highly recommend considering that life path and have written about how to do something similar &lt;a href=&quot;https://twitter.com/0xdabbad00/status/1262056865665409025&quot;&gt;here&lt;/a&gt; and &lt;a href=&quot;https://twitter.com/0xdabbad00/status/1284193457175552000&quot;&gt;here&lt;/a&gt;.  I’m excited for this new opportunity where I can focus on challenges that require deeper integrations, architectural changes, and longer time horizons than short-term contract work.&lt;/p&gt;

&lt;p&gt;This post will describe project ideas I didn’t get around to as I suspect I’ll be a bit too busy for a while to get them. If you’d like to kick start a consulting business, draw attention to the engineering talent of your organization, or possibly create a SaaS business to get some extra revenue, these are some ideas that I think the world of AWS security would benefit from.&lt;/p&gt;

&lt;h2 id=&quot;security-group-optimizer-using-vpc-flow-logs&quot;&gt;Security Group optimizer using VPC Flow Logs&lt;/h2&gt;
&lt;p&gt;In much the same way as tools such as &lt;a href=&quot;https://github.com/Netflix/repokid&quot;&gt;repokid&lt;/a&gt; and &lt;a href=&quot;https://github.com/duo-labs/cloudtracker&quot;&gt;cloudtracker&lt;/a&gt; have recommended or auto-remediated changes to IAM privileges based on the privileges actually used (as evidenced by Access Advisor or CloudTrail logs) vs the privileges granted, the concept here would be to take the existing Security Groups (ie. network access granted) and available VPC Flow Logs (ie. network access used) and perform a diff. The resulting output would allow you to recommend changes, so you could say “This EC2 has never received traffic on port 80, therefore that Security Group can be changed”.  I suspect that much like the problems I encountered in graphing network diagrams with CloudMapper, this may be more difficult in larger environments. You would also likely need to take CloudTrail logs into consideration in order to understand what EC2s (or other resource) existed at the time of the flow logs. AWS has a blog post &lt;a href=&quot;https://aws.amazon.com/blogs/security/how-to-visualize-and-refine-your-networks-security-by-adding-security-group-ids-to-your-vpc-flow-logs/&quot;&gt;here&lt;/a&gt; that mentioned some analysis of VPC Flow Logs for Security Group improvements, but is minimal in terms of what all could be done.&lt;/p&gt;

&lt;h2 id=&quot;investigate-memory-capture-using-ec2-hibernation&quot;&gt;Investigate memory capture using EC2 hibernation&lt;/h2&gt;
&lt;p&gt;When AWS updated their &lt;a href=&quot;https://d1.awsstatic.com/whitepapers/aws_security_incident_response.pdf&quot;&gt;Incident Response&lt;/a&gt; whitepaper in June 2020, the biggest change was the mention of using EC2 hibernation for memory capture.  Historically it has been very easy to take a disk snapshot of an EC2, but doing a memory capture required third party tools.  Having AWS native functionality for memory capture is very interesting, but there are a ton of limitations and requirements for this to be possible, and it’d be interesting in seeing this explored. See some discussion &lt;a href=&quot;https://twitter.com/0xdabbad00/status/1273678304201998336&quot;&gt;here&lt;/a&gt;.&lt;/p&gt;

&lt;h2 id=&quot;iam-privilege-aggregator&quot;&gt;IAM privilege aggregator&lt;/h2&gt;
&lt;p&gt;I have often found myself trying to understand what all the privileges a role has when taking into consideration the IAM policies, Permission Boundaries, and SCPs being applied to it.  At a minimum it would be nice to just concat all these together into one place, especially for SCPs which can be applied to the account or multiple levels of OUs.  Ideally though you’d like something that can understand how these operate together and give you the actual privileges in some minimized way.  For example, if an IAM role has an admin policy, but a permission boundary that only allows access to S3 and an SCP that denies changing GuardDuty, you’d like to see that the role can only access S3.  This functionality is needed for some later projects.&lt;/p&gt;

&lt;h2 id=&quot;access-denied-explainer&quot;&gt;Access Denied explainer&lt;/h2&gt;
&lt;p&gt;Similar to the “IAM privilege aggregator”, a situation that is going to become an increasingly worse problem on AWS, is debugging why something was denied.  When you get an Access Denied error, there is no further context, either within the API response or CloudTrail logs.  Imagine trying to access an S3 bucket and getting an Access Denied.  Was it because you didn’t have privileges, or because of a permission boundary, a bucket policy, or SCP denying access? This problem is made worse because from an account you do not have an ability to see what SCPs have been applied to you.  Is the access restricted based on some set of conditions?  Maybe the tags on the bucket don’t match the tags required for your access?&lt;/p&gt;

&lt;p&gt;As SCPs become more common and as AWS advocates greater use of &lt;a href=&quot;https://summitroute.com/blog/2020/11/02/state_of_abac_on_aws/&quot;&gt;ABAC&lt;/a&gt;, this situation is going to happen more frequently and become harder to debug.  Minimally, you want to at least tell someone the relevant statements and conditions for the privilege involved.  The ultimate goal wold be to tie this to the CloudTrail events in EventBridge to look for Access Denied messages in real-time and then automatically send a Slack message to someone telling them “Hey, looks like you tried to create an EC2, but you’re only allowed to use t3.micro instances in that account”.  There are some common conditions like that which you could have pre-planned conversational text for.  If you build that, there are people I know right now that would write you checks.  Another option would be to use &lt;a href=&quot;https://summitroute.com/blog/2020/05/25/client_side_monitoring/&quot;&gt;CSM&lt;/a&gt; to identify these Access Denieds locally or in special cases, such as when unit tests are run in a CI/CD or staging environment.&lt;/p&gt;

&lt;h2 id=&quot;scp-baseline-creator&quot;&gt;SCP baseline creator&lt;/h2&gt;
&lt;p&gt;Once in an engagement I was given access to a newly created account that had been initialized with the company baseline that included IAM roles for a vendor, enabled GuardDuty, EventBridge rules, etc. I was asked to create an SCP that could protect those configurations, so for example if a developer runs aws-nuke on a sandbox account, it doesn’t modify this baseline.  It should be fairly easy to generate an SCP based on some common features like that which has built-in functionality for exception conditions so that those features can still be changed by a certain Organization accessible admin role.&lt;/p&gt;

&lt;p&gt;Along with this, it would be nice to have a differ and some sort of linter, such that you could identify that an existing SCP, for example, does not properly protect GuardDuty.&lt;/p&gt;

&lt;h2 id=&quot;tagging-policy-scp-generator&quot;&gt;Tagging policy SCP generator&lt;/h2&gt;
&lt;p&gt;Many companies would like to ensure all their resources are tagged with certain keys, such as an Owner tag.  You might think that the Organization feature Tag Policies could do this, but you would be sorely dissapointed, just like everyone else that ever tried using that feature to do anything meaningful.  One way of accomplishing this is to auto-remediate or otherwise detect improperly tagged resources after the fact, but I believe a better way would be to enforce this via an SCP. Before doing this, you’ll want the “Access Denied explainer” project to exist, or else you will bring sadness and frustration to your developers.&lt;/p&gt;

&lt;h2 id=&quot;aws-listdescribe-proxy&quot;&gt;AWS List/Describe proxy&lt;/h2&gt;
&lt;p&gt;Many companies have multiple tools scanning their accounts looking for security, tagging, cost, operations, and other issues.  As these tools make List and Describe calls, in large environments, eventually they are rate limited and companies try to make use of AWS Config, which requires you to change how you make queries and also lacks coverage across a number of services and features.  It would be better to have a single tool collect this information, possibly leveraging AWS Config and also possibly leveraging the CloudTrail data to keep it updated without querying (or at least without querying as often).  Netflix began down this path with their &lt;a href=&quot;https://netflix-skunkworks.github.io/historical/&quot;&gt;Historical&lt;/a&gt; project, but no longer maintains that project.  Ideally, this would work fairly transparently, such that you could trick an application into visiting your server instead of amazonaws.com (such as via /etc/hosts and the SDK environment variable CA_BUNDLE so you get through HTTPS), then you’d either respond with the data or relay the request to AWS.  In environments that use AWS Config, you might convert the request into an Athena query against the data in S3 as explained &lt;a href=&quot;https://aws.amazon.com/blogs/mt/how-to-query-your-aws-resource-configuration-states-using-aws-config-and-amazon-athena/&quot;&gt;here&lt;/a&gt;.&lt;/p&gt;

&lt;h2 id=&quot;improving-existing-tools&quot;&gt;Improving existing tools&lt;/h2&gt;
&lt;p&gt;The ideas above were for some new projects. There are lots of features and improvements to &lt;a href=&quot;https://github.com/duo-labs/cloudmapper&quot;&gt;CloudMapper&lt;/a&gt; that I haven’t gotten to as well, in addition to just general maintenance and bug fixes of &lt;a href=&quot;https://github.com/duo-labs/cloudtracker&quot;&gt;CloudTracker&lt;/a&gt;.  One valuable focus area for CloudMapper is on the identification and visualization of trust relationships between accounts.  CloudMapper, via the weboftrust command, can identify trust relationships between accounts of IAM roles, S3 buckets, and VPC peerings.  There are lots more relationships that can exist, and one could start by going through the list of &lt;a href=&quot;https://github.com/SummitRoute/aws_exposable_resources&quot;&gt;aws_exposable_resources&lt;/a&gt;.  The visualization of these could also be improved by simply creating a table as one option.  In theory Access Analyzer could find many of these relationships, but that tool lacks the coverage you would expect.&lt;/p&gt;

&lt;h1 id=&quot;conclusion&quot;&gt;Conclusion&lt;/h1&gt;
&lt;p&gt;I’m not going away, but I might not ever get to some of these things, and I don’t want these ideas to die, so go forth and do awesome things!&lt;/p&gt;

&lt;p&gt;&lt;br /&gt;&lt;br /&gt;&lt;/p&gt;
&lt;hr /&gt;

 &lt;br&gt;...&lt;a href="https://SummitRoute.com/blog/2021/02/16/aws_security_project_ideas/"&gt;Read more ...&lt;/a&gt; </description>
				<pubDate>Tue, 16 Feb 2021 12:00:00 -0800</pubDate>
				<link>https://summitroute.com/blog/2021/02/16/aws_security_project_ideas/</link>
				<guid isPermaLink="true">https://SummitRoute.com/blog/2021/02/16/aws_security_project_ideas/</guid>
			</item>
		
			<item>
				<title>AWS Security Maturity Roadmap 2021</title>
				<description>&lt;p&gt;This is the third annual release of my “&lt;a href=&quot;https://summitroute.com/downloads/aws_security_maturity_roadmap-Summit_Route.pdf&quot;&gt;AWS Security Maturity Roadmap&lt;/a&gt;” to give companies a series or actionable steps to improve the security of their AWS environments. Each year I update this with the latest features of AWS, along with improvements based on my discussions with clients, other consultants, and more who have gone through some of these activities or encountered challenges, or have mentioned new ideas.  This includes companies of all sizes, risk tolerances, and integration (from lift and shift to completely serverless).&lt;/p&gt;

&lt;p&gt;Changes include:&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;Added that your root email addresses should be under your company domain and on email distribution lists as I’ve found many accounts during assessments that were associated with old aol.com emails and other personal accounts. This is how AWS communicates with you and is an important part of account recovery.&lt;/li&gt;
  &lt;li&gt;Added &lt;a href=&quot;https://summitroute.com/blog/2021/01/06/opting_out_of_aws_ai_data_usage/&quot;&gt;opting out&lt;/a&gt; of the AI services from sending your data outside of the regions you put it in.&lt;/li&gt;
  &lt;li&gt;Added budget alarms to Stage 1. Although less likely to provide as much value for larger enterprises, these are very important for individuals and small businesses. Also mentioned &lt;a href=&quot;https://aws.amazon.com/blogs/aws-cost-management/preview-anomaly-detection-and-alerting-now-available-in-aws-cost-management/&quot;&gt;Cost Anomaly Detection&lt;/a&gt; and &lt;a href=&quot;https://aws.amazon.com/blogs/aws-cost-management/get-started-with-aws-budgets-actions/&quot;&gt;Budget Actions&lt;/a&gt;.&lt;/li&gt;
  &lt;li&gt;Mentioned that you should consider using GuardDuty’s &lt;a href=&quot;https://aws.amazon.com/blogs/aws/identify-unintended-resource-access-with-aws-identity-and-access-management-iam-access-analyzer/&quot;&gt;S3 monitoring&lt;/a&gt;, which for monitoring, is as an alternative to Macie.&lt;/li&gt;
  &lt;li&gt;Mentioned the use of &lt;a href=&quot;https://aws.amazon.com/blogs/aws/new-use-aws-cloudformation-stacksets-for-multiple-accounts-in-an-aws-organization/&quot;&gt;CloudFormation StackSets with Organizations&lt;/a&gt; which is an Organization feature that deploys a CloudFormation StackSet whenever a new account is created to ensure it is initialized with your baseline.&lt;/li&gt;
  &lt;li&gt;Discussed using a ticketing system for alerts, as I’ve found the ways in which companies receive alerts to vary in maturity which impacts their ability to properly monitor and respond to incidents.&lt;/li&gt;
  &lt;li&gt;Discussed turning on more log sources, such as &lt;a href=&quot;https://aws.amazon.com/blogs/aws/log-your-vpc-dns-queries-with-route-53-resolver-query-logs/&quot;&gt;VPC DNS queries&lt;/a&gt;, VPC Flow Logs, S3 access logs, etc. and linked to a post by &lt;a href=&quot;https://twitter.com/matthewdfuller&quot;&gt;Matt Fuller&lt;/a&gt; for a list of log sources on AWS: &lt;a href=&quot;https://matthewdf10.medium.com/how-to-enable-logging-on-every-aws-service-in-existence-circa-2021-5b9105b87c9&quot;&gt;How to Enable Logging on Every AWS Service in Existence (Circa 2021)&lt;/a&gt;.&lt;/li&gt;
  &lt;li&gt;Mentioned that IAM user access keys, when required, should ideally be put in a single account and assume roles into other accounts as it makes detection of compromise easier.&lt;/li&gt;
  &lt;li&gt;Mentioned that Access Advisor now shows the use of s3:ListAllMyBuckets, so you should use that to remove that specific privilege when not needed.&lt;/li&gt;
  &lt;li&gt;Discussed the need to plan how accounts will be connected, as the security boundaries of separate accounts can become blurred due to trust relationships of resource policies, network connections, and other mechanisms.&lt;/li&gt;
  &lt;li&gt;Expanded on the discussion of using SCPs to mention how exceptions can be made for specific roles, and SCPs can vary between accounts. Therefore, you can initialize an account by configuring it’s network configuration in advance and restricting changes via SCPs, such that a dev account may be restricted from making any resources public. Also listed possible SCPs to deploy, which are described in my post &lt;a href=&quot;https://summitroute.com/blog/2020/03/25/aws_scp_best_practices/&quot;&gt;AWS SCP Best Practices&lt;/a&gt;.&lt;/li&gt;
  &lt;li&gt;Mentioned &lt;a href=&quot;https://aws.amazon.com/blogs/opensource/accelerate-infrastructure-as-code-development-with-open-source-former2/&quot;&gt;former2&lt;/a&gt; for helping transition to IaC (Infrastructure as Code).&lt;/li&gt;
  &lt;li&gt;Mentioned that IaC scanning tools can be used, referencing &lt;a href=&quot;https://twitter.com/christophetd&quot;&gt;Christophe’s&lt;/a&gt; post &lt;a href=&quot;https://blog.christophetd.fr/shifting-cloud-security-left-scanning-infrastructure-as-code-for-security-issues/&quot;&gt;Shifting Cloud Security Left — Scanning Infrastructure as Code for Security Issues&lt;/a&gt;.&lt;/li&gt;
  &lt;li&gt;Removed mention of &lt;a href=&quot;https://aws.amazon.com/blogs/aws/new-use-tag-policies-to-manage-tags-across-multiple-aws-accounts/&quot;&gt;Tag Policies&lt;/a&gt; as this service is limited in various ways that make it not worth bothering with.&lt;/li&gt;
  &lt;li&gt;Merged “Stage 8: Enhance detection” and “Stage 9: Auto-remediation and privilege refinement” into one stage. Mostly because I wanted this to be 10 stages. :)&lt;/li&gt;
  &lt;li&gt;Mentioned Client Side Monitoring as part of the least privilege improvements, and linked to the cloudonaut article &lt;a href=&quot;https://cloudonaut.io/record-aws-api-calls-to-improve-iam-policies/&quot;&gt;Record AWS API calls to improve IAM Policies&lt;/a&gt;.&lt;/li&gt;
  &lt;li&gt;Mentioned the AWS &lt;a href=&quot;https://aws.amazon.com/network-firewall/&quot;&gt;Network Firewall&lt;/a&gt; as a solution for monitoring and protecting your networks.&lt;/li&gt;
  &lt;li&gt;Mentioned the use of microservices to access resources instead of direct access so that better monitoring, restrictions, and rate limiting can be performed.&lt;/li&gt;
&lt;/ul&gt;

&lt;center style=&quot;font-size:200%&quot;&gt;Download the &lt;a href=&quot;/downloads/aws_security_maturity_roadmap-Summit_Route.pdf&quot;&gt;AWS Security Maturity Roadmap&lt;/a&gt; for 2021&lt;/center&gt;
 &lt;br&gt;...&lt;a href="https://SummitRoute.com/blog/2021/01/12/2021_aws_security_maturity_roadmap_2021/"&gt;Read more ...&lt;/a&gt; </description>
				<pubDate>Tue, 12 Jan 2021 04:00:00 -0800</pubDate>
				<link>https://summitroute.com/blog/2021/01/12/2021_aws_security_maturity_roadmap_2021/</link>
				<guid isPermaLink="true">https://SummitRoute.com/blog/2021/01/12/2021_aws_security_maturity_roadmap_2021/</guid>
			</item>
		
			<item>
				<title>Opting out of AWS AI data usage</title>
				<description>&lt;p&gt;&lt;strong&gt;Update 2022.02.22: AWS has no team managing this feature and now some services work slightly differently depending on if this feature is enabled or not. Some caution must therefore be taken when enabling this. AWS is working on better documenting what these differences are.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;This post will discuss why you should opt out of the AI data usage on AWS, how to do that, and how to confirm you did it correctly.&lt;/p&gt;

&lt;p&gt;A general rule on AWS is that your data will not leave the region you put it in.  AWS customers rely on this for compliance, data sovereignty, and other reasons.  Another general rule is that AWS will not access your data.  AWS customers rely on this because they want to use AWS services, but do not want Amazon to use their data to create competing products or improve their services in such a way that it would directly benefit existing competitors.&lt;/p&gt;

&lt;p&gt;In 2017 AWS made exceptions for these rules for their Machine Learning and Artificial Intelligence services in the &lt;a href=&quot;https://aws.amazon.com/service-terms/&quot;&gt;AWS Service Terms&lt;/a&gt;.  Specifically, under section 50.3, by using AWS services such as Lex, Transcribe, and more, you automatically opt in to allowing AWS “to develop and improve AWS and affiliate machine-learning and artificial-intelligence technologies” and that they may store your data outside of the region you put it in. Section 50.4, as I understand it, then informs you that it is your responsibility to disclose this use by AWS to your own users in order to abide by various laws, such as the Children’s Online Privacy Protection Act (COPPA).&lt;/p&gt;

&lt;p&gt;The AWS terms are not often read or understood, other than the regular chuckle about Amazon Lumberyard having a clause related to zombies (section 42.10). So it wasn’t until AWS &lt;a href=&quot;https://github.com/aws/aws-sdk-go/releases/tag/v1.33.4&quot;&gt;added functionality to the SDK&lt;/a&gt; for Organizations and subsequent &lt;a href=&quot;https://aws.amazon.com/about-aws/whats-new/2020/07/easily-manage-content-policies-ai-services-aws-organizations/&quot;&gt;announcement&lt;/a&gt; in July 2020 that I noticed the section about the AI services. They added functionality to the SDK to opt-out of this data usage, which is described in the docs &lt;a href=&quot;https://docs.aws.amazon.com/organizations/latest/userguide/orgs_manage_policies_ai-opt-out.html&quot;&gt;here&lt;/a&gt;.  Opting out of this still allows you to use these services. Opting out just means that now AWS won’t copy your data or use it for their own benefit.  There is no negative to opting out other than that maybe these services may not be improved as much as they would otherwise.&lt;/p&gt;

&lt;p&gt;The functionality has all sorts of complexity to allow opting out of specific services, default allowing some services, having different policies for different accounts, and whether accounts can make exceptions.  This is ridiculous because anyone that learns about this and takes action is only going to ensure that all of their accounts are opted out.&lt;/p&gt;

&lt;p&gt;The remainder of this article will explain how to turn this on and how to confirm it is on.&lt;/p&gt;

&lt;h1 id=&quot;opting-out&quot;&gt;Opting out&lt;/h1&gt;

&lt;p&gt;You should opt out of this data usage. You can do this by following the &lt;a href=&quot;https://docs.aws.amazon.com/organizations/latest/userguide/orgs_manage_policies_ai-opt-out_create.html&quot;&gt;docs&lt;/a&gt; to enable the opt-out ability, creating a policy, and associating that policy with your organization root. The policy you create should be:&lt;/p&gt;

&lt;div class=&quot;language-json highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
    &lt;/span&gt;&lt;span class=&quot;nl&quot;&gt;&quot;services&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
        &lt;/span&gt;&lt;span class=&quot;nl&quot;&gt;&quot;@@operators_allowed_for_child_policies&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;@@none&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;],&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
        &lt;/span&gt;&lt;span class=&quot;nl&quot;&gt;&quot;default&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
            &lt;/span&gt;&lt;span class=&quot;nl&quot;&gt;&quot;@@operators_allowed_for_child_policies&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;@@none&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;],&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
            &lt;/span&gt;&lt;span class=&quot;nl&quot;&gt;&quot;opt_out_policy&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
                &lt;/span&gt;&lt;span class=&quot;nl&quot;&gt;&quot;@@operators_allowed_for_child_policies&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;@@none&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;],&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
                &lt;/span&gt;&lt;span class=&quot;nl&quot;&gt;&quot;@@assign&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;optOut&quot;&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
            &lt;/span&gt;&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
        &lt;/span&gt;&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
    &lt;/span&gt;&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
&lt;p&gt;This policy is documented &lt;a href=&quot;https://docs.aws.amazon.com/organizations/latest/userguide/orgs_manage_policies_ai-opt-out_syntax.html&quot;&gt;here&lt;/a&gt; and will opt you out of all services from using your data for all accounts, and will not allow member accounts to create exceptions. As mentioned, these policies are needlessly complex.&lt;/p&gt;

&lt;p&gt;To opt-out via terraform you can use this &lt;a href=&quot;https://gist.github.com/christophetd/a36dfc89323513ad1c61048a3c2dd8a6&quot;&gt;gist&lt;/a&gt; from &lt;a href=&quot;https://twitter.com/christophetd&quot;&gt;Christophe Tafani-Dereeper&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;This process can be done from the command-line with the following with a session to the Organization management account:&lt;/p&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;c&quot;&gt;# Get root id&lt;/span&gt;
&lt;span class=&quot;nb&quot;&gt;export &lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;ROOT_ID&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;sb&quot;&gt;`&lt;/span&gt;aws organizations list-roots | jq &lt;span class=&quot;nt&quot;&gt;-cr&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;'.Roots[0].Id'&lt;/span&gt;&lt;span class=&quot;sb&quot;&gt;`&lt;/span&gt;

&lt;span class=&quot;c&quot;&gt;# Enable the feature&lt;/span&gt;
aws organizations enable-policy-type &lt;span class=&quot;nt&quot;&gt;--root-id&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$ROOT_ID&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;--policy-type&lt;/span&gt; AISERVICES_OPT_OUT_POLICY

&lt;span class=&quot;c&quot;&gt;# Create the policy&lt;/span&gt;
aws organizations create-policy &lt;span class=&quot;nt&quot;&gt;--type&lt;/span&gt; AISERVICES_OPT_OUT_POLICY &lt;span class=&quot;nt&quot;&gt;--name&lt;/span&gt; optout &lt;span class=&quot;nt&quot;&gt;--description&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;Opt out of AI services using our data&quot;&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;--content&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;{&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;services&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;:{&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;@@operators_allowed_for_child_policies&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;:[&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;@@none&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;],&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;default&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;:{&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;@@operators_allowed_for_child_policies&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;:[&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;@@none&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;],&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;opt_out_policy&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;:{&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;@@operators_allowed_for_child_policies&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;:[&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;@@none&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;],&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;@@assign&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;optOut&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;}}}}&quot;&lt;/span&gt;

&lt;span class=&quot;c&quot;&gt;# Get the policy id&lt;/span&gt;
&lt;span class=&quot;nb&quot;&gt;export &lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;POLICY_ID&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;sb&quot;&gt;`&lt;/span&gt;aws organizations list-policies &lt;span class=&quot;nt&quot;&gt;--filter&lt;/span&gt; AISERVICES_OPT_OUT_POLICY|jq &lt;span class=&quot;nt&quot;&gt;-cr&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;'.Policies[0].Id'&lt;/span&gt;&lt;span class=&quot;sb&quot;&gt;`&lt;/span&gt;

&lt;span class=&quot;c&quot;&gt;# Attach it to the root&lt;/span&gt;
aws organizations attach-policy &lt;span class=&quot;nt&quot;&gt;--policy-id&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$POLICY_ID&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;--target-id&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$ROOT_ID&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h1 id=&quot;confirming-you-opted-out&quot;&gt;Confirming you opted out&lt;/h1&gt;
&lt;p&gt;To ensure this has been applied correctly, I’ll list the steps to confirm this.  This can be used by auditors to ensure this step has been performed. For these commands, ensure you have the latest version of the AWS CLI. When I run &lt;code class=&quot;highlighter-rouge&quot;&gt;aws --version&lt;/code&gt; the response includes &lt;code class=&quot;highlighter-rouge&quot;&gt;aws-cli/2.1.15&lt;/code&gt; so ensure you are using at least that version.&lt;/p&gt;

&lt;h2 id=&quot;confirm-feature-is-enabled&quot;&gt;Confirm feature is enabled&lt;/h2&gt;
&lt;p&gt;First, ensure the opt out functionality has been enabled for the organization.  In the organization management account, run:&lt;/p&gt;
&lt;div class=&quot;highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt; aws organizations list-roots
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;This should return something like:&lt;/p&gt;
&lt;div class=&quot;language-json highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
    &lt;/span&gt;&lt;span class=&quot;nl&quot;&gt;&quot;Roots&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
        &lt;/span&gt;&lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
            &lt;/span&gt;&lt;span class=&quot;nl&quot;&gt;&quot;Id&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;r-p0xn&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
            &lt;/span&gt;&lt;span class=&quot;nl&quot;&gt;&quot;Arn&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;arn:aws:organizations::123456789012:root/o-abcd123456/r-abcd&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
            &lt;/span&gt;&lt;span class=&quot;nl&quot;&gt;&quot;Name&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;Root&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
            &lt;/span&gt;&lt;span class=&quot;nl&quot;&gt;&quot;PolicyTypes&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
                &lt;/span&gt;&lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
                    &lt;/span&gt;&lt;span class=&quot;nl&quot;&gt;&quot;Type&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;AISERVICES_OPT_OUT_POLICY&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
                    &lt;/span&gt;&lt;span class=&quot;nl&quot;&gt;&quot;Status&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;ENABLED&quot;&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
                &lt;/span&gt;&lt;span class=&quot;p&quot;&gt;},&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
                &lt;/span&gt;&lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
                    &lt;/span&gt;&lt;span class=&quot;nl&quot;&gt;&quot;Type&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;TAG_POLICY&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
                    &lt;/span&gt;&lt;span class=&quot;nl&quot;&gt;&quot;Status&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;ENABLED&quot;&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
                &lt;/span&gt;&lt;span class=&quot;p&quot;&gt;},&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
                &lt;/span&gt;&lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
                    &lt;/span&gt;&lt;span class=&quot;nl&quot;&gt;&quot;Type&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;SERVICE_CONTROL_POLICY&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
                    &lt;/span&gt;&lt;span class=&quot;nl&quot;&gt;&quot;Status&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;ENABLED&quot;&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
                &lt;/span&gt;&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
            &lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
        &lt;/span&gt;&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
    &lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;You want to confirm &lt;code class=&quot;highlighter-rouge&quot;&gt;AISERVICES_OPT_OUT_POLICY&lt;/code&gt; is set to &lt;code class=&quot;highlighter-rouge&quot;&gt;ENABLED&lt;/code&gt;.&lt;/p&gt;

&lt;h2 id=&quot;confirm-the-policy-exists&quot;&gt;Confirm the policy exists&lt;/h2&gt;
&lt;p&gt;Confirm an opt-out policy exists by running:&lt;/p&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nv&quot;&gt;$ &lt;/span&gt;aws organizations list-policies &lt;span class=&quot;nt&quot;&gt;--filter&lt;/span&gt; AISERVICES_OPT_OUT_POLICY
&lt;span class=&quot;o&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;s2&quot;&gt;&quot;Policies&quot;&lt;/span&gt;: &lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;
        &lt;span class=&quot;o&quot;&gt;{&lt;/span&gt;
            &lt;span class=&quot;s2&quot;&gt;&quot;Id&quot;&lt;/span&gt;: &lt;span class=&quot;s2&quot;&gt;&quot;p-0000000000&quot;&lt;/span&gt;,
            &lt;span class=&quot;s2&quot;&gt;&quot;Arn&quot;&lt;/span&gt;: &lt;span class=&quot;s2&quot;&gt;&quot;arn:aws:organizations::123456789012:policy/o-abcd123456/aiservices_opt_out_policy/p-0000000000&quot;&lt;/span&gt;,
            &lt;span class=&quot;s2&quot;&gt;&quot;Name&quot;&lt;/span&gt;: &lt;span class=&quot;s2&quot;&gt;&quot;optout&quot;&lt;/span&gt;,
            &lt;span class=&quot;s2&quot;&gt;&quot;Type&quot;&lt;/span&gt;: &lt;span class=&quot;s2&quot;&gt;&quot;AISERVICES_OPT_OUT_POLICY&quot;&lt;/span&gt;,
            &lt;span class=&quot;s2&quot;&gt;&quot;AwsManaged&quot;&lt;/span&gt;: &lt;span class=&quot;nb&quot;&gt;false&lt;/span&gt;
        &lt;span class=&quot;o&quot;&gt;}&lt;/span&gt;
    &lt;span class=&quot;o&quot;&gt;]&lt;/span&gt;
&lt;span class=&quot;o&quot;&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;Then get the contents of this policy (replacing your policy id):&lt;/p&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nv&quot;&gt;$ &lt;/span&gt;aws organizations describe-policy &lt;span class=&quot;nt&quot;&gt;--policy-id&lt;/span&gt; p-0000000000
&lt;span class=&quot;o&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;s2&quot;&gt;&quot;Policy&quot;&lt;/span&gt;: &lt;span class=&quot;o&quot;&gt;{&lt;/span&gt;
        &lt;span class=&quot;s2&quot;&gt;&quot;PolicySummary&quot;&lt;/span&gt;: &lt;span class=&quot;o&quot;&gt;{&lt;/span&gt;
            &lt;span class=&quot;s2&quot;&gt;&quot;Id&quot;&lt;/span&gt;: &lt;span class=&quot;s2&quot;&gt;&quot;p-0000000000&quot;&lt;/span&gt;,
            &lt;span class=&quot;s2&quot;&gt;&quot;Arn&quot;&lt;/span&gt;: &lt;span class=&quot;s2&quot;&gt;&quot;arn:aws:organizations::123456789012:policy/o-abcd123456/aiservices_opt_out_policy/p-0000000000&quot;&lt;/span&gt;,
            &lt;span class=&quot;s2&quot;&gt;&quot;Name&quot;&lt;/span&gt;: &lt;span class=&quot;s2&quot;&gt;&quot;optout&quot;&lt;/span&gt;,
            &lt;span class=&quot;s2&quot;&gt;&quot;Type&quot;&lt;/span&gt;: &lt;span class=&quot;s2&quot;&gt;&quot;AISERVICES_OPT_OUT_POLICY&quot;&lt;/span&gt;,
            &lt;span class=&quot;s2&quot;&gt;&quot;AwsManaged&quot;&lt;/span&gt;: &lt;span class=&quot;nb&quot;&gt;false&lt;/span&gt;
        &lt;span class=&quot;o&quot;&gt;}&lt;/span&gt;,
        &lt;span class=&quot;s2&quot;&gt;&quot;Content&quot;&lt;/span&gt;: &lt;span class=&quot;s2&quot;&gt;&quot;{&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;services&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;:{&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;@@operators_allowed_for_child_policies&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;:[&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;@@none&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;],&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;default&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;:{&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;@@operators_allowed_for_child_policies&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;:[&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;@@none&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;],&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;opt_out_policy&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;:{&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;@@operators_allowed_for_child_policies&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;:[&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;@@none&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;],&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;@@assign&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;optOut&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;}}}}&quot;&lt;/span&gt;
    &lt;span class=&quot;o&quot;&gt;}&lt;/span&gt;
&lt;span class=&quot;o&quot;&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;You can pipe that through &lt;code class=&quot;highlighter-rouge&quot;&gt;jq '.Policy.Content|fromjson'&lt;/code&gt; for a more readable policy. Confirm the policy matches the policy text shown earlier.&lt;/p&gt;

&lt;h2 id=&quot;confirm-the-policy-is-attached-to-the-root&quot;&gt;Confirm the policy is attached to the root&lt;/h2&gt;

&lt;p&gt;Finally, run the following (replacing your policy id):&lt;/p&gt;
&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nv&quot;&gt;$ &lt;/span&gt;aws organizations list-targets-for-policy &lt;span class=&quot;nt&quot;&gt;--policy-id&lt;/span&gt; p-0000000000
&lt;span class=&quot;o&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;s2&quot;&gt;&quot;Targets&quot;&lt;/span&gt;: &lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;
        &lt;span class=&quot;o&quot;&gt;{&lt;/span&gt;
            &lt;span class=&quot;s2&quot;&gt;&quot;TargetId&quot;&lt;/span&gt;: &lt;span class=&quot;s2&quot;&gt;&quot;r-p0xn&quot;&lt;/span&gt;,
            &lt;span class=&quot;s2&quot;&gt;&quot;Arn&quot;&lt;/span&gt;: &lt;span class=&quot;s2&quot;&gt;&quot;arn:aws:organizations::123456789012:root/o-abcd123456/r-abcd&quot;&lt;/span&gt;,
            &lt;span class=&quot;s2&quot;&gt;&quot;Name&quot;&lt;/span&gt;: &lt;span class=&quot;s2&quot;&gt;&quot;Root&quot;&lt;/span&gt;,
            &lt;span class=&quot;s2&quot;&gt;&quot;Type&quot;&lt;/span&gt;: &lt;span class=&quot;s2&quot;&gt;&quot;ROOT&quot;&lt;/span&gt;
        &lt;span class=&quot;o&quot;&gt;}&lt;/span&gt;
    &lt;span class=&quot;o&quot;&gt;]&lt;/span&gt;
&lt;span class=&quot;o&quot;&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
&lt;p&gt;Confirm that the type in the response is “ROOT”.&lt;/p&gt;

&lt;p&gt;This confirms that you have opted out all the accounts in your organization from having their data moved to other regions or used for reasons outside of your control.&lt;/p&gt;
 &lt;br&gt;...&lt;a href="https://SummitRoute.com/blog/2021/01/06/opting_out_of_aws_ai_data_usage/"&gt;Read more ...&lt;/a&gt; </description>
				<pubDate>Wed, 06 Jan 2021 04:00:00 -0800</pubDate>
				<link>https://summitroute.com/blog/2021/01/06/opting_out_of_aws_ai_data_usage/</link>
				<guid isPermaLink="true">https://SummitRoute.com/blog/2021/01/06/opting_out_of_aws_ai_data_usage/</guid>
			</item>
		
			<item>
				<title>Setting up personal G Suite backups on AWS</title>
				<description>&lt;p&gt;In giving &lt;a href=&quot;https://summitroute.com/aws_security_training/&quot;&gt;training&lt;/a&gt; to companies on their AWS security, I advise they have backups. There was an &lt;a href=&quot;https://www.infoworld.com/article/2608076/murder-in-the-amazon-cloud.html&quot;&gt;infamous breach&lt;/a&gt; of a company named CodeSpaces that ran on AWS who had all of their data deleted by an attacker and the company had to shutdown within hours of the breach.  I didn’t have my own house in order as well as I would have liked, so this week I set up automated backups, and did so in a generalized way that others can use via my cdk app &lt;a href=&quot;https://github.com/SummitRoute/backup_runner&quot;&gt;backup_runner&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;My business relies on Google Workspaces (previously known as G Suite) for email and Google Drive.  My account is part of the &lt;a href=&quot;https://landing.google.com/advancedprotection/&quot;&gt;Advanced Protection Program&lt;/a&gt;, but in a worst case scenario an attacker that obtained code execution on my laptop could wipe/ransom this data. I don’t know how Google would handle such an incident, but other scenarios also exist, however unlikely, that make me want to have backups of this data.  My business is only myself, so using a featureful vendor solution isn’t needed, and it is nice to avoid some third-party risk of a vendor having access to all my email and company data, so I setup backups myself in AWS.&lt;/p&gt;

&lt;h2 id=&quot;tools-used&quot;&gt;Tools used&lt;/h2&gt;
&lt;p&gt;I used &lt;a href=&quot;https://github.com/jay0lee/got-your-back&quot;&gt;got-your-back&lt;/a&gt; and &lt;a href=&quot;https://rclone.org/&quot;&gt;rclone&lt;/a&gt; for the email and drive backups respectively.  Got-your-back is made by Jay Lee, a manager at Google for Enterprise support, and the creator of &lt;a href=&quot;https://github.com/jay0lee/GAM&quot;&gt;GAM&lt;/a&gt; which is the de facto standard for interacting with the GSuite APIs.  I could have used GAM for the drive backups, but it doesn’t maintain directory structure, which is important to me, so I turned to rclone.&lt;/p&gt;

&lt;h2 id=&quot;architecture&quot;&gt;Architecture&lt;/h2&gt;

&lt;p&gt;Historically, a number of folks have setup an EC2 and S3 bucket for this purpose, but I decided to run a nightly ECS container with an attached EFS, which itself is backed up via AWS Backup. The primary benefit of this architecture is AWS Backup takes care of incremental backups for me, meaning it only stores the changes each night, and makes it easy to recover the state of my data from any day in the past 35 days (this could be set longer).&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;/img/backup_architecture.png&quot;&gt;
&lt;img style=&quot;max-width:500px&quot; src=&quot;/img/backup_architecture.png&quot; alt=&quot;Backup architecture&quot; title=&quot;Phishing email 2&quot; /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;div class=&quot;caption&quot;&gt;Backup architecture&lt;/div&gt;

&lt;p&gt;The output of the script run by the ECS is recorded to CloudWatch Logs, where a CloudWatch Alarm monitors for the word “ERROR”. If found, the alarm is sent to an SNS that I’m subscribed to.  The AWS Backup service will also generate events that are sent to the SNS under error conditions.&lt;/p&gt;

&lt;h2 id=&quot;security-considerations&quot;&gt;Security considerations&lt;/h2&gt;
&lt;h3 id=&quot;encryption&quot;&gt;Encryption&lt;/h3&gt;
&lt;p&gt;AWS Backups are always encrypted. I configured my EFS to be encrypted at rest, and the access from the ECS is configured to use encryption in transit.&lt;/p&gt;

&lt;h3 id=&quot;business-continuity&quot;&gt;Business continuity&lt;/h3&gt;
&lt;p&gt;I am storing the backup Vault in the same account as the EFS as my primary motivation is to get the data copied to AWS. AWS did just release &lt;a href=&quot;https://aws.amazon.com/about-aws/whats-new/2020/11/aws-backup-enables-aws-organizations-bring-cross-account-backup-feature/&quot;&gt;cross-account backups&lt;/a&gt; for AWS Backups, but my data already exists in two places (the live data in GSuite and the copy in the AWS account).&lt;/p&gt;

&lt;p&gt;I did set the access policy on the Vault to restrict some ways of destroying the backups, but there seem to be limitations in the CDK for deploying an ideal policy here, so a privileged attacker could get around this by editing/deleting the policy.  One thing that AWS Backup does not offer is the concept used by &lt;a href=&quot;https://aws.amazon.com/blogs/storage/protecting-data-with-amazon-s3-object-lock/&quot;&gt;S3 Object Lock&lt;/a&gt; and &lt;a href=&quot;https://aws.amazon.com/blogs/aws/glacier-vault-lock/&quot;&gt;Glacier Vault&lt;/a&gt; locking which enforces strong WORM (Write Once Read Many) controls.&lt;/p&gt;

&lt;h3 id=&quot;secrets-management&quot;&gt;Secrets management&lt;/h3&gt;
&lt;p&gt;As the EFS contains all my email and data, it seems reasonable to just put the secrets used to download this data directly on that EFS, as compromising those creds does not extend the access beyond what is already on the EFS.&lt;/p&gt;

&lt;h2 id=&quot;costs&quot;&gt;Costs&lt;/h2&gt;
&lt;p&gt;By running a nightly ECS, I avoid some of the compute costs of running an EC2, but EFS costs $0.30/GB vs $0.023/GB for S3 (EFS is 13x more!).  Files in the EFS should move to the less expensive Infrequent Access Storage tier after 7 days which is only $0.025/GB which is roughly the same cost as S3, but S3 itself has an infrequent access tier at only $0.0125, and can be made even less expensive by using Glacier Deep Archive at only $0.00099/GB.  However, given that I have 30GB in GSuite, my costs should end up around $9/yr for using EFS (once most of the data moves to infrequent access), so I’m not going to waste time trying to shave pennies off that.&lt;/p&gt;

&lt;p&gt;AWS Backup is $0.05/GB, and does have a cold-storage tier at $0.01/GB, but that requires storing your data for over 90 days, and I only store mine for 35 days.  The backups are incremental, meaning it automatically figures out what the new files are and only charges me for those.&lt;/p&gt;

&lt;p&gt;Having run this setup for a month, my total costs are looking to be about $50/yr.&lt;/p&gt;

&lt;p&gt;Using S3 and its storage tiers would result in cost savings, but the time saved in having AWS Backup handle some of these backup concepts instead of me figuring them out is worth the expense.&lt;/p&gt;

&lt;h1 id=&quot;deploying&quot;&gt;Deploying&lt;/h1&gt;
&lt;p&gt;In order to setup this architecture I created a &lt;a href=&quot;https://aws.amazon.com/cdk/&quot;&gt;CDK&lt;/a&gt; app. The repo to clone is called &lt;a href=&quot;https://github.com/SummitRoute/backup_runner&quot;&gt;backup_runner&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;The ECS just calls a script named &lt;code class=&quot;highlighter-rouge&quot;&gt;nightly.sh&lt;/code&gt; that it expects to find on the EFS.  As a result, this app is very generalized for any backup solution, so it could easily backup Office365 or other data.&lt;/p&gt;

&lt;p&gt;Once the CDK app is deployed, it won’t actually copy over any data to it, because again, it just runs a script.  So in order to set this up you need to spin up an EC2 in the subnet where the EFS is , access a command-line in the EC2 (via SSH, EC2 Instance Connect, or Session Manager), attach the EFS to the EC2, and then setup got-your-back and rclone, or whatever else you had in mind.  Setting those up is outside of the scope of this post, but it involves setting up some oauth creds.  Be sure to copy the &lt;code class=&quot;highlighter-rouge&quot;&gt;~/bin&lt;/code&gt; that got-your-back creates and &lt;code class=&quot;highlighter-rouge&quot;&gt;~/.config&lt;/code&gt; that rclone creates to the EFS.  You’ll want a larger instance, like a t3.large for got-your-back, and after setting this up and testing it, you can terminate that instance.&lt;/p&gt;
 &lt;br&gt;...&lt;a href="https://SummitRoute.com/blog/2020/11/24/setting_up_personal_gsuite_backups_on_aws/"&gt;Read more ...&lt;/a&gt; </description>
				<pubDate>Tue, 24 Nov 2020 04:00:00 -0800</pubDate>
				<link>https://summitroute.com/blog/2020/11/24/setting_up_personal_gsuite_backups_on_aws/</link>
				<guid isPermaLink="true">https://SummitRoute.com/blog/2020/11/24/setting_up_personal_gsuite_backups_on_aws/</guid>
			</item>
		
			<item>
				<title>The state of ABAC on AWS</title>
				<description>&lt;p&gt;Two years ago, in November 2018, AWS &lt;a href=&quot;https://aws.amazon.com/blogs/security/add-tags-to-manage-your-aws-iam-users-and-roles/&quot;&gt;announced&lt;/a&gt; new conditions keys &lt;code class=&quot;highlighter-rouge&quot;&gt;aws:PrincipalTag&lt;/code&gt; and &lt;code class=&quot;highlighter-rouge&quot;&gt;aws:RequestTag&lt;/code&gt;, and &lt;a href=&quot;https://aws.amazon.com/blogs/security/simplify-granting-access-to-your-aws-resources-by-using-tags-on-aws-iam-users-and-roles/&quot;&gt;started to push&lt;/a&gt; the concept of Attribute Based Access Control (ABAC).  This post will describe what this is, the difficulties with implementing this strategy, and what AWS needs to do for customers to be successful with this concept.&lt;/p&gt;

&lt;h1 id=&quot;what-is-abac&quot;&gt;What is ABAC?&lt;/h1&gt;
&lt;p&gt;A long standing problem with AWS security has been that if you had two projects in a single AWS account, it was often impossible to ensure that some principals (meaning the users and roles there) could only interact with the resources of one project and not the other.  In order to implement a least privilege strategy, you want to isolate the actions each principal can take to only certain resources to ensure they cannot impact or exfil data from the other project.&lt;/p&gt;

&lt;p&gt;The solution many customers have been forced to adopt is to isolate their projects into separate AWS accounts, but that’s not always ideal. For example, it can be difficult to take an existing account and move resources into another account as an account grows.  So AWS started focusing on tagging resources and restricting access via tags.  Over time, many privileges started to be able to work with the condition key &lt;code class=&quot;highlighter-rouge&quot;&gt;aws:ResourceTag&lt;/code&gt; so that you could restrict who could interact with an existing resource. But what if you wanted the principal to create new resources, but restrict what tags they could use, so they couldn’t create a resource with the tag of another project?  For this AWS &lt;a href=&quot;https://aws.amazon.com/blogs/security/add-tags-to-manage-your-aws-iam-users-and-roles/&quot;&gt;released&lt;/a&gt; &lt;code class=&quot;highlighter-rouge&quot;&gt;aws:RequestTag&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;What if you had many principals and projects and you didn’t want to create separate IAM policies for each one? You want a single policy that you can apply to all principals that says “Only interact with resources that match the same tag as you have” or the common request of “You can only interact with resources you created.”  To implement this concept, AWS released &lt;code class=&quot;highlighter-rouge&quot;&gt;aws:PrincipalTag&lt;/code&gt;, so you could now use a conditions such as:&lt;/p&gt;

&lt;div class=&quot;highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;StringEquals: { &quot;aws:RequestTag/project&quot;: &quot;${aws:PrincipalTag/project}&quot; }
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;Attribute-based access control (ABAC) is an authorization strategy that defines permissions based on attributes, which on AWS means tags.  Two of the best resources on this concept are &lt;a href=&quot;https://twitter.com/bjohnso5y&quot;&gt;Brigid Johnson’s&lt;/a&gt; re:Inforce talk &lt;a href=&quot;https://www.youtube.com/watch?v=Iq_hDc385t4&quot;&gt;Scale Permissions Management in AWS w/ Attribute-Based Access Control&lt;/a&gt; and &lt;a href=&quot;https://twitter.com/mchancloud&quot;&gt;Michael Chan&lt;/a&gt;’s blog post &lt;a href=&quot;https://aws.amazon.com/blogs/security/working-backward-from-iam-policies-and-principal-tags-to-standardized-names-and-tags-for-your-aws-resources/&quot;&gt;Working backward: From IAM policies and principal tags to standardized names and tags for your AWS resources&lt;/a&gt;.&lt;/p&gt;
 &lt;br&gt;...&lt;a href="https://SummitRoute.com/blog/2020/11/02/state_of_abac_on_aws/"&gt;Read more ...&lt;/a&gt; </description>
				<pubDate>Mon, 02 Nov 2020 04:00:00 -0800</pubDate>
				<link>https://summitroute.com/blog/2020/11/02/state_of_abac_on_aws/</link>
				<guid isPermaLink="true">https://SummitRoute.com/blog/2020/11/02/state_of_abac_on_aws/</guid>
			</item>
		
			<item>
				<title>Public dataset of Cloudtrail logs from flaws.cloud</title>
				<description>&lt;p&gt;In order to advance research into AWS security, I’m releasing anonymized CloudTrail logs from &lt;a href=&quot;http://flaws.cloud/&quot;&gt;flaws.cloud&lt;/a&gt;.  I don’t know of any other public datasets of CloudTrail logs and the logs from flaws.cloud are a unique collection, as they are largely attacks within a simple AWS environment.  They cover over 3.5 years, and have involved many attackers and types of attacks.  This post will describe what these logs represent and how these logs were anonymized. It will describe how to load these into Athena. With there being 240MB of log data, roughly every 10 Athena queries will cost you a penny.  The logs are available &lt;a href=&quot;https://summitroute.com/downloads/flaws_cloudtrail_logs.tar&quot;&gt;here&lt;/a&gt;.&lt;/p&gt;
 &lt;br&gt;...&lt;a href="https://SummitRoute.com/blog/2020/10/09/public_dataset_of_cloudtrail_logs_from_flaws_cloud/"&gt;Read more ...&lt;/a&gt; </description>
				<pubDate>Fri, 09 Oct 2020 05:00:00 -0700</pubDate>
				<link>https://summitroute.com/blog/2020/10/09/public_dataset_of_cloudtrail_logs_from_flaws_cloud/</link>
				<guid isPermaLink="true">https://SummitRoute.com/blog/2020/10/09/public_dataset_of_cloudtrail_logs_from_flaws_cloud/</guid>
			</item>
		
			<item>
				<title>Denial of Wallet Attacks on AWS</title>
				<description>&lt;p&gt;The AWS incidents that make the news are normally data loss incidents (ex. a public S3 bucket), but one of the common ways people find out about a compromise is through their AWS bill, because a common incident that isn’t made public is a compromised AWS key that is used to spin up EC2s to mine bitcoin.  That attack is used for the personal gain of the attacker, but it is possible that an attacker just wants to bring hurt to you.  Historically, this would have taken the form of a DDoS attack, but in the age of the cloud, that attack can be modified to be a Denial of Wallet attack, where the goal is to cause a high bill such that you run out of money.&lt;/p&gt;

&lt;p&gt;When you have servers in a datacenter, and an attacker just wants to bring you hurt, they can DDoS you and your site goes down.  When you run in the cloud, an attacker can do things such that your site might stay up, but you’ll be bankrupt.  This post will describe this concept, how it can be abused, and how it can be avoided.&lt;/p&gt;

&lt;p&gt;This post comes about from &lt;a href=&quot;https://twitter.com/baphometadata/status/1268192247176220679&quot;&gt;this&lt;/a&gt; tweet:&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;/img/tweet-denial_of_wallet-kpop.png&quot;&gt;
&lt;img style=&quot;max-width:500px&quot; src=&quot;/img/tweet-denial_of_wallet-kpop.png&quot; alt=&quot;Denial of wallet attack tweet&quot; title=&quot;Denial of wallet attack tweet&quot; /&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;As I’m going to be discussing improvements on the attack, mitigations, and other technical issues related to this, I want to start by briefly touching on some of the non-technical issues involved here:&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;Black lives matter.&lt;/li&gt;
  &lt;li&gt;I don’t condone illegal or unjust activities, whether that is done by protestors or police officers.&lt;/li&gt;
  &lt;li&gt;Increasing police department expenses may only be shifting the burden to tax payers.&lt;/li&gt;
  &lt;li&gt;This tweet could have instead been about an app that allows protestors to report on police somehow that was overwhelmed.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Now onto the technical issues.&lt;/p&gt;

&lt;h1 id=&quot;billing-alerts&quot;&gt;Billing alerts&lt;/h1&gt;
&lt;p&gt;One of the first things you should do on an AWS account is create a &lt;a href=&quot;https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/monitor_estimated_charges_with_cloudwatch.html&quot;&gt;billing alert&lt;/a&gt;. It is better to find out about a dozen expensive EC2s running on the day they are spun up, so you can take action, rather than 20 days later after they’ve incurred 20 days worth of charges against your account.&lt;/p&gt;

&lt;p&gt;If you’re just trying AWS out for the first time and you hear about this “free tier” concept, you might be surprised to discover that nothing stops you doing things that actually cost money, and you won’t know about this until the end of the billing cycle.  There is no way to tell AWS “Don’t charge me more than X for the month, and terminate my application if it exceeds that amount.”   You however can set alerts for when your estimated charges exceed a threshold.  I normally set this to something like $10 for accounts I expect to be free (often you end up with bills for using AWS for something like $0.49, so setting the threshold to $0 causes alerts you aren’t too worried about).&lt;/p&gt;

&lt;p&gt;For enterprises with monthly spend in the millions, this can be more difficult, but can still be helpful.  If you’re in that category, you should talk to folks like &lt;a href=&quot;https://twitter.com/QuinnyPig&quot;&gt;Corey Quinn&lt;/a&gt; of the &lt;a href=&quot;https://www.duckbillgroup.com/&quot;&gt;Duckbill Group&lt;/a&gt; and Thomas Dullien (aka &lt;a href=&quot;https://twitter.com/halvarflake&quot;&gt;halvarflake&lt;/a&gt;) of &lt;a href=&quot;https://optimyze.cloud/&quot;&gt;optimyze&lt;/a&gt; who each focus on different areas of cloud spend improvements.  This is not a paid ad. I have a lot of respect for both of those people.&lt;/p&gt;

&lt;p&gt;One strategy commonly used is to set multiple alarms that you expect to trigger throughout the month. For example, if you expect your bill to be $1000, then set the following:&lt;/p&gt;
&lt;ul&gt;
  &lt;li&gt;Alarms for $250, $500, $750, and $1000 and name them based on the week you expect them to trigger.  If your $500 alarm triggers in week 1, you need to investigate.&lt;/li&gt;
  &lt;li&gt;Alarms for $1500 and $2000 so you know when your expenses have increased dramatically.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;For my free tier accounts I have alerts for $10 and $100.  When the $10 alert triggers, and I’m not around my computer, I’ll casually make a note to look into it when I get back to a computer.  Usually it’s a domain name being renewed for $12.  When the $100 triggers, I run to my computer because something bad must be happening.&lt;/p&gt;

&lt;p&gt;You can have these alerts not only email you, but also text you.  You can set up to 10 alarms for free, after which it is $0.10/mo.&lt;/p&gt;

&lt;h1 id=&quot;service-quotas&quot;&gt;Service Quotas&lt;/h1&gt;
&lt;p&gt;AWS has a number of hard and soft limits that among other possible reasons, help mitigate run-away code. Many people have &lt;a href=&quot;https://medium.com/@asankha/lambda-programming-errors-that-could-cost-you-thousands-of-dollars-a-day-265dfac354f&quot;&gt;stories&lt;/a&gt; about infinite loops happening in AWS that caused resources to be created over and over again, or a Lambda to trigger that caused itself to trigger again.  This is a common enough problem that the &lt;a href=&quot;https://docs.aws.amazon.com/AmazonCloudWatch/latest/events/Create-CloudWatch-Events-CloudTrail-Rule.html&quot;&gt;Cloudwatch Event Rule documentation&lt;/a&gt; even has a warning about it.&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;/img/inifinite_loops_cloudwatch_warning.png&quot;&gt;
&lt;img style=&quot;max-width:700px&quot; src=&quot;/img/inifinite_loops_cloudwatch_warning.png&quot; alt=&quot;Cloudwatch infinite loop warning&quot; title=&quot;Cloudwatch infinite loop warning&quot; /&gt;&lt;/a&gt;&lt;/p&gt;
 &lt;br&gt;...&lt;a href="https://SummitRoute.com/blog/2020/06/08/denial_of_wallet_attacks_on_aws/"&gt;Read more ...&lt;/a&gt; </description>
				<pubDate>Mon, 08 Jun 2020 05:00:00 -0700</pubDate>
				<link>https://summitroute.com/blog/2020/06/08/denial_of_wallet_attacks_on_aws/</link>
				<guid isPermaLink="true">https://SummitRoute.com/blog/2020/06/08/denial_of_wallet_attacks_on_aws/</guid>
			</item>
		
	</channel>
</rss>
