Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
戳戳防毒死穴 (Kill AV in X64)
Search
kenny
December 27, 2013
Technology
0
280
戳戳防毒死穴 (Kill AV in X64)
Hack In Taiwan(HIT) 2013
[email protected]
kenny
December 27, 2013
Tweet
Share
Other Decks in Technology
See All in Technology
AIと融ける人間の冒険
pujisi
0
110
マーケットプレイス版Oracle WebCenter Content For OCI
oracle4engineer
PRO
5
1.5k
SES向け、生成AI時代におけるエンジニアリングとセキュリティ
longbowxxx
0
310
Introduction to Sansan Meishi Maker Development Engineer
sansan33
PRO
0
330
「リリースファースト」の実感を届けるには 〜停滞するチームに変化を起こすアプローチ〜 #RSGT2026
kintotechdev
0
680
会社紹介資料 / Sansan Company Profile
sansan33
PRO
11
390k
Claude Codeを使った情報整理術
knishioka
20
12k
Oracle Database@Azure:サービス概要のご紹介
oracle4engineer
PRO
3
270
プロンプトエンジニアリングを超えて:自由と統制のあいだでつくる Platform × Context Engineering
yuriemori
0
260
「駆動」って言葉、なんかカッコイイ_Mitz
comucal
PRO
0
140
Scrum Guide Expansion Pack が示す現代プロダクト開発への補完的視点
sonjin
0
490
1万人を変え日本を変える!!多層構造型ふりかえりの大規模組織変革 / 20260108 Kazuki Mori
shift_evolve
PRO
6
960
Featured
See All Featured
The Web Performance Landscape in 2024 [PerfNow 2024]
tammyeverts
12
1k
Highjacked: Video Game Concept Design
rkendrick25
PRO
1
260
No one is an island. Learnings from fostering a developers community.
thoeni
21
3.6k
Evolving SEO for Evolving Search Engines
ryanjones
0
93
Pawsitive SEO: Lessons from My Dog (and Many Mistakes) on Thriving as a Consultant in the Age of AI
davidcarrasco
0
41
How to build a perfect <img>
jonoalderson
1
4.8k
GitHub's CSS Performance
jonrohan
1032
470k
The #1 spot is gone: here's how to win anyway
tamaranovitovic
1
880
Building an army of robots
kneath
306
46k
Navigating Team Friction
lara
191
16k
Side Projects
sachag
455
43k
Into the Great Unknown - MozCon
thekraken
40
2.2k
Transcript
[email protected]
戳戳防毒死穴 (Kill AV in X64)
About Me 現任研究生 網駭科技 – R & D Chroot Security
Group
What’s AV?
What’s AV?
None
None
雖然她們 伴隨著 青春歲月
深埋你我 的 D:\
But~
今天主角是…….
None
None
None
主題 , 你懂得:D
Anti AntiVirus(躲避防毒)
與防毒軟體 來一次親密的 衝擊
大綱-三件事 • 繞過UAC 拿到UserMode最高權限 • 繞過數位簽章檢查,拿到KernelMode權限 • Kill AV
What is UAC? • User Access Control
第一件事
UAC Bypass
5th February 2009 Reference http://www.pretentiousname.com/misc/win7_uac_whitelist2.html
利用條件一 • 某些程式在執行時會自動擁有 為管理者權限,但不會觸發UAC Windows/System32/sdclt.exe Windows/System32/shrpubw.exe Windows/System32/slui.exe Windows/System32/SndVol.exe Windows/System32/syskey.exe Windows/System32/sysprep/sysprep.exe
………..以下省略
利用條件二 • 某些程式可以建立特定的 Com Object且不會有UAC提示 Calc.exe – 小算盤 Taskmgr.exe –
工作管理員 Notepad.exe – 記事本 Explorer.exe ………..以下省略
利用條件三 • 某些Com Object,若建立成功則 擁有管理者權限 • Child Process會有與Parent Process 有相同權限(權限繼承)
Parent Process Admin權限 Create Child Process Admin權限
Code Injection Code WriteProcessMemory + CreateRemoteThread Explorer.exe
擁有管理員權限但不觸發UAC提示!! IFileOperation Object Pattern 3AD05575-8857-4850-9277-11B85BDB8E09 Code IFileOperation Object Create
IFileOperation Object(Com object) Windows Vista版本之後,檔案操作的框架 複製、剪下、刪除等操作都透過它。
IfileOperation Copy Cryptbase.dll (Evil) Save System32 \sysprep Explorer.exe Code Inject
Attacker
Execute DLL Hijack Cryptbase.dll (Evil) Load Admin Code sysprep.exe Attacker
None
模擬情境-不小心撿到….. 偷笑的一定是駭客
None
一秒變格格
Demo 一秒變Admin
第二件事
Driver數位簽章
None
None
None
Driver強制數位簽章機制(DSE) • Vista 64bit時期引入 • x64系統生效 • 載入Driver時, 即使有管理員權限仍會檢測
數位簽章檢查機制 In Kernel Mode x64 Driver 載入 簽章 檢查 載入成功
載入失敗
How to Bypass!?
一、正常方法 暫時性關閉數位簽章檢查 二、邪惡方法 • 替換BootLoader Bypass 數位簽章 & PatchGuard •
利用已公布之漏洞+白名單數位簽章
None
暫時性關閉數位簽章檢查 於電腦的 BIOS 自我檢測完成之後, 狂按 F8 鍵,等到出現「進階開機選項」, 選擇「停用驅動程式強制簽章」 啟動 Windows。
None
這叫
Binary Patch SystemFile 邪惡方法一
fyyre 2011/03/19 Reference http://fyyre.ivory-tower.de/
一、Patch SystemFile 1.winload.exe (1)檢查OS File是否被修改 (2)數位簽章檢查機制 技術原理-Binary Patch 2.ntoskrnl.exe(PatchGuard) 假裝安全模式騙過系統
二、bcdedit 新增自定義開機導引
None
提供Script + Dup2 的Patch
缺點 一、動作太大,會被AV偵測 二、必須重開機才有效果!
邪惡方法二 利用已公布之漏洞 加上正式簽章Bypass
Reference http://j00ru.vexillium.org/?p=377 A quick insight into the Driver Signature Enforcement
j00ru 2010/06/19
Bypass數位簽章檢測原理 nt!MmLoadSystemImage nt!MiObtainSectionForDriver nt!MiCreateSectionForDriver nt!MmCheckSystemImage nt!NtCreateSection nt!MmCreateSection nt!MiValidateImageHeader nt!SeValidateImageHeader •
nt!_g_CiCallbacks[0]
攻擊目標-關鍵變數 nt!g_CiEnabled 若值等於 1 則開啟數位簽章檢查 若值等於 0 則關閉檢查
條件一:正式數位簽章
條件二:任意寫入漏洞 /* drivecrypt-dcr.c * Copyright (c) 2009 by <
[email protected]
> *
DriveCrypt <= 5.3 local kernel ring0 exploit * by mu-b - Sun 16 Aug 2009 * - Tested on: DCR.sys * Compile: MinGW + -lntdll * - Private Source Code -DO NOT DISTRIBUTE - * http://www.digit-labs.org/ -- Digit-Labs 2009!@$! */
Fuzz Exploit by yourself?
If I have seen further [than certain other men] it
is by standing upon the shoulders of giants. Isaac Newton
None
http://www.exploit-db.com
倚天劍(User mode 權限)
屠龍刀(Kernel Mode 權限)
第三件事
Kill AV
Target
How To Kill It !?
Kernel Hook in x86
But…
PatchGuard in X64
None
為了不觸發PatchGuard, 微軟提供一套Kernel底下實作監控 框架的API,所以在x64系統底下, 各家防毒的核心自我保護手段都 『大同小異』。 微軟Solution
核心函數- ObRegisterCallbacks The ObRegisterCallbacks routine registers a list of callback
routines for thread and process handle operations. from MSDN
某防毒大廠
攻擊方法一 Message Flood
User Mode
核心Code
Demo
缺點 • 只能攻擊有GUI的程式 • 無法對防毒核心造成真正威脅,偷渡惡意程式
攻擊方法二
正式數位簽章 + KernelMode任意寫入漏洞
KeQueryIntervalProfile Call HalDispatchTable +0x8
Kernel ShellCode KeQueryIntervalProfile + HalDispatchTable + 0x8
Exploit流程 計算 g_CiEnabled 計算 HalDispatch Table 填寫 Shellcode 任意寫入漏洞 改寫
HalDispatchTable KeQueryInterval Profile 觸發Shellcode
改寫HalDispatchtable前 改寫HalDispatchtable後
Exploit流程 執行 Shellcode Bypass 簽章檢查 載入攻擊 Driver Kill AV PspTerminate
ThreadByPointer
Bypass – ShellCode 只有4行
Live Demo Kill AV
結論 • 大多數防毒 → WatchDog機制 • PatchGuard → ?? •
Here we can only trust ourselves relying on hackers.
Reference http://www.pretentiousname.com/misc/win7_uac_whitelist2.html http://fyyre.ivory-tower.de/ http://www.powerofcommunity.net/poc2012/mj0011.pdf
Reference http://echopakistan.com/wp-content/uploads/2013/04/windows8_logo_by_dracu_teufel666- d5n43o6.jpg http://stickmanlordsweb.webs.com/maddness%20kill.gif http://ext.pimg.tw/sana217/1368109769-1436612722.jpg http://zh.wikipedia.org/wiki/%E8%89%BE%E8%90%A8%E5%85%8B%C2%B7%E7%89%9B%E9%A1%BF http://1.bp.blogspot.com/- k2AluoKtRRg/TwcZ_F1P4kI/AAAAAAAAACU/jz4FXhTdQOE/s640/%25E7%2589%25A9%25E7%2590%25 86111%25E7%258F%25AD%25E5%25BE%25BD- %25E5%25BE%2590%25E9%259D%2592%25E9%259D%2592.jpg
http://www.jsswordshop.com/images/upload/Image/IMG_7258.jpg http://img0.pengfu.cn/big/36/3036.jpg http://www.giddens.tw/blog http://pic5.nipic.com/20100126/7971_151429039628_2.jpg http://soobahkdo.biz/wp-content/uploads/2011/02/easy-button-350x350.jpg http://i.imgur.com/nHIAq.jpg http://pic1.duowan.com/news/1204/198857478824/198857478830.jpg http://farm3.static.flickr.com/2096/1873199072_9c5f12a621.jpg http://www.guten-morgen-voyager.de/portal/images/flatto/dasbild/mission_impossible.jpg http://img1.guokr.com/gkimage/xa/th/ya/xathya.jpg http://img1.guokr.com/gkimage/6e/dj/1m/6edj1m.jpg http://imgs.caraq.com/UploadData/fck/image/192/19278/%E4%B8%80%E6%93%8A%E5%BF%85%E6%A E%BA.jpg http://www.nydailynews.com/img/2008/07/15/gal_allstar-derby_1.jpg
None