Join our Newsletter — 33% off our NHI Course
Home› Guides› Securing the cloud key management service (KMS) itself:…
Guide Data Security

Securing the cloud key management service (KMS) itself: protect the keys behind every encrypted store

PDF for newsletter subscribers · free to read online

← All guides
By NHI Mgmt Group, under the editorial direction of Lalit Choda Updated 13 November 2026 15 min read
On this page

Whoever controls your cloud key management service decides whether your encrypted data can be read, and whether it can be read at all, so a compromised KMS is both a confidentiality breach and a ransomware lever. A KMS sits underneath storage, databases, backups, secrets managers and signing services. Its key policies, grants and administrative roles are often created by infrastructure code, copied between accounts and rarely reviewed, and the workloads that call it are non-human identities with standing permissions. This guide is for cloud security engineers, platform teams and cryptography owners who run a cloud KMS, including keys backed by hardware security modules or by imported key material. It covers the attack surface, administrative roles, the service identities that use keys, key lifecycle and deletion, logging, hardening and decommissioning. It is vendor-neutral, so confirm exact setting names in your provider's documentation. For key management principles in general, see the Cryptographic Key Management Guide.

Key takeaways

  • Treat the KMS as tier 0. Anyone who can change a key policy, disable a key or schedule its deletion can read or destroy every dataset that key protects.
  • Separate key administration from key use. The people who create, rotate and delete keys should not be able to decrypt data, and the workloads that decrypt should not be able to change policy.
  • Scope every service identity to named keys and operations. One workload identity per application, allowed only encrypt, decrypt or sign on the keys it needs, with no wildcard on keys or actions.
  • Make destruction slow and visible. Use the longest practical deletion waiting period, alert on every disable and schedule-deletion call, and require a second approver.
  • Log every key operation somewhere the KMS admins cannot alter. Key usage records are the only way to know what data a stolen credential decrypted.

What makes up a KMS's attack surface

NIST SP 800-130 sets out what a cryptographic key management system design should document, and NIST SP 800-57 Part 1 Rev. 5 describes the key states (pre-activation, active, suspended, deactivated, compromised, destroyed) that the system must enforce. A cloud KMS implements those functions as a service, but you configure most of the controls. The table reflects a common cloud architecture and is NHI Mgmt Group's view; your provider may name, merge or split these components differently.

ComponentWhat it holds or doesIf an attacker controls itPrimary control
Key policies and resource permissionsWho may administer and who may use each key, including other accountsAdds an external principal, grants decrypt to their own identity (T1098)Policies as code, review, alert on policy change, block cross-account grants by default
Grants and delegated permissionsTemporary or programmatic rights for services to use a keyCreates a quiet grant that outlives the incidentInventory grants, retire unused ones, alert on creation
Key encryption keys (customer-managed keys)Wrap the data keys that encrypt storage, databases and backupsDisables or deletes the key, making data unreadable (T1485), or rewraps data under a key they control (T1486)Deletion waiting period, deletion alerts, two-person approval
Imported or external key materialCustomer-supplied material or a key held outside the providerLets material expire or removes the external key, causing an outageTracked expiry, escrowed copy under dual control
Signing and MAC keysSign tokens, artefacts or documentsSigns malicious artefacts or tokens that verifiers trustSeparate signing keys, narrow sign permission, usage alerting
Management plane identitiesCloud administrators, automation roles, pipelines that deploy key policyAny of the above, at scale, through infrastructure codeSmall admin group, just-in-time elevation, protected pipeline

The two failure modes matter differently. Loss of confidentiality comes from too many principals with decrypt. Loss of availability comes from a key that is disabled, deleted or whose imported material expires; data encrypted under a lost key cannot be recovered, as the OWASP Key Management Cheat Sheet warns. NIST SP 800-53 SC-12(1) asks you to maintain availability of information in the event of the loss of cryptographic keys.

Administrative roles and separation of duties

Most cloud KMSs let you separate permissions to manage a key from permissions to use it. Design that split before keys are created, because default administrator roles in a cloud account often include both.

