Translated ['src/README.md', 'src/banners/hacktricks-training.md', 'src/

This commit is contained in:
Translator
2024-12-31 20:36:01 +00:00
parent 388bdfdf0a
commit 0077c42f9c
245 changed files with 9025 additions and 11888 deletions

View File

@@ -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 अनुमतियों** की आवश्यकता नहीं है।
<details>
<summary>Policy Details</summary>
<summary>नीति विवरण</summary>
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 नीति** के माध्यम से
- **अनुदानों** के माध्यम से
</details>
### 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 <id>
@@ -132,31 +129,26 @@ aws kms describe-key --key-id <id>
aws kms get-key-policy --key-id <id> --policy-name <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}}