Who Touched My GCP Project? Understanding the Principal Part in Cloud Audit Logs - Gabriel Fried

fwd:cloudsec
18 Jun 202422:28

Summary

TLDRIn this insightful talk, Gabrielle Freed, a senior security researcher, delves into Google Cloud Platform (GCP) audit logs, focusing on the principal part and its significance in cybersecurity. He explains the importance of understanding identities—users, workload identities, and service accounts—in the context of GCP. Freed discusses the concept of impersonation, delegation chains, and the unique challenges in identifying service agents. He also touches on the practical aspects of investigating incidents within GCP environments, providing valuable insights for securing cloud-based operations.

Takeaways

  • 🔒 The importance of understanding who accessed or modified GCP projects is emphasized for reducing time loss and avoiding unnecessary financial losses in cybersecurity incidents.
  • 👤 The script introduces three main identity types in GCP: users, workload identities, and service accounts, each serving different purposes and access methods within the GCP environment.
  • 🔑 Service accounts in GCP are used for service-to-service operations and can be identified by the 'gs://service-account.com' prefix. They can be user-managed or Google-managed, with different authentication and access control mechanisms.
  • 🔄 The concept of service account impersonation is explained, allowing one service account to act on behalf of another, which can be legitimate for tasks like delegated access or potentially malicious for privilege escalation.
  • 🔗 Delegation chains are highlighted as a series of impersonations where a service account may need to impersonate multiple other service accounts to access resources, which is crucial for tracing back the origin of operations in an incident.
  • 📝 The structure of cloud audit logs is detailed, including authentication info and service account delegation info, which are vital for understanding the 'who, what, and where' of actions taken within GCP.
  • 📡 Workload identities offer a solution for external entities to access GCP resources securely without the need for managing keys, using an IDP trust and token exchange process.
  • 👥 Workforce identity federation is mentioned as a similar solution for human users, allowing them direct access to GCP resources after authentication with an IDP, without the need for impersonation.
  • 🕵️‍♂️ The speaker suggests using the knowledge of identities and logs to investigate incidents effectively, tracing actions back to their origin and understanding the context of operations within GCP.
  • ⚠️ The script warns about cases where Google redacts caller IPs or identities for privacy reasons, and advises checking Google's documentation for understanding such cases in logs.
  • 📈 The talk concludes with a call to action for attendees to review their GCP logs to understand the activities, and in time, to be able to write detections based on their environment's impersonation patterns.

Q & A

  • What is the main focus of the talk 'Who Touched My GCP Project'?

    -The talk focuses on understanding the principal part in Cloud audit logs to identify who performed actions within a GCP project, which is crucial for security incident investigation and resolution.

  • Why is it important to understand who touched a GCP project?

    -Understanding who touched a GCP project is important to reduce time loss and potential financial loss due to false investigations, and to quickly resolve security incidents by identifying the actions and impacts of the involved entities.

  • What is the role of Periso in cloud security?

    -Periso is a threat detection company that provides a purpose-built platform for detecting threats in cloud-based environments. It uses human and non-human identity attribution to analyze data across authentication boundaries for actionable detections.

  • What are the three main identity types in GCP?

    -The three main identity types in GCP are users, workload identities, and service accounts. Users are human entities, workload identities are for external entities, and service accounts are for service-to-service operations.

  • What are the two main sections of cloud audit logs in GCP?

    -The two main sections of cloud audit logs in GCP are data access and admin activity. Data access logs record access to certain data, while admin activity logs record administrative operations.

  • What is a service account in GCP and how is it used?

    -A service account in GCP provides an identity for a resource to access another resource. It is used for service-to-service operations, such as when an application on a VM needs to access a GCP bucket.

  • What are the two methods of accessing a service account in GCP?

    -The two methods of accessing a service account in GCP are activation and impersonation. Activation involves logging in as the service account, while impersonation allows a service account to act on behalf of a user to access a resource.

  • What is the purpose of service account impersonation in GCP?

    -Service account impersonation allows a service account to act on behalf of a user to access a resource. It can be used for legitimate cases like delegating access or for malicious purposes such as data exfiltration or privilege escalation.

  • What is a service agent in GCP and how does it differ from a service account?

    -A service agent in GCP acts on behalf of certain services and is usually attached to them for logging operations. Unlike service accounts, service agents are completely managed by Google and cannot be impersonated.

  • What is workload identity and how does it provide a solution for external entities accessing GCP resources?

    -Workload identity provides external cloud providers or SaaS applications with an identity to access GCP resources without the need for keys. It uses keyless authentication through an IDP trust to GCP, allowing external entities to authenticate and access GCP resources securely.

  • What is the significance of the Google Kubernetes Engine default service account in the context of the talk?

    -The Google Kubernetes Engine default service account is significant because it is often used for operations within the Kubernetes environment. Any operation from a VM, even with an attached service account, happens through a delegation from the default service account, which is an important behavior to recognize during investigations.

