Translated ['', 'src/pentesting-cloud/azure-security/az-services/az-stor

This commit is contained in:
Translator
2026-07-17 06:09:48 +00:00
parent 18cdb6b811
commit 1a9af458e6
2 changed files with 150 additions and 150 deletions
@@ -4,47 +4,47 @@
## Azure SQL
Azure SQL은 **Azure cloud의 SQL Server database engine**을 사용하는 관리형, 보안성 높은, 지능형 제품군입니다. 즉, 서버의 물리적 관리에 신경 쓸 필요고, 데이터 관리에 집중할 수 있습니다.
Azure SQL은 **Azure cloud의 SQL Server database engine을 사용하는** managed, secure, intelligent 제품군입니다. 즉, 서버의 물리적 관리를 걱정할 필요 없 데이터 관리에 집중할 수 있습니다.
Azure SQL은 네 가지 주요 서비스로 구성됩니다:
Azure SQL은 네 가지 주요 제품으로 구성됩니다.
1. **Azure SQL Server**: SQL Server databases의 **deployment and management**에 필요합니다.
2. **Azure SQL Database**: Azure cloud에서 개별 databases를 호스팅할 수 있는 **fully-managed database service**입니다.
3. **Azure SQL Managed Instance**: 더 큰 규모의, 전체 SQL Server instance 범위 배포를 위한 입니다.
4. **Azure SQL Server on Azure VMs**: 운영 체제 SQL Server instance에 대한 **control**을 원할 때 가장 적합합니다.
1. **Azure SQL Server**: SQL Server database의 **배포 및 관리**를 위해 서버가 필요합니다.
2. **Azure SQL Database**: Azure cloud에서 개별 database를 호스팅할 수 있는 **fully-managed database service**입니다.
3. **Azure SQL Managed Instance**: 더 큰 규모의 전체 SQL Server instance 범위 배포를 위한 제품입니다.
4. **Azure VMs의 Azure SQL Server**: **운영 체제 **및 SQL Server instance를 직접 제어하려는 아키텍처에 가장 적합합니다.
### SQL Server Security Features
### SQL Server 보안 기능
**Network access:**
**네트워크 액세스:**
- Public endpoint(특정 networks로의 access를 제한할 수 있음).
- Public endpoint(특정 네트워크로 액세스를 제한할 수 있음).
- Private endpoints.
- domain names를 기준으로 connections를 제한할 수도 있습니다.
- Azure services가 접근하도록 허용할 수도 있습니다(예: portal Query editor를 사용하거나 Azure VM이 connect하도록 허용).
- SQL Server에 *Allow Azure services and resources to access this server*가 "Enabled"로 설정되어 있으면, Azure는 Azure에서 시작된 모든 network traffic이 SQL Server에 connect할 수 있도록 하는 hidden firewall rule을 자동으로 생성합니다 — 다른 tenant의 resources도 포함됩니다.
- 즉, 유효한 SQL credentials를 획득했다면, 자신의 attackercontrolled tenant 내부의 Azure VM에서 피해자의 Azure SQL Server에 connect할 수 있습니다. [MS docs explains this](https://learn.microsoft.com/en-us/azure/azure-sql/database/network-access-controls-overview?view=azuresql#allow-azure-services)
- 도메인 이름을 기준으로 연결을 제한할 수도 있습니다.
- Azure services가 액세스하도록 허용할 수도 있습니다(예: portal에서 Query editor를 사용하거나 Azure VM이 연결하도록 허용).
- SQL Server에 *Allow Azure services and resources to access this server*가 "Enabled"로 설정된 경우, Azure는 Azure에서 시작된 모든 네트워크 트래픽이 SQL Server에 연결할 수 있도록 하는 숨겨진 firewall rule을 자동으로 생성합니다. 여기에는 모든 tenant의 리소스가 포함됩니다.
- 즉, 유효한 SQL credentials를 획득하면 공격자가 제어하는 자체 tenant 내부의 Azure VM에서 victim Azure SQL Server에 연결할 수 있습니다. [MS docs에서 이를 설명합니다](https://learn.microsoft.com/en-us/azure/azure-sql/database/network-access-controls-overview?view=azuresql#allow-azure-services)
**Authentication Methods:**
**인증 방법:**
- Microsoft **Entra-only** authentication: 서비스에 access할 Entra principals를 지정해야 합니다.
- **Both SQL and Microsoft Entra** authentication: Microsoft Entra와 함께 전통적인 username password 기 SQL authentication을 사용합니다.
- **Only SQL** authentication: database users를 통한 access만 허용합니다.
- Microsoft **Entra-only** authentication: service에 액세스할 Entra principal 지정해야 합니다.
- **Both SQL and Microsoft Entra** authentication: Microsoft Entra와 함께 username password를 사용하는 SQL authentication니다.
- **Only SQL** authentication: database user를 통한 액세스만 허용합니다.
SQL auth가 허용되 admin user(username + password)를 지정해야 하, Entra ID auth 선택되면 admin access를 가진 principal을 최소 하나 이상 지정해야 한다는 점에 유의하세요.
SQL auth가 허용되는 경우 admin user(username + password)를 지정해야 하, Entra ID auth 선택한 경우 admin access를 가진 principal을 하나 이상 지정해야 합니다.
**Encryption:**
**암호화:**
- “Transparent data encryption”이라고 하며, databases, backups, logs를 at rest 상태에서 암호화합니다.
- 항상 그렇듯, 기본적으로 Azure managed key가 사용되지만 customer managed encryption key (CMEK)도 사용할 수 있습니다.
- “Transparent data encryption”이라고 하며 저장 상태의 database, backup log 암호화합니다.
- 항상 그렇듯 기본적으로 Azure managed key가 사용되지만 customer managed encryption key(CMEK)도 사용할 수 있습니다.
**Managed Identities:**
- system user managed MIs를 할당할 수 있습니다.
- encryption key(CMEK가 사용되는 경우) databases에서 다른 servicesaccess하는 데 사용됩니다.
- database에서 접근할 수 있는 Azure services 예시는 [this page of the docs](https://learn.microsoft.com/en-us/sql/t-sql/statements/create-external-data-source-transact-sql)에서 확인할 수 있습니다.
- 둘 이상의 UMI가 할당된 경우, 사용할 default one을 지정할 수 있습니다.
- cross-tenant access를 위 federated client identity를 설정할 수 있습니다.
- system managed MI와 user managed MI를 할당할 수 있습니다.
- encryption key(CMEK가 사용되는 경우) database에서 사용하는 기타 service에 액세스하는 데 사용됩니다.
- database에서 액세스할 수 있는 Azure service의 일부 예시는 [docs의 이 페이지](https://learn.microsoft.com/en-us/sql/t-sql/statements/create-external-data-source-transact-sql)를 참조하세요.
- 둘 이상의 UMI가 할당된 경우 사용할 기본 UMI를 지정할 수 있습니다.
- cross-tenant access를 위 federated client identity를 구성할 수 있습니다.
SQL database에서 blob storage 내부의 정보를 access하는 몇 가지 commands:
SQL database에서 blob storage 내부의 정보에 액세스하는 일부 command:
```sql
-- Create a credential for the managed identity
CREATE DATABASE SCOPED CREDENTIAL [ManagedIdentityCredential]
@@ -71,58 +71,58 @@ GO
```
**Microsoft Defender:**
- 잠재적인 database 취약점을 완화하고, 비정상적인 활동을 탐지하는 데 유용
- Defender는 별도 레슨에서 다룰 예정임(다른 여러 Azure 서비스에서 활성화할 수 있음)
- 잠재적인 database vulnerabilities를 완화하고, anomalous activities를 탐지하는 데 유용
- Defender는 별도의 lesson에서 다룹니다(여러 다른 Azure services에서 활성화할 수 있음)
**Backups:**
- Backup 빈도는 retention policies에서 관리.
- Backup frequency는 retention policies에서 관리됩니다.
**Deleted databases:**
- 기존 backups에서 삭제된 DB를 복원할 수 있.
- 기존 backups에서 삭제된 DB를 restore할 수 있습니다.
## Azure SQL Database
**Azure SQL Database**는 확장 가능하고 안전한 relational database 솔루션을 제공하는 **fully managed database platform as a service (PaaS)**다. 최신 SQL Server 기술을 기반으로 구축되어 infrastructure management가 필요 없으므로, cloud-based 애플리케이션에 널리 사용다.
**Azure SQL Database**는 확장 가능하고 안전한 relational database solutions를 제공하는 **fully managed database platform as a service (PaaS)**입니다. 최신 SQL Server technologies를 기반으로 하며 infrastructure management가 필요하지 않아 cloud-based applications에 널리 사용됩니다.
SQL database를 생성하려면, 호스팅 SQL server를 지정해야 다.
SQL database를 생성하려면 호스팅 SQL server를 지정해야 합니다.
### SQL Database Security Features
- **Always Up-to-Date**: 최신 안정 버전의 SQL Server에서 실행며 새로운 기능과 패치를 자동으로 받음.
- **Always Up-to-Date**: 최신 stable version의 SQL Server 실행며 새로운 features와 patches를 자동으로 수신합니다.
- **Inherited SQL Server security features:**
- Authentication (SQL and/or Entra ID)
- Authentication (SQL 및/또는 Entra ID)
- Assigned Managed Identities
- Network restrictions
- Encryption
- Backups
-
- **Data redundancy:** 로컬, zone, Geo 또는 Geo-Zone redundant 옵션이 있.
- **Ledger:** 데이터의 무결성을 암호학적으로 검증하여 변조가 탐지되도록 보장함. 금융, 의료 및 민감한 데이터를 관리하는 모든 조직에 유용.
- **Data redundancy:** local, zone, Geo 또는 Geo-Zone redundant 옵션이 있습니다.
- **Ledger:** data의 integrity를 cryptographically verify하여 tampering이 발생했는지 탐지할 수 있도록 합니다. financial, medical 및 sensitive data를 관리하는 모든 organization에 유용합니다.
SQL database는 **elastic Pool**의 일부가 될 수 있다. Elastic pools는 구성 가능한 compute (eDTUs)와 storage 리소스를 여러 database가 공유하도록 하여 여러 database를 관리하는 데 비용 효율적인 솔루션이며, 가격은 database 수가 아니라 할당된 리소스에만 기반한다.
SQL database는 **elastic Pool**의 일부가 될 수 있습니다. Elastic pools는 여러 databases를 관리하기 위한 cost-effective solution으로, configurable compute (eDTUs)와 storage resources를 여러 databases가 공유하도록 합니다. 가격은 databases의 수가 아니라 할당된 resources를 기준으로 책정됩니다.
#### Azure SQL Column Level Security (Masking) & Row Level Security
**Azure SQL's dynamic** data masking은 **민감한 정보를 숨겨 비인가 사용자로부터 보호**하는 기능이다. 실제 데이터를 변경하는 대신, 표시되는 데이터를 동적으로 마스킹하여 credit card 번호와 같은 민감한 정보가 가려지도록 다.
**Azure SQL dynamic** data masking은 unauthorized users에게 sensitive information을 **숨겨 보호하는** feature입니다. 실제 data를 변경하는 대신 표시되는 data를 동적으로 mask하여 credit card numbers와 같은 sensitive details가 가려지도록 합니다.
**Dynamic Data Masking**은 unmasked된 사용자(이 사용자들은 지정되어야 함)와 administrators를 제외한 모든 사용자에게 적용다. 동적 data masking에서 제외되는 SQL 사용자를 지정하는 구성 옵션이 있으며, **administrators는 항상 제외**된다.
**Dynamic Data Masking**은 unmasked 상태인 users(이 users는 지정야 함)와 administrators를 제외한 모든 users에게 적용됩니다. 어떤 SQL users가 dynamic data masking에서 exempt되는지 지정하는 configuration option이 있으며, **administrators는 항상 제외됩니다**.
**Azure SQL Row Level Security (RLS)**는 사용자가 **어떤 rows를 볼 수 있거나 수정할 수 있는지 제어**하는 기능으로, 각 사용자가 자신과 관련된 data만 보도록 보장한다. filter 또는 block predicates security policies를 생성함으로써 조직은 database 수준에서 세밀한 접근 제어를 적용할 수 있다.
**Azure SQL Row Level Security (RLS)**는 사용자가 view하거나 modify할 수 있는 rows를 **제어하여**, 각 사용자가 자신에게 relevant한 data만 볼 수 있도록 하는 feature입니다. filter 또는 block predicates가 포함된 security policies를 생성하면 organizations는 database level에서 fine-grained access를 적용할 수 있습니다.
### Azure SQL Managed Instance
**Azure SQL Managed Instances**는 더 큰 규모의, 전체 SQL Server instance 범위 배포를 위한 것다. 최신 SQL Server on-premises (Enterprise Edition) Database Engine과 거의 100% 호환되며, 네이티브 virtual network (VNet) 구현을 제공해 일반적인 security concerns를 해결하고, on-premises SQL Server 고객에게 유리한 business model을 제공다.
**Azure SQL Managed Instances**는 더 큰 규모의 전체 SQL Server instance-scoped deployments를 위한 것입니다. 최신 on-premises SQL Server (Enterprise Edition) Database Engine과 거의 100%의 compatibility를 제공하며, 일반적인 security concerns를 해결하는 native virtual network (VNet) implementation과 on-premises SQL Server customers에게 유리한 business model을 제공합니다.
### Azure SQL Virtual Machines
**Azure SQL Virtual Machines** **operating system**과 SQL Server instance를 제어할 수 있게 해준다. VM service에서 SQL server를 실행하는 VM이 생성되기 때문다.
**Azure SQL Virtual Machines**를 사용하면 **operating system**과 SQL Server instance를 **control**할 수 있습니다. VM service에서 SQL server를 실행하는 VM이 spawn되기 때문입니다.
SQL Virtual Machine 생성되면, SQL server를 호스팅할 VM의 **모든 settings를 선택**할 수 있다( VM 레슨에 표시된 것처럼).
- 이는 VM이 일부 VNet(s)에 접근하게 되고, **Managed Identities attached**될 수 있으며, file shares가 마운트될 있음을 의미한다… 따라서 **SQL에서 VM으로 pivoting**이 매우 흥미다.
- 또한 app id와 secret을 설정하여 **SQL이 특정 key vault에 접근하도록 허용**할 수 있으며, 여기에 민감한 info가 어 있을 수 있다.
SQL Virtual Machine 생성할 때 SQL server를 호스팅할 **VM의 모든 settings를 선택**할 수 있습니다(VM lesson에서 설명한 것과 같음).
- 이는 VM이 일부 VNet(s)에 access하고, **Managed Identities attach**되어 있으며, file shares가 mount되어 있을 수 있음을 의미합니다. 따라서 **SQL에서 VM으로 pivoting**하는 것이 매우 흥미로울 수 있습니다.
- 또한 app id와 secret을 configure하여 **SQL이 특정 key vault에 access**하도록 할 수 있으며, 해당 vault에는 sensitive info가 포함되어 있을 수 있습니다.
**automatic SQL updates**, **automatic backups**, **Entra ID authentication** 및 다른 SQL 서비스들의 대부분 기능도 구성할 수 있다.
**automatic SQL updates**, **automatic backups**, **Entra ID authentication** 및 다른 SQL services의 대부분 features와 같은 항목도 configure할 수 있습니다.
## Enumeration
@@ -261,7 +261,7 @@ Get-AzSqlVM
{{#endtab}}
{{#endtabs}}
또한 데이터베이스 내에서 Dynamic Data Masking Row Level policies를 열거하고 싶다면, 다음을 쿼리할 수 있습니다:
또한 데이터베이스 내에서 Dynamic Data Masking Row Level policies를 열거하려면 다음을 쿼리할 수 있습니다:
```sql
--Enumerates the masked columns
SELECT
@@ -286,9 +286,9 @@ JOIN sys.security_predicates AS sp2
ON sp.object_id = sp2.object_id;
```
### SQL 쿼리 연결 및 실행
### 연결하고 SQL query 실행
example [enumerating an Az WebApp](az-app-services.md)에서 연결 문자열(자격 증명 포함)을 찾을 수 있습니다:
예를 들어 [Az WebApp 열거](az-app-services.md)를 통해 connection string(credentials 포함)을 찾을 수 있습니다:
```bash
function invoke-sql{
param($query)
@@ -307,18 +307,18 @@ $Connection.Close()
invoke-sql 'Select Distinct TABLE_NAME From information_schema.TABLES;'
```
또한 sqlcmd를 사용해 데이터베이스에 접근할 수 있습니다. 서버가 public connections 허용하는지 `az sql server show --name <server-name> --resource-group <resource-group>`로 확인하는 것이 중요하며, firewall rule이 우리 IP를 접근하도록 허용하는지도 확인해야 합니다:
sqlcmd를 사용하여 database에 액세스할 수 있습니다. 서버가 public connections 허용하는지 `az sql server show --name <server-name> --resource-group <resource-group>`를 사용해 확인하고, firewall rule이 우리 IP의 액세스를 허용하는지도 확인하는 것이 중요합니다:
```bash
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
@@ -330,7 +330,7 @@ sqlcmd -S <sql-server>.database.windows.net -U <server-user> -P <server-passwork
../az-post-exploitation/az-sql-post-exploitation.md
{{#endref}}
### Persistence
### 지속성
{{#ref}}
../az-persistence/az-sql-persistence.md
@@ -2,54 +2,54 @@
{{#include ../../../banners/hacktricks-training.md}}
## Basic Information
## 기본 정보
Azure Storage Accounts는 Microsoft Azure의 핵심 서비스로, blobs(binary large objects), files, queues, tables를 포함한 다양한 데이터 유형을 위한 확장 가능하고 안전하며 가용성이 높은 cloud **storage**를 제공합니다. 이들은 이러한 서로 다른 storage services를 하나의 namespace 아래는 컨테이너 역할을 하여 관리가 쉽습니다.
Azure Storage Accounts는 Microsoft Azure에서 확장 가능하고 안전하며 높은 가용성을 제공하는 기본 서비스로, blob(바이너리 대형 객체), 파일, 큐, 테이블을 비롯한 다양한 데이터 유형을 위한 **storage를 제공**합니다. 서로 다른 storage 서비스를 손쉽게 관리할 수 있도록 하나의 namespace 아래에 그룹화하는 컨테이너 역할을 니다.
**Main configuration options**:
**주요 configuration 옵션**:
- Every storage account must have a **uniq name across all Azure**.
- Every storage account is deployed in a **region** or in an Azure extended zone
- It's possible to select the **premium** version of the storage account for better performance
- It's possible to select among **4 types of redundancy to protect** against rack, drive and datacenter **failures**.
- 모든 storage account는 **전체 Azure에서 고유한 이름**을 가져야 합니다.
- 모든 storage account **region** 또는 Azure extended zone에 배포됩니다.
- 더 나은 성능을 위해 storage account의 **premium** 버전을 선택할 수 있습니다.
- rack, drive 및 datacenter **장애에 대비해 보호**할 수 있는 **4가지 redundancy 유형** 중 하나를 선택할 수 있습니다.
**Security configuration options**:
**Security configuration 옵션**:
- **Require secure transfer for REST API operations**: Require TLS in any communication with the storage
- **Allows enabling anonymous access on individual containers**: If not, it won't be possible to enable anonymous access in the future
- **Enable storage account key access**: If not, access with Shared Keys will be forbidden
- **Require secure transfer for REST API operations**: storage와의 모든 통신에 TLS를 요구합니다.
- **Allows enabling anonymous access on individual containers**: 비활성화하면 이후에 anonymous access를 활성화할 수 없습니다.
- **Enable storage account key access**: 비활성화하면 Shared Keys를 통한 access가 금지됩니다.
- **Minimum TLS version**
- **Permitted scope for copy operations**: Allow from any storage account, from any storage account from the same Entra tenant or from storage account with private endpoints in the same virtual network.
- **Permitted scope for copy operations**: 모든 storage account, 동일한 Entra tenant의 모든 storage account, 또는 동일한 virtual network에 private endpoints가 있는 storage account에서의 복사를 허용합니다.
**Blob Storage options**:
**Blob Storage 옵션**:
- **Allow cross-tenant replication**
- **Access tier**: Hot (frequently access data), Cool and Cold (rarely accessed data)
- **Access tier**: Hot(자주 access하는 데이터), Cool Cold(드물게 access하는 데이터)
**Networking options**:
**Networking 옵션**:
- **Network access**:
- Allow from all networks
- Allow from selected virtual networks and IP addresses
- Disable public access and use private access
- **Private endpoints**: It allows a private connection to the storage account from a virtual network
- 모든 network에서 허용
- 선택한 virtual network 및 IP 주소에서 허용
- public access를 비활성화하고 private access 사용
- **Private endpoints**: virtual network에서 storage account로의 private connection을 허용합니다.
**Data protection options**:
**Data protection 옵션**:
- **Point-in-time restore for containers**: Allows to restore containers to an earlier state
- It requires versioning, change feed, and blob soft delete to be enabled.
- **Enable soft delete for blobs**: It enables a retention period in days for deleted blobs (even overwritten)
- **Enable soft delete for containers**: It enables a retention period in days for deleted containers
- **Enable soft delete for file shares**: It enables a retention period in days for deleted file shared
- **Enable versioning for blobs**: Maintain previous versions of your blobs
- **Enable blob change feed**: Keep logs of create, modification, and delete changes to blobs
- **Enable version-level immutability support**: Allows you to set time-based retention policy on the account-level that will apply to all blob versions.
- Version-level immutability support and point-in-time restore for containers cannot be enabled simultaneously.
- **Point-in-time restore for containers**: container를 이전 상태로 restore할 수 있습니다.
- versioning, change feed blob soft delete를 활성화해야 합니다.
- **Enable soft delete for blobs**: 삭제된 blob(덮어쓴 blob 포함)에 대해 일 단위의 retention period를 활성화합니다.
- **Enable soft delete for containers**: 삭제된 container에 대해 일 단위의 retention period를 활성화합니다.
- **Enable soft delete for file shares**: 삭제된 file share에 대해 일 단위의 retention period를 활성화합니다.
- **Enable versioning for blobs**: blob의 이전 버전을 유지합니다.
- **Enable blob change feed**: blob의 생성, 수정 및 삭제 변경 사항에 대한 log를 유지합니다.
- **Enable version-level immutability support**: 모든 blob version에 적용되는 account-level time-based retention policy를 설정할 수 있습니다.
- Version-level immutability support point-in-time restore for containers는 동시에 활성화할 수 없습니다.
**Encryption configuration options**:
**Encryption configuration 옵션**:
- **Encryption type**: It's possible to use Microsoft-managed keys (MMK) or Customer-managed keys (CMK)
- **Enable infrastructure encryption**: Allows to double encrypt the data "for more security"
- **Encryption type**: Microsoft-managed keys(MMK) 또는 Customer-managed keys(CMK)를 사용할 수 있습니다.
- **Enable infrastructure encryption**: "더 높은 security를 위해" 데이터를 이중으로 encrypt할 수 있습니다.
### Storage endpoints
@@ -64,19 +64,19 @@ Azure Storage Accounts는 Microsoft Azure의 핵심 서비스로, blobs(binary l
### Public Exposure
If "Allow Blob public access" is **enabled** (disabled by default), when creating a container it's possible to:
"Allow Blob public access"가 **활성화**되어 있으면(기본값은 비활성화), container를 생성할 때 다음과 같이 설정할 수 있습니다.
- Give **public access to read blobs** (you need to know the name).
- **List container blobs** and **read** them.
- Make it fully **private**
- **blob을 read할 수 있는 public access** 부여(이름을 알고 있어야 합니다).
- **container blob을 list**하고 **read**합니다.
- 완전히 **private**으로 설정합니다.
<figure><img src="https://lh7-rt.googleusercontent.com/slidesz/AGV_vUfoetUnYBPWQpRrWNnnlbqWpl8Rdoaeg5uBrCVlvcNDlnKwQHjZe8nUb2SfPspBgbu-lCZLmUei-hFi_Jl2eKbaxUtBGTjdUSDmkrcwr90VZkmuMjk9tyh92p75btfyzGiUTa0-=s2048?key=m8TV59TrCFPlkiNnmhYx3aZt" alt=""><figcaption></figcaption></figure>
### Static website (`$web`) exposure & leaked secrets
- **Static websites** are served from the special `$web` container over a region-specific endpoint such as `https://<account>.z13.web.core.windows.net/`.
- The `$web` container may report `publicAccess: null` via the blob API, but files are still reachable through the static site endpoint, so dropping config/IaC artifacts there can leak secrets.
- Quick audit workflow:
- **Static websites**`https://<account>.z13.web.core.windows.net/`과 같은 region-specific endpoint를 통해 특수한 `$web` container에서 제공됩니다.
- `$web` container는 blob API를 통해 `publicAccess: null`을 보고할 수 있지만, 파일은 여전히 static site endpoint를 통해 접근할 수 있으므로 해당 위치에 config/IaC artifact를 저장하면 secrets가 leak될 수 있습니다.
- 빠른 audit workflow:
```bash
# Identify storage accounts with static website hosting enabled
az storage blob service-properties show --account-name <acc-name> --auth-mode login
@@ -89,51 +89,51 @@ az storage blob download -c '$web' --name iac/terraform.tfvars --file /dev/stdou
```
### 익명 blob 노출 감사
- 데이터 노출 수 있는 **storage accounts**를 찾습니다: `az storage account list | jq -r '.[] | select(.properties.allowBlobPublicAccess==true) | .name'`. `allowBlobPublicAccess``false`이면 container를 public으로 만들 수 없습니다.
- 위험한 account를 검사해 플래그와 다른 약한 설정 확인합니다: `az storage account show --name <acc> --query '{allow:properties.allowBlobPublicAccess, minTls:properties.minimumTlsVersion}'`.
- 플래그가 활성화된 경우 container 수준 노출 열거합니다:
- **데이터 노출 수 있는 storage account 찾기**: `az storage account list | jq -r '.[] | select(.properties.allowBlobPublicAccess==true) | .name'`. `allowBlobPublicAccess``false`이면 container를 public으로 설정할 수 없습니다.
- **위험한 account를 검사하여 해당 플래그 및 기타 취약한 설정 확인**: `az storage account show --name <acc> --query '{allow:properties.allowBlobPublicAccess, minTls:properties.minimumTlsVersion}'`.
- **플래그가 활성화된 경우 container 수준 노출 열거**:
```bash
az storage container list --account-name <acc> \
--query '[].{name:name, access:properties.publicAccess}'
```
- `"Blob"`: 익명 read는 **blob 이름려진 경우에만** 허용됩니다(목록 조회 불가).
- `"Container"`: 모든 blob에 대한 익명 **list + read**.
- `null`: private; authentication required.
- **credentials 없이 access를 증명**:
- `publicAccess``Container`인 경우, 익명 listing이 동작합니다: `curl "https://<acc>.blob.core.windows.net/<container>?restype=container&comp=list"`.
- `Blob` `Container` 둘 다에서, blob 이름을 알고 있으면 익명 blob download가 동작합니다:
- `"Blob"`: blob 이름고 있는 경우에만 anonymous read 허용됨 (listing 불가).
- `"Container"`: 모든 blob에 대해 anonymous **list + read** 허용됨.
- `null`: private; authentication 필요.
- **자격 증명 없이 access 입증**:
- `publicAccess``Container`인 경우 anonymous listing이 작동함: `curl "https://<acc>.blob.core.windows.net/<container>?restype=container&comp=list"`.
- `Blob` `Container` 모두 이름을 알고 있으면 anonymous blob download가 작동함:
```bash
az storage blob download -c <container> -n <blob> --account-name <acc> --file /dev/stdout
# or via raw HTTP
curl "https://<acc>.blob.core.windows.net/<container>/<blob>"
```
### Connect to Storage
### Storage에 연결
연결할 수 있는 **storage**를 찾면 [**Microsoft Azure Storage Explorer**](https://azure.microsoft.com/es-es/products/storage/storage-explorer/) 도구를 사용해 접근할 수 있다.
연결할 수 있는 **storage**를 찾았다면 [**Microsoft Azure Storage Explorer**](https://azure.microsoft.com/es-es/products/storage/storage-explorer/) 도구를 사용할 수 있습니다.
## Access to Storage <a href="#about-blob-storage" id="about-blob-storage"></a>
## Storage에 대한 액세스 <a href="#about-blob-storage" id="about-blob-storage"></a>
### RBAC
**RBAC roles**를 사용해 Entra ID principals로 storage accounts에 접근하는 것이 가능하며, 이것이 권장되는 방법이다.
Entra ID principal에 **RBAC roles**를 사용하여 storage accounts에 액세스할 수 있으며, 이 권장되는 방식입니다.
### Access Keys
storage accounts에는 접근에 사용할 수 있는 access keys가 있으며, 이를 사용해 접근할 수 있다. 이것은 **storage account에 대한 완전한 접근 권한**을 제공다.
storage accounts에는 액세스에 사용할 수 있는 access keys가 있습니다. 이는 storage account에 대한 전체 액세스를 제공합니다.
<figure><img src="../../../images/image (5).png" alt=""><figcaption></figcaption></figure>
### **Shared Keys & Lite Shared Keys**
[**Shared Keys**](https://learn.microsoft.com/en-us/rest/api/storageservices/authorize-with-shared-key)를 생성해 access keys로 서명하면, signed URL을 통해 특정 리소스에 대한 access를 승인할 수 있다.
access keys로 서명된 [**Shared Keys를 생성**](https://learn.microsoft.com/en-us/rest/api/storageservices/authorize-with-shared-key)하여 signed URL을 통해 특정 리소스에 대한 액세스를 인증할 수 있습니다.
> [!NOTE]
> `CanonicalizedResource` 부분은 storage services resource (URI)를 나타낸다. URL의 어느 부분이든 encoded 되어 있다면, `CanonicalizedResource` 내부에서도 encoded 되어야 한다.
> `CanonicalizedResource` 부분은 storage services resource (URI)를 나타냅니다. 또한 URL의 일부가 인코딩되어 있다면 `CanonicalizedResource` 내부에서도 인코딩해야 합니다.
> [!NOTE]
> 것은 요청 인증을 위해 `az` cli에서 기본적으로 **사용다**. Entra ID principal credentials를 사용하 하려면 `--auth-mode login` param을 지정하라.
> 는 기본적으로 `az` cli가 requests를 인증하는 데 **사용됩니다**. Entra ID principal credentials를 사용하도록 하려면 `--auth-mode login` param을 지정합니다.
- 다음 정보를 서명하여 blob, queue and file services용 **shared key**를 생성할 수 있다:
- **blob, queue file services에 대한 shared key를 생성**하여 다음 정보를 서명할 수 있습니다:
```bash
StringToSign = VERB + "\n" +
Content-Encoding + "\n" +
@@ -150,7 +150,7 @@ Range + "\n" +
CanonicalizedHeaders +
CanonicalizedResource;
```
- 다음 정보를 서명하여 **shared key for table services**를 생성할 수 있습니다:
- 다음 정보를 서명하여 **table services용 shared key**를 생성할 수 있습니다:
```bash
StringToSign = VERB + "\n" +
Content-MD5 + "\n" +
@@ -158,7 +158,7 @@ Content-Type + "\n" +
Date + "\n" +
CanonicalizedResource;
```
- **blob, queue, file services**용 **lite shared key**를 다음 정보를 서명하여 생성할 수 있습니다:
- 다음 정보를 signing하여 **blob, queue file serviceslite shared key**를 생성할 수 있습니다:
```bash
StringToSign = VERB + "\n" +
Content-MD5 + "\n" +
@@ -167,12 +167,12 @@ Date + "\n" +
CanonicalizedHeaders +
CanonicalizedResource;
```
- 다음 정보를 서명하여 **lite shared key for table services**를 생성할 수 있습니다:
- 다음 정보를 signing하여 **table services**용 **lite shared key**를 생성할 수 있습니다:
```bash
StringToSign = Date + "\n"
CanonicalizedResource
```
그다음, key를 사용하려면 Authorization header에서 다음 syntax를 따르시면 됩니다:
다음, 를 사용하려면 다음 구문에 따라 Authorization 헤더에 포함하면 됩니다:
```bash
Authorization="[SharedKey|SharedKeyLite] <AccountName>:<Signature>"
#e.g.
@@ -186,68 +186,68 @@ Content-Length: 0
```
### **Shared Access Signature** (SAS)
Shared Access Signatures (SAS)는 Azure Storage 계정의 access keys를 노출하지 않고 **resource에 접근할 수 있는 특정 permissions를 부여하는** 안전한 시간 제한 URL입니다. access keys가 모든 resource에 대한 전체 administrative access를 제공하는 반면, SAS는 permissions를 지정하고 만료 시간을 정의함으로써 세밀한 제어를 가능하게 합니다.
Shared Access Signatures (SAS)는 Azure Storage account의 access key를 노출하지 않고 **리소스**에 액세스할 수 있는 특정 권한을 부여하는 안전한 시간 제한 URL입니다. access key 모든 리소스에 대한 전체 administrative access를 제공하지만, SAS는 권한(예: read 또는 write)을 지정하고 expiration time을 정의하여 세분화된 제어를 허용합니다.
#### SAS Types
- **User delegation SAS**: 이는 **Entra ID principal**에서 생성되며, 이 principal이 SAS를 sign하고 user의 permissions를 SAS로 delegate합니다. **blob and data lake storage**에서만 사용할 수 있습니다 ([docs](https://learn.microsoft.com/en-us/rest/api/storageservices/create-user-delegation-sas)). 생성된 모든 user delegated SAS를 **revoke**할 수 있습니다.
- 사용자의 권한보다 "더 많은" permissions를 가진 delegation SAS를 생성할 수 있는 것처럼 보일 수 있습니다. 그러나 principal이 해당 permissions를 가지고 있지 않으면 작하지 않습니다(privesc 없음).
- **Service SAS**: storage account **access keys** 중 하나를 사용해 sign됩니다. 단일 storage service의 특정 resource에 대한 access를 부여하는 데 사용할 수 있습니다. key가 renewed되면 SAS는 동작을 멈춥니다.
- **Account SAS**: 이것도 storage account **access keys** 중 하나로 sign됩니다. storage account services(Blob, Queue, Table, File) 전반의 resource에 대한 access를 부여하며 service-level operations를 포함할 수 있습니다.
- **User delegation SAS**: SAS에 서명하고 user의 permissions를 SAS에 위임하는 **Entra ID principal**에서 생성됩니다. **blob data lake storage**에서만 사용할 수 있습니다([docs](https://learn.microsoft.com/en-us/rest/api/storageservices/create-user-delegation-sas)). 생성된 모든 user delegated SAS를 **revoke**할 수 있습니다.
- user가 보유한 permissions보다 "more" permissions를 가진 delegation SAS를 생성하는 것은 가능합니다. 그러나 principal이 해당 permissions를 보유하지 않으면 작하지 않습니다(no privesc).
- **Service SAS**: storage account **access keys** 중 하나를 사용하여 서명됩니다. 단일 storage service의 특정 리소스에 대한 access를 부여하는 데 사용할 수 있습니다. key가 갱신되면 SAS는 작동을 중지합니다.
- **Account SAS**: storage account **access keys** 중 하나를 사용하여 서명됩니다. storage account의 여러 services(Blob, Queue, Table, File)에 걸쳐 리소스에 대한 access를 부여하며 service-level operations를 포함할 수 있습니다.
**access key**로 sign된 SAS URL은 다음과 같습니다:
**access key**로 서명된 SAS URL은 다음과 같습니다.
- `https://<container_name>.blob.core.windows.net/newcontainer?sp=r&st=2021-09-26T18:15:21Z&se=2021-10-27T02:14:21Z&spr=https&sv=2021-07-08&sr=c&sig=7S%2BZySOgy4aA3Dk0V1cJyTSIf1cW%2Fu3WFkhHV32%2B4PE%3D`
**user delegation**으로 sign된 SAS URL은 다음과 같습니다:
**user delegation**으로 서명된 SAS URL은 다음과 같습니다.
- `https://<container_name>.blob.core.windows.net/testing-container?sp=r&st=2024-11-22T15:07:40Z&se=2024-11-22T23:07:40Z&skoid=d77c71a1-96e7-483d-bd51-bd753aa66e62&sktid=fdd066e1-ee37-49bc-b08f-d0e152119b04&skt=2024-11-22T15:07:40Z&ske=2024-11-22T23:07:40Z&sks=b&skv=2022-11-02&spr=https&sv=2022-11-02&sr=c&sig=7s5dJyeE6klUNRulUj9TNL0tMj2K7mtxyRc97xbYDqs%3D`
몇 가지 **http params**에 주목하세요:
다음 **http params**에 유의하세요.
- **`se`** param은 SAS의 **expiration date**를 나타냅니다
- **`sp`** param은 SAS의 **permissions**를 나타냅니다
- **`sig`**는 SAS를 검증하는 **signature**입니다
- **`se`** param은 SAS의 **expiration date**를 나타냅니다.
- **`sp`** param은 SAS의 **permissions**를 나타냅니다.
- **`sig`**는 SAS를 검증하는 **signature**입니다.
#### SAS permissions
SAS를 생성할 때 부여해야 하는 permissions를 지정해야 합니다. SAS 생성 대상 objet에 따라 포함될 수 있는 permissions가 다를 수 있습니다. 예를 들면:
SAS를 생성할 때 부여 permissions를 지정해야 합니다. SAS 생성는 object에 따라 여러 permissions가 포함될 수 있습니다. 예:
- (a)dd, (c)reate, (d)elete, (e)xecute, (f)ilter_by_tags, (i)set_immutability_policy, (l)ist, (m)ove, (r)ead, (t)ag, (w)rite, (x)delete_previous_version, (y)permanent_delete
## SFTP Support for Azure Blob Storage
## Azure Blob Storage의 SFTP Support
Azure Blob Storage는 이제 SSH File Transfer Protocol (SFTP)을 지원하며, 맞춤형 솔루션이나 third-party products 없이 Blob Storage로 직접 안전한 file transfer와 관리를 가능하게 합니다.
Azure Blob Storage는 이제 SSH File Transfer Protocol (SFTP)을 지원하므로 custom solutions 또는 third-party products 없이 Blob Storage로 직접 안전한 file transfer 및 management를 수행할 수 있습니다.
### Key Features
### 주요 Features
- Protocol Support: SFTP는 hierarchical namespace (HNS) 구성된 Blob Storage accounts에서 작합니다. 이는 더 쉬운 탐색을 위해 blobs directories subdirectories로 조직합니다.
- Security: SFTP는 local user identities를 사용할 수 있지만, authorization을 위해 Microsoft Entra ID 기반 access와 Azure RBAC도 지원합니다. 즉, local SFTP users를 만들지 않고도 일반적인 Blob Storage data-plane roles access를 부여할 수 있습니다. local users는 다음을 통해 authenticate할 수 있습니다:
- Protocol Support: SFTP는 hierarchical namespace (HNS) 구성된 Blob Storage accounts에서 작합니다. 이를 통해 blobs directories subdirectories로 구성되어 더 쉽게 탐색할 수 있습니다.
- Security: SFTP는 local user identities를 사용할 수 있으며, authorization을 위해 Azure RBAC를 사용하는 Microsoft Entra ID 기반 access도 지원합니다. 따라서 local SFTP users를 생성하는 대신 일반적인 Blob Storage data-plane roles를 사용하여 access를 부여할 수 있습니다. Local users는 다음을 통해 authenticate할 수 있습니다.
- Azure-generated passwords
- Public-private SSH key pairs
- Granular Permissions: Read, Write, Delete, List 같은 permissions 최대 100개의 containers에 대해 local users에게 할당할 수 있습니다.
- Networking Considerations: SFTP connections는 port 22를 통해 만들어집니다. Azure는 SFTP traffic을 보호하기 위해 firewalls, private endpoints, virtual networks 같은 network configurations를 지원합니다.
- 세분화된 Permissions: Read, Write, Delete List 같은 permissions 최대 100개의 containers에 대해 local users에게 할당할 수 있습니다.
- Networking Considerations: SFTP connections는 port 22를 통해 이루어집니다. Azure는 SFTP traffic을 보호하기 위해 firewalls, private endpoints 또는 virtual networks 같은 network configurations를 지원합니다.
### Setup Requirements
- Hierarchical Namespace: storage account를 생성할 때 HNS가 enabled되어 있어야 합니다.
- Supported Encryption: Microsoft Security Development Lifecycle (SDL) approved cryptographic algorithms(예: rsa-sha2-256, ecdsa-sha2-nistp256)이 필요합니다.
- Hierarchical Namespace: storage account를 생성할 때 HNS를 활성화해야 합니다.
- Supported Encryption: Microsoft Security Development Lifecycle (SDL)에서 승인한 cryptographic algorithms(예: rsa-sha2-256, ecdsa-sha2-nistp256)이 필요합니다.
- SFTP Configuration:
- storage account에서 SFTP를 enable합니다.
- local-user access의 경우, 적절한 permissions를 가진 local user identities를 만듭니다.
- local users의 경우, container 내에서 시작 위치를 정의하도록 home directories를 구성합니다.
- storage account에서 SFTP를 활성화합니다.
- local-user access의 경우 적절한 permissions를 가진 local user identities를 생성합니다.
- local users의 경우 container 내에서 시작 위치를 정의하도록 home directories를 구성합니다.
### Permissions
| Permission | Symbol | Description |
| ---------------------- | ------ | ------------------------------------ |
| **Read** | `r` | 파일 내용을 읽습니다. |
| **Write** | `w` | 파일을 업로드하고 directories를 생성합니다. |
| **List** | `l` | directories의 내용을 나열합니다. |
| **Delete** | `d` | 파일 또는 directories를 삭제합니다. |
| **Create** | `c` | 파일 또는 directories를 생성합니다. |
| **Modify Ownership** | `o` | 소유 user 또는 group을 변경합니다. |
| **Modify Permissions** | `p` | 파일 또는 directories의 ACLs를 변경합니다. |
| **Read** | `r` | file content를 Read합니다. |
| **Write** | `w` | files를 Upload하고 directories를 생성합니다. |
| **List** | `l` | directories의 contents를 List합니다. |
| **Delete** | `d` | files 또는 directories를 Delete합니다. |
| **Create** | `c` | files 또는 directories를 Create합니다. |
| **Modify Ownership** | `o` | owning user 또는 group을 변경합니다. |
| **Modify Permissions** | `p` | files 또는 directories의 ACLs를 변경합니다. |
## Enumeration
@@ -379,7 +379,7 @@ az storage account local-user list \
{{#tab name="Az PowerShell" }}
<details>
<summary>Az PowerShell enumeration</summary>
<summary>Az PowerShell 열거</summary>
```powershell
# Get storage accounts
Get-AzStorageAccount | fl
@@ -448,7 +448,7 @@ New-AzStorageBlobSASToken `
az-file-shares.md
{{#endref}}
## 권한 상승
## Privilege Escalation
{{#ref}}
../az-privilege-escalation/az-storage-privesc.md
@@ -466,13 +466,13 @@ az-file-shares.md
../az-persistence/az-storage-persistence.md
{{#endref}}
## References
## 참고 자료
- [https://learn.microsoft.com/en-us/azure/storage/blobs/storage-blobs-introduction](https://learn.microsoft.com/en-us/azure/storage/blobs/storage-blobs-introduction)
- [https://learn.microsoft.com/en-us/azure/storage/common/storage-sas-overview](https://learn.microsoft.com/en-us/azure/storage/common/storage-sas-overview)
- [https://learn.microsoft.com/en-us/azure/storage/blobs/secure-file-transfer-protocol-support](https://learn.microsoft.com/en-us/azure/storage/blobs/secure-file-transfer-protocol-support)
- [https://learn.microsoft.com/en-us/azure/storage/blobs/secure-file-transfer-protocol-support-entra-id-based-access](https://learn.microsoft.com/en-us/azure/storage/blobs/secure-file-transfer-protocol-support-entra-id-based-access)
- [Holiday Hack Challenge 2025 Spare Key (Azure static website SAS leak)](https://0xdf.gitlab.io/holidayhack2025/act1/spare-key)
- [Holiday Hack Challenge 2025 Spare Key (Azure 정적 웹사이트 SAS leak)](https://0xdf.gitlab.io/holidayhack2025/act1/spare-key)
- [Holiday Hack Challenge 2025: Blob Storage (Storage Secrets)](https://0xdf.gitlab.io/holidayhack2025/act1/blob-storage)
- [https://learn.microsoft.com/en-us/cli/azure/storage/account](https://learn.microsoft.com/en-us/cli/azure/storage/account)
- [https://learn.microsoft.com/en-us/cli/azure/storage/container](https://learn.microsoft.com/en-us/cli/azure/storage/container)