Az - MySQLデータベースの特権昇格

Reading time: 4 minutes

tip

AWSハッキングを学び、実践する:HackTricks Training AWS Red Team Expert (ARTE)
GCPハッキングを学び、実践する:HackTricks Training GCP Red Team Expert (GRTE) Azureハッキングを学び、実践する:HackTricks Training Azure Red Team Expert (AzRTE)

HackTricksをサポートする

MySQLデータベースの特権昇格

SQLデータベースに関する詳細情報は次を確認してください:

Az - MySQL

Microsoft.DBforMySQL/flexibleServers/read && Microsoft.DBforMySQL/flexibleServers/write

この権限を持つことで、Azure上でMySQL Flexible Serverインスタンスを作成、更新、または削除できます。これには、新しいサーバーのプロビジョニング、既存のサーバー構成の変更、またはサーバーの廃止が含まれます。

bash
az mysql flexible-server create \
--name <ServerName> \
--resource-group <ResourceGroupName> \
--location <Location> \
--admin-user <AdminUsername> \
--admin-password <AdminPassword> \
--sku-name <SkuName> \
--storage-size <StorageSizeInGB> \
--tier <PricingTier> \
--version <MySQLVersion>

例えば、これらの権限はMySQLのパスワードを変更することを許可します。これは、もちろんMySQL認証が有効な場合に便利です。

bash
az mysql flexible-server update \
--resource-group <resource_group_name> \
--name <server_name> \
--admin-password <password_to_update>

パブリックアクセスを有効にする必要があります。非プライベートエンドポイントからアクセスする場合は、これを有効にするには:

bash
az mysql flexible-server update --resource-group <resource_group_name> --server-name <server_name> --public-access Enabled

Microsoft.DBforMySQL/flexibleServers/read, Microsoft.DBforMySQL/flexibleServers/write, Microsoft.DBforMySQL/flexibleServers/backups/read, Microsoft.ManagedIdentity/userAssignedIdentities/assign/action

これらの権限を持つことで、バックアップからMySQLサーバーを復元できます:

bash
az mysql flexible-server restore \
--resource-group <resource_group_name> \
--name <restore_server_name> \
--source-server <server_name> \
--yes

Microsoft.DBforMySQL/flexibleServers/read, Microsoft.DBforMySQL/flexibleServers/write, Microsoft.ManagedIdentity/userAssignedIdentities/assign/action, Microsoft.DBforMySQL/flexibleServers/administrators/write && Microsoft.DBforMySQL/flexibleServers/administrators/read

この権限を持つことで、MySQL Flexible ServerのAzure Active Directory (AD) 管理者を構成できます。これは、自分自身または他のアカウントをAD管理者として設定することで悪用でき、MySQLサーバーに対する完全な管理権限を付与します。フレキシブルサーバーには、使用するためにユーザー割り当てのマネージドIDが必要です。

bash
az mysql flexible-server ad-admin create \
--resource-group <ResourceGroupName> \
--server-name <ServerName> \
--display-name <ADAdminDisplayName> \
--identity <IdentityNameOrID> \
--object-id <ObjectID>

tip

AWSハッキングを学び、実践する:HackTricks Training AWS Red Team Expert (ARTE)
GCPハッキングを学び、実践する:HackTricks Training GCP Red Team Expert (GRTE) Azureハッキングを学び、実践する:HackTricks Training Azure Red Team Expert (AzRTE)

HackTricksをサポートする