閱讀文章分享@若渴 2016.1.24

閱讀文章分享@若渴
2016.1.24
<ajblane0612@gmail.com>
AJMachine
https://cve4fun.hackpad.com/
關注動態方式
• 閱讀文章我先找出
• 有沒有fb粉專
• 有沒有YouTube訂閱
• Twitter
• FB其實蠻好用的
• 粉專->點讚->搶先看
• 每天打開fb看的都是關於資安的新聞
• 分享至自己動態,告知自己要看什麼
SMI到底是軟還是硬呢XD?可軟可硬
• SMM code completely unaccessible from OS and OS can’t even notice
when exactly SMI is being executed. There’s a several ways to
generate SMI:
• Ring 0 code can trigger software SMI at any time by writing some byte value
to APMC I/O port B2h.
• Internal chipset registers (SMI_EN, GEN_PMCON_1 and others) that
accessible via PCI config space allows to enable or disable different kind of
hardware SMI sources.
• You can route hardware interrupts into SMM by reconfiguring of advanced
programmable interrupt controller (APIC) that integrated into CPU.
• I/O instruction restart CPU feature (chapter 34.12 of IA-32 Architectures
Software Developer’s Manual) allows to generate SMI on any I/O port access
by IN or OUT processor instruction.
節錄Building reliable SMM backdoor for UEFI based platforms
Outline
•The memory sinkhole
•Undefined behavior: what happed to my code
•The impact of GPU-assisted malware on memory
forensics: a case study
•SLOTH
•ATM
HTTPS bicycle attack
The Memory Sinkhole
• In Intel, Ring 3 – Userland, Ring 0 – Kernel, Ring-1 - Hypervisor, Ring-2 –
SMM has the firmware, all the most critical security checks
• SMM hides from Ring 0
• System Management RAM (SMRAM) is only accessible to SMM
• SMM handler
• System Management Interrupt (SMI) toggles SMM
• SMM handler
• 抓DSC structure(Global Descriptor Table, Segment selectors,..)來對此結構初始化
• Attack技巧
• 使用APIC remap,把APIC payload (都為0)對應至DSC structure (SMRAM)
• 經過SMM handler執行完會跳至0x10:0x8077的位置去執行。
SMM Security
節錄The Memory Sinkhole : An architectural privilege escalation vulnerability
The APIC Remap Attack
節錄The Memory Sinkhole : An architectural
privilege escalation vulnerability
節錄The Memory Sinkhole : An architectural privilege escalation vulnerability
Undefined Behavior: What Happed to my
Code
• Undefined behavior
• Null Pointer Dereference
• Oversize Shit
• Singed Integer Overflow
• Out-of-Bounds Pointer
• Type-Punned Point Deference
• Uninitialized Read
• 程式碼的行為在C規格書上沒有定義,而c沒有定義的行為,各個
compiler會有不同狀況的處理,有可能把code移除,造成跟預期
結果不一樣,產生漏洞主角: compiler。= =||
Out-of-Bounds Pointer
• 指標的加減是Undefined behavior,所以要來看compiler會做什麼事,
如下code
• end < buf 會被Clang轉成
• buf + size < buf
• size < 0
• 之後它會刪除if (end < buf) { ... } 整個branch ,原本要避免Singed Integer Overflow
(!!)
Type-Punned Point Deference
• C有嚴格限制aliasing(兩個指標指向同一個記憶體做存取),但你往
往會aliasing導致undefined behavior,此行為會導致compiler沒辦
法最佳化
• 使用C的union,告知compiler我們是
一樣的,如以下code
節錄http://stackoverflow.com/questions/98650/what-is-the-strict-aliasing-rule
PIC/GSM Address Space Layout on Intel
Haswell
• PIC bus for GPU or DMA
• CPU view
• MMIO有一部分保留給PIC bus
• DRAM view
• MMIO記憶體範圍是看不到的,所以就看不到PIC bus
• Intel解法
• 在CPU view上設定位置TOLUD至4GB給MMIO,所以DRAM view
就可以看到相同的位置空間。
• Graphic Stolen Memory (GSM)
• CPU view大部分不能存取的,有GTT部分可以存取。
• 組成
• Graphics Translation Tables (GTT) : 告知GPU virtual-to-physical
可由BIOS階段設定
• Data Range (programming space)
The Impact of GPU-assisted Malware on
Memory Forensics: a Case Study
• 建立buffer object 在Graphics Execution Manage (GEM) subsystem(不
在GSM裡),可被CPU和GPU domains看到,使用不同的virtual
address
• OS page table
• graphic page table
• 攻擊手法
• GPU修改在GSM的graphic page table,原本對應 buffer object但可經由修
改存取到CPU使用memory的資料。
只是想了解為什麼hash collision跟TLS有關
SLOTH(CVE-2015-7575)
源自Transcript Collision Attacks:
Breaking Authentication in TLS, IKE, and SSH
Client 認證可過,代表MitMA可以假
裝Client C
Tyupkin ATM
malware in the ATM
你知道台灣人怎做嗎?
1 of 17

