Lab 2.5: Seatbelt
オンライン演習
接続性: この演習を実施するには、クラス内ネットワーク(560A VPN経由)に接続している必要があります
概要
Seatbeltを使用して、Windows 11システムの設定をより深く理解していきます。
Walkthrough Video
演習のセットアップ
使用するVM:
- Windows 11
Windows VMから10.130.10.10にpingが通ることを確認してください:
コマンド
ping 10.130.10.10
想定される結果
PS C:\Users\sec560> ping 10.130.10.10
Pinging 10.130.10.10 with 32 bytes of data:
Reply from 10.130.10.10: bytes=32 time=122ms TTL=63
Reply from 10.130.10.10: bytes=32 time=122ms TTL=63
Reply from 10.130.10.10: bytes=32 time=127ms TTL=63
Reply from 10.130.10.10: bytes=32 time=122ms TTL=63
Ping statistics for 10.130.10.10:
Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),
Approximate round trip times in milli-seconds:
Minimum = 122ms, Maximum = 127ms, Average = 123ms
演習 – ステップバイステップの手順
1: Seatbeltの起動
プロジェクトのウェブサイトによると:
Seatbeltは、攻撃的および防御的なセキュリティの両方の観点から関連する、多数のセキュリティ指向のホスト調査「安全性チェック」を実行するC#プロジェクトです。
Windowsデスクトップの**Terminal**ショートカットを使用してPowerShellターミナルを起動し、C:\bin
に移動します。
コマンド
cd \bin
Seatbelt.exe
Seatbeltを実行すると、画面にASCIIアートのシートベルトが表示され、結果が提供されます。
2: 単一チェック
特定のコマンド名を使用して個別のチェックを実行できます。Seatbeltを実行して、現在のAVに関する情報を取得してみましょう。
コマンド
Seatbelt.exe AntiVirus
想定される結果
PS C:\bin> Seatbelt.exe AntiVirus
%&&@@@&&
&&&&&&&%%%, #&&@@@@@@%%%%%%###############%
&%& %&%% &////(((&%%%%%#%################//((((###%%%%%%%%%%%%%%%
%%%%%%%%%%%######%%%#%%####% &%%**# @////(((&%%%%%%######################(((((((((((((((((((
#%#%%%%%%%#######%#%%####### %&%,,,,,,,,,,,,,,,, @////(((&%%%%%#%#####################(((((((((((((((((((
#%#%%%%%%#####%%#%#%%####### %%%,,,,,, ,,. ,, @////(((&%%%%%%%######################(#(((#(#((((((((((
#####%%%#################### &%%...... ... .. @////(((&%%%%%%%###############%######((#(#(####((((((((
#######%##########%######### %%%...... ... .. @////(((&%%%%%#########################(#(#######((#####
###%##%%#################### &%%............... @////(((&%%%%%%%%##############%#######(#########((#####
#####%###################### %%%.. @////(((&%%%%%%%################
&%& %%%%% Seatbelt %////(((&%%%%%%%%#############*
&%%&&&%%%%% v1.2.2 ,(((&%%%%%%%%%%%%%%%%%,
#%%%%##,
====== AntiVirus ======
[*] Completed collection in 0.034 seconds
このWindows 11システムではMicrosoft Defenderが*完全に*無効化されているため、このコマンドから結果が表示されません。興味がある方のために説明すると、DefenderはDefenderProToolsを使用してインストールメディア自体から削除されています。
システムにインストールされているものを確認してみましょう。実際のペンテストでは、1つのシステムのソフトウェアは他のシステムと類似している可能性が高くなります。そのソフトウェアの脆弱性を使用してシステム間を移動することができます。
コマンド
Seatbelt.exe InstalledProducts
想定される結果
PS C:\bin> Seatbelt.exe InstalledProducts
====== InstalledProducts ======
DisplayName : Visual Studio Build Tools 2017
DisplayVersion : 15.9.64
Publisher : Microsoft Corporation
InstallDate : 1/1/0001 12:00:00 AM
Architecture : x86
DisplayName : BleachBit
DisplayVersion : 4.6.0.2537
Publisher : BleachBit
InstallDate : 1/1/0001 12:00:00 AM
Architecture : x86
DisplayName : Icecast v2.0.0
DisplayVersion :
Publisher :
InstallDate : 1/1/0001 12:00:00 AM
Architecture : x86
DisplayName : Microsoft Edge
DisplayVersion : 127.0.2651.98
Publisher : Microsoft Corporation
InstallDate : 1/1/0001 12:00:00 AM
Architecture : x86
...truncated for brevity...
Lab 2.2のIcecastを覚えていますか?
Seatbeltの一部の機能は、組み込みコマンドと同様のアクションを実行します。利点は、この.NET Assembly(EXE)をターゲットシステムのメモリにロードし、組み込みのnetstat
のようなものをクエリできることですが、cmd、PowerShell、またはnetstat
実行可能ファイルを使用せずに済みます。これらはアクセスが監視されている可能性があります。
そのような機能の1つであるTcpConnections
を見てみましょう。
コマンド
Seatbelt.exe TcpConnections
想定される結果
PS C:\bin> Seatbelt.exe TcpConnections
[...skipped ASCII art...]
====== TcpConnections ======
Local Address Foreign Address State PID Service ProcessName
0.0.0.0:80 0.0.0.0:0 LISTEN 4 System
0.0.0.0:135 0.0.0.0:0 LISTEN 580 RpcEptMapper C:\WINDOWS\system32\svchost.exe -k RPCSS -p
0.0.0.0:445 0.0.0.0:0 LISTEN 4 System
0.0.0.0:5040 0.0.0.0:0 LISTEN 5256 CDPSvc C:\WINDOWS\system32\svchost.exe -k LocalService -p -s CDPSvc
0.0.0.0:5357 0.0.0.0:0 LISTEN 4 System
0.0.0.0:5985 0.0.0.0:0 LISTEN 4 System
0.0.0.0:7680 0.0.0.0:0 LISTEN 6976 DoSvc svchost.exe
0.0.0.0:47001 0.0.0.0:0 LISTEN 4 System
0.0.0.0:49664 0.0.0.0:0 LISTEN 832 lsass.exe
0.0.0.0:49665 0.0.0.0:0 LISTEN 676 wininit.exe
0.0.0.0:49666 0.0.0.0:0 LISTEN 1712 EventLog C:\WINDOWS\System32\svchost.exe -k LocalServiceNetworkRestricted -p -s EventLog
0.0.0.0:49667 0.0.0.0:0 LISTEN 1556 Schedule C:\WINDOWS\system32\svchost.exe -k netsvcs -p -s Schedule
0.0.0.0:49668 0.0.0.0:0 LISTEN 2780 Spooler C:\WINDOWS\System32\spoolsv.exe
0.0.0.0:49669 0.0.0.0:0 LISTEN 820 services.exe
10.10.10.165:139 0.0.0.0:0 LISTEN 4 System
10.10.10.165:49671 40.83.247.108:443 ESTAB 3260 WpnService C:\WINDOWS\system32\svchost.exe -k netsvcs -p -s WpnService
10.254.252.3:139 0.0.0.0:0 LISTEN 4 System
127.0.0.1:25340 0.0.0.0:0 LISTEN 9132 openvpn --log "C:\Users\sec560\OpenVPN\log\sec560-labs-mcjunkin-vm59x.log" --config "sec560-labs-mcjunkin-vm59x.ovpn" --setenv IV_GUI_VER "OpenVPN GUI 11.50.0.0" --setenv IV_SSO openurl,webauth,crtext --service 2364000023a4 0 --auth-retry interact --management 127.0.0.1 25340 stdin --management-query-passwords --management-hold --pull-filter ignore route-method --msg-channel 504
127.0.0.1:25340 127.0.0.1:49680 ESTAB 9132 openvpn --log "C:\Users\sec560\OpenVPN\log\sec560-labs-mcjunkin-vm59x.log" --config "sec560-labs-mcjunkin-vm59x.ovpn" --setenv IV_GUI_VER "OpenVPN GUI 11.50.0.0" --setenv IV_SSO openurl,webauth,crtext --service 2364000023a4 0 --auth-retry interact --management 127.0.0.1 25340 stdin --management-query-passwords --management-hold --pull-filter ignore route-method --msg-channel 504
127.0.0.1:49680 127.0.0.1:25340 ESTAB 9060 "C:\Program Files\OpenVPN\bin\openvpn-gui.exe
[*] Completed collection in 0.076 seconds
3: グループ
個別のコマンドを実行する代わりに、コマンドのグループを起動できます。現在Seatbeltでサポートされているコマンドグループは以下の通りです:
- All - すべてのコマンド
- User - 現在のユーザー、または昇格された権限で実行している場合はすべてのユーザー
- System - ターゲットシステムに関する興味深いデータをマイニング
- Slack - slackに関する情報を抽出するように設計されたモジュール(インストールされているか、ダウンロード、ワークスペース)
- Chromium - Chromiumベースのブラウザに関する情報を抽出(インストールされているか、ブックマーク、履歴)
- Remote - リモートシステムで機能するチェック(ラテラルムーブメント前に非常に興味深い)
- Misc - その他のチェック
システムを見て、*System*グループの結果を分析してみましょう。
コマンド
Seatbelt.exe -group=system
想定される結果
====== AppLocker ======
[*] AppIDSvc service is Stopped
[*] Applocker is not running because the AppIDSvc is not running
[*] AppLocker not configured
====== ARPTable ======
Loopback Pseudo-Interface 1 --- Index 1
Interface Description : Software Loopback Interface 1
Interface IPs : ::1, 127.0.0.1
DNS Servers : fec0:0:0:ffff::1%1, fec0:0:0:ffff::2%1, fec0:0:0:ffff::3%1
Internet Address Physical Address Type
224.0.0.22 00-00-00-00-00-00 Static
239.255.255.250 00-00-00-00-00-00 Static
Ethernet0 --- Index 4
Interface Description : Intel(R) PRO/1000 MT Network Connection
Interface IPs : fe80::dc2a:6612:843e:eac0%4, 10.10.10.165
DNS Servers : 10.10.10.2
Internet Address Physical Address Type
10.10.10.1 00-50-56-C0-00-08 Dynamic
10.10.10.2 00-50-56-EF-67-AC Dynamic
10.10.10.186 00-0C-29-13-17-CC Dynamic
10.10.10.254 00-50-56-E2-E1-DC Dynamic
10.10.10.255 FF-FF-FF-FF-FF-FF Static
224.0.0.22 01-00-5E-00-00-16 Static
224.0.0.251 01-00-5E-00-00-FB Static
224.0.0.252 01-00-5E-00-00-FC Static
239.255.255.250 01-00-5E-7F-FF-FA Static
255.255.255.255 FF-FF-FF-FF-FF-FF Static
OpenVPN TAP-Windows6 --- Index 5
Interface Description : TAP-Windows Adapter V9
Interface IPs : fe80::7560:ca9b:492d:4bc4%5, 169.254.36.173
DNS Servers : fec0:0:0:ffff::1%1, fec0:0:0:ffff::2%1, fec0:0:0:ffff::3%1
...truncated for brevity...
このグループは以下を含む55の異なるコマンドを実行します:
- AMSIProviders
- AntiVirus
- AppLocker
- ARPTable
- AuditPolicies
- AuditSettings
- AutoRuns
- CredGuard
- DNSCache
- DotNet
- EnvironmentPath
- EnvironmentVariables
- InterestingProcesses
- InternetSettings
- LAPS
- LastShutdown
- LocalGPOs
- LocalGroups
- LocalUsers
- LogonSessions
- LSASettings
- NamedPipes
- NetworkProfiles
- NetworkShares
- NTLMSettings
- OSInfo
- PoweredOnEvents
- PowerShell
- Processes
- PSSessionSettings
- RDPSessions
- SCCM
- Services
- Sysmon
- TcpConnections
- TokenPrivileges
- UAC
- UdpConnections
- UserRightAssignments
- WindowsAutoLogon
- WindowsDefender
- WindowsEventForwarding
- WindowsFirewall
- WMIEventConsumer
- WMIEventFilter
- WMIFilterBinding
- WSUS
これは、オフライン分析のためにターゲットシステムに関する大量のデータを取得する迅速な方法です。興味深いコマンドのいくつかと、それらがどのように役立つかを簡単に見てみましょう。
- AutoRuns - 実行可能ファイルまたはその設定を変更して、永続性や権限昇格に利用できる可能性があります
- InterestingProcesses - システムにインストールされている防御および管理ツールを理解するのに役立ちます
- LocalGroups and LocalUsers - これらは昇格または永続性に使用できる可能性があります
- LogonSessions - これは現在ログオンしているユーザーのリストです。彼らのアクセスをラテラルムーブメントや権限昇格に使用できる可能性があります。
- NetworkShares - 私たちのシステムは他の人が必要とする/欲しい有用な情報を共有していますか?別のユーザーやコンピュータへのアクセスを取得するためにファイルを追加または置き換えることができますか?
- PowerShell - このコマンドは、PowerShellの防御技術が有効になっているかどうかを知らせてくれます。有効になっていない場合、PowerShellツールを使用できる可能性があります。防御が有効になっている場合は、アラートをトリガーしないようにPowerShellを避けるのが最善かもしれません。
4: リモート使用
Seatbeltを使用して、ターゲットを悪用したり、ターゲットにラテラルムーブメントを試みる*前に*、ターゲットについて学ぶことができます。Windowsは自動的に現在のユーザートークンを渡すか、-username
と-password
でユーザー名とパスワードを指定することができます。
以前のパスワード推測で複数の有効な認証情報を見つけたことを思い出してください。bgreen
/Password1
を使用して、別のシステムのシステム情報をクエリします。
リモートで実行できるコマンドには+
のプレフィックスが付いていることを思い出してください。別のホストから情報を取得するためにリモートで実行できるコマンドを見てみましょう。
コマンド
Seatbelt.exe | findstr +
想定される結果
PS C:\bin> Seatbelt.exe | findstr +
Available commands (+ means remote usage is supported):
+ AMSIProviders - Providers registered for AMSI
+ AntiVirus - Registered antivirus (via WMI)
+ AppLocker - AppLocker settings, if installed
+ AuditPolicyRegistry - Audit settings via the registry
+ AutoRuns - Auto run executables/scripts/programs
+ ChromiumBookmarks - Parses any found Chrome/Edge/Brave/Opera bookmark files
+ ChromiumHistory - Parses any found Chrome/Edge/Brave/Opera history files
+ ChromiumPresence - Checks if interesting Chrome/Edge/Brave/Opera files exist
+ CloudCredentials - AWS/Google/Azure/Bluemix cloud credential files
+ CloudSyncProviders - All configured Office 365 endpoints (tenants and teamsites) which are synchronised by OneDrive.
+ CredGuard - CredentialGuard configuration
+ DNSCache - DNS cache entries (via WMI)
+ DotNet - DotNet versions
+ DpapiMasterKeys - List DPAPI master keys
+ EnvironmentVariables - Current environment variables
+ ExplicitLogonEvents - Explicit Logon events (Event ID 4648) from the security event log. Default of 7 days, argument == last X days.
+ ExplorerRunCommands - Recent Explorer "run" commands
+ FileZilla - FileZilla configuration files
+ FirefoxHistory - Parses any found FireFox history files
+ FirefoxPresence - Checks if interesting Firefox files exist
+ Hotfixes - Installed hotfixes (via WMI)
+ IEFavorites - Internet Explorer favorites
+ IEUrls - Internet Explorer typed URLs (last 7 days, argument == last X days)
+ InstalledProducts - Installed products via the registry
+ InterestingProcesses - "Interesting" processes - defensive products and admin tools
+ KeePass - Finds KeePass configuration files
+ LAPS - LAPS settings, if installed
+ LastShutdown - Returns the DateTime of the last system shutdown (via the registry).
+ LocalGroups - Non-empty local groups, "-full" displays all groups (argument == computername to enumerate)
+ LocalUsers - Local users, whether they're active/disabled, and pwd last set (argument == computername to enumerate)
+ LogonEvents - Logon events (Event ID 4624) from the security event log. Default of 10 days, argument == last X days.
+ LogonSessions - Windows logon sessions
+ LSASettings - LSA settings (including auth packages)
+ MappedDrives - Users' mapped drives (via WMI)
+ NetworkProfiles - Windows network profiles
+ NetworkShares - Network shares exposed by the machine (via WMI)
+ NTLMSettings - NTLM authentication settings
+ OptionalFeatures - List Optional Features/Roles (via WMI)
+ OSInfo - Basic OS info (i.e. architecture, OS version, etc.)
+ OutlookDownloads - List files downloaded by Outlook
+ PoweredOnEvents - Reboot and sleep schedule based on the System event log EIDs 1, 12, 13, 42, and 6008. Default of 7 days, argument == last X days.
+ PowerShell - PowerShell versions and security settings
+ PowerShellEvents - PowerShell script block logs (4104) with sensitive data.
+ PowerShellHistory - Searches PowerShell console history files for sensitive regex matches.
+ ProcessCreationEvents - Process creation logs (4688) with sensitive data.
+ ProcessOwners - Running non-session 0 process list with owners. For remote use.
+ PSSessionSettings - Enumerates PS Session Settings from the registry
+ PuttyHostKeys - Saved Putty SSH host keys
+ PuttySessions - Saved Putty configuration (interesting fields) and SSH host keys
+ RDPSavedConnections - Saved RDP connections stored in the registry
+ RDPSessions - Current incoming RDP sessions (argument == computername to enumerate)
+ RDPsettings - Remote Desktop Server/Client Settings
+ SCCM - System Center Configuration Manager (SCCM) settings, if applicable
+ ScheduledTasks - Scheduled tasks (via WMI) that aren't authored by 'Microsoft', "-full" dumps all Scheduled tasks
+ SlackDownloads - Parses any found 'slack-downloads' files
+ SlackPresence - Checks if interesting Slack files exist
+ SlackWorkspaces - Parses any found 'slack-workspaces' files
+ SuperPutty - SuperPutty configuration files
+ Sysmon - Sysmon configuration from the registry
+ SysmonEvents - Sysmon process creation logs (1) with sensitive data.
+ UAC - UAC system policies via the registry
+ WindowsAutoLogon - Registry autologon information
+ WindowsDefender - Windows Defender settings (including exclusion locations)
+ WindowsEventForwarding - Windows Event Forwarding (WEF) settings via the registry
+ WindowsFirewall - Non-standard firewall rules, "-full" dumps all (arguments == allow/deny/tcp/udp/in/out/domain/private/public)
+ WMI - Runs a specified WMI query
+ WSUS - Windows Server Update Services (WSUS) settings, if applicable
10.130.10.25システムに対してUAC
モジュールを実行してみましょう。
コマンド
Seatbelt.exe UAC '-computername=10.130.10.25' -username=hiboxy\bgreen -password=Password1
想定される結果
PS C:\bin> Seatbelt.exe UAC '-computername=10.130.10.25' -username=hiboxy\bgreen -password=Password1
[*] Running commands remotely against the host '10.130.10.25' with credentials -> user:hiboxy\bgreen , password:Password1
[...trimmed ASCII art...]
====== UAC ======
ConsentPromptBehaviorAdmin : 5 - PromptForNonWindowsBinaries
EnableLUA (Is UAC enabled?) : 1
LocalAccountTokenFilterPolicy :
FilterAdministratorToken :
[*] Default Windows settings - Only the RID-500 local admin account can be used for lateral movement.
[*] Completed collection in 0.714 seconds
ここで、UACが有効になっており、ローカルアカウントを使用する場合はラテラルムーブメントのために組み込みのAdministratorアカウント(RID 500)が必要であることがわかります。
時間がある場合は、このリモートシステムに対して他のモジュールをいくつか実行してください。
まとめ
Seatbeltは、ローカルシステムとリモートシステムの両方でチェックを実行するのに役立ちます。これらのチェックは、ペンテスターにとって最も有用な問題を見つけるように設計されています。