Skip to content

Commit 967a945

Browse files
committed
f
1 parent 6e1f623 commit 967a945

2 files changed

Lines changed: 25 additions & 3 deletions

File tree

  • src/pentesting-cloud/aws-security
    • aws-post-exploitation/aws-kms-post-exploitation
    • aws-privilege-escalation/aws-iam-privesc

src/pentesting-cloud/aws-security/aws-post-exploitation/aws-kms-post-exploitation/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ There is another way to perform a global KMS Ransomware, which would involve the
113113

114114
### Delete Keys via kms:DeleteImportedKeyMaterial
115115

116-
With the `kms:DeleteImportedKeyMaterial` permission, an actor can delete the imported key material from CMKs with `Origin=EXTERNAL` (CMKs that have imperted their key material), making them unable to decrypt data. This action is destructive and irreversible unless compatible material is re-imported, allowing an attacker to effectively cause ransomware-like data loss by rendering encrypted information permanently inaccessible.
116+
With the `kms:DeleteImportedKeyMaterial` permission, an actor can delete the imported key material from CMKs with `Origin=EXTERNAL` (CMKs that have imported their key material), making them unable to decrypt data. This action is destructive and irreversible unless compatible material is re-imported, allowing an attacker to effectively cause ransomware-like data loss by rendering encrypted information permanently inaccessible.
117117

118118
```bash
119119
aws kms delete-imported-key-material --key-id <Key_ID>

src/pentesting-cloud/aws-security/aws-privilege-escalation/aws-iam-privesc/README.md

Lines changed: 24 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ aws iam set-default-policy-version --policy-arn <target_policy_arn> --version-id
3535

3636
**Impact:** Indirect privilege escalation by enabling more permissions.
3737

38-
### **`iam:CreateAccessKey`**
38+
### **`iam:CreateAccessKey`, (`iam:DeleteAccessKey`)**
3939

4040
Enables creating access key ID and secret access key for another user, leading to potential privilege escalation.
4141

@@ -47,6 +47,29 @@ aws iam create-access-key --user-name <target_user>
4747

4848
**Impact:** Direct privilege escalation by assuming another user's extended permissions.
4949

50+
Note that a user can only have 2 access keys created, so if a user already has 2 access keys you will need the permission `iam:DeleteAccessKey` to detele one of them to be able to create a new one:
51+
52+
```bash
53+
aws iam delete-access-key --uaccess-key-id <key_id>
54+
```
55+
56+
### **`iam:CreateVirtualMFADevice` + `iam:EnableMFADevice`**
57+
58+
If you can create a new virtual MFA device and enable it on another user, you can effectively enroll your own MFA for that user and then request an MFA-backed session for their credentials.
59+
60+
**Exploit:**
61+
62+
```bash
63+
# Create a virtual MFA device (this returns the serial and the base32 seed)
64+
aws iam create-virtual-mfa-device --virtual-mfa-device-name <mfa_name>
65+
66+
# Generate 2 consecutive TOTP codes from the seed, then enable it for the user
67+
aws iam enable-mfa-device --user-name <target_user> --serial-number <serial> \
68+
--authentication-code1 <code1> --authentication-code2 <code2>
69+
```
70+
71+
**Impact:** Direct privilege escalation by taking over a user's MFA enrollment (and then using their permissions).
72+
5073
### **`iam:CreateLoginProfile` | `iam:UpdateLoginProfile`**
5174

5275
Permits creating or updating a login profile, including setting passwords for AWS console login, leading to direct privilege escalation.
@@ -308,4 +331,3 @@ aws iam put-role-permissions-boundary \
308331
{{#include ../../../../banners/hacktricks-training.md}}
309332

310333

311-

0 commit comments

Comments
 (0)