Recommended

[SITCON2015] 自己的異質多核心平台自己幹 by
[SITCON2015] 自己的異質多核心平台自己幹[SITCON2015] 自己的異質多核心平台自己幹
[SITCON2015] 自己的異質多核心平台自己幹Aj MaChInE
2.6K views42 slides
[MOSUT20150131] Linux Runs on SoCKit Board with the GPGPU by
[MOSUT20150131] Linux Runs on SoCKit Board with the GPGPU[MOSUT20150131] Linux Runs on SoCKit Board with the GPGPU
[MOSUT20150131] Linux Runs on SoCKit Board with the GPGPUAj MaChInE
1.3K views31 slides
Viny storage—网络游戏数据存储的终极解决方案 by
Viny storage—网络游戏数据存储的终极解决方案Viny storage—网络游戏数据存储的终极解决方案
Viny storage—网络游戏数据存储的终极解决方案Tencent
2.5K views18 slides
MySQL Tuning For CPU Bottleneck by
MySQL Tuning For CPU BottleneckMySQL Tuning For CPU Bottleneck
MySQL Tuning For CPU BottleneckSky Jian
13.9K views48 slides
如何针对业务做DB优化 by
如何针对业务做DB优化如何针对业务做DB优化
如何针对业务做DB优化Jinrong Ye
25.4K views22 slides
Node分享 展烨 by
Node分享 展烨Node分享 展烨
Node分享 展烨tb-vertical-guide
1.8K views15 slides

More Related Content

What's hot

Cinder isaci 实现原理详解 by
Cinder isaci 实现原理详解Cinder isaci 实现原理详解
Cinder isaci 实现原理详解Yong Luo
385 views9 slides
使用 Visual Studio Code 建構 JavaScript 應用程式 by
使用 Visual Studio Code 建構 JavaScript 應用程式使用 Visual Studio Code 建構 JavaScript 應用程式
使用 Visual Studio Code 建構 JavaScript 應用程式Will Huang
15.3K views27 slides
MySQL技术分享:一步到位实现mysql优化 by
MySQL技术分享:一步到位实现mysql优化MySQL技术分享:一步到位实现mysql优化
MySQL技术分享:一步到位实现mysql优化Jinrong Ye
5.1K views35 slides
Ceph中国社区9.19 Some Ceph Story-朱荣泽03 by
Ceph中国社区9.19 Some Ceph Story-朱荣泽03Ceph中国社区9.19 Some Ceph Story-朱荣泽03
Ceph中国社区9.19 Some Ceph Story-朱荣泽03Hang Geng
739 views44 slides
Android开发基础 by
Android开发基础Android开发基础
Android开发基础ykdsg
3K views23 slides
Windows Container 101: dotNET, Container, Kubernetes by
Windows Container 101: dotNET, Container, KubernetesWindows Container 101: dotNET, Container, Kubernetes
Windows Container 101: dotNET, Container, KubernetesWill Huang
1.9K views29 slides

What's hot(6)

