SlideShare ist ein Scribd-Unternehmen logo
1 von 29
Related Work:
Code Reuse Attacks
2016.6.21
<ajblane0612@gmail.com>
AJMachine
@若渴
How to Explore Code Reuse to
Construct a Turing Machine
https://www.quora.com/What-exactly-is-Turings-Automatic-Computing-Engine
The Turing Machine
• Finite state machine
• Read head
• Program
For Example: Return-Oriented
Programming
virtual memory
heap
high
low
code
ADD gadget ret
LOAD gadget ret
stack
ADD gadget Addr
LOAD gadget AddrSP
• Finite state machine
• SP (read head) + ret
• Program
• LOAD gadget ret
For Simplicity,
Code Reuse Attack Using ROP
László Szekeres, etc., “Eternal War in Memory”
Stack overflow Use-After-Free 不只
ROP
沒畫到SMEP
Modify a Code Pointer …
• Code pointer
– Stack overflow modifies EIP. Once ret instruction
is used, the execution flow is redirected.
– Heap overflow modifies function pointer with an
address that points to stack pivot gadget. Once
the overwritten function pointer is used by the
application, the execution flow is redirected.
– Enrique Nissim, etc.,Windows SMEP Bypass U=S
(!)
– …
Just-In-Time ROP
Kevin Z. Snow, etc., “Just-In-Time Code Reuse: On the Effectiveness of
Fine-Grained Address Space Layout Randomization”
ROP
ASLR
ASLR
ROP semantics (Load/Store/…) RO Programming
自動化找gadgets
ROP gadgets ROP compiler
Just-in-time ROP compiler Bypassing ASLR
Initial code pointer
還需stack overflow,等來執行ROP payload
Network
AttackerVictim
Initial code pointer
kuku補充
Researches on Code Reuse Attacks to
Break Defenses
• The different FSMs
• The different gadgets
Code Reuse Attacks
• Jump-oriented programming
• Loop-oriented programming
• Interrupt-oriented programming
• Data-oriented programming
• …
Jump-oriented Programming
Tyler Bletsch, etc.,”Jump-Oriented Programming: A New Class of Code-Reuse Attack”
• Bypassing ret integrity
• Stackless
Loop-oriented(call-ret-pairing)
Programming
• Bypassing CFI and
shadow stack
Interrupt-oriented Programming
Samuel Junjie Tan, etc., “Interrupt-oriented Bugdoor Programming: A minimalist approach to
bugdooring embedded systems firmware“
IOP Setup
Timings are precise enough
The table is from László Szekeres, etc., “Eternal War in Memory”
Data-oriented programming
假設data address已知
Data-oriented Exploit
Hong Hu, etc., “Automatic Generation of Data-Oriented Exploits”
Data-oriented Exploit
Hong Hu, etc., “Automatic Generation of Data-Oriented Exploits”
Data-oriented Exploit
Hong Hu, etc., “Automatic Generation of Data-Oriented Exploits”
Data-oriented Exploit is
Turing-complete
Hong Hu, etc., “Data-Oriented Programming: On the Expressiveness
of Non-Control Data Attacks”
• The data consumed by the interpreter is
inherently under the remote attacker’s control
• For example, all local variables are under the
control of attackers using stack overflow
The Concept of Data-oriented
Programming
Vulnerable FTP server with data-oriented gadgets
Data-oriented Programming
a data-oriented gadget simulates
three logical micro-operations
• the load micro-operation
• the intended virtual operation’s
semantics
• store micro-operation.
The Evil interpreter
data-oriented gadget of assignment operation
利用DOP執行 74+612
round1
*type被 corrupted 成 !NONE 也不是 !STREAM,假設 *type =74。
假設srv被corrupted讓 srv + 0x8 (srv->type) 等於 size。
那執行assignment gadget時,*size = 74
而執行addition gadget是無意思的。
The Evil interpreter
round2
*type被 corrupted 成 !NONE 也不是 !STREAM,假設 *type =612。
假設srv被corrupted成 srv – 0x4,
讓 srv – 0x4 + 0x8 (srv->type) 會等於 srv + 0x4 (srv->total) 。
那執行assignment gadget時, srv->total = 612
而執行addition gadget是無意思的
The Evil interpreter
round3
*type被 corrupted 成 !NONE 也不是 !STREAM,假設 *type =612。
假設srv被corrupted成 (srv – 0x4) + 0x4
那執行assignment gadget時, 是無意思。
而執行addition gadget就會是 612 + 74存至srv->total
The Evil interpreter
Reference
• https://www.trust.cased.de/fileadmin/user_upload/Group_TRUST/
PubsPDF/blackhat-2013-jitrop.pdf
• http://www.ieee-security.org/TC/SP2013/papers/4977a574.pdf
• https://nebelwelt.net/publications/files/14SP.pdf
• https://www.csc.ncsu.edu/faculty/jiang/pubs/ASIACCS11.pdf
• http://tcipg.org/sites/default/files/papers/2014_q3_tfs1.pdf
• https://www.usenix.org/sites/default/files/conference/protected-
files/sec15_slides_hu_0.pdf
• http://huhong-nus.github.io/advanced-DOP/
• https://www.ics.uci.edu/~perl/keynote_sadeghi_runtime_exploits.
pdf
• https://www.trust.cased.de/fileadmin/user_upload/Group_TRUST/
PubsPDF/blackhat-2013-jitrop.pdf
• http://www.ieee-security.org/TC/SP2013/papers/4977a574.pdf