Outlines

00:00

🔍 Introduction to GCP Audit Logs and Sponsors

The speaker, Gabrielle, begins by acknowledging the sponsors, specifically Periso, a threat detection company specializing in cloud-based environments. Periso's platform is highlighted for its ability to analyze human and non-human behaviors in cloud and SaaS environments, providing high fidelity and actionable detections. Gabrielle introduces the talk's focus on understanding the principal part in Google Cloud Platform (GCP) audit logs, emphasizing the importance of identifying who accessed or modified GCP resources to prevent time and money loss due to false investigations.

05:00

🛠 Understanding Service Accounts and Service Agents in GCP

Gabrielle explains the concept of service accounts in GCP, which provide an identity for a resource to access another resource, using the example of an application needing to access a GCP bucket. Three types of service accounts are discussed: user-managed, Google-managed, and service agents. The speaker outlines the methods of accessing service accounts, including activation and impersonation, and the importance of understanding these in the context of audit logs. The talk also touches on the legitimate and malicious use cases for impersonation and the concept of delegation chains in service account operations.

10:02

🔗 Delegation Chains and Service Agent Operations

The speaker delves into the intricacies of service account delegation chains, where multiple impersonations may be necessary due to insufficient permissions. Gabrielle clarifies how to identify delegation chains and single invocations in audit logs by examining the permission codes and metadata. The discussion includes the default service account behavior in Google Compute Engine and the role of service agents, which are managed by Google and cannot be impersonated. Examples of service agents and their representation in logs are provided, along with a cautionary note on their proper identification to prevent security risks.

15:05

🌐 Workload Identities and Workforce Identity Federation

Gabrielle introduces workload identities, which allow external cloud providers or SaaS applications to access GCP resources securely without the need for managing keys. The process of authenticating through an external Identity Provider (IDP) and obtaining a GCP access token is explained. The speaker also covers how these identities appear in logs, with examples of token exchanges and impersonations. Workforce identity federation is briefly mentioned as a similar solution for users, providing direct access to GCP resources after IDP authentication.

20:06

🕵️‍♂️ Analyzing GCP Logs for Incident Investigation

The speaker provides insights into using GCP logs for incident investigation, highlighting how to trace operations back to their origins using session IDs and other identifiers. Gabrielle discusses the importance of recognizing default service accounts associated with services like Google Kubernetes Engine and the potential for Google to redact caller IPs or identities for privacy reasons. The talk concludes with a challenge for the audience to analyze their own GCP logs, understand the activities, and write detections based on their environment's impersonation patterns.

🤝 Closing Remarks and Audience Interaction

Gabrielle concludes the presentation by summarizing the key points about different identities in GCP and how they can be investigated through logs. The speaker encourages the audience to engage with their GCP logs to enhance their understanding and detection capabilities. A Q&A session follows, where Gabrielle addresses questions about identifying service accounts that mimic service agents and the use of Google's access transparency logs, showing a readiness to share knowledge and learn from the audience's experiences.

Mindmap

Keywords

💡GCP

GCP stands for Google Cloud Platform, which is a suite of cloud computing services that Google offers to the public. It is the main subject of the video, as the speaker discusses how to understand and analyze activities within a GCP project. The script mentions various GCP features and services, such as GCP buckets and jobs, emphasizing the importance of monitoring and auditing these resources for security purposes.

💡Cloud Audit Logs

Cloud Audit Logs are records of activities and events within a cloud environment. In the context of the video, they are crucial for tracking who accessed or modified resources in a GCP project. The speaker explains how to interpret these logs to identify the principal part involved in the actions, which is essential for security incident response and forensic analysis.

💡Principal

In the context of the video, a principal refers to the entity that initiates an action within a GCP project. This could be a user, a service account, or a workload identity. Understanding the principal is key to determining who performed an action, which is critical for security monitoring and compliance.

💡Service Accounts

Service accounts in GCP are special types of accounts used by applications or services to access GCP resources. They are not tied to an individual user and are often used for automated processes. The script discusses how service accounts can be used for service-to-service operations and how they can be identified in audit logs.

💡Impersonation

Impersonation in the context of the video refers to the process where a service account assumes the identity of another service account to access resources. This can be legitimate for tasks like delegated access or potentially malicious if used to escalate privileges. The speaker explains how impersonation is represented in audit logs and the importance of understanding it for security analysis.

💡Delegation Chains

Delegation chains occur when a series of impersonations is required to access a resource due to insufficient permissions. The video explains how this is represented in audit logs and how it can be traced back to the original invoker. This is important for understanding the flow of actions and identifying potential security issues.

💡Workload Identities

Workload identities provide a way for external cloud providers or SaaS applications to access GCP resources without the need for managing keys. The script explains how this keyless authentication works and how it is beneficial for security by reducing the risk of key exposure and simplifying the management of external entities.

💡Workforce Identity Federation

Workforce Identity Federation is a solution that allows users to authenticate to their identity provider (IDP) and then access GCP resources directly, without the need for additional impersonation. The video describes how this process works and how it is represented in logs, emphasizing the simplification of user management and security.

💡Service Agents

Service agents in GCP are predefined service accounts managed by Google, used for specific services within the Google environment. The speaker mentions that service agents cannot be impersonated and provides examples of how they appear in audit logs, which is important for understanding the scope of actions performed by these agents.

💡Redaction

Redaction in the context of the video refers to the practice of removing or obscuring certain information in logs for privacy or security reasons. The script mentions cases where Google might redact caller IPs or identities in logs, which is important to be aware of when conducting investigations or audits.

💡Forensics

Forensics in the video refers to the investigation and analysis of data, such as logs, to determine the facts of an incident or security breach. The speaker discusses how understanding the identities and actions within GCP can aid in forensic investigations, providing examples of how session IDs and other details can be traced back to specific actions or entities.

Highlights

Introduction to the importance of understanding principal parts in Cloud audit logs for GCP security.

Sponsorship acknowledgment for Pera, a threat detection company specializing in cloud-based environments.

Explanation of how Pera's platform uses human and non-human identity attribution for high-fidelity detections.

The necessity of knowing 'who touched our GCP project' to mitigate time loss and financial loss from false investigations.

Overview of the three main identity types in GCP: users, workload identity, and service accounts.

Description of the four log categories in GCP: service logs, agent logs, network logs, and cloud audit logs.

Emphasis on the significance of cloud audit logs in determining 'who did what and where' in GCP.

Discussion on the authentication information provided in cloud audit logs, including principal email and service account key details.

Explanation of service account delegation and how it appears in audit logs.

Introduction to service accounts, their purpose, and how they are identified.

Differentiation between user, custom-built, and Google-managed service accounts.

Explanation of service account activation and impersonation, and their respective commands.

Identification of legitimate and malicious use cases for service account impersonation.

How service account operations appear in audit logs, including activation and impersonation.

Concept of service account delegation chains and their necessity for accessing resources.

Detailed look at how Google Compute Engine default service account operates and its appearance in logs.

Introduction to Service agents, their function, and how they differ from service accounts.

Explanation of workload identities and their role in providing external entities access to GCP resources.

Description of the process for external entities to authenticate and access GCP resources using workload identities.

How workload identity operations appear in logs, including token exchange and impersonation.

Introduction to Workforce identity Federation and its benefits over traditional user management.

Summary of how to use the understanding of identities and logs to investigate incidents in GCP.

Recommendation for the audience to check their GCP logs to understand and investigate incidents.

Q&A session discussing the challenges of identifying malicious service accounts mimicking service agents.

Mention of Google's Access Transparency logs and their potential use in investigations.

Transcripts

play00:00

all right we're going to uh we're going

play00:01

to get right back into it uh our next

play00:04

talk is uh who touched my gcp project

play00:07

understanding the principal part in

play00:09

Cloud audit logs uh before we get

play00:11

started I'd like to thank our sponsors

play00:13

specifically per

play00:15

miso uh permiso is a threat detection

play00:18

company that finds evil in cloud-based

play00:20

environments detection in identity cloud

play00:22

and SAS environments have suffered too

play00:23

