Detection rules › Panther

GCP DNS Zone Modified or Deleted

Severity
low
Group by
protoPayload.authenticationInfo.principalEmail
Log types
GCP.AuditLog
Reference
https://cloud.google.com/dns/docs/zones
Source
github.com/panther-labs/panther-analysis

Detection for GCP DNS zones that are deleted, patched, or updated.

Rule body yaml

AnalysisType: rule
Description: Detection for GCP DNS zones that are deleted, patched, or updated.
DisplayName: "GCP DNS Zone Modified or Deleted"
Enabled: true
Filename: gcp_dns_zone_modified_or_deleted.py
Runbook: Verify that this modification or deletion was expected. These operations are high-impact events and can result in downtimes or total outages.
Reference: https://cloud.google.com/dns/docs/zones
Severity: Low
Tests:
  - ExpectedResult: true
    Log:
      insertid: -xxxxxxxxxxxx
      logName: projects/test-project-123456/logs/cloudaudit.googleapis.com%2Factivity
      protoPayload:
        at_sign_type: type.googleapis.com/google.cloud.audit.AuditLog
        authenticationInfo:
          principalEmail: user@domain.com
        authorizationInfo:
          - granted: true
            permission: dns.managedZones.delete
            resourceAttributes: {}
        methodName: dns.managedZones.delete
        request:
          "@type": type.googleapis.com/cloud.dns.api.ManagedZonesDeleteRequest
          managedZone: test-zone
          project: test-project-123456
        requestMetadata:
          callerIP: 12.12.12.12
          destinationAttributes: {}
          requestAttributes:
            auth: {}
            time: "2023-05-23T19:08:13.820007Z"
        resourceName: managedZones/test-zone
        response:
          "@type": type.googleapis.com/cloud.dns.api.ManagedZonesDeleteResponse
        serviceName: dns.googleapis.com
        status: {}
      receivetimestamp: "2023-05-23 19:08:14.305"
      resource:
        labels:
          location: global
          project_id: test-project-123456
          zone_name: test-zone
        type: dns_managed_zone
      severity: NOTICE
      timestamp: "2023-05-23 19:08:11.697"
    Name: dns.managedZones.delete-should-alert
  - ExpectedResult: true
    Log:
      insertid: -xxxxxxxxxxxx
      logname: projects/test-project-123456/logs/cloudaudit.googleapis.com%2Factivity
      protoPayload:
        at_sign_type: type.googleapis.com/google.cloud.audit.AuditLog
        authenticationInfo:
          principalEmail: user@domain.com
        authorizationInfo:
          - granted: true
            permission: dns.managedZones.update
            resourceAttributes: {}
        methodName: dns.managedZones.patch
        request:
          "@type": type.googleapis.com/cloud.dns.api.ManagedZonesPatchRequest
          managedZone: test-zone
          managedZoneResource:
            description: testing
            privateVisibilityConfig:
              networks:
                - networkUrl: https://www.googleapis.com/compute/v1/projects/test-project-123456/global/networks/default
          project: test-project-123456
        requestMetadata:
          callerIP: 12.12.12.12
          destinationAttributes: {}
          requestAttributes:
            auth: {}
            time: "2023-05-23T19:07:25.568071Z"
        resourceName: managedZones/test-zone
        response:
          "@type": type.googleapis.com/cloud.dns.api.ManagedZonesPatchResponse
          managedZone:
            cloudLoggingConfig: {}
            creationTime: "2023-05-23T18:59:57.919Z"
            description: testing
            dnsName: test.detectiontesting.com.
            fingerprint: 3f961d0b0a9e6a8c000001884a024eed
            id: "4581881604156058252"
            name: test-zone
            nameServers:
              - ns-gcp-private.googledomains.com.
            privateVisibilityConfig:
              networks:
                - networkUrl: https://www.googleapis.com/compute/v1/projects/test-project-123456/global/networks/default
            rrsetCount: 2
            visibility: PRIVATE
          operation:
            id: a7513a2c-e637-4b86-b223-1c4f8b0797be
            startTime: "2023-05-23T19:07:25.511Z"
            status: DONE
            type: UPDATE
            user: user@domain.com
            zoneContext:
              newValue:
                cloudLoggingConfig: {}
                creationTime: "2023-05-23T18:59:57.919Z"
                description: testing
                dnsName: test.detectiontesting.com.
                fingerprint: 3f961d0b0a9e6a8c000001884a024eed
                id: "4581881604156058252"
                name: test-zone
                nameServers:
                  - ns-gcp-private.googledomains.com.
                privateVisibilityConfig:
                  networks:
                    - networkUrl: https://www.googleapis.com/compute/v1/projects/test-project-123456/global/networks/default
                rrsetCount: 2
                visibility: PRIVATE
              oldValue:
                cloudLoggingConfig: {}
                creationTime: "2023-05-23T18:59:57.919Z"
                description: testing
                dnsName: test.detectiontesting.com.
                fingerprint: 3f961d0b0a9e6a8c0000018849fb7b5f
                id: "4581881604156058252"
                name: test-zone
                nameServers:
                  - ns-gcp-private.googledomains.com.
                rrsetCount: 2
                visibility: PRIVATE
        serviceName: dns.googleapis.com
        status: {}
      receivetimestamp: "2023-05-23 19:07:26.276"
      resource:
        labels:
          location: global
          project_id: test-project-123456
          zone_name: test-zone
        type: dns_managed_zone
      severity: NOTICE
      timestamp: "2023-05-23 19:07:25.282"
    Name: dns.managedZones.patch-should-alert
  - ExpectedResult: true
    Log:
      insertid: xxxxxxxxxxxx
      logname: projects/test-project-123456/logs/cloudaudit.googleapis.com%2Factivity
      protoPayload:
        at_sign_type: type.googleapis.com/google.cloud.audit.AuditLog
        authenticationInfo:
          principalEmail: user@domain.com
        authorizationInfo:
          - granted: true
            permission: dns.changes.create
            resourceAttributes: {}
        methodName: dns.changes.create
        request:
          "@type": type.googleapis.com/cloud.dns.api.ChangesCreateRequest
          change:
            additions:
              - name: test.detectiontesting.com.
                rrdata:
                  - ns-gcp-private.googledomains.com. cloud-dns-hostmaster.google.com. 1 21600 3600 259200 300
                ttl: 3600
                type: SOA
            deletions:
              - name: test.detectiontesting.com.
                rrdata:
                  - ns-gcp-private.googledomains.com. cloud-dns-hostmaster.google.com. 1 21600 3600 259200 300
                ttl: 21600
                type: SOA
          managedZone: test-zone
          project: test-project-123456
        requestMetadata:
          callerIP: 12.12.12.12
          destinationAttributes: {}
          requestAttributes:
            auth: {}
            time: "2023-05-23T19:07:39.239275Z"
        resourceName: managedZones/test-zone
        response:
          "@type": type.googleapis.com/cloud.dns.api.ChangesCreateResponse
          change:
            additions:
              - name: test.detectiontesting.com.
                rrdata:
                  - ns-gcp-private.googledomains.com. cloud-dns-hostmaster.google.com. 1 21600 3600 259200 300
                ttl: 3600
                type: SOA
            deletions:
              - name: test.detectiontesting.com.
                rrdata:
                  - ns-gcp-private.googledomains.com. cloud-dns-hostmaster.google.com. 1 21600 3600 259200 300
                ttl: 21600
                type: SOA
            id: "1"
            startTime: "2023-05-23T19:07:39.155Z"
            status: PENDING
        serviceName: dns.googleapis.com
        status: {}
      receivetimestamp: "2023-05-23 19:07:40.053"
      resource:
        labels:
          location: global
          project_id: test-project-123456
          zone_name: test-zone
        type: dns_managed_zone
      severity: NOTICE
      timestamp: "2023-05-23 19:07:39.132"
    Name: dns.managedZones.update-should-alert
  - ExpectedResult: false
    Log:
      insertid: -nkgd1se1zsiw
      logName: projects/test-project-123456/logs/cloudaudit.googleapis.com%2Factivity
      protoPayload:
        at_sign_type: type.googleapis.com/google.cloud.audit.AuditLog
        authenticationInfo:
          principalEmail: staging@pantherstaging.io
        authorizationInfo:
          - granted: true
            permission: dns.managedZones.get
            resourceAttributes: {}
        methodName: dns.managedZones.get
        request:
          "@type": type.googleapis.com/cloud.dns.api.ManagedZonesGetRequest
          managedZone: test-zone
          project: test-project-123456
        requestMetadata:
          callerIP: 12.12.12.12
          destinationAttributes: {}
          requestAttributes:
            auth: {}
            time: "2023-05-23T19:08:13.820007Z"
        resourceName: managedZones/test-zone
        response:
          "@type": type.googleapis.com/cloud.dns.api.ManagedZonesGetResponse
        serviceName: dns.googleapis.com
        status: {}
      receivetimestamp: "2023-05-23 19:08:14.305"
      resource:
        labels:
          location: global
          project_id: test-project-123456
          zone_name: test-zone
        type: dns_managed_zone
      severity: NOTICE
      timestamp: "2023-05-23 19:08:11.697"
    Name: dns.managedZones.get-should-not-alert