Weitere ähnliche Inhalte

Mehr von Aj MaChInE

Mehr von Aj MaChInE (12)

An Intro on Data-oriented Attacks
An Intro on Data-oriented AttacksAn Intro on Data-oriented Attacks
An Intro on Data-oriented Attacks
 
A Study on .NET Framework for Red Team - Part I
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
 
A study on NetSpectre
A study on NetSpectreA study on NetSpectre
A study on NetSpectre
 
Introduction to Adversary Evaluation Tools
Introduction to Adversary Evaluation ToolsIntroduction to Adversary Evaluation Tools
Introduction to Adversary Evaluation Tools
 
[若渴] 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
[若渴] A preliminary study on attacks against consensus in bitcoin
 
[RAT資安小聚] Study on Automatically Evading Malware Detection
[RAT資安小聚] Study on Automatically Evading Malware Detection[RAT資安小聚] Study on Automatically Evading Malware Detection
[RAT資安小聚] Study on Automatically Evading Malware Detection
 
[若渴] Preliminary Study on Design and Exploitation of Trustzone
[若渴] Preliminary Study on Design and Exploitation of Trustzone[若渴] Preliminary Study on Design and Exploitation of Trustzone
[若渴] Preliminary Study on Design and Exploitation of Trustzone
 
[若渴]Study on Side Channel Attacks and Countermeasures
[若渴]Study on Side Channel Attacks and Countermeasures [若渴]Study on Side Channel Attacks and Countermeasures
[若渴]Study on Side Channel Attacks and Countermeasures
 
[若渴計畫] Challenges and Solutions of Window Remote Shellcode
[若渴計畫] Challenges and Solutions of Window Remote Shellcode[若渴計畫] Challenges and Solutions of Window Remote Shellcode
[若渴計畫] Challenges and Solutions of Window Remote Shellcode
 
[若渴計畫] Introduction: Formal Verification for Code
[若渴計畫] Introduction: Formal Verification for Code[若渴計畫] Introduction: Formal Verification for Code
[若渴計畫] Introduction: Formal Verification for Code
 
[若渴計畫] Studying ASLR^cache
[若渴計畫] Studying ASLR^cache[若渴計畫] Studying ASLR^cache
[若渴計畫] Studying ASLR^cache
 
[若渴計畫] Black Hat 2017之過去閱讀相關整理
[若渴計畫] Black Hat 2017之過去閱讀相關整理[若渴計畫] Black Hat 2017之過去閱讀相關整理
[若渴計畫] Black Hat 2017之過去閱讀相關整理
 

Kürzlich hochgeladen

If this Giant Must Walk: A Manifesto for a New Nigeria
If this Giant Must Walk: A Manifesto for a New NigeriaIf this Giant Must Walk: A Manifesto for a New Nigeria
If this Giant Must Walk: A Manifesto for a New Nigeria
Kayode Fayemi
 
Uncommon Grace The Autobiography of Isaac Folorunso
Uncommon Grace The Autobiography of Isaac FolorunsoUncommon Grace The Autobiography of Isaac Folorunso
Uncommon Grace The Autobiography of Isaac Folorunso
Kayode Fayemi
 