long from a one siiz fits-all sim

play00:25

approach modern environments require a

play00:27

purpose-built platform periso uses human

play00:30

non-human identity attribution to pair

play00:31

runtime and static data in cloud and SAS

play00:33

into complete sessions where detections

play00:35

no longer have to rely on single events

play00:38

pera's platform provides High Fidelity

play00:40

High resiliency and maximum content for

play00:42

actionable detections that cut through

play00:43

the Noise by analyzing human and

play00:45

non-human entitlements and behavior

play00:47

across authentication boundaries periso

play00:49

gives companies a complete picture of

play00:51

every entity operating in and across

play00:52

their Cloud environments and does not

play00:54

allow threat actors to hide in silos of

play00:56

overwhelming Cloud activity data please

play00:58

welcome Gabrielle

play01:00

[Applause]

play01:03

hello can you hear me awesome hey

play01:06

everyone and welcome to who touch my gcp

play01:08

project where today we're going to learn

play01:10

about the principal part in gcp audit

play01:13

logs every day in our environment we

play01:15

could have gcp buckets being accessed

play01:18

jobs being created and unfortunately

play01:20

cyber security incidents now sadly we

play01:23

could lose a lot of time and

play01:25

unfortunately money on false

play01:27

investigations when we can understand

play01:29

who who did what and how so in order to

play01:33

resolve this and have lower time loss

play01:36

and possibly not any loss of money it's

play01:39

critical for us to understand who

play01:40

touched our gcp project so in order to

play01:44

do so I'd like to go today over some gcp

play01:47

principles and logs we have service

play01:50

accounts and Service agents where do

play01:52

they come into play workload identities

play01:54

and Workforce identities what solution

play01:57

they provide and we'll mention some

play01:59

cases that Google redacts caller

play02:01

identities and IP

play02:05

identities I'm Gabriel freed I'm a

play02:08

senior security researcher at mtiga I

play02:10

have 10 years experience in cyber

play02:11

security this is my first conference I'm

play02:13

talking in and I'm a whiskey dude so if

play02:16

anyone knows where I could get a drink

play02:17

please let me

play02:19

know so let's talk about gcp principle

play02:22

and logs we

play02:23

have in gcp we could categorize three

play02:26

main identity types we have users

play02:28

workload identity and service accounts

play02:31

where Workforce identities which I

play02:32

mentioned are somehow a hybrid between

play02:34

the first two users are like human

play02:37

entities like me and you logging in with

play02:39

our emails to access our gcp resources

play02:42

workload identities provide external

play02:44

entities coming from things like

play02:47

external Cloud providers in SAS access

play02:49

to our gcp resources and service

play02:52

accounts are for service to service

play02:54

operations meaning if we have some

play02:56

resource needing tax as another it will

play02:58

use this as as its

play03:01

entity in gcp we have four kind of log

play03:05

categories we could which we could

play03:06

categorize we have service logs which

play03:09

are for standard error and outputs we

play03:12

have agent logs which are for agents

play03:15

which we could install on certain gcp

play03:17

resources and get information from that

play03:20

agent we have Network logs which are for

play03:24

VPC flow logs Nat gateways and firewall

play03:28

rules and what will focus on

play03:30

today the cloud audit logs the cloud

play03:33

audit logs tell us who did what and

play03:36

where and they could be categorized into

play03:39

two sections data access and admin

play03:41

activity where data access is stuff

play03:44

we're using to access certain data and

play03:46

admin activity is about administrative

play03:48

operations an example for this could be

play03:51

a creation of a bucket would be under

play03:53

admin activity but accessing the data in

play03:56

the bucket would be under data access so

play03:58

these are the four types of logs you

play04:02

could categorize in

play04:04

gcp in our Cloud audit logs we have a

play04:06

section called authentication info this

play04:09

tells us who did what and

play04:12

how and it tells us the authentication

play04:15

method a principal email a service

play04:18

account key information which we'll talk

play04:20

about in service account section it will

play04:22

tell us about third party information

play04:25

and some delegation info for delegated

play04:27

impersonations which we'll talk about

play04:29

later later on this structure looks

play04:31

something like

play04:33

this we could see in this structure we

play04:35

have another structure called service

play04:37

account delegation

play04:39

info this is for impersonation chain of

play04:42

service account and Service agents which

play04:44

we'll talk about later down the line but

play04:47

this section just to keep in mind looks