Cinder isaci 实现原理详解 by Yong Luo
Cinder isaci 实现原理详解Cinder isaci 实现原理详解
Cinder isaci 实现原理详解
Yong Luo385 views
使用 Visual Studio Code 建構 JavaScript 應用程式 by Will Huang
使用 Visual Studio Code 建構 JavaScript 應用程式使用 Visual Studio Code 建構 JavaScript 應用程式
使用 Visual Studio Code 建構 JavaScript 應用程式
Will Huang15.3K views
MySQL技术分享:一步到位实现mysql优化 by Jinrong Ye
MySQL技术分享:一步到位实现mysql优化MySQL技术分享:一步到位实现mysql优化
MySQL技术分享:一步到位实现mysql优化
Jinrong Ye5.1K views
Ceph中国社区9.19 Some Ceph Story-朱荣泽03 by Hang Geng
Ceph中国社区9.19 Some Ceph Story-朱荣泽03Ceph中国社区9.19 Some Ceph Story-朱荣泽03
Ceph中国社区9.19 Some Ceph Story-朱荣泽03
Hang Geng739 views
Android开发基础 by ykdsg
Android开发基础Android开发基础
Android开发基础
ykdsg3K views
Windows Container 101: dotNET, Container, Kubernetes by Will Huang
Windows Container 101: dotNET, Container, KubernetesWindows Container 101: dotNET, Container, Kubernetes
Windows Container 101: dotNET, Container, Kubernetes
Will Huang1.9K views

Viewers also liked

[若渴計畫] Studying Concurrency by
[若渴計畫] Studying Concurrency[若渴計畫] Studying Concurrency
[若渴計畫] Studying ConcurrencyAj MaChInE
4K views38 slides
[若渴計畫2015.8.18] SMACK by
[若渴計畫2015.8.18] SMACK[若渴計畫2015.8.18] SMACK
[若渴計畫2015.8.18] SMACKAj MaChInE
1.2K views25 slides
[MOSUT] Format String Attacks by
[MOSUT] Format String Attacks[MOSUT] Format String Attacks
[MOSUT] Format String AttacksAj MaChInE
2.6K views16 slides
[若渴計畫]64-bit Linux Return-Oriented Programming by
[若渴計畫]64-bit Linux Return-Oriented Programming[若渴計畫]64-bit Linux Return-Oriented Programming
[若渴計畫]64-bit Linux Return-Oriented ProgrammingAj MaChInE
2.2K views24 slides
[若渴計畫]由GPU硬體概念到coding CUDA by
[若渴計畫]由GPU硬體概念到coding CUDA[若渴計畫]由GPU硬體概念到coding CUDA
[若渴計畫]由GPU硬體概念到coding CUDAAj MaChInE
4.8K views69 slides
Unattended Apache BigTop installer CD using preseed by
Unattended Apache BigTop installer CD using preseedUnattended Apache BigTop installer CD using preseed
Unattended Apache BigTop installer CD using preseedJazz Yao-Tsung Wang
447 views33 slides

Viewers also liked(11)

