Facebook Google Plus Twitter LinkedIn YouTube RSS Menu Search Resource - BlogResource - WebinarResource - ReportResource - Eventicons_066 icons_067icons_068icons_069icons_070

Tenable 博客

订阅

Understanding Customer Managed Encryption Keys (CMKs) in AWS, Azure and GCP: A Comparative Insight

Azure, AWS and GCP logos shown

Explore critical differences in handling customer-managed encryption keys (CMKs) across AWS, Azure, and GCP to avoid security misconfigurations and protect your data effectively.

此次演示意欲为何?

A customer-managed encryption key (CMK) is an encryption key created, managed, and owned by the customer. This gives the customer control over its access management—that is, determining who / what may access it and what actions they can perform.

A CMK is distinct from provider-managed keys, where the cloud service provider manages the key lifecycle and access. 

CMKs are available across various cloud service providers such as AWS, Azure and GCP. 

There’s a significant difference between the paradigm applied to encryption and decryption with CMKs in AWS and the one which is applied in Azure and GCP. A lack of understanding of this difference may have consequences if it goes unnoticed by security practitioners. In this blog, we delve into the differences and why the distinction is important.

Using CMKs in AWS

In AWS, CMKs are available with AWS Key Management Service (KMS). 

When a data resource, such as an S3 bucket, is encrypted using a CMK, accessing the data (such as through an S3 request) involves a decryption process. The AWS KMS action will be performed using the credentials of the identity that initiated the data access request. Here you can find more information about how this works and the aws:CalledVia condition key. We’ve also done our own review of this condition key as well as others that are significant to know in a previous post.

The reason why this operation method is important is its implications when managing access to data.

In AWS, even if you grant a principal access to retrieve data (such as providing access to s3 for an object in a bucket), the principal will still receive an Access Denied error if the object is encrypted with a CMK with which they are not allowed to decrypt. This is because the principal credentials are used for the decryption process and thus it’s required they have the necessary permissions.

An access denied error message
AccessDenied error message received by a principal not authorized to use kms:Decrypt though it has access to AmazonS3FullAccess 

This dual requirement adds an extra layer of security as both permissions are necessary to access the encrypted data.

This is very significant as usage of managed policies in AWS is pretty popular even though it’s usually a very poor practice. For example, a principal may be granted AmazonS3FullAccess if they require access only to very specific buckets. Alternatively, even a user-managed IAM policy could be easily configured with a “*” in the right place (or wrong place, depending how you look at it) and that will enable the principal to have access to all buckets in an account. 

If a bucket holding sensitive information is encrypted with a CMK, a principal will still need explicit access to perform kms:Decrypt using that key, even if it has access to retrieve information from all buckets in the account. This significantly reduces the chance of unintentional data access. 

Using CMKs in Azure and GCP 

The situation in Azure and GCP is quite different when using their storage solutions (storage accounts and cloud storage buckets, respectively), as the principal being used to perform the decrypt operation is not the principal initiating the data access call, which we will now explore. 

 Being aware of this is important because if you come from an AWS background and then start using Azure or GCP (which happens quite a bit), you may be under the impression that, similarly to AWS, there’s a requirement for having the permissions to use the CMK in order to access the data.

This might lead you to believe that a sensitive Azure storage account or a cloud storage bucket in GCP is protected from principals with a Role that grants access to all storage data in a subscription or project, as long as they don't have access to the CMK. However, this is not actually the case.

Since the principal accessing the data is different from the one initiating the call (which we will explain later), and the accessing principal is granted access to the bucket separately, the initiating principal does not need permissions to use the CMK.

Using a CMK in Azure

CMKs in Azure are created in Key Vault

In order to encrypt a storage account using a CMK, you will first have to create a managed identity. The identity will then be associated with the storage account and will be the principal used to perform the encryption and decryption actions using the CMK.

Note that to be able to use the CMK for this particular use case, we had to enable purge protection on the key vault:

