Beanstalk Notion
Beanstalk Notion
/
🪲
Bug Reports
/
BIC Notes
/
📄
Report #35035
📄

Report #35035

Report Date
September 3, 2024
Status
Closed
Payout

Google Cloud Service Account JSON File Leakage

‣
Report Info

Report ID

#35035

Report type

Websites and Applications

Has PoC?

Yes

Target

https://github.com/BeanstalkFarms/Beanstalk-Analytics

(Out of scope)

Impacts

  • API Key Leakage

Description

Hi Team,

Google Cloud Service Account JSON file leakage refers to the unintended exposure or disclosure of sensitive JSON files associated with Google Cloud Service Accounts. These JSON files contain credentials that grant access to Google Cloud services, including private resources and administrative controls. When these files are leaked, unauthorized individuals can potentially exploit them to gain access to cloud resources, escalating the risk of data breaches and service misuse.

Vulnerability Details

Google Cloud Service Accounts use JSON key files to authenticate and authorize access to Google Cloud resources. These files include sensitive information such as the service account ID, private key, and other credentials necessary for accessing cloud services. Leakage of these files can occur through various means, including:

  • Misconfigured Permissions: Inappropriate file permissions or exposure of files in public repositories.
  • Improper Storage: Storing JSON key files in insecure locations such as public directories or version control systems.
  • Inadequate Security Practices: Sharing or transferring JSON files via insecure channels or failing to use proper key management practices.

###Common Causes:

  • Public Repository Exposure: Accidentally committing JSON key files to public code repositories (e.g., GitHub).

Impact Details

The impact of Google Cloud Service Account JSON file leakage can be severe and multifaceted:

  • Unauthorized Access: Attackers can use the exposed credentials to gain unauthorized access to Google Cloud services and resources, including databases, storage buckets, and APIs.
  • Data Breach: Unauthorized access can lead to data theft, data manipulation, or deletion of sensitive information stored in the cloud.
  • Service Disruption: Malicious actors may modify or delete critical cloud infrastructure components, causing service interruptions or outages.
  • Financial Loss: Exploitation of leaked credentials can result in financial losses due to misuse of resources, including unexpected charges for cloud services.

Proof of concept