play04:49

something like this so something small

play04:51

we can remember we have four SE types of

play04:54

logs three main identities and two

play04:57

interesting structures so once we talked

play05:00

about that let's shift to the service

play05:02

account and Service

play05:04

agents what are service accounts service

play05:07

accounts provide an identity for a

play05:09

resource to access another resource and

play05:11

an example usage for this to get this

play05:13

into our uh head is kind of like having

play05:16

an application on a VM which needs to

play05:19

access our gcp bucket so this will be

play05:22

done using a service account we could

play05:24

identify these by the GS service

play05:26

account.com prefix

play05:30

wait okay there are three types of

play05:33

service accounts service accounts just

play05:35

to a head start when they authenticate

play05:37

they needs credentials which are usually

play05:40

ajon or p12 key so we have three main

play05:43

categories we have user which are

play05:45

custommade built-in service accounts and

play05:48

Google manage service accounts the

play05:51

custom ones that a user could create are

play05:54

we could act we could give them certain

play05:56

types of roles specific Scopes and we

play05:58

manage their keys

play06:00

for access the Google built-in service

play06:03

accounts are kind of Google's way to

play06:05

give to give us a head start on certain

play06:07

services for example if we have the

play06:09

Google compute engine and we enable this

play06:11

API Google will create the service

play06:14

account and its keys to get us started

play06:16

and the Google managed are technically

play06:18

what we will later refer to as the

play06:20

service agents but these are for

play06:21

internal operations happening in our

play06:24

Google environment and their keys are

play06:26

completely managed by

play06:28

Google so

play06:30

how can we access these service accounts

play06:32

well we have two types of meth methods

play06:34

of accessing them through through

play06:38

activation and through impersonation

play06:40

when we activate a service account we're

play06:42

essentially logging in as the service

play06:45

account we need to provide a key and

play06:47

then we're essentially if our g-cloud uh

play06:50

command is activating it we're kind of

play06:53

logged in as disservice account this

play06:55

could be done using this command

play07:00

now this is what I'd call a bad

play07:02

impersonation but now let's talk about

play07:05

service account

play07:07

impersonations a service account

play07:08

personation allows a service account to

play07:11

act on our behalf to access a certain

play07:14

Resource as we could see here a user

play07:16

might need to impersonate a service

play07:17

account to access a resource this

play07:19

service account has this will allow us

play07:22

to have temporary credentials to the

play07:23

service account to access the

play07:27

resource now we could have legitimate

play07:29

cases for impersonation some malicious

play07:32

cases for

play07:33

impersonation and two types of

play07:35

impersonations a legitimate case could

play07:37

be when we want to delegate access

play07:39

because we don't want our users to

play07:40

always have access to everything we

play07:43

might need this to automate tasks on

play07:45

certain software we have to impersonate

play07:47

service accounts for resources and we

play07:50

might want to De like give external

play07:52

entities access to our resources which

play07:55

we'll talk about later on to get um

play07:58

resources from outside into our gcp

play08:00

environment a malicious actor might use

play08:03

this to either exfiltrate data cuz a

play08:06

service account might have the right

play08:07

permissions escalate their privileges

play08:09

because it might have higher Privileges

play08:11

and certain types of attacks using their

play08:14

behavior and to possibly cover their

play08:16

tracks why because you might say Okay a

play08:19

service account is operating in these

play08:20

logs it's all

play08:22

good now there are two forms of

play08:25

impersonation one is the activation we

play08:27

mentioned previously and one is a

play08:29

specific

play08:29

invocation what happens when we have a

play08:31

specific invocation we're essentially

play08:34

getting temporary credentials to act on

play08:36

one certain command to to allow this

play08:39

service account to act on our behalf

play08:42

what we need for this is a role called

play08:44

service account token Creator why

play08:47

because what happens when we impersonate

play08:49

we're generating an access token which

play08:51

allows us to have temporary credentials

play08:53

for the service account to allow it to

play08:55

operate on our behalf so we understood

play08:58

so far that in service accounts we have

play09:01

activation and impersonation let's see

play09:03

how this looks in our audit

play09:06

logs when we're activating a service

play09:08

account as we mentioned we're

play09:10

essentially logging in as the service

play09:12

account so the authentication info

play09:14

section will tell us our principal email

play09:16

was the actual service account operating

play09:19

because now our session is as the

play09:20

service account but when we impersonate

