From b187034c4ade55eea9b41edcc6ea242dd8eb5c35 Mon Sep 17 00:00:00 2001 From: Translator Date: Sat, 15 Nov 2025 11:49:00 +0000 Subject: [PATCH] Translated ['', 'src/pentesting-cloud/gcp-security/gcp-privilege-escalat --- .../gcp-misc-perms-privesc.md | 30 ++++++++++++++----- .../gcp-orgpolicy-privesc.md | 27 +++++++++++++++-- 2 files changed, 48 insertions(+), 9 deletions(-) diff --git a/src/pentesting-cloud/gcp-security/gcp-privilege-escalation/gcp-misc-perms-privesc.md b/src/pentesting-cloud/gcp-security/gcp-privilege-escalation/gcp-misc-perms-privesc.md index 838dafc00..3dabbf195 100644 --- a/src/pentesting-cloud/gcp-security/gcp-privilege-escalation/gcp-misc-perms-privesc.md +++ b/src/pentesting-cloud/gcp-security/gcp-privilege-escalation/gcp-misc-perms-privesc.md @@ -1,4 +1,4 @@ -# GCP - Generic Permissions Privesc +# GCP - सामान्य दिलचस्प अनुमतियाँ Privesc {{#include ../../../banners/hacktricks-training.md}} @@ -6,20 +6,36 @@ ### \*.setIamPolicy -यदि आपके पास एक उपयोगकर्ता है जिसके पास किसी संसाधन में **`setIamPolicy`** अनुमति है, तो आप उस संसाधन में **अधिकार बढ़ा सकते हैं** क्योंकि आप उस संसाधन की IAM नीति को बदलने में सक्षम होंगे और आपको उस पर अधिक अधिकार मिलेंगे।\ -यह अनुमति **अन्य प्रिंसिपल्स के लिए अधिकार बढ़ाने** की भी अनुमति दे सकती है यदि संसाधन कोड निष्पादित करने की अनुमति देता है और iam.ServiceAccounts.actAs आवश्यक नहीं है। +If you owns a user that has the **`setIamPolicy`** permission in a resource you can **escalate privileges in that resource** because you will be able to change the IAM policy of that resource and give you more privileges over it.\ +यदि आपके पास ऐसा user है जिसे किसी resource में **`setIamPolicy`** permission है, तो आप उस resource में अपने privileges को बढ़ा सकते हैं क्योंकि आप उस resource की IAM policy बदलकर अपने लिए अधिक अधिकार दे सकते हैं.\ +This permission can also allow to **escalate to other principals** if the resource allow to execute code and the `iam.ServiceAccounts.actAs` is not necessary.\ +यदि वह resource कोड चलाने की अनुमति देता है और `iam.ServiceAccounts.actAs` आवश्यक नहीं है, तो यह permission आपको **अन्य principals पर escalate** करने की भी अनुमति दे सकती है. - _cloudfunctions.functions.setIamPolicy_ -- एक क्लाउड फ़ंक्शन की नीति को संशोधित करें ताकि आप इसे कॉल कर सकें। +- Modify the policy of a Cloud Function to allow yourself to invoke it.\ + Cloud Function की policy modify करके खुद को उसे invoke करने की अनुमति दें. -इस प्रकार की अनुमति वाले कई संसाधन प्रकार हैं, आप सभी को [https://cloud.google.com/iam/docs/permissions-reference](https://cloud.google.com/iam/docs/permissions-reference) पर setIamPolicy के लिए खोजकर पा सकते हैं। +There are tens of resources types with this kind of permission, you can find all of them in [https://cloud.google.com/iam/docs/permissions-reference](https://cloud.google.com/iam/docs/permissions-reference) searching for setIamPolicy.\ +ऐसे permission वाले कई resource types हैं; आप [https://cloud.google.com/iam/docs/permissions-reference](https://cloud.google.com/iam/docs/permissions-reference) में setIamPolicy खोजकर सब उन्हें पा सकते हैं. ### \*.create, \*.update -ये अनुमतियाँ संसाधनों में अधिकार बढ़ाने के लिए **एक नया बनाने या एक नए को अपडेट करने** के लिए बहुत उपयोगी हो सकती हैं। ये अनुमतियाँ विशेष रूप से उपयोगी होती हैं यदि आपके पास एक सेवा खाते पर **iam.serviceAccounts.actAs** अनुमति भी है और जिस संसाधन पर आपके पास .create/.update है वह एक सेवा खाते को संलग्न कर सकता है। +These permissions can be very useful to try to escalate privileges in resources by **creating a new one or updating a new one**. These can of permissions are specially useful if you also has the permission **iam.serviceAccounts.actAs** over a Service Account and the resource you have .create/.update over can attach a service account.\ +ये permissions resource में privileges escalate करने के लिए उपयोगी हो सकते हैं, खासकर जब आप कोई नया resource **create** करें या किसी existing को **update** करें। ये permissions विशेष रूप से तब फायदेमंद होते हैं जब आपके पास किसी Service Account पर **iam.serviceAccounts.actAs** permission भी है और जिस resource पर आपकी .create/.update अनुमति है वह Service Account attach कर सकता है। ### \*ServiceAccount\* -यह अनुमति आमतौर पर आपको **किसी संसाधन में एक सेवा खाते तक पहुँचने या उसे संशोधित करने** की अनुमति देती है (जैसे: compute.instances.setServiceAccount)। यह **एक अधिकार वृद्धि** वेक्टर की ओर ले जा सकता है, लेकिन यह प्रत्येक मामले पर निर्भर करेगा। +This permission will usually let you **access or modify a Service Account in some resource** (e.g.: compute.instances.setServiceAccount). This **could lead to a privilege escalation** vector, but it will depend on each case.\ +यह permission आमतौर पर आपको किसी resource में एक Service Account तक पहुँचने या उसे बदलने की अनुमति देता है (उदा.: compute.instances.setServiceAccount). यह **privilege escalation** का एक vector बन सकता है, पर यह हर मामले पर निर्भर करेगा। + +### iam.ServiceAccounts.actAs + +This permission will let you attach a Service Account to a resource that supports it (e.g.: Compute Engine VM, Cloud Function, Cloud Run, etc).\ +यह permission आपको उस resource पर एक Service Account attach करने की अनुमति देता है जो इसे सपोर्ट करता है (उदा.: Compute Engine VM, Cloud Function, Cloud Run, आदि).\ +If you can attach a Service Account that has more privileges than your user to a resource that can execute code, you will be able to escalate your privileges by executing code with that Service Account.\ +यदि आप किसी ऐसे Service Account को attach कर सकें जिसके पास आपके user से अधिक privileges हों और वह resource कोड चला सकता हो, तो आप उस Service Account के साथ कोड चलाकर अपने privileges escalate कर सकेंगे. + +Search in Cloud Hacktricks for `iam.ServiceAccounts.actAs` to find several examples of how to escalate privileges with this permission.\ +Cloud Hacktricks में `iam.ServiceAccounts.actAs` खोजें ताकि इस permission के साथ privileges escalate करने के कई उदाहरण मिलें. {{#include ../../../banners/hacktricks-training.md}} diff --git a/src/pentesting-cloud/gcp-security/gcp-privilege-escalation/gcp-orgpolicy-privesc.md b/src/pentesting-cloud/gcp-security/gcp-privilege-escalation/gcp-orgpolicy-privesc.md index b9c30ba8c..94316a166 100644 --- a/src/pentesting-cloud/gcp-security/gcp-privilege-escalation/gcp-orgpolicy-privesc.md +++ b/src/pentesting-cloud/gcp-security/gcp-privilege-escalation/gcp-orgpolicy-privesc.md @@ -6,7 +6,7 @@ ### `orgpolicy.policy.set` -एक हमलावर जो **orgpolicy.policy.set** का उपयोग करता है, संगठनात्मक नीतियों में हेरफेर कर सकता है, जिससे उसे कुछ प्रतिबंधों को हटाने की अनुमति मिलती है जो विशिष्ट संचालन में बाधा डालते हैं। उदाहरण के लिए, प्रतिबंध **appengine.disableCodeDownload** आमतौर पर App Engine स्रोत कोड को डाउनलोड करने से रोकता है। हालाँकि, **orgpolicy.policy.set** का उपयोग करके, एक हमलावर इस प्रतिबंध को निष्क्रिय कर सकता है, जिससे उसे स्रोत कोड डाउनलोड करने की अनुमति मिलती है, भले ही यह प्रारंभ में सुरक्षित हो। +एक attacker जो **orgpolicy.policy.set** का उपयोग करता है, वह संगठनात्मक नीतियों को बदल सकता है, जिससे वह कुछ ऐसे प्रतिबंध हटा सकेगा जो विशिष्ट ऑपरेशनों को रोक रहे हैं। उदाहरण के लिए, कन्स्ट्रेंट **appengine.disableCodeDownload** आमतौर पर App Engine के स्रोत कोड को डाउनलोड करने से रोकता है। हालांकि, **orgpolicy.policy.set** का उपयोग करके attacker इस कन्स्ट्रेंट को निष्क्रिय कर सकता है, और परिणामस्वरूप प्रारम्भ में संरक्षित होने के बावजूद स्रोत कोड डाउनलोड करने की पहुँच प्राप्त कर सकता है। ```bash # Get info gcloud resource-manager org-policies describe [--folder | --organization | --project ] @@ -14,8 +14,31 @@ gcloud resource-manager org-policies describe [--folder | --or # Disable gcloud resource-manager org-policies disable-enforce [--folder | --organization | --project ] ``` -एक पायथन स्क्रिप्ट इस विधि के लिए [यहाँ](https://github.com/RhinoSecurityLabs/GCP-IAM-Privilege-Escalation/blob/master/ExploitScripts/orgpolicy.policy.set.py) मिल सकती है। +A python स्क्रिप्ट इस विधि के लिए [here](https://github.com/RhinoSecurityLabs/GCP-IAM-Privilege-Escalation/blob/master/ExploitScripts/orgpolicy.policy.set.py) पर मिल सकती है। +### `orgpolicy.policy.set`, `iam.serviceAccounts.actAs` + +आम तौर पर किसी अलग project के service account को किसी resource से attach करना संभव नहीं होता क्योंकि एक policy constraint लागू रहती है जिसका नाम **`iam.disableCrossProjectServiceAccountUsage`** है जो इस क्रिया को रोकता है। + +यह सत्यापित किया जा सकता है कि यह constraint लागू है या नहीं, निम्नलिखित command चलाकर: +```bash +gcloud resource-manager org-policies describe \ +constraints/iam.disableCrossProjectServiceAccountUsage \ +--project= \ +--effective + +booleanPolicy: +enforced: true +constraint: constraints/iam.disableCrossProjectServiceAccountUsage +``` +यह हमलावर को अनुमति **`iam.serviceAccounts.actAs`** का दुरुपयोग करके किसी दूसरे प्रोजेक्ट के service account का impersonate करने से रोकता है — उदाहरण के लिए बिना अतिरिक्त इंफ्रा अनुमतियों के नया VM शुरू करने जैसी क्रियाओं के लिए — जो privilege escalation का कारण बन सकता है। + +हालाँकि, जिनके पास अनुमति **`orgpolicy.policy.set`** है वे इस प्रतिबंध को बायपास कर सकते हैं, constraint **`iam.disableServiceAccountProjectWideAccess`** को disable करके। इससे हमलावर अपने प्रोजेक्ट में किसी रिसोर्स के साथ दूसरे प्रोजेक्ट के service account को attach कर सकता है, effectively escalating his privileges. +```bash +gcloud resource-manager org-policies disable-enforce \ +iam.disableCrossProjectServiceAccountUsage \ +--project= +``` ## संदर्भ - [https://rhinosecuritylabs.com/cloud-security/privilege-escalation-google-cloud-platform-part-2/](https://rhinosecuritylabs.com/cloud-security/privilege-escalation-google-cloud-platform-part-2/)