[若渴計畫] Studying Concurrency by Aj MaChInE
[若渴計畫] Studying Concurrency[若渴計畫] Studying Concurrency
[若渴計畫] Studying Concurrency
Aj MaChInE4K views
[若渴計畫2015.8.18] SMACK by Aj MaChInE
[若渴計畫2015.8.18] SMACK[若渴計畫2015.8.18] SMACK
[若渴計畫2015.8.18] SMACK
Aj MaChInE1.2K views
[MOSUT] Format String Attacks by Aj MaChInE
[MOSUT] Format String Attacks[MOSUT] Format String Attacks
[MOSUT] Format String Attacks
Aj MaChInE2.6K views
[若渴計畫]64-bit Linux Return-Oriented Programming by Aj MaChInE
[若渴計畫]64-bit Linux Return-Oriented Programming[若渴計畫]64-bit Linux Return-Oriented Programming
[若渴計畫]64-bit Linux Return-Oriented Programming
Aj MaChInE2.2K views
[若渴計畫]由GPU硬體概念到coding CUDA by Aj MaChInE
[若渴計畫]由GPU硬體概念到coding CUDA[若渴計畫]由GPU硬體概念到coding CUDA
[若渴計畫]由GPU硬體概念到coding CUDA
Aj MaChInE4.8K views
Unattended Apache BigTop installer CD using preseed by Jazz Yao-Tsung Wang
Unattended Apache BigTop installer CD using preseedUnattended Apache BigTop installer CD using preseed
Unattended Apache BigTop installer CD using preseed
「教出孩子的生存力」讀後心得 by Chih-Yu Lin
「教出孩子的生存力」讀後心得「教出孩子的生存力」讀後心得
「教出孩子的生存力」讀後心得
Chih-Yu Lin744 views
Mac protocols sensor_20071105_slideshare by Chih-Yu Lin
Mac protocols sensor_20071105_slideshareMac protocols sensor_20071105_slideshare
Mac protocols sensor_20071105_slideshare
Chih-Yu Lin8.6K views
DARPA CGC and DEFCON CTF: Automatic Attack and Defense Technique by Chong-Kuan Chen
DARPA CGC and DEFCON CTF: Automatic Attack and Defense TechniqueDARPA CGC and DEFCON CTF: Automatic Attack and Defense Technique
DARPA CGC and DEFCON CTF: Automatic Attack and Defense Technique
Chong-Kuan Chen3.1K views
2017-03-27 From Researcher To Product Manager by Jazz Yao-Tsung Wang
2017-03-27 From Researcher To Product Manager2017-03-27 From Researcher To Product Manager
2017-03-27 From Researcher To Product Manager
Jazz Yao-Tsung Wang1.5K views

Similar to 閱讀文章分享@若渴 2016.1.24

COSCUP2016 - LLVM框架、由淺入淺 by
COSCUP2016 - LLVM框架、由淺入淺COSCUP2016 - LLVM框架、由淺入淺
COSCUP2016 - LLVM框架、由淺入淺hydai
2.7K views62 slides
COSCUP 2016 - LLVM 由淺入淺 by
COSCUP 2016 - LLVM 由淺入淺COSCUP 2016 - LLVM 由淺入淺
COSCUP 2016 - LLVM 由淺入淺宗凡 楊
2.6K views62 slides
美团前端架构简介 by
美团前端架构简介美团前端架构简介
美团前端架构简介pan weizeng
4.8K views47 slides
谈谈模块化 by
谈谈模块化谈谈模块化
谈谈模块化衡锋 阳
925 views31 slides
twMVC#22 | 什麼鬼的IOC與DI by
twMVC#22 | 什麼鬼的IOC與DItwMVC#22 | 什麼鬼的IOC與DI
twMVC#22 | 什麼鬼的IOC與DItwMVC
449 views54 slides
构建可维护的Javascript 小米网 by
构建可维护的Javascript 小米网构建可维护的Javascript 小米网
构建可维护的Javascript 小米网yang alex
1.8K views30 slides

Similar to 閱讀文章分享@若渴 2016.1.24(20)

