mirror of
https://github.com/HackTricks-wiki/hacktricks-cloud.git
synced 2025-12-28 13:43:24 -08:00
Add files via upload
This commit is contained in:
@@ -0,0 +1,243 @@
|
||||
# Az - CosmosDB Post Exploitation
|
||||
|
||||
{% hint style="success" %}
|
||||
Learn & practice AWS Hacking:<img src="../../../.gitbook/assets/image (1) (1) (1) (1).png" alt="" data-size="line">[**HackTricks Training AWS Red Team Expert (ARTE)**](https://training.hacktricks.xyz/courses/arte)<img src="../../../.gitbook/assets/image (1) (1) (1) (1).png" alt="" data-size="line">\
|
||||
Learn & practice GCP Hacking: <img src="../../../.gitbook/assets/image (2) (1).png" alt="" data-size="line">[**HackTricks Training GCP Red Team Expert (GRTE)**<img src="../../../.gitbook/assets/image (2) (1).png" alt="" data-size="line">](https://training.hacktricks.xyz/courses/grte)
|
||||
|
||||
<details>
|
||||
|
||||
<summary>Support HackTricks</summary>
|
||||
|
||||
* 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.
|
||||
|
||||
</details>
|
||||
{% endhint %}
|
||||
|
||||
## CosmosDB Post Exploitation
|
||||
For more information about SQL Database check:
|
||||
|
||||
{% content-ref url="../az-services/az-postgresql.md" %}
|
||||
[az-postgresql.md](../az-services/az-postgresql.md)
|
||||
{% endcontent-ref %}
|
||||
|
||||
|
||||
### "Microsoft.DocumentDB/databaseAccounts/read" && "Microsoft.DocumentDB/databaseAccounts/write"
|
||||
With this permission, you can create or update Azure Cosmos DB accounts. This includes modifying account-level settings, adding or removing regions, changing consistency levels, and enabling or disabling features like multi-region writes.
|
||||
|
||||
{% code overflow="wrap" %}
|
||||
```bash
|
||||
az cosmosdb update \
|
||||
--name <account_name> \
|
||||
--resource-group <resource_group_name> \
|
||||
--public-network-access ENABLED
|
||||
```
|
||||
{% endcode %}
|
||||
|
||||
### "Microsoft.DocumentDB/databaseAccounts/sqlDatabases/containers/read" && "Microsoft.DocumentDB/databaseAccounts/sqlDatabases/containers/write"
|
||||
With this permission, you can create or modify containers (collections) within a SQL database of an Azure Cosmos DB account. Containers are used to store data, and changes to them can impact the database's structure and access patterns.
|
||||
|
||||
{% code overflow="wrap" %}
|
||||
```bash
|
||||
# Create
|
||||
az cosmosdb sql container create \
|
||||
--account-name <account_name> \
|
||||
--resource-group <resource_group_name> \
|
||||
--database-name <database_name> \
|
||||
--name <container_name> \
|
||||
--partition-key-path <partition_key_path>
|
||||
|
||||
#Update
|
||||
az cosmosdb sql container update \
|
||||
--account-name <account_name> \
|
||||
--resource-group <resource_group_name> \
|
||||
--database-name <database_name> \
|
||||
--name <container_name> \
|
||||
--ttl 3600
|
||||
```
|
||||
{% endcode %}
|
||||
|
||||
### "Microsoft.DocumentDB/databaseAccounts/sqlDatabases/write" && "Microsoft.DocumentDB/databaseAccounts/sqlDatabases/read"
|
||||
With this permission, you can create or modify SQL databases within an Azure Cosmos DB account. This allows for managing the database structure and adding new databases to the account. While this permission enables database creation, improper or unauthorized use could result in unnecessary resource consumption, increased costs, or operational inefficiencies.
|
||||
|
||||
{% code overflow="wrap" %}
|
||||
```bash
|
||||
az cosmosdb sql database create \
|
||||
--account-name <account_name> \
|
||||
--resource-group <resource_group_name> \
|
||||
--name <database_name>
|
||||
```
|
||||
{% endcode %}
|
||||
|
||||
### "Microsoft.DocumentDB/databaseAccounts/failoverPriorityChange/action"
|
||||
|
||||
With this permission, you can change the failover priority of regions for an Azure Cosmos DB database account. This action determines the order in which regions become primary during a failover event. Improper use of this permission can disrupt the high availability of the database or lead to unintended operational impacts.
|
||||
|
||||
{% code overflow="wrap" %}
|
||||
```bash
|
||||
az cosmosdb failover-priority-change \
|
||||
--name <database_account_name> \
|
||||
--resource-group <resource_group_name> \
|
||||
--failover-policies <region1=priority1> <region2=priority2>
|
||||
|
||||
```
|
||||
{% endcode %}
|
||||
|
||||
### "Microsoft.DocumentDB/databaseAccounts/regenerateKey/action"
|
||||
With this permission, you can regenerate the primary or secondary keys for an Azure Cosmos DB account. This is typically used to enhance security by replacing old keys, but it can disrupt access for services or applications that rely on the current keys.
|
||||
|
||||
{% code overflow="wrap" %}
|
||||
```bash
|
||||
az cosmosdb keys regenerate \
|
||||
--name <account_name> \
|
||||
--resource-group <resource_group_name> \
|
||||
--key-kind <primary|secondary>
|
||||
|
||||
```
|
||||
{% endcode %}
|
||||
|
||||
### "Microsoft.DocumentDB/databaseAccounts/sqlDatabases/containers/userDefinedFunctions/write" && "Microsoft.DocumentDB/databaseAccounts/sqlDatabases/containers/userDefinedFunctions/read"
|
||||
|
||||
With this permission, you can create or modify triggers within a container of a SQL database in an Azure Cosmos DB account. Triggers allow you to execute server-side logic in response to operations.
|
||||
|
||||
{% code overflow="wrap" %}
|
||||
```bash
|
||||
az cosmosdb sql trigger create \
|
||||
--account-name <account_name> \
|
||||
--resource-group <resource_group_name> \
|
||||
--database-name <sql_database_name> \
|
||||
--container-name <container_name> \
|
||||
--name <trigger_name> \
|
||||
--body 'function trigger() { var context = getContext(); var request = context.getRequest(); request.setBody("Triggered operation!"); }' \
|
||||
--type Pre \
|
||||
--operation All
|
||||
```
|
||||
{% endcode %}
|
||||
|
||||
### "Microsoft.DocumentDB/databaseAccounts/sqlDatabases/containers/storedProcedures/write" && "Microsoft.DocumentDB/databaseAccounts/sqlDatabases/containers/storedProcedures/read"
|
||||
With this permission, you can create or modify stored procedures within a container of a SQL database in an Azure Cosmos DB account. Stored procedures in Cosmos DB are server-side JavaScript functions that allow you to encapsulate logic for processing data or performing operations directly within the database.
|
||||
|
||||
{% code overflow="wrap" %}
|
||||
```bash
|
||||
az cosmosdb sql stored-procedure create \
|
||||
--account-name <account_name> \
|
||||
--resource-group <resource_group_name> \
|
||||
--database-name <sql_database_name> \
|
||||
--container-name <container_name> \
|
||||
--name <stored_procedure_name> \
|
||||
--body 'function sample() { return "Hello, Cosmos!"; }'
|
||||
```
|
||||
{% endcode %}
|
||||
|
||||
### "Microsoft.DocumentDB/databaseAccounts/sqlDatabases/containers/triggers/write" && "Microsoft.DocumentDB/databaseAccounts/sqlDatabases/containers/triggers/read"
|
||||
With this permission, you can create or modify triggers within a container of a SQL database in an Azure Cosmos DB account. Triggers allow you to execute server-side logic in response to operations like inserts, updates, or deletes.
|
||||
|
||||
{% code overflow="wrap" %}
|
||||
```bash
|
||||
az cosmosdb sql trigger create \
|
||||
--account-name <account_name> \
|
||||
--resource-group <resource_group_name> \
|
||||
--database-name <sql_database_name> \
|
||||
--container-name <container_name> \
|
||||
--name <trigger_name> \
|
||||
--body 'function trigger() { var context = getContext(); var request = context.getRequest(); request.setBody("Triggered operation!"); }' \
|
||||
--type Pre \
|
||||
--operation All
|
||||
```
|
||||
{% endcode %}
|
||||
|
||||
### "Microsoft.DocumentDB/databaseAccounts/mongodbDatabases/collections/read" && "Microsoft.DocumentDB/databaseAccounts/mongodbDatabases/collections/write"
|
||||
With this permission, you can create or modify collections within MongoDB databases in an Azure Cosmos DB account. Collections are used to store documents and define the structure and partitioning for data.
|
||||
|
||||
{% code overflow="wrap" %}
|
||||
```bash
|
||||
az cosmosdb mongodb collection create \
|
||||
--account-name <account_name> \
|
||||
--resource-group <resource_group_name> \
|
||||
--database-name <mongodb_database_name> \
|
||||
--name <collection_name>
|
||||
```
|
||||
{% endcode %}
|
||||
|
||||
### "Microsoft.DocumentDB/databaseAccounts/mongodbDatabases/write" && "Microsoft.DocumentDB/databaseAccounts/mongodbDatabases/read"
|
||||
With this permission, you can create new MongoDB databases within an Azure Cosmos DB account. This allows for provisioning new databases to store and manage collections and documents.
|
||||
|
||||
{% code overflow="wrap" %}
|
||||
```bash
|
||||
az cosmosdb mongodb database create \
|
||||
--account-name <account_name> \
|
||||
--resource-group <resource_group_name> \
|
||||
--name <database_name>
|
||||
```
|
||||
{% endcode %}
|
||||
|
||||
### "Microsoft.DocumentDB/databaseAccounts/mongodbRoleDefinitions/write" && "Microsoft.DocumentDB/databaseAccounts/mongodbRoleDefinitions/read"
|
||||
With this permission, you can create new MongoDB role definitions within an Azure Cosmos DB account. This allows defining custom roles with specific permissions for MongoDB users.
|
||||
|
||||
{% code overflow="wrap" %}
|
||||
```bash
|
||||
az cosmosdb mongodb role definition create \
|
||||
--account-name <account_name> \
|
||||
--resource-group <resource_group_name> \
|
||||
--body '{
|
||||
"Id": "<mydatabase>.readWriteRole",
|
||||
"RoleName": "readWriteRole",
|
||||
"Type": "CustomRole",
|
||||
"DatabaseName": "<mydatabase>",
|
||||
"Privileges": [
|
||||
{
|
||||
"Resource": {
|
||||
"Db": "<mydatabase>",
|
||||
"Collection": "mycollection"
|
||||
},
|
||||
"Actions": [
|
||||
"insert",
|
||||
"find",
|
||||
"update"
|
||||
]
|
||||
}
|
||||
],
|
||||
"Roles": []
|
||||
}'
|
||||
```
|
||||
{% endcode %}
|
||||
|
||||
### "Microsoft.DocumentDB/databaseAccounts/mongodbUserDefinitions/write" && "Microsoft.DocumentDB/databaseAccounts/mongodbUserDefinitions/read"
|
||||
With this permission, you can create new MongoDB user definitions within an Azure Cosmos DB account. This allows the provisioning of users with specific roles and access levels to MongoDB databases.
|
||||
{% code overflow="wrap" %}
|
||||
```bash
|
||||
az cosmosdb mongodb user definition create \
|
||||
--account-name <account_name> \
|
||||
--resource-group <resource_group_name> \
|
||||
--body '{
|
||||
"Id": "<mydatabase>.myUser",
|
||||
"UserName": "myUser",
|
||||
"Password": "mySecurePassword",
|
||||
"DatabaseName": "<mydatabase>",
|
||||
"CustomData": "TestCustomData",
|
||||
"Mechanisms": "SCRAM-SHA-256",
|
||||
"Roles": [
|
||||
{
|
||||
"Role": "readWriteRole",
|
||||
"Db": "<mydatabase>"
|
||||
}
|
||||
]
|
||||
}'
|
||||
```
|
||||
{% endcode %}
|
||||
|
||||
{% hint style="success" %}
|
||||
Learn & practice AWS Hacking:<img src="../../../.gitbook/assets/image (1) (1) (1) (1).png" alt="" data-size="line">[**HackTricks Training AWS Red Team Expert (ARTE)**](https://training.hacktricks.xyz/courses/arte)<img src="../../../.gitbook/assets/image (1) (1) (1) (1).png" alt="" data-size="line">\
|
||||
Learn & practice GCP Hacking: <img src="../../../.gitbook/assets/image (2) (1).png" alt="" data-size="line">[**HackTricks Training GCP Red Team Expert (GRTE)**<img src="../../../.gitbook/assets/image (2) (1).png" alt="" data-size="line">](https://training.hacktricks.xyz/courses/grte)
|
||||
|
||||
<details>
|
||||
|
||||
<summary>Support HackTricks</summary>
|
||||
|
||||
* 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.
|
||||
|
||||
</details>
|
||||
{% endhint %}
|
||||
@@ -0,0 +1,167 @@
|
||||
# Az - MySQL Post Exploitation
|
||||
|
||||
{% hint style="success" %}
|
||||
Learn & practice AWS Hacking:<img src="../../../.gitbook/assets/image (1) (1) (1) (1).png" alt="" data-size="line">[**HackTricks Training AWS Red Team Expert (ARTE)**](https://training.hacktricks.xyz/courses/arte)<img src="../../../.gitbook/assets/image (1) (1) (1) (1).png" alt="" data-size="line">\
|
||||
Learn & practice GCP Hacking: <img src="../../../.gitbook/assets/image (2) (1).png" alt="" data-size="line">[**HackTricks Training GCP Red Team Expert (GRTE)**<img src="../../../.gitbook/assets/image (2) (1).png" alt="" data-size="line">](https://training.hacktricks.xyz/courses/grte)
|
||||
|
||||
<details>
|
||||
|
||||
<summary>Support HackTricks</summary>
|
||||
|
||||
* 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.
|
||||
|
||||
</details>
|
||||
{% endhint %}
|
||||
|
||||
## MySQL Database Post Exploitation
|
||||
For more information about MySQL Database check:
|
||||
|
||||
{% content-ref url="../az-services/az-mysql.md" %}
|
||||
[az-mysql.md](../az-services/az-mysql.md)
|
||||
{% endcontent-ref %}
|
||||
|
||||
### "Microsoft.DBforMySQL/flexibleServers/databases/write" && "Microsoft.DBforMySQL/flexibleServers/databases/read"
|
||||
|
||||
With this permission, you can create new databases within a MySQL Flexible Server instance on Azure. While this action itself does not modify existing resources, excessive or unauthorized creation of databases could lead to resource consumption, or potential misuse of the server.
|
||||
|
||||
{% code overflow="wrap" %}
|
||||
```bash
|
||||
az mysql flexible-server db create \
|
||||
--server-name <server_name> \
|
||||
--resource-group <resource_group_name> \
|
||||
--database-name <database_name>
|
||||
```
|
||||
{% endcode %}
|
||||
|
||||
### "Microsoft.DBforMySQL/flexibleServers/backups/write"
|
||||
|
||||
With this permission, you can initiate the creation of backups for a MySQL Flexible Server instance on Azure. This allows users to generate on-demand backups, which can be useful for preserving data at specific points in time.
|
||||
|
||||
{% code overflow="wrap" %}
|
||||
```bash
|
||||
az mysql flexible-server backup create \
|
||||
--name <server_name> \
|
||||
--resource-group <resource_group_name>
|
||||
--backup-name <backup_name>
|
||||
```
|
||||
{% endcode %}
|
||||
|
||||
### "Microsoft.DBforMySQL/flexibleServers/advancedThreatProtectionSettings/write"
|
||||
|
||||
With this permission, you can configure or update the Advanced Threat Protection (ATP) settings for a MySQL Flexible Server instance on Azure. This allows enabling or diabling security features designed to detect and respond to anomalous activities and potential threats.
|
||||
|
||||
{% code overflow="wrap" %}
|
||||
```bash
|
||||
az mysql flexible-server threat-protection-policy update \
|
||||
--name <server_name> \
|
||||
--resource-group <resource_group_name> \
|
||||
--state <Enabled|Disabled>
|
||||
```
|
||||
{% endcode %}
|
||||
|
||||
### "Microsoft.DBforMySQL/flexibleServers/firewallRules/write"
|
||||
|
||||
With this permission, you can create or modify firewall rules for a MySQL Flexible Server instance on Azure. This allows control over which IP addresses or ranges can access the server. Unauthorized or improper use of this permission could expose the server to unwanted or malicious access.
|
||||
|
||||
{% code overflow="wrap" %}
|
||||
```bash
|
||||
# Create Rule
|
||||
az mysql flexible-server firewall-rule create \
|
||||
--name <server_name> \
|
||||
--resource-group <resource_group_name> \
|
||||
--rule-name <rule_name> \
|
||||
--start-ip-address <start_ip> \
|
||||
--end-ip-address <end_ip>
|
||||
|
||||
# Update Rule
|
||||
az mysql flexible-server firewall-rule update \
|
||||
--name <server_name> \
|
||||
--resource-group <resource_group_name> \
|
||||
--rule-name <rule_name> \
|
||||
--start-ip-address <start_ip> \
|
||||
--end-ip-address <end_ip>
|
||||
```
|
||||
{% endcode %}
|
||||
|
||||
### "Microsoft.DBforMySQL/flexibleServers/resetGtid/action"
|
||||
|
||||
With this permission, you can reset the GTID (Global Transaction Identifier) for a MySQL Flexible Server instance on Azure. Resetting GTID will invalidate all the automated, on-demand backups and geo-backups that were taken before the reset action. After GTID reset, you will not be able to perform PITR (point-in-time-restore) using fastest restore point or by custom restore point if the selected restore time is before the GTID reset time. And successful geo-restore will be possible only after 5 days.
|
||||
|
||||
{% code overflow="wrap" %}
|
||||
```bash
|
||||
az mysql flexible-server reset-gtid \
|
||||
--name \
|
||||
--resource-group <resource_group_name> \
|
||||
--gtid-set <gtid>
|
||||
```
|
||||
{% endcode %}
|
||||
|
||||
### "Microsoft.DBforMySQL/flexibleServers/updateConfigurations/action"
|
||||
|
||||
With this permission, you can update the configuration settings of a MySQL Flexible Server instance on Azure. This allows customization of server parameters such as performance tuning, security configurations, or operational settings. You can update the following parameters together in a batch: audit_log_enabled, audit_log_events, binlog_expire_logs_seconds, binlog_row_image, character_set_server, collation_server, connect_timeout, enforce_gtid_consistency, gtid_mode, init_connect, innodb_buffer_pool_size, innodb_io_capacity, innodb_io_capacity_max, innodb_purge_threads, innodb_read_io_threads, innodb_thread_concurrency, innodb_write_io_threads, long_query_time, max_connect_errors, and max_connections.
|
||||
|
||||
{% code overflow="wrap" %}
|
||||
```bash
|
||||
az mysql flexible-server parameter set-batch \
|
||||
--resource-group <resource_group_name> \
|
||||
--server-name <server_name> \
|
||||
--args max_connections=<value>
|
||||
```
|
||||
{% endcode %}
|
||||
|
||||
### "Microsoft.DBforMySQL/flexibleServers/read", "Microsoft.DBforMySQL/flexibleServers/write" && "Microsoft.ManagedIdentity/userAssignedIdentities/assign/action"
|
||||
|
||||
With this permission, you can assign a user-assigned managed identity to MySQL flexible servers.
|
||||
|
||||
{% code overflow="wrap" %}
|
||||
```bash
|
||||
az mysql flexible-server identity assign \
|
||||
--resource-group <ResourceGroupName> \
|
||||
--server-name <ServerName> \
|
||||
--identity <IdentityName>
|
||||
```
|
||||
{% endcode %}
|
||||
|
||||
### "Microsoft.DBforMySQL/flexibleServers/stop/action"
|
||||
|
||||
With this permission, you can stop a PostgreSQL Flexible Server instance on Azure. Stopping a server can lead to temporary service disruption, affecting applications and users dependent on the database.
|
||||
|
||||
{% code overflow="wrap" %}
|
||||
```bash
|
||||
az mysql flexible-server stop \
|
||||
--name <server_name> \
|
||||
--resource-group <resource_group_name>
|
||||
```
|
||||
{% endcode %}
|
||||
|
||||
### "Microsoft.DBforMySQL/flexibleServers/start/action"
|
||||
With this permission, you can start a stopped PostgreSQL Flexible Server instance on Azure. Starting a server restores its availability, enabling applications and users to reconnect and access the database.
|
||||
|
||||
{% code overflow="wrap" %}
|
||||
```bash
|
||||
az mysql flexible-server start \
|
||||
--name <server_name> \
|
||||
--resource-group <resource_group_name>
|
||||
```
|
||||
{% endcode %}
|
||||
|
||||
### "*/delete"
|
||||
|
||||
With this permissions you can delete resources related to mysql server in Azure such as server, firewalls, managed identities or configurations
|
||||
|
||||
{% hint style="success" %}
|
||||
Learn & practice AWS Hacking:<img src="../../../.gitbook/assets/image (1) (1) (1) (1).png" alt="" data-size="line">[**HackTricks Training AWS Red Team Expert (ARTE)**](https://training.hacktricks.xyz/courses/arte)<img src="../../../.gitbook/assets/image (1) (1) (1) (1).png" alt="" data-size="line">\
|
||||
Learn & practice GCP Hacking: <img src="../../../.gitbook/assets/image (2) (1).png" alt="" data-size="line">[**HackTricks Training GCP Red Team Expert (GRTE)**<img src="../../../.gitbook/assets/image (2) (1).png" alt="" data-size="line">](https://training.hacktricks.xyz/courses/grte)
|
||||
|
||||
<details>
|
||||
|
||||
<summary>Support HackTricks</summary>
|
||||
|
||||
* 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.
|
||||
|
||||
</details>
|
||||
{% endhint %}
|
||||
@@ -0,0 +1,155 @@
|
||||
# Az - PostgreSQL Post Exploitation
|
||||
|
||||
{% hint style="success" %}
|
||||
Learn & practice AWS Hacking:<img src="../../../.gitbook/assets/image (1) (1) (1) (1).png" alt="" data-size="line">[**HackTricks Training AWS Red Team Expert (ARTE)**](https://training.hacktricks.xyz/courses/arte)<img src="../../../.gitbook/assets/image (1) (1) (1) (1).png" alt="" data-size="line">\
|
||||
Learn & practice GCP Hacking: <img src="../../../.gitbook/assets/image (2) (1).png" alt="" data-size="line">[**HackTricks Training GCP Red Team Expert (GRTE)**<img src="../../../.gitbook/assets/image (2) (1).png" alt="" data-size="line">](https://training.hacktricks.xyz/courses/grte)
|
||||
|
||||
<details>
|
||||
|
||||
<summary>Support HackTricks</summary>
|
||||
|
||||
* 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.
|
||||
|
||||
</details>
|
||||
{% endhint %}
|
||||
|
||||
## PostgreSQL Database Post Exploitation
|
||||
For more information about PostgreSQL Database check:
|
||||
|
||||
{% content-ref url="../az-services/az-postgresql.md" %}
|
||||
[az-postgresql.md](../az-services/az-postgresql.md)
|
||||
{% endcontent-ref %}
|
||||
|
||||
### "Microsoft.DBforPostgreSQL/flexibleServers/databases/write" && "Microsoft.DBforPostgreSQL/flexibleServers/databases/read"
|
||||
|
||||
With this permission, you can create new databases within a Postgres Flexible Server instance on Azure. While this action itself does not modify existing resources, excessive or unauthorized creation of databases could lead to resource consumption, or potential misuse of the server.
|
||||
|
||||
{% code overflow="wrap" %}
|
||||
```bash
|
||||
az postgres flexible-server db create \
|
||||
--server-name <server_name> \
|
||||
--resource-group <resource_group_name> \
|
||||
--database-name <database_name>
|
||||
```
|
||||
{% endcode %}
|
||||
|
||||
### "Microsoft.DBforPostgreSQL/flexibleServers/backups/write"
|
||||
|
||||
With this permission, you can initiate the creation of backups for a Postgres Flexible Server instance on Azure. This allows users to generate on-demand backups, which can be useful for preserving data at specific points in time.
|
||||
|
||||
{% code overflow="wrap" %}
|
||||
```bash
|
||||
az postgres flexible-server backup create \
|
||||
--name <server_name> \
|
||||
--resource-group <resource_group_name>
|
||||
--backup-name <backup_name>
|
||||
```
|
||||
{% endcode %}
|
||||
|
||||
### "Microsoft.DBforPostgreSQL/flexibleServers/advancedThreatProtectionSettings/write" && "Microsoft.DBforPostgreSQL/flexibleServers/advancedThreatProtectionSettings/read"
|
||||
|
||||
With this permission, you can configure or update the Advanced Threat Protection (ATP) settings for a Postgres Flexible Server instance on Azure. This allows enabling or diabling security features designed to detect and respond to anomalous activities and potential threats.
|
||||
|
||||
{% code overflow="wrap" %}
|
||||
```bash
|
||||
az postgres flexible-server threat-protection-policy update \
|
||||
--name <server_name> \
|
||||
--resource-group <resource_group_name> \
|
||||
--state <Enabled|Disabled>
|
||||
```
|
||||
{% endcode %}
|
||||
|
||||
### "Microsoft.DBforPostgreSQL/flexibleServers/firewallRules/write", "Microsoft.DBforPostgreSQL/flexibleServers/read" && "Microsoft.DBforPostgreSQL/flexibleServers/firewallRules/read"
|
||||
|
||||
With this permission, you can create or modify firewall rules for a Postgres Flexible Server instance on Azure. This allows control over which IP addresses or ranges can access the server. Unauthorized or improper use of this permission could expose the server to unwanted or malicious access.
|
||||
|
||||
{% code overflow="wrap" %}
|
||||
```bash
|
||||
# Create Rule
|
||||
az postgres flexible-server firewall-rule create \
|
||||
--name <server_name> \
|
||||
--resource-group <resource_group_name> \
|
||||
--rule-name <rule_name> \
|
||||
--start-ip-address <start_ip> \
|
||||
--end-ip-address <end_ip>
|
||||
|
||||
# Update Rule
|
||||
az postgres flexible-server firewall-rule update \
|
||||
--name <server_name> \
|
||||
--resource-group <resource_group_name> \
|
||||
--rule-name <rule_name> \
|
||||
--start-ip-address <start_ip> \
|
||||
--end-ip-address <end_ip>
|
||||
```
|
||||
{% endcode %}
|
||||
|
||||
### "Microsoft.DBforPostgreSQL/flexibleServers/configurations/write" && "Microsoft.DBforPostgreSQL/flexibleServers/configurations/read"
|
||||
|
||||
With this permission, you can update the configuration settings of a Postgres Flexible Server instance on Azure. This allows customization of server parameters such as performance tuning, security configurations, or operational settings.
|
||||
|
||||
{% code overflow="wrap" %}
|
||||
```bash
|
||||
az postgres flexible-server parameter set \
|
||||
--resource-group <resource_group_name> \
|
||||
--server-name <server_name> \
|
||||
--name <parameter_name> \
|
||||
--value <parameter_value>
|
||||
```
|
||||
{% endcode %}
|
||||
|
||||
### "Microsoft.DBforPostgreSQL/flexibleServers/stop/action"
|
||||
|
||||
With this permission, you can stop a PostgreSQL Flexible Server instance on Azure. Stopping a server can lead to temporary service disruption, affecting applications and users dependent on the database.
|
||||
|
||||
{% code overflow="wrap" %}
|
||||
```bash
|
||||
az postgres flexible-server stop \
|
||||
--name <server_name> \
|
||||
--resource-group <resource_group_name>
|
||||
```
|
||||
{% endcode %}
|
||||
|
||||
### "Microsoft.DBforPostgreSQL/flexibleServers/start/action"
|
||||
With this permission, you can start a stopped PostgreSQL Flexible Server instance on Azure. Starting a server restores its availability, enabling applications and users to reconnect and access the database.
|
||||
|
||||
{% code overflow="wrap" %}
|
||||
```bash
|
||||
az postgres flexible-server start \
|
||||
--name <server_name> \
|
||||
--resource-group <resource_group_name>
|
||||
```
|
||||
{% endcode %}
|
||||
|
||||
### "Microsoft.DBforPostgreSQL/flexibleServers/read", "Microsoft.DBforPostgreSQL/flexibleServers/write" && "Microsoft.ManagedIdentity/userAssignedIdentities/assign/action"
|
||||
|
||||
With this permission, you can assign a user-assigned managed identity to postgres flexible servers.
|
||||
|
||||
{% code overflow="wrap" %}
|
||||
```bash
|
||||
az postgres flexible-server identity assign \
|
||||
--resource-group <ResourceGroupName> \
|
||||
--server-name <ServerName> \
|
||||
--identity <IdentityName>
|
||||
```
|
||||
{% endcode %}
|
||||
|
||||
### "*/delete"
|
||||
With this permissions you can delete resources related to postgres server in Azure such as server, firewalls, managed identities or configurations
|
||||
|
||||
|
||||
{% hint style="success" %}
|
||||
Learn & practice AWS Hacking:<img src="../../../.gitbook/assets/image (1) (1) (1) (1).png" alt="" data-size="line">[**HackTricks Training AWS Red Team Expert (ARTE)**](https://training.hacktricks.xyz/courses/arte)<img src="../../../.gitbook/assets/image (1) (1) (1) (1).png" alt="" data-size="line">\
|
||||
Learn & practice GCP Hacking: <img src="../../../.gitbook/assets/image (2) (1).png" alt="" data-size="line">[**HackTricks Training GCP Red Team Expert (GRTE)**<img src="../../../.gitbook/assets/image (2) (1).png" alt="" data-size="line">](https://training.hacktricks.xyz/courses/grte)
|
||||
|
||||
<details>
|
||||
|
||||
<summary>Support HackTricks</summary>
|
||||
|
||||
* 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.
|
||||
|
||||
</details>
|
||||
{% endhint %}
|
||||
Reference in New Issue
Block a user