gcpwn 0.5.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of gcpwn might be problematic. Click here for more details.

Files changed (152) hide show
  1. gcpwn-0.5.0/LICENSE +28 -0
  2. gcpwn-0.5.0/PKG-INFO +583 -0
  3. gcpwn-0.5.0/README.md +512 -0
  4. gcpwn-0.5.0/gcpwn/__init__.py +3 -0
  5. gcpwn-0.5.0/gcpwn/__main__.py +11 -0
  6. gcpwn-0.5.0/gcpwn/cli/main.py +461 -0
  7. gcpwn-0.5.0/gcpwn/cli/module_actions.py +524 -0
  8. gcpwn-0.5.0/gcpwn/cli/workspace_instructions.py +2286 -0
  9. gcpwn-0.5.0/gcpwn/core/action_schema.py +87 -0
  10. gcpwn-0.5.0/gcpwn/core/config.py +66 -0
  11. gcpwn-0.5.0/gcpwn/core/console.py +637 -0
  12. gcpwn-0.5.0/gcpwn/core/contracts.py +47 -0
  13. gcpwn-0.5.0/gcpwn/core/db.py +1189 -0
  14. gcpwn-0.5.0/gcpwn/core/output_paths.py +133 -0
  15. gcpwn-0.5.0/gcpwn/core/session.py +926 -0
  16. gcpwn-0.5.0/gcpwn/core/utils/action_recording.py +57 -0
  17. gcpwn-0.5.0/gcpwn/core/utils/iam_permissions.py +102 -0
  18. gcpwn-0.5.0/gcpwn/core/utils/iam_simplifier.py +970 -0
  19. gcpwn-0.5.0/gcpwn/core/utils/module_helpers.py +1186 -0
  20. gcpwn-0.5.0/gcpwn/core/utils/persistence.py +198 -0
  21. gcpwn-0.5.0/gcpwn/core/utils/serialization.py +59 -0
  22. gcpwn-0.5.0/gcpwn/core/utils/service_runtime.py +320 -0
  23. gcpwn-0.5.0/gcpwn/mappings/database_info.json +2344 -0
  24. gcpwn-0.5.0/gcpwn/mappings/module-mappings.json +482 -0
  25. gcpwn-0.5.0/gcpwn/mappings/og_permission_to_roles_map.json +2867 -0
  26. gcpwn-0.5.0/gcpwn/mappings/og_privilege_escalation_paths.json +255 -0
  27. gcpwn-0.5.0/gcpwn/mappings/og_service_agent_patterns.json +1262 -0
  28. gcpwn-0.5.0/gcpwn/modules/agentplatform/enumeration/enum_agentplatform.py +430 -0
  29. gcpwn-0.5.0/gcpwn/modules/agentplatform/utilities/helpers.py +951 -0
  30. gcpwn-0.5.0/gcpwn/modules/apigateway/enumeration/enum_apigateway.py +435 -0
  31. gcpwn-0.5.0/gcpwn/modules/apigateway/utilities/data/locations.txt +10 -0
  32. gcpwn-0.5.0/gcpwn/modules/apigateway/utilities/helpers.py +444 -0
  33. gcpwn-0.5.0/gcpwn/modules/apikeys/enumeration/enum_apikeys.py +164 -0
  34. gcpwn-0.5.0/gcpwn/modules/apikeys/unauthenticated/unauth_apikey_enum_all_scopes.py +1062 -0
  35. gcpwn-0.5.0/gcpwn/modules/apikeys/unauthenticated/unauth_apikey_gemini_exploit.py +1253 -0
  36. gcpwn-0.5.0/gcpwn/modules/apikeys/unauthenticated/unauth_apikey_vertex_exploit.py +879 -0
  37. gcpwn-0.5.0/gcpwn/modules/apikeys/utilities/data/model_list.txt +27 -0
  38. gcpwn-0.5.0/gcpwn/modules/apikeys/utilities/helpers.py +375 -0
  39. gcpwn-0.5.0/gcpwn/modules/appengine/enumeration/enum_appengine.py +396 -0
  40. gcpwn-0.5.0/gcpwn/modules/appengine/utilities/helpers.py +284 -0
  41. gcpwn-0.5.0/gcpwn/modules/artifactregistry/enumeration/enum_artifactregistry.py +837 -0
  42. gcpwn-0.5.0/gcpwn/modules/artifactregistry/utilities/data/locations.txt +46 -0
  43. gcpwn-0.5.0/gcpwn/modules/artifactregistry/utilities/helpers.py +740 -0
  44. gcpwn-0.5.0/gcpwn/modules/batch/enumeration/enum_batch.py +165 -0
  45. gcpwn-0.5.0/gcpwn/modules/batch/utilities/helpers.py +87 -0
  46. gcpwn-0.5.0/gcpwn/modules/bigquery/enumeration/enum_bigquery.py +363 -0
  47. gcpwn-0.5.0/gcpwn/modules/bigquery/utilities/helpers.py +539 -0
  48. gcpwn-0.5.0/gcpwn/modules/bigtable/enumeration/enum_bigtable.py +219 -0
  49. gcpwn-0.5.0/gcpwn/modules/bigtable/utilities/helpers.py +338 -0
  50. gcpwn-0.5.0/gcpwn/modules/cloudbuild/enumeration/enum_cloudbuild.py +464 -0
  51. gcpwn-0.5.0/gcpwn/modules/cloudbuild/utilities/data/locations.txt +43 -0
  52. gcpwn-0.5.0/gcpwn/modules/cloudbuild/utilities/helpers.py +554 -0
  53. gcpwn-0.5.0/gcpwn/modules/cloudcomposer/enumeration/enum_cloudcomposer.py +84 -0
  54. gcpwn-0.5.0/gcpwn/modules/cloudcomposer/utilities/data/locations.txt +43 -0
  55. gcpwn-0.5.0/gcpwn/modules/cloudcomposer/utilities/helpers.py +144 -0
  56. gcpwn-0.5.0/gcpwn/modules/cloudcompute/enumeration/enum_cloudcompute_lb.py +206 -0
  57. gcpwn-0.5.0/gcpwn/modules/cloudcompute/enumeration/enum_cloudcompute_network.py +407 -0
  58. gcpwn-0.5.0/gcpwn/modules/cloudcompute/enumeration/enum_cloudcompute_resources.py +1336 -0
  59. gcpwn-0.5.0/gcpwn/modules/cloudcompute/exploit/exploit_instance_ssh_keys.py +196 -0
  60. gcpwn-0.5.0/gcpwn/modules/cloudcompute/exploit/exploit_instance_startup_script.py +259 -0
  61. gcpwn-0.5.0/gcpwn/modules/cloudcompute/utilities/data/zones.txt +115 -0
  62. gcpwn-0.5.0/gcpwn/modules/cloudcompute/utilities/helpers.py +4456 -0
  63. gcpwn-0.5.0/gcpwn/modules/cloudcompute/utilities/lb_helpers.py +145 -0
  64. gcpwn-0.5.0/gcpwn/modules/cloudcompute/utilities/network_helpers.py +703 -0
  65. gcpwn-0.5.0/gcpwn/modules/clouddns/enumeration/enum_clouddns.py +252 -0
  66. gcpwn-0.5.0/gcpwn/modules/clouddns/utilities/helpers.py +288 -0
  67. gcpwn-0.5.0/gcpwn/modules/cloudfunctions/enumeration/enum_cloudfunctions.py +285 -0
  68. gcpwn-0.5.0/gcpwn/modules/cloudfunctions/exploit/exploit_functions_invoke.py +311 -0
  69. gcpwn-0.5.0/gcpwn/modules/cloudfunctions/unauthenticated/unauth_functionbrute.py +154 -0
  70. gcpwn-0.5.0/gcpwn/modules/cloudfunctions/utilities/data/codev1v2.zip +0 -0
  71. gcpwn-0.5.0/gcpwn/modules/cloudfunctions/utilities/data/gcpfunctionsbrute_permutations.txt +102 -0
  72. gcpwn-0.5.0/gcpwn/modules/cloudfunctions/utilities/data/regions_v1.txt +23 -0
  73. gcpwn-0.5.0/gcpwn/modules/cloudfunctions/utilities/data/regions_v2.txt +39 -0
  74. gcpwn-0.5.0/gcpwn/modules/cloudfunctions/utilities/helpers.py +923 -0
  75. gcpwn-0.5.0/gcpwn/modules/cloudrun/enumeration/enum_cloudrun.py +320 -0
  76. gcpwn-0.5.0/gcpwn/modules/cloudrun/utilities/data/locations.txt +43 -0
  77. gcpwn-0.5.0/gcpwn/modules/cloudrun/utilities/helpers.py +405 -0
  78. gcpwn-0.5.0/gcpwn/modules/cloudsql/enumeration/enum_cloudsql.py +189 -0
  79. gcpwn-0.5.0/gcpwn/modules/cloudsql/utilities/helpers.py +307 -0
  80. gcpwn-0.5.0/gcpwn/modules/cloudstorage/enumeration/enum_cloudstorage.py +230 -0
  81. gcpwn-0.5.0/gcpwn/modules/cloudstorage/exploit/exploit_bucket_upload.py +144 -0
  82. gcpwn-0.5.0/gcpwn/modules/cloudstorage/exploit/exploit_storage_hmac.py +121 -0
  83. gcpwn-0.5.0/gcpwn/modules/cloudstorage/unauthenticated/unauth_bucketbrute.py +197 -0
  84. gcpwn-0.5.0/gcpwn/modules/cloudstorage/utilities/data/gcpbucketbrute_permutations.txt +211 -0
  85. gcpwn-0.5.0/gcpwn/modules/cloudstorage/utilities/data/top_level_domains.txt +1297 -0
  86. gcpwn-0.5.0/gcpwn/modules/cloudstorage/utilities/helpers.py +1144 -0
  87. gcpwn-0.5.0/gcpwn/modules/cloudtasks/enumeration/enum_cloudtasks.py +280 -0
  88. gcpwn-0.5.0/gcpwn/modules/cloudtasks/utilities/data/locations.txt +23 -0
  89. gcpwn-0.5.0/gcpwn/modules/cloudtasks/utilities/helpers.py +394 -0
  90. gcpwn-0.5.0/gcpwn/modules/everything/enumeration/enum_all.py +652 -0
  91. gcpwn-0.5.0/gcpwn/modules/everything/enumeration/enum_policy_bindings.py +87 -0
  92. gcpwn-0.5.0/gcpwn/modules/everything/exploit/exploit_setiampolicy.py +920 -0
  93. gcpwn-0.5.0/gcpwn/modules/everything/process/analyze_vulns.py +18 -0
  94. gcpwn-0.5.0/gcpwn/modules/everything/process/process_iam_bindings.py +108 -0
  95. gcpwn-0.5.0/gcpwn/modules/everything/utilities/helpers.py +1137 -0
  96. gcpwn-0.5.0/gcpwn/modules/everything/utilities/iam_policy_bindings.py +1504 -0
  97. gcpwn-0.5.0/gcpwn/modules/firestore/enumeration/enum_firestore.py +206 -0
  98. gcpwn-0.5.0/gcpwn/modules/firestore/utilities/helpers.py +566 -0
  99. gcpwn-0.5.0/gcpwn/modules/gke/enumeration/enum_gke.py +248 -0
  100. gcpwn-0.5.0/gcpwn/modules/gke/utilities/helpers.py +166 -0
  101. gcpwn-0.5.0/gcpwn/modules/iam/enumeration/enum_iam.py +618 -0
  102. gcpwn-0.5.0/gcpwn/modules/iam/exploit/exploit_generate_access_token.py +542 -0
  103. gcpwn-0.5.0/gcpwn/modules/iam/exploit/exploit_service_account_keys.py +148 -0
  104. gcpwn-0.5.0/gcpwn/modules/iam/exploit/update_role.py +1 -0
  105. gcpwn-0.5.0/gcpwn/modules/iam/utilities/helpers.py +1202 -0
  106. gcpwn-0.5.0/gcpwn/modules/kms/enumeration/enum_kms.py +193 -0
  107. gcpwn-0.5.0/gcpwn/modules/kms/utilities/data/locations.txt +69 -0
  108. gcpwn-0.5.0/gcpwn/modules/kms/utilities/helpers.py +248 -0
  109. gcpwn-0.5.0/gcpwn/modules/memorystore/enumeration/enum_memorystore.py +138 -0
  110. gcpwn-0.5.0/gcpwn/modules/memorystore/utilities/helpers.py +232 -0
  111. gcpwn-0.5.0/gcpwn/modules/opengraph/enumeration/enum_gcp_cloud_hound_data.py +349 -0
  112. gcpwn-0.5.0/gcpwn/modules/opengraph/utilities/final_allowlist_trim_builder.py +328 -0
  113. gcpwn-0.5.0/gcpwn/modules/opengraph/utilities/helpers/constants.py +131 -0
  114. gcpwn-0.5.0/gcpwn/modules/opengraph/utilities/helpers/context.py +288 -0
  115. gcpwn-0.5.0/gcpwn/modules/opengraph/utilities/helpers/core_helpers.py +872 -0
  116. gcpwn-0.5.0/gcpwn/modules/opengraph/utilities/helpers/iam_bindings_shared_helpers.py +2976 -0
  117. gcpwn-0.5.0/gcpwn/modules/opengraph/utilities/helpers/iam_conditionals.py +121 -0
  118. gcpwn-0.5.0/gcpwn/modules/opengraph/utilities/iam_bindings_prepare_builder.py +534 -0
  119. gcpwn-0.5.0/gcpwn/modules/opengraph/utilities/iam_bindings_single_multi_permission_graph_builder.py +84 -0
  120. gcpwn-0.5.0/gcpwn/modules/opengraph/utilities/iam_bindings_single_permission_graph_builder.py +69 -0
  121. gcpwn-0.5.0/gcpwn/modules/opengraph/utilities/iam_inferred_permissions_graph_builder.py +1068 -0
  122. gcpwn-0.5.0/gcpwn/modules/opengraph/utilities/principal_builder.py +266 -0
  123. gcpwn-0.5.0/gcpwn/modules/opengraph/utilities/resource_expansion_builder.py +672 -0
  124. gcpwn-0.5.0/gcpwn/modules/pubsub/enumeration/enum_pubsub.py +311 -0
  125. gcpwn-0.5.0/gcpwn/modules/pubsub/utilities/helpers.py +347 -0
  126. gcpwn-0.5.0/gcpwn/modules/resourcemanager/enumeration/enum_resources.py +268 -0
  127. gcpwn-0.5.0/gcpwn/modules/resourcemanager/utilities/data/all_folder_permissions.txt +12928 -0
  128. gcpwn-0.5.0/gcpwn/modules/resourcemanager/utilities/data/all_organization_permissions.txt +13169 -0
  129. gcpwn-0.5.0/gcpwn/modules/resourcemanager/utilities/data/all_project_permissions.txt +12844 -0
  130. gcpwn-0.5.0/gcpwn/modules/resourcemanager/utilities/data/general_folder_permissions.txt +312 -0
  131. gcpwn-0.5.0/gcpwn/modules/resourcemanager/utilities/data/general_organization_permissions.txt +316 -0
  132. gcpwn-0.5.0/gcpwn/modules/resourcemanager/utilities/data/general_project_permissions.txt +309 -0
  133. gcpwn-0.5.0/gcpwn/modules/resourcemanager/utilities/helpers.py +1057 -0
  134. gcpwn-0.5.0/gcpwn/modules/secretsmanager/enumeration/enum_secretsmanager.py +233 -0
  135. gcpwn-0.5.0/gcpwn/modules/secretsmanager/utilities/data/locations.txt +39 -0
  136. gcpwn-0.5.0/gcpwn/modules/secretsmanager/utilities/helpers.py +332 -0
  137. gcpwn-0.5.0/gcpwn/modules/servicedirectory/enumeration/enum_servicedirectory.py +234 -0
  138. gcpwn-0.5.0/gcpwn/modules/servicedirectory/utilities/data/locations.txt +43 -0
  139. gcpwn-0.5.0/gcpwn/modules/servicedirectory/utilities/helpers.py +261 -0
  140. gcpwn-0.5.0/gcpwn/modules/storagetransfer/enumeration/enum_storagetransfer.py +165 -0
  141. gcpwn-0.5.0/gcpwn/modules/storagetransfer/utilities/helpers.py +124 -0
  142. gcpwn-0.5.0/gcpwn/modules/workspace_cloud_identity/enumeration/enum_cloud_identity.py +318 -0
  143. gcpwn-0.5.0/gcpwn/modules/workspace_cloud_identity/utilities/helpers.py +648 -0
  144. gcpwn-0.5.0/gcpwn.egg-info/PKG-INFO +583 -0
  145. gcpwn-0.5.0/gcpwn.egg-info/SOURCES.txt +150 -0
  146. gcpwn-0.5.0/gcpwn.egg-info/dependency_links.txt +1 -0
  147. gcpwn-0.5.0/gcpwn.egg-info/entry_points.txt +2 -0
  148. gcpwn-0.5.0/gcpwn.egg-info/requires.txt +54 -0
  149. gcpwn-0.5.0/gcpwn.egg-info/top_level.txt +1 -0
  150. gcpwn-0.5.0/pyproject.toml +56 -0
  151. gcpwn-0.5.0/requirements.txt +70 -0
  152. gcpwn-0.5.0/setup.cfg +4 -0
