GCP - Apikeys Privesc

Support HackTricks

Apikeys

다음 권한은 API 키를 생성하고 훔치는 데 유용합니다. 문서에서 다음과 같이 설명합니다: API 키는 주체 없이 애플리케이션을 식별하는 간단한 암호화된 문자열입니다. 이들은 공개 데이터에 익명으로 접근하는 데 유용하며, 쿼터청구를 위해 API 요청을 프로젝트와 연관시키는 데 사용됩니다.

따라서 API 키를 사용하면 해당 회사가 API 사용에 대한 비용을 지불하게 할 수 있지만, 권한 상승은 할 수 없습니다.

API 키에 대한 자세한 정보는 다음을 확인하세요:

GCP - API Keys Enum

API 키를 생성하는 다른 방법은 다음을 확인하세요:

GCP - Serviceusage Privesc

Brute Force API Key access

어떤 API가 프로젝트에서 활성화되어 있는지 또는 발견한 API 키에 적용된 제한 사항을 모를 수 있으므로, https://github.com/ozguralp/gmapsapiscanner 도구를 실행하고 API 키로 접근할 수 있는 내용을 확인하는 것이 흥미로울 것입니다.

apikeys.keys.create

이 권한은 API 키를 생성할 수 있게 해줍니다:

gcloud services api-keys create
Operation [operations/akmf.p7-[...]9] complete. Result: {
"@type":"type.googleapis.com/google.api.apikeys.v2.Key",
"createTime":"2022-01-26T12:23:06.281029Z",
"etag":"W/\"HOhA[...]==\"",
"keyString":"AIzaSy[...]oU",
"name":"projects/5[...]6/locations/global/keys/f707[...]e8",
"uid":"f707[...]e8",
"updateTime":"2022-01-26T12:23:06.378442Z"
}

You can find a script to automate the creation, exploit and cleaning of a vuln environment here.

기본적으로 사용자는 새 프로젝트를 생성할 수 있는 권한이 있으며, 새 프로젝트에 대해 소유자 역할이 부여됩니다. 따라서 사용자는 프로젝트를 생성하고 이 프로젝트 내에서 API 키를 생성할 수 있습니다.

apikeys.keys.getKeyString , apikeys.keys.list

이 권한은 모든 apiKeys를 나열하고 가져오며 키를 가져오는 것을 허용합니다:

for  key  in  $(gcloud services api-keys list --uri); do
gcloud services api-keys get-key-string "$key"
done

You can find a script to automate the creation, exploit and cleaning of a vuln environment here.

apikeys.keys.undelete , apikeys.keys.list

이 권한은 삭제된 API 키를 나열하고 재생성할 수 있게 해줍니다. undelete가 완료된 후 API 키는 출력에 제공됩니다:

gcloud services api-keys list --show-deleted
gcloud services api-keys undelete <key-uid>

내부 OAuth 애플리케이션 생성하여 다른 직원 피싱하기

이 작업은 clientauthconfig 서비스에 속하므로, 이를 수행하는 방법을 배우려면 다음 페이지를 확인하세요 문서에 따르면:

GWS - Google Platforms Phishing
HackTricks 지원하기

Last updated