The json file can be found [here](https://github.com/BeanstalkFarms/Beanstalk-Analytics/blob/7022cb0fc0b497f2247f277857c7d0c390ac7a62/serverless/tbiq-beanstalk-analytics-bca7893d8291.json#L6) and to test if it's working:

  • Download the json file
  • install gcloud
  • see commands below:
  • below command is to make sure that the file is present.
  • below command is activating the account credentials.
$ gcloud auth activate-service-account --key-file=tbiq-beanstalk-analytics-bca7893d8291.json
Activated service account credentials for: [bean-analytics-data-writer@tbiq-beanstalk-analytics.iam.gserviceaccount.com]
  • Lastly, fetching valid access token.

Even though the file is no longer present in the public repository, it remains accessible through the GitHub commit history, where it can be discovered and exploited by attackers. Additionally, since I can still generate an access token, it indicates that the file, despite being deleted, is still functional.

BIC Response

Thank you for the report. We have checked and found these credentials aren't associated with any Beanstalk Farms accounts nor allow access to any of our systems.

$ cat tbiq-beanstalk-analytics-bca7893d8291.json
{
  "type": "service_account",
  "project_id": "tbiq-beanstalk-analytics",
  "private_key_id": "bca7893d8291018eea9618c7ef5ff3de52ac9b73",
  "private_key": "-----BEGIN PRIVATE KEY-----\nMIIEvAIBADANBgkqhkiG9w0BAQEFAASCBKYwggSiAgEAAoIBAQCbNezRYYsOOPZi\nQPr2fFGuTqLkv4fDt2qVEtivFu9cvVEYOXWcy/5TKzffXFd3oqLzf/DYzRDeahJl\nfwvk9ZJInCrWvzeLwRrIy6kTnND5OuSyIMiQptEVbS8KC3XGoxUT7o+IP1bJ2UuM\ni28xKhArF5x5DpzA8gE4XKzqD4q4c0NPgruNyEH/vdq45WHpCt1zE7FX5oiE5zOt\nhgLrluFgMtM3YEFC3MKBU2emDUHwVTjrNnvG/+kYfpu6nIKZDzMFBoZ0Q9q8eHCP\niy8ChJFxUldAOX6xST8ib49LrreWTAhJbkqbeDhJYbyyhWmOeQB+7NRsGBdno4iC\nylUjQC0xAgMBAAECggEAFahzsE/1MHngX5uDqYt1dmZAsrzLPBNHCyBDHkOMCRvd\nygySjdulVIOuWzuudOI77NCIkigjV3XjtUgCJ+PgksM/8xFhtd2vWB+bK0JxoqWG\nLhkHA7BTcrL2omcw+xPcqBhc7P0xph7tPOJkFK8y7GByFC5mz0G1y+CavFqI1+39\nwFV8IUywSs+4mcAtHTlLGISIjuJFoI2VxzHodumtalsNMhQ7bSVTYHThm4DKNSm2\nO6Rx+W0o5RE2Tp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account.com",
  "client_id": "109301792576877008160",
  "auth_uri": "https://accounts.google.com/o/oauth2/auth",
  "token_uri": "https://oauth2.googleapis.com/token",
  "auth_provider_x509_cert_url": "https://www.googleapis.com/oauth2/v1/certs",
  "client_x509_cert_url": "https://www.googleapis.com/robot/v1/metadata/x509/bean-analytics-data-writer%40tbiq-beanstalk-analytics.iam.gserviceaccount.com"
}
$ gcloud auth print-access-token
ya29.c.c0ASRK0GavCHsGByeAOwlLSV7gd7eBLFxafHVGf8PI1VHCkgFx-DqGFJeQTvFre-Daxz94WrgadUbAveQwU4-K_U1qUAI5XcYZI7jN80QTat9yMCpyNt2-k3f_sIGQ0ccBw6Jz0goru3yg1BWrq3VS3MQYQISH3jHeVn48WtzaIK866vrONuM1YJnENSr0jn46ygKL5z0hWT7Igq1F0uhBfzm98z84ZzylaMVNYHVTqBIrF9GyZOwuypF1jJXdlKlpMrRKX-73HiHI9BLhwmk77XZJiussa48OtPg8oOSnBnJuwT-v9iAMJKJUU2UIaR3wTaQZjhrE3MDZ0xWf_dVErMAMq5afv22taywqKdLB1rkhdN5ZiuBW9AnQCo4a5zQ-nQtzG397CeVvMvqYpXcgWjJ9_lol2e_iwSFnRVRB3X1f0R4S08hgVxY8O7zseplaM_7-bS-ipIf05RdIOeRvVUdUMSR6WgxRiyshwdZeIpQWR5lJldFzWQ1ZIBF6yapjx0QMMmdm635Ylg1gaqImcBZRnehZff_tI8-WScjZnuxsVIyr-jg2B1Jml41iQxq1Wb1O7395qZBb1vfFmeis2V07R5MRaBoJ9QJbs95hdF17FSZU1Jm3nQrzFqf5ijJRU50prZFJOau-vZkIpa9IIcxRv5Blpau8foSxZexte2JJI9WWddIj9BxRtbrqO-cl-5JhebZaMmo-Yr56zc3piteQulz_dto5x5gFdrIkIZnvSFhxq9n95nFIZcYkjciUvFIiZFBlZ4XZ8ljJS4vWW-bRpwsM9ncZfvtZqfowtupjnSrclRoolgJXnIwurzrt6n-z2FUjfVVwJ30IyhS_gFp9V17aY7yw2UU4iliWgyVhxaYy5tY_vv_j0g76Ug3rbtfrcg4Z-npq_ilU0h2h0zjcibyRzq29kkWbSMpdZYuJq13sFVomW5Ih6as9ep-YjJV34BoapFfX07dlihnnnu1WQlv4omOIsBhc6WlFqcpRo17JuW67uOe