mirror of
https://github.com/HackTricks-wiki/hacktricks-cloud.git
synced 2026-01-09 11:44:59 -08:00
Translated ['src/README.md', 'src/banners/hacktricks-training.md', 'src/
This commit is contained in:
@@ -4,62 +4,57 @@
|
||||
|
||||
## STS
|
||||
|
||||
**AWS Security Token Service (STS)** is primarily designed to issue **temporary, limited-privilege credentials**. These credentials can be requested for **AWS Identity and Access Management (IAM)** users or for authenticated users (federated users).
|
||||
**AWS Security Token Service (STS)** è principalmente progettato per emettere **credenziali temporanee e con privilegi limitati**. Queste credenziali possono essere richieste per **AWS Identity and Access Management (IAM)** utenti o per utenti autenticati (utenti federati).
|
||||
|
||||
Given that STS's purpose is to **issue credentials for identity impersonation**, the service is immensely valuable for **escalating privileges and maintaining persistence**, even though it might not have a wide array of options.
|
||||
Dato che lo scopo di STS è **emettere credenziali per impersonificazione dell'identità**, il servizio è immensamente prezioso per **l'escalation dei privilegi e il mantenimento della persistenza**, anche se potrebbe non avere una vasta gamma di opzioni.
|
||||
|
||||
### Assume Role Impersonation
|
||||
### Impersonificazione del Ruolo Assunto
|
||||
|
||||
The action [AssumeRole](https://docs.aws.amazon.com/STS/latest/APIReference/API_AssumeRole.html) provided by AWS STS is crucial as it permits a principal to acquire credentials for another principal, essentially impersonating them. Upon invocation, it responds with an access key ID, a secret key, and a session token corresponding to the specified ARN.
|
||||
L'azione [AssumeRole](https://docs.aws.amazon.com/STS/latest/APIReference/API_AssumeRole.html) fornita da AWS STS è cruciale in quanto consente a un principale di acquisire credenziali per un altro principale, impersonandolo essenzialmente. Al momento dell'invocazione, risponde con un ID chiave di accesso, una chiave segreta e un token di sessione corrispondente all'ARN specificato.
|
||||
|
||||
For Penetration Testers or Red Team members, this technique is instrumental for privilege escalation (as elaborated [**here**](../aws-privilege-escalation/aws-sts-privesc.md#sts-assumerole)). However, it's worth noting that this technique is quite conspicuous and may not catch an attacker off guard.
|
||||
Per i Tester di Penetrazione o i membri del Red Team, questa tecnica è strumentale per l'escalation dei privilegi (come elaborato [**qui**](../aws-privilege-escalation/aws-sts-privesc.md#sts-assumerole)). Tuttavia, vale la pena notare che questa tecnica è piuttosto evidente e potrebbe non sorprendere un attaccante.
|
||||
|
||||
#### Assume Role Logic
|
||||
|
||||
In order to assume a role in the same account if the **role to assume is allowing specifically a role ARN** like in:
|
||||
#### Logica del Ruolo Assunto
|
||||
|
||||
Per assumere un ruolo nello stesso account se il **ruolo da assumere consente specificamente un ARN di ruolo** come in:
|
||||
```json
|
||||
{
|
||||
"Version": "2012-10-17",
|
||||
"Statement": [
|
||||
{
|
||||
"Effect": "Allow",
|
||||
"Principal": {
|
||||
"AWS": "arn:aws:iam::<acc_id>:role/priv-role"
|
||||
},
|
||||
"Action": "sts:AssumeRole",
|
||||
"Condition": {}
|
||||
}
|
||||
]
|
||||
"Version": "2012-10-17",
|
||||
"Statement": [
|
||||
{
|
||||
"Effect": "Allow",
|
||||
"Principal": {
|
||||
"AWS": "arn:aws:iam::<acc_id>:role/priv-role"
|
||||
},
|
||||
"Action": "sts:AssumeRole",
|
||||
"Condition": {}
|
||||
}
|
||||
]
|
||||
}
|
||||
```
|
||||
Il ruolo **`priv-role`** in questo caso, **non ha bisogno di essere specificamente autorizzato** ad assumere quel ruolo (con quella autorizzazione è sufficiente).
|
||||
|
||||
The role **`priv-role`** in this case, **doesn't need to be specifically allowed** to assume that role (with that allowance is enough).
|
||||
|
||||
However, if a role is allowing an account to assume it, like in:
|
||||
|
||||
Tuttavia, se un ruolo consente a un account di assumerlo, come in:
|
||||
```json
|
||||
{
|
||||
"Version": "2012-10-17",
|
||||
"Statement": [
|
||||
{
|
||||
"Effect": "Allow",
|
||||
"Principal": {
|
||||
"AWS": "arn:aws:iam::<acc_id>:root"
|
||||
},
|
||||
"Action": "sts:AssumeRole",
|
||||
"Condition": {}
|
||||
}
|
||||
]
|
||||
"Version": "2012-10-17",
|
||||
"Statement": [
|
||||
{
|
||||
"Effect": "Allow",
|
||||
"Principal": {
|
||||
"AWS": "arn:aws:iam::<acc_id>:root"
|
||||
},
|
||||
"Action": "sts:AssumeRole",
|
||||
"Condition": {}
|
||||
}
|
||||
]
|
||||
}
|
||||
```
|
||||
Il ruolo che si sta cercando di assumere avrà bisogno di un **permesso `sts:AssumeRole` specifico** su quel ruolo **per assumerlo**.
|
||||
|
||||
The role trying to assume it will need a **specific `sts:AssumeRole` permission** over that role **to assume it**.
|
||||
|
||||
If you try to assume a **role** **from a different account**, the **assumed role must allow it** (indicating the role **ARN** or the **external account**), and the **role trying to assume** the other one **MUST** to h**ave permissions to assume it** (in this case this isn't optional even if the assumed role is specifying an ARN).
|
||||
|
||||
### Enumeration
|
||||
Se si tenta di assumere un **ruolo** **da un altro account**, il **ruolo assunto deve consentirlo** (indicando l'**ARN** del ruolo o l'**account esterno**), e il **ruolo che sta cercando di assumere** l'altro **DEVE** avere **permessi per assumerlo** (in questo caso non è opzionale anche se il ruolo assunto specifica un ARN).
|
||||
|
||||
### Enumerazione
|
||||
```bash
|
||||
# Get basic info of the creds
|
||||
aws sts get-caller-identity
|
||||
@@ -72,10 +67,9 @@ aws sts get-session-token
|
||||
## MFA
|
||||
aws sts get-session-token --serial-number <arn_device> --token-code <otp_code>
|
||||
```
|
||||
|
||||
### Privesc
|
||||
|
||||
In the following page you can check how to **abuse STS permissions to escalate privileges**:
|
||||
Nella pagina seguente puoi controllare come **abuse STS permissions to escalate privileges**:
|
||||
|
||||
{{#ref}}
|
||||
../aws-privilege-escalation/aws-sts-privesc.md
|
||||
@@ -98,7 +92,3 @@ In the following page you can check how to **abuse STS permissions to escalate p
|
||||
- [https://blog.christophetd.fr/retrieving-aws-security-credentials-from-the-aws-console/?utm_source=pocket_mylist](https://blog.christophetd.fr/retrieving-aws-security-credentials-from-the-aws-console/?utm_source=pocket_mylist)
|
||||
|
||||
{{#include ../../../banners/hacktricks-training.md}}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user