Skip to content

Commit d5e9892

Browse files
authored
Merge pull request #155 from mosesrenegade/main
Added sections for GCP
2 parents f9ac0c7 + 8bfd73a commit d5e9892

File tree

3 files changed

+87
-0
lines changed

3 files changed

+87
-0
lines changed

content/gcp/gcp-buckets.md

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
---
2+
author: Moses Frost (@mosesrenegade)
3+
title: Hunting GCP Buckets
4+
description: How to find valid and invalid GCP Buckets using tools
5+
---
6+
7+
GCP Buckets are almost 100% identical to AWS S3 Buckets.
8+
9+
*Theory*: This call is based on OpenStack; maybe most cloud environments will be the same.
10+
11+
Using @digininja's [CloudStorageFinder](https://github.com/digininja/CloudStorageFinder) diff the following files:
12+
13+
`diff bucket_finder.rb google_finder.rb`
14+
15+
The main differences are the URLs:
16+
17+
- AWS Supports HTTP and HTTPS
18+
- `AWS S3` URLs: `http://s3-region.amazonaws.com`, i.e.: `http://s3-eu-west-1.amazonaws.com`.
19+
- GCP Endpoint: `https://storage.googleapis.com`
20+
21+
How to find buckets using CloudStorageFinder:
22+
23+
Create a wordlist with any name; in our example, it is `wordlist.txt`.
24+
25+
$ `ruby google_finder.rb wordlist.txt`
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
---
2+
author: Moses Frost (@mosesrenegade)
3+
title: Default Account Information
4+
description: Default information on how accounts and service accounts exist in GCP
5+
---
6+
7+
# Service Accounts
8+
9+
[Service accounts](https://cloud.google.com/iam/docs/service-accounts) are similar to Azure [Service Principals](https://docs.microsoft.com/en-us/azure/active-directory/develop/app-objects-and-service-principals). They can allow for programmatic access but also abuse.
10+
11+
[Information on Service Accounts](https://cloud.google.com/iam/docs/creating-managing-service-account-keys)
12+
13+
User-Created Service Account: `[email protected]`
14+
15+
Using the format above, you can denote the following items:
16+
17+
- `service-account-name`: This will tell you potentially what services this is for: `Bigtable-sa` or `compute-sa`
18+
- `project-id`: This will be the project identifier that the service account is for. You can set your `gcloud` configuration to this `project-id`. It will be numerical typically.
19+
20+
## Default Service Account filename permutations:
21+
22+
* `serviceaccount.json`
23+
* `service_account.json`
24+
* `sa-private-key.json`
25+
* `service-account-file.json`
26+
27+
## Application-Based Service Account:
28+
29+
- `[email protected]`: Ths would be `project-id` value for App Engine or anything leveraging App Engine.
30+
- `[email protected]`: This service account is for Compute Engine where the `project-number-compute` will be: `project-id`-`compute`. I.E. `1234567-compute`.
31+
32+
## How to use Service Accounts
33+
34+
In a BASH (or equivalent) shell: `export GOOGLE_APPLICATION_CREDENTIALS="/home/user/Downloads/service-account-file.json"`
35+
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
---
2+
author: Moses Frost (@mosesrenegade)
3+
title: Security and Constraints
4+
description: Security considerations and constraints that are unique to GCP
5+
---
6+
7+
8+
GCP Resources are typically placed into Projects. Projects are a mix of resource groups in Azure and Accounts in AWS. Projects can be either non-hierarchical or completely hierarchical. An operator can place security constraints on these projects to provide a baseline security policy. There are also Organization-wide policy constraints that apply to every project.
9+
10+
# Examples
11+
12+
From: [Organizational Policy Constraints](https://cloud.google.com/resource-manager/docs/organization-policy/org-policy-constraints)
13+
14+
* constraints/iam.disableServiceAccountCreation : This can disable the overall creation of service accounts. Equivalent to Service Principals in Azure.
15+
* constraints/iam.disableServiceAccountKeyCreation : This constraint will disable the ability to create a service account key. This constraint would be helpful if you want service accounts but only want to use RSA-based authentication.
16+
17+
There are specific policies that are *not* retroactive. We can use these to our *advantage*.
18+
19+
1. `constraints/compute.requireShieldedVm`: If a compute node is already created and exists without this constraint applied, then this constraint will not be retroactive. You *must* delete the object and re-create it for it to enforce shielded VMs.
20+
2. `constraints/compute.vmExternalIpAccess`: Consider the following scenario:
21+
22+
- Constraint is based on the following permutation: `projects/PROJECT_ID/zones/ZONE/instances/INSTANCE`
23+
- Constraint looks for the `name` of the machine in the `project` identifier specified in the specific `zone`
24+
- If you can boot a VM with this specific set of criteria, then you can have a machine with an External IP Address
25+
- Machine cannot already exist.
26+
3. `constraints/compute.vmCanIpForward`: Another Non Retroactive Setting. The machine must not exist before this setting is created. Once this is set, then machines will enforce this condition.
27+

0 commit comments

Comments
 (0)