COSCUP2016 - LLVM框架、由淺入淺 by hydai
COSCUP2016 - LLVM框架、由淺入淺COSCUP2016 - LLVM框架、由淺入淺
COSCUP2016 - LLVM框架、由淺入淺
hydai2.7K views
COSCUP 2016 - LLVM 由淺入淺 by 宗凡 楊
COSCUP 2016 - LLVM 由淺入淺COSCUP 2016 - LLVM 由淺入淺
COSCUP 2016 - LLVM 由淺入淺
宗凡 楊2.6K views
美团前端架构简介 by pan weizeng
美团前端架构简介美团前端架构简介
美团前端架构简介
pan weizeng4.8K views
谈谈模块化 by 衡锋 阳
谈谈模块化谈谈模块化
谈谈模块化
衡锋 阳925 views
twMVC#22 | 什麼鬼的IOC與DI by twMVC
twMVC#22 | 什麼鬼的IOC與DItwMVC#22 | 什麼鬼的IOC與DI
twMVC#22 | 什麼鬼的IOC與DI
twMVC449 views
构建可维护的Javascript 小米网 by yang alex
构建可维护的Javascript 小米网构建可维护的Javascript 小米网
构建可维护的Javascript 小米网
yang alex1.8K views
构建可扩展的微博系统 by lonegunman
构建可扩展的微博系统构建可扩展的微博系统
构建可扩展的微博系统
lonegunman505 views
08 gaming framework design based on cocos2d-x by 乐费 胡
08   gaming framework design based on cocos2d-x08   gaming framework design based on cocos2d-x
08 gaming framework design based on cocos2d-x
乐费 胡702 views
广告投放代码和创意代码持续优化 by taobao.com
广告投放代码和创意代码持续优化广告投放代码和创意代码持续优化
广告投放代码和创意代码持续优化
taobao.com1.5K views
为啥别读HotSpot VM的源码(2012-03-03) by Kris Mok
为啥别读HotSpot VM的源码(2012-03-03)为啥别读HotSpot VM的源码(2012-03-03)
为啥别读HotSpot VM的源码(2012-03-03)
Kris Mok13.6K views
Build desktop app_by_xulrunner by Rack Lin
Build desktop app_by_xulrunnerBuild desktop app_by_xulrunner
Build desktop app_by_xulrunner
Rack Lin1.2K views
網站程式資安白箱與黑箱檢測處理經驗分享 by Ying-Chun Cheng
網站程式資安白箱與黑箱檢測處理經驗分享網站程式資安白箱與黑箱檢測處理經驗分享
網站程式資安白箱與黑箱檢測處理經驗分享
Ying-Chun Cheng22.5K views
Btrace intro(撒迦) by ykdsg
Btrace intro(撒迦)Btrace intro(撒迦)
Btrace intro(撒迦)
ykdsg2.2K views
通用Mock平台在支付宝测试的实践 by drewz lin
通用Mock平台在支付宝测试的实践通用Mock平台在支付宝测试的实践
通用Mock平台在支付宝测试的实践
drewz lin1.6K views
網路技術心得分享 by Mux Baxer
網路技術心得分享網路技術心得分享
網路技術心得分享
Mux Baxer276 views
腾讯大讲堂46 自由cgi之路v3 by George Ang
腾讯大讲堂46 自由cgi之路v3腾讯大讲堂46 自由cgi之路v3
腾讯大讲堂46 自由cgi之路v3
George Ang130 views
⼤語⾔模型 LLM 應⽤開發入⾨ by Wen-Tien Chang
⼤語⾔模型 LLM 應⽤開發入⾨⼤語⾔模型 LLM 應⽤開發入⾨
⼤語⾔模型 LLM 應⽤開發入⾨
Wen-Tien Chang5.4K views

More from Aj MaChInE

An Intro on Data-oriented Attacks by
An Intro on Data-oriented AttacksAn Intro on Data-oriented Attacks
An Intro on Data-oriented AttacksAj MaChInE
301 views18 slides
A Study on .NET Framework for Red Team - Part I by
A Study on .NET Framework for Red Team - Part IA Study on .NET Framework for Red Team - Part I
A Study on .NET Framework for Red Team - Part IAj MaChInE
493 views28 slides
A study on NetSpectre by
A study on NetSpectreA study on NetSpectre
A study on NetSpectreAj MaChInE
211 views27 slides
Introduction to Adversary Evaluation Tools by
Introduction to Adversary Evaluation ToolsIntroduction to Adversary Evaluation Tools
Introduction to Adversary Evaluation ToolsAj MaChInE
1.2K views45 slides
[若渴] A preliminary study on attacks against consensus in bitcoin by
[若渴] A preliminary study on attacks against consensus in bitcoin[若渴] A preliminary study on attacks against consensus in bitcoin
[若渴] A preliminary study on attacks against consensus in bitcoinAj MaChInE
345 views46 slides
[RAT資安小聚] Study on Automatically Evading Malware Detection by
[RAT資安小聚] Study on Automatically Evading Malware Detection[RAT資安小聚] Study on Automatically Evading Malware Detection
[RAT資安小聚] Study on Automatically Evading Malware DetectionAj MaChInE
795 views71 slides

More from Aj MaChInE(12)

