mirror of
https://github.com/HackTricks-wiki/hacktricks-cloud.git
synced 2026-01-17 15:21:52 -08:00
Translated ['.github/pull_request_template.md', 'src/pentesting-cloud/az
This commit is contained in:
@@ -4,9 +4,9 @@
|
||||
|
||||
## Basic Information
|
||||
|
||||
**Before start pentesting** a **GCP** environment, there are a few **basics things you need to know** about how it works to help you understand what you need to do, how to find misconfigurations and how to exploit them.
|
||||
**GCP** वातावरण का **pentesting** शुरू करने से पहले, कुछ **बुनियादी बातें हैं जो आपको जाननी चाहिए** कि यह कैसे काम करता है, ताकि आप समझ सकें कि आपको क्या करना है, कैसे गलत कॉन्फ़िगरेशन खोजें और उन्हें कैसे भुनाएं।
|
||||
|
||||
Concepts such as **organization** hierarchy, **permissions** and other basic concepts are explained in:
|
||||
**संगठन** पदानुक्रम, **अनुमतियाँ** और अन्य बुनियादी अवधारणाएँ इस में समझाई गई हैं:
|
||||
|
||||
{{#ref}}
|
||||
gcp-basic-information/
|
||||
@@ -21,41 +21,41 @@ gcp-basic-information/
|
||||
|
||||
## GCP Pentester/Red Team Methodology
|
||||
|
||||
In order to audit a GCP environment it's very important to know: which **services are being used**, what is **being exposed**, who has **access** to what, and how are internal GCP services an **external services** connected.
|
||||
GCP वातावरण का ऑडिट करने के लिए यह जानना बहुत महत्वपूर्ण है: कौन सी **सेवाएँ उपयोग की जा रही हैं**, क्या **प्रकट किया जा रहा है**, किसके पास **पहुँच** है, और आंतरिक GCP सेवाएँ और **बाहरी सेवाएँ** कैसे जुड़ी हुई हैं।
|
||||
|
||||
From a Red Team point of view, the **first step to compromise a GCP environment** is to manage to obtain some **credentials**. Here you have some ideas on how to do that:
|
||||
Red Team के दृष्टिकोण से, **GCP वातावरण को समझौता करने का पहला कदम** कुछ **क्रेडेंशियल्स** प्राप्त करना है। यहाँ कुछ विचार दिए गए हैं कि आप ऐसा कैसे कर सकते हैं:
|
||||
|
||||
- **Leaks** in github (or similar) - OSINT
|
||||
- **Social** Engineering (Check the page [**Workspace Security**](../workspace-security/))
|
||||
- **Password** reuse (password leaks)
|
||||
- Vulnerabilities in GCP-Hosted Applications
|
||||
- [**Server Side Request Forgery**](https://book.hacktricks.xyz/pentesting-web/ssrf-server-side-request-forgery/cloud-ssrf) with access to metadata endpoint
|
||||
- **Local File Read**
|
||||
- `/home/USERNAME/.config/gcloud/*`
|
||||
- `C:\Users\USERNAME\.config\gcloud\*`
|
||||
- 3rd parties **breached**
|
||||
- **Internal** Employee
|
||||
- github (या समान) में **लीक** - OSINT
|
||||
- **सामाजिक** इंजीनियरिंग (पृष्ठ [**Workspace Security**](../workspace-security/) देखें)
|
||||
- **पासवर्ड** पुन: उपयोग (पासवर्ड लीक)
|
||||
- GCP-Hosted Applications में कमजोरियाँ
|
||||
- [**Server Side Request Forgery**](https://book.hacktricks.xyz/pentesting-web/ssrf-server-side-request-forgery/cloud-ssrf) जिसमें मेटाडेटा एंडपॉइंट तक पहुँच है
|
||||
- **स्थानीय फ़ाइल पढ़ें**
|
||||
- `/home/USERNAME/.config/gcloud/*`
|
||||
- `C:\Users\USERNAME\.config\gcloud\*`
|
||||
- 3rd पार्टियों के **भंग**
|
||||
- **आंतरिक** कर्मचारी
|
||||
|
||||
Or by **compromising an unauthenticated service** exposed:
|
||||
या **अप्रमाणित सेवा** को समझौता करके जो प्रकट है:
|
||||
|
||||
{{#ref}}
|
||||
gcp-unauthenticated-enum-and-access/
|
||||
{{#endref}}
|
||||
|
||||
Or if you are doing a **review** you could just **ask for credentials** with these roles:
|
||||
या यदि आप एक **समीक्षा** कर रहे हैं तो आप बस इन भूमिकाओं के साथ **क्रेडेंशियल्स** मांग सकते हैं:
|
||||
|
||||
{{#ref}}
|
||||
gcp-permissions-for-a-pentest.md
|
||||
{{#endref}}
|
||||
|
||||
> [!NOTE]
|
||||
> After you have managed to obtain credentials, you need to know **to who do those creds belong**, and **what they have access to**, so you need to perform some basic enumeration:
|
||||
> एक बार जब आप क्रेडेंशियल्स प्राप्त करने में सफल हो जाते हैं, तो आपको यह जानने की आवश्यकता है कि **ये क्रेडेंशियल्स किसके हैं**, और **इनके पास क्या पहुँच है**, इसलिए आपको कुछ बुनियादी गणना करनी होगी:
|
||||
|
||||
## Basic Enumeration
|
||||
|
||||
### **SSRF**
|
||||
|
||||
For more information about how to **enumerate GCP metadata** check the following hacktricks page:
|
||||
GCP मेटाडेटा को **गणना** करने के बारे में अधिक जानकारी के लिए निम्नलिखित हैक्ट्रिक्स पृष्ठ देखें:
|
||||
|
||||
{{#ref}}
|
||||
https://book.hacktricks.xyz/pentesting-web/ssrf-server-side-request-forgery/cloud-ssrf#6440
|
||||
@@ -63,8 +63,7 @@ https://book.hacktricks.xyz/pentesting-web/ssrf-server-side-request-forgery/clou
|
||||
|
||||
### Whoami
|
||||
|
||||
In GCP you can try several options to try to guess who you are:
|
||||
|
||||
GCP में आप यह अनुमान लगाने के लिए कई विकल्प आजमा सकते हैं कि आप कौन हैं:
|
||||
```bash
|
||||
#If you are inside a compromise machine
|
||||
gcloud auth list
|
||||
@@ -74,50 +73,45 @@ gcloud auth print-identity-token #Get info from the token
|
||||
#If you compromised a metadata token or somehow found an OAuth token
|
||||
curl -H "Content-Type: application/x-www-form-urlencoded" -d "access_token=<token>" https://www.googleapis.com/oauth2/v1/tokeninfo
|
||||
```
|
||||
|
||||
You can also use the API endpoint `/userinfo` to get more info about the user:
|
||||
|
||||
आप `/userinfo` API एंडपॉइंट का उपयोग करके उपयोगकर्ता के बारे में अधिक जानकारी प्राप्त कर सकते हैं:
|
||||
```bash
|
||||
curl -H "Content-Type: application/x-www-form-urlencoded" -H "Authorization: OAuth $(gcloud auth print-access-token)" https://www.googleapis.com/oauth2/v1/userinfo
|
||||
|
||||
curl -H "Content-Type: application/x-www-form-urlencoded" -H "Authorization: OAuth <access_token>" https://www.googleapis.com/oauth2/v1/userinfo
|
||||
```
|
||||
|
||||
### Org Enumeration
|
||||
|
||||
### संगठन गणना
|
||||
```bash
|
||||
# Get organizations
|
||||
gcloud organizations list #The DIRECTORY_CUSTOMER_ID is the Workspace ID
|
||||
gcloud resource-manager folders list --organization <org_number> # Get folders
|
||||
gcloud projects list # Get projects
|
||||
```
|
||||
|
||||
### Principals & IAM Enumeration
|
||||
|
||||
If you have enough permissions, **checking the privileges of each entity inside the GCP account** will help you understand what you and other identities can do and how to **escalate privileges**.
|
||||
यदि आपके पास पर्याप्त अनुमतियाँ हैं, तो **GCP खाते के अंदर प्रत्येक इकाई के विशेषाधिकारों की जांच करना** आपको यह समझने में मदद करेगा कि आप और अन्य पहचान क्या कर सकते हैं और कैसे **विशेषाधिकार बढ़ा सकते हैं**।
|
||||
|
||||
If you don't have enough permissions to enumerate IAM, you can **steal brute-force them** to figure them out.\
|
||||
Check **how to do the numeration and brute-forcing** in:
|
||||
यदि आपके पास IAM को सूचीबद्ध करने के लिए पर्याप्त अनुमतियाँ नहीं हैं, तो आप **उन्हें ब्रूट-फोर्स करके चुरा सकते हैं**।\
|
||||
जांचें **संख्यांकन और ब्रूट-फोर्सिंग कैसे करें**:
|
||||
|
||||
{{#ref}}
|
||||
gcp-services/gcp-iam-and-org-policies-enum.md
|
||||
{{#endref}}
|
||||
|
||||
> [!NOTE]
|
||||
> Now that you **have some information about your credentials** (and if you are a red team hopefully you **haven't been detected**). It's time to figure out which services are being used in the environment.\
|
||||
> In the following section you can check some ways to **enumerate some common services.**
|
||||
> अब जब आपके पास **आपकी क्रेडेंशियल्स के बारे में कुछ जानकारी है** (और यदि आप एक रेड टीम हैं, तो उम्मीद है कि आप **पकड़े नहीं गए** हैं)। यह पता लगाने का समय है कि वातावरण में कौन सी सेवाएँ उपयोग की जा रही हैं।\
|
||||
> निम्नलिखित अनुभाग में आप **कुछ सामान्य सेवाओं को सूचीबद्ध करने के तरीके** देख सकते हैं।
|
||||
|
||||
## Services Enumeration
|
||||
|
||||
GCP has an astonishing amount of services, in the following page you will find **basic information, enumeration** cheatsheets, how to **avoid detection**, obtain **persistence**, and other **post-exploitation** tricks about some of them:
|
||||
GCP में सेवाओं की एक आश्चर्यजनक मात्रा है, निम्नलिखित पृष्ठ पर आप **बुनियादी जानकारी, सूचीकरण** चीटशीट, **पकड़े जाने से बचने** के तरीके, **स्थायीता** प्राप्त करने और उनमें से कुछ के बारे में अन्य **पोस्ट-एक्सप्लॉइटेशन** ट्रिक्स पाएंगे:
|
||||
|
||||
{{#ref}}
|
||||
gcp-services/
|
||||
{{#endref}}
|
||||
|
||||
Note that you **don't** need to perform all the work **manually**, below in this post you can find a **section about** [**automatic tools**](./#automatic-tools).
|
||||
ध्यान दें कि आपको सभी कार्य **हाथ से** करने की आवश्यकता **नहीं** है, इस पोस्ट के नीचे आप [**स्वचालित उपकरणों**](./#automatic-tools) के बारे में एक **अनुभाग** पा सकते हैं।
|
||||
|
||||
Moreover, in this stage you might discovered **more services exposed to unauthenticated users,** you might be able to exploit them:
|
||||
इसके अलावा, इस चरण में आप **असत्यापित उपयोगकर्ताओं के लिए अधिक सेवाएँ उजागर** कर सकते हैं, आप उन्हें शोषण करने में सक्षम हो सकते हैं:
|
||||
|
||||
{{#ref}}
|
||||
gcp-unauthenticated-enum-and-access/
|
||||
@@ -125,9 +119,9 @@ gcp-unauthenticated-enum-and-access/
|
||||
|
||||
## Privilege Escalation, Post Exploitation & Persistence
|
||||
|
||||
The most common way once you have obtained some cloud credentials or have compromised some service running inside a cloud is to **abuse misconfigured privileges** the compromised account may have. So, the first thing you should do is to enumerate your privileges.
|
||||
जब आपने कुछ क्लाउड क्रेडेंशियल्स प्राप्त कर लिए हैं या क्लाउड के अंदर चल रही कुछ सेवा को समझौता कर लिया है, तो सबसे सामान्य तरीका है **गलत कॉन्फ़िगर की गई अनुमतियों का दुरुपयोग** करना जो समझौता किए गए खाते के पास हो सकता है। इसलिए, आपको सबसे पहले अपने विशेषाधिकारों को सूचीबद्ध करना चाहिए।
|
||||
|
||||
Moreover, during this enumeration, remember that **permissions can be set at the highest level of "Organization"** as well.
|
||||
इसके अलावा, इस सूचीकरण के दौरान, याद रखें कि **अनुमतियाँ "संगठन" के उच्चतम स्तर पर सेट की जा सकती हैं**।
|
||||
|
||||
{{#ref}}
|
||||
gcp-privilege-escalation/
|
||||
@@ -143,10 +137,10 @@ gcp-persistence/
|
||||
|
||||
### Publicly Exposed Services
|
||||
|
||||
While enumerating GCP services you might have found some of them **exposing elements to the Internet** (VM/Containers ports, databases or queue services, snapshots or buckets...).\
|
||||
As pentester/red teamer you should always check if you can find **sensitive information / vulnerabilities** on them as they might provide you **further access into the AWS account**.
|
||||
जब आप GCP सेवाओं को सूचीबद्ध कर रहे होंगे, तो आप उनमें से कुछ को **इंटरनेट पर तत्वों को उजागर करते हुए** पा सकते हैं (VM/कंटेनर पोर्ट, डेटाबेस या कतार सेवाएँ, स्नैपशॉट या बाल्टियाँ...)।\
|
||||
एक पेंटेस्टर/रेड टीमर के रूप में, आपको हमेशा यह जांचना चाहिए कि क्या आप उन पर **संवेदनशील जानकारी / कमजोरियों** को खोज सकते हैं क्योंकि वे आपको **AWS खाते में आगे की पहुँच** प्रदान कर सकते हैं।
|
||||
|
||||
In this book you should find **information** about how to find **exposed GCP services and how to check them**. About how to find **vulnerabilities in exposed network services** I would recommend you to **search** for the specific **service** in:
|
||||
इस पुस्तक में आपको **जानकारी** मिलेगी कि **कैसे उजागर GCP सेवाओं को खोजें और उन्हें कैसे जांचें**। उजागर नेटवर्क सेवाओं में **कमजोरियों** को खोजने के लिए, मैं आपको **विशिष्ट सेवा** के लिए **खोजने** की सिफारिश करूंगा:
|
||||
|
||||
{{#ref}}
|
||||
https://book.hacktricks.xyz/
|
||||
@@ -154,7 +148,7 @@ https://book.hacktricks.xyz/
|
||||
|
||||
## GCP <--> Workspace Pivoting
|
||||
|
||||
**Compromising** principals in **one** platform might allow an attacker to **compromise the other one**, check it in:
|
||||
**एक** प्लेटफ़ॉर्म में प्रिंसिपल को **समझौता करना** एक हमलावर को **दूसरे को समझौता करने** की अनुमति दे सकता है, इसे जांचें:
|
||||
|
||||
{{#ref}}
|
||||
gcp-to-workspace-pivoting/
|
||||
@@ -162,11 +156,10 @@ gcp-to-workspace-pivoting/
|
||||
|
||||
## Automatic Tools
|
||||
|
||||
- In the **GCloud console**, in [https://console.cloud.google.com/iam-admin/asset-inventory/dashboard](https://console.cloud.google.com/iam-admin/asset-inventory/dashboard) you can see resources and IAMs being used by project.
|
||||
- Here you can see the assets supported by this API: [https://cloud.google.com/asset-inventory/docs/supported-asset-types](https://cloud.google.com/asset-inventory/docs/supported-asset-types)
|
||||
- Check **tools** that can be [**used in several clouds here**](../pentesting-cloud-methodology.md).
|
||||
- [**gcp_scanner**](https://github.com/google/gcp_scanner): This is a GCP resource scanner that can help determine what **level of access certain credentials posses** on GCP.
|
||||
|
||||
- **GCloud कंसोल** में, [https://console.cloud.google.com/iam-admin/asset-inventory/dashboard](https://console.cloud.google.com/iam-admin/asset-inventory/dashboard) पर आप प्रोजेक्ट द्वारा उपयोग की जा रही संसाधनों और IAMs को देख सकते हैं।
|
||||
- यहाँ आप इस API द्वारा समर्थित संपत्तियों को देख सकते हैं: [https://cloud.google.com/asset-inventory/docs/supported-asset-types](https://cloud.google.com/asset-inventory/docs/supported-asset-types)
|
||||
- जांचें **उपकरण** जो [**कई क्लाउड में उपयोग किए जा सकते हैं**](../pentesting-cloud-methodology.md)।
|
||||
- [**gcp_scanner**](https://github.com/google/gcp_scanner): यह एक GCP संसाधन स्कैनर है जो यह निर्धारित करने में मदद कर सकता है कि **कुछ क्रेडेंशियल्स पर GCP पर किस स्तर की पहुँच है**।
|
||||
```bash
|
||||
# Install
|
||||
git clone https://github.com/google/gcp_scanner.git
|
||||
@@ -177,13 +170,11 @@ pip install -r requirements.txt
|
||||
# Execute with gcloud creds
|
||||
python3 __main__.py -o /tmp/output/ -g "$HOME/.config/gcloud"
|
||||
```
|
||||
|
||||
- [**gcp_enum**](https://gitlab.com/gitlab-com/gl-security/threatmanagement/redteam/redteam-public/gcp_enum): Bash script to enumerate a GCP environment using gcloud cli and saving the results in a file.
|
||||
- [**GCP-IAM-Privilege-Escalation**](https://github.com/RhinoSecurityLabs/GCP-IAM-Privilege-Escalation): Scripts to enumerate high IAM privileges and to escalate privileges in GCP abusing them (I couldn’t make run the enumerate script).
|
||||
- [**BF My GCP Permissions**](https://github.com/carlospolop/bf_my_gcp_permissions): Script to bruteforce your permissions.
|
||||
- [**gcp_enum**](https://gitlab.com/gitlab-com/gl-security/threatmanagement/redteam/redteam-public/gcp_enum): Bash स्क्रिप्ट जो gcloud cli का उपयोग करके GCP वातावरण को एन्यूमरेट करती है और परिणामों को एक फ़ाइल में सहेजती है।
|
||||
- [**GCP-IAM-Privilege-Escalation**](https://github.com/RhinoSecurityLabs/GCP-IAM-Privilege-Escalation): उच्च IAM विशेषाधिकारों को एन्यूमरेट करने और GCP में उनका दुरुपयोग करके विशेषाधिकारों को बढ़ाने के लिए स्क्रिप्ट (मैं एन्यूमरेट स्क्रिप्ट को चलाने में असमर्थ था)।
|
||||
- [**BF My GCP Permissions**](https://github.com/carlospolop/bf_my_gcp_permissions): आपकी अनुमतियों को ब्रूटफोर्स करने के लिए स्क्रिप्ट।
|
||||
|
||||
## gcloud config & debug
|
||||
|
||||
```bash
|
||||
# Login so gcloud can use your credentials
|
||||
gcloud auth login
|
||||
@@ -198,13 +189,11 @@ gcloud auth application-default print-access-token
|
||||
# Update gcloud
|
||||
gcloud components update
|
||||
```
|
||||
|
||||
### Capture gcloud, gsutil... network
|
||||
|
||||
Remember that you can use the **parameter** **`--log-http`** with the **`gcloud`** cli to **print** the **requests** the tool is performing. If you don't want the logs to redact the token value use `gcloud config set log_http_redact_token false`
|
||||
|
||||
Moreover, to intercept the communication:
|
||||
याद रखें कि आप **`gcloud`** cli के साथ **`--log-http`** **पैरामीटर** का उपयोग कर सकते हैं ताकि **उपकरण** द्वारा किए जा रहे **अनुरोधों** को **प्रिंट** किया जा सके। यदि आप नहीं चाहते कि लॉग टोकन मान को छुपाएं, तो `gcloud config set log_http_redact_token false` का उपयोग करें।
|
||||
|
||||
इसके अलावा, संचार को इंटरसेप्ट करने के लिए:
|
||||
```bash
|
||||
gcloud config set proxy/address 127.0.0.1
|
||||
gcloud config set proxy/port 8080
|
||||
@@ -221,11 +210,9 @@ gcloud config unset proxy/type
|
||||
gcloud config unset auth/disable_ssl_validation
|
||||
gcloud config unset core/custom_ca_certs_file
|
||||
```
|
||||
### OAuth टोकन gcloud में कॉन्फ़िगर करें
|
||||
|
||||
### OAuth token configure in gcloud
|
||||
|
||||
In order to **use an exfiltrated service account OAuth token from the metadata endpoint** you can just do:
|
||||
|
||||
**मेटाडेटा एंडपॉइंट से निकाले गए सेवा खाते के OAuth टोकन का उपयोग करने के लिए** आप बस कर सकते हैं:
|
||||
```bash
|
||||
# Via env vars
|
||||
export CLOUDSDK_AUTH_ACCESS_TOKEN=<token>
|
||||
@@ -237,13 +224,8 @@ gcloud config set auth/access_token_file /some/path/to/token
|
||||
gcloud projects list
|
||||
gcloud config unset auth/access_token_file
|
||||
```
|
||||
|
||||
## References
|
||||
## संदर्भ
|
||||
|
||||
- [https://about.gitlab.com/blog/2020/02/12/plundering-gcp-escalating-privileges-in-google-cloud-platform/](https://about.gitlab.com/blog/2020/02/12/plundering-gcp-escalating-privileges-in-google-cloud-platform/)
|
||||
|
||||
{{#include ../../banners/hacktricks-training.md}}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user