play09:23

a service account we will see our user

play09:26

which is instigating this specific

play09:28

invocation in

play09:30

impersonation doing a generate access

play09:33

token operation to get the token for the

play09:36

service account and in our resource

play09:38

section of the logs we will see our

play09:40

service account as what we're trying to

play09:43

impersonate so this is how these look in

play09:46

the logs but we mentioned before

play09:48

something called delegation chains so

play09:50

what is that a service account

play09:52

delegation chain means that sometimes we

play09:55

might need to have several

play09:57

impersonations going out because service

play10:00

account needs doesn't have the

play10:01

sufficient permissions to do something

play10:03

it needs another service account or you

play10:05

might want to move around some type of

play10:07

permissions so a user might impersonate

play10:10

service account a which needs to

play10:12

impersonate service account B to access

play10:14

our resources for this we'll need the

play10:16

get access token and again the service

play10:18

account token

play10:20

Creator now let's see how this looks and

play10:23

belongs when we're starting a delegation

play10:25

chain we will see the invoker or in this

play10:27

case our username

play10:30

doing a generate access token for the

play10:32

full list of service account we need to

play10:34

impersonate because each entity in this

play10:36

chain will now also need to generate an

play10:38

access token for the next one in the

play10:41

chain but when we see sorry yes but when

play10:46

we see the operations happening with the

play10:48

delegation chain what we'll actually see

play10:51

is oh sorry is the last service account

play10:54

in our delegation chain which we needed

play10:56

to actually access our resources but in

play11:00

the um identity delegation info we'll

play11:03

see the reverse order of who actually

play11:06

initiated this operation which is

play11:08

critical because if we see an operation

play11:10

an operation happen in an incident you

play11:12

could trace this back to the actual

play11:14

original

play11:15

invoker but sometimes because we

play11:18

mentioned each one needs to generate an

play11:19

access token we're not sure if this

play11:21

started as a specific invocation or a

play11:23

delegation chain well for this I have a

play11:26

tip you could look at the permission Cod

play11:30

when we see an event for generating a

play11:32

token if we have a single invocation our

play11:35

permission will be the get access token

play11:38

and our identity will only involve one

play11:41

service account but when we're starting

play11:43

a delegation our permission scope will

play11:45

involve implicit delegation and in our

play11:49

resources we will see the information uh

play11:52

sorry in our metad data we will see the

play11:53

information of all the identities we

play11:55

want to

play11:57

impersonate so so far we understood that

play11:59

service accounts have these operations

play12:02

impersonations and delegation chains now

play12:05

I'd like to talk about the curist case

play12:07

the Google uh compute engine default

play12:10

service account we mentioned that

play12:12

default service accounts are kind of

play12:13

like a hit start to our operations right

play12:16

so one of these is the Google compute

play12:18

engine service now Google allows us to

play12:22

attach our own custom service account to

play12:24

AVM if we want certain operations to

play12:27

happen and this will be the entity

play12:30

acting for this virtual machine kind of

play12:32

like managed identities if anyone knows

play12:35

how they are in Azure so what I'd expect

play12:38

the behavior to be is that we see an

play12:40

operation from this VM Happening by this

play12:42

attached uh service account what we

play12:45

noticed

play12:46

is that each operation even with an

play12:49

attached service account actually

play12:51

happens by a delegation from the default

play12:53

computer engine service account so

play12:55

seeing this is not like something

play12:56

unusual but it's just unusual as a

play12:58

behavior and something cool to

play13:01

notice so now let's talk about Service

play13:05

agents Service agents act on behalf of

play13:08

like certain type of services in Google

play13:11

they're usually attached to them like

play13:12

the Google Sync uh for logging operation

play13:15

these things are logged for transparency

play13:18

and their keys that we mentioned before

play13:20

like we use for Activation are

play13:21

completely managed by Google and

play13:23

therefore you cannot impersonate Service

play13:25

agents uh here are some example of

play13:27

Service agents but I'd highly recommend

play13:30

looking at Google's documentation for a

play13:32

full list let's see how Service agents

play13:35

look in our logs um here again we see

play13:38

our Google compute engine default

play13:40

service account which we remember and

play13:44

this was actually an operation invoked

play13:46

by our service agent as we see over here

play13:49

so this kind of sums up our service

play13:51

agents and service account section we

play13:54

learn about impersonation delegation

play13:56

