carlospolop / PurplePanda

Identify privilege escalation paths within and across different clouds
Other
657 stars 82 forks source link

TypeError: 'GcpProject' object is not subscriptable #23

Closed meneerkrabs closed 5 days ago

meneerkrabs commented 1 year ago

When running your amazing tool on a few service accounts that I found, I get the following error: [12:56:47] INFO INFO:core.utils.purplepanda:Enumerating purplepanda.py:187 google... [12:56:48] disc_orgs took 0s purplepanda.py:75 [12:56:49] disc_folders took 0s purplepanda.py:75 [12:56:50] disc_projects took 0s purplepanda.py:75 [12:56:50] WARNING WARNING:core.db.customogm:Objects of class customogm.py:73 <class 'intel.google.models.gcp_organization.GcpOrg anization'> where searched for but nothing was found WARNING WARNING:core.db.customogm:Objects of class customogm.py:73 <class 'intel.google.models.gcp_folder.GcpFolder'> where searched for but nothing was found disc_org_policies.orgs took 0s purplepanda.py:75 disc_org_policies.folders took 0s purplepanda.py:75 [12:56:51] disc_org_policies.projects took 0s purplepanda.py:75 [12:56:51] WARNING WARNING:core.db.customogm:Objects of class customogm.py:73 <class 'intel.google.models.gcp_organization.GcpOrg anization'> where searched for but nothing was found [12:56:52] disc_custom_roles_permissions took 0s purplepanda.py:75 disc_sa._disc_sas took 0s purplepanda.py:75 [12:56:52] WARNING WARNING:core.db.customogm:Objects of class customogm.py:73 <class 'intel.google.models.gcp_service_account.Gcp ServiceAccount'> where searched for but nothing was found disc_sa._disc_special_sas took 0s purplepanda.py:75 WARNING WARNING:core.db.customogm:Objects of class customogm.py:73 <class 'intel.google.models.gcp_workspace.GcpWorksp ace'> where searched for but nothing was found [12:56:53] disc_storage took 0s purplepanda.py:75 disc_compute_subnetworks took 0s purplepanda.py:75 [12:56:54] disc_clusters took 0s purplepanda.py:75 [12:56:55] disc_secrets took 0s purplepanda.py:75 disc_composer took 0s purplepanda.py:75 disc_pubsub took 0s purplepanda.py:75 disc_compute_instances took 0s purplepanda.py:75 disc_sourcerepo took 0s purplepanda.py:75 disc_cloud_run took 0s purplepanda.py:75 disc_cloud_functions took 0s purplepanda.py:75 disc_cloudbuild._disc_builds took 0s purplepanda.py:75 disc_dns took 0s purplepanda.py:75 disc_sql took 0s purplepanda.py:75 disc_pubsub.subscriptions took 0s purplepanda.py:75 [12:56:56] disc_compute_networks took 0s purplepanda.py:75 disc_pubsub.schemas took 0s purplepanda.py:75 [12:56:57] disc_cloudbuild._disc_triggers took 1s purplepanda.py:75 [12:57:46] disc_kms took 51s purplepanda.py:75 Google disc_bigquery ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 0.0% • 1 • 0:00:52 ⠼ Traceback (most recent call last): File "/Users/testuser/PurplePanda/main.py", line 216, in <module> main() File "/Users/testuser/PurplePanda/main.py", line 188, in main PurplePanda().start_discovery(functions) File "/Users/testuser/PurplePanda/core/utils/purplepanda.py", line 197, in start_discovery t.result() File "/Users/testuser/opt/anaconda3/lib/python3.9/concurrent/futures/_base.py", line 439, in result return self.__get_result() File "/Users/testuser/opt/anaconda3/lib/python3.9/concurrent/futures/_base.py", line 391, in __get_result raise self._exception File "/Users/testuser/opt/anaconda3/lib/python3.9/concurrent/futures/thread.py", line 58, in run result = self.fn(*self.args, **self.kwargs) File "/Users/testuser/PurplePanda/intel/google/purplepanda_google.py", line 76, in discover DiscoverSaas( File "/Users/testuser/PurplePanda/core/utils/discover_saas.py", line 17, in do_discovery self._call_f(f) File "/Users/testuser/PurplePanda/core/utils/discover_saas.py", line 44, in _call_f func() File "/Users/testuser/PurplePanda/core/utils/discover_saas.py", line 27, in do_discovery t.result() File "/Users/testuser/opt/anaconda3/lib/python3.9/concurrent/futures/_base.py", line 439, in result return self.__get_result() File "/Users/testuser/opt/anaconda3/lib/python3.9/concurrent/futures/_base.py", line 391, in __get_result raise self._exception File "/Users/testuser/opt/anaconda3/lib/python3.9/concurrent/futures/thread.py", line 58, in run result = self.fn(*self.args, **self.kwargs) File "/Users/testuser/PurplePanda/core/utils/discover_saas.py", line 39, in _do_parallel self._call_f(f) File "/Users/testuser/PurplePanda/core/utils/discover_saas.py", line 44, in _call_f func() File "/Users/testuser/PurplePanda/core/utils/purplepanda.py", line 56, in discover self._disc() File "/Users/testuser/PurplePanda/intel/google/discovery/disc_bigquery.py", line 20, in _disc self._disc_loop(projects, self._disc_datasets, __name__.split(".")[-1]) File "/Users/testuser/PurplePanda/core/utils/purplepanda.py", line 68, in _disc_loop func(item, **kwargs) # Here the keyworded arguments are being passed to the function File "/Users/testuser/PurplePanda/intel/google/discovery/disc_bigquery.py", line 26, in _disc_datasets project_id: str = project["id"] TypeError: 'GcpProject' object is not subscriptable

Maybe because the service accounts have too few permissions?

carlospolop commented 1 year ago

hey @meneerkrabs! hmm, it's complicated to say why is this occurring just with this info. Anyway, I think the error shouldn't happen even if you cannot access anything. But again, I'm not sure about how to debug this with access to the env or more hints about what could be causing this

carlospolop commented 5 days ago

I think this was fixed, although let me know if it isn't please