Skip to main content

More Info:

Object Storage buckets should be encrypted with customer-managed KMS keys rather than Oracle-managed defaults. Customer-managed keys provide full control over encryption lifecycle and audit trails

Risk Level

Medium

Address

Compliance, Security

Compliance Standards

  • APRA CPS 234 (Australia)
  • BSI C5 (Germany)
  • Brazil LGPD
  • CCPA / CPRA (California)
  • CIS Critical Security Controls v8
  • CMMC 2.0
  • CSA Cloud Controls Matrix v4
  • Cloudanix Best Practice
  • DPDPA
  • Digital Operational Resilience Act (EU)
  • ISO/IEC 27017
  • ISO/IEC 27018
  • ISO/IEC 27701
  • KSA PDPL
  • MAS Technology Risk Management (Singapore)
  • MITRE ATT&CK (Cloud)
  • NIS2 Directive
  • NIST SP 800-171
  • NYDFS 23 NYCRR 500
  • SWIFT Customer Security Controls Framework
  • Sarbanes-Oxley IT General Controls
  • UK NCSC Cyber Assessment Framework

Triage and Remediation

Remediation

Using Console

Below are the step‑by‑step remediation steps using the OCI Console so that an Object Storage bucket uses a customer‑managed KMS key instead of the Oracle‑managed default key.

1. Confirm / Create a Vault

  1. In the OCI Console, open the navigation menu.
  2. Go to Identity & SecurityVault.
  3. Make sure you are in the correct compartment.
  4. If you don’t have a vault yet:
    • Click Create vault.
    • Enter Name, select Compartment.
    • Choose Vault type (Default or Virtual Private).
    • Click Create vault and wait until its lifecycle state is Active.

2. Create / Identify a Customer-Managed Key

  1. Open the vault you plan to use.
  2. Go to the Master Encryption Keys (or Keys) tab.
  3. To create a new key:
    • Click Create key.
    • Select Key shape (e.g., AES, 256‑bit).
    • Set Protection mode to HSM or Software as required.
    • Provide a Name and optional description.
    • Click Create key and wait for it to become Enabled.
Keep note of the key and vault (they must be in a region that supports the bucket’s region).

3. Update the Bucket to Use the Customer-Managed KMS Key

  1. In the OCI Console, go to StorageBuckets.
  2. Choose the Compartment where your “OCI Encryption Monitoring” bucket (or target bucket) resides.
  3. Click the bucket name you want to remediate.
  4. On the bucket details page, click Edit (top-right).
  5. In the Encryption section:
    • Change from Encrypt using Oracle-managed keys to Encrypt using Customer-managed keys.
    • Select the Vault created earlier.
    • Select the Master Encryption Key you created/identified.
  6. Click Save changes (or Update).
OCI will now use your customer-managed KMS key for that bucket’s encryption going forward.

4. (Optional) Verify Configuration

  1. Return to the bucket details page.
  2. Under Encryption, confirm it shows:
    • Customer-managed keys.
    • The correct Vault and Key.
This completes remediation for the finding “OCI Encryption Storage Buckets Should Use Customer-Managed KMS Keys” using the OCI Console.
Below are the exact steps to remediate “OCI Encryption Storage Buckets Should Use Customer-Managed KMS Keys” using the OCI CLI.Assumptions:
  • You already have the OCI CLI configured (oci setup config done).
  • You know your compartment OCID and region (or are using defaults in ~/.oci/config).

1. Create (or identify) a Customer-Managed KMS Key

1.1. Create a Vault (if you don’t have one)

Get the vault OCID and management endpoint:
From the output, note:
  • id → VAULT_OCID
  • management-endpoint → KMS_ENDPOINT

1.2. Create a Master Encryption Key

Get the key OCID:
Note the id as:
If you already have a CMK created, just identify its KEY_OCID and skip the creation steps.

2. Identify Buckets Not Using Customer-Managed Keys

Get the Object Storage namespace:
List all buckets in a compartment with their current KMS key:
In the output:
  • Buckets with "kmsKeyId": null are using Oracle-managed keys.
  • Buckets with "kmsKeyId": "<ocid1.key...>" are already using a CMK.

3. Update a Single Bucket to Use the Customer-Managed KMS Key

Verify:
You should see "kmsKeyId": "<your_key_ocid>".

4. Bulk Remediation: Update All Non-Compliant Buckets in a Compartment

This example updates every bucket in the compartment that does not yet have kmsKeyId set.

5. (Optional) Script for Monitoring / Reporting via CLI

To only monitor (no changes), you can run:
This will show all buckets in the compartment that are still using Oracle-managed encryption, which you can feed into your monitoring or alerting.
Below is a concise, practical way to remediate this finding using Python and the OCI SDK: detect buckets not using a customer-managed KMS key and update them to use one.

1. Prerequisites

  1. OCI Python SDK installed
  1. Configured OCI credentials (one of):
  • ~/.oci/config with a profile, e.g. [DEFAULT]
  • Or use instance principal / resource principal (for functions) – code below shows both patterns.
  1. Existing Vault and KMS Key
You must already have:
  • vault_id (OCID of the KMS vault)
  • kms_key_id (OCID of the key inside that vault you want to use for bucket encryption)
  1. IAM Policies
The principal running this script must be allowed to:
(Adjust for dynamic groups if using instance/resource principals.)

2. Script Outline

What it does:
  1. Lists all compartments (or uses a specific one).
  2. Lists all Object Storage buckets per compartment.
  3. Identifies buckets where:
    • kms_key_id is None (Oracle-managed encryption) OR
    • kms_key_id is not the desired KMS key.
  4. Updates each such bucket to use the customer-managed KMS key.

3. Python Remediation Script


4. How This Ties to “Encryption Monitoring”

If you are using Cloud Guard / Security Zones / Cloud Advisor with a control such as “OCI Encryption Storage Buckets Should Use Customer-Managed KMS Keys,” rerun the detector after this script:
  • All buckets will have kms_key_id set to your customer-managed key.
  • The encryption control should move from “Problem” to “Resolved” state once the service re-evaluates.

If you share whether you want to target only specific compartments, tags, or exclude some buckets, I can adjust the script accordingly.
Changing kms_key_id on an existing oci_objectstorage_bucket updates the bucket in place; it does not force replacement, so no outage is expected.To verify, terraform plan should show an in-place ~ update on oci_objectstorage_bucket.encrypted_bucket with kms_key_id changing from null (or the old key OCID) to the OCID of oci_kms_key.cmk_key.