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

This commit is contained in:
Translator
2024-12-31 20:20:29 +00:00
parent 77a009d308
commit 4bcd54c1b6
245 changed files with 9959 additions and 12700 deletions

View File

@@ -4,30 +4,29 @@
## DynamoDB
### Basic Information
### Grundinformationen
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 wird von AWS als eine **vollständig verwaltete, serverlose, Schlüssel-Wert NoSQL-Datenbank** präsentiert, die für leistungsstarke Anwendungen jeder Größe konzipiert ist. Der Dienst bietet robuste Funktionen, einschließlich integrierter Sicherheitsmaßnahmen, unterbrechungsfreier Backups, automatisierter Replikation über mehrere Regionen, integrierter In-Memory-Caching und praktischer Datenexport-Utilities.
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.
Im Kontext von DynamoDB werden anstelle einer traditionellen Datenbank **Tabellen erstellt**. Jede Tabelle erfordert die Angabe eines **Partitionierungsschlüssels** als integralen Bestandteil des **Primärschlüssels der Tabelle**. Dieser Partitionierungsschlüssel, im Wesentlichen ein **Hash-Wert**, spielt eine entscheidende Rolle sowohl bei der Abfrage von Elementen als auch bei der Verteilung von Daten über verschiedene Hosts. Diese Verteilung ist entscheidend für die Aufrechterhaltung sowohl der Skalierbarkeit als auch der Verfügbarkeit der Datenbank. Darüber hinaus gibt es die Möglichkeit, einen **Sortierschlüssel** hinzuzufügen, um die Datenorganisation weiter zu verfeinern.
### Encryption
### Verschlüsselung
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.
Standardmäßig verwendet DynamoDB einen KMS-Schlüssel, der **zu Amazon DynamoDB gehört,** nicht einmal den von AWS verwalteten Schlüssel, der zumindest zu Ihrem Konto gehört.
<figure><img src="https://lh4.googleusercontent.com/JjtNS7aA-_GRMgZb4v93jWEQJi6DQdUPq0FEpzZPdeyCeNoG05p0NJiV9Zs-ULs_-Tfjmx0W1ZgsE2Ui2ljo7D-1a87Xny-gpLVQO0XmXdFoph9ci1RepbVNwaCe9oPruEZSEDxGTxF5dIv6pW1WpT6kWA=s2048" alt=""><figcaption></figcaption></figure>
### Backups & Export to S3
### Backups & Export nach 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.
Es ist möglich, die Erstellung von **Tabellen-Backups** zu **planen** oder sie **auf Anfrage** zu erstellen. Darüber hinaus ist es auch möglich, **Point-in-time recovery (PITR) für eine Tabelle zu aktivieren.** Die Wiederherstellung zu einem bestimmten Zeitpunkt bietet kontinuierliche **Backups** Ihrer DynamoDB-Daten für **35 Tage**, um Sie vor versehentlichen Schreib- oder Löschvorgängen zu schützen.
It's also possible to export **the data of a table to S3**, but the table needs to have **PITR enabled**.
Es ist auch möglich, **die Daten einer Tabelle nach S3 zu exportieren**, aber die Tabelle muss **PITR aktiviert** haben.
### 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)
Es gibt eine GUI für lokale Dynamo-Dienste wie [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) usw., die nützlich sein könnte: [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 <t_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,7 +53,6 @@ aws dynamodb describe-export --export-arn <arn>
# Misc
aws dynamodb describe-endpoints #Dynamodb endpoints
```
### Unauthenticated Access
{{#ref}}
@@ -83,7 +81,7 @@ aws dynamodb describe-endpoints #Dynamodb endpoints
### SQL Injection
There are ways to access DynamoDB data with **SQL syntax**, therefore, typical **SQL injections are also possible**.
Es gibt Möglichkeiten, auf DynamoDB-Daten mit **SQL-Syntax** zuzugreifen, daher sind typische **SQL-Injektionen ebenfalls möglich**.
{{#ref}}
https://book.hacktricks.xyz/pentesting-web/sql-injection
@@ -91,23 +89,21 @@ https://book.hacktricks.xyz/pentesting-web/sql-injection
### NoSQL Injection
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)
In DynamoDB können verschiedene **Bedingungen** verwendet werden, um Daten abzurufen. Wie bei einer gängigen NoSQL-Injektion, wenn es möglich ist, **mehrere Bedingungen zu verketten, um** Daten abzurufen, könnten Sie versteckte Daten (oder die gesamte Tabelle dumpen).\
Hier finden Sie die von DynamoDB unterstützten Bedingungen: [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`**.
Beachten Sie, dass **verschiedene Bedingungen** unterstützt werden, wenn auf die Daten über **`query`** oder über **`scan`** zugegriffen wird.
> [!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.
> Tatsächlich müssen **Query**-Aktionen die **Bedingung "EQ" (gleich)** im **primären** Schlüssel angeben, damit sie funktionieren, was sie viel **weniger anfällig für NoSQL-Injektionen** macht (und auch die Operation sehr eingeschränkt).
Wenn Sie die **Vergleichsoperation** ändern oder neue hinzufügen können, könnten Sie mehr Daten abrufen.
```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}}
@@ -115,68 +111,54 @@ https://book.hacktricks.xyz/pentesting-web/nosql-injection
### Raw Json injection
> [!CAUTION]
> **This vulnerability is based on dynamodb Scan Filter which is now deprecated!**
> **Diese Schwachstelle basiert auf dem dynamodb Scan Filter, der jetzt veraltet ist!**
**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** akzeptiert **Json**-Objekte, um **Daten** in der DB zu **suchen**. Wenn Sie feststellen, dass Sie im json-Objekt, das zum Suchen gesendet wird, schreiben können, könnten Sie die DB dumpen, alle Inhalte.
Zum Beispiel, injizieren in eine Anfrage wie:
```bash
'{"Id": {"ComparisonOperator": "EQ","AttributeValueList": [{"N": "' + user_input + '"}]}}'
```
an attacker could inject something like:
ein Angreifer könnte etwas injizieren wie:
`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:
behebe die "EQ"-Bedingung, indem du nach der ID 1000 suchst und dann nach allen Daten mit einer Id-Zeichenfolge, die größer als 0 ist, was alles ist.
Ein weiteres **anfälliges Beispiel mit einem Login** könnte sein:
```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:
Dies wäre anfällig für:
```
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:
Einige SDKs erlauben die Verwendung eines Strings, der die durchzuführende Filterung angibt, wie:
```java
new ScanSpec().withProjectionExpression("UserName").withFilterExpression(user_input+" = :username and Password = :password").withValueMap(valueMap)
```
Sie müssen wissen, dass beim Suchen in DynamoDB für **das Ersetzen** eines Attributs **wertes** in **Filterausdrücken** während des Scannens der Elemente die Tokens mit dem **`:`**-Zeichen **beginnen** sollten. Solche Tokens werden zur Laufzeit mit dem tatsächlichen **Attributwert ersetzt**.
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:
Daher kann ein Login wie das vorherige mit etwas wie folgt umgangen werden:
```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}}