Translated ['src/pentesting-cloud/azure-security/az-privilege-escalation

This commit is contained in:
Translator
2025-01-09 01:06:33 +00:00
parent 18e74de74d
commit 3cda3838cf
2 changed files with 61 additions and 44 deletions

View File

@@ -2,36 +2,37 @@
{{#include ../../../banners/hacktricks-training.md}}
## Grundinformationen <a href="#reviewing-cloud-git-repositories" id="reviewing-cloud-git-repositories"></a>
## Basic Information <a href="#reviewing-cloud-git-repositories" id="reviewing-cloud-git-repositories"></a>
Google Cloud Source Repositories ist ein vollständig ausgestatteter, skalierbarer, **privater Git-Repository-Dienst**. Er wurde entwickelt, um **Ihren Quellcode in einer vollständig verwalteten Umgebung zu hosten**, die nahtlos mit anderen GCP-Tools und -Diensten integriert ist. Er bietet einen kollaborativen und sicheren Ort für Teams, um ihren Code zu speichern, zu verwalten und zu verfolgen.
Google Cloud Source Repositories is a fully-featured, scalable, **private Git repository service**. It's designed to **host your source code in a fully managed environment**, integrating seamlessly with other GCP tools and services. It offers a collaborative and secure place for teams to store, manage, and track their code.
Wichtige Funktionen von Cloud Source Repositories sind:
Key features of Cloud Source Repositories include:
1. **Vollständig verwaltetes Git-Hosting**: Bietet die vertraute Funktionalität von Git, was bedeutet, dass Sie reguläre Git-Befehle und -Workflows verwenden können.
2. **Integration mit GCP-Diensten**: Integriert sich mit anderen GCP-Diensten wie Cloud Build, Pub/Sub und App Engine für eine durchgängige Nachverfolgbarkeit vom Code bis zur Bereitstellung.
3. **Private Repositories**: Stellt sicher, dass Ihr Code sicher und privat gespeichert wird. Sie können den Zugriff mit Cloud Identity and Access Management (IAM)-Rollen steuern.
4. **Quellcodeanalyse**: Arbeitet mit anderen GCP-Tools zusammen, um eine automatisierte Analyse Ihres Quellcodes bereitzustellen, die potenzielle Probleme wie Bugs, Sicherheitsanfälligkeiten oder schlechte Programmierpraktiken identifiziert.
5. **Kollaborationstools**: Unterstützt kollaboratives Codieren mit Tools wie Merge-Anfragen, Kommentaren und Überprüfungen.
6. **Spiegelunterstützung**: Ermöglicht es Ihnen, Cloud Source Repositories mit Repositories zu verbinden, die auf GitHub oder Bitbucket gehostet werden, wodurch eine automatische Synchronisierung ermöglicht und eine einheitliche Ansicht aller Ihrer Repositories bereitgestellt wird.
1. **Fully Managed Git Hosting**: Offers the familiar functionality of Git, meaning you can use regular Git commands and workflows.
2. **Integration with GCP Services**: Integrates with other GCP services like Cloud Build, Pub/Sub, and App Engine for end-to-end traceability from code to deployment.
3. **Private Repositories**: Ensures your code is stored securely and privately. You can control access using Cloud Identity and Access Management (IAM) roles.
4. **Source Code Analysis**: Works with other GCP tools to provide automated analysis of your source code, identifying potential issues like bugs, vulnerabilities, or bad coding practices.
5. **Collaboration Tools**: Supports collaborative coding with tools like merge requests, comments, and reviews.
6. **Mirror Support**: Allows you to connect Cloud Source Repositories with repositories hosted on GitHub or Bitbucket, enabling automatic synchronization and providing a unified view of all your repositories.
### OffSec-Informationen <a href="#reviewing-cloud-git-repositories" id="reviewing-cloud-git-repositories"></a>
### OffSec information <a href="#reviewing-cloud-git-repositories" id="reviewing-cloud-git-repositories"></a>
- Die Konfiguration der Quell-Repositorys innerhalb eines Projekts wird ein **Service-Konto** haben, das zum Veröffentlichen von Cloud Pub/Sub-Nachrichten verwendet wird. Das standardmäßig verwendete ist das **Compute SA**. Ich glaube jedoch, **dass es nicht möglich ist, sein Token** aus den Source Repositories zu stehlen, da es im Hintergrund ausgeführt wird.
- Um den Code in der GCP Cloud Source Repositories-Webkonsole ([https://source.cloud.google.com/](https://source.cloud.google.com/)) zu sehen, muss der Code **standardmäßig im Master-Branch sein**.
- Sie können auch **ein Spiegel-Cloud-Repository** erstellen, das auf ein Repo von **Github** oder **Bitbucket** verweist (indem Sie Zugriff auf diese Plattformen gewähren).
- Es ist möglich, **aus GCP heraus zu codieren und zu debuggen**.
- Standardmäßig **verhindert Source Repositories, dass private Schlüssel in Commits gepusht werden**, aber dies kann deaktiviert werden.
- The source repositories configuration inside a project will have a **Service Account** used to publishing Cloud Pub/Sub messages. The default one used is the **Compute SA**. However, **I don't think it's possible steal its token** from Source Repositories as it's being executed in the background.
- To see the code inside the GCP Cloud Source Repositories web console ([https://source.cloud.google.com/](https://source.cloud.google.com/)), you need the code to be **inside master branch by default**.
- You can also **create a mirror Cloud Repository** pointing to a repo from **Github** or **Bitbucket** (giving access to those platforms).
- It's possible to **code & debug from inside GCP**.
- By default, Source Repositories **prevents private keys to be pushed in commits**, but this can be disabled.
### Im Cloud Shell öffnen
### Open In Cloud Shell
Es ist möglich, das Repository im Cloud Shell zu öffnen, ein Prompt wie dieser wird erscheinen:
It's possible to open the repository in Cloud Shell, a prompt like this one will appear:
<figure><img src="../../../images/image (325).png" alt=""><figcaption></figcaption></figure>
Dies ermöglicht es Ihnen, im Cloud Shell zu codieren und zu debuggen (was dazu führen könnte, dass cloudshell kompromittiert wird).
This will allow you to code and debug in Cloud Shell (which could get cloudshell compromised).
### Enumeration
```bash
# Repos enumeration
gcloud source repos list #Get names and URLs
@@ -42,7 +43,7 @@ gcloud source repos get-iam-policy <repo_name>
gcloud source repos clone <REPO NAME>
gcloud source repos get-iam-policy <REPO NAME>
... git add & git commit -m ...
git push --set-upstream origin master
git push --set-upstream origin $BRANCH
git push -u origin master
# Access via git
@@ -50,16 +51,20 @@ git push -u origin master
git clone ssh://username@domain.com@source.developers.google.com:2022/p/<proj-name>/r/<repo-name>
git add, commit, push...
```
### Privilegienerhöhung & Nachausnutzung
### Privilege Escalation & Post Exploitation
{{#ref}}
../gcp-privilege-escalation/gcp-sourcerepos-privesc.md
{{#endref}}
### Unauthentifiziertes Enum
### Unauthenticated Enum
{{#ref}}
../gcp-unauthenticated-enum-and-access/gcp-source-repositories-unauthenticated-enum.md
{{#endref}}
{{#include ../../../banners/hacktricks-training.md}}