# T1078.004 - Cloud Accounts
## [Description from ATT&CK](https://attack.mitre.org/techniques/T1078/004)
<blockquote>Adversaries may obtain and abuse credentials of a cloud account as a means of gaining Initial Access, Persistence, Privilege Escalation, or Defense Evasion. Cloud accounts are those created and configured by an organization for use by users, remote support, services, or for administration of resources within a cloud service provider or SaaS application. In some cases, cloud accounts may be federated with traditional identity management system, such as Window Active Directory. (Citation: AWS Identity Federation)(Citation: Google Federating GC)(Citation: Microsoft Deploying AD Federation)

Compromised credentials for cloud accounts can be used to harvest sensitive data from online storage accounts and databases. Access to cloud accounts can also be abused to gain Initial Access to a network by abusing a [Trusted Relationship](https://attack.mitre.org/techniques/T1199). Similar to [Domain Accounts](https://attack.mitre.org/techniques/T1078/002), compromise of federated cloud accounts may allow adversaries to more easily move laterally within an environment.</blockquote>

## Atomic Tests

- [Atomic Test #1 - Creating GCP Service Account and Service Account Key](#atomic-test-1---creating-gcp-service-account-and-service-account-key)


<br/>

## Atomic Test #1 - Creating GCP Service Account and Service Account Key
GCP Service Accounts can be used to gain intial access as well as maintain persistence inside Google Cloud.

**Supported Platforms:** Google-workspace, Windows, Linux, macOS


**auto_generated_guid:** 9fdd83fd-bd53-46e5-a716-9dec89c8ae8e





#### Inputs:
| Name | Description | Type | Default Value |
|------|-------------|------|---------------|
| project-id | ID of the project, you want to create service account as well as service account key for | String | art-project-1|
| service-account-name | Name of the service account | String | gcp-art-service-account-1|
| service-account-email | Email of the service account | String | gcp-art-service-account-1@art-project-1.iam.gserviceaccount.com|
| output-key-file | Email of the service account | String | gcp-art-service-account-1.json|


#### Attack Commands: Run with `gcloud`! 


```gcloud
gcloud auth login --no-launch-browser
gcloud config set project #{project-id}
gcloud iam service-accounts create #{service-account-name}
gcloud iam service-accounts keys create #{output-key-file} --iam-account=#{service-account-email}
```

#### Cleanup Commands:
```gcloud
gcloud iam service-accounts delete #{service-account-email} --quiet
```



#### Dependencies:  Run with `gcloud`!
##### Description: Requires gcloud
##### Check Prereq Commands:
```gcloud
if [ -x "$(command -v gcloud)" ]; then exit 0; else exit 1; fi;
```
##### Get Prereq Commands:
```gcloud
echo "Please Install Google Cloud SDK before running this atomic test : https://cloud.google.com/sdk/docs/install"
```




<br/>
