Trusted Design

T1058 - Service Registry Permissions Weakness

概要

Windows stores local service configuration information in the Registry under HKLM\SYSTEM\CurrentControlSet\Services. The information stored under a service's Registry keys can be manipulated to modify a service's execution parameters through tools such as the service controller, sc.exe, PowerShell, or Reg. Access to Registry keys is controlled through Access Control Lists and permissions. (Citation: MSDN Registry Key Security)

If the permissions for users and groups are not properly set and allow access to the Registry keys for a service, then adversaries can change the service binPath/ImagePath to point to a different executable under their control. When the service starts or is restarted, then the adversary-controlled program will execute, allowing the adversary to gain persistence and/or privilege escalation to the account context the service is set to execute under (local/domain account, SYSTEM, LocalService, or NetworkService).

Adversaries may also alter Registry keys associated with service failure parameters (such as FailureCommand) that may be executed in an elevated context anytime the service fails or is intentionally corrupted.(Citation: TrustedSignal Service Failure)(Citation: Twitter Service Recovery Nov 2017)

管理者によるコメント

T1058は、セキュリティ設定が甘く(一般ユーザーでも変更可能になっており)、Windowsサービスの情報を管理する「レジストリキー」を直接書き換えることで、「永続化(Persistence)」や「特権昇格(Privilege Escalation)」を狙うものです。

1. 概要

この手法で攻撃者は、「本来なら管理者しか変更できないはずのシステムサービスを、一般ユーザー権限のまま乗っ取ること」を実現します。

何を実現できるのか

2. 攻撃の流れ

この手法の最大の特徴は、「管理者権限がなくても、設定ミスを突いて管理者(SYSTEM)以上の権限へ這い上がれる」点にあります。

  1. 脆弱なレジストリの探索:
    攻撃者は、サービスの設定が保存されている以下のレジストリキーの中から、一般ユーザー(Authenticated Users 等)に「書き込み権限」が与えられてしまっているものを探します。

    • HKLM\SYSTEM\CurrentControlSet\Services\<サービス名>
  2. レジストリの書き換え:
    対象のサービス(例: SYSTEM権限で自動起動するサードパーティ製アプリのサービス)を見つけたら、その中にある実行ファイルのパス(ImagePath 値)を、マルウェアのパスに書き換えます。

  3. トリガーの待機:
    システムの再起動、またはサービスの手動起動(一般ユーザーでも再起動可能なサービスの場合)を待ちます。

  4. 最高権限での実行:
    Windowsは書き換えられたレジストリに従ってサービスを起動します。この結果、マルウェアが SYSTEM権限 でバックグラウンド実行されます。

3. 防御・対策

「レジストリのアクセス権管理」が最も直接的な防御策です。

4. 重要ポイント

5. 関連する主なCWE

6. 関連する代表的なCVE/ツール

サードパーティ製のアプリケーション(セキュリティソフト、VPNクライアント、各種管理ツールなど)がWindowsに独自サービスを追加する際、この不備を作り込んでしまい、特権昇格のCVEとして報告されるケースが後を絶ちません。

実務上のアドバイス

エンドポイントセキュリティの観点では、「一般ユーザー(非管理者)が Services 以下のレジストリを触る」行為自体が極めて異常です。EDRやSIEMで、管理者権限を持たない一般ユーザープロセスのレジストリ変更ログを監視することが、この攻撃を未然に防ぐ最も確実な方法となります。

分析

この攻撃手法を利用する脅威アクター

関連する CVE

攻撃手法 – 脅威アクター Graph


← Technique一覧に戻る ← Tactics一覧に戻る