GSuite Overly Visible Drive Document


Description

A Google drive resource that is overly visible has been modified.

Query · python

from panther_gsuite_helpers import gsuite_details_lookup as details_lookup
from panther_gsuite_helpers import gsuite_parameter_lookup as param_lookup

RESOURCE_CHANGE_EVENTS = {
    "create",
    "move",
    "upload",
    "edit",
}

PERMISSIVE_VISIBILITY = {
    "people_with_link",
    "public_on_the_web",
}


def rule(event):
    if event.deep_get("id", "applicationName") != "drive":
        return False

    details = details_lookup("access", RESOURCE_CHANGE_EVENTS, event)
    return (
        bool(details)
        and param_lookup(details.get("parameters", {}), "visibility") in PERMISSIVE_VISIBILITY
    )


def dedup(event):
    user = event.deep_get("actor", "email")
    if user is None:
        user = event.deep_get("actor", "profileId", default="<UNKNOWN_PROFILEID>")
    return user


def title(event):
    details = details_lookup("access", RESOURCE_CHANGE_EVENTS, event)
    doc_title = param_lookup(details.get("parameters", {}), "doc_title")
    share_settings = param_lookup(details.get("parameters", {}), "visibility")
    user = event.deep_get("actor", "email")
    if user is None:
        user = event.deep_get("actor", "profileId", default="<UNKNOWN_PROFILEID>")
    return (
        f"User [{user}]"
        f" modified a document [{doc_title}] that has overly permissive share"
        f" settings [{share_settings}]"
    )

Analyst notes

Investigate whether the drive document is appropriate to be this visible.

Raw source GSuite Overly Visible Drive Document · Panther Python
Esc
Published by panther-labs/panther-analysis ↗, licensed under Apache 2.0 ↗. Reproduced here unmodified.
AnalysisType: rule
Filename: gsuite_drive_overly_visible.py
RuleID: "GSuite.DriveOverlyVisible"
DisplayName: "GSuite Overly Visible Drive Document"
Enabled: true
LogTypes:
  - GSuite.ActivityEvent
Tags:
  - GSuite
  - Collection:Data from Information Repositories
Reports:
  MITRE ATT&CK:
    - TA0009:T1213
Severity: Info
Description: >
  A Google drive resource that is overly visible has been modified.
Reference: https://support.google.com/docs/answer/2494822?hl=en&co=GENIE.Platform%3DDesktop&sjid=864417124752637253-EU
Runbook: >
  Investigate whether the drive document is appropriate to be this visible.
SummaryAttributes:
  - actor:email
DedupPeriodMinutes: 360 # 6 hours
Tests:
  - Name: Access Event
    ExpectedResult: false
    Log:
      {
            "p_log_type": "GSuite.ActivityEvent",
            "p_row_id": "111222",
            "actor": {
                  "email": "bobert@example.com"
            },
            "id": {
                  "applicationName": "drive"
            },
            "type": "access",
            "name": "download"
      }
  - Name: Modify Event Without Over Visibility
    ExpectedResult: false
    Log:
      {
            "p_log_type": "GSuite.ActivityEvent",
            "p_row_id": "111222",
            "actor": {
                  "email": "bobert@example.com"
            },
            "id": {
                  "applicationName": "drive"
            },
            "type": "access",
            "name": "edit",
            "parameters": {
                  "visibility": "private"
            }
      }
  - Name: Overly Visible Doc Modified
    ExpectedResult: true
    Log:
      {
            "p_log_type": "GSuite.ActivityEvent",
            "p_row_id": "111222",
            "actor": {
                  "email": "bobert@example.com"
            },
            "id": {
                  "applicationName": "drive"
            },
            "type": "access",
            "name": "edit",
            "parameters": {
                  "visibility": "people_with_link",
                  "doc_title": "my shared document"
            }
      }
  - Name: Overly Visible Doc Modified - no email
    ExpectedResult: true
    Log:
      {
            "p_log_type": "GSuite.ActivityEvent",
            "p_row_id": "111222",
            "actor": {
                  "profileId": "1234567890123"
            },
            "id": {
                  "applicationName": "drive"
            },
            "type": "access",
            "name": "edit",
            "parameters": {
                  "visibility": "people_with_link",
                  "doc_title": "my shared document"
            }
      }


# ------ paired body: gsuite_drive_overly_visible.py ------

from panther_gsuite_helpers import gsuite_details_lookup as details_lookup
from panther_gsuite_helpers import gsuite_parameter_lookup as param_lookup

RESOURCE_CHANGE_EVENTS = {
    "create",
    "move",
    "upload",
    "edit",
}

PERMISSIVE_VISIBILITY = {
    "people_with_link",
    "public_on_the_web",
}


def rule(event):
    if event.deep_get("id", "applicationName") != "drive":
        return False

    details = details_lookup("access", RESOURCE_CHANGE_EVENTS, event)
    return (
        bool(details)
        and param_lookup(details.get("parameters", {}), "visibility") in PERMISSIVE_VISIBILITY
    )


def dedup(event):
    user = event.deep_get("actor", "email")
    if user is None:
        user = event.deep_get("actor", "profileId", default="<UNKNOWN_PROFILEID>")
    return user


def title(event):
    details = details_lookup("access", RESOURCE_CHANGE_EVENTS, event)
    doc_title = param_lookup(details.get("parameters", {}), "doc_title")
    share_settings = param_lookup(details.get("parameters", {}), "visibility")
    user = event.deep_get("actor", "email")
    if user is None:
        user = event.deep_get("actor", "profileId", default="<UNKNOWN_PROFILEID>")
    return (
        f"User [{user}]"
        f" modified a document [{doc_title}] that has overly permissive share"
        f" settings [{share_settings}]"
    )

Detection rules belong to the projects that publish them and remain under their own licenses. This site indexes and links to them; it claims no rights in them.