chains word cases with the GCE and

play13:59

Service agents now let's talk about

play14:01

workload identities and Workforce

play14:03

identities workload identities provide

play14:06

external cloud cloud providers or SAS

play14:09

applications and identity to access our

play14:12

gcp resources why would we need the

play14:14

solution because we mentioned that

play14:17

sometimes we might want to uh get a

play14:19

service account through keys or log into

play14:21

our gcp environment and having keys

play14:23

around is a security risk and we also

play14:26

don't want the complexity of managing

play14:28

external entities so what solution do we

play14:30

have the solution here is that we have

play14:32

keyless authentication because we have

play14:35

an IDP trust to our gcp environment now

play14:38

let's see how this

play14:40

works our workload entity will then will

play14:44

first start by authenticating with its

play14:46

external IDP it will then get its

play14:49

credentials back from the IDP and send

play14:52

these credentials to the Google SDS

play14:54

service which is the security token

play14:56

service in Google which verifies the

play14:58

authentication with the IDP once this

play15:01

entity is is verified the SDS will

play15:05

return a gcp access token now we

play15:08

remember what we could do with these

play15:09

tokens we can

play15:12

impersonate a service account which

play15:14

gives us access to the gcp resource so

play15:17

this is how this works now let's see how

play15:19

we could identify these things in our

play15:21

logs let's talk about the SDS to token

play15:24

Exchange in our

play15:26

logs something really cool here is we

play15:29

have an external workload identity

play15:31

coming from AWS where we could see this

play15:33

the account ID the role it assumed and

play15:36

the session ID which means like for

play15:39

forensic investigations this is gold

play15:41

because we could trace something all the

play15:43

way back to a specific session ID in

play15:45

AWS um we will see here um Google giving

play15:50

us a mapped identity for this external

play15:53

entity this is how this identity will

play15:55

now be represented in our logs and the

play15:57

operation will be the token exchange for

play16:01

Google here's another example but why am

play16:04

i showing you first the mapped identity

play16:06

because what we see here is that when it

play16:09

comes from Azure we get the object ID

play16:12

which we could trace back to a to Azure

play16:14

if we had an incident starting from

play16:17

there so once we have our token we our

play16:20

STDs token we want to impersonate a

play16:22

service account so what we see here is

play16:25

that we're starting with our maap entity

play16:27

which we saw in the token Exchange

play16:28

change doing a generate access token for

play16:32

a resource which is the service account

play16:35

which we need to impersonate to access

play16:37

our

play16:38

logs this before what we saw sorry was

play16:42

an AWS which we know what we could trace

play16:44

back but now let's see what happened

play16:47

once we

play16:48

impersonated once we're impersonated or

play16:51

AWS we will see a service account

play16:53

operating cuz we already impersonated

play16:56

and our our principal subject in the in

play16:58

the

play16:59

in the service account delegation info

play17:01

will be our external entity now GitHub

play17:04

has something called GitHub actions

play17:06

which are for cicd operations which on

play17:09

uh which kind of like on P requests

play17:11

could allow us to like spawn VMS to try

play17:14

check our deployment so what we see here

play17:16

is a service account operating but our

play17:18

principal subject is actually a GitHub

play17:21

and we get it straight from the

play17:22

repository the path all the way up to

play17:24

the pr of what spawn or did actions in

play17:28

our G GP environment which is really

play17:30

cool cuz if someone had access to our GC

play17:32

to our GitHub we can actually trace this

play17:34

all the way back to

play17:36

gcp let's talk a little bit about work

play17:38

force identity Federation this is

play17:41

essentially kind of like the same

play17:43

solution but for users but without

play17:45

impersonation a user authenticates the

play17:47

IDP and then has direct access to our

play17:49

gcp environment the solution here is

play17:52

that also we don't have to sync users if

play17:54

anyone knows entra ID and on Prem you

play17:56

have to sync your users and you have to

play17:58

manage them we could manage them using

play18:00

Workforce identity

play18:02

pools this is how Google describes the

play18:04

operation fairly similar but no

play18:07

impersonation where we authenticate to

play18:09

the IDP get a token verified and access

play18:12

our gcp resources the way this will look

play18:14

in our logs is fairly similar the way

play18:17

our user authenticated to its IDP in

play18:19

this case a user a user add an

play18:23

email Short Pop Quiz let's see if anyone

play18:26

got anything so far few seconds let's

