Skip to content

Commit 03a213f

Browse files
committed
Secrets manager new attacks
1 parent 3da7552 commit 03a213f

File tree

2 files changed

+38
-0
lines changed

2 files changed

+38
-0
lines changed

src/pentesting-cloud/aws-security/aws-post-exploitation/aws-secrets-manager-post-exploitation.md

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,42 @@ aws secretsmanager delete-secret \
5252
--recovery-window-in-days 7
5353
```
5454

55+
## secretsmanager:RestoreSecret
56+
57+
It is possible to restore a secret, which allows the restoration of secrets that have been scheduled for deletion, since the minimum deletion period for secrets is 7 days and the maximum is 30 days. Together with the secretsmanager:GetSecretValue permission, this makes it possible to retrieve their contents.
58+
59+
To recover a secret that is in the process of being deleted, you can use the following command:
60+
```bash
61+
aws secretsmanager restore-secret \
62+
--secret-id <Secret_Name>
63+
```
64+
65+
## secretsmanager:DeleteResourcePolicy, DoS
66+
67+
This action allows deleting the resource policy that controls who can access a secret. This could lead to a DoS if the resource policy was configured to allow access to a specific set of users.
68+
69+
To delete the resource policy:
70+
```bash
71+
aws secretsmanager delete-resource-policy \
72+
--secret-id <Secret_Name>
73+
```
74+
75+
## secretsmanager:UpdateSecretVersionStage, DoS
76+
77+
The states of a secret are used to manage versions of a secret. AWSCURRENT marks the active version that applications use, AWSPREVIOUS keeps the previous version so that you can roll back if necessary, and AWSPENDING is used in the rotation process to prepare and validate a new version before making it the current one.
78+
79+
Applications always read the version with AWSCURRENT. If someone moves that label to the wrong version, the apps will use invalid credentials and may fail.
80+
81+
AWSPREVIOUS is not used automatically. However, if AWSCURRENT is removed or reassigned incorrectly, it may appear that everything is still running with the previous version.
82+
83+
```bash
84+
aws secretsmanager update-secret-version-stage \
85+
--secret-id <your-secret-name-or-arn> \
86+
--version-stage AWSCURRENT \
87+
--move-to-version-id <target-version-id> \
88+
--remove-from-version-id <previous-version-id>
89+
```
90+
5591
{{#include ../../../banners/hacktricks-training.md}}
5692

5793

src/pentesting-cloud/aws-security/aws-privilege-escalation/aws-secrets-manager-privesc.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@ An attacker with this permission can get the **saved value inside a secret** in
1818
aws secretsmanager get-secret-value --secret-id <secret_name> # Get value
1919
```
2020

21+
`secretsmanager:BatchGetSecretValue` needs also `secretsmanager:GetSecretValue` to retrieve the secrets.
22+
2123
**Potential Impact:** Access high sensitive data inside AWS secrets manager service.
2224

2325
### `secretsmanager:GetResourcePolicy`, `secretsmanager:PutResourcePolicy`, (`secretsmanager:ListSecrets`)

0 commit comments

Comments
 (0)