RoleAllowedNot allowed
Key administratorCreate keys, set policy, enable rotation, tag, schedule deletion with approvalEncrypt, decrypt, sign, create grants for itself
Key user (workload)Encrypt, decrypt, generate data key or sign on named keysChange policy, disable, delete, import material
Security auditorRead key metadata, policies, rotation status and usage logsAny change; any cryptographic operation
Break-glassRestore a deleted policy or cancel a pending deletion during an incidentRoutine use; it is monitored and sealed
  • Remove inherited rights: check whether the account owner, root or a broad organisation administrator role can still manage every key. Where the provider allows it, write key policies so that only named administrator roles can manage the key, and keep the account root out of daily use.
  • Just-in-time administration: grant key administrator rights for a time-boxed change rather than permanently. NIST SP 800-53 AC-5 (separation of duties) and AC-6(5) (privileged accounts) are the controls to cite. See the Tiered Administration and Enterprise Access Model Guide.
  • Organisation guardrails: use organisation-level policies to deny key deletion, disabling and policy changes except from named roles, and to deny granting key use to principals outside your organisation.
  • Strong authentication: human administrators sign in through your identity provider with phishing-resistant MFA from privileged access workstations, in line with the NCSC secure system administration principles. See the Privileged Access Workstations Guide.
  • Break-glass: keep one documented emergency path, sealed and alerting on use. See the Break-Glass Account Guide.

Service identities and key usage

Most calls to a KMS come from non-human identities: storage and database services acting for you, application workloads that unwrap data keys, pipelines that sign artefacts and backup services. The OWASP Key Management Cheat Sheet asks you to enforce least privilege for all key assets and to give each key a single purpose, which limits the damage if one is misused.

IdentityNeedsAvoidPattern
Application workloadDecrypt or generate data key on its own keyWildcard on all keys; management actionsOne workload identity per application, keyed to named key IDs
Cloud storage or database serviceUse a key on behalf of the accountAllowing any caller through the serviceCondition the permission on the calling service and your account
CI/CD signing jobSign with one signing keyDecrypt rights; long-lived access keys in pipeline variablesFederated short-lived credentials bound to the protected branch
Backup serviceEncrypt and decrypt backup copiesUsing the production key for backupsA separate backup key administered by a different team
Cross-account consumerUse one shared keyGranting the whole external accountNamed role in the external account, explicit conditions, expiry
  • Prefer federation: workloads should obtain short-lived credentials through workload identity federation, not static access keys. See the Workload Identity Federation Guide.
  • Use encryption context: where the KMS supports additional authenticated data or encryption context, require it in policy so a stolen credential can only decrypt data for the matching tenant or table.
  • Envelope encryption: keep key encryption keys in the KMS and data keys next to the data, wrapped. That keeps call volumes manageable and lets you rotate the wrapping key without re-encrypting everything. See the Envelope Encryption and KMS Integration Patterns Guide.
  • Inventory: record every identity with key permissions, its owner and purpose in your NHI inventory. See the Service Account Security Guide.

Key lifecycle, rotation and deletion

NIST SP 800-57 Part 1 defines a cryptoperiod as the time span during which a key is authorised for use, and the OWASP cheat sheet gives typical ranges, such as up to two years for symmetric data keys in general low-volume use. Set your cryptoperiods in policy and let the KMS enforce them.

  1. Create: generate keys inside the KMS or its HSM-backed tier rather than importing, unless a regulation or contract needs you to hold the material. FIPS 140-3 defines four increasing security levels for cryptographic modules; record which level your key tier is validated at. See the HSM Deployment and Operations Guide.
  2. Tag and own: every key gets an owner, data classification, application and cryptoperiod tag at creation, enforced by policy.
  3. Rotate: turn on automatic rotation for symmetric keys where the KMS offers it. Rotating a key encryption key creates new versions while older versions remain available to decrypt existing data; rotation does not revoke access and is not a response to compromise.
  4. Respond to compromise: follow a written compromise-recovery plan, as the OWASP cheat sheet recommends: who is notified, which data is affected, how data is re-encrypted under a new key, and when the old key is disabled. See If your cloud key management service (KMS) is compromised.
  5. Disable, then delete: disable a key and watch for failed calls for a period before scheduling deletion. Use the longest deletion waiting period your provider allows for keys that protect production or backup data.
  6. Imported material: track expiry dates and keep an escrowed copy under dual control; once material expires or is removed, data cannot be decrypted until it is re-imported. See the BYOK, HYOK and External Key Management Guide.

