Skip to main content

More Info:

Unauthorized API calls, especially by root or admin-level entities, must trigger alerts. This is a critical indicator of privilege escalation or internal reconnaissance by a threat actor.

Risk Level

High

Address

Compliance, Security

Compliance Standards

  • APRA CPS 234 (Australia)
  • AWS Startup Security Baseline
  • 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)
  • Essential 8
  • HIPAA
  • HITRUST CSF
  • ISO 27001
  • 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
  • SOC2
  • SWIFT Customer Security Controls Framework
  • Sarbanes-Oxley IT General Controls
  • UK NCSC Cyber Assessment Framework

Triage and Remediation

Remediation

Using Console

Below are concise, console-based steps to configure an alarm for root activity in OCI Monitoring. This uses:
  • Audit → Logs
  • Service Connector → Custom Metric in Monitoring
  • Alarm → Notification to email/Slack/etc.

1. Prerequisites

  1. Make sure:
    • Audit is enabled (it is on by default for all compartments).
    • You have permissions for:
      • audit, logging, sch (Service Connector Hub), metrics, and ons (Notifications).
  2. Decide:
    • Which compartment to monitor (often the root compartment/tenancy).
    • Where to put:
      • The Service Connector
      • The Custom Metric compartment (often same as tenancy or a central ops compartment)
      • The Alarm and Notification topics

2. Confirm Audit Logs Are Flowing to Logging

  1. In OCI Console, open the navigation menu.
  2. Go to Observability & Management → Logging.
  3. Under Logs, select the compartment where Audit logs should appear.
  4. Ensure there is a log group such as Default Audit Logs and that Audit logs exist (filter by Service = Audit or check for recent events).
If Audit logs aren’t going to Logging, enable them:
  1. Go to Identity & Security → Audit.
  2. Choose your compartment (root / tenancy).
  3. Confirm events exist. By default, they are exported to the Logging service for 90 days; if not, configure a log as needed.

3. Create a Service Connector to Turn Root Activity into a Custom Metric

You will create a Service Connector that:
  • Source: Audit Logs
  • Target: Monitoring custom metrics
  • Filter: Only events where the actor is the tenancy’s root user (OCID of root user) or equivalent high-privilege user.
  1. Find the root user OCID:
    • Go to Identity & Security → Users.
    • Locate the tenancy root user (often the first user or the user associated with the tenancy).
    • Copy the root User OCID.
  2. Go to Observability & Management → Service Connector Hub.
  3. Click Create service connector.
  4. Basics:
    • Name: e.g., Root-Activity-to-Metrics
    • Compartment: choose your central ops / security compartment.
  5. Source:
    • Select Logging.
    • Choose:
      • Log group containing your Audit logs (e.g., Default Audit Logs).
      • Log: the Audit log.
  6. Filter (important):
    • Under Stream logs by specifying filters, add a filter to match Audit events where:
      • data.identity.principalId = "<ROOT_USER_OCID>"
        (replace with the OCID you copied)
    • Example filter (JSON filter expression, depending on UI version):
    • If principalEmail or userName is easier to filter on in your environment, adjust the field accordingly (e.g., data.identity.userName).
  7. Target:
    • Choose Monitoring.
    • Metric namespace: e.g., security_root_activity.
    • Metric name: e.g., root_actions_count.
    • Dimensions (recommended):
      • compartmentId, eventName, requestAction, requestResource, etc.
    • Value: typically 1 per event (the target UI usually defaults to counting occurrences).
  8. Save and Activate the service connector.
Now each root activity event will push a custom metric point into Monitoring.

4. Verify the Custom Metric

  1. Go to Observability & Management → Monitoring → Metrics Explorer.
  2. In Compartment, pick the compartment where metrics are stored.
  3. Under Namespace, select security_root_activity (or the namespace you used).
  4. Under Metric Name, select root_actions_count.
  5. Adjust time range (e.g., last 1–24 hours).
  6. Confirm you see metric data when you know root has done an action (you can do a trivial root action to test, like listing resources).

5. Create a Notification Topic (If Not Already)

  1. Go to Application Integration → Notifications.
  2. Click Create topic:
    • Name: e.g., Root-Activity-Alerts.
    • Compartment: security / ops.
  3. Open the topic; click Create subscription.
  4. Choose Protocol (e.g., Email, HTTPS, Slack via webhook, PagerDuty, etc.).
  5. Enter the endpoint (email address, webhook URL).
  6. For email, confirm via the link sent to your email.

6. Create an Alarm on the Root Activity Metric

  1. Go to Observability & Management → Monitoring → Alarms.
  2. Click Create alarm.
  3. Alarm basics:
    • Name: Root-Activity-Alarm.
    • Compartment: same as your metrics (or your monitoring compartment).
  4. Alarm query (example):
    • Namespace: security_root_activity
    • Metric: root_actions_count
    • Statistic: sum
    • Interval: 1 minute or 5 minutes.
    • Use a Monitoring query like:
    • This means: trigger if any root activity occurs in the last 5 minutes.
  5. Severity: choose Critical (recommended).
  6. Destination:
    • Select the Notification topic Root-Activity-Alerts.
  7. Alarm trigger settings:
    • Trigger rule: Greater than threshold (as defined above).
    • Specify how many consecutive periods should breach before triggering (e.g., 1 period for immediate alert).
  8. Optional: Suppress (to avoid alert storms) if needed, e.g., auto-resolve or cooldown period.
  9. Click Create alarm.