play18:28

see if anyone can understand what

play18:30

happened

play18:42

here so what happened here something I

play18:45

need I I I stumbled upon myself was that

play18:48

I saw a service account operating but I

play18:51

saw this uh principal subject that SVC

play18:54

ID goo which I didn't understand what it

play18:56

was this is actually

play18:59

the Google kubernetes engine default

play19:01

service account attached with an IM

play19:03

policy to a service account so this is a

play19:06

hint if we're investigating anything

play19:08

from Google kubernetes engine and we see

play19:10

the SBC goog we could even Trace things

play19:12

back to the name space and the

play19:14

kubernetes service account that we had

play19:16

inside our environment which is really

play19:18

cool for

play19:19

investigations now let's have a short

play19:21

brief about cases where Google redacts

play19:24

caller IPS or caller

play19:26

identities uh in big query sometimes we

play19:28

have cross project access with different

play19:30

domains so Google might redact this for

play19:32

privacy gdpr and all those fun reasons

play19:35

uh call or email in Virtual networks

play19:38

they might call it Google internal and

play19:40

if we have the MS without external IPS

play19:42

they might just call it like Google

play19:44

internal or remove it I highly recommend

play19:47

looking at Google's documentation for

play19:48

all the use cases we

play19:51

have so in order to summarize this up We

play19:55

Now understand the different types of

play19:57

identities how they look in our logs and

play19:59

how we could investig investigate these

play20:01

incidents I would like you tomorrow to

play20:03

check your gcp logs see if you could

play20:06

understand what happened there in a week

play20:08

from now if you have an incident can you

play20:10

tie it back and in a month write

play20:12

detections based on your uh environment

play20:15

impersonation patterns and what you know

play20:18

if there's one thing I could have you

play20:19

all take away from this is that once we

play20:21

understand the principles we could

play20:23

easily investigate and understand who

play20:25

touched our gcp project thank you very

play20:28

much that was gel

play20:38

freed were all the were all the logs

play20:40

that you showed in the default audit

play20:42

logs that are enabled by default or did

play20:43

you have to turn on data access dat yeah

play20:46

so some of them were from data access

play20:47

and someone for the from the audit LS

play20:51

that that that link oh this link is just

play20:54

my LinkedIn if anyone feel free yeah

play20:57

yeah uh one other question great talk by

play20:59

the way um one of the things we've

play21:01

noticed when we see ransomware in gcp is

play21:03

that um their mechanism for persistence

play21:06

is to create a service account but try

play21:07

to make it look like a service agent

play21:08

with nomenclature um do you have any

play21:10

tips on like identifying that inside the

play21:12

delegation chain or anything like that

play21:14

so A few things you could have is first

play21:16

of all Google has an immense list of all

play21:18

the service agents there are specific

play21:20

like uh resources which have designated

play21:23

Service agents another cool thing which

play21:25

I also noticed myself is that each

play21:27

listed service agent they might try to

play21:30

Def fake has a list of of specific uh

play21:33

roles it should have so if you see it

play21:36

acting something that it shouldn't be

play21:37

doing that's a really cool point because

play21:39

for some reason Google allows you to add

play21:41

additional roles but they're like don't

play21:44

do it you might break stuff but yeah so

play21:47

if you'd see it

play21:48

operating hi uh so I actually work at

play21:50

Google then that's it's a good talk I

play21:52

actually didn't know as much about uh Ro

play21:54

delegation and service account we

play21:55

because I re use mostly Borg but uh we I

play21:58

I have a service called access

play21:59

transparency which which I don't know if

play22:00

youve used which tells you when googlers

play22:02

access your data have you had experience

play22:04

with that and I thought I was getting

play22:05

your thoughts so I'm aware of the access

play22:07

transparency log which like Google kind

play22:09

of like allows you to see what they're

play22:10

doing but I haven't seen the logs myself

play22:13

to ingate cuz like what I know from Main

play22:16

detection and investigation people go to

play22:19

the cloud audit but that's something I

play22:21

definitely should look

play22:22

into thank Gabrielle cheers

play22:27

[Applause]

Rate This

5.0 / 5 (0 votes)

関連タグ
GCP SecurityAudit LogsIdentity ManagementCloud SecurityService AccountsImpersonationDelegation ChainsWorkload IdentityWorkforce IdentityThreat DetectionCybersecurity Research
英語で要約が必要ですか?