Logging and detection

Cloud KMSs record management actions and cryptographic operations in the provider's audit log, but data-plane events such as decrypt calls may need to be switched on or may be sampled. Confirm both are captured for every account and region, and send them to storage under a different administrative account with object lock or equivalent immutability. NIST SP 800-53 AU-9(2) covers storing audit records on a separate system, and AU-9(4) limits management of audit logging to a subset of privileged users.

EventWhy it mattersAlert
Key disabled, deletion scheduled, imported material deletedDestroys availability of data (T1485)Always, page the owner
Key policy or permission change, new grantPersistence or exfiltration path (T1098)Always, compare with change record
Decrypt or generate-data-key by an unexpected identity or from an unexpected networkStolen workload credential (T1078.004)New caller for a key; volume spike
Cross-account use of a keyData moved or shared outside the organisationAny account outside an allow list
New key created and used to encrypt existing data in bulkPossible ransomware using a key the attacker controls (T1486)Encryption under a key with an external or unknown policy
Rotation turned off; logging configuration changedWeakened lifecycle or a blind spot (T1685)Always

Send these to your SIEM and route deletion alerts to a channel that does not depend on the same cloud account. See the Securing the SIEM itself guide for protecting the place where these logs end up.

Hardening an existing KMS: a phased approach

  1. Inventory (week 1 to 2): export every key, alias, policy, grant and rotation setting across all accounts, subscriptions or projects and regions. Map each key to the data stores and services that use it.
  2. Turn on logging and alerts: enable data-plane logging, forward to immutable storage, and deploy the deletion and policy-change alerts before changing any permissions.
  3. Audit mode for least privilege: compare granted permissions with 90 days of actual key usage (our suggested window) and draft narrower policies. Use the provider's policy analysis or access analysis features where available.
  4. Pilot ring: apply narrowed policies to non-production keys first, then one production application, and watch for access-denied errors.
  5. Guardrails: add organisation policies that deny deletion and external grants except for named roles.
  6. Roll back safely: keep the previous policy version in source control. If a workload fails, re-grant only the specific action and key it reports as missing; never restore a wildcard. A key pending deletion can be cancelled during the waiting period, so make cancellation part of the runbook.

For a full rollout of a new KMS, use the Cloud key management service (KMS) rollout playbook; for moving keys between providers or tiers, the Cloud key management service (KMS) migration playbook.

Decision guidance

DecisionChoose A whenChoose B when
Provider-managed keys (A) or customer-managed keys (B)You need encryption at rest with no key administration burden and no separation requirementYou need your own policy, rotation control, usage logs per key or the ability to revoke access
Software-protected (A) or HSM-backed key tier (B)General workloads with no stated module validation levelRegulation, contract or risk needs a higher FIPS 140-3 level or hardware key protection
Generated in KMS (A) or imported or external material (B)Default: fewer moving parts and no material outside the serviceYou must hold or escrow the material, or keep it outside the provider; accept the outage risk
Shared key per environment (A) or key per application (B)Small estates where blast radius is acceptableLarger estates, regulated data or multi-tenant platforms

Small organisations can usually stop at customer-managed keys for regulated data, deletion alerts and a two-role split. Large organisations need policy as code, organisation guardrails and a key per application or tenant. See the Cloud Customer-Managed Keys and BYOK/HYOK Decision Guide.

Lifecycle of the platform itself

  • Buy and design: ask the CISA and FBI Secure by Demand questions: standards-based SSO at no extra cost, phishing-resistant MFA by default, security logs in the base product, at least six months of log retention for cloud services, and a published vulnerability disclosure policy.
  • Run: review administrators, grants and cross-account permissions every quarter, and track the metrics in the Cloud key management service (KMS) health check.
  • Back up and recover: keep a separate key for backups under a different administrative team, and test that a restore can decrypt with that key alone. See the Backup Security and Immutable Backup Guide.
  • Retire: before deleting a key, prove that no data store still references it, export the usage history you must retain, then disable, wait and delete. Remove the key's grants and aliases, and close the workload identities that used it.

