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

This commit is contained in:
Translator
2025-01-09 01:06:24 +00:00
parent 20b894fccc
commit 1224f1d1a5
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**: Інтегрується з іншими сервісами GCP, такими як Cloud Build, Pub/Sub та App Engine для повної трасованості від коду до розгортання.
3. **Приватні репозиторії**: Забезпечує безпечне та приватне зберігання вашого коду. Ви можете контролювати доступ, використовуючи ролі Cloud Identity and Access Management (IAM).
4. **Аналіз вихідного коду**: Працює з іншими інструментами GCP для автоматизованого аналізу вашого вихідного коду, виявляючи потенційні проблеми, такі як помилки, вразливості або погані практики кодування.
5. **Інструменти для співпраці**: Підтримує спільне кодування з такими інструментами, як запити на злиття, коментарі та огляди.
6. **Підтримка дзеркал**: Дозволяє підключати Cloud Source Repositories до репозиторіїв, розміщених на GitHub або Bitbucket, забезпечуючи автоматичну синхронізацію та надаючи єдиний вигляд усіх ваших репозиторіїв.
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**. Однак, **я не думаю, що можливо вкрасти його токен** з Source Repositories, оскільки він виконується у фоновому режимі.
- Щоб побачити код всередині веб-консолі GCP Cloud Source Repositories ([https://source.cloud.google.com/](https://source.cloud.google.com/)), вам потрібно, щоб код був **за замовчуванням у гілці master**.
- Ви також можете **створити дзеркальний Cloud Repository**, вказуючи на репозиторій з **Github** або **Bitbucket** (надаючи доступ до цих платформ).
- Можливо **кодувати та налагоджувати зсередини GCP**.
- За замовчуванням, Source Repositories **запобігає пушу приватних ключів у коміти**, але це можна вимкнути.
- 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}}