Translated ['', 'src/pentesting-cloud/aws-security/aws-services/aws-ec2-

This commit is contained in:
Translator
2026-05-26 19:15:33 +00:00
parent 817f6c3bb4
commit 1856fadd27
@@ -4,7 +4,7 @@
## VPC & Networking
जानें कि VPC क्या है और इसके घटकों के बारे में:
VPC क्या है और इसके components के बारे में यहाँ जानें:
{{#ref}}
aws-vpc-and-networking-basic-information.md
@@ -12,30 +12,30 @@ aws-vpc-and-networking-basic-information.md
## EC2
Amazon EC2 का उपयोग **वर्चुअल सर्वर** आरंभ करने के लिए किया जाता है। यह **सुरक्षा** और **नेटवर्किंग** की कॉन्फ़िगरेशन और **स्टोरेज** के प्रबंधन की सुविधा प्रदान करता है। Amazon EC2 की लचीलापन इसके संसाधनों को ऊपर और नीचे दोनों तरह से स्केल करने की क्षमता में दिखाई देती है, जिससे यह बदलती आवश्यकताओं या लोकप्रियता में वृद्धि के साथ प्रभावी रूप से अनुकूल हो जाता है। यह सुविधा सटीक ट्रैफिक पूर्वानुमान की आवश्यकता को कम कर देती है।
Amazon EC2 का उपयोग **virtual servers** शुरू करने के लिए किया जाता है। यह **security** और **networking** के configuration तथा **storage** के management की अनुमति देता है। Amazon EC2 की flexibility इसकी इस क्षमता में दिखती है कि यह resources को ऊपर और नीचे दोनों तरह scale कर सकता है, जिससे varying requirement changes या popularity में surge के अनुसार आसानी से adapt किया जा सकता है। यह feature precise traffic predictions की आवश्यकता को कम करता है।
EC2 में enumerate करने योग्य दिलचस्प चीज़ें:
EC2 में enumerate करने लायक interesting चीज़ें:
- वर्चुअल मशीनें
- Virtual Machines
- SSH Keys
- User Data
- Existing EC2s/AMIs/Snapshots
- नेटवर्किंग
- नेटवर्क्स
- सबनेटवर्क्स
- Networking
- Networks
- Subnetworks
- Public IPs
- Open ports
- AWS के बाहर अन्य नेटवर्क्स के साथ एकीकृत कनेक्शन
- AWS के बाहर अन्य networks के साथ integrated connections
### Instance Profiles
EC2 instances पर चलने वाले applications को permissions देने के लिए **roles** का उपयोग करने में थोड़ी अतिरिक्त कॉन्फ़िगरेशन की आवश्यकता होती है। EC2 instance पर चल रहा कोई application virtualized operating system के कारण AWS से अलग होता है। इस अतिरिक्त पृथक्करण के कारण, आपको किसी EC2 instance को एक AWS role और उससंबंधित permissions असाइन करने और उन्हें उसके applications के लिए उपलब्ध कराने के लिए एक अतिरिक्त कदम उठाना पड़ता है
**roles** का उपयोग करके **EC2 instances** पर चलने वाले applications को permissions देना थोड़ा extra configuration मांगता है। EC2 instance पर चल रहा application virtualized operating system के कारण AWS से abstracted होता है। इस extra separation की वजह से, आपको AWS role और उसजुड़ी permissions को EC2 instance पर assign करने और उन्हें उसके applications के लिए उपलब्ध कराने के लिए एक अतिरिक्त step चाहिए
यह अतिरिक्त कदम instance से जुड़े एक [_**instance profile**_](https://docs.aws.amazon.com/IAM/latest/UserGuide/id_roles_use_switch-role-ec2_instance-profiles.html) का निर्माण है। The **instance profile contains the role and** एप्लिकेशन को instance पर चलने वाले उन रोल्स के अस्थायी क्रेडेंशियल प्रदान कर सकता है। ये अस्थायी क्रेडेंशियल फिर application's API कॉल्स में उपयोग करके resources तक पहुँचने और रोल द्वारा निर्दिष्ट केवल उन्हीं resources तक पहुँच को सीमित करने के लिए उपयोग किए जा सकत हैं। ध्यान दें कि **only one role can be assigned to an EC2 instance** एक समय में, और instance पर सभी applications एक ही role और permissions साझा करते हैं।
यह extra step instance से जुड़ा हुए [_**instance profile**_](https://docs.aws.amazon.com/IAM/latest/UserGuide/id_roles_use_switch-role-ec2_instance-profiles.html) का **creation** है। **instance profile role को contain करता है** और instance पर चलने वाले application को role के temporary credentials दे सकता है। फिर इन temporary credentials का उपयोग application के API calls में resources access करने के लिए किया जा सकता है, और access को केवल उन resources तक सीमित किया जा सकत है जिन्हें role specify करता है। ध्यान दें कि **एक समय में EC2 instance को केवल एक role assign किया जा सकता है**, और instance पर सभी applications ही role और permissions share करते हैं।
### Metadata Endpoint
AWS EC2 metadata वह जानकारी है जो किसी Amazon Elastic Compute Cloud (EC2) instance के बारे में runtime पर instance के लिए उपलब्ध होती है। यह metadata instance के बारे में जानकारी प्रदान करने के लिए उपयोग की जात है, जैसे उसका instance ID, वह availability zone जिसमें यह चल रहा है, instance से जुड़ा हुआ IAM role, और instance का hostname।
AWS EC2 metadata Amazon Elastic Compute Cloud (EC2) instance के बारे में information है जो runtime पर instance क उपलब्ध होती है। इस metadata का उपयोग instance के बारे में information देने के लिए किया जात है, जैसे उसका instance ID, वह availability zone जिसमें यह चल रहा है, instance से associated IAM role, और instance का hostname।
{{#ref}}
https://book.hacktricks.wiki/en/pentesting-web/ssrf-server-side-request-forgery/cloud-ssrf.html
@@ -138,7 +138,7 @@ aws ec2 describe-vpc-peering-connections
### Privesc
निम्नलिखित पृष्ठ पर आप देख सकते हैं कि कैसे **abuse EC2 permissions to escalate privileges**:
In the following page you can check how to **abuse EC2 permissions to escalate privileges**:
{{#ref}}
../../aws-privilege-escalation/aws-ec2-privesc/README.md
@@ -152,17 +152,17 @@ aws ec2 describe-vpc-peering-connections
## EBS
Amazon **EBS** (Elastic Block Store) की **snapshots** मूलतः AWS EBS volumes के स्थिर **backups** हैं। दूसरे शब्दों में, वे क विशिष्ट समय पर किसी **EC2** Instance से जुड़े **disks** की **copies** होत हैं। EBS snapshots को क्षेत्रीय (regions) और खातों (accounts) में कॉपी किया जा सकता है, या यहां तक कि डाउनलोड करके स्थानीय रूप से चलाया भी जा सकता है।
Amazon **EBS** (Elastic Block Store) **snapshots** मूल रूप से AWS EBS volumes के static **backups**ोते हैं। दूसरे शब्दों में, वे किसी विशिष्ट समय पर **EC2** Instance से जुड़े **disks** की **copies** होत हैं। EBS snapshots को regions और accounts के बीच copy किया जा सकता है, या फिर डाउनलोड करके local रूप से run भी किया जा सकता है।
Snapshots में **sensitive information** जैसे कि **source code or APi keys** शामिल हो सकती है, इसलिए यदि आपके पास मौका हो तो इन्हें जांचना सुझाया जाता है।
Snapshots में **sensitive information** जैसे **source code or APi keys** हो सकती है, इसलिए अगर मौका मिले, तो इसे check करना recommended है।
### Difference AMI & EBS
An **AMI** is used to **launch an EC2 instance**, while an EC2 **Snapshot** is used to **backup and recover data stored on an EBS volume**. While an EC2 Snapshot can be used to create a new AMI, it is not the same thing as an AMI, and it does not include information about the operating system, application server, or other software required to run an application.
एक **AMI** का use **EC2 instance** launch करने के लिए किया जाता है, जबकि EC2 **Snapshot** का use EBS volume पर stored data का **backup and recover** करने के लिए किया जाता है। जबकि EC2 Snapshot का use एक नया AMI बनाने के लिए किया जा सकता है, यह AMI जैसी चीज़ नहीं है, और इसमें operating system, application server, या application चलाने के लिए required अन्य software की information शामिल नहीं होती।
### Privesc
निम्नलिखित पृष्ठ पर आप देख सकते हैं कि कैसे **abuse EBS permissions to escalate privileges**:
In the following page you can check how to **abuse EBS permissions to escalate privileges**:
{{#ref}}
../../aws-privilege-escalation/aws-ebs-privesc/README.md
@@ -170,11 +170,11 @@ An **AMI** is used to **launch an EC2 instance**, while an EC2 **Snapshot** is u
## SSM
**Amazon Simple Systems Manager (SSM)** EC2 instances के बेड़े को दूरस्थ रूप से प्रबंधित करने की अनुमति देता है ताकि उनका प्रशासन काफी आसान हो सके। इन प्रत्येक instances पर **SSM Agent service as the service will be the one getting the actions and performing them** चल रही होनी चाहिए क्योंकि ही सेवा AWS API से कार्रवाइयाँ प्राप्त करके उन्हें निष्पादित करेगी।
**Amazon Simple Systems Manager (SSM)** EC2 instances के fleets को remotely manage करने की अनुमति देता है ताकि उनकी administration काफी आसान हो सके। इन instances में से प्रत्येक पर **SSM Agent service** चल रही होनी चाहिए, क्योंकि ही service actions को प्राप्त करेगी और AWS API से उन्हें perform करेगी।
**SSM Agent** Systems Manager को इन संसाधनों को अपडेट, प्रबंधित, और कॉन्फ़िगर करने में सक्षम बनाता है। एजेंट **processes requests from the Systems Manager service in the AWS Cloud**, और फिर उन अनुरोधों को अनुरोध में निर्दिष्ट अनुसार चलाता है।
**SSM Agent** Systems Manager को इन resources को update, manage, और configure करना संभव बनाता है। Agent **AWS Cloud में Systems Manager service से आने वाले requests को process करता है**, और फिर उन्हें request में specified तरीके से run करता है।
The **SSM Agent comes**[ **preinstalled in some AMIs**](https://docs.aws.amazon.com/systems-manager/latest/userguide/ami-preinstalled-agent.html) or you need to [**manually install them**](https://docs.aws.amazon.com/systems-manager/latest/userguide/sysman-manual-agent-install.html) on the instances. Also, the IAM Role used inside the instance needs to have the policy **AmazonEC2RoleforSSM** attached to be able to communicate.
**SSM Agent comes**[ **preinstalled in some AMIs**](https://docs.aws.amazon.com/systems-manager/latest/userguide/ami-preinstalled-agent.html) या आपको instances पर [**manually install them**](https://docs.aws.amazon.com/systems-manager/latest/userguide/sysman-manual-agent-install.html) करना होगा। साथ ही, instance के अंदर इस्तेमाल होने वाले IAM Role में communication करने के लिए policy **AmazonEC2RoleforSSM** attached होनी चाहिए।
### Enumeration
```bash
@@ -185,13 +185,13 @@ aws ssm describe-instance-patches --instance-id <id>
aws ssm describe-instance-patch-states --instance-ids <id>
aws ssm describe-instance-associations-status --instance-id <id>
```
आप EC2 instance में यह जांच सकते हैं कि Systems Manager चल रहा है या नहीं, बस निम्नलिखित को चलाकर:
आप EC2 instance में यह check कर सकते हैं कि Systems Manager चल रहा है या नहीं, बस यह execute करके:
```bash
ps aux | grep amazon-ssm
```
### Privesc
निम्नलिखित पृष्ठ पर आप यह देख सकते हैं कि कैसे **abuse SSM permissions to escalate privileges**:
निम्नलिखित पेज में आप देख सकते हैं कि **SSM permissions का abuse करके privileges कैसे escalate करें**:
{{#ref}}
../../aws-privilege-escalation/aws-ssm-privesc/README.md
@@ -199,7 +199,7 @@ ps aux | grep amazon-ssm
### Perssistence
निम्नलिखित पृष्ठ पर आप यह देख सकते हैं कि कैसे **abuse SSM permissions to achieve persistence**:
निम्नलिखित पेज में आप देख सकते हैं कि **SSM permissions का abuse करके persistence कैसे achieve करें**:
{{#ref}}
../../aws-persistence/aws-ssm-persistence/README.md
@@ -207,7 +207,9 @@ ps aux | grep amazon-ssm
## ELB
**Elastic Load Balancing** (ELB) Amazon Web Services (AWS) परिनियोजनों के लिए एक **लोड-बैलेंसिंग सेवा** है। ELB स्वचालित रूप से **आने वाले एप्लिकेशन ट्रैफ़िक का वितरण** करता है और ट्रैफ़िक की मांगों को पूरा करने के लिए संसाधनों का स्केल करता है।
**Elastic Load Balancing** (ELB) **Amazon Web Services** (AWS) deployments के लिए एक **load-balancing service** है। ELB अपने आप **incoming application traffic को distribute** करता है और traffic demands को पूरा करने के लिए resources को scale करता है।
**Application Load Balancers (ALBs)** के लिए, listener rules, authentication actions, header handling, और same targets तक जाने वाले alternative paths **security boundary** का हिस्सा हैं। पूरे path **CloudFront --> ALB/NLB --> listeners --> rules --> target groups --> instances/IPs/ports/security groups** की review करें, न कि केवल किसी एक listener rule को अलग से।
### Enumeration
```bash
@@ -219,10 +221,77 @@ aws elb describe-load-balancers | jq '.LoadBalancerDescriptions[]| select( .Sche
aws elbv2 describe-load-balancers
aws elbv2 describe-load-balancers | jq '.LoadBalancers[].DNSName'
aws elbv2 describe-listeners --load-balancer-arn <load_balancer_arn>
aws elbv2 describe-rules --listener-arn <listener_arn>
aws elbv2 describe-target-groups --load-balancer-arn <load_balancer_arn>
aws elbv2 describe-target-health --target-group-arn <target_group_arn>
aws elbv2 describe-load-balancer-attributes --load-balancer-arn <load_balancer_arn>
```
### ELB / ALB एक्सपोज़र & Access-Control बायपास
#### CloudFront / WAF बायपास via direct ALB origin access
अगर एक **CloudFront** distribution एक **internet-facing ALB** के सामने है, लेकिन ALB security group अभी भी public inbound traffic allow करता है, तो attacker अक्सर **ALB DNS name को सीधे request** करके **CloudFront WAF, geo restrictions, rate limits, और cache-layer controls** को bypass कर सकता है।
```bash
# Test the origin directly
curl -isk https://<alb-dns-name>/
# If the ALB routes on Host, replay the expected hostname directly to the ALB
curl -isk https://<alb-dns-name>/ -H 'Host: app.example.com'
```
**ऑडिट नोट्स:**
- CloudFront distributions और उनके origins को enumerate करें, फिर जाँचें कि origin ALB अभी भी **internet-facing** है या नहीं।
- ALB **security groups** की समीक्षा करें। अगर inbound traffic `0.0.0.0/0` या broad CIDRs से allowed है, तो संभव है कि CloudFront ही एकमात्र reachable path न हो।
- ALB से मिलने वाला direct **non-error** response आमतौर पर मतलब है कि CloudFront/WAF layer bypassable है।
**Hardening:** अगर CloudFront को ही only entry point होना चाहिए, तो ALB के लिए inbound traffic केवल AWS-managed prefix list **`com.amazonaws.global.cloudfront.origin-facing`** से allow करें।
#### Listener rule shadowing / auth bypass
ALB rules को **ascending priority order** में evaluate किया जाता है। एक **broader** rule, जिसका priority number **lower** हो, restrictive rule से पहले traffic capture कर सकता है, इससे पहले कि `authenticate-oidc`, `authenticate-cognito`, या `source-ip` तक पहुँचा जाए।
```text
[10] path /* -> forward -> tg-app
[20] path /admin* -> authenticate-oidc -> tg-app
```
`/admin` पर किया गया request पहले `/*` से match हो जाता है, इसलिए authentication action कभी run नहीं होती।
**Audit notes:**
- `aws elbv2 describe-rules --listener-arn <listener_arn>` से हर listener और rule dump करें।
- Rules को ascending priority order में walk करें और check करें कि क्या कोई broad **host/path/header/query** condition ऐसे traffic से match हो रही है जिसे पहले किसी more restrictive rule से hit होना चाहिए था।
- Listener ordering को middleware ordering की तरह treat करें: **first matching rule wins**.
#### `source-ip` restrictions alternate paths के जरिए bypass हो सकती हैं
`source-ip` condition सिर्फ उसी **specific listener rule** को protect करती है जहाँ यह configured है। अगर **same target group**, **same backend IPs/instances**, या **same service on another port** किसी दूसरे ALB, दूसरे listener, या weaker controls वाले NLB के जरिए reachable है, तो IP allowlist को अक्सर उस alternate path का उपयोग करके bypass किया जा सकता है।
**Audit notes:**
- हर restrictive rule के लिए, **target group ARN** और registered targets enumerate करें।
- उन targets को account/region के **all other listeners/load balancers** के against compare करें।
- Direct exposure भी check करें: **public instance IPs**, permissive **security groups**, या `80`, `443`, `8080`, या `8443` जैसे ports पर additional listeners।
एक अच्छा mental model यह है: **target को protect करें, सिर्फ target तक जाने वाला एक route नहीं**
#### Client-controlled `X-Forwarded-For` trust
अगर `routing.http.xff_header_processing.mode` को एक **internet-facing ALB** पर **`preserve`** set किया गया है, तो backend को **attacker-supplied** `X-Forwarded-For` value बिना बदले मिल सकती है। अगर application उस header पर **access control**, **rate limiting**, **logging**, या **monitoring** के लिए trust करती है, तो attacker perceived client IP spoof कर सकता है।
```bash
curl -isk https://<alb-dns-name>/ -H 'X-Forwarded-For: 127.0.0.1'
aws elbv2 describe-load-balancer-attributes --load-balancer-arn <load_balancer_arn>
```
Prefer `append` या `remove` on internet-facing ALBs, और authorization primitive के रूप में client-controlled forwarding headers का उपयोग करने से बचें।
#### Useful tool
[**ELBaph**](https://github.com/doyensec/ELBaph) एक read-only auditor है जो **ALBs, NLBs, listeners, rules, target groups, और targets को एक routing graph** के रूप में model करता है और फिर reachable exposures के लिए probe करता है।
```bash
elbaph scan --region us-east-1
elbaph scan --all-regions -p my-pentest-profile
```
## Launch Templates & Autoscaling Groups
### एन्यूमरेशन
### Enumरेशन
```bash
# Launch templates
aws ec2 describe-launch-templates
@@ -239,7 +308,7 @@ aws autoscaling describe-load-balancers
```
## Nitro
AWS Nitro एक **नवोन्मेषी तकनीकों** का सेट है जो AWS EC2 instances के लिए आधारभूत प्लेटफ़ॉर्म बनता है। Amazon द्वारा पेश किया गया ताकि **सुरक्षा, प्रदर्शन, और विश्वसनीयता में सुधार** किया जा सके, Nitro कस्टम **hardware components और एक lightweight hypervisor** का उपयोग करता है। यह पारंपरिक virtualization कार्यक्षमता का अधिकांश भाग समर्पित हार्डवेयर और सॉफ़्टवेयर में abstract कर देता है, जिससे **attack surface को कम**िया जाता है और resource efficiency में सुधार होता है। virtualization फ़ंक्शन्स को ऑफलोड करके, Nitro EC2 instances को **near bare-metal performance** प्रदान करने में सक्षम बनाता है, ज resource-intensive applications के लिए विशेष रूप से फायदेमंद है। अतिरिक्त रूप से, Nitro Security Chip विशेष रूप से hardware और firmware की **security** सुनिश्चित करता है, जिससे इसकी मजबूत वास्तुकला और भी दृढ़ होती है।
AWS Nitro एक **innovative technologies** का suite है जो AWS EC2 instances के लिए underlying platform बनता है। Amazon द्वारा **security, performance, और reliability** को बढ़ाने के लिए introduced, Nitro custom **hardware components और lightweight hypervisor** का उपयोग करता है। यह traditional virtualization functionality का बड़ा हिस्सा dedicated hardware और software पर abstract करता है, **attack surface को कम**ता है और resource efficiency को बेहतर बनाता है। Virtualization functions को offload करके, Nitro EC2 instances को **near bare-metal performance** देने देता है, जिससे यह resource-intensive applications के लिए खास तौर पर लाभकारी है। इसके अलावा, Nitro Security Chip विशेष रूप से **hardware और firmware की security** सुनिश्चित करता है, जिससे इसकी मजबूत architecture और भी solid हो जाती है।
Get more information and how to enumerate it from:
@@ -249,32 +318,32 @@ aws-nitro-enum.md
## VPN
A VPN आपको अपन**on-premise network (site-to-site VPN)** या **workers laptops (Client VPN)** को **AWS VPC** से जोड़ने की अनुमति देता है ताकि सेवाओं को इंटरनेट पर एक्सपोज़ किए बिना एक्सेस किया जा सके।
एक VPN आपके **on-premise network (site-to-site VPN)** या **workers laptops (Client VPN)** को **AWS VPC** से connect करने देता है, ताकि services को internet पर expose किए बिना access किया जा सके।
#### Basic AWS VPN Components
1. **Customer Gateway**:
- A Customer Gateway एक संसाधन है जिसे आप AWS में बनाते हैं ताकि यह आपके VPN connection की तरफ़ का प्रतिनिधित्व कर सके
- यह मूल रूप से आपके Site-to-Site VPN connection की ओर पर स्थित कोई भौतिक डिवाइस या सॉफ़्टवेयर एप्लिकेशन होता है।
- Customer Gateway बनाने के लिए आप AWS को अपने नेटवर्क डिवाइस routing information और public IP address (जैसे router या firewall) प्रदान करते हैं।
- यह VPN connection सेटअप करने के लिए एक संदर्भ बिंदु के रूप में काम करता है और इसके लिए अतिरिक्त शुल्क नहीं लगत
- A Customer Gateway AWS में आपके VPN connection के side को represent करने के लिए आपके द्वारा create किया गया resource है
- यह मूल रूप से आपके side पर Site-to-Site VPN connection का एक physical device या software application होता है।
- Customer Gateway create करने के लिए आप अपने network device (जैसे router या firewall) routing information और public IP address AWS को provide करते हैं।
- यह VPN connection set up करने के लिए reference point के रूप में काम करता है और इसके लिए अतिरिक्त charges नहीं लगत
2. **Virtual Private Gateway**:
- A Virtual Private Gateway (VPG) Site-to-Site VPN connection के Amazon पक्ष पर स्थित VPN concentrator होता है।
- यह आपके VPC से जुड़ा होता है और आपके VPN connection का लक्ष्य होता है।
- VPG VPN connection के लिए AWS पक्ष का endpoint है।
- यह आपके VPC और आपके on-premises network के बीच सुरक्षित संचार को संभालता है।
- A Virtual Private Gateway (VPG) Amazon side पर Site-to-Site VPN connection क VPN concentrator है।
- यह आपके VPC से attached होता है और आपके VPN connection के target के रूप में काम करता है।
- VPG, VPN connection के लिए AWS side endpoint है।
- यह आपके VPC और on-premises network के बीच secure communication को handle करता है।
3. **Site-to-Site VPN Connection**:
- Site-to-Site VPN connection आपके on-premises network को एक secure, IPsec VPN tunnel के माध्यम से VPC से जोड़ता है।
- इस प्रकार के connection के लिए एक Customer Gateway और एक Virtual Private Gateway की आवश्यकता होती है।
- यह आपके डेटा सेंटर या नेटवर्क और आपके AWS परिवेश के बीच सुरक्षित, स्थिर और सुसंगत संचार के लिए उपयोग किया जाता है।
- आम तौर पर इसे नियमित, दीर्घकालिक कनेक्शनों के लिए उपयोग किया जाता है और कनेक्शन के माध्यम से स्थानांतरित किए गए डेटा की मात्रा के आधार पर बिल किया जाता है।
- A Site-to-Site VPN connection आपके on-premises network को एक secure, IPsec VPN tunnel के माध्यम से VPC से connect करता है।
- इस type of connection के लिए Customer Gateway और Virtual Private Gateway की आवश्यकता होती है।
- इसका उपयोग आपके data center या network और AWS environment के बीच secure, stable, और consistent communication के लिए किया जाता है।
- आम तौर पर regular, long-term connections के लिए उपयोग होता है और connection पर transferred data की amount के आधार पर billed होता है।
4. **Client VPN Endpoint**:
- A Client VPN endpoint एक संसाधन है जिसे आप AWS में बनाते हैं ताकि client VPN sessions को सक्षम और प्रबंधित किया जा सके
- यह व्यक्तिगत उपकरणों (जैसे laptops, smartphones, आदि) को सुरक्षित रूप से AWS resources या आपके on-premises network से कनेक्ट करने की अनुमति देने के लिए उपयोग किया जाता है।
- यह Site-to-Site VPN से अलग है क्योंकि यह पूरे नेटवर्क को जोड़ने के बजाय व्यक्तिगत क्लाइंट्स के लिए डिज़ाइन किया गया है।
- Client VPN के साथ, प्रत्येक क्लाइंट डिवाइस एक VPN client software का उपयोग करके एक सुरक्षित कनेक्शन स्थापित करता है।
- A Client VPN endpoint AWS में आपके द्वारा create किया गया resource है जो client VPN sessions को enable और manage करता है
- इसका उपयोग individual devices (जैसे laptops, smartphones, आदि) को securely AWS resources या आपके on-premises network से connect करने देने के लिए किया जाता है।
- यह Site-to-Site VPN से इस तरह अलग है कि यह entire networks को connect करने के बजाय individual clients के लिए design किया गया है।
- Client VPN के साथ, हर client device secure connection establish करने के लिए VPN client software का उपयोग करता है।
You can [**AWS VPNs के लाभों और घटकों के बारे में अधिक जानकारी यहाँ पा सकते हैं**](aws-vpc-and-networking-basic-information.md#vpn).
You can [**find more information about the benefits and components of AWS VPNs here**](aws-vpc-and-networking-basic-information.md#vpn).
### Enumeration
```bash
@@ -300,17 +369,17 @@ aws ec2 describe-vpn-gateways
# Get VPN site-to-site connections
aws ec2 describe-vpn-connections
```
### Local Enumeration
### लोकल एन्यूमरेशन
**Local Temporary Credentials**
**लोकल टेम्पररी क्रेडेंशियल्स**
जब AWS VPN Client का उपयोग किसी VPN से कनेक्ट करने के लिए किया जाता है, तो उपयोगकर्ता आमतौर पर **login in AWS** करके VPN तक पहुँच प्राप्त करता है। उसके बाद, VPN कनेक्शन स्थापित करने के लिए कुछ **AWS credentials are created and stored** लोकली बनकर रखे जाते हैं। ये credentials **stored in** `$HOME/.config/AWSVPNClient/TemporaryCredentials/<region>/temporary-credentials.txt` में रखे जाते हैं और इनमें एक **AccessKey**, एक **SecretKey** और एक **Token** होता है।
जब AWS VPN Client का उपयोग VPN से कनेक्ट करने के लिए किया जाता है, तो यूज़र आमतौर पर VPN तक पहुँच पाने के लिए **AWS में login** करता है। फिर, VPN connection स्थापित करने के लिए कुछ **AWS credentials बनाए और locally stored** किए जाते हैं। ये credentials **stored in** `$HOME/.config/AWSVPNClient/TemporaryCredentials/<region>/temporary-credentials.txt` और इनमें एक **AccessKey**, एक **SecretKey** और एक **Token** होता है।
ये credentials user `arn:aws:sts::<acc-id>:assumed-role/aws-vpn-client-metrics-analytics-access-role/CognitoIdentityCredentials` के हैं (TODO: इ credentials क permissions के बारे में और रिसर्च करें)।
ये credentials यूज़र `arn:aws:sts::<acc-id>:assumed-role/aws-vpn-client-metrics-analytics-access-role/CognitoIdentityCredentials` के होते हैं (TODO: इ credentials क permissions के बारे में और research करें)।
**opvn config files**
अगर एक **VPN connection was stablished** तो आपको सिस्टम में **`.opvn`** config files की तलाश करनी चाहिए। इसके अलावा, एक जगह जहाँ आप ये **configurations** पा सकते हैं वह है **`$HOME/.config/AWSVPNClient/OpenVpnConfigs`**
अगर एक **VPN connection was stablished** किया गया था, तो आपको सिस्टम में **`.opvn`** config files ढूँढनी चाहिए। इसके अलावा, एक जगह जहाँ आप **configurations** पा सकते हैं, वह है **`$HOME/.config/AWSVPNClient/OpenVpnConfigs`**
#### **Post Exploitaiton**
@@ -320,6 +389,11 @@ aws ec2 describe-vpn-connections
## References
- [https://docs.aws.amazon.com/batch/latest/userguide/getting-started-ec2.html](https://docs.aws.amazon.com/batch/latest/userguide/getting-started-ec2.html)
- [AWS Elastic Beanstalk and Amazon EC2 getting started](https://docs.aws.amazon.com/batch/latest/userguide/getting-started-ec2.html)
- [Doyensec - Navigating Lax Load Balancers: When an Intersection Gets You Inside](https://blog.doyensec.com/2026/05/25/cloudsectidbits-elbaph-alb.html)
- [AWS - Listener rules for your Application Load Balancer](https://docs.aws.amazon.com/elasticloadbalancing/latest/application/listener-rules.html)
- [AWS - HTTP headers and Application Load Balancers](https://docs.aws.amazon.com/elasticloadbalancing/latest/application/x-forwarded-headers.html)
- [AWS - CloudFront managed prefix list for origin-facing servers](https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/LocationsOfEdgeServers.html)
- [Doyensec - ELBaph](https://github.com/doyensec/ELBaph)
{{#include ../../../../banners/hacktricks-training.md}}