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 trailsRisk Level
MediumAddress
Compliance, SecurityCompliance 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
Remediation
Using Console
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
- In the OCI Console, open the navigation menu.
- Go to Identity & Security → Vault.
- Make sure you are in the correct compartment.
- 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
- Open the vault you plan to use.
- Go to the Master Encryption Keys (or Keys) tab.
- 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.
3. Update the Bucket to Use the Customer-Managed KMS Key
- In the OCI Console, go to Storage → Buckets.
- Choose the Compartment where your “OCI Encryption Monitoring” bucket (or target bucket) resides.
- Click the bucket name you want to remediate.
- On the bucket details page, click Edit (top-right).
- 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.
- Click Save changes (or Update).
4. (Optional) Verify Configuration
- Return to the bucket details page.
- Under Encryption, confirm it shows:
- Customer-managed keys.
- The correct Vault and Key.
Using CLI
Using CLI
Below are the exact steps to remediate “OCI Encryption Storage Buckets Should Use Customer-Managed KMS Keys” using the OCI CLI.Assumptions:
Get the vault OCID and management endpoint:From the output, note:Get the key OCID:Note the If you already have a CMK created, just identify its
List all buckets in a compartment with their current KMS key:In the output:
Verify:You should see
This will show all buckets in the compartment that are still using Oracle-managed encryption, which you can feed into your monitoring or alerting.
- You already have the OCI CLI configured (
oci setup configdone). - 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)
id→ VAULT_OCIDmanagement-endpoint→ KMS_ENDPOINT
1.2. Create a Master Encryption Key
id as:KEY_OCID and skip the creation steps.2. Identify Buckets Not Using Customer-Managed Keys
Get the Object Storage namespace:- Buckets with
"kmsKeyId": nullare 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
"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 havekmsKeyId set.5. (Optional) Script for Monitoring / Reporting via CLI
To only monitor (no changes), you can run:Using Python
Using Python
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.
(Adjust for dynamic groups if using instance/resource principals.)
If you share whether you want to target only specific compartments, tags, or exclude some buckets, I can adjust the script accordingly.
1. Prerequisites
- OCI Python SDK installed
- Configured OCI credentials (one of):
~/.oci/configwith a profile, e.g.[DEFAULT]- Or use instance principal / resource principal (for functions) – code below shows both patterns.
- Existing Vault and KMS Key
vault_id(OCID of the KMS vault)kms_key_id(OCID of the key inside that vault you want to use for bucket encryption)
- IAM Policies
2. Script Outline
What it does:- Lists all compartments (or uses a specific one).
- Lists all Object Storage buckets per compartment.
- Identifies buckets where:
kms_key_idisNone(Oracle-managed encryption) ORkms_key_idis not the desired KMS key.
- 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_idset 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.
Using Terraform
Using Terraform
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.
