
WIndowsのレジストリ修正をBat、Powershell、Intune、GPOでそれぞれやってみる
------------------------------------------------------------------
追記:2021/07/06 脆弱性対応の更新プログラムが徐々に公開。
セキュリティ更新プログラムガイド
追記:2021/07/08 サーバOSのパッチ公開
しかし、パッチが不十分の可能性あり。
「Microsoftの印刷スプーラ脆弱性対策は不十分」
追記:2021/07/19 新しい脆弱性を確認
さらなる脆弱性。ローカル特権昇格可能でパッチは準備中
追記:2021/08/12 202108月例パッチで上記は対応。しかし別の脆弱性発見
「Windows印刷スプーラーサービス」にあらたなゼロデイ脆弱性
08/13現在の対策方法は前回記事のサービスストップのみ
変更:2022/05/18 脆弱性の対応はされたので、タイトルを「Windows 10の印刷スプーラに任意コード実行の脆弱性をIntuneとGPOで暫定対応してみる2」から変更。
更新プログラムが配布された後、この記事はintuneでのレジストリ配布の手順として残す。
------------------------------------------------------------------
前回はWindowsのサービスを止めるものだったが、今回はレジストリ配布またはレジストリ修正をしてみる。
情報としては以下
レジストリファイルの作成
下記の内容の.regファイルを作成して実行する
Windows Registry Editor Version 5.00
[HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Windows NT\Printers]
"RegisterSpoolerRemoteRpcEndPoint"=dword:00000002
batファイルの作成
下記の内容の.batファイルを作成して、管理者として実行する。
reg add "HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Windows NT\Printers" /v RegisterSpoolerRemoteRpcEndPoint /t "REG_DWORD" /d "2" /f
exit
Intuneでの止め方
下記のIntuneWinAppUtil.exeをダウンロードする
ダウンロードしたファイルを実行し、前記で作成したレジストファイルを指定して、intunewinファイルを作成する。

「アプリ」-「Windows」-「追加」

「Windowsアプリ(win32)」を選択。

「アプリ情報」
先程作成した.intunewinファイルを指定する。

発行元が求められるので適当に

「プログラム」
インストールコマンドとアンインストールコマンドに以下を入れる
regedit.exe /s (レジストファイル)
デバイスの再起動は「なにもしない」としておく

「必要条件」
オペレーティングシステムのアーキテクチャを全部チェックする。

「検出規則」
「規則の形式」を「検出規則を手動で構成する」と設定し、「追加」をクリック

規則の種類:レジストリ
キーパス:HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Windows NT\Printers
値の名前:RegisterSpoolerRemoteRpcEndPoint
検出方法:文字列と比較
演算子:指定の値に等しい
値:1

「依存関係」、「置き換え」は何もしない


「割り当て」
配布したいグループを指定する。

「確認及び作成」で確認する。

GPOでの止め方
「コンピュータの構成」-「ポリシー」-「管理用テンプレート」-「プリンター」-「印刷スプーラーにクライアント接続の受け入れを許可する」をクリック

無効にする

batファイルでの元に戻し方
reg add "HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Windows NT\Printers" /v RegisterSpoolerRemoteRpcEndPoint /t "REG_DWORD" /d "1" /f
exit
レジストリファイルで元に戻す方法
下記の内容の.regファイルを作成して実行する
Windows Registry Editor Version 5.00
[HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Windows NT\Printers]
"RegisterSpoolerRemoteRpcEndPoint"=dword:00000001
Intuneで元に戻す方法
「レジストリファイルで元に戻す方法」のレジストリを配布する。
GPOで元に戻す方法
有効にする。

以上