DedupPeriodMinutes: 90
LogTypes:
  - GCP.AuditLog
RuleID: "GCP.DNS.Zone.Modified.or.Deleted"
Threshold: 1

Detection logic

Condition

protoPayload.methodName in ["dns.changes.create", "dns.managedZones.delete", "dns.managedZones.patch", "dns.managedZones.update"]

Indicators

Each row is a field, operator, and value that the rule matches. The corpus column counts how many other rules in the catalog look for the same combination: high numbers point to widely-used, community-vetted indicators. Blank or 1 shows that the indicator is specific to this rule.

FieldKindValues
protoPayload.methodNamein
  • dns.changes.create
  • dns.managedZones.delete
  • dns.managedZones.patch
  • dns.managedZones.update

Output fields

Fields the rule emits when it matches. Chronicle authors list these in the outcome block; they appear on the detection and $risk_score drives alerting. Sentinel / Defender XDR rules build them up through project / summarize / extend stages. Sentinel maps these into alert fields via entityMappings and customDetails; Defender XDR custom detections surface them as alert fields directly.

FieldSource
projectresource.labels.project_id
principalprotoPayload.authenticationInfo.principalEmail
caller_ipprotoPayload.requestMetadata.callerIP
methodNameprotoPayload.methodName
resourceNameprotoPayload.resourceName
serviceNameprotoPayload.serviceName