Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[sync] GCP serviceusage.apiKeys.create Privilege Escalation rule (#55) #1076

Merged
merged 2 commits into from
Jan 30, 2024

Conversation

egibs
Copy link
Contributor

@egibs egibs commented Jan 30, 2024

Goal

Detect serviceusage.apiKeys.create method for privilege escalation in GCP. Depending on what logs are generated by the exploit, this ticket could result in multiple detections.

Categorization

TA0004:T1548

Strategy Abstract

It is non-IAM service privilege escalation method. This permission doesn't belong to the “IAM” family.

Technical Context

Here we work with method of authenticating with GCP APIs known as API keys. By default, they are created with no restrictions, which means they have access to the entire GCP project they were created in. We can capitalize on that fact by creating a new API key that may have more privileges than our own user. There is no official API for this, so a custom HTTP request needs to be sent to https://apikeys.clients6.google.com/ (or https://apikeys.googleapis.com/). This was discovered by monitoring the HTTP requests and responses while browsing the GCP web console. For documentation on the restrictions associated with API keys, visit this link.

Blind Spots and Assumptions

Assumes proper GCP logging and audit policies.

False Positives

Legitimate administrative activity that is authorized and expected.

Validation

The exploit script for this method can be found here.

Priority

High or Critical

Response

This is not a vulnerability in GCP, this is a vulnerability in how you have configured your GCP environment, so it is your responsibility to be aware of these attack vectors and to defend against them. It’s also important to remember that privilege escalation does not necessarily need to pass through the IAM service to be effective. Make sure to follow the principle of least-privilege in your environments to help mitigate these security risks.

Additional Resources

https://rhinosecuritylabs.com/cloud-security/privilege-escalation-google-cloud-platform-part-2/

https://cloud.google.com/docs/authentication/api-keys

Co-authored-by: Evan Gibler <evan.gibler@panther.com>
@egibs egibs requested review from a team January 30, 2024 18:54
@egibs egibs enabled auto-merge (squash) January 30, 2024 19:51
@egibs egibs merged commit b8fae38 into main Jan 30, 2024
5 checks passed
@egibs egibs deleted the egibs-sync-55 branch January 30, 2024 19:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants