mirror of
https://github.com/HackTricks-wiki/hacktricks-cloud.git
synced 2026-01-06 17:53:37 -08:00
Translated ['.github/pull_request_template.md', 'src/pentesting-cloud/az
This commit is contained in:
@@ -2,114 +2,113 @@
|
||||
|
||||
{{#include ../../../banners/hacktricks-training.md}}
|
||||
|
||||
## Basic Information
|
||||
## 基本情報
|
||||
|
||||
**Azure Function Apps** are a **serverless compute service** that allow you to run small pieces of code, called **functions**, without managing the underlying infrastructure. They are designed to execute code in response to various triggers, such as **HTTP requests, timers, or events from other Azure services** like Blob Storage or Event Hubs. Function Apps support multiple programming languages, including C#, Python, JavaScript, and Java, making them versatile for building **event-driven applications**, automating workflows, or integrating services. They are cost-effective, as you usually only pay for the compute time used when your code runs.
|
||||
**Azure Function Apps** は、**サーバーレスコンピューティングサービス**であり、基盤となるインフラストラクチャを管理することなく、**関数**と呼ばれる小さなコードの断片を実行することを可能にします。これらは、**HTTPリクエスト、タイマー、またはBlob StorageやEvent Hubsなどの他のAzureサービスからのイベント**など、さまざまなトリガーに応じてコードを実行するように設計されています。Function Appsは、C#、Python、JavaScript、Javaなどの複数のプログラミング言語をサポートしており、**イベント駆動型アプリケーション**の構築、ワークフローの自動化、サービスの統合に柔軟性を提供します。通常、コードが実行されるときに使用されたコンピューティング時間に対してのみ支払うため、コスト効率が高いです。
|
||||
|
||||
> [!NOTE]
|
||||
> Note that **Functions are a subset of the App Services**, therefore, a lot of the features discussed here will be used also by applications created as Azure Apps (`webapp` in cli).
|
||||
> **FunctionsはApp Servicesのサブセット**であるため、ここで説明される多くの機能は、Azure Apps(cliでは`webapp`)として作成されたアプリケーションでも使用されます。
|
||||
|
||||
### Different Plans
|
||||
### 異なるプラン
|
||||
|
||||
- **Flex Consumption Plan**: Offers **dynamic, event-driven scaling** with pay-as-you-go pricing, adding or removing function instances based on demand. It supports **virtual networking** and **pre-provisioned instances** to reduce cold starts, making it suitable for **variable workloads** that don’t require container support.
|
||||
- **Traditional Consumption Plan**: The default serverless option, where you **pay only for compute resources when functions run**. It automatically scales based on incoming events and includes **cold start optimizations**, but does not support container deployments. Ideal for **intermittent workloads** requiring automatic scaling.
|
||||
- **Premium Plan**: Designed for **consistent performance**, with **prewarmed workers** to eliminate cold starts. It offers **extended execution times, virtual networking**, and supports **custom Linux images**, making it perfect for **mission-critical applications** needing high performance and advanced features.
|
||||
- **Dedicated Plan**: Runs on dedicated virtual machines with **predictable billing** and supports manual or automatic scaling. It allows running multiple apps on the same plan, provides **compute isolation**, and ensures **secure network access** via App Service Environments, making it ideal for **long-running applications** needing consistent resource allocation.
|
||||
- **Container Apps**: Enables deploying **containerized function apps** in a managed environment, alongside microservices and APIs. It supports custom libraries, legacy app migration, and **GPU processing**, eliminating Kubernetes cluster management. Ideal for **event-driven, scalable containerized applications**.
|
||||
- **Flex Consumption Plan**: **動的でイベント駆動型のスケーリング**を提供し、需要に応じて関数インスタンスを追加または削除する従量課金制です。**仮想ネットワーキング**と**事前プロビジョニングされたインスタンス**をサポートし、コールドスタートを減少させ、コンテナサポートを必要としない**変動するワークロード**に適しています。
|
||||
- **Traditional Consumption Plan**: デフォルトのサーバーレスオプションで、**関数が実行されるときのみコンピューティングリソースに対して支払います**。受信イベントに基づいて自動的にスケールし、**コールドスタートの最適化**が含まれていますが、コンテナデプロイメントはサポートしていません。自動スケーリングを必要とする**断続的なワークロード**に最適です。
|
||||
- **Premium Plan**: **一貫したパフォーマンス**を提供するように設計されており、コールドスタートを排除するための**事前ウォームされたワーカー**を備えています。**拡張実行時間、仮想ネットワーキング**を提供し、**カスタムLinuxイメージ**をサポートしており、高パフォーマンスと高度な機能を必要とする**ミッションクリティカルなアプリケーション**に最適です。
|
||||
- **Dedicated Plan**: 専用の仮想マシン上で実行され、**予測可能な請求**を提供し、手動または自動スケーリングをサポートします。同じプランで複数のアプリを実行でき、**コンピューティングの隔離**を提供し、App Service Environmentsを介して**安全なネットワークアクセス**を確保し、一貫したリソース割り当てを必要とする**長時間実行されるアプリケーション**に最適です。
|
||||
- **Container Apps**: **コンテナ化された関数アプリ**を管理された環境でデプロイすることを可能にし、マイクロサービスやAPIと共に使用できます。カスタムライブラリ、レガシーアプリの移行、**GPU処理**をサポートし、Kubernetesクラスターの管理を排除します。**イベント駆動型でスケーラブルなコンテナ化されたアプリケーション**に最適です。
|
||||
|
||||
### **Storage Buckets**
|
||||
### **ストレージバケット**
|
||||
|
||||
When creating a new Function App not containerised (but giving the code to run), the **code and other Function related data will be stored in a Storage account**. By default the web console will create a new one per function to store the code.
|
||||
新しいFunction Appをコンテナ化せずに作成する際、**コードとその他のFunction関連データはストレージアカウントに保存されます**。デフォルトでは、Webコンソールはコードを保存するために関数ごとに新しいものを作成します。
|
||||
|
||||
Moreover, modifying the code inside the bucket (in the different formats it could be stored), the **code of the app will be modified to the new one and executed** next time the Function is called.
|
||||
さらに、バケット内のコードを変更すると(保存されるさまざまな形式で)、**アプリのコードは新しいものに変更され、次回Functionが呼び出されると実行されます**。
|
||||
|
||||
> [!CAUTION]
|
||||
> This is very interesting from an attackers perspective as **write access over this bucket** will allow an attacker to **compromise the code and escalate privileges** to the managed identities inside the Function App.
|
||||
> これは攻撃者の視点から非常に興味深いものであり、**このバケットに対する書き込みアクセス**があれば、攻撃者は**コードを妥協し、Function App内の管理されたIDの権限を昇格させる**ことができます。
|
||||
>
|
||||
> More on this in the **privilege escalation section**.
|
||||
> これについては**権限昇格セクション**で詳しく説明します。
|
||||
|
||||
It's also possible to find the **master and functions keys** stored in the storage account in the container **`azure-webjobs-secrets`** inside the folder **`<app-name>`** in the JSON files you can find inside.
|
||||
ストレージアカウント内のコンテナ**`azure-webjobs-secrets`**に、フォルダ**`<app-name>`**内のJSONファイルに保存されている**マスターキーと関数キー**を見つけることも可能です。
|
||||
|
||||
Note that Functions also allow to store the code in a remote location just indicating the URL to it.
|
||||
Functionsは、コードをリモートの場所に保存することも可能で、URLを指定するだけで済みます。
|
||||
|
||||
### Networking
|
||||
### ネットワーキング
|
||||
|
||||
Using a HTTP trigger:
|
||||
HTTPトリガーを使用する場合:
|
||||
|
||||
- It's possible to give **access to a function to from all Internet** without requiring any authentication or give access IAM based. Although it’s also possible to restrict this access.
|
||||
- It's also possible to **give or restrict access** to a Function App from **an internal network (VPC)**.
|
||||
- **インターネットから関数へのアクセスを認証なしで提供する**ことが可能であり、IAMベースのアクセスを提供することもできます。ただし、このアクセスを制限することも可能です。
|
||||
- **内部ネットワーク(VPC)**からFunction Appへのアクセスを**付与または制限する**ことも可能です。
|
||||
|
||||
> [!CAUTION]
|
||||
> This is very interesting from an attackers perspective as it might be possible to **pivot to internal networks** from a vulnerable Function exposed to the Internet.
|
||||
> これは攻撃者の視点から非常に興味深いものであり、インターネットに公開された脆弱なFunctionから**内部ネットワークにピボットする**ことが可能かもしれません。
|
||||
|
||||
### **Function App Settings & Environment Variables**
|
||||
### **Function Appの設定と環境変数**
|
||||
|
||||
It's possible to configure environment variables inside an app, which could contain sensitive information. Moreover, by default the env variables **`AzureWebJobsStorage`** and **`WEBSITE_CONTENTAZUREFILECONNECTIONSTRING`** (among others) are created. These are specially interesting because they **contain the account key to control with FULL permissions the storage account containing the data of the application**. These settings are also needed to execute the code from the Storage Account.
|
||||
アプリ内で環境変数を設定することが可能で、これには機密情報が含まれる場合があります。さらに、デフォルトで環境変数**`AzureWebJobsStorage`**と**`WEBSITE_CONTENTAZUREFILECONNECTIONSTRING`**(他にもいくつか)が作成されます。これらは特に興味深いもので、**アプリケーションのデータを含むストレージアカウントを完全に制御するためのアカウントキーを含んでいます**。これらの設定は、ストレージアカウントからコードを実行するためにも必要です。
|
||||
|
||||
These env variables or configuration parameters also controls how the Function execute the code, for example if **`WEBSITE_RUN_FROM_PACKAGE`** exists, it'll indicate the URL where the code of the application is located.
|
||||
これらの環境変数や設定パラメータは、Functionがコードを実行する方法も制御します。たとえば、**`WEBSITE_RUN_FROM_PACKAGE`**が存在する場合、アプリケーションのコードがあるURLを示します。
|
||||
|
||||
### **Function Sandbox**
|
||||
|
||||
Inside the linux sandbox the source code is located in **`/home/site/wwwroot`** in the file **`function_app.py`** (if python is used) the user running the code is **`app`** (without sudo permissions).
|
||||
Linuxサンドボックス内では、ソースコードは**`/home/site/wwwroot`**にあり、ファイル**`function_app.py`**(Pythonを使用している場合)に格納されています。コードを実行するユーザーは**`app`**(sudo権限なし)です。
|
||||
|
||||
In a **Windows** function using NodeJS the code was located in **`C:\home\site\wwwroot\HttpTrigger1\index.js`**, the username was **`mawsFnPlaceholder8_f_v4_node_20_x86`** and was part of the **groups**: `Mandatory Label\High Mandatory Level Label`, `Everyone`, `BUILTIN\Users`, `NT AUTHORITY\INTERACTIVE`, `CONSOLE LOGON`, `NT AUTHORITY\Authenticated Users`, `NT AUTHORITY\This Organization`, `BUILTIN\IIS_IUSRS`, `LOCAL`, `10-30-4-99\Dwas Site Users`.
|
||||
**Windows**関数でNodeJSを使用している場合、コードは**`C:\home\site\wwwroot\HttpTrigger1\index.js`**にあり、ユーザー名は**`mawsFnPlaceholder8_f_v4_node_20_x86`**で、**グループ**には`Mandatory Label\High Mandatory Level Label`、`Everyone`、`BUILTIN\Users`、`NT AUTHORITY\INTERACTIVE`、`CONSOLE LOGON`、`NT AUTHORITY\Authenticated Users`、`NT AUTHORITY\This Organization`、`BUILTIN\IIS_IUSRS`、`LOCAL`、`10-30-4-99\Dwas Site Users`が含まれていました。
|
||||
|
||||
### **Managed Identities & Metadata**
|
||||
### **管理されたIDとメタデータ**
|
||||
|
||||
Just like [**VMs**](vms/), Functions can have **Managed Identities** of 2 types: System assigned and User assigned.
|
||||
[**VMs**](vms/)と同様に、Functionsは**2種類の管理されたID**を持つことができます:システム割り当てとユーザー割り当て。
|
||||
|
||||
The **system assigned** one will be a managed identity that **only the function** that has it assigned would be able to use, while the **user assigned** managed identities are managed identities that **any other Azure service will be able to use**.
|
||||
**システム割り当て**のものは、**そのIDが割り当てられた関数のみが使用できる管理されたID**です。一方、**ユーザー割り当て**の管理されたIDは、**他のAzureサービスが使用できる管理されたID**です。
|
||||
|
||||
> [!NOTE]
|
||||
> Just like in [**VMs**](vms/), Functions can have **1 system assigned** managed identity and **several user assigned** ones, so it's always important to try to find all of them if you compromise the function because you might be able to escalate privileges to several managed identities from just one Function.
|
||||
> [**VMs**](vms/)と同様に、Functionsは**1つのシステム割り当て**の管理されたIDと**複数のユーザー割り当て**の管理されたIDを持つことができるため、関数を妥協した場合は、すべての管理されたIDを見つけることが常に重要です。1つのFunctionから複数の管理されたIDに権限を昇格させることができるかもしれません。
|
||||
>
|
||||
> If a no system managed identity is used but one or more user managed identities are attached to a function, by default you won’t be able to get any token.
|
||||
> システム管理されたIDが使用されていない場合でも、1つ以上のユーザー管理されたIDが関数に添付されている場合、デフォルトではトークンを取得することはできません。
|
||||
|
||||
It's possible to use the [**PEASS scripts**](https://github.com/peass-ng/PEASS-ng) to get tokens from the default managed identity from the metadata endpoint. Or you could get them **manually** as explained in:
|
||||
[**PEASSスクリプト**](https://github.com/peass-ng/PEASS-ng)を使用して、メタデータエンドポイントからデフォルトの管理されたIDのトークンを取得することが可能です。また、以下のように**手動で**取得することもできます:
|
||||
|
||||
{% embed url="https://book.hacktricks.xyz/pentesting-web/ssrf-server-side-request-forgery/cloud-ssrf#azure-vm" %}
|
||||
|
||||
Note that you need to find out a way to **check all the Managed Identities a function has attached** as if you don't indicate it, the metadata endpoint will **only use the default one** (check the previous link for more info).
|
||||
関数に添付された**すべての管理されたIDを確認する方法を見つける**必要があることに注意してください。指定しない場合、メタデータエンドポイントは**デフォルトのもののみを使用します**(詳細については前のリンクを参照してください)。
|
||||
|
||||
## Access Keys
|
||||
## アクセスキー
|
||||
|
||||
> [!NOTE]
|
||||
> Note that there aren't RBAC permissions to give access to users to invoke the functions. The **function invocation depends on the trigger** selected when it was created and if a HTTP Trigger was selected, it might be needed to use an **access key**.
|
||||
> ユーザーに関数を呼び出すアクセスを付与するためのRBAC権限はありません。**関数の呼び出しは、作成時に選択されたトリガーに依存します**。HTTPトリガーが選択された場合、**アクセスキー**を使用する必要があるかもしれません。
|
||||
|
||||
When creating an endpoint inside a function using a **HTTP trigger** it's possible to indicate the **access key authorization level** needed to trigger the function. Three options are available:
|
||||
HTTPトリガーを使用して関数内にエンドポイントを作成する際、関数をトリガーするために必要な**アクセスキーの認証レベル**を指定することが可能です。3つのオプションがあります:
|
||||
|
||||
- **ANONYMOUS**: **Everyone** can access the function by the URL.
|
||||
- **FUNCTION**: Endpoint is only accessible to users using a **function, host or master key**.
|
||||
- **ADMIN**: Endpoint is only accessible to users a **master key**.
|
||||
- **ANONYMOUS**: **誰でも**URLを通じて関数にアクセスできます。
|
||||
- **FUNCTION**: エンドポイントは、**関数、ホスト、またはマスターキー**を使用するユーザーのみがアクセスできます。
|
||||
- **ADMIN**: エンドポイントは、**マスターキー**を持つユーザーのみがアクセスできます。
|
||||
|
||||
**Type of keys:**
|
||||
**キーの種類:**
|
||||
|
||||
- **Function Keys:** Function keys can be either default or user-defined and are designed to grant access exclusively to **specific function endpoints** within a Function App allowing a more fine-grained access over the endpoints.
|
||||
- **Host Keys:** Host keys, which can also be default or user-defined, provide access to **all function endpoints within a Function App with FUNCTION access level**.
|
||||
- **Master Key:** The master key (`_master`) serves as an administrative key that offers elevated permissions, including access to all function endpoints (ADMIN access lelvel included). This **key cannot be revoked.**
|
||||
- **System Keys:** System keys are **managed by specific extensions** and are required for accessing webhook endpoints used by internal components. Examples include the Event Grid trigger and Durable Functions, which utilize system keys to securely interact with their respective APIs.
|
||||
- **関数キー**: 関数キーはデフォルトまたはユーザー定義のいずれかであり、Function App内の**特定の関数エンドポイント**へのアクセスを独占的に付与するように設計されています。
|
||||
- **ホストキー**: ホストキーもデフォルトまたはユーザー定義のいずれかであり、**FUNCTIONアクセスレベル**を持つFunction App内の**すべての関数エンドポイント**へのアクセスを提供します。
|
||||
- **マスターキー**: マスターキー(`_master`)は、すべての関数エンドポイントへのアクセスを提供する管理キーであり(ADMINアクセスレベルを含む)、この**キーは取り消すことができません**。
|
||||
- **システムキー**: システムキーは**特定の拡張機能によって管理され**、内部コンポーネントによって使用されるWebhookエンドポイントにアクセスするために必要です。例としては、Event GridトリガーやDurable Functionsがあり、これらはそれぞれのAPIと安全に対話するためにシステムキーを利用します。
|
||||
|
||||
> [!TIP]
|
||||
> Example to access a function API endpoint using a key:
|
||||
> キーを使用して関数APIエンドポイントにアクセスする例:
|
||||
>
|
||||
> `https://<function_uniq_name>.azurewebsites.net/api/<endpoint_name>?code=<access_key>`
|
||||
|
||||
### Basic Authentication
|
||||
### 基本認証
|
||||
|
||||
Just like in App Services, Functions also support basic authentication to connect to **SCM** and **FTP** to deploy code using a **username and password in a URL** provided by Azure. More information about it in:
|
||||
App Servicesと同様に、Functionsも**SCM**および**FTP**に接続してコードをデプロイするための基本認証をサポートしています。これは、Azureが提供する**ユーザー名とパスワードを含むURL**を使用します。詳細については:
|
||||
|
||||
{{#ref}}
|
||||
az-app-service.md
|
||||
{{#endref}}
|
||||
|
||||
### Github Based Deployments
|
||||
### Githubベースのデプロイメント
|
||||
|
||||
When a function is generated from a Github repo Azure web console allows to **automatically create a Github Workflow in a specific repository** so whenever this repository is updated the code of the function is updated. Actually the Github Action yaml for a python function looks like this:
|
||||
関数がGithubリポジトリから生成されると、Azure Webコンソールは**特定のリポジトリにGithubワークフローを自動的に作成する**ことを許可します。これにより、このリポジトリが更新されるたびに関数のコードが更新されます。実際、Python関数のGithub Action yamlは次のようになります:
|
||||
|
||||
<details>
|
||||
|
||||
<summary>Github Action Yaml</summary>
|
||||
|
||||
```yaml
|
||||
# Docs for the Azure Web Apps Deploy action: https://github.com/azure/functions-action
|
||||
# More GitHub Actions for Azure: https://github.com/Azure/actions
|
||||
@@ -118,95 +117,93 @@ When a function is generated from a Github repo Azure web console allows to **au
|
||||
name: Build and deploy Python project to Azure Function App - funcGithub
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
workflow_dispatch:
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
workflow_dispatch:
|
||||
|
||||
env:
|
||||
AZURE_FUNCTIONAPP_PACKAGE_PATH: "." # set this to the path to your web app project, defaults to the repository root
|
||||
PYTHON_VERSION: "3.11" # set this to the python version to use (supports 3.6, 3.7, 3.8)
|
||||
AZURE_FUNCTIONAPP_PACKAGE_PATH: "." # set this to the path to your web app project, defaults to the repository root
|
||||
PYTHON_VERSION: "3.11" # set this to the python version to use (supports 3.6, 3.7, 3.8)
|
||||
|
||||
jobs:
|
||||
build:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v4
|
||||
build:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Setup Python version
|
||||
uses: actions/setup-python@v5
|
||||
with:
|
||||
python-version: ${{ env.PYTHON_VERSION }}
|
||||
- name: Setup Python version
|
||||
uses: actions/setup-python@v5
|
||||
with:
|
||||
python-version: ${{ env.PYTHON_VERSION }}
|
||||
|
||||
- name: Create and start virtual environment
|
||||
run: |
|
||||
python -m venv venv
|
||||
source venv/bin/activate
|
||||
- name: Create and start virtual environment
|
||||
run: |
|
||||
python -m venv venv
|
||||
source venv/bin/activate
|
||||
|
||||
- name: Install dependencies
|
||||
run: pip install -r requirements.txt
|
||||
- name: Install dependencies
|
||||
run: pip install -r requirements.txt
|
||||
|
||||
# Optional: Add step to run tests here
|
||||
# Optional: Add step to run tests here
|
||||
|
||||
- name: Zip artifact for deployment
|
||||
run: zip release.zip ./* -r
|
||||
- name: Zip artifact for deployment
|
||||
run: zip release.zip ./* -r
|
||||
|
||||
- name: Upload artifact for deployment job
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: python-app
|
||||
path: |
|
||||
release.zip
|
||||
!venv/
|
||||
- name: Upload artifact for deployment job
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: python-app
|
||||
path: |
|
||||
release.zip
|
||||
!venv/
|
||||
|
||||
deploy:
|
||||
runs-on: ubuntu-latest
|
||||
needs: build
|
||||
deploy:
|
||||
runs-on: ubuntu-latest
|
||||
needs: build
|
||||
|
||||
permissions:
|
||||
id-token: write #This is required for requesting the JWT
|
||||
permissions:
|
||||
id-token: write #This is required for requesting the JWT
|
||||
|
||||
steps:
|
||||
- name: Download artifact from build job
|
||||
uses: actions/download-artifact@v4
|
||||
with:
|
||||
name: python-app
|
||||
steps:
|
||||
- name: Download artifact from build job
|
||||
uses: actions/download-artifact@v4
|
||||
with:
|
||||
name: python-app
|
||||
|
||||
- name: Unzip artifact for deployment
|
||||
run: unzip release.zip
|
||||
- name: Unzip artifact for deployment
|
||||
run: unzip release.zip
|
||||
|
||||
- name: Login to Azure
|
||||
uses: azure/login@v2
|
||||
with:
|
||||
client-id: ${{ secrets.AZUREAPPSERVICE_CLIENTID_6C3396368D954957BC58E4C788D37FD1 }}
|
||||
tenant-id: ${{ secrets.AZUREAPPSERVICE_TENANTID_7E50AEF6222E4C3DA9272D27FB169CCD }}
|
||||
subscription-id: ${{ secrets.AZUREAPPSERVICE_SUBSCRIPTIONID_905358F484A74277BDC20978459F26F4 }}
|
||||
- name: Login to Azure
|
||||
uses: azure/login@v2
|
||||
with:
|
||||
client-id: ${{ secrets.AZUREAPPSERVICE_CLIENTID_6C3396368D954957BC58E4C788D37FD1 }}
|
||||
tenant-id: ${{ secrets.AZUREAPPSERVICE_TENANTID_7E50AEF6222E4C3DA9272D27FB169CCD }}
|
||||
subscription-id: ${{ secrets.AZUREAPPSERVICE_SUBSCRIPTIONID_905358F484A74277BDC20978459F26F4 }}
|
||||
|
||||
- name: "Deploy to Azure Functions"
|
||||
uses: Azure/functions-action@v1
|
||||
id: deploy-to-function
|
||||
with:
|
||||
app-name: "funcGithub"
|
||||
slot-name: "Production"
|
||||
package: ${{ env.AZURE_FUNCTIONAPP_PACKAGE_PATH }}
|
||||
- name: "Deploy to Azure Functions"
|
||||
uses: Azure/functions-action@v1
|
||||
id: deploy-to-function
|
||||
with:
|
||||
app-name: "funcGithub"
|
||||
slot-name: "Production"
|
||||
package: ${{ env.AZURE_FUNCTIONAPP_PACKAGE_PATH }}
|
||||
```
|
||||
|
||||
</details>
|
||||
|
||||
Moreover, a **Managed Identity** is also created so the Github Action from the repository will be able to login into Azure with it. This is done by generating a Federated credential over the **Managed Identity** allowing the **Issuer** `https://token.actions.githubusercontent.com` and the **Subject Identifier** `repo:<org-name>/<repo-name>:ref:refs/heads/<branch-name>`.
|
||||
さらに、**Managed Identity**も作成されるため、リポジトリからのGithub Actionはそれを使用してAzureにログインできます。これは、**Managed Identity**上にフェデレーテッド資格情報を生成することで行われ、**Issuer** `https://token.actions.githubusercontent.com` と **Subject Identifier** `repo:<org-name>/<repo-name>:ref:refs/heads/<branch-name>` が許可されます。
|
||||
|
||||
> [!CAUTION]
|
||||
> Therefore, anyone compromising that repo will be able to compromise the function and the Managed Identities attached to it.
|
||||
> したがって、そのリポジトリを侵害した者は、関数およびそれに関連付けられたManaged Identitiesを侵害することができます。
|
||||
|
||||
### Container Based Deployments
|
||||
### コンテナベースのデプロイメント
|
||||
|
||||
Not all the plans allow to deploy containers, but for the ones that do, the configuration will contain the URL of the container. In the API the **`linuxFxVersion`** setting will ha something like: `DOCKER|mcr.microsoft.com/...`, while in the web console, the configuration will show the **image settings**.
|
||||
すべてのプランがコンテナのデプロイを許可しているわけではありませんが、許可されているプランでは、構成にコンテナのURLが含まれます。APIでは、**`linuxFxVersion`**設定は次のようになります: `DOCKER|mcr.microsoft.com/...`、一方、ウェブコンソールでは、構成に**イメージ設定**が表示されます。
|
||||
|
||||
Moreover, **no source code will be stored in the storage** account related to the function as it's not needed.
|
||||
|
||||
## Enumeration
|
||||
さらに、**ソースコードは関数に関連するストレージ**アカウントに保存されません。必要ないためです。
|
||||
|
||||
## 列挙
|
||||
```bash
|
||||
# List all the functions
|
||||
az functionapp list
|
||||
@@ -218,15 +215,15 @@ az functionapp show --name <app-name> --resource-group <res-group>
|
||||
|
||||
# Get details about the source of the function code
|
||||
az functionapp deployment source show \
|
||||
--name <app-name> \
|
||||
--resource-group <res-group>
|
||||
--name <app-name> \
|
||||
--resource-group <res-group>
|
||||
## If error like "This is currently not supported."
|
||||
## Then, this is probalby using a container
|
||||
|
||||
# Get more info if a container is being used
|
||||
az functionapp config container show \
|
||||
--name <name> \
|
||||
--resource-group <res-group>
|
||||
--name <name> \
|
||||
--resource-group <res-group>
|
||||
|
||||
# Get settings (and privesc to the sorage account)
|
||||
az functionapp config appsettings list --name <app-name> --resource-group <res-group>
|
||||
@@ -242,7 +239,7 @@ az functionapp config access-restriction show --name <app-name> --resource-group
|
||||
|
||||
# Get more info about a function (invoke_url_template is the URL to invoke and script_href allows to see the code)
|
||||
az rest --method GET \
|
||||
--url "https://management.azure.com/subscriptions/<subscription>/resourceGroups/<res-group>/providers/Microsoft.Web/sites/<app-name>/functions?api-version=2024-04-01"
|
||||
--url "https://management.azure.com/subscriptions/<subscription>/resourceGroups/<res-group>/providers/Microsoft.Web/sites/<app-name>/functions?api-version=2024-04-01"
|
||||
|
||||
# Get source code with Master Key of the function
|
||||
curl "<script_href>?code=<master-key>"
|
||||
@@ -252,19 +249,14 @@ curl "https://newfuncttest123.azurewebsites.net/admin/vfs/home/site/wwwroot/func
|
||||
# Get source code
|
||||
az rest --url "https://management.azure.com/<subscription>/resourceGroups/<res-group>/providers/Microsoft.Web/sites/<app-name>/hostruntime/admin/vfs/function_app.py?relativePath=1&api-version=2022-03-01"
|
||||
```
|
||||
|
||||
## Privilege Escalation
|
||||
## 権限昇格
|
||||
|
||||
{{#ref}}
|
||||
../az-privilege-escalation/az-functions-app-privesc.md
|
||||
{{#endref}}
|
||||
|
||||
## References
|
||||
## 参考文献
|
||||
|
||||
- [https://learn.microsoft.com/en-us/azure/azure-functions/functions-openapi-definition](https://learn.microsoft.com/en-us/azure/azure-functions/functions-openapi-definition)
|
||||
|
||||
{{#include ../../../banners/hacktricks-training.md}}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user