An Intro on Data-oriented Attacks by Aj MaChInE
An Intro on Data-oriented AttacksAn Intro on Data-oriented Attacks
An Intro on Data-oriented Attacks
Aj MaChInE301 views
A Study on .NET Framework for Red Team - Part I by Aj MaChInE
A Study on .NET Framework for Red Team - Part IA Study on .NET Framework for Red Team - Part I
A Study on .NET Framework for Red Team - Part I
Aj MaChInE493 views
A study on NetSpectre by Aj MaChInE
A study on NetSpectreA study on NetSpectre
A study on NetSpectre
Aj MaChInE211 views
Introduction to Adversary Evaluation Tools by Aj MaChInE
Introduction to Adversary Evaluation ToolsIntroduction to Adversary Evaluation Tools
Introduction to Adversary Evaluation Tools
Aj MaChInE1.2K views
[若渴] A preliminary study on attacks against consensus in bitcoin by Aj MaChInE
[若渴] A preliminary study on attacks against consensus in bitcoin[若渴] A preliminary study on attacks against consensus in bitcoin
[若渴] A preliminary study on attacks against consensus in bitcoin
Aj MaChInE345 views
[RAT資安小聚] Study on Automatically Evading Malware Detection by Aj MaChInE
[RAT資安小聚] Study on Automatically Evading Malware Detection[RAT資安小聚] Study on Automatically Evading Malware Detection
[RAT資安小聚] Study on Automatically Evading Malware Detection
Aj MaChInE795 views
[若渴] Preliminary Study on Design and Exploitation of Trustzone by Aj MaChInE
[若渴] Preliminary Study on Design and Exploitation of Trustzone[若渴] Preliminary Study on Design and Exploitation of Trustzone
[若渴] Preliminary Study on Design and Exploitation of Trustzone
Aj MaChInE281 views
[若渴]Study on Side Channel Attacks and Countermeasures by Aj MaChInE
[若渴]Study on Side Channel Attacks and Countermeasures [若渴]Study on Side Channel Attacks and Countermeasures
[若渴]Study on Side Channel Attacks and Countermeasures
Aj MaChInE858 views
[若渴計畫] Challenges and Solutions of Window Remote Shellcode by Aj MaChInE
[若渴計畫] Challenges and Solutions of Window Remote Shellcode[若渴計畫] Challenges and Solutions of Window Remote Shellcode
[若渴計畫] Challenges and Solutions of Window Remote Shellcode
Aj MaChInE981 views
[若渴計畫] Introduction: Formal Verification for Code by Aj MaChInE
[若渴計畫] Introduction: Formal Verification for Code[若渴計畫] Introduction: Formal Verification for Code
[若渴計畫] Introduction: Formal Verification for Code
Aj MaChInE718 views
[若渴計畫] Studying ASLR^cache by Aj MaChInE
[若渴計畫] Studying ASLR^cache[若渴計畫] Studying ASLR^cache
[若渴計畫] Studying ASLR^cache
Aj MaChInE430 views
[若渴計畫] Black Hat 2017之過去閱讀相關整理 by Aj MaChInE
[若渴計畫] Black Hat 2017之過去閱讀相關整理[若渴計畫] Black Hat 2017之過去閱讀相關整理
[若渴計畫] Black Hat 2017之過去閱讀相關整理
Aj MaChInE434 views

