Attack Against Google Cloud Native App 0x3nt3
Attack Against Google Cloud Native App 0x3nt3
Attack Against Google Cloud Native App 0x3nt3
COM
Attack Against Google Cloud
Native App
In the rapidly evolving landscape of cloud computing, Google Cloud Platform (GCP)
stands out as a prominent player, offering a wide range of services that enable
businesses to build and deploy cloud-native applications. While these applications
benefit from the scalability, flexibility, and efficiency of cloud environments, they are not
immune to security threats. Understanding the nature of attacks and potential attack
vectors in cloud-native applications is crucial for maintaining robust security postures.
4. API Security Flaws: Insecure APIs can be exploited to gain access to backend
services and data.
IAM in GCP manages access control by defining who (identity) has what access
(role) to which resource.
Commands: Use gcloud iam roles list to list available roles, gcloud iam service-
3. Authentication Methods:
GCP supports various authentication methods like OAuth 2.0, service accounts,
and API keys.
Involves managing users, groups, organizational units, and services like Gmail,
Drive, etc.
Manage user access to various Workspace services and ensure proper access
controls and permissions.
Code Example: Using Google Workspace Admin SDK to list users in Python:
The primary objective is to simulate realistic cyber attacks to test and improve
an organization's defenses.
Red teams use these frameworks to plan and execute their operations,
ensuring a thorough and systematic approach.
GCP offers a wide range of services like Compute Engine, App Engine, Cloud
Storage, BigQuery, etc.
Commands & Code: Interacting with these services usually involves using the
gcloud command-line tool or client libraries in various programming languages.
list .
4. Networking in GCP:
Commands: Use gcloud compute networks list to list networks, gcloud compute
Red Teams often engage in penetration testing using tools like Metasploit,
Nmap, and custom scripts.
Example: Using Nmap for network scanning: nmap -sV -p 80,443 target_ip .
These reports are crucial for improving security posture and training the Blue
Team (defensive team).
2. Service Account
Misconfiguration: Overprivileged service accounts or exposed keys can be a
security risk.
3. Cloud Function
Misconfiguration: Insecure trigger configurations or exposed sensitive data in
environment variables.
4. Compute Instance
6. Cloud Storage
Misconfiguration: Publicly accessible storage buckets or improper access controls.
gsutil ls
7. Secret Manager
Misconfiguration: Exposed secrets or lack of access controls on secret
management.
Visibility
Purpose: Provides a view of all your assets across projects and services.
2. Policy Analyzer
Command: There isn't a direct gcloud command for Policy Analyzer, but it's
accessible via the Cloud Console.
Security Controls
1. Organization Policies
Purpose: Helps enforce broad security policies across your GCP resources.
Logging
1. Audit Logs - Google Cloud Platform
Monitoring
1. Security Command Centre
Command: There are no specific GCP commands for OSINT. Tools like
theHarvester , Shodan , or Google Dorks are commonly used.
DNS Enumeration
DNS records can reveal a lot of information about the services an organization uses.
Azure Endpoint:
curl https://login.microsoftonline.com/getuserrealm.srf?login=Username@atomic-nuclea
r.site&xml=1
Google Login:
curl https://accounts.google.com/
Resources: GCP Buckets, Firebase Realtime Databases, Google App Engine sites,
Cloud Functions, Firebase Apps.
2. Initial Access
Purpose: Gaining the first level of access to the GCP environment.
Purpose: This command uses a service account key file to authenticate to GCP,
allowing access to the resources that the service account has permissions for.
3. Authenticated Enumeration
Purpose: Enumerating resources and services after gaining access.
Command: List all GCP projects accessible with the current authentication.
Command: Get the IAM policy attached to a specific Compute Engine instance.
gsutil ls
4. Privilege Escalation
Purpose: Elevating access to gain higher privileges.
Command: Get the project-level IAM policy for a specific service account.
5. Persistence
Purpose: Maintaining access within the environment.
apiVersion: apps/v1
kind: StatefulSet
metadata:
name: [STATEFULSET_NAME]
spec:
serviceName: "[SERVICE_NAME]"
replicas: [REPLICAS_COUNT]
template:
gsutil mb gs://[BUCKET_NAME]
6. Credential Access
Purpose: Accessing or obtaining credentials.
Command: Set a new access token retrieved from the VM's default service
account.
Command: Invoke the newly created Cloud Function and retrieve a short-term
access token from it.
Command: Set a new access token retrieved from the Cloud Function's high-
privilege service account.
Command: Retrieve the project-level IAM policy for the high-privilege service
account.
7. Lateral Movement
Purpose: Moving across the network and accessing different systems.
2. Getting Project Level IAM Policy for the New Service Account
Command: Retrieve the IAM policy for a specific service account in a project.
4. Getting Project Level IAM Policy for the Service Account in a Second Project
Command: Retrieve the IAM policy for the same service account in another
project.
Command: Get the IAM policy attached to a specific service account in the
second project.
8. Data Exfiltration
Purpose: Extracting sensitive data from the target environment.
Command: To copy data from a GCP storage bucket (use with authorization):
gsutil cp gs://[BUCKET_NAME]/[FILE_NAME] .
gsutil ls gs://prod-storage-metatech
Command: Export data from a Cloud SQL instance to a Cloud Storage bucket.
Moreover, the shared responsibility model in cloud computing dictates that while cloud
providers like Google ensure the security of the cloud infrastructure, customers are
responsible for securing their data and applications on the cloud. This includes
implementing proper access controls, encrypting sensitive data, and regularly updating
and patching software.