Enabling key protection on a key vault
Enabling purge protection on a Key Vault; this allows keys created in the vault to be used for encrypting storage accounts 

We actually discovered this requirement “by accident” as we ran into this error message when trying to create the storage account:

Recoverable is not set error message
Here we see a “recoverable is not set” error message when trying to create a storage account that is encrypted with a key from a Key Vault without purge protection 

As explained in the Azure documentation: “The managed identity that is associated with the storage account must have these permissions at a minimum to access a customer-managed key in Azure Key Vault: wrapkey, unwrapkey, get” 

So, you will need to create a custom role allowing for the following permissions: 

Screenshot of updating a custom role
Screenshot from updating a custom role with the permissions needed for a managed identity to perform encryption actions on a storage account

And then create a role assignment for the managed identity with that role:

Screenshot of adding a role assignment
Screenshot from adding a role assignment for a managed identity that we created to use the encryption key 

Then, as you configure the storage account, you will choose the CMK you want to use for encryption from the key vault AND the managed identity, which will be associated with the storage account for the purpose of encrypting / decrypting:

Setting the user assigned managed identity
 Setting the user-assigned managed identity we created when configuring encryption on the storage account 

Using a CMK in GCP

In GCP, the mechanism is similar to the one used in Azure, but slightly different. 

The principal performing the encryption / decryption is the cloud storage service agent; you can find its email in the cloud storage settings

Retrieving the email account
Retrieving the email address for the service account of the service agent for the Cloud Storage in our GCP project

You can then assign it with the Cloud KMS CryptoKey Encrypter/Decrypter Role on the key used for encrypting the bucket, as described here.

Granting the service agent permissions
Granting the service agent permissions to use the encryption key to perform cryptographic functions on the bucket

 

And… that’s pretty much it. Now the service agent for cloud storage is able to use the key in order to perform encryption / decryption of its content with the CMK.

What this means for security

The difference shown here between the encryption-related permissions paradigms corresponds with a difference between the AWS approach to permission management and the RBAC (role based access control) employed by Azure and GCP. While the AWS approach may be more complex to manage, it does provide more control mechanisms when it comes to access. 

It’s also a great example of how this approach can be both a security advantage and a security liability. 

When granting access to encrypted resources, the Azure and GCP approach is easier to manage, because granting permissions to the objects themselves should suffice. Also, there are fewer things to consider, such as managing the permissions to the encryption assets for each principal. This simplicity is great for security as teams can more easily implement compartmentalization of data access. 

Additionally, the complexity of managing permissions to the keys may unintentionally create a scenario where an attacker is able to manipulate, hijack the key, and carry out an effective ransomware attack. 

On the other hand, a security boundary that requires permissions to a KMS key cannot be established using the CMK. If permission to access data is granted by mistake (which can definitely happen), the encryption won’t prevent it. 

Although we’re usually in search of winners vs. losers in these kinds of comparisons, it’s very hard to make a clear determination in this case. However, one thing is clear: knowing the distinction between the two, as well as the pros and the cons for each, is key (pun not intended). 

结论

Data protection and access management is a crucial cornerstone of your cloud environment security and also essential to adhere to many compliance standards. 

If you’re starting out with encryption in Azure and / or GCP, whether you’re an experienced AWS practitioner or not, remember the difference we discussed here. Be extremely careful with data access permissions granted to principals in your subscriptions / projects. 

As always, based on the principle of least privilege, be sure to provide principals only with the permissions they need for their job function, preferably with a custom role and only on the appropriate scope. If possible, this should also be given on the resource level only. 

If you have any questions, visit our cloud security page and contact us for more information. 
 

相关文章

您可加以利用的网络安全新闻

输入您的电子邮件,绝不要错过 Tenable 专家的及时提醒和安全指导。

Tenable Vulnerability Management

可全面访问基于云的现代化漏洞管理平台,从而以无可比拟的精确度发现并追踪所有资产。