閱讀文章分享@若渴 2016.1.24

  • 2. 關注動態方式 • 閱讀文章我先找出 • 有沒有fb粉專 • 有沒有YouTube訂閱 • Twitter • FB其實蠻好用的 • 粉專->點讚->搶先看 • 每天打開fb看的都是關於資安的新聞 • 分享至自己動態,告知自己要看什麼
  • 3. SMI到底是軟還是硬呢XD?可軟可硬 • SMM code completely unaccessible from OS and OS can’t even notice when exactly SMI is being executed. There’s a several ways to generate SMI: • Ring 0 code can trigger software SMI at any time by writing some byte value to APMC I/O port B2h. • Internal chipset registers (SMI_EN, GEN_PMCON_1 and others) that accessible via PCI config space allows to enable or disable different kind of hardware SMI sources. • You can route hardware interrupts into SMM by reconfiguring of advanced programmable interrupt controller (APIC) that integrated into CPU. • I/O instruction restart CPU feature (chapter 34.12 of IA-32 Architectures Software Developer’s Manual) allows to generate SMI on any I/O port access by IN or OUT processor instruction. 節錄Building reliable SMM backdoor for UEFI based platforms
  • 4. Outline •The memory sinkhole •Undefined behavior: what happed to my code •The impact of GPU-assisted malware on memory forensics: a case study •SLOTH •ATM HTTPS bicycle attack
  • 5. The Memory Sinkhole • In Intel, Ring 3 – Userland, Ring 0 – Kernel, Ring-1 - Hypervisor, Ring-2 – SMM has the firmware, all the most critical security checks • SMM hides from Ring 0 • System Management RAM (SMRAM) is only accessible to SMM • SMM handler • System Management Interrupt (SMI) toggles SMM • SMM handler • 抓DSC structure(Global Descriptor Table, Segment selectors,..)來對此結構初始化 • Attack技巧 • 使用APIC remap,把APIC payload (都為0)對應至DSC structure (SMRAM) • 經過SMM handler執行完會跳至0x10:0x8077的位置去執行。
  • 6. SMM Security 節錄The Memory Sinkhole : An architectural privilege escalation vulnerability
  • 7. The APIC Remap Attack 節錄The Memory Sinkhole : An architectural privilege escalation vulnerability
  • 8. 節錄The Memory Sinkhole : An architectural privilege escalation vulnerability
  • 9. Undefined Behavior: What Happed to my Code • Undefined behavior • Null Pointer Dereference • Oversize Shit • Singed Integer Overflow • Out-of-Bounds Pointer • Type-Punned Point Deference • Uninitialized Read • 程式碼的行為在C規格書上沒有定義,而c沒有定義的行為,各個 compiler會有不同狀況的處理,有可能把code移除,造成跟預期 結果不一樣,產生漏洞主角: compiler。= =||
  • 10. Out-of-Bounds Pointer • 指標的加減是Undefined behavior,所以要來看compiler會做什麼事, 如下code • end < buf 會被Clang轉成 • buf + size < buf • size < 0 • 之後它會刪除if (end < buf) { ... } 整個branch ,原本要避免Singed Integer Overflow (!!)
  • 11. Type-Punned Point Deference • C有嚴格限制aliasing(兩個指標指向同一個記憶體做存取),但你往 往會aliasing導致undefined behavior,此行為會導致compiler沒辦 法最佳化 • 使用C的union,告知compiler我們是 一樣的,如以下code 節錄http://stackoverflow.com/questions/98650/what-is-the-strict-aliasing-rule
  • 12. PIC/GSM Address Space Layout on Intel Haswell • PIC bus for GPU or DMA • CPU view • MMIO有一部分保留給PIC bus • DRAM view • MMIO記憶體範圍是看不到的,所以就看不到PIC bus • Intel解法 • 在CPU view上設定位置TOLUD至4GB給MMIO,所以DRAM view 就可以看到相同的位置空間。 • Graphic Stolen Memory (GSM) • CPU view大部分不能存取的,有GTT部分可以存取。 • 組成 • Graphics Translation Tables (GTT) : 告知GPU virtual-to-physical 可由BIOS階段設定 • Data Range (programming space)
  • 13. The Impact of GPU-assisted Malware on Memory Forensics: a Case Study • 建立buffer object 在Graphics Execution Manage (GEM) subsystem(不 在GSM裡),可被CPU和GPU domains看到,使用不同的virtual address • OS page table • graphic page table • 攻擊手法 • GPU修改在GSM的graphic page table,原本對應 buffer object但可經由修 改存取到CPU使用memory的資料。

Editor's Notes

  1. 我要怎使用APIC? *MMIO *從取 APIC 0xfee000000~0xfee01000 來存取體資訊與行為設定。例如: 讀processor ID APIC can relocated 我可以搬移MMIO的位置 MCH memory controller hub APIC registers mapped to processor memory at 0xfee00000 – 0xfee01000 APIC registers的map是可relocated