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

This commit is contained in:
Translator
2025-01-09 01:06:17 +00:00
parent 655a6c1ffc
commit 03fd07629f
2 changed files with 63 additions and 46 deletions

View File

@@ -1,37 +1,38 @@
# GCP - ソースリポジトリの列挙
# GCP - Source Repositories Enum
{{#include ../../../banners/hacktricks-training.md}}
## 基本情報 <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は、完全に機能し、スケーラブルな**プライベートGitリポジトリサービス**です。これは、**完全に管理された環境でソースコードをホストする**ように設計されており、他のGCPツールやサービスとシームレスに統合されます。チームがコードを保存、管理、追跡するための協力的で安全な場所を提供します。
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.
Cloud Source Repositoriesの主な機能は次のとおりです:
Key features of Cloud Source Repositories include:
1. **完全管理されたGitホスティング**Gitの一般的な機能を提供し、通常のGitコマンドやワークフローを使用できます。
2. **GCPサービスとの統合**Cloud BuildPub/SubApp Engineなどの他のGCPサービスと統合され、コードからデプロイメントまでのエンドツーエンドのトレーサビリティを提供します。
3. **プライベートリポジトリ**:コードが安全かつプライベートに保存されることを保証します。Cloud Identity and Access Management (IAM)ロールを使用してアクセスを制御できます。
4. **ソースコード分析**他のGCPツールと連携して、ソースコードの自動分析を提供し、バグ、脆弱性、または悪いコーディングプラクティスなどの潜在的な問題を特定します。
5. **コラボレーションツール**:マージリクエスト、コメント、レビューなどのツールを使用して、協力的なコーディングをサポートします。
6. **ミラーサポート**Cloud Source RepositoriesをGitHubBitbucketにホストされたリポジトリと接続でき、自動同期を可能にし、すべてのリポジトリの統一ビューを提供します。
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情報 <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>
- プロジェクト内のソースリポジトリの設定には、Cloud Pub/Subメッセージを公開するために使用される**サービスアカウント**があります。デフォルトで使用されるのは**Compute SA**です。ただし、**ソースリポジトリからそのトークンを盗むことは不可能だと思います**。これはバックグラウンドで実行されているためです。
- GCP Cloud Source RepositoriesのWebコンソール内のコードを見るには、コードが**デフォルトでマスターブランチ内にある必要があります**。
- **Github**または**Bitbucket**のリポジトリを指す**ミラーCloudリポジトリ**を**作成することもできます**(これらのプラットフォームへのアクセスを提供します)。
- **GCP内からコードを記述およびデバッグすることが可能です**。
- デフォルトでは、ソースリポジトリは**プライベートキーがコミットにプッシュされるのを防ぎます**が、これを無効にすることができます。
- 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.
### Cloud Shellで開く
### Open In Cloud Shell
Cloud Shellでリポジトリを開くことが可能で、次のようなプロンプトが表示されます
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>
これにより、Cloud Shellでコードを記述およびデバッグできますこれによりcloudshellが侵害される可能性があります
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...
```
### 権限昇格とポストエクスプロイト
### Privilege Escalation & Post Exploitation
{{#ref}}
../gcp-privilege-escalation/gcp-sourcerepos-privesc.md
{{#endref}}
### 認証されていない列挙
### Unauthenticated Enum
{{#ref}}
../gcp-unauthenticated-enum-and-access/gcp-source-repositories-unauthenticated-enum.md
{{#endref}}
{{#include ../../../banners/hacktricks-training.md}}