No Advance 8868886958 Chandigarh Call Girls , Indian Call Girls For Full Nigh...
No Advance 8868886958 Chandigarh Call Girls , Indian Call Girls For Full Nigh...No Advance 8868886958 Chandigarh Call Girls , Indian Call Girls For Full Nigh...
No Advance 8868886958 Chandigarh Call Girls , Indian Call Girls For Full Nigh...
Sheetaleventcompany
 

Kürzlich hochgeladen (20)

Call Girl Number in Khar Mumbai📲 9892124323 💞 Full Night Enjoy
Call Girl Number in Khar Mumbai📲 9892124323 💞 Full Night EnjoyCall Girl Number in Khar Mumbai📲 9892124323 💞 Full Night Enjoy
Call Girl Number in Khar Mumbai📲 9892124323 💞 Full Night Enjoy
 
Introduction to Prompt Engineering (Focusing on ChatGPT)
Introduction to Prompt Engineering (Focusing on ChatGPT)Introduction to Prompt Engineering (Focusing on ChatGPT)
Introduction to Prompt Engineering (Focusing on ChatGPT)
 
If this Giant Must Walk: A Manifesto for a New Nigeria
If this Giant Must Walk: A Manifesto for a New NigeriaIf this Giant Must Walk: A Manifesto for a New Nigeria
If this Giant Must Walk: A Manifesto for a New Nigeria
 
Causes of poverty in France presentation.pptx
Causes of poverty in France presentation.pptxCauses of poverty in France presentation.pptx
Causes of poverty in France presentation.pptx
 
Air breathing and respiratory adaptations in diver animals
Air breathing and respiratory adaptations in diver animalsAir breathing and respiratory adaptations in diver animals
Air breathing and respiratory adaptations in diver animals
 
Dreaming Marissa Sánchez Music Video Treatment
Dreaming Marissa Sánchez Music Video TreatmentDreaming Marissa Sánchez Music Video Treatment
Dreaming Marissa Sánchez Music Video Treatment
 
ANCHORING SCRIPT FOR A CULTURAL EVENT.docx
ANCHORING SCRIPT FOR A CULTURAL EVENT.docxANCHORING SCRIPT FOR A CULTURAL EVENT.docx
ANCHORING SCRIPT FOR A CULTURAL EVENT.docx
 
SaaStr Workshop Wednesday w/ Lucas Price, Yardstick
SaaStr Workshop Wednesday w/ Lucas Price, YardstickSaaStr Workshop Wednesday w/ Lucas Price, Yardstick
SaaStr Workshop Wednesday w/ Lucas Price, Yardstick
 
Re-membering the Bard: Revisiting The Compleat Wrks of Wllm Shkspr (Abridged)...
Re-membering the Bard: Revisiting The Compleat Wrks of Wllm Shkspr (Abridged)...Re-membering the Bard: Revisiting The Compleat Wrks of Wllm Shkspr (Abridged)...
Re-membering the Bard: Revisiting The Compleat Wrks of Wllm Shkspr (Abridged)...
 
Uncommon Grace The Autobiography of Isaac Folorunso
Uncommon Grace The Autobiography of Isaac FolorunsoUncommon Grace The Autobiography of Isaac Folorunso
Uncommon Grace The Autobiography of Isaac Folorunso
 
The workplace ecosystem of the future 24.4.2024 Fabritius_share ii.pdf
The workplace ecosystem of the future 24.4.2024 Fabritius_share ii.pdfThe workplace ecosystem of the future 24.4.2024 Fabritius_share ii.pdf
The workplace ecosystem of the future 24.4.2024 Fabritius_share ii.pdf
 
ICT role in 21st century education and it's challenges.pdf
ICT role in 21st century education and it's challenges.pdfICT role in 21st century education and it's challenges.pdf
ICT role in 21st century education and it's challenges.pdf
 
Dreaming Music Video Treatment _ Project & Portfolio III
Dreaming Music Video Treatment _ Project & Portfolio IIIDreaming Music Video Treatment _ Project & Portfolio III
Dreaming Music Video Treatment _ Project & Portfolio III
 
