Upgrade to Pro — share decks privately, control downloads, hide ads and more …

開源編譯器,如何實現系統安全最後一哩路

Sponsored · Your Podcast. Everywhere. Effortlessly. Share. Educate. Inspire. Entertain. You do you. We'll handle the rest.

 開源編譯器,如何實現系統安全最後一哩路

COSCUP Talk

Avatar for Funny Systems

Funny Systems

August 20, 2016
Tweet

More Decks by Funny Systems

Other Decks in Technology

Transcript

  1. 不能用的劍 一.學術作法 1. 程式語言 • C 語言子集合 (C-Subset) » 沒人用

    • 領域專用語言 (DSL) » 更沒人用 2. 程式方法 • 函數式程式設計 (FP) » 有潛力 – 舊有風格程式碼 (Legacy Code) !?
  2. 清朝的劍, 砍→明朝的官 二.古代作法 (~2010) 1. 作業系統 • 記憶體隨機化 (ASLR) »

    有條件繞過 • 記憶體不可執行 (DEP/NX) » 可成熟繞過 2. 編譯器 • 堆疊溢位檢測 (StackGuard) » 有條件繞過 • 靜態分析 » 堪用~可用 – 掃描完,修不完!
  3. 還在發 Paper 階段 三.其他作法 1. 軟體驗證 (Verification) » (軍)工業等級 •

    But … 如果你還想加個新功能 (大驚!) 2. 執行檔二次處理 » 有時候需要 3. 虛擬化 » 看怎麼使用
  4. 軟體安全 系統安全 • OS – Kernel • TCB (Trust Computing

    Base) – Hypervisor • Firmware – TrustZone
  5. C/C++ 語言 • Pointer – Code Pointer • Return Address

    • Function Pointer • Method Pointer • Virtual Function Pointer – Data Pointer – Object Pointer
  6. C 語言 • Pointer – 完整性(效驗) • Return Address –

    隔離性 • Return Address – 不可預測性 • Function Pointer、Method Pointer
  7. C 語言 • Array、Global Data – 方向性 • Overflow •

    Underflow – 隔離性 • 邊界防禦
  8. StackGuard • 1998 年提出,GCC & LLVM • 透過編譯器,在 Stack Frame

    的 Return Address 前,插入 Canary/Cookie 。 – 用來抑制 Stack Overflow 問題 – Function Pointer on Stack – fork()
  9. CFI – Control Flow Integrity • 2005 年提出,LLVM • 透過編譯器,針對

    Direct/Indirect Control Flow 作完整性驗證 – Call Site & Call Target 互相配對 – 用來抑制 ROP 問題 – Mixing Function Chain & ROP Chain • 3rd Party • Legacy Code • Edge Case
  10. VTV – Virtual Table Verification • 2014 年提出,GCC & LLVM

    • 透過編譯器,針對 Virtual Table 結構,和 Virtual Function 呼叫,中間插入一層驗證 機制 – 主要用來抑制 Use-After-Free – Instantiated Template – tcmalloc
  11. Q&A