Detection rules › YARA-L

Google Workspace Multiple Files Deleted From Google Drive

Severity
high
Type
Alert
Time window
1h
Match by
user_id
Author
Google Cloud Security
Source
github.com/chronicle/detection-rules

Identifies when a user deletes multiple files from Google Drive, which may indicate data destruction.

MITRE ATT&CK coverage

TacticTechniques
ImpactT1485 Data Destruction

Event coverage

Rule body yaral

/*
 * Copyright 2023 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     https://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

rule google_workspace_multiple_files_deleted_from_google_drive {

  meta:
    author = "Google Cloud Security"
    description = "Identifies when a user deletes multiple files from Google Drive, which may indicate data destruction."
    rule_id = "mr_efa7bd41-506c-49b9-85a0-d799f0345ecf"
    rule_name = "Google Workspace Multiple Files Deleted From Google Drive"
    mitre_attack_tactic = "Impact"
    mitre_attack_technique = "Data Destruction"
    mitre_attack_url = "https://attack.mitre.org/techniques/T1485/"
    mitre_attack_version = "v13.1"
    type = "Alert"
    data_source = "Workspace Activity"
    severity = "High"
    priority = "High"

  events:
    $ws.metadata.vendor_name = "Google Workspace"
    $ws.metadata.product_name = "drive"
    (
        $ws.metadata.product_event_type = "trash" or
        $ws.metadata.product_event_type = "delete"
    )
    $ws.principal.user.userid = $user_id

  match:
    $user_id over 1h

  outcome:
    $risk_score = max(75)
    $mitre_attack_tactic = "Impact"
    $mitre_attack_technique = "Data Destruction"
    $mitre_attack_technique_id = "T1567"
    $event_count = count_distinct($ws.metadata.id)
    $product_event_type = array_distinct($ws.metadata.product_event_type)
    $userid = array_distinct($ws.principal.user.userid)
    $doc_type = array_distinct($ws.src.resource.attribute.labels["doc_type"])
    $owner = array_distinct($ws.target.resource.attribute.labels["owner"])
    $doc_name = array_distinct($ws.target.resource.name)
    $doc_id = array_distinct($ws.target.resource.product_object_id)
    $count_docs = count_distinct($ws.target.resource.product_object_id)

  condition:
    // Customize the value of $count_docs to set the alerting threshold for your environment
    $ws and $count_docs > 10
}

Detection logic

Fires when at least one $ws event in the 1h window and $count_docs > 10.

Events

$ws

  • metadata.product_event_type = "trash" or "delete"

Correlation

Match key
$user_id (principal.user.userid)
Within
1h

Outcome

Fields the detection emits on a match. $risk_score drives alerting; Chronicle surfaces the rest on the detection.

FieldExpression
risk_scoremax(75)
event_countcount_distinct($ws.metadata.id)
product_event_typearray_distinct($ws.metadata.product_event_type)
useridarray_distinct($ws.principal.user.userid)
doc_typearray_distinct($ws.src.resource.attribute.labels["doc_type"])
ownerarray_distinct($ws.target.resource.attribute.labels["owner"])
doc_namearray_distinct($ws.target.resource.name)
doc_idarray_distinct($ws.target.resource.product_object_id)
count_docscount_distinct($ws.target.resource.product_object_id)