Tenable Vulnerability Management trials created everywhere except UAE will also include Tenable Lumin and Tenable Web App Scanning.

Tenable Vulnerability Management

可全面访问基于云的现代化漏洞管理平台,从而以无可比拟的精确度发现并追踪所有资产。 立即购买年度订阅。

100 项资产

选择您的订阅选项:

立即购买

Tenable Vulnerability Management

可全面访问基于云的现代化漏洞管理平台,从而以无可比拟的精确度发现并追踪所有资产。

Tenable Vulnerability Management trials created everywhere except UAE will also include Tenable Lumin and Tenable Web App Scanning.

Tenable Vulnerability Management

可全面访问基于云的现代化漏洞管理平台,从而以无可比拟的精确度发现并追踪所有资产。 立即购买年度订阅。

100 项资产

选择您的订阅选项:

立即购买

Tenable Vulnerability Management

可全面访问基于云的现代化漏洞管理平台,从而以无可比拟的精确度发现并追踪所有资产。

Tenable Vulnerability Management trials created everywhere except UAE will also include Tenable Lumin and Tenable Web App Scanning.

Tenable Vulnerability Management

可全面访问基于云的现代化漏洞管理平台,从而以无可比拟的精确度发现并追踪所有资产。 立即购买年度订阅。

100 项资产

选择您的订阅选项:

立即购买

试用 Tenable Web App Scanning

您可以通过 Tenable One 风险暴露管理平台完全访问我们专为现代应用程序量身打造的最新 Web 应用程序扫描产品。可安全扫描全部在线资产组合的漏洞,具有高度准确性,而且无需繁重的手动操作或中断关键的 Web 应用程序。立即注册。

Tenable Web App Scanning 试用版还包含 Tenable Vulnerability Management 和 Tenable Lumin。

购买 Tenable Web App Scanning

可全面访问基于云的现代化漏洞管理平台,从而以无可比拟的精确度发现并追踪所有资产。 立即购买年度订阅。

5 个 FQDN

$3,578

立即购买

试用 Tenable Lumin

使用 Tenable Lumin 直观呈现及探索您的风险暴露管理,长期追踪风险降低状况,并比照同行业者进行基准衡量。

Tenable Lumin 试用版还包括 Tenable Vulnerability Management 和 Tenable Web App Scanning。

购买 Tenable Lumin

联系销售代表,了解 Tenable Lumin 如何帮助您获取整个企业的洞见并管理网络安全风险。

免费试用 Tenable Nessus Professional

免费试用 7 天

Tenable Nessus 是当今市场上功能最全面的漏洞扫描器。

新 - Tenable Nessus Expert
不可用

Nessus Expert 添加了更多功能,包括外部攻击面扫描,以及添加域和扫描云基础设施的功能。单击此处试用 Nessus Expert。

填写下面的表格可继续试用 Nessus Pro。

购买 Tenable Nessus Professional

Tenable Nessus 是当今市场上功能最全面的漏洞扫描器。Tenable Nessus Professional 可帮助自动化漏洞扫描流程、节省合规周期的时间,并调动起 IT 团队的积极性。

购买多年期许可,即享优惠价格添加高级支持功能,获取一年 365 天、一天 24 小时的电话、社区和聊天支持。

选择您的许可证

购买多年期许可,即享优惠价格

添加支持和培训

免费试用 Tenable Nessus Expert

免费试用 7 天

Nessus Expert 针对现代攻击面而量身打造,可以查看更多信息,保护企业免遭从 IT 到云中漏洞的攻击。

已经有 Tenable Nessus Professional?
升级到 Nessus Expert,免费试用 7 天。

购买 Tenable Nessus Expert

Nessus Expert 针对现代攻击面而量身打造,可以查看更多信息,保护企业免遭从 IT 到云中漏洞的攻击。

选择您的许可证

购买多年许可证,节省幅度更大。

添加支持和培训