GCP - Secrets Manager Enum

Support HackTricks

Secret Manager

Google Secret Manager पासवर्ड, API कुंजी, प्रमाणपत्र, फ़ाइलें (अधिकतम 64KB) और अन्य संवेदनशील डेटा संग्रहीत करने के लिए एक वॉल्ट-जैसी समाधान है।

एक रहस्य में विभिन्न डेटा संग्रहीत करने के लिए विभिन्न संस्करण हो सकते हैं।

रहस्य डिफ़ॉल्ट रूप से Google प्रबंधित कुंजी का उपयोग करके एन्क्रिप्ट होते हैं, लेकिन इसे एन्क्रिप्ट करने के लिए KMS से एक कुंजी का चयन करना संभव है

रोटेशन के संबंध में, यह हर कुछ दिनों में pub-sub पर भेजे जाने वाले संदेशों को कॉन्फ़िगर करना संभव है, उन संदेशों को सुनने वाला कोड रहस्य को रोटेट कर सकता है।

स्वचालित हटाने के लिए एक दिन कॉन्फ़िगर करना संभव है, जब निर्दिष्ट दिन पहुंचा जाता है, तो रहस्य स्वचालित रूप से हटा दिया जाएगा

Enumeration

# First, list the entries
gcloud secrets list
gcloud secrets get-iam-policy <secret_name>

# Then, pull the clear-text of any version of any secret
gcloud secrets versions list <secret_name>
gcloud secrets versions access 1 --secret="<secret_name>"

Privilege Escalation

In the following page you can check how to abuse secretmanager permissions to escalate privileges.

Post Exploitation

Persistence

Rotation misuse

An attacker could update the secret to रोटेशन को रोकने के लिए (so it won't be modified), or रोटेशन को बहुत कम बार करना (so the secret won't be modified) or to रोटेशन संदेश को एक अलग pub/sub पर प्रकाशित करना, or modifying the rotation code being executed (this happens in a different service, probably in a Clound Function, so the attacker will need privileged access over the Cloud Function or any other service)

Support HackTricks

Last updated