Skip to main content

More Info:

KMS keys should have been rotated at least once (more than one key version). Keys that have never been rotated may use outdated cryptographic parameters.

Risk Level

High

Address

Compliance, Security

Compliance Standards

  • APRA CPS 234 (Australia)
  • AWS Well Architected Framework
  • BSI C5 (Germany)
  • Brazil LGPD
  • CCPA / CPRA (California)
  • CIS AWS
  • CIS Critical Security Controls v8
  • CMMC 2.0
  • CSA Cloud Controls Matrix v4
  • Cloudanix Best Practice
  • DPDPA
  • Digital Operational Resilience Act (EU)
  • GDPR
  • HIPAA
  • HITRUST CSF
  • ISO/IEC 27017
  • ISO/IEC 27018
  • ISO/IEC 27701
  • KSA PDPL
  • MAS Technology Risk Management (Singapore)
  • MITRE ATT&CK (Cloud)
  • NIS2 Directive
  • NIST
  • NIST CSF
  • NIST SP 800-171
  • NYDFS 23 NYCRR 500
  • PCI
  • Reserve Bank of India (RBI) Cyber Security Framework
  • Reserve Bank of India (RBI) Master Direction – Information Technology Framework
  • SOC2
  • SWIFT Customer Security Controls Framework
  • Sarbanes-Oxley IT General Controls
  • Securities and Exchange Board of India (SEBI) - Cloud Security Adoption Framework
  • UK NCSC Cyber Assessment Framework

Triage and Remediation

Remediation

Using Console

Below are the concise steps to remediate “OCI Encryption KMS Keys Should Be Rotated At Least Once” using the OCI Console.

1. Identify the Non‑Rotated Keys

  1. Sign in to the OCI Console.
  2. Go to Identity & SecurityVault.
  3. Choose the Compartment you monitor (top-left compartment selector).
  4. Open each Vault and then select Keys.
  5. Look for Keys with:
    • Key Status: Enabled
    • No rotation history (never rotated) or last rotation is older than your required policy.

2. Manually Rotate a Key

For each key that needs rotation:
  1. In the vault, go to Keys.
  2. Click the Key Name you want to rotate.
  3. On the key details page, click Rotate Key (or Create New Key Version).
  4. Confirm the rotation:
    • This creates a new key version; the key’s OCID stays the same.
    • Existing resources using this key will automatically start using the new version (no change needed in resource config).
  5. Verify rotation:
    • On the key details page, you should now see multiple Key Versions with the latest marked as Primary.

To avoid future findings for “not rotated at least once”:
  1. In the same Key details page, look for Key Rotation or Automatic Rotation section.
  2. Click Edit Rotation Policy or Enable Rotation.
  3. Set:
    • Rotation Interval (e.g., every 90 days or per your policy).
  4. Save.
This ensures:
  • The key is rotated at least once (clearing current misconfiguration).
  • Future rotations are automated, preventing recurring findings.

4. Confirm Remediation in Your Monitoring Tool

If you’re using OCI Cloud Guard / Security Zones / custom monitoring:
  1. Allow some time for the next evaluation cycle.
  2. Re-run the check (or wait for Cloud Guard detector to rescan).
  3. Verify the finding for “OCI Encryption KMS Keys Should Be Rotated At Least Once” is no longer reported for keys you rotated.

If you share which exact monitoring/control (Cloud Guard detector recipe, Security Zone policy, or a third-party scanner), I can tailor the rotation interval and any additional verification steps to match that control’s logic.
Below are CLI-focused steps to rotate OCI KMS keys and (optionally) enforce a rotation schedule so they’re not flagged as “never rotated”.Assumptions:
  • You already have oci CLI configured with proper tenancy/region.
  • You know the vault-id and key-id for the keys in question.

1. Identify KMS keys that have never been rotated

  1. List keys in a vault:
  1. For each key, list key versions:
  • If only a single version exists (the original), the key has never been rotated.

2. Manually rotate a key (create a new key version)

