在 Windows Vista 後作業系統內置了 UAC(User Account Control)防護,本來應被視為其中一項相當重要的惡意程式防護、替我們擋下未知的惡意程式做出的惡意手段。然而現實慘狀卻告訴我們:UAC 服務只是一個惱人要求使用者同意的彈窗設計、而未能擋下數不盡的惡意程式攻擊。在這場議程中,將簡介微軟在 Windows 上防護體系的馬其諾防線、Win32 Process 裝載特性、逆向工程分析 UAC 實作細節、微軟設計 UAC 時作出的安全考量假設 與 各個大神是怎麼玩爆你的 UAC 防護的。
先備知識
先備知識要有的話要很到很深入的逆向工程、Windows 特性、C & C++ 資料結構觀念 etc。不過這份稿件我希望講架構大觀念與方向上是怎麼被惡意利用,應該不太需要前備知識
SITCON 2020 共筆
SITCON 2020
2020
共筆
R2
歡迎大家來到SITCON 2020 ヽ(✿゚▽゚)ノ
共筆入口:https://hackmd.io/@SITCON/2020
手機版請點選上方 按鈕展開議程列表。
請從這裡開始
您是否要允許這個來自未知發行者的App
Windows Vista 之後內置
process tree
執行流程:
Explorer(一般使用者 Ring3) -> runAs
-- RPC message --> UAC Service (B.)Send a task by RPC message to UAC service for creating a different privilege child proccess
-> trust_authA
--> trust_authB
-> privileged child process
syscall Ring3
auth_a
TrustAuth_A #trust path verify
$p = ToDosName("C:\\a.exe")
$p.startwith(\??\C:Windows\System32)
$p.startwith(\??\C:Windows\SysWoW64)
deny-list
\??\C:\Windows\Debug\
\??\C:\Windows\PCHealth\
\??\C:\Windows\Registration\
\??\C:\Windows\System32\com\
\??\C:\Windows\System32\FxsTmp\
\??\C:\Windows\System32\Microsoft\
\??\C:\Windows\System32\Spool\
...
debug 執行版本的程式
/?auth_b
//安裝服務、安裝系統套件
//要有微軟的簽章簽過,或是只要自己標註提升權限就可以提權
// cttunesvr
inetmgr
migsetup
mmc
oobe
pkgmgr
provisionshare
provisionstorage
…
/?Bypass
UAC:用兩種rule
A. launched from the system directory
B. whitelisted + signed by
sigcheck -m <program> - 檢查程式是否想要被提權
/?Attack
/?misc#1
Accessing Access Tokens for UIAccess
就是直接操作游標去點確定啦 lol
Accessing Access Tokens for UIAccess
/?misc#2
磁碟清掃工具會去 load Temp 裡面的 dll lol
Bypassing UAC on Windows 10 using Disk Cleanup
/?misc#3
wusa hack.cab /extract C:\windows\system32
WUSA.exe – Extract option is gone in Windows 10
用系統更新工具幫你解 .cab 進系統資料夾
comobject接口
檔案搬移、刪除、複製…
使用者帳戶控制 KuGou.exe 變更這些通知顯示的時機
複製的時候
菊花圖,放在C:應該也是UAC授權啊,但是視窗長得不一樣
ㄊ
用戶權限低嘗試到高權限的目錄下
/?fileCopy
/?alert
上面兩個操作詢問提升權限的方法不同
可以發現 KuGou 是透過 Consent.exe 詢問
而 Explorer 複製檔案時表現的方式代表其實本身可以使用高權限
/?hijack
$PATH:{
C:\hijack\VERSION.dll
}
系統函式庫VERSION.dll,你可能想要同層目錄的dll不是系統的dll
PoC
簡單來說就是利用 dll 注入 explorer 幫你做任意寫入,再讓其他服務 load 你的惡意 dll。
更動Windows註冊
開機選項
你的 D 槽裡面可能會有很多.avi
/?MasqueradePEB
偽裝執行程序資訊
/?WikiLeaks
Vault 7: CIA Hacking Tools Revealed
patched after Win10 1607 by utilizing dll load path whitelist
Moking
/?DACL
mkdir "C:\Windows \"
mkdir "C:\Windows \System32"
放在Win32,低權限,VERSION.dll就可以劫持
Windows 在解析路徑時會去掉尾端的空白,但是只有在透過 UI 修改時會阻擋尾端空白。所以可以透過其他方式創造經過處理後會變成系統路徑的假路徑,來繞過保護機制。
/?attack
/?recap
or
or
By clicking below, you agree to our terms of service.
New to HackMD? Sign up
Syntax | Example | Reference | |
---|---|---|---|
# Header | Header | 基本排版 | |
- Unordered List |
|
||
1. Ordered List |
|
||
- [ ] Todo List |
|
||
> Blockquote | Blockquote |
||
**Bold font** | Bold font | ||
*Italics font* | Italics font | ||
~~Strikethrough~~ | |||
19^th^ | 19th | ||
H~2~O | H2O | ||
++Inserted text++ | Inserted text | ||
==Marked text== | Marked text | ||
[link text](https:// "title") | Link | ||
 | Image | ||
`Code` | Code |
在筆記中貼入程式碼 | |
```javascript var i = 0; ``` |
|
||
:smile: | ![]() |
Emoji list | |
{%youtube youtube_id %} | Externals | ||
$L^aT_eX$ | LaTeX | ||
:::info This is a alert area. ::: |
This is a alert area. |
On a scale of 0-10, how likely is it that you would recommend HackMD to your friends, family or business associates?
Please give us some advice and help us improve HackMD.
Syncing