Translated ['src/README.md', 'src/banners/hacktricks-training.md', 'src/

This commit is contained in:
Translator
2024-12-31 20:18:58 +00:00
parent 820dd99aed
commit 931ae54e5f
245 changed files with 9984 additions and 12710 deletions

View File

@@ -4,65 +4,61 @@
## Lambda
For more information check:
Per ulteriori informazioni controlla:
{{#ref}}
../../aws-services/aws-lambda-enum.md
{{#endref}}
### Lambda Layer Persistence
### Persistenza dei Layer Lambda
It's possible to **introduce/backdoor a layer to execute arbitrary code** when the lambda is executed in a stealthy way:
È possibile **introdurre/backdoor un layer per eseguire codice arbitrario** quando il lambda viene eseguito in modo furtivo:
{{#ref}}
aws-lambda-layers-persistence.md
{{#endref}}
### Lambda Extension Persistence
### Persistenza delle Estensioni Lambda
Abusing Lambda Layers it's also possible to abuse extensions and persist in the lambda but also steal and modify requests.
Abusando dei Layer Lambda è anche possibile abusare delle estensioni e persistere nel lambda ma anche rubare e modificare le richieste.
{{#ref}}
aws-abusing-lambda-extensions.md
{{#endref}}
### Via resource policies
### Tramite politiche delle risorse
It's possible to grant access to different lambda actions (such as invoke or update code) to external accounts:
È possibile concedere accesso a diverse azioni lambda (come invocare o aggiornare il codice) a account esterni:
<figure><img src="../../../../images/image (255).png" alt=""><figcaption></figcaption></figure>
### Versions, Aliases & Weights
### Versioni, Alias e Pesi
A Lambda can have **different versions** (with different code each version).\
Then, you can create **different aliases with different versions** of the lambda and set different weights to each.\
This way an attacker could create a **backdoored version 1** and a **version 2 with only the legit code** and **only execute the version 1 in 1%** of the requests to remain stealth.
Un Lambda può avere **diverse versioni** (con codice diverso per ogni versione).\
Poi, puoi creare **diversi alias con diverse versioni** del lambda e impostare pesi diversi per ciascuno.\
In questo modo un attaccante potrebbe creare una **versione 1 backdoored** e una **versione 2 con solo il codice legittimo** e **eseguire solo la versione 1 nel 1%** delle richieste per rimanere furtivo.
<figure><img src="../../../../images/image (120).png" alt=""><figcaption></figcaption></figure>
### Version Backdoor + API Gateway
### Backdoor della Versione + API Gateway
1. Copy the original code of the Lambda
2. **Create a new version backdooring** the original code (or just with malicious code). Publish and **deploy that version** to $LATEST
1. Call the API gateway related to the lambda to execute the code
3. **Create a new version with the original code**, Publish and deploy that **version** to $LATEST.
1. This will hide the backdoored code in a previous version
4. Go to the API Gateway and **create a new POST method** (or choose any other method) that will execute the backdoored version of the lambda: `arn:aws:lambda:us-east-1:<acc_id>:function:<func_name>:1`
1. Note the final :1 of the arn **indicating the version of the function** (version 1 will be the backdoored one in this scenario).
5. Select the POST method created and in Actions select **`Deploy API`**
6. Now, when you **call the function via POST your Backdoor** will be invoked
1. Copia il codice originale del Lambda
2. **Crea una nuova versione backdooring** il codice originale (o solo con codice malevolo). Pubblica e **deplora quella versione** su $LATEST
1. Chiama l'API gateway relativo al lambda per eseguire il codice
3. **Crea una nuova versione con il codice originale**, Pubblica e deploara quella **versione** su $LATEST.
1. Questo nasconderà il codice backdoored in una versione precedente
4. Vai all'API Gateway e **crea un nuovo metodo POST** (o scegli un altro metodo) che eseguirà la versione backdoored del lambda: `arn:aws:lambda:us-east-1:<acc_id>:function:<func_name>:1`
1. Nota il finale :1 dell'arn **che indica la versione della funzione** (la versione 1 sarà quella backdoored in questo scenario).
5. Seleziona il metodo POST creato e in Azioni seleziona **`Deploy API`**
6. Ora, quando **chiami la funzione via POST la tua Backdoor** sarà invocata
### Cron/Event actuator
### Attuatore Cron/Event
The fact that you can make **lambda functions run when something happen or when some time pass** makes lambda a nice and common way to obtain persistence and avoid detection.\
Here you have some ideas to make your **presence in AWS more stealth by creating lambdas**.
Il fatto che puoi far **eseguire funzioni lambda quando accade qualcosa o quando passa del tempo** rende lambda un modo piacevole e comune per ottenere persistenza ed evitare la rilevazione.\
Ecco alcune idee per rendere la tua **presenza in AWS più furtiva creando lambdas**.
- Every time a new user is created lambda generates a new user key and send it to the attacker.
- Every time a new role is created lambda gives assume role permissions to compromised users.
- Every time new cloudtrail logs are generated, delete/alter them
- Ogni volta che viene creato un nuovo utente, lambda genera una nuova chiave utente e la invia all'attaccante.
- Ogni volta che viene creata una nuova ruolo, lambda concede permessi di assunzione ruolo agli utenti compromessi.
- Ogni volta che vengono generati nuovi log di cloudtrail, cancellali/modificali
{{#include ../../../../banners/hacktricks-training.md}}