SlideShare a Scribd company logo
1 of 65
Download to read offline
How to find the vulnerability to
bypass the Control Flow Guard
Henry Li(@zenhumany)
About me
•  Trend Micro CDC Zeroday discovery Team
•  Security Researcher
•  Six Years Experience
•  Expert in browser 0day vulnerability analysis,
discovery and exploit.
•  Won the Microsoft Mitigation Bypass Bounty
in 2016
•  Won the Microsoft Edge Web Platform on
WIP Bounty
•  MSRC Top 17 in year 2016
•  twitter/weibo: zenhumany
Why we need CFG bypass vulnerability
• Even your have arbitrary read/write vulnerability, you
need bypass CFG to run shellcode
• No universal CFG bypass method
Why we need CFG bypass vulnerability
• Attack Surface
• Find vulnerability
• Exploit Framework
• Improvements
Agenda
• CFG attribute Change Functions
• write return address
• No Control Flow Guard check
• CFG sensitive API
Attack Surface
Attack Surface 1
• CFG ATTRIBUTE CHANGE FUNCTIONS
• VirtualAlloc
• VirtualProtect
• SetProcessValidCallTargets
Attack Surface 1
• VirtualProtect
•  flNewProtect 0x40
•  Memory Protection PAGE_EXECUTE_READWRITE
•  The address in the pages are all CFG valid
•  flNewProtect 0x40000040
•  Memory Protection PAGE_EXECUTE_READWRITE
•  The address in the pages are all CFG invalid
• VirtualAlloc
•  flProtect 0x40
•  Memory Protection PAGE_EXECUTE_READWRITE
•  The address in the pages are all CFG valid
•  flProtect 0x40000040
•  Memory Protection PAGE_EXECUTE_READWRITE
•  The address in the pages are all CFG invalid
VirtualProtect-VirtualAlloc
• SetProcessValidCallTargets
• Flags
• CFG_CALL_TARGET_VALID
• Otherwise, it will be marked as invalid
SetProcessValidCallTargets
Chakra Engine Architecture
JIT Memory Management
• In Microsoft Edge, there are two types of JIT:
•  javascript JIT, in the chakra.dll Module.
•  SHADER JIT, in the d3d10warp.dll Module.
Attack Surface 1
• Because the CFG does not check the ret, we can write
the return address to bypass the CFG.
• In chakra engine, the interpreting execution mode will
simulate a function call stack. The implementation will
save some stackframe information on a special object in
the heap.
• If we have arbitrary read and write vulnerability, we may
can infoleak some stack information.
Attack Surface 2
write the return address
Interpreter StackFrame
• JIT code is implemented in the runtime.
• The CFG support in JIT may be manual
maintenance.
• Pay attention to the JIT code to find indirect call
with no CFG check.
Attack Surface 3
Indirect call with no CFG check
• Use these function to bypass CFG
• VirtualProtect
• VirtualAlloc
• longjmp/setjmp
• ……
Attack Surface 4
CFG Sensitive API
•  Six CFG bypass vulnerabilities
Notes:
All of the following bypass vulnerabilities suppose you have
arbitrary read/write vulnerability
Find Vulnerability
• eshims!VirtualProtect to bypass CFG and DEP
• Vuln Type: Call Sensitive API out of context
• Module: Eshims
• Operation System: Windows 10 14367 32 bit
• BYPASS CFG/DEP
Vuln 1
• eshims.dll is a module in Microsoft Edge
• eshims have following hook functios,the functions
are CFG valid.
Vuln 1
Vuln 1
Vuln 1: Exploit Method
• CodeStorageBlock::Protect function to bypass CFG
and DEP
• Vuln Type:Call Sensitive API out of context
• Module: D3D10Warp.dll
• Operation System: Windows 10 14393.5 32 bit
• BYPASS CFG/DEP
Vuln 2
CodeStorageBlock(0x38)
0x00 pVtable
0x04 pCodeStorage
0x08 begianAddressofCodeStorageSection
0x30 pSectionCount
•  CodeStorageBlock::Protect is CFG valid
CodeStorageSection(0x18)
0x00 pCodeStorageChunk
0x04 pPrevCodeStorageSection
0x08 pNextCodeStorageSection
0x0c baseAddress
0x10 size
0x14 flag_busy :byte
Vuln 2
Vuln 2
Vuln 3 Vuln 2
Vuln 2:Exploit Method
• Use InterpreterThunkEmitter to bypass CFG
• Vuln Type: No Control Flow Guard check
• Module: chakra.dll
• Operation System: Windows 10 14328 32 bit
• Bypass CFG
Vuln 3
Vuln 3:Js Function Interpreting Execute
Vuln 3: InterpreterThunkEmitter
Vuln 3
•  BYTE* InterpreterThunkEmitter::GetNextThunk(PVOID*
ppDynamicInterpreterThunk)
•  {
•  Assert(ppDynamicInterpreterThunk);
•  Assert(*ppDynamicInterpreterThunk == nullptr);
• 
•  if(thunkCount == 0)
•  {
•  if(!this->freeListedThunkBlocks.Empty())
•  {
•  return AllocateFromFreeList(ppDynamicInterpreterThunk);
•  }
•  NewThunkBlock();
•  }
BYTE* InterpreterThunkEmitter::GetNextThunk(PVOID* ppDynamicInterpreterThunk)
{
Assert(ppDynamicInterpreterThunk);
Assert(*ppDynamicInterpreterThunk == nullptr);
if(thunkCount == 0)
{
if(!this->freeListedThunkBlocks.Empty())
{
return AllocateFromFreeList(ppDynamicInterpreterThunk);
}
NewThunkBlock();
}
Vuln 3
const BYTE InterpreterThunkEmitter::InterpreterThunk[] = {
0x55, // push ebp ;Prolog - setup the stack frame
0x8B, 0xEC, // mov ebp,esp
0x8B, 0x45, 0x08, // mov eax, dword ptr [ebp+8]
0x8B, 0x40, 0x00, // mov eax, dword ptr [eax+FunctionBodyOffset]
0x8B, 0x48, 0x00, // mov ecx, dword ptr [eax+DynamicThunkAddressOffset]
// Range Check for Valid call target
0x83, 0xE1, 0xF8, // and ecx, 0FFFFFFF8h
0x8b, 0xc1, // mov eax, ecx
0x2d, 0x00, 0x00, 0x00, 0x00, // sub eax, CallBlockStartAddress
0x3d, 0x00, 0x00, 0x00, 0x00, // cmp eax, ThunkSize
0x76, 0x07, // jbe SHORT $safe
0xb9, 0x00, 0x00, 0x00, 0x00, // mov ecx, errorcode
0xCD, 0x29, // int 29h
//$safe
0x8D, 0x45, 0x08, // lea eax, ebp+8
0x50, // push eax
0xB8, 0x00, 0x00, 0x00, 0x00, // mov eax, <thunk>//static InterpreterThunk address
0xFF, 0xE1, // jmp ecx
0xCC // int 3 for 8byte alignment
Vuln 3:Set Dynamic InterpreterThunk Address
Vuln 3:Dynamic InterpreterThunk
Vuln 3: Exploit
Vuln 4
• Write the return address to bypass CFG and DEP
• Vuln Type: write return address
• Module: chakra.dll
• Operation System: Windows 10 14352 32 bit
• BYPASS CFG/RFG
Vuln 4
Vuln 4
Vuln 4
Vuln 4
• InterpreterHelper will call following function
Vuln 4
Vuln 4
• InterpreterStackFrame
• 0x48 addressOfReturnAddress
Vuln 4
Vuln 4: ExploitVuln 4: Exploit Method
• Use Chakra Recycler Memory pageheap to bypass
DEP and CFG
• Vuln type: Data Only Attack
• Module: chakra.dll
• Operation System: Windows 10 14328 32 bit
• BYPASS CFG/DEP
Vuln 5
Vuln 5
Vuln 5
Vuln 5 Vuln 5
Vuln 5
Vuln 5
Vuln 5: Exploit
Vuln 5:Exploit Method
Vuln 6
• Use JIT PAGE to bypass CFG and DEP
• Vuln Type: Data Only Attack
• Module: chakra.dll
• Operation System: Windows 10 14361 32 bit
• BYPASS CFG/DEP
Vuln 6
Vuln 6
Vuln 6
Vuln 6
Vuln 6
Vuln 6:Exploit
Vuln 6:Exploit Method
Vuln 6:Exploit
Vuln 6:Exploit Method
•  Write Return Address
•  VirtualAlloc/VirtualProtect
Exploit Framework
Exploit Vuln 4:Get addressofReturnAddress
Exploit Vuln 4
What to write in the
addressOfReturnAddress?
Shellcode
address?
Stack pivot
address
xchg eax,esp
Interpreter CallStack
Construct a function, I call it StackPivot,do two things:
I. write the stack pivot gadget address to the return address
II.Return shellcode_address/2
function stackpivot_func( )
{
//write the return address is the stack_pivot
return shellcode_address/2;
}
Exploit Vuln 4:stackpivot function
• The representation of an integer in memory(on x86)
• In chakra engine, script defined an integer is m, in
memory it’s 2*m + 1
Exploit Vuln 4:stackpivot function
Exploit Vuln 4: Stackpivot function
Exploit Vuln 4: Stackpivot function
BYPASS RFG
•  InterpreterStackFrame::InterpreterThunk
•  eax, rax save the return value.
BYPASS RFG
VirtualAlloc/VirtualProtect Exploit
• Addressing CFG coverage gaps
• Disable RtlRemoteCall when CFG is enabled
• compiler directive: __declspec(guard(suppress))
• Setjmp/Longjmp hardening
• Arbitrary Code Guard
Improvements
• Not for CFG, actual effect on CFG have a great impact
• Prohibited to modified PAGE_EXECUTE to
PAGE_EXECUTE_READWRITE
• Prohibited to modified PAGE_READWRITE to
PAGE_EXECUTE_READWRITE
• Kill using Virtualalloc/VirtualProtect methods to bypass
CFG.
Arbitrary Code Guard
• Bypass that rely on modifying or corrupting read-
only memory
• _guard_check_icall_fptr
• write return address( RFG not enabled)
• CFG friendly API which is CFG valid
• Data Only Attack
Exist Attack Surface
•  Jack Tang : Co-found MSRC 33966
•  Kai Yu
Acknowledgement
references
•  Yunhai Zhang How To Avoid Implement An Exploit Friendly JIT
•  David Weston、Matt Miller
Windows 10 Mitigation Improvements
•  Henry Li
Control Flow Guard Improvements in Windows 10 Anniversary
Update

More Related Content

What's hot

You didnt see it’s coming? "Dawn of hardened Windows Kernel"
You didnt see it’s coming? "Dawn of hardened Windows Kernel" You didnt see it’s coming? "Dawn of hardened Windows Kernel"
You didnt see it’s coming? "Dawn of hardened Windows Kernel"
Peter Hlavaty
 
Self Introduction & The Story that I Tried to Make Sayonara ROP Chain in Linux
Self Introduction & The Story that I Tried to Make Sayonara ROP Chain in LinuxSelf Introduction & The Story that I Tried to Make Sayonara ROP Chain in Linux
Self Introduction & The Story that I Tried to Make Sayonara ROP Chain in Linux
inaz2
 
The Art of Exploiting Unconventional Use-after-free Bugs in Android Kernel by...
The Art of Exploiting Unconventional Use-after-free Bugs in Android Kernel by...The Art of Exploiting Unconventional Use-after-free Bugs in Android Kernel by...
The Art of Exploiting Unconventional Use-after-free Bugs in Android Kernel by...
CODE BLUE
 
Possibility of arbitrary code execution by Step-Oriented Programming
Possibility of arbitrary code execution by Step-Oriented ProgrammingPossibility of arbitrary code execution by Step-Oriented Programming
Possibility of arbitrary code execution by Step-Oriented Programming
kozossakai
 

What's hot (20)

Security research over Windows #defcon china
Security research over Windows #defcon chinaSecurity research over Windows #defcon china
Security research over Windows #defcon china
 
DeathNote of Microsoft Windows Kernel
DeathNote of Microsoft Windows KernelDeathNote of Microsoft Windows Kernel
DeathNote of Microsoft Windows Kernel
 
Abusing Interrupts for Reliable Windows Kernel Exploitation (en)
Abusing Interrupts for Reliable Windows Kernel Exploitation (en)Abusing Interrupts for Reliable Windows Kernel Exploitation (en)
Abusing Interrupts for Reliable Windows Kernel Exploitation (en)
 
You didnt see it’s coming? "Dawn of hardened Windows Kernel"
You didnt see it’s coming? "Dawn of hardened Windows Kernel" You didnt see it’s coming? "Dawn of hardened Windows Kernel"
You didnt see it’s coming? "Dawn of hardened Windows Kernel"
 
Practical Windows Kernel Exploitation
Practical Windows Kernel ExploitationPractical Windows Kernel Exploitation
Practical Windows Kernel Exploitation
 
Us 16-subverting apple-graphics_practical_approaches_to_remotely_gaining_root...
Us 16-subverting apple-graphics_practical_approaches_to_remotely_gaining_root...Us 16-subverting apple-graphics_practical_approaches_to_remotely_gaining_root...
Us 16-subverting apple-graphics_practical_approaches_to_remotely_gaining_root...
 
Self Introduction & The Story that I Tried to Make Sayonara ROP Chain in Linux
Self Introduction & The Story that I Tried to Make Sayonara ROP Chain in LinuxSelf Introduction & The Story that I Tried to Make Sayonara ROP Chain in Linux
Self Introduction & The Story that I Tried to Make Sayonara ROP Chain in Linux
 
50 Shades of Fuzzing by Peter Hlavaty & Marco Grassi
50 Shades of Fuzzing by Peter Hlavaty & Marco Grassi50 Shades of Fuzzing by Peter Hlavaty & Marco Grassi
50 Shades of Fuzzing by Peter Hlavaty & Marco Grassi
 
syzbot and the tale of million kernel bugs
syzbot and the tale of million kernel bugssyzbot and the tale of million kernel bugs
syzbot and the tale of million kernel bugs
 
Injection on Steroids: Codeless code injection and 0-day techniques
Injection on Steroids: Codeless code injection and 0-day techniquesInjection on Steroids: Codeless code injection and 0-day techniques
Injection on Steroids: Codeless code injection and 0-day techniques
 
Rainbow Over the Windows: More Colors Than You Could Expect
Rainbow Over the Windows: More Colors Than You Could ExpectRainbow Over the Windows: More Colors Than You Could Expect
Rainbow Over the Windows: More Colors Than You Could Expect
 
Introduction of ShinoBOT (Black Hat USA 2013 Arsenal)
Introduction of ShinoBOT (Black Hat USA 2013 Arsenal)Introduction of ShinoBOT (Black Hat USA 2013 Arsenal)
Introduction of ShinoBOT (Black Hat USA 2013 Arsenal)
 
The Art of Exploiting Unconventional Use-after-free Bugs in Android Kernel by...
The Art of Exploiting Unconventional Use-after-free Bugs in Android Kernel by...The Art of Exploiting Unconventional Use-after-free Bugs in Android Kernel by...
The Art of Exploiting Unconventional Use-after-free Bugs in Android Kernel by...
 
08 - Return Oriented Programming, the chosen one
08 - Return Oriented Programming, the chosen one08 - Return Oriented Programming, the chosen one
08 - Return Oriented Programming, the chosen one
 
Bypassing patchguard on Windows 8.1 and Windows 10
Bypassing patchguard on Windows 8.1 and Windows 10Bypassing patchguard on Windows 8.1 and Windows 10
Bypassing patchguard on Windows 8.1 and Windows 10
 
BSides LV 2016 - Beyond the tip of the iceberg - fuzzing binary protocols for...
BSides LV 2016 - Beyond the tip of the iceberg - fuzzing binary protocols for...BSides LV 2016 - Beyond the tip of the iceberg - fuzzing binary protocols for...
BSides LV 2016 - Beyond the tip of the iceberg - fuzzing binary protocols for...
 
Статический анализ кода в контексте SSDL
Статический анализ кода в контексте SSDLСтатический анализ кода в контексте SSDL
Статический анализ кода в контексте SSDL
 
[Blackhat EU'14] Attacking the Linux PRNG on Android and Embedded Devices
[Blackhat EU'14] Attacking the Linux PRNG on Android and Embedded Devices[Blackhat EU'14] Attacking the Linux PRNG on Android and Embedded Devices
[Blackhat EU'14] Attacking the Linux PRNG on Android and Embedded Devices
 
Possibility of arbitrary code execution by Step-Oriented Programming
Possibility of arbitrary code execution by Step-Oriented ProgrammingPossibility of arbitrary code execution by Step-Oriented Programming
Possibility of arbitrary code execution by Step-Oriented Programming
 
Back to the CORE
Back to the COREBack to the CORE
Back to the CORE
 

Viewers also liked

CSW2017 Qinghao tang+Xinlei ying vmware_escape_final
CSW2017 Qinghao tang+Xinlei ying vmware_escape_finalCSW2017 Qinghao tang+Xinlei ying vmware_escape_final
CSW2017 Qinghao tang+Xinlei ying vmware_escape_final
CanSecWest
 
CSW2017 Weston miller csw17_mitigating_native_remote_code_execution
CSW2017 Weston miller csw17_mitigating_native_remote_code_executionCSW2017 Weston miller csw17_mitigating_native_remote_code_execution
CSW2017 Weston miller csw17_mitigating_native_remote_code_execution
CanSecWest
 
CSW2017 Kyle ehmke lots of squats- ap-ts never miss leg day
CSW2017 Kyle ehmke lots of squats- ap-ts never miss leg dayCSW2017 Kyle ehmke lots of squats- ap-ts never miss leg day
CSW2017 Kyle ehmke lots of squats- ap-ts never miss leg day
CanSecWest
 
CSW2017 Peng qiu+shefang-zhong win32k -dark_composition_finnal_finnal_rm_mark
CSW2017 Peng qiu+shefang-zhong win32k -dark_composition_finnal_finnal_rm_markCSW2017 Peng qiu+shefang-zhong win32k -dark_composition_finnal_finnal_rm_mark
CSW2017 Peng qiu+shefang-zhong win32k -dark_composition_finnal_finnal_rm_mark
CanSecWest
 
CSW2017 Yuhao song+Huimingliu cyber_wmd_vulnerable_IoT
CSW2017 Yuhao song+Huimingliu cyber_wmd_vulnerable_IoTCSW2017 Yuhao song+Huimingliu cyber_wmd_vulnerable_IoT
CSW2017 Yuhao song+Huimingliu cyber_wmd_vulnerable_IoT
CanSecWest
 
CSW2017 Enrico branca What if encrypted communications are not as secure as w...
CSW2017 Enrico branca What if encrypted communications are not as secure as w...CSW2017 Enrico branca What if encrypted communications are not as secure as w...
CSW2017 Enrico branca What if encrypted communications are not as secure as w...
CanSecWest
 
CSW2017 Privilege escalation on high-end servers due to implementation gaps i...
CSW2017 Privilege escalation on high-end servers due to implementation gaps i...CSW2017 Privilege escalation on high-end servers due to implementation gaps i...
CSW2017 Privilege escalation on high-end servers due to implementation gaps i...
CanSecWest
 
CSW2017 Minrui yan+Jianhao-liu a visualization tool for evaluating can-bus cy...
CSW2017 Minrui yan+Jianhao-liu a visualization tool for evaluating can-bus cy...CSW2017 Minrui yan+Jianhao-liu a visualization tool for evaluating can-bus cy...
CSW2017 Minrui yan+Jianhao-liu a visualization tool for evaluating can-bus cy...
CanSecWest
 
CSW2017 Mickey+maggie low cost radio attacks on modern platforms
CSW2017 Mickey+maggie low cost radio attacks on modern platformsCSW2017 Mickey+maggie low cost radio attacks on modern platforms
CSW2017 Mickey+maggie low cost radio attacks on modern platforms
CanSecWest
 
CSW2017 Qidan he+Gengming liu_cansecwest2017
CSW2017 Qidan he+Gengming liu_cansecwest2017CSW2017 Qidan he+Gengming liu_cansecwest2017
CSW2017 Qidan he+Gengming liu_cansecwest2017
CanSecWest
 
Csw2016 chen grassi-he-apple_graphics_is_compromised
Csw2016 chen grassi-he-apple_graphics_is_compromisedCsw2016 chen grassi-he-apple_graphics_is_compromised
Csw2016 chen grassi-he-apple_graphics_is_compromised
CanSecWest
 
Csw2016 freingruber bypassing_application_whitelisting
Csw2016 freingruber bypassing_application_whitelistingCsw2016 freingruber bypassing_application_whitelisting
Csw2016 freingruber bypassing_application_whitelisting
CanSecWest
 
CSW2017 Saumil shah stegosploit_internals_cansecwest_2017
CSW2017 Saumil shah stegosploit_internals_cansecwest_2017CSW2017 Saumil shah stegosploit_internals_cansecwest_2017
CSW2017 Saumil shah stegosploit_internals_cansecwest_2017
CanSecWest
 
Csw2016 tang virtualization_device emulator testing technology
Csw2016 tang virtualization_device emulator testing technologyCsw2016 tang virtualization_device emulator testing technology
Csw2016 tang virtualization_device emulator testing technology
CanSecWest
 
CSW2017 chuanda ding_state of windows application security
CSW2017 chuanda ding_state of windows application securityCSW2017 chuanda ding_state of windows application security
CSW2017 chuanda ding_state of windows application security
CanSecWest
 

Viewers also liked (20)

CSW2017 Qinghao tang+Xinlei ying vmware_escape_final
CSW2017 Qinghao tang+Xinlei ying vmware_escape_finalCSW2017 Qinghao tang+Xinlei ying vmware_escape_final
CSW2017 Qinghao tang+Xinlei ying vmware_escape_final
 
CSW2017 Weston miller csw17_mitigating_native_remote_code_execution
CSW2017 Weston miller csw17_mitigating_native_remote_code_executionCSW2017 Weston miller csw17_mitigating_native_remote_code_execution
CSW2017 Weston miller csw17_mitigating_native_remote_code_execution
 
CSW2017 Kyle ehmke lots of squats- ap-ts never miss leg day
CSW2017 Kyle ehmke lots of squats- ap-ts never miss leg dayCSW2017 Kyle ehmke lots of squats- ap-ts never miss leg day
CSW2017 Kyle ehmke lots of squats- ap-ts never miss leg day
 
CSW2017 Peng qiu+shefang-zhong win32k -dark_composition_finnal_finnal_rm_mark
CSW2017 Peng qiu+shefang-zhong win32k -dark_composition_finnal_finnal_rm_markCSW2017 Peng qiu+shefang-zhong win32k -dark_composition_finnal_finnal_rm_mark
CSW2017 Peng qiu+shefang-zhong win32k -dark_composition_finnal_finnal_rm_mark
 
CSW2017 Harri hursti csw17 final
CSW2017 Harri hursti csw17 finalCSW2017 Harri hursti csw17 final
CSW2017 Harri hursti csw17 final
 
CSW2017 Yuhao song+Huimingliu cyber_wmd_vulnerable_IoT
CSW2017 Yuhao song+Huimingliu cyber_wmd_vulnerable_IoTCSW2017 Yuhao song+Huimingliu cyber_wmd_vulnerable_IoT
CSW2017 Yuhao song+Huimingliu cyber_wmd_vulnerable_IoT
 
CSW2017 Enrico branca What if encrypted communications are not as secure as w...
CSW2017 Enrico branca What if encrypted communications are not as secure as w...CSW2017 Enrico branca What if encrypted communications are not as secure as w...
CSW2017 Enrico branca What if encrypted communications are not as secure as w...
 
CSW2017 Privilege escalation on high-end servers due to implementation gaps i...
CSW2017 Privilege escalation on high-end servers due to implementation gaps i...CSW2017 Privilege escalation on high-end servers due to implementation gaps i...
CSW2017 Privilege escalation on high-end servers due to implementation gaps i...
 
CSW2017 Minrui yan+Jianhao-liu a visualization tool for evaluating can-bus cy...
CSW2017 Minrui yan+Jianhao-liu a visualization tool for evaluating can-bus cy...CSW2017 Minrui yan+Jianhao-liu a visualization tool for evaluating can-bus cy...
CSW2017 Minrui yan+Jianhao-liu a visualization tool for evaluating can-bus cy...
 
CSW2017 Scott kelly secureboot-csw2017-v1
CSW2017 Scott kelly secureboot-csw2017-v1CSW2017 Scott kelly secureboot-csw2017-v1
CSW2017 Scott kelly secureboot-csw2017-v1
 
CSW2017 Mickey+maggie low cost radio attacks on modern platforms
CSW2017 Mickey+maggie low cost radio attacks on modern platformsCSW2017 Mickey+maggie low cost radio attacks on modern platforms
CSW2017 Mickey+maggie low cost radio attacks on modern platforms
 
CSW2017 Qidan he+Gengming liu_cansecwest2017
CSW2017 Qidan he+Gengming liu_cansecwest2017CSW2017 Qidan he+Gengming liu_cansecwest2017
CSW2017 Qidan he+Gengming liu_cansecwest2017
 
Csw2016 chen grassi-he-apple_graphics_is_compromised
Csw2016 chen grassi-he-apple_graphics_is_compromisedCsw2016 chen grassi-he-apple_graphics_is_compromised
Csw2016 chen grassi-he-apple_graphics_is_compromised
 
Csw2016 freingruber bypassing_application_whitelisting
Csw2016 freingruber bypassing_application_whitelistingCsw2016 freingruber bypassing_application_whitelisting
Csw2016 freingruber bypassing_application_whitelisting
 
CSW2017 Saumil shah stegosploit_internals_cansecwest_2017
CSW2017 Saumil shah stegosploit_internals_cansecwest_2017CSW2017 Saumil shah stegosploit_internals_cansecwest_2017
CSW2017 Saumil shah stegosploit_internals_cansecwest_2017
 
Csw2016 song li-smart_wars
Csw2016 song li-smart_warsCsw2016 song li-smart_wars
Csw2016 song li-smart_wars
 
CSW2017 jun li_car anomaly detection
CSW2017  jun li_car anomaly detectionCSW2017  jun li_car anomaly detection
CSW2017 jun li_car anomaly detection
 
Csw2016 tang virtualization_device emulator testing technology
Csw2016 tang virtualization_device emulator testing technologyCsw2016 tang virtualization_device emulator testing technology
Csw2016 tang virtualization_device emulator testing technology
 
CSW2017 chuanda ding_state of windows application security
CSW2017 chuanda ding_state of windows application securityCSW2017 chuanda ding_state of windows application security
CSW2017 chuanda ding_state of windows application security
 
Csw2016 macaulay eh_trace-rop_hooks
Csw2016 macaulay eh_trace-rop_hooksCsw2016 macaulay eh_trace-rop_hooks
Csw2016 macaulay eh_trace-rop_hooks
 

Similar to CSW2017 Henry li how to find the vulnerability to bypass the control flow guard final

Crash dump analysis - experience sharing
Crash dump analysis - experience sharingCrash dump analysis - experience sharing
Crash dump analysis - experience sharing
James Hsieh
 
Разработка кросс-платформенного кода между iPhone &lt; -> Windows с помощью o...
Разработка кросс-платформенного кода между iPhone &lt; -> Windows с помощью o...Разработка кросс-платформенного кода между iPhone &lt; -> Windows с помощью o...
Разработка кросс-платформенного кода между iPhone &lt; -> Windows с помощью o...
Yandex
 

Similar to CSW2017 Henry li how to find the vulnerability to bypass the control flow guard final (20)

Handling Exceptions In C &amp; C++ [Part B] Ver 2
Handling Exceptions In C &amp; C++ [Part B] Ver 2Handling Exceptions In C &amp; C++ [Part B] Ver 2
Handling Exceptions In C &amp; C++ [Part B] Ver 2
 
Defcon 27 - Writing custom backdoor payloads with C#
Defcon 27 - Writing custom backdoor payloads with C#Defcon 27 - Writing custom backdoor payloads with C#
Defcon 27 - Writing custom backdoor payloads with C#
 
Linux kernel tracing superpowers in the cloud
Linux kernel tracing superpowers in the cloudLinux kernel tracing superpowers in the cloud
Linux kernel tracing superpowers in the cloud
 
JVM Mechanics: When Does the JVM JIT & Deoptimize?
JVM Mechanics: When Does the JVM JIT & Deoptimize?JVM Mechanics: When Does the JVM JIT & Deoptimize?
JVM Mechanics: When Does the JVM JIT & Deoptimize?
 
Valgrind
ValgrindValgrind
Valgrind
 
Code quality par Simone Civetta
Code quality par Simone CivettaCode quality par Simone Civetta
Code quality par Simone Civetta
 
Code lifecycle in the jvm - TopConf Linz
Code lifecycle in the jvm - TopConf LinzCode lifecycle in the jvm - TopConf Linz
Code lifecycle in the jvm - TopConf Linz
 
Silicon Valley JUG: JVM Mechanics
Silicon Valley JUG: JVM MechanicsSilicon Valley JUG: JVM Mechanics
Silicon Valley JUG: JVM Mechanics
 
DEF CON 27 - workshop - MAURICIO VELAZCO - writing custom paylods
DEF CON 27 - workshop - MAURICIO VELAZCO - writing  custom paylodsDEF CON 27 - workshop - MAURICIO VELAZCO - writing  custom paylods
DEF CON 27 - workshop - MAURICIO VELAZCO - writing custom paylods
 
Cansecwest_16_Dont_Trust_Your_Eye_Apple_Graphics_Is_Compromised
Cansecwest_16_Dont_Trust_Your_Eye_Apple_Graphics_Is_CompromisedCansecwest_16_Dont_Trust_Your_Eye_Apple_Graphics_Is_Compromised
Cansecwest_16_Dont_Trust_Your_Eye_Apple_Graphics_Is_Compromised
 
Practical IoT Exploitation (DEFCON23 IoTVillage) - Lyon Yang
Practical IoT Exploitation (DEFCON23 IoTVillage) - Lyon YangPractical IoT Exploitation (DEFCON23 IoTVillage) - Lyon Yang
Practical IoT Exploitation (DEFCON23 IoTVillage) - Lyon Yang
 
NSC #2 - D3 02 - Peter Hlavaty - Attack on the Core
NSC #2 - D3 02 - Peter Hlavaty - Attack on the CoreNSC #2 - D3 02 - Peter Hlavaty - Attack on the Core
NSC #2 - D3 02 - Peter Hlavaty - Attack on the Core
 
Implementing New Web
Implementing New WebImplementing New Web
Implementing New Web
 
Implementing new WebAPIs
Implementing new WebAPIsImplementing new WebAPIs
Implementing new WebAPIs
 
[若渴計畫] 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
 
Crash dump analysis - experience sharing
Crash dump analysis - experience sharingCrash dump analysis - experience sharing
Crash dump analysis - experience sharing
 
Frameworkless CLI app in PHP
Frameworkless CLI app in PHPFrameworkless CLI app in PHP
Frameworkless CLI app in PHP
 
LCA14: LCA14-412: GPGPU on ARM SoC session
LCA14: LCA14-412: GPGPU on ARM SoC sessionLCA14: LCA14-412: GPGPU on ARM SoC session
LCA14: LCA14-412: GPGPU on ARM SoC session
 
Разработка кросс-платформенного кода между iPhone &lt; -> Windows с помощью o...
Разработка кросс-платформенного кода между iPhone &lt; -> Windows с помощью o...Разработка кросс-платформенного кода между iPhone &lt; -> Windows с помощью o...
Разработка кросс-платформенного кода между iPhone &lt; -> Windows с помощью o...
 
Ob1k presentation at Java.IL
Ob1k presentation at Java.ILOb1k presentation at Java.IL
Ob1k presentation at Java.IL
 

More from CanSecWest

Csw2017 bazhaniuk exploring_yoursystemdeeper_updated
Csw2017 bazhaniuk exploring_yoursystemdeeper_updatedCsw2017 bazhaniuk exploring_yoursystemdeeper_updated
Csw2017 bazhaniuk exploring_yoursystemdeeper_updated
CanSecWest
 
CSW2017 Geshev+Miller logic bug hunting in chrome on android
CSW2017 Geshev+Miller logic bug hunting in chrome on androidCSW2017 Geshev+Miller logic bug hunting in chrome on android
CSW2017 Geshev+Miller logic bug hunting in chrome on android
CanSecWest
 
CSW2017Richard Johnson_harnessing intel processor trace on windows for vulner...
CSW2017Richard Johnson_harnessing intel processor trace on windows for vulner...CSW2017Richard Johnson_harnessing intel processor trace on windows for vulner...
CSW2017Richard Johnson_harnessing intel processor trace on windows for vulner...
CanSecWest
 
Csw2016 gawlik bypassing_differentdefenseschemes
Csw2016 gawlik bypassing_differentdefenseschemesCsw2016 gawlik bypassing_differentdefenseschemes
Csw2016 gawlik bypassing_differentdefenseschemes
CanSecWest
 
Csw2016 gong pwn_a_nexus_device_with_a_single_vulnerability
Csw2016 gong pwn_a_nexus_device_with_a_single_vulnerabilityCsw2016 gong pwn_a_nexus_device_with_a_single_vulnerability
Csw2016 gong pwn_a_nexus_device_with_a_single_vulnerability
CanSecWest
 
Csw2016 wheeler barksdale-gruskovnjak-execute_mypacket
Csw2016 wheeler barksdale-gruskovnjak-execute_mypacketCsw2016 wheeler barksdale-gruskovnjak-execute_mypacket
Csw2016 wheeler barksdale-gruskovnjak-execute_mypacket
CanSecWest
 

More from CanSecWest (7)

Csw2017 bazhaniuk exploring_yoursystemdeeper_updated
Csw2017 bazhaniuk exploring_yoursystemdeeper_updatedCsw2017 bazhaniuk exploring_yoursystemdeeper_updated
Csw2017 bazhaniuk exploring_yoursystemdeeper_updated
 
CSW2017 Geshev+Miller logic bug hunting in chrome on android
CSW2017 Geshev+Miller logic bug hunting in chrome on androidCSW2017 Geshev+Miller logic bug hunting in chrome on android
CSW2017 Geshev+Miller logic bug hunting in chrome on android
 
CSW2017Richard Johnson_harnessing intel processor trace on windows for vulner...
CSW2017Richard Johnson_harnessing intel processor trace on windows for vulner...CSW2017Richard Johnson_harnessing intel processor trace on windows for vulner...
CSW2017Richard Johnson_harnessing intel processor trace on windows for vulner...
 
Csw2016 gawlik bypassing_differentdefenseschemes
Csw2016 gawlik bypassing_differentdefenseschemesCsw2016 gawlik bypassing_differentdefenseschemes
Csw2016 gawlik bypassing_differentdefenseschemes
 
Csw2016 wang docker_escapetechnology
Csw2016 wang docker_escapetechnologyCsw2016 wang docker_escapetechnology
Csw2016 wang docker_escapetechnology
 
Csw2016 gong pwn_a_nexus_device_with_a_single_vulnerability
Csw2016 gong pwn_a_nexus_device_with_a_single_vulnerabilityCsw2016 gong pwn_a_nexus_device_with_a_single_vulnerability
Csw2016 gong pwn_a_nexus_device_with_a_single_vulnerability
 
Csw2016 wheeler barksdale-gruskovnjak-execute_mypacket
Csw2016 wheeler barksdale-gruskovnjak-execute_mypacketCsw2016 wheeler barksdale-gruskovnjak-execute_mypacket
Csw2016 wheeler barksdale-gruskovnjak-execute_mypacket
 

Recently uploaded

VIP Call Girls Pollachi 7001035870 Whatsapp Number, 24/07 Booking
VIP Call Girls Pollachi 7001035870 Whatsapp Number, 24/07 BookingVIP Call Girls Pollachi 7001035870 Whatsapp Number, 24/07 Booking
VIP Call Girls Pollachi 7001035870 Whatsapp Number, 24/07 Booking
dharasingh5698
 
valsad Escorts Service ☎️ 6378878445 ( Sakshi Sinha ) High Profile Call Girls...
valsad Escorts Service ☎️ 6378878445 ( Sakshi Sinha ) High Profile Call Girls...valsad Escorts Service ☎️ 6378878445 ( Sakshi Sinha ) High Profile Call Girls...
valsad Escorts Service ☎️ 6378878445 ( Sakshi Sinha ) High Profile Call Girls...
Call Girls In Delhi Whatsup 9873940964 Enjoy Unlimited Pleasure
 
VIP Call Girls Himatnagar 7001035870 Whatsapp Number, 24/07 Booking
VIP Call Girls Himatnagar 7001035870 Whatsapp Number, 24/07 BookingVIP Call Girls Himatnagar 7001035870 Whatsapp Number, 24/07 Booking
VIP Call Girls Himatnagar 7001035870 Whatsapp Number, 24/07 Booking
dharasingh5698
 
Low Sexy Call Girls In Mohali 9053900678 🥵Have Save And Good Place 🥵
Low Sexy Call Girls In Mohali 9053900678 🥵Have Save And Good Place 🥵Low Sexy Call Girls In Mohali 9053900678 🥵Have Save And Good Place 🥵
Low Sexy Call Girls In Mohali 9053900678 🥵Have Save And Good Place 🥵
Chandigarh Call girls 9053900678 Call girls in Chandigarh
 
在线制作约克大学毕业证(yu毕业证)在读证明认证可查
在线制作约克大学毕业证(yu毕业证)在读证明认证可查在线制作约克大学毕业证(yu毕业证)在读证明认证可查
在线制作约克大学毕业证(yu毕业证)在读证明认证可查
ydyuyu
 
Thalassery Escorts Service ☎️ 6378878445 ( Sakshi Sinha ) High Profile Call G...
Thalassery Escorts Service ☎️ 6378878445 ( Sakshi Sinha ) High Profile Call G...Thalassery Escorts Service ☎️ 6378878445 ( Sakshi Sinha ) High Profile Call G...
Thalassery Escorts Service ☎️ 6378878445 ( Sakshi Sinha ) High Profile Call G...
Call Girls In Delhi Whatsup 9873940964 Enjoy Unlimited Pleasure
 
📱Dehradun Call Girls Service 📱☎️ +91'905,3900,678 ☎️📱 Call Girls In Dehradun 📱
📱Dehradun Call Girls Service 📱☎️ +91'905,3900,678 ☎️📱 Call Girls In Dehradun 📱📱Dehradun Call Girls Service 📱☎️ +91'905,3900,678 ☎️📱 Call Girls In Dehradun 📱
📱Dehradun Call Girls Service 📱☎️ +91'905,3900,678 ☎️📱 Call Girls In Dehradun 📱
@Chandigarh #call #Girls 9053900678 @Call #Girls in @Punjab 9053900678
 
💚😋 Salem Escort Service Call Girls, 9352852248 ₹5000 To 25K With AC💚😋
💚😋 Salem Escort Service Call Girls, 9352852248 ₹5000 To 25K With AC💚😋💚😋 Salem Escort Service Call Girls, 9352852248 ₹5000 To 25K With AC💚😋
💚😋 Salem Escort Service Call Girls, 9352852248 ₹5000 To 25K With AC💚😋
nirzagarg
 

Recently uploaded (20)

VIP Call Girls Pollachi 7001035870 Whatsapp Number, 24/07 Booking
VIP Call Girls Pollachi 7001035870 Whatsapp Number, 24/07 BookingVIP Call Girls Pollachi 7001035870 Whatsapp Number, 24/07 Booking
VIP Call Girls Pollachi 7001035870 Whatsapp Number, 24/07 Booking
 
Dubai=Desi Dubai Call Girls O525547819 Outdoor Call Girls Dubai
Dubai=Desi Dubai Call Girls O525547819 Outdoor Call Girls DubaiDubai=Desi Dubai Call Girls O525547819 Outdoor Call Girls Dubai
Dubai=Desi Dubai Call Girls O525547819 Outdoor Call Girls Dubai
 
valsad Escorts Service ☎️ 6378878445 ( Sakshi Sinha ) High Profile Call Girls...
valsad Escorts Service ☎️ 6378878445 ( Sakshi Sinha ) High Profile Call Girls...valsad Escorts Service ☎️ 6378878445 ( Sakshi Sinha ) High Profile Call Girls...
valsad Escorts Service ☎️ 6378878445 ( Sakshi Sinha ) High Profile Call Girls...
 
20240507 QFM013 Machine Intelligence Reading List April 2024.pdf
20240507 QFM013 Machine Intelligence Reading List April 2024.pdf20240507 QFM013 Machine Intelligence Reading List April 2024.pdf
20240507 QFM013 Machine Intelligence Reading List April 2024.pdf
 
Ganeshkhind ! Call Girls Pune - 450+ Call Girl Cash Payment 8005736733 Neha T...
Ganeshkhind ! Call Girls Pune - 450+ Call Girl Cash Payment 8005736733 Neha T...Ganeshkhind ! Call Girls Pune - 450+ Call Girl Cash Payment 8005736733 Neha T...
Ganeshkhind ! Call Girls Pune - 450+ Call Girl Cash Payment 8005736733 Neha T...
 
VIP Model Call Girls NIBM ( Pune ) Call ON 8005736733 Starting From 5K to 25K...
VIP Model Call Girls NIBM ( Pune ) Call ON 8005736733 Starting From 5K to 25K...VIP Model Call Girls NIBM ( Pune ) Call ON 8005736733 Starting From 5K to 25K...
VIP Model Call Girls NIBM ( Pune ) Call ON 8005736733 Starting From 5K to 25K...
 
Microsoft Azure Arc Customer Deck Microsoft
Microsoft Azure Arc Customer Deck MicrosoftMicrosoft Azure Arc Customer Deck Microsoft
Microsoft Azure Arc Customer Deck Microsoft
 
"Boost Your Digital Presence: Partner with a Leading SEO Agency"
"Boost Your Digital Presence: Partner with a Leading SEO Agency""Boost Your Digital Presence: Partner with a Leading SEO Agency"
"Boost Your Digital Presence: Partner with a Leading SEO Agency"
 
VIP Call Girls Himatnagar 7001035870 Whatsapp Number, 24/07 Booking
VIP Call Girls Himatnagar 7001035870 Whatsapp Number, 24/07 BookingVIP Call Girls Himatnagar 7001035870 Whatsapp Number, 24/07 Booking
VIP Call Girls Himatnagar 7001035870 Whatsapp Number, 24/07 Booking
 
Low Sexy Call Girls In Mohali 9053900678 🥵Have Save And Good Place 🥵
Low Sexy Call Girls In Mohali 9053900678 🥵Have Save And Good Place 🥵Low Sexy Call Girls In Mohali 9053900678 🥵Have Save And Good Place 🥵
Low Sexy Call Girls In Mohali 9053900678 🥵Have Save And Good Place 🥵
 
VVIP Pune Call Girls Sinhagad WhatSapp Number 8005736733 With Elite Staff And...
VVIP Pune Call Girls Sinhagad WhatSapp Number 8005736733 With Elite Staff And...VVIP Pune Call Girls Sinhagad WhatSapp Number 8005736733 With Elite Staff And...
VVIP Pune Call Girls Sinhagad WhatSapp Number 8005736733 With Elite Staff And...
 
在线制作约克大学毕业证(yu毕业证)在读证明认证可查
在线制作约克大学毕业证(yu毕业证)在读证明认证可查在线制作约克大学毕业证(yu毕业证)在读证明认证可查
在线制作约克大学毕业证(yu毕业证)在读证明认证可查
 
WhatsApp 📞 8448380779 ✅Call Girls In Mamura Sector 66 ( Noida)
WhatsApp 📞 8448380779 ✅Call Girls In Mamura Sector 66 ( Noida)WhatsApp 📞 8448380779 ✅Call Girls In Mamura Sector 66 ( Noida)
WhatsApp 📞 8448380779 ✅Call Girls In Mamura Sector 66 ( Noida)
 
Thalassery Escorts Service ☎️ 6378878445 ( Sakshi Sinha ) High Profile Call G...
Thalassery Escorts Service ☎️ 6378878445 ( Sakshi Sinha ) High Profile Call G...Thalassery Escorts Service ☎️ 6378878445 ( Sakshi Sinha ) High Profile Call G...
Thalassery Escorts Service ☎️ 6378878445 ( Sakshi Sinha ) High Profile Call G...
 
𓀤Call On 7877925207 𓀤 Ahmedguda Call Girls Hot Model With Sexy Bhabi Ready Fo...
𓀤Call On 7877925207 𓀤 Ahmedguda Call Girls Hot Model With Sexy Bhabi Ready Fo...𓀤Call On 7877925207 𓀤 Ahmedguda Call Girls Hot Model With Sexy Bhabi Ready Fo...
𓀤Call On 7877925207 𓀤 Ahmedguda Call Girls Hot Model With Sexy Bhabi Ready Fo...
 
Trump Diapers Over Dems t shirts Sweatshirt
Trump Diapers Over Dems t shirts SweatshirtTrump Diapers Over Dems t shirts Sweatshirt
Trump Diapers Over Dems t shirts Sweatshirt
 
Russian Call Girls Pune (Adult Only) 8005736733 Escort Service 24x7 Cash Pay...
Russian Call Girls Pune  (Adult Only) 8005736733 Escort Service 24x7 Cash Pay...Russian Call Girls Pune  (Adult Only) 8005736733 Escort Service 24x7 Cash Pay...
Russian Call Girls Pune (Adult Only) 8005736733 Escort Service 24x7 Cash Pay...
 
📱Dehradun Call Girls Service 📱☎️ +91'905,3900,678 ☎️📱 Call Girls In Dehradun 📱
📱Dehradun Call Girls Service 📱☎️ +91'905,3900,678 ☎️📱 Call Girls In Dehradun 📱📱Dehradun Call Girls Service 📱☎️ +91'905,3900,678 ☎️📱 Call Girls In Dehradun 📱
📱Dehradun Call Girls Service 📱☎️ +91'905,3900,678 ☎️📱 Call Girls In Dehradun 📱
 
Call Girls Sangvi Call Me 7737669865 Budget Friendly No Advance BookingCall G...
Call Girls Sangvi Call Me 7737669865 Budget Friendly No Advance BookingCall G...Call Girls Sangvi Call Me 7737669865 Budget Friendly No Advance BookingCall G...
Call Girls Sangvi Call Me 7737669865 Budget Friendly No Advance BookingCall G...
 
💚😋 Salem Escort Service Call Girls, 9352852248 ₹5000 To 25K With AC💚😋
💚😋 Salem Escort Service Call Girls, 9352852248 ₹5000 To 25K With AC💚😋💚😋 Salem Escort Service Call Girls, 9352852248 ₹5000 To 25K With AC💚😋
💚😋 Salem Escort Service Call Girls, 9352852248 ₹5000 To 25K With AC💚😋
 

CSW2017 Henry li how to find the vulnerability to bypass the control flow guard final

  • 1. How to find the vulnerability to bypass the Control Flow Guard Henry Li(@zenhumany)
  • 2. About me •  Trend Micro CDC Zeroday discovery Team •  Security Researcher •  Six Years Experience •  Expert in browser 0day vulnerability analysis, discovery and exploit. •  Won the Microsoft Mitigation Bypass Bounty in 2016 •  Won the Microsoft Edge Web Platform on WIP Bounty •  MSRC Top 17 in year 2016 •  twitter/weibo: zenhumany
  • 3. Why we need CFG bypass vulnerability
  • 4. • Even your have arbitrary read/write vulnerability, you need bypass CFG to run shellcode • No universal CFG bypass method Why we need CFG bypass vulnerability
  • 6. • CFG attribute Change Functions • write return address • No Control Flow Guard check • CFG sensitive API Attack Surface
  • 7. Attack Surface 1 • CFG ATTRIBUTE CHANGE FUNCTIONS • VirtualAlloc • VirtualProtect • SetProcessValidCallTargets Attack Surface 1
  • 8. • VirtualProtect •  flNewProtect 0x40 •  Memory Protection PAGE_EXECUTE_READWRITE •  The address in the pages are all CFG valid •  flNewProtect 0x40000040 •  Memory Protection PAGE_EXECUTE_READWRITE •  The address in the pages are all CFG invalid • VirtualAlloc •  flProtect 0x40 •  Memory Protection PAGE_EXECUTE_READWRITE •  The address in the pages are all CFG valid •  flProtect 0x40000040 •  Memory Protection PAGE_EXECUTE_READWRITE •  The address in the pages are all CFG invalid VirtualProtect-VirtualAlloc
  • 12. • In Microsoft Edge, there are two types of JIT: •  javascript JIT, in the chakra.dll Module. •  SHADER JIT, in the d3d10warp.dll Module. Attack Surface 1
  • 13. • Because the CFG does not check the ret, we can write the return address to bypass the CFG. • In chakra engine, the interpreting execution mode will simulate a function call stack. The implementation will save some stackframe information on a special object in the heap. • If we have arbitrary read and write vulnerability, we may can infoleak some stack information. Attack Surface 2 write the return address
  • 15. • JIT code is implemented in the runtime. • The CFG support in JIT may be manual maintenance. • Pay attention to the JIT code to find indirect call with no CFG check. Attack Surface 3 Indirect call with no CFG check
  • 16. • Use these function to bypass CFG • VirtualProtect • VirtualAlloc • longjmp/setjmp • …… Attack Surface 4 CFG Sensitive API
  • 17. •  Six CFG bypass vulnerabilities Notes: All of the following bypass vulnerabilities suppose you have arbitrary read/write vulnerability Find Vulnerability
  • 18. • eshims!VirtualProtect to bypass CFG and DEP • Vuln Type: Call Sensitive API out of context • Module: Eshims • Operation System: Windows 10 14367 32 bit • BYPASS CFG/DEP Vuln 1
  • 19. • eshims.dll is a module in Microsoft Edge • eshims have following hook functios,the functions are CFG valid. Vuln 1
  • 21. Vuln 1: Exploit Method
  • 22. • CodeStorageBlock::Protect function to bypass CFG and DEP • Vuln Type:Call Sensitive API out of context • Module: D3D10Warp.dll • Operation System: Windows 10 14393.5 32 bit • BYPASS CFG/DEP Vuln 2
  • 23. CodeStorageBlock(0x38) 0x00 pVtable 0x04 pCodeStorage 0x08 begianAddressofCodeStorageSection 0x30 pSectionCount •  CodeStorageBlock::Protect is CFG valid CodeStorageSection(0x18) 0x00 pCodeStorageChunk 0x04 pPrevCodeStorageSection 0x08 pNextCodeStorageSection 0x0c baseAddress 0x10 size 0x14 flag_busy :byte Vuln 2
  • 27. • Use InterpreterThunkEmitter to bypass CFG • Vuln Type: No Control Flow Guard check • Module: chakra.dll • Operation System: Windows 10 14328 32 bit • Bypass CFG Vuln 3
  • 28. Vuln 3:Js Function Interpreting Execute
  • 30. Vuln 3 •  BYTE* InterpreterThunkEmitter::GetNextThunk(PVOID* ppDynamicInterpreterThunk) •  { •  Assert(ppDynamicInterpreterThunk); •  Assert(*ppDynamicInterpreterThunk == nullptr); •  •  if(thunkCount == 0) •  { •  if(!this->freeListedThunkBlocks.Empty()) •  { •  return AllocateFromFreeList(ppDynamicInterpreterThunk); •  } •  NewThunkBlock(); •  } BYTE* InterpreterThunkEmitter::GetNextThunk(PVOID* ppDynamicInterpreterThunk) { Assert(ppDynamicInterpreterThunk); Assert(*ppDynamicInterpreterThunk == nullptr); if(thunkCount == 0) { if(!this->freeListedThunkBlocks.Empty()) { return AllocateFromFreeList(ppDynamicInterpreterThunk); } NewThunkBlock(); }
  • 31. Vuln 3 const BYTE InterpreterThunkEmitter::InterpreterThunk[] = { 0x55, // push ebp ;Prolog - setup the stack frame 0x8B, 0xEC, // mov ebp,esp 0x8B, 0x45, 0x08, // mov eax, dword ptr [ebp+8] 0x8B, 0x40, 0x00, // mov eax, dword ptr [eax+FunctionBodyOffset] 0x8B, 0x48, 0x00, // mov ecx, dword ptr [eax+DynamicThunkAddressOffset] // Range Check for Valid call target 0x83, 0xE1, 0xF8, // and ecx, 0FFFFFFF8h 0x8b, 0xc1, // mov eax, ecx 0x2d, 0x00, 0x00, 0x00, 0x00, // sub eax, CallBlockStartAddress 0x3d, 0x00, 0x00, 0x00, 0x00, // cmp eax, ThunkSize 0x76, 0x07, // jbe SHORT $safe 0xb9, 0x00, 0x00, 0x00, 0x00, // mov ecx, errorcode 0xCD, 0x29, // int 29h //$safe 0x8D, 0x45, 0x08, // lea eax, ebp+8 0x50, // push eax 0xB8, 0x00, 0x00, 0x00, 0x00, // mov eax, <thunk>//static InterpreterThunk address 0xFF, 0xE1, // jmp ecx 0xCC // int 3 for 8byte alignment
  • 32. Vuln 3:Set Dynamic InterpreterThunk Address
  • 35. Vuln 4 • Write the return address to bypass CFG and DEP • Vuln Type: write return address • Module: chakra.dll • Operation System: Windows 10 14352 32 bit • BYPASS CFG/RFG Vuln 4
  • 37. Vuln 4 • InterpreterHelper will call following function Vuln 4
  • 39. Vuln 4: ExploitVuln 4: Exploit Method
  • 40. • Use Chakra Recycler Memory pageheap to bypass DEP and CFG • Vuln type: Data Only Attack • Module: chakra.dll • Operation System: Windows 10 14328 32 bit • BYPASS CFG/DEP Vuln 5
  • 44. Vuln 5: Exploit Vuln 5:Exploit Method
  • 45. Vuln 6 • Use JIT PAGE to bypass CFG and DEP • Vuln Type: Data Only Attack • Module: chakra.dll • Operation System: Windows 10 14361 32 bit • BYPASS CFG/DEP Vuln 6
  • 50. •  Write Return Address •  VirtualAlloc/VirtualProtect Exploit Framework
  • 51. Exploit Vuln 4:Get addressofReturnAddress
  • 52. Exploit Vuln 4 What to write in the addressOfReturnAddress? Shellcode address? Stack pivot address xchg eax,esp
  • 54. Construct a function, I call it StackPivot,do two things: I. write the stack pivot gadget address to the return address II.Return shellcode_address/2 function stackpivot_func( ) { //write the return address is the stack_pivot return shellcode_address/2; } Exploit Vuln 4:stackpivot function
  • 55. • The representation of an integer in memory(on x86) • In chakra engine, script defined an integer is m, in memory it’s 2*m + 1 Exploit Vuln 4:stackpivot function
  • 56. Exploit Vuln 4: Stackpivot function
  • 57. Exploit Vuln 4: Stackpivot function
  • 58. BYPASS RFG •  InterpreterStackFrame::InterpreterThunk •  eax, rax save the return value. BYPASS RFG
  • 60. • Addressing CFG coverage gaps • Disable RtlRemoteCall when CFG is enabled • compiler directive: __declspec(guard(suppress)) • Setjmp/Longjmp hardening • Arbitrary Code Guard Improvements
  • 61. • Not for CFG, actual effect on CFG have a great impact • Prohibited to modified PAGE_EXECUTE to PAGE_EXECUTE_READWRITE • Prohibited to modified PAGE_READWRITE to PAGE_EXECUTE_READWRITE • Kill using Virtualalloc/VirtualProtect methods to bypass CFG. Arbitrary Code Guard
  • 62. • Bypass that rely on modifying or corrupting read- only memory • _guard_check_icall_fptr • write return address( RFG not enabled) • CFG friendly API which is CFG valid • Data Only Attack Exist Attack Surface
  • 63. •  Jack Tang : Co-found MSRC 33966 •  Kai Yu Acknowledgement
  • 64.
  • 65. references •  Yunhai Zhang How To Avoid Implement An Exploit Friendly JIT •  David Weston、Matt Miller Windows 10 Mitigation Improvements •  Henry Li Control Flow Guard Improvements in Windows 10 Anniversary Update