Manual rotation = creating a new key version.
This immediately creates a new key version and makes it the primary version. Any subsequent cryptographic operations will use this new version, while old versions remain available for decrypting existing data (unless explicitly disabled/destroyed).You can verify:
You should now see multiple versions.

3. Configure automatic key rotation (so the finding does not reoccur)

To ensure periodic rotation, you can set a rotation interval (policy) on the key.

3.1 Prepare a key policy JSON with rotation settings

Create a file key-policy.json:
  • rotationInterval uses ISO 8601 duration format:
    • P90D = every 90 days
    • Example: P180D = every 180 days
Adjust flags (isUseKeyInVaultEnabled, isDerivedKeysEnabled) if needed for your environment.

3.2 Apply the key policy via OCI CLI

Confirm:
Look for the keyPolicy and rotationInterval details in the output.

4. Scriptable remediation (optional)

To remediate all “never rotated” keys in a compartment:High-level bash pseudo-script:

5. Tie into “OCI Encryption Monitoring”

To ensure any future non-rotated or long-unrotated keys are remediated:
  • Use Oracle Cloud Guard / Security Zones or your own governance scripts to:
    • Periodically run a CLI/script similar to section 4 to:
      • Detect keys with a single version or last version older than your threshold.
      • Rotate them and/or enforce rotationInterval.
  • Optionally, configure an Events rule (e.g., on key creation) that triggers a Function which:
    • Immediately sets the rotationInterval.
    • Optionally performs an initial rotation.

In practice, for each flagged key:
  1. oci kms management key-version create --key-id <key_ocid>
  2. oci kms management key update --key-id <key_ocid> --from-json file://key-policy.json (with an appropriate rotationInterval).
Below is how to remediate “OCI Encryption KMS Keys Should Be Rotated At Least Once” with Python-based monitoring and enforcement using the OCI Python SDK.

1. Prerequisites

  1. Install SDK:
  1. Configure OCI credentials (one of):
  • ~/.oci/config with a profile (e.g. DEFAULT)
  • Or instance principal / resource principal (for OCI native execution)
  1. Ensure the calling principal has these permissions in the compartment(s) and vault(s) you care about:
  • manage keys
  • read vaults
Example policy:

2. What you need to check

For each key:
  • Has at least one new key version been created (i.e., rotated) since creation?
  • Is automatic rotation enabled with a reasonable interval (e.g., 90 days)?
Key facts (OCI KMS):
  • Each rotation = new key version (create_key_version).
  • Automatic rotation is controlled via:
    • is_auto_key_rotation_enabled
    • rotation_interval_in_days (min 1 day, typical 30–365)

3. Python script: monitor and remediate rotation

This example:
  1. Lists all vaults and keys in a compartment.
  2. For each key, checks:
    • Whether it has more than one version (i.e., rotated at least once).
    • Whether auto-rotation is enabled with an acceptable interval.
  3. Optionally:
    • Enables auto-rotation if not enabled.
    • Immediately rotates keys that have never been rotated.
Adjust: compartment OCID, rotation policy (e.g., 90 days), and DRY_RUN flag.

4. How this addresses the misconfiguration

  • Monitoring: Script reports keys that:
    • Have never been rotated (only 1 key version).
    • Do not have compliant auto-rotation settings.
  • Remediation (if DRY_RUN = False):
    • Creates a new key version for never-rotated keys.
    • Enables auto-rotation and sets rotation_interval_in_days to your policy.

5. Operationalizing

  • Run this script on a schedule (e.g., OCI Functions, OCI DevOps, or cron on a compute instance).
  • Send output to:
    • OCI Logging / Object Storage / Email or Slack via webhooks for alerts.
  • Optionally:
    • Restrict to “monitor only” in production (keep DRY_RUN=True) and have a change process for enabling actual rotation.
This adds a new key version for the existing OCI KMS key, satisfying the requirement that the key has been rotated at least once; it does not replace the key itself, so no outage is introduced.For verification, terraform plan should show a single + create action for oci_kms_key_version.ENCRYPTION_KEY_ROTATION_1 and no changes to oci_kms_key.ENCRYPTION_KEY.