7. Test the Alarm

  1. Perform a test action as root (e.g., view or modify a resource).
  2. Wait for the monitoring interval (e.g., 5 minutes).
  3. Confirm:
    • The metric updated in Metrics Explorer.
    • The alarm enters FIRING.
    • You receive the notification via your configured channel.

If you share exactly how you identify the “root account” in your tenancy (user OCID, group, or specific IAM conditions), I can give you a more precise filter expression for the Service Connector.
Below is a CLI-based way to configure an OCI Monitoring alarm for root activity. Because metric names and dimensions can differ between tenancies, the steps first discover the exact Audit metric and then create the alarm.

1. Set your common variables

You can avoid repeating --region by exporting:

2. Discover available Audit metrics (to locate root-activity metric)

List metrics for the oci_audit namespace in the root compartment:
Inspect the output for a metric that clearly represents root/tenant-level activity (for example, you may see metrics like root_activity, audit_events, etc., with dimensions such as userName, principalId, or flags indicating root usage).Identify:
  • metricName (e.g. root_activity)
  • Any dimension(s) that distinguish root user or root-compartment actions (e.g. userName = "ocid1.tenancy.oc1..." or principalId = "<root-principal-id>")
You will use these in the query.

3. Build the Monitoring query for “root activity”

A typical query pattern:
Example (you must adapt metricName, dimensionKey, and value based on step 2):
or, with a dimension (example only):
Test your query interactively in the OCI Console (Monitoring → Metrics Explorer) to confirm it returns data when you simulate or view historical root activity.

4. Create the alarm via OCI CLI

Use the query from step 3 in --query-text.
Replace <YOUR_QUERY_TEXT_HERE> with your tested query, for example:
or:

5. Verify the alarm

  1. List alarms:
  2. Describe the alarm to confirm configuration:
  3. Trigger a controlled root action (if possible) and confirm a notification is sent to the topic.

If you paste the output of step 2 (the relevant metric snippet), I can help you craft the exact --query-text for your tenancy.
Below is a practical way to remediate this in OCI using Python by creating a Monitoring Alarm that fires whenever there is root user activity (using Audit metrics).

1. Prerequisites

  1. Enable Audit in the tenancy (it’s on by default).
  2. Install OCI Python SDK:
  3. Configure your ~/.oci/config with appropriate tenancy, user, fingerprint, key_file, region and a profile (e.g. DEFAULT).
  4. Have:
    • Compartment OCID where you want the alarm created.
    • Notification Topic OCID (for OCI Notifications) to receive alerts.

2. Find / Confirm Root Activity Metric

Oracle provides Audit-related metrics in namespace oci_audit. You should confirm what’s available in your tenancy:
Look for a metric that represents root activity (e.g., auditrootactioncount or similar) or a way to filter on principalId or identity.domain.id/identity.user.name indicating root or tenancy-level identity.Suppose you identified:
  • Namespace: oci_audit
  • Metric: auditrootactioncount
  • Dimension for root activity: principalid = "ocid1.tenancy.oc1..root" (example – adjust to what you actually see).

3. Define the Alarm Query

A typical Monitoring query for “any root action in last minute” might look like:
Adjust:
  • Metric name
  • Dimension key/value (whatever you confirmed in step 2)
  • Window [1m], [5m], etc.
  • Aggregation .sum() / .rate() as appropriate.

4. Create the Alarm with Python


5. Validate

  1. In the OCI Console:
    Monitoring → Alarms → locate “Root Activity Alarm”.
  2. Confirm:
    • Namespace: oci_audit.
    • Query matches what you tested.
    • Notification destination is correct.
  3. Trigger a test (if possible) or temporarily lower the threshold to confirm a notification is sent.

6. Summary of Remediation

  • Identify / confirm the metric(s) representing root activity in oci_audit.
  • Craft a Monitoring query that detects non-zero root activity in a small time window.
  • Programmatically create an Alarm using the OCI Python SDK with:
    • namespace="oci_audit"
    • The root-activity query
    • A Notifications topic as the destination.
If you share the exact metric name and dimensions you see from list_metrics, I can give you a fully tailored query string.
Substitute:
  • OCID_OF_ALARM_COMPARTMENT with the compartment OCID where you manage alarms.
  • OCID_OF_METRIC_COMPARTMENT with the compartment OCID where the metric is emitted.
  • OCID_OF_OCI_NOTIFICATIONS_TOPIC with your Notifications topic OCID used for alerting.
  • CUSTOM_NAMESPACE_FOR_ROOT_ACTIVITY_METRICS and CUSTOM_METRIC_NAME with the actual namespace/metric you publish for unauthorized root/admin API calls, and adjust the dimension filters (userType, responseCode) to match your metric schema.
This change does not force replacement of existing resources; it creates (or updates) a single oci_monitoring_alarm resource.Verification: terraform plan should show one oci_monitoring_alarm.root_unauthorized_api_calls to be created (or updated) with the query condition using your root-activity metric and a threshold of > 0.