Detection and measurement

  1. Percentage of customer-managed keys with an owner, application and cryptoperiod tag (target: 100%).
  2. Number of principals that can both administer and use the same key (target: zero outside break-glass).
  3. Policies or grants with wildcard principals, wildcard keys or external accounts outside the allow list (target: zero).
  4. Percentage of symmetric keys with automatic rotation on.
  5. Disable and schedule-deletion events with a matching change record (target: 100%), and median time from the event to owner acknowledgement.
  6. Percentage of accounts and regions with data-plane KMS logging enabled and forwarded to immutable storage.

Framework mapping

Control areaNIST SP 800-53 Rev. 5NIST CSF 2.0ATT&CK threat addressed
Key lifecycle and availabilitySC-12, SC-12(1), SC-28, SC-28(1)PR.DS-01T1485 Data Destruction
Admin and use separationAC-5, AC-6, AC-6(5), AC-2PR.AA-05T1098 Account Manipulation
Service identity credentialsIA-5PR.AA-01T1078.004 Cloud Accounts, T1098.001 Additional Cloud Credentials
Logging of key operationsAU-6, AU-9(2), AU-9(4), AU-12, AC-6(9)PR.PS-04T1685 Disable or Modify Tools
Change control of policyCM-3, CM-5PR.PS-01T1486 Data Encrypted for Impact
Backup keysCP-9PR.DS-11T1485 Data Destruction

In ISO/IEC 27001:2022 Annex A, the platform maps mainly to 8.24 Use of cryptography, 8.2 Privileged access rights and 8.15 Logging. In CIS Controls v8.1, see Control 3 Data Protection and Control 6 Access Control Management.

Common failure patterns

  • Admins who can decrypt: a broad cloud administrator role includes key use, so every administrator credential is a decryption credential.
  • Wildcard key policies: a policy written during a proof of concept allows any principal in the account to decrypt, and is copied into every new key by a template.
  • Forgotten grants: programmatic grants created for a migration or a vendor integration are never retired and stay usable for years.
  • Deletion with no alarm: a scheduled deletion passes unnoticed through the waiting period, and the data under the key becomes unreadable.
  • Logs only for management events: decrypt calls are not recorded, so after a credential leak nobody can say what data was read.
  • Imported material left to expire: nobody owns the expiry date, and a production database stops working on a weekend.

Practitioner checklist

  • Classify the KMS, its key policies and the pipeline that deploys them as tier 0.
  • Split key administrator, key user and auditor roles, and remove inherited rights from broad admin roles.
  • Scope each workload identity to named keys and operations, using federation instead of static keys.
  • Require encryption context or equivalent conditions where the KMS supports it.
  • Turn on automatic rotation and enforce owner and cryptoperiod tags.
  • Deny deletion, disabling and external grants by organisation policy except for named roles.
  • Use the longest practical deletion waiting period, and alert on every disable and schedule-deletion call.
  • Enable data-plane logging everywhere and forward it to immutable storage.
  • Keep a separate backup key under a different team and test restores with it.
  • Maintain a written key compromise-recovery plan and test it once a year.

Standards and references

Related NHI Mgmt Group resources: Cryptographic Key Management Guide · Cloud key management service (KMS) health check · Securing the secrets manager itself · Securing the internal PKI and certificate authority itself · Encryption and Key Management Requirements Map

PDF for subscribers

Take this guide with you

Every section, table and checklist in one PDF, with links to the sources and related guides. Subscribe to our weekly NHI & AI Identity Journal and we’ll email you a download link.

Free weekly newsletter

Subscribe to the NHI & AI Identity Journal

The latest on NHI and Agentic AI security – articles, research, breaches, news and events every week.

Bonus 33% off our NHI Course when you subscribe.

PDF Downloads for Newsletter Subscribers

Get the guide

Enter your details and we’ll email you a download link.

The full guide is free to read online. The PDF is a thank you for subscribing.

Fill in all fields marked * and tick both boxes to continue.