戳戳防毒死穴 (Kill AV in X64)
by
kenny
×
Copy
Open
Link
Embed
Share
Beginning
This slide
Copy link URL
Copy link URL
Copy iframe embed code
Copy iframe embed code
Copy javascript embed code
Copy javascript embed code
Share
Tweet
Share
Tweet
Slide 1
Slide 1 text
[email protected]
戳戳防毒死穴 (Kill AV in X64)
Slide 2
Slide 2 text
About Me 現任研究生 網駭科技 – R & D Chroot Security Group
Slide 3
Slide 3 text
What’s AV?
Slide 4
Slide 4 text
What’s AV?
Slide 5
Slide 5 text
No content
Slide 6
Slide 6 text
No content
Slide 7
Slide 7 text
雖然她們 伴隨著 青春歲月
Slide 8
Slide 8 text
深埋你我 的 D:\
Slide 9
Slide 9 text
But~
Slide 10
Slide 10 text
今天主角是…….
Slide 11
Slide 11 text
No content
Slide 12
Slide 12 text
No content
Slide 13
Slide 13 text
No content
Slide 14
Slide 14 text
主題 , 你懂得:D
Slide 15
Slide 15 text
Anti AntiVirus(躲避防毒)
Slide 16
Slide 16 text
與防毒軟體 來一次親密的 衝擊
Slide 17
Slide 17 text
大綱-三件事 • 繞過UAC 拿到UserMode最高權限 • 繞過數位簽章檢查,拿到KernelMode權限 • Kill AV
Slide 18
Slide 18 text
What is UAC? • User Access Control
Slide 19
Slide 19 text
第一件事
Slide 20
Slide 20 text
UAC Bypass
Slide 21
Slide 21 text
5th February 2009 Reference http://www.pretentiousname.com/misc/win7_uac_whitelist2.html
Slide 22
Slide 22 text
利用條件一 • 某些程式在執行時會自動擁有 為管理者權限,但不會觸發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 ………..以下省略
Slide 23
Slide 23 text
利用條件二 • 某些程式可以建立特定的 Com Object且不會有UAC提示 Calc.exe – 小算盤 Taskmgr.exe – 工作管理員 Notepad.exe – 記事本 Explorer.exe ………..以下省略
Slide 24
Slide 24 text
利用條件三 • 某些Com Object,若建立成功則 擁有管理者權限 • Child Process會有與Parent Process 有相同權限(權限繼承) Parent Process Admin權限 Create Child Process Admin權限
Slide 25
Slide 25 text
Code Injection Code WriteProcessMemory + CreateRemoteThread Explorer.exe
Slide 26
Slide 26 text
擁有管理員權限但不觸發UAC提示!! IFileOperation Object Pattern 3AD05575-8857-4850-9277-11B85BDB8E09 Code IFileOperation Object Create
Slide 27
Slide 27 text
IFileOperation Object(Com object) Windows Vista版本之後,檔案操作的框架 複製、剪下、刪除等操作都透過它。
Slide 28
Slide 28 text
IfileOperation Copy Cryptbase.dll (Evil) Save System32 \sysprep Explorer.exe Code Inject Attacker
Slide 29
Slide 29 text
Execute DLL Hijack Cryptbase.dll (Evil) Load Admin Code sysprep.exe Attacker
Slide 30
Slide 30 text
No content
Slide 31
Slide 31 text
模擬情境-不小心撿到….. 偷笑的一定是駭客
Slide 32
Slide 32 text
No content
Slide 33
Slide 33 text
一秒變格格
Slide 34
Slide 34 text
Demo 一秒變Admin
Slide 35
Slide 35 text
第二件事
Slide 36
Slide 36 text
Driver數位簽章
Slide 37
Slide 37 text
No content
Slide 38
Slide 38 text
No content
Slide 39
Slide 39 text
No content
Slide 40
Slide 40 text
Driver強制數位簽章機制(DSE) • Vista 64bit時期引入 • x64系統生效 • 載入Driver時, 即使有管理員權限仍會檢測
Slide 41
Slide 41 text
數位簽章檢查機制 In Kernel Mode x64 Driver 載入 簽章 檢查 載入成功 載入失敗
Slide 42
Slide 42 text
How to Bypass!?
Slide 43
Slide 43 text
一、正常方法 暫時性關閉數位簽章檢查 二、邪惡方法 • 替換BootLoader Bypass 數位簽章 & PatchGuard • 利用已公布之漏洞+白名單數位簽章
Slide 44
Slide 44 text
No content
Slide 45
Slide 45 text
暫時性關閉數位簽章檢查 於電腦的 BIOS 自我檢測完成之後, 狂按 F8 鍵,等到出現「進階開機選項」, 選擇「停用驅動程式強制簽章」 啟動 Windows。
Slide 46
Slide 46 text
No content
Slide 47
Slide 47 text
這叫
Slide 48
Slide 48 text
Binary Patch SystemFile 邪惡方法一
Slide 49
Slide 49 text
fyyre 2011/03/19 Reference http://fyyre.ivory-tower.de/
Slide 50
Slide 50 text
一、Patch SystemFile 1.winload.exe (1)檢查OS File是否被修改 (2)數位簽章檢查機制 技術原理-Binary Patch 2.ntoskrnl.exe(PatchGuard) 假裝安全模式騙過系統 二、bcdedit 新增自定義開機導引
Slide 51
Slide 51 text
No content
Slide 52
Slide 52 text
提供Script + Dup2 的Patch
Slide 53
Slide 53 text
缺點 一、動作太大,會被AV偵測 二、必須重開機才有效果!
Slide 54
Slide 54 text
邪惡方法二 利用已公布之漏洞 加上正式簽章Bypass
Slide 55
Slide 55 text
Reference http://j00ru.vexillium.org/?p=377 A quick insight into the Driver Signature Enforcement j00ru 2010/06/19
Slide 56
Slide 56 text
Bypass數位簽章檢測原理 nt!MmLoadSystemImage nt!MiObtainSectionForDriver nt!MiCreateSectionForDriver nt!MmCheckSystemImage nt!NtCreateSection nt!MmCreateSection nt!MiValidateImageHeader nt!SeValidateImageHeader ● nt!_g_CiCallbacks[0]
Slide 57
Slide 57 text
攻擊目標-關鍵變數 nt!g_CiEnabled 若值等於 1 則開啟數位簽章檢查 若值等於 0 則關閉檢查
Slide 58
Slide 58 text
條件一:正式數位簽章
Slide 59
Slide 59 text
條件二:任意寫入漏洞 /* drivecrypt-dcr.c * Copyright (c) 2009 by * 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!@$! */
Slide 60
Slide 60 text
Fuzz Exploit by yourself?
Slide 61
Slide 61 text
If I have seen further [than certain other men] it is by standing upon the shoulders of giants. Isaac Newton
Slide 62
Slide 62 text
No content
Slide 63
Slide 63 text
http://www.exploit-db.com
Slide 64
Slide 64 text
倚天劍(User mode 權限)
Slide 65
Slide 65 text
屠龍刀(Kernel Mode 權限)
Slide 66
Slide 66 text
第三件事
Slide 67
Slide 67 text
Kill AV
Slide 68
Slide 68 text
Target
Slide 69
Slide 69 text
How To Kill It !?
Slide 70
Slide 70 text
Kernel Hook in x86
Slide 71
Slide 71 text
But…
Slide 72
Slide 72 text
PatchGuard in X64
Slide 73
Slide 73 text
No content
Slide 74
Slide 74 text
為了不觸發PatchGuard, 微軟提供一套Kernel底下實作監控 框架的API,所以在x64系統底下, 各家防毒的核心自我保護手段都 『大同小異』。 微軟Solution
Slide 75
Slide 75 text
核心函數- ObRegisterCallbacks The ObRegisterCallbacks routine registers a list of callback routines for thread and process handle operations. from MSDN
Slide 76
Slide 76 text
某防毒大廠
Slide 77
Slide 77 text
攻擊方法一 Message Flood
Slide 78
Slide 78 text
User Mode
Slide 79
Slide 79 text
核心Code
Slide 80
Slide 80 text
Demo
Slide 81
Slide 81 text
缺點 • 只能攻擊有GUI的程式 • 無法對防毒核心造成真正威脅,偷渡惡意程式
Slide 82
Slide 82 text
攻擊方法二
Slide 83
Slide 83 text
正式數位簽章 + KernelMode任意寫入漏洞
Slide 84
Slide 84 text
KeQueryIntervalProfile Call HalDispatchTable +0x8
Slide 85
Slide 85 text
Kernel ShellCode KeQueryIntervalProfile + HalDispatchTable + 0x8
Slide 86
Slide 86 text
Exploit流程 計算 g_CiEnabled 計算 HalDispatch Table 填寫 Shellcode 任意寫入漏洞 改寫 HalDispatchTable KeQueryInterval Profile 觸發Shellcode
Slide 87
Slide 87 text
改寫HalDispatchtable前 改寫HalDispatchtable後
Slide 88
Slide 88 text
Exploit流程 執行 Shellcode Bypass 簽章檢查 載入攻擊 Driver Kill AV PspTerminate ThreadByPointer
Slide 89
Slide 89 text
Bypass – ShellCode 只有4行
Slide 90
Slide 90 text
Live Demo Kill AV
Slide 91
Slide 91 text
結論 • 大多數防毒 → WatchDog機制 • PatchGuard → ?? • Here we can only trust ourselves relying on hackers.
Slide 92
Slide 92 text
Reference http://www.pretentiousname.com/misc/win7_uac_whitelist2.html http://fyyre.ivory-tower.de/ http://www.powerofcommunity.net/poc2012/mj0011.pdf
Slide 93
Slide 93 text
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
Slide 94
Slide 94 text
No content