No Advance 8868886958 Chandigarh Call Girls , Indian Call Girls For Full Nigh...
No Advance 8868886958 Chandigarh Call Girls , Indian Call Girls For Full Nigh...No Advance 8868886958 Chandigarh Call Girls , Indian Call Girls For Full Nigh...
No Advance 8868886958 Chandigarh Call Girls , Indian Call Girls For Full Nigh...
 
BDSM⚡Call Girls in Sector 93 Noida Escorts >༒8448380779 Escort Service
BDSM⚡Call Girls in Sector 93 Noida Escorts >༒8448380779 Escort ServiceBDSM⚡Call Girls in Sector 93 Noida Escorts >༒8448380779 Escort Service
BDSM⚡Call Girls in Sector 93 Noida Escorts >༒8448380779 Escort Service
 
Presentation on Engagement in Book Clubs
Presentation on Engagement in Book ClubsPresentation on Engagement in Book Clubs
Presentation on Engagement in Book Clubs
 
VVIP Call Girls Nalasopara : 9892124323, Call Girls in Nalasopara Services
VVIP Call Girls Nalasopara : 9892124323, Call Girls in Nalasopara ServicesVVIP Call Girls Nalasopara : 9892124323, Call Girls in Nalasopara Services
VVIP Call Girls Nalasopara : 9892124323, Call Girls in Nalasopara Services
 
My Presentation "In Your Hands" by Halle Bailey
My Presentation "In Your Hands" by Halle BaileyMy Presentation "In Your Hands" by Halle Bailey
My Presentation "In Your Hands" by Halle Bailey
 
lONG QUESTION ANSWER PAKISTAN STUDIES10.
lONG QUESTION ANSWER PAKISTAN STUDIES10.lONG QUESTION ANSWER PAKISTAN STUDIES10.
lONG QUESTION ANSWER PAKISTAN STUDIES10.
 
Report Writing Webinar Training
Report Writing Webinar TrainingReport Writing Webinar Training
Report Writing Webinar Training
 

[若渴計畫] 2016.6.21 Related Work: Reuse Code Attacks

Hinweis der Redaktion

  1. 此配置狀況,至少要執行一個ret。
  2. 須達成修改code pointer才有後續的code reuse attacks
  3. 灰色部分代表需要在記憶體中 *Runtime disassembler *Runtime gadget finder *Just-in-time TOP compiler
  4. goto h(A), is used to invoke the functional gadget f(A) -> A, which can redirect A to point to the next item of dispatch table. For example, f can be A=A+4, or a dereference operation A=*(A+8) The main idea of CFI is to derive an application’s control-flow graph (CFG) prior to execution, and then monitor indirect branches to ensure that the control flows follow a legitimate path of the CFG Shadow stack is a run-time mechanism for checking that functions return to their caller In this way, the control flows between loop gadget and functional gadgets strictly follow the process of call-retpairing
  5. 0x200位置的值從0開始加1加到等於2, bypass spin1 loop
  6. 透過修改filename指標,輸出就會不一樣,但執行相同程式碼
  7. 圖中 assignment: 對兩個記憶體位置(srv->typ = *type => *(srv+8) = *type )做assignment addition: EX: 對兩個記憶體做相加存智其中一個位置
  8. selector * FSM’s Read head (上圖的*type) * Link gadgets (上述兩項,用memory corrupt達成) 補充Link gadgets : Addresses of load/store micro-operations are corruptible by mem-err to meet that gadget I‘’s output and gadget i+1’s input have same address. 除了這個也可以 兩個gadget想要link中間塞個 assignment gadget 讓that gadget I‘’s output and gadget i+1’s input有不同的位置但值一樣。 => Each iteration executes a subset of gadgets using outputs from gadgets in the previous iteration. To direct the outputs of one gadget in iteration i into the inputs to a gadget in iteration i+1, the selector changes the load address of iteration i+1 to the store addresses of iteration i. The selector’s behavior is controlled by attackers through the memory error. The selector on line 7(p.19 code) is the memory error itself, which repeatedly corrupts the local variables to setup the execution of gadgets in that iteration. The corruption is done in a way that it enables only the gadgets of the attacker’s choice. These gadgets take as input the outputs of the previous round’s gadget by selectively corrupting operand pointers. The remaining gadgets may still get executed, but their inputs and outputs are set up such that they behave like NOPs (operating on unused memory locations). 灰色gadget。