GCP - Cloud Functions Unauthenticated Enum

htARTE (HackTricks AWS Red Team Expert) के साथ शून्य से नायक तक AWS हैकिंग सीखें

HackTricks का समर्थन करने के अन्य तरीके:

Cloud Functions

Cloud Functions के बारे में अधिक जानकारी यहाँ मिल सकती है:

pageGCP - Cloud Functions Enum

Brute Force URls

URL प्रारूप को Brute Force करें:

  • https://<region>-<project-gcp-name>.cloudfunctions.net/<func_name>

यह आसान है यदि आप प्रोजेक्ट नाम जानते हैं।

इस brute force को प्रदर्शित करने के लिए कुछ उपकरणों की जांच यहाँ करें:

pageGCP - Unauthenticated Enum & Access

खुले Cloud Functions का पता लगाएं

निम्नलिखित कोड यहाँ से लिया गया का उपयोग करके आप उन Cloud Functions का पता लगा सकते हैं जो अप्रमाणित आह्वानों की अनुमति देते हैं।

#!/bin/bash

############################
# Run this tool to find Cloud Functions that permit unauthenticated invocations
# anywhere in your GCP organization.
# Enjoy!
############################

for proj in $(gcloud projects list --format="get(projectId)"); do
echo "[*] scraping project $proj"

enabled=$(gcloud services list --project "$proj" | grep "Cloud Functions API")

if [ -z "$enabled" ]; then
continue
fi


for func_region in $(gcloud functions list --quiet --project "$proj" --format="value[separator=','](NAME,REGION)"); do
# drop substring from first occurence of "," to end of string.
func="${func_region%%,*}"
# drop substring from start of string up to last occurence of ","
region="${func_region##*,}"
ACL="$(gcloud functions get-iam-policy "$func" --project "$proj" --region "$region")"

all_users="$(echo "$ACL" | grep allUsers)"
all_auth="$(echo "$ACL" | grep allAuthenticatedUsers)"

if [ -z "$all_users" ]
then
:
else
echo "[!] Open to all users: $proj: $func"
fi

if [ -z "$all_auth" ]
then
:
else
echo "[!] Open to all authenticated users: $proj: $func"
fi
done
done
शून्य से नायक तक AWS हैकिंग सीखें htARTE (HackTricks AWS Red Team Expert) के साथ!

HackTricks का समर्थन करने के अन्य तरीके:

Last updated