Translated ['.github/pull_request_template.md', 'src/pentesting-cloud/az

This commit is contained in:
Translator
2024-12-31 19:16:19 +00:00
parent 7770a50092
commit ea3a11546a
244 changed files with 8714 additions and 11561 deletions

View File

@@ -4,100 +4,99 @@
## Azure SQL
Azure SQL is a family of managed, secure, and intelligent products that use the **SQL Server database engine in the Azure cloud**. This means you don't have to worry about the physical administration of your servers, and you can focus on managing your data.
Azure SQLは、**Azureクラウド内のSQL Serverデータベースエンジン**を使用する、管理された、安全で、インテリジェントな製品のファミリーです。これにより、サーバーの物理管理を心配する必要がなく、データの管理に集中できます。
Azure SQL consists of three main offerings:
Azure SQLは、主に3つの提供形態から成り立っています
1. **Azure SQL Database**: This is a **fully-managed database service**, which allows you to host individual databases in the Azure cloud. It offers built-in intelligence that learns your unique database patterns and provides customized recommendations and automatic tuning.
2. **Azure SQL Managed Instance**: This is for larger scale, entire SQL Server instance-scoped deployments. It provides near 100% compatibility with the latest SQL Server on-premises (Enterprise Edition) Database Engine, which provides a native virtual network (VNet) implementation that addresses common security concerns, and a business model favorable for on-premises SQL Server customers.
3. **Azure SQL Server on Azure VMs**: This is Infrastructure as a Service (IaaS) and is best for migrations where you want **control over the operating system and SQL Server instance**, like it was a server running on-premises.
1. **Azure SQL Database**: これは**完全管理型データベースサービス**で、Azureクラウド内に個別のデータベースをホストできます。独自のデータベースパターンを学習し、カスタマイズされた推奨事項と自動チューニングを提供する組み込みのインテリジェンスを備えています。
2. **Azure SQL Managed Instance**: これは、より大規模なSQL Serverインスタンススコープの展開向けです。最新のSQL ServerオンプレミスEnterprise Editionデータベースエンジンとのほぼ100%の互換性を提供し、一般的なセキュリティの懸念に対処するネイティブの仮想ネットワークVNet実装を提供し、オンプレミスSQL Server顧客にとって有利なビジネスモデルを提供します。
3. **Azure SQL Server on Azure VMs**: これはInfrastructure as a ServiceIaaS)で、オンプレミスで実行されているサーバーのように、**オペレーティングシステムとSQL Serverインスタンスを制御したい**マイグレーションに最適です。
### Azure SQL Database
**Azure SQL Database** is a **fully managed database platform as a service (PaaS)** that provides scalable and secure relational database solutions. It's built on the latest SQL Server technologies and eliminates the need for infrastructure management, making it a popular choice for cloud-based applications.
**Azure SQL Database**は、**完全管理型データベースプラットフォームとしてのサービスPaaS**で、スケーラブルで安全なリレーショナルデータベースソリューションを提供します。最新のSQL Server技術に基づいており、インフラ管理の必要がなく、クラウドベースのアプリケーションに人気の選択肢となっています。
#### Key Features
#### 主な機能
- **Always Up-to-Date**: Runs on the latest stable version of SQL Server and Receives new features and patches automatically.
- **PaaS Capabilities**: Built-in high availability, backups, and updates.
- **Data Flexibility**: Supports relational and non-relational data (e.g., graphs, JSON, spatial, and XML).
- **常に最新**: 最新の安定版SQL Serverで実行され、新機能やパッチを自動的に受け取ります。
- **PaaS機能**: 組み込みの高可用性、バックアップ、更新。
- **データの柔軟性**: リレーショナルデータと非リレーショナルデータグラフ、JSON、空間、XMLをサポート。
#### Purchasing Models / Service Tiers
#### 購入モデル / サービスタイア
- **vCore-based**: Choose compute, memory, and storage independently. For General Purpose, Business Critical (with high resilience and performance for OLTP apps), and scales up to 128 TB storag
- **DTU-based**: Bundles compute, memory, and I/O into fixed tiers. Balanced resources for common tasks.
- Standard: Balanced resources for common tasks.
- Premium: High performance for demanding workloads.
- **vCoreベース**: コンピュート、メモリ、ストレージを独立して選択。一般的な用途、ビジネスクリティカルOLTPアプリ向けの高い耐障害性とパフォーマンスで、最大128TBのストレージにスケールアップ。
- **DTUベース**: コンピュート、メモリ、I/Oを固定のティアにバンドル。一般的なタスクに対するバランスの取れたリソース。
- スタンダード: 一般的なタスクに対するバランスの取れたリソース。
- プレミアム: 要求の厳しいワークロード向けの高パフォーマンス。
#### Deployment Models
#### デプロイメントモデル
Azure SQL Database supports flexible deployment options to suit various needs:
Azure SQL Databaseは、さまざまなニーズに応じた柔軟なデプロイメントオプションをサポートしています:
- **Single Database**:
- A fully isolated database with its own dedicated resources.
- Great for microservices or applications requiring a single data source.
- **Elastic Pool**:
- Allows multiple databases to share resources within a pool.
- Cost-efficient for applications with fluctuating usage patterns across multiple databases.
- **シングルデータベース**:
- 専用リソースを持つ完全に孤立したデータベース。
- マイクロサービスや単一のデータソースを必要とするアプリケーションに最適。
- **エラスティックプール**:
- 複数のデータベースがプール内でリソースを共有できる。
- 複数のデータベース間で使用パターンが変動するアプリケーションにコスト効率的。
#### Scalable performance and pools
#### スケーラブルなパフォーマンスとプール
- **Single Databases**: Each database is isolated and has its own dedicated compute, memory, and storage resources. Resources can be scaled dynamically (up or down) without downtime (1128 vCores, 32 GB4 TB storage, and up to 128 TB).
- **Elastic Pools**: Share resources across multiple databases in a pool to maximize efficiency and save costs. Resources can also be scaled dynamically for the entire pool.
- **Service Tier Flexibility**: Start small with a single database in the General Purpose tier. Upgrade to Business Critical or Hyperscale tiers as needs grow.
- **Scaling Options**: Dynamic Scaling or Autoscaling Alternatives.
- **シングルデータベース**: 各データベースは孤立しており、専用のコンピュート、メモリ、ストレージリソースを持っています。リソースはダウンタイムなしで動的にスケールアップまたはスケールダウンできます1〜128 vCores32 GB4 TBストレージ、最大128 TB)。
- **エラスティックプール**: 複数のデータベース間でリソースを共有し、効率を最大化し、コストを節約します。プール全体のリソースも動的にスケールできます。
- **サービスティアの柔軟性**: 一般的な用途のティアでシングルデータベースから小さく始めます。ニーズが増えるにつれてビジネスクリティカルまたはハイパースケールティアにアップグレードします。
- **スケーリングオプション**: 動的スケーリングまたはオートスケーリングの代替。
#### Built-In Monitoring & Optimization
#### 組み込みの監視と最適化
- **Query Store**: Tracks performance issues, identifies top resource consumers, and offers actionable recommendations.
- **Automatic Tuning**: Proactively optimizes performance with features like automatic indexing and query plan corrections.
- **Telemetry Integration**: Supports monitoring through Azure Monitor, Event Hubs, or Azure Storage for tailored insights.
- **クエリストア**: パフォーマンスの問題を追跡し、主要なリソース消費者を特定し、実行可能な推奨事項を提供します。
- **自動チューニング**: 自動インデックス作成やクエリプラン修正などの機能でパフォーマンスを積極的に最適化します。
- **テレメトリー統合**: Azure MonitorEvent Hubs、またはAzure Storageを通じて監視をサポートし、カスタマイズされたインサイトを提供します。
#### Disaster Recovery & Availavility
#### 災害復旧と可用性
- **Automatic backups**: SQL Database automatically performs full, differential, and transaction log backups of databases
- **Point-in-Time Restore**: Recover databases to any past state within the backup retention period.
- **Geo-Redundancy**
- **Failover Groups**: Simplifies disaster recovery by grouping databases for automatic failover across regions.
- **自動バックアップ**: SQL Databaseは、データベースのフル、差分、およびトランザクションログバックアップを自動的に実行します。
- **ポイントインタイムリストア**: バックアップ保持期間内の任意の過去の状態にデータベースを復元します。
- **地理的冗長性**
- **フェイルオーバーグループ**: データベースをグループ化して自動フェイルオーバーを行うことで、災害復旧を簡素化します。
### Azure SQL Managed Instance
**Azure SQL Managed Instance** is a Platform as a Service (PaaS) database engine that offers near 100% compatibility with SQL Server and handles most management tasks (e.g., upgrading, patching, backups, monitoring) automatically. It provides a cloud solution for migrating on-premises SQL Server databases with minimal changes.
**Azure SQL Managed Instance**は、SQL Serverとのほぼ100%の互換性を提供し、ほとんどの管理タスクアップグレード、パッチ適用、バックアップ、監視を自動的に処理するプラットフォームとしてのサービスPaaSデータベースエンジンです。最小限の変更でオンプレミスSQL Serverデータベースを移行するためのクラウドソリューションを提供します。
#### Service Tiers
#### サービスタイア
- **General Purpose**: Cost-effective option for applications with standard I/O and latency requirements.
- **Business Critical**: High-performance option with low I/O latency for critical workloads.
- **一般的な用途**: 標準的なI/Oおよびレイテンシ要件を持つアプリケーション向けのコスト効率の良いオプション。
- **ビジネスクリティカル**: 重要なワークロード向けの低I/Oレイテンシを持つ高パフォーマンスオプション。
#### Advanced Security Features
#### 高度なセキュリティ機能
* **Threat Protection**: Advanced Threat Protection alerts for suspicious activities and SQL injection attacks. Auditing to track and log database events for compliance.
* **Access Control**: Microsoft Entra authentication for centralized identity management. Row-Level Security and Dynamic Data Masking for granular access control.
* **Backups**: Automated and manual backups with point-in-time restore capability.
* **脅威保護**: 疑わしい活動やSQLインジェクション攻撃に対する高度な脅威保護アラート。コンプライアンスのためのデータベースイベントの追跡とログ記録。
* **アクセス制御**: 中央集権的なアイデンティティ管理のためのMicrosoft Entra認証。細かいアクセス制御のための行レベルセキュリティと動的データマスキング。
* **バックアップ**: ポイントインタイムリストア機能を持つ自動および手動バックアップ。
### Azure SQL Virtual Machines
**Azure SQL Virtual Machines** is best for migrations where you want **control over the operating system and SQL Server instance**, like it was a server running on-premises. It can have different machine sizes, and a wide selection of SQL Server versions and editions.
**Azure SQL Virtual Machines**は、オンプレミスで実行されているサーバーのように、**オペレーティングシステムとSQL Serverインスタンスを制御したい**マイグレーションに最適です。異なるマシンサイズや、さまざまなSQL Serverバージョンとエディションを選択できます。
#### Key Features
#### 主な機能
**Automated Backup**: Schedule backups for SQL databases.
**Automatic Patching**: Automates the installation of Windows and SQL Server updates during a maintenance window.
**Azure Key Vault Integration**: Automatically configures Key Vault for SQL Server VMs.
**Defender for Cloud Integration**: View Defender for SQL recommendations in the portal.
**Version/Edition Flexibility**: Change SQL Server version or edition metadata without redeploying the VM.
**自動バックアップ**: SQLデータベースのバックアップをスケジュールします。
**自動パッチ適用**: メンテナンスウィンドウ中にWindowsおよびSQL Serverの更新を自動的にインストールします。
**Azure Key Vault統合**: SQL Server VMのためにKey Vaultを自動的に構成します。
**Defender for Cloud統合**: ポータルでSQLの推奨事項を表示します。
**バージョン/エディションの柔軟性**: VMを再デプロイすることなくSQL Serverのバージョンまたはエディションのメタデータを変更できます。
#### Security Features
#### セキュリティ機能
**Microsoft Defender for SQL**: Security insights and alerts.
**Azure Key Vault Integration**: Secure storage of credentials and encryption keys.
**Microsoft Entra (Azure AD)**: Authentication and access control.
**Microsoft Defender for SQL**: セキュリティインサイトとアラート。
**Azure Key Vault統合**: 認証情報と暗号化キーの安全な保管。
**Microsoft EntraAzure AD**: 認証とアクセス制御。
## Enumeration
{{#tabs}}
{{#tab name="az cli"}}
```bash
# List Servers
az sql server list # --output table
@@ -164,11 +163,9 @@ az sql midb show --resource-group <res-grp> --name <name>
az sql vm list
az sql vm show --resource-group <res-grp> --name <name>
```
{{#endtab}}
{{#tab name="Az PowerShell"}}
```powershell
# List Servers
Get-AzSqlServer -ResourceGroupName "<resource-group-name>"
@@ -206,60 +203,51 @@ Get-AzSqlInstanceDatabase -ResourceGroupName <ResourceGroupName> -InstanceName <
# Lis all sql VM
Get-AzSqlVM
```
{{#endtab}}
{{#endtabs}}
### Connect and run SQL queries
You could find a connection string (containing credentials) from example [enumerating an Az WebApp](az-app-services.md):
### 接続してSQLクエリを実行する
例として[Az WebAppの列挙](az-app-services.md)から接続文字列(資格情報を含む)を見つけることができます:
```powershell
function invoke-sql{
param($query)
$Connection_string = "Server=tcp:supercorp.database.windows.net,1433;Initial Catalog=flag;Persist Security Info=False;User ID=db_read;Password=gAegH!324fAG!#1fht;MultipleActiveResultSets=False;Encrypt=True;TrustServerCertificate=False;Connection Timeout=30;"
$Connection = New-Object System.Data.SqlClient.SqlConnection $Connection_string
$Connection.Open()
$Command = New-Object System.Data.SqlClient.SqlCommand
$Command.Connection = $Connection
$Command.CommandText = $query
$Reader = $Command.ExecuteReader()
while ($Reader.Read()) {
$Reader.GetValue(0)
}
$Connection.Close()
param($query)
$Connection_string = "Server=tcp:supercorp.database.windows.net,1433;Initial Catalog=flag;Persist Security Info=False;User ID=db_read;Password=gAegH!324fAG!#1fht;MultipleActiveResultSets=False;Encrypt=True;TrustServerCertificate=False;Connection Timeout=30;"
$Connection = New-Object System.Data.SqlClient.SqlConnection $Connection_string
$Connection.Open()
$Command = New-Object System.Data.SqlClient.SqlCommand
$Command.Connection = $Connection
$Command.CommandText = $query
$Reader = $Command.ExecuteReader()
while ($Reader.Read()) {
$Reader.GetValue(0)
}
$Connection.Close()
}
invoke-sql 'Select Distinct TABLE_NAME From information_schema.TABLES;'
```
You can also use sqlcmd to access the database. It is important to know if the server allows public connections `az sql server show --name <server-name> --resource-group <resource-group>`, and also if it the firewall rule let's our IP to access:
データベースにアクセスするためにsqlcmdを使用することもできます。サーバーがパブリック接続を許可しているかどうかを確認することが重要です `az sql server show --name <server-name> --resource-group <resource-group>`、また、ファイアウォールルールが私たちのIPのアクセスを許可しているかどうかも確認する必要があります
```powershell
sqlcmd -S <sql-server>.database.windows.net -U <server-user> -P <server-passworkd> -d <database>
```
## References
## 参考文献
- [https://learn.microsoft.com/en-us/azure/azure-sql/azure-sql-iaas-vs-paas-what-is-overview?view=azuresql](https://learn.microsoft.com/en-us/azure/azure-sql/azure-sql-iaas-vs-paas-what-is-overview?view=azuresql)
- [https://learn.microsoft.com/en-us/azure/azure-sql/database/single-database-overview?view=azuresql](https://learn.microsoft.com/en-us/azure/azure-sql/database/single-database-overview?view=azuresql)
- [https://learn.microsoft.com/en-us/azure/azure-sql/managed-instance/sql-managed-instance-paas-overview?view=azuresql](https://learn.microsoft.com/en-us/azure/azure-sql/managed-instance/sql-managed-instance-paas-overview?view=azuresql)
- [https://learn.microsoft.com/en-us/azure/azure-sql/virtual-machines/windows/sql-server-on-azure-vm-iaas-what-is-overview?view=azuresql](https://learn.microsoft.com/en-us/azure/azure-sql/virtual-machines/windows/sql-server-on-azure-vm-iaas-what-is-overview?view=azuresql)
## Privilege Escalation
## 権限昇格
{{#ref}}
../az-privilege-escalation/az-sql-privesc.md
{{#endref}}
## Post Exploitation
## ポストエクスプロイト
{{#ref}}
../az-post-exploitation/az-sql-post-exploitation.md
{{#endref}}
{{#include ../../../banners/hacktricks-training.md}}