gcpwn-0.5.0/LICENSE ADDED
@@ -0,0 +1,28 @@
1
+ BSD 3-Clause License
2
+
3
+ Copyright (c) 2024, NetSPI
4
+
5
+ Redistribution and use in source and binary forms, with or without
6
+ modification, are permitted provided that the following conditions are met:
7
+
8
+ 1. Redistributions of source code must retain the above copyright notice, this
9
+ list of conditions and the following disclaimer.
10
+
11
+ 2. Redistributions in binary form must reproduce the above copyright notice,
12
+ this list of conditions and the following disclaimer in the documentation
13
+ and/or other materials provided with the distribution.
14
+
15
+ 3. Neither the name of the copyright holder nor the names of its
16
+ contributors may be used to endorse or promote products derived from
17
+ this software without specific prior written permission.
18
+
19
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
20
+ AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
21
+ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
22
+ DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
23
+ FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
24
+ DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
25
+ SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
26
+ CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
27
+ OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
28
+ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
gcpwn-0.5.0/PKG-INFO ADDED
@@ -0,0 +1,583 @@
1
+ Metadata-Version: 2.4
2
+ Name: gcpwn
3
+ Version: 0.5.0
4
+ Summary: GCP offensive assessment and enumeration framework.
5
+ Author: NetSPI
6
+ License-Expression: BSD-3-Clause
7
+ Classifier: Programming Language :: Python :: 3
8
+ Classifier: Programming Language :: Python :: 3 :: Only
9
+ Classifier: Programming Language :: Python :: 3.11
10
+ Classifier: Programming Language :: Python :: 3.12
11
+ Classifier: Programming Language :: Python :: 3.13
12
+ Classifier: Operating System :: OS Independent
13
+ Classifier: Intended Audience :: Information Technology
14
+ Classifier: Topic :: Security
15
+ Requires-Python: >=3.11
16
+ Description-Content-Type: text/markdown
17
+ License-File: LICENSE
18
+ Requires-Dist: boto3<2,>=1.43.1
19
+ Requires-Dist: pandas==3.0.2
20
+ Requires-Dist: requests==2.33.1
21
+ Requires-Dist: xlsxwriter==3.2.9
22
+ Requires-Dist: google-api-core==2.30.3
23
+ Requires-Dist: google-api-python-client==2.195.0
24
+ Requires-Dist: google-auth-httplib2==0.3.1
25
+ Requires-Dist: google-auth-oauthlib==1.3.1
26
+ Requires-Dist: google-cloud-access-approval==1.19.0
27
+ Requires-Dist: google-cloud-aiplatform==1.149.0
28
+ Requires-Dist: google-cloud-api-gateway==1.15.0
29
+ Requires-Dist: google-cloud-api-keys==0.8.0
30
+ Requires-Dist: google-cloud-appengine-admin==1.17.0
31
+ Requires-Dist: google-cloud-artifact-registry==1.21.0
32
+ Requires-Dist: google-cloud-batch==0.21.0
33
+ Requires-Dist: google-cloud-bigquery==3.41.0
34
+ Requires-Dist: google-cloud-bigtable==2.36.0
35
+ Requires-Dist: google-cloud-billing==1.19.0
36
+ Requires-Dist: google-cloud-build==3.36.0
37
+ Requires-Dist: google-cloud-compute==1.47.0
38
+ Requires-Dist: google-cloud-container==2.64.0
39
+ Requires-Dist: google-cloud-dns==0.36.1
40
+ Requires-Dist: google-cloud-firestore==2.27.0
41
+ Requires-Dist: google-cloud-functions==1.23.0
42
+ Requires-Dist: google-cloud-iam==2.22.0
43
+ Requires-Dist: google-cloud-kms==3.12.0
44
+ Requires-Dist: google-cloud-language==2.20.0
45
+ Requires-Dist: google-cloud-logging==3.15.0
46
+ Requires-Dist: google-cloud-monitoring==2.30.0
47
+ Requires-Dist: google-cloud-netapp==0.9.0
48
+ Requires-Dist: google-cloud-orchestration-airflow==1.20.0
49
+ Requires-Dist: google-cloud-pubsub==2.37.0
50
+ Requires-Dist: google-cloud-redis==2.21.0
51
+ Requires-Dist: google-cloud-resource-manager==1.17.0
52
+ Requires-Dist: google-cloud-run==0.16.0
53
+ Requires-Dist: google-cloud-runtimeconfig==0.36.1
54
+ Requires-Dist: google-cloud-scheduler==2.19.0
55
+ Requires-Dist: google-cloud-secret-manager==2.27.0
56
+ Requires-Dist: google-cloud-service-directory==1.17.0
57
+ Requires-Dist: google-cloud-speech==2.38.0
58
+ Requires-Dist: google-cloud-storage==3.10.1
59
+ Requires-Dist: google-cloud-storage-transfer==1.20.0
60
+ Requires-Dist: google-cloud-storageinsights==0.4.0
61
+ Requires-Dist: google-cloud-tasks==2.22.0
62
+ Requires-Dist: google-cloud-translate==3.26.0
63
+ Requires-Dist: google-cloud-videointelligence==2.19.0
64
+ Requires-Dist: google-cloud-vision==3.13.0
65
+ Requires-Dist: google-genai==1.74.0
66
+ Provides-Extra: dev
67
+ Requires-Dist: pytest>=8.0; extra == "dev"
68
+ Provides-Extra: table
69
+ Requires-Dist: prettytable==3.17.0; extra == "table"
70
+ Dynamic: license-file
71
+
72
+ ![GCPwnLogo](https://github.com/user-attachments/assets/1ad93c63-37f2-42fd-95e9-ec05966cb6b2)
73
+
74
+ [![PyPI](https://img.shields.io/pypi/v/gcpwn)](https://pypi.org/project/gcpwn/)
75
+ [![Python](https://img.shields.io/badge/python-3.11%2B-blue)](https://www.python.org/)
76
+ [![License](https://img.shields.io/badge/license-BSD--3--Clause-blue.svg)](./LICENSE)
77
+ [![Stars](https://img.shields.io/github/stars/NetSPI/gcpwn.svg)](https://github.com/NetSPI/gcpwn/stargazers)
78
+ [![Forks](https://img.shields.io/github/forks/NetSPI/gcpwn.svg)](https://github.com/NetSPI/gcpwn/network)
79
+ [![Issues](https://img.shields.io/github/issues/NetSPI/gcpwn.svg)](https://github.com/NetSPI/gcpwn/issues)
80
+
81
+ # GCPwn
82
+
83
+ ## Overview
84
+
85
+ GCPwn is a Google Cloud offensive security assessment framework focused on workspace-driven credential handling, service enumeration, artifact download, and graph-based attack-path analysis.
86
+
87
+ The project started as a pentesting-focused "one-stop-shop" to combine:
88
+
89
+ - broad service enumeration,
90
+ - practical exploit workflows,
91
+ - saved permission tracking over time,
92
+ - and OpenGraph output for BloodHound.
93
+
94
+ Unlike one-off scripts, GCPwn stores both resource data and discovered actions/permissions while you run modules, which makes follow-on analysis and exploit pathing much faster.
95
+
96
+ ## High-Level Features
97
+
98
+ - **CLI UX:** Interactive terminal workflow for workspaces, credentials, module execution, and exports.
99
+ - **Module Model:** Enumeration, exploit, unauthenticated, and processing modules across many GCP services.
100
+ - **Mass Enumeration:** `enum_all` orchestration support (implemented under `modules/everything`).
101
+ - **IAM Visibility:** `testIamPermissions` coverage across many resources + policy binding processing.
102
+ - **Artifact Downloads:** `--download` support across multiple modules with scoped skip/include behavior.
103
+ - **OpenGraph / BloodHound:** Graph generation for GCP principals/resources, privilege-escalation edges, inheritance expansion, and optional conditional evaluation placeholders.
104
+ - **Reporting Exports:** SQLite-backed data export to CSV/JSON/Excel/tree image from the CLI.
105
+
106
+ ## Documentation
107
+
108
+ Documentation is maintained in the GitHub Wiki:
109
+
110
+ - https://github.com/NetSPI/gcpwn/wiki
111
+
112
+ Additional project docs:
113
+
114
+ - Contributing: `CONTRIBUTING.md`
115
+ - Roadmap: `ROADMAP.md`
116
+
117
+ ## Installation TLDR
118
+
119
+ ### Option 1: Local Install
120
+
121
+ ```bash
122
+ git clone https://github.com/NetSPI/gcpwn.git
123
+ cd gcpwn
124
+
125
+ python3 -m venv .venv
126
+ source .venv/bin/activate
127
+ pip install --upgrade pip
128
+ ```
129
+
130
+ Base install (no `prettytable`, default output is text):
131
+
132
+ ```bash
133
+ pip install -r requirements.txt
134
+ ```
135
+
136
+ Install optional table output support:
137
+
138
+ ```bash
139
+ pip install prettytable==3.17.0
140
+ ```
141
+
142
+ Run the tool:
143
+
144
+ ```bash
145
+ python -m gcpwn
146
+ ```
147
+
148
+ ### Option 2: Pip Install (PyPI)
149
+
150
+ ```bash
151
+ pip3 install gcpwn
152
+ ```
153
+
154
+ If you want pretty tables, optional table rendering dependency `prettytable` can be installed via:
155
+
156
+ ```bash
157
+ pip3 install "gcpwn[table]"
158
+ ```
159
+
160
+ Run the tool:
161
+
162
+ ```bash
163
+ gcpwn
164
+ ```
165
+
166
+ If your shell cannot find `gcpwn`, run:
167
+
168
+ ```bash
169
+ python -m gcpwn
170
+ ```
171
+
172
+ ### Option 3: Docker
173
+
174
+ ```bash
175
+ docker build -t gcpwn .
176
+ docker run --rm -it gcpwn
177
+ ```
178
+
179
+ If you want local persistence for DB/output between runs, mount volumes:
180
+
181
+ ```bash
182
+ docker run --rm -it \
183
+ -v "$(pwd)/databases:/opt/gcpwn/databases" \
184
+ -v "$(pwd)/gcpwn_output:/opt/gcpwn/gcpwn_output" \
185
+ gcpwn
186
+ ```
187
+
188
+ ## First-Run TLDR
189
+
190
+ 1. Create/select a workspace.
191
+ 2. Load credentials (user/service) and set your target project(s).
192
+ 3. Start with broad enumeration:
193
+
194
+ ```bash
195
+ # Common first pass
196
+ modules run enum_all --iam
197
+
198
+ # Deep IAM permission pass at org/folder/project scale
199
+ modules run enum_all --iam --all-permissions
200
+
201
+ # Deep pass + download coverage
202
+ modules run enum_all --iam --all-permissions --download
203
+ ```
204
+
205
+ 4. Review what was collected:
206
+
207
+ ```bash
208
+ # See your current creds (includes testIamPermission references)
209
+ creds info
210
+
211
+ # Process all IAM bindings & get IAM summary
212
+ modules run process_iam_bindings
213
+
214
+ # Create BloodHound graph of IAM permissions
215
+ modules run enum_gcp_cloud_hound_data --out output.json
216
+
217
+ # Export all enumerated data to an excel sheet
218
+ data export excel
219
+ ```
220
+
221
+ ## Unauthenticated Passthrough Mode
222
+
223
+ You can run unauthenticated modules directly without entering the interactive workspace shell. This creates a workspace called `PASSTHROUGH` implicitly.
224
+
225
+ Examples:
226
+
227
+ ```bash
228
+ # Run via installed console script
229
+ gcpwn --module unauth_apikey_enum_all_scopes --api-key AIza...
230
+
231
+ # Same flow via python module entrypoint
232
+ python -m gcpwn --module unauth_apikey_gemini_exploit --api-key AIza...
233
+
234
+ # Modules that derive targets from project context can use --project-id
235
+ python -m gcpwn --module unauth_functionbrute --project-id my-project --region us-central1
236
+ ```
237
+
238
+ Notes:
239
+
240
+ - In passthrough mode, **all** commands use `--module <module_name>` (regardless of `gcpwn` vs `python -m gcpwn` entrypoint).
241
+ - Passthrough mode is currently limited to `Unauthenticated` modules.
242
+ - This mode skips workspace selection/startup and uses a lightweight runtime context.
243
+ - Pass module-specific help with: `gcpwn --module <module> -h`
244
+ - Use normal interactive mode (`gcpwn` then `modules run ...`) when you want workspace-backed caching, credential management, and full data persistence.
245
+
246
+ ## OpenGraph TLDR
247
+
248
+ By default the OpenGraph module ONLY graphs edges and related resource edges that are tied to privilege escalatoin paths. This default allowlist of OpenGraph escalation rules live in `gcpwn/mappings/og_privilege_escalation_paths.json`. You can enable differnet flags. See below for differnet flags. In general the following is probably good in most cases:
249
+ ```bash
250
+ # TLDR best option
251
+ modules run enum_gcp_cloud_hound_data --expand-inheritance --reset --out Bloodhound_Output.json
252
+ ```
253
+
254
+ ### Graphing Strategy
255
+
256
+ You might notice edges go to `role@location` instead of going directly to the project. This preserves authorization fidelity in the graph. If User A has `compute.admin` on Project A and User B has `storage.admin` on Project A, drawing both users directly to Project A and then Project A to all resources would incorrectly imply both users can reach the same resources. The correct model is to route each user through their specific role binding node at that location, and only then fan out to resources that role can actually affect.
257
+
258
+ Incorrect method (over-broad reach):
259
+
260
+ ```text
261
+ User A --> Project A --> Compute & Storage
262
+ User B --> Project A --> Compute & Storage
263
+ ```
264
+
265
+ Correct method (binding-scoped reach):
266
+
267
+ ```text
268
+ User A --> compute_admin@project:A --> Compute Resources
269
+ User B --> storage_admin@project:A --> Storage Resources
270
+ ```
271
+
272
+ ![OpenGraph example graph](images/Opengraph_Example.png)
273
+
274
+ Generate OpenGraph JSON:
275
+
276
+ ```bash
277
+ modules run enum_gcp_cloud_hound_data --out opengraph_output.json --reset [--include-all] [--expand-inherited] [--cond-eval]
278
+
279
+ # Example
280
+ (<project-id>:example-cred)> modules run enum_gcp_cloud_hound_data --out TEST.json
281
+ [*] Step 1: users_groups (Users/Groups graph)
282
+ [*] Completed users_groups: +92 nodes, +0 edges
283
+ [*] Step 2: iam_bindings (IAM bindings graph)
284
+ [*] Completed iam_bindings: +77 nodes, +179 edges
285
+ [*] Step 3: inferred_permissions (Inferred permissions graph)
286
+ [*] Completed inferred_permissions: +69 nodes, +117 edges
287
+ [*] Step 4: resource_expansion (Resource expansion graph)
288
+ [*] Completed resource_expansion: +66 nodes, +71 edges
289
+ [*] Pruned isolated service-account IAM-binding islands (pairs=15, key_islands=2, nodes=39, edges=22).
290
+ [*] Pruned orphan implied-IAM-binding nodes (implied_bindings=15, nodes=15, edges=15).
291
+ [*] Pruned isolated service-account nodes (service_accounts=43, nodes=43, edges=0).
292
+ [*] OpenGraph generation complete. Nodes: 207 | Edges: 330
293
+ [*] Saved graph JSON to TEST.json
294
+
295
+ # Pass the TEST.json into your local installation of Bloodhound
296
+ > head TEST.json -n 20
297
+ {
298
+ "metadata": {
299
+ "source_kind": "GCPBase"
300
+ },
301
+ "graph": {
302
+ "nodes": [
303
+ {
304
+ "id": "allUsers",
305
+ "kinds": [
306
+ "GCPAllUsers",
307
+ "GCPPrincipal"
308
+ ],
309
+ "properties": {
310
+ "display_name": "allUsers",
311
+ "source": "iam_members"
312
+ }
313
+ },
314
+ {
315
+ "id": "combo_iambinding:RESET_COMPUTE_STARTUP_SA@project:<Project_ID>#06e0003fe1",
316
+ "kinds": [
317
+ [TRUNCATED]
318
+
319
+ ```
320
+
321
+ Optional flags:
322
+
323
+ - `--include-all`: include broader relationship output that might not be "direct priv escalations" (ex. a binding that lets you read bucket content).
324
+ - `--expand-inherited`: expand inherited IAM scope relationships.
325
+ - `--cond-eval`: currently preserves conditional workflow plumbing (placeholder behavior).
326
+ - `--reset`: clear prior OpenGraph DB state before generation.
327
+
328
+ Then import the JSON into BloodHound CE.
329
+
330
+ ### Adding Your Own Edges TLDR
331
+
332
+ If you want to add your own priv escalation (or any edges really) to be called out "by default", Just edit `og_privilege_escalation_paths.json` and add your edge. You need to know the permissions you want to flag on. We cover adding a single permission edge below, but we support multi-permission edges as described in the wiki.
333
+
334
+ #### Add a Single-Permission Edge
335
+
336
+ Let's assume we want to call out `cloudkms.cryptoKeys.update` and add it to our default single permission rules.
337
+
338
+ 1. Add to the permission --> role dictionary
339
+ - If your target permission (i.e. `cloudkms.cryptoKeys.update`) is not already included, add the permission on a newline to `scripts/build_predfined_perm_to_role_input.txt`
340
+ - With your own GCP creds (ex. a free GCP account), run `./build_predefined_perm_to_roles.sh build_predfined_perm_to_role_input.txt > perm_to_role_mappings.json` as an authenticated user. This is a bash script that just gets all permissions for all predefined rules in a GCP env to see what roles map to your permission. You could alos just add it manually to hte existing `gcpwn/data/core/mappings/og_permission_to_roles_map.json` file if you want using https://docs.cloud.google.com/iam/docs/roles-permissions
341
+ - You should see the permission --> role(s) mapping in `perm_to_role_mappings.json`. Replace `gcpwn/data/core/mappings/og_permission_to_roles_map.json` with `perm_to_role_mappings.json`
342
+ 2. Add a rule definition to `og_privilege_escalation_paths.json` (Note multi-permission rules are covered in the wiki). In our case, it might look like the netry below. Note `resource_scopes_possible` is where one might see a binding with those permisisions, and `resource_types` are the actual resource nodes you will be drawing edges to. For example, you might see `cloudkms.cryptoKeys.update` at the project level or attached directly to a key, but the end edge is going to be drawn to a key (not a project; if attached to a project gcpwn will fan out edges to keys rather than the project node).
343
+
344
+ ```json
345
+ "single_permission_rules": {
346
+ "CAN_DISABLE_KMS_KEY": {
347
+ "permission": "cloudkms.cryptoKeys.update",
348
+ "description": "Can update KMS crypto key settings including disabling or changing key behavior.",
349
+ "resource_scopes_possible": ["project", "kmscryptokey"],
350
+ "target_selector": {
351
+ "mode": "resource_types",
352
+ "resource_types": ["kmscryptokey"]
353
+ }
354
+ }
355
+ }
356
+ ```
357
+
358
+ 3. A final OpenGraph edge might then look like the following when ingested in Bloodhound
359
+
360
+ ```text
361
+ user:alice@example.com
362
+ -[HAS_IAM_BINDING]->
363
+ iambinding:roles/cloudkms.admin@project:my-project
364
+ -[CAN_DISABLE_KMS_KEY]->
365
+ resource:projects/my-project/locations/us-central1/keyRings/prod/cryptoKeys/app-key
366
+ ```
367
+
368
+ ### OpenGraph Cypher TLDR
369
+
370
+ These examples assume your OpenGraph JSON has already been imported into Neo4j/BloodHound-compatible tooling.
371
+
372
+ 1. See all nodes and edges
373
+
374
+ ```cypher
375
+ MATCH (n)-[r]->(m)
376
+ RETURN n, r, m
377
+ LIMIT 1000
378
+ ```
379
+
380
+ 2. See all nodes and edges minus service-agent-associated data
381
+
382
+ ```cypher
383
+ MATCH (n)-[r]->(m)
384
+ WHERE coalesce(n.is_service_agent, false) = false
385
+ AND coalesce(m.is_service_agent, false) = false
386
+ AND coalesce(n.service_agent_role, false) = false
387
+ AND coalesce(m.service_agent_role, false) = false
388
+ RETURN n, r, m
389
+ LIMIT 1000
390
+ ```
391
+
392
+ 3. See all nodes and edges where IAM edges are inferred only
393
+
394
+ ```cypher
395
+ MATCH (p)-[:HAS_IMPLIED_PERMISSIONS]->(g)-[r]->(t)
396
+ WHERE type(r) STARTS WITH "INFERRED_"
397
+ RETURN p, g, r, t
398
+ LIMIT 1000
399
+ ```
400
+
401
+ 4. See all nodes and edges where IAM edges are binding-based only
402
+
403
+ ```cypher
404
+ MATCH (p)-[seed:HAS_IAM_BINDING|HAS_COMBO_BINDING]->(g)
405
+ OPTIONAL MATCH (g)-[r]->(t)
406
+ WHERE r IS NULL OR NOT type(r) STARTS WITH "INFERRED_"
407
+ RETURN p, seed, g, r, t
408
+ LIMIT 1000
409
+ ```
410
+
411
+ 5. Find paths to `roles/owner` or any custom role (replace `ABC_Name`)
412
+
413
+ ```cypher
414
+ MATCH p=(principal)-[:HAS_IAM_BINDING]->(binding:GCPIamSimpleBinding)
415
+ WHERE binding.role_name IN ["roles/owner", "ABC_Name"]
416
+ OPTIONAL MATCH (binding)-[r]->(target)
417
+ RETURN principal, binding, r, target, p
418
+ LIMIT 1000
419
+ ```
420
+
421
+ 6. Identify paths where a service account leads to another service account
422
+
423
+ ```cypher
424
+ MATCH p=(sa1:GCPServiceAccount)-[*1..6]->(sa2)
425
+ WHERE (sa2:GCPServiceAccount OR sa2:GCPServiceAccountResource)
426
+ AND sa1 <> sa2
427
+ RETURN p
428
+ LIMIT 500
429
+ ```
430
+
431
+ ## Module/Data Output TLDR
432
+
433
+ ### Module output format
434
+
435
+ Default output is `text`. You can switch workspace output format with:
436
+
437
+ ```text
438
+ configs list
439
+ configs set std_output_format text
440
+ configs set std_output_format table
441
+ ```
442
+
443
+ `table` mode requires the optional dependency:
444
+
445
+ ```bash
446
+ pip install prettytable==3.17.0
447
+ ```
448
+
449
+ ### Data output and exports
450
+
451
+ ```text
452
+ # Export all collected service data to one CSV blob
453
+ data export csv
454
+
455
+ # Export all collected service data to one JSON blob
456
+ data export json
457
+
458
+ # Export all collected service data to one Excel workbook
459
+ data export excel
460
+
461
+ # Export all collected service data to a specific Excel file path
462
+ data export excel --out-file ./gcpwn_export.xlsx
463
+
464
+ # Export hierarchy image (SVG)
465
+ data export treeimage
466
+
467
+ # Run direct SQL against SQLite (service DB by default)
468
+ data sql --db service "SELECT * FROM iam_allow_policies LIMIT 25"
469
+
470
+ # Wipe service DB rows for current workspace (destructive)
471
+ data wipe-service --yes
472
+ ```
473
+
474
+ ## Dependency Inventory
475
+
476
+ Direct runtime dependencies are sourced from `requirements.txt`.
477
+
478
+ ### Core utilities
479
+
480
+ - `boto3>=1.34,<2` (includes `botocore` transitively)
481
+ - `pandas==3.0.2`
482
+ - `requests==2.33.1`
483
+ - `xlsxwriter==3.2.9`
484
+
485
+ ### Google API and auth libraries
486
+
487
+ - `google-api-core==2.30.3`
488
+ - `google-api-python-client==2.194.0`
489
+ - `google-auth-httplib2==0.3.1`
490
+ - `google-auth-oauthlib==1.3.1`
491
+
492
+ ### Google Cloud client libraries
493
+
494
+ - `google-cloud-access-approval==1.19.0`
495
+ - `google-cloud-aiplatform==1.148.0`
496
+ - `google-cloud-api-gateway==1.15.0`
497
+ - `google-cloud-api-keys==0.8.0`
498
+ - `google-cloud-appengine-admin==1.17.0`
499
+ - `google-cloud-artifact-registry==1.21.0`
500
+ - `google-cloud-batch==0.21.0`
501
+ - `google-cloud-bigquery==3.41.0`
502
+ - `google-cloud-bigtable==2.36.0`
503
+ - `google-cloud-billing==1.19.0`
504
+ - `google-cloud-build==3.36.0`
505
+ - `google-cloud-compute==1.47.0`
506
+ - `google-cloud-container==2.49.0`
507
+ - `google-cloud-dns==0.36.1`
508
+ - `google-cloud-firestore==2.27.0`
509
+ - `google-cloud-functions==1.23.0`
510
+ - `google-cloud-iam==2.22.0`
511
+ - `google-cloud-kms==3.12.0`
512
+ - `google-cloud-language==2.20.0`
513
+ - `google-cloud-logging==3.15.0`
514
+ - `google-cloud-monitoring==2.30.0`
515
+ - `google-cloud-netapp==0.9.0`
516
+ - `google-cloud-orchestration-airflow==1.20.0`
517
+ - `google-cloud-pubsub==2.37.0`
518
+ - `google-cloud-redis==2.21.0`
519
+ - `google-cloud-resource-manager==1.17.0`
520
+ - `google-cloud-run==0.16.0`
521
+ - `google-cloud-runtimeconfig==0.36.1`
522
+ - `google-cloud-scheduler==2.19.0`
523
+ - `google-cloud-secret-manager==2.27.0`
524
+ - `google-cloud-service-directory==1.17.0`
525
+ - `google-cloud-speech==2.38.0`
526
+ - `google-cloud-storage==3.10.1`
527
+ - `google-cloud-storage-transfer==1.20.0`
528
+ - `google-cloud-storageinsights==0.4.0`
529
+ - `google-cloud-tasks==2.22.0`
530
+ - `google-cloud-translate==3.26.0`
531
+ - `google-cloud-videointelligence==2.19.0`
532
+ - `google-cloud-vision==3.13.0`
533
+
534
+ ### Vertex/GenAI support
535
+
536
+ - `google-genai==1.73.1`
537
+
538
+ ### Optional extras
539
+
540
+ - `prettytable==3.17.0` via `pip install "gcpwn[table]"`
541
+
542
+ ### Dev-only extra
543
+
544
+ - `pytest>=8.0` via `pip install "gcpwn[dev]"`
545
+
546
+ ## Repository Layout
547
+
548
+ - `gcpwn/`: main package root.
549
+ - `gcpwn/__main__.py`: `python -m gcpwn` entrypoint.
550
+ - `gcpwn/cli/`: command processor and workspace command handlers.
551
+ - `gcpwn/core/`: session/config/db/runtime/export primitives.
552
+ - `gcpwn/modules/`: service modules (`everything`, `opengraph`, service-specific modules).
553
+ - `gcpwn/mappings/`: static mapping/config data used across modules.
554
+ - `gcpwn.wiki/`: local wiki/docs copy.
555
+ - `tests/`: unit/integration/module tests.
556
+ - `databases/`: SQLite stores for workspaces, sessions, and service data.
557
+
558
+ ## Who Is This For?
559
+
560
+ - **Pentesters:** automate large portions of GCP recon and exploit-path discovery.
561
+ - **Cloud security learners:** quickly map APIs/resources and permission behavior.
562
+ - **Security researchers:** batch module execution + centralized data/action collection for deeper analysis/proxying.
563
+
564
+ ## Author, Contributors, and License
565
+
566
+ - Author: NetSPI
567
+ - License: BSD-3-Clause (`LICENSE`)
568
+ - Contributors: PRs and issues welcome
569
+
570
+ ## Resources
571
+
572
+ - fwd:cloudsec 2024: https://www.youtube.com/watch?v=opvv9h3Qe0s
573
+ - DEF CON 32 Cloud Village: https://www.youtube.com/watch?v=rxXyYo1n9cw
574
+ - Introduction blog: https://www.netspi.com/blog/technical-blog/cloud-pentesting/introduction-to-gcpwn-part-1/
575
+
576
+ ## Credits
577
+
578
+ Built on the shoulders of giants; inspiration, code, and/or supporting research included from:
579
+
580
+ - GMap API Scanner: https://github.com/ozguralp/gmapsapiscanner
581
+ - Rhino Security: https://rhinosecuritylabs.com/gcp/privilege-escalation-google-cloud-platform-part-1/
582
+ - GCPBucketBrute: https://github.com/RhinoSecurityLabs/GCPBucketBrute
583
+ - Google Cloud Python docs: https://cloud.google.com/python/docs/reference