> [!NOTE]
> Premium and Enterprise (Deprecated) [service tiers](https://docs.cloud.google.com/security-command-center/docs/service-tiers.md.txt)

> [!CAUTION]
> The Security Command Center Enterprise service tier will shut down on May 21, 2027. If your organization uses the Enterprise service tier, then the organization will automatically move to the Premium service tier on or after May 21, 2027. Contact your account representative or a [Google Cloud sales specialist](https://cloud.google.com/contact) if you have questions.

This document describes a threat finding type in Security Command Center. Threat findings are generated by
[threat detectors](https://docs.cloud.google.com/security-command-center/docs/concepts-security-sources.md.txt#threats) when they detect
a potential threat in your cloud resources. For a full list of available threat findings, see [Threat findings index](https://docs.cloud.google.com/security-command-center/docs/threat-findings-index.md.txt).

## Overview

This finding isn't available for project-level activations.

An IAM service account is accessing Google Cloud using
suspicious software, as indicated by an anomalous user agent.

[Event Threat Detection](https://docs.cloud.google.com/security-command-center/docs/concepts-event-threat-detection-overview.md.txt) is the source of
this finding.

## How to respond

To respond to this finding, do the following:

### Step 1: Review finding details

1. Open a `Persistence: New User Agent` finding, as directed
   in [Reviewing finding details](https://docs.cloud.google.com/security-command-center/docs/how-to-investigate-threats.md.txt#reviewing_findings) earlier on this
   page. The details panel for the finding opens to the **Summary** tab.

2. On the **Summary** tab, review the information in the following sections:

   - **What was detected** , especially the following fields:
     - **Principal email**: the potentially compromised service account.
   - **Affected resource** , especially the following fields:
     - **Project full name**: the project that contains the potentially compromised service account.
   - **Related links** , especially the following fields:
     - **Cloud Logging URI**: link to Logging entries.
     - **MITRE ATT\&CK method**: link to the MITRE ATT\&CK documentation.
     - **Related findings**: links to any related findings.

   1. In the detail view of the finding, click the **JSON** tab.
   2. In the JSON, note the following fields.

   - `projectId`: the project that contains the potentially compromised service account.
   - `callerUserAgent`: the anomalous user agent.
   - `anomalousSoftwareClassification`: the type of software.
   - `notSeenInLast`: the time period used to establish a baseline for normal behavior.

### Step 2: Review project and account permissions

1. In the Google Cloud console, go to the **IAM** page.

   <br />

   [Go to IAM](https://console.cloud.google.com/iam-admin/iam)

   <br />

2. If necessary, select the project listed in `projectId`.

3. On the page that appears, in the **Filter** box, enter the account name
   that is listed on the **Principal email** row in the **Summary** tab
   of the finding details and check granted roles.

4. In the Google Cloud console, go to the **Service Accounts** page.

   <br />

   [Go to Service Accounts](https://console.cloud.google.com/iam-admin/serviceaccounts)

   <br />

5. On the page that appears, in the **Filter** box, enter the account name
   that is listed on the **Principal email** row in the **Summary** tab
   of the finding details.

6. Check the service account's keys and key creation dates.

### Step 3: Check logs

1. On the **Summary tab** of the finding details panel, click the **Cloud Logging URI** link to open the **Logs Explorer**.
2. If necessary, select your project.
3. On the page that loads, check logs for activity from new or updated IAM resources using the following filters:
   - `proto_payload.method_name="google.iam.admin.v1.CreateServiceAccount"`
   - `protoPayload.methodName="SetIamPolicy"`
   - `protoPayload.methodName="google.iam.admin.v1.UpdateRole"`
   - `protoPayload.methodName="google.iam.admin.v1.CreateRole"`
   - `protoPayload.authenticationInfo.principalEmail="principalEmail"`

### Step 4: Research attack and response methods

1. Review the MITRE ATT\&CK framework entry for this finding type: [Valid Accounts: Cloud Accounts](https://attack.mitre.org/techniques/T1078/004/).
2. To develop a response plan, combine your investigation results with MITRE research.

### Step 5: Implement your response


The following response plan might be appropriate for this finding, but might also impact operations.
Carefully evaluate the information you gather in your investigation to determine the best way to
resolve findings.

- Contact the owner of the project with the compromised account.
- Review the `anomalousSoftwareClassification`, `callerUserAgent`, and `behaviorPeriod` fields to verify whether the access is abnormal and if the account has been compromised.
- Delete project resources created by unauthorized accounts, like unfamiliar Compute Engine instances, snapshots, service accounts, and IAM users.
- To restrict the creation of new resources to specific regions, see [Restricting resource locations](https://docs.cloud.google.com/resource-manager/docs/organization-policy/defining-locations).
- To identify and fix overly permissive roles, use [IAM
  Recommender](https://docs.cloud.google.com/iam/docs/recommender-overview).

## Example finding JSON

The following is an example of the finding JSON.

```json
{
  "finding": {
    "name": "organizations/ORGANIZATION_ID/sources/SOURCE_ID/findings/FINDING_ID",
    "parent": "organizations/ORGANIZATION_ID/sources/SOURCE_ID",
    "resourceName": "//monitoring.googleapis.com/projects/PROJECT_ID",
    "state": "ACTIVE",
    "category": "Persistence: New User Agent",
    "sourceProperties": {
      "sourceId": {
        "projectNumber": "PROJECT_NUMBER",
        "customerOrganizationNumber": "ORGANIZATION_ID"
      },
      "detectionCategory": {
        "technique": "persistence",
        "indicator": "audit_log",
        "ruleName": "iam_anomalous_behavior",
        "subRuleName": "user_agent"
      },
      "detectionPriority": "LOW",
      "affectedResources": [{
        "gcpResourceName": "//monitoring.googleapis.com/projects/PROJECT_ID"
      }, {
        "gcpResourceName": "//cloudresourcemanager.googleapis.com/projects/PROJECT_NUMBER"
      }],
      "evidence": [{
        "sourceLogId": {
          "projectId": "PROJECT_ID",
          "resourceContainer": "projects/PROJECT_ID",
          "timestamp": {
            "seconds": "1614736482",
            "nanos": 9.76209552E8
          },
          "insertId": "INSERT_ID"
        }
      }],
      "properties": {
        "anomalousSoftware": {
          "anomalousSoftwareClassification": ["USER_AGENT"],
          "behaviorPeriod": "2592000s",
          "callerUserAgent": "USER_AGENT",
          "principalEmail": "USER_EMAIL@PROJECT_ID.iam.gserviceaccount.com"
        }
      },
      "findingId": "FINDING_ID",
      "contextUris": {
        "cloudLoggingQueryUri": [{
          "displayName": "Cloud Logging Query Link",
          "url": "https://console.cloud.google.com/logs/query;query\u003dtimestamp%3D%222021-03-03T01:54:42.976209552Z%22%0AinsertId%3D%22INSERT_ID%22%0Aresource.labels.project_id%3D%22PROJECT_ID%22?project\u003dPROJECT_ID"
        }]
      }
    },
    "securityMarks": {
      "name": "organizations/ORGANIZATION_ID/sources/SOURCE_ID/findings/FINDING_ID/securityMarks"
    },
    "eventTime": "2021-03-03T01:54:47.681Z",
    "createTime": "2021-03-03T01:54:49.154Z",
    "severity": "HIGH",
    "workflowState": "NEW",
    "canonicalName": "organizations/ORGANIZATION_ID/sources/SOURCE_ID/findings/FINDING_ID"
  },
  "resource": {
    "name": "//monitoring.googleapis.com/projects/PROJECT_ID"
  }
}
```

## What's next

- Learn [how to work with threat
  findings in Security Command Center](https://docs.cloud.google.com/security-command-center/docs/how-to-investigate-threats).
- Refer to the [Threat findings index](https://docs.cloud.google.com/security-command-center/docs/threat-findings-index.md.txt).
- Learn how to [review a
  finding](https://docs.cloud.google.com/security-command-center/docs/how-to-investigate-threats#reviewing_findings) through the Google Cloud console.
- Learn about the [services that
  generate threat findings](https://docs.cloud.google.com/security-command-center/docs/concepts-security-sources#threats).