SlideShare una empresa de Scribd logo
1 de 42
Descargar para leer sin conexión
Your texte here ….




   Defeating DEP and ASLR in Windows




ORIGINAL SWISS ETHICAL HACKING
                        ©2011 High-Tech Bridge SA – www.htbridge.ch 
What is DEP?
   Your texte here ….




   •    Data Execution Prevention (DEP) is a set of hardware and software technologies

   •    It performs additional checks on memory to help prevent malicious code from running on a
        system




ORIGINAL SWISS ETHICAL HACKING
                              ©2011 High-Tech Bridge SA – www.htbridge.ch 
Hardware-enforced DEP
   Your texte here ….


   •       Hardware-enforced DEP causes an attempt to transfer control to an instruction in a
           memory page marked as “no execute” to generate an access fault.

   •       Relies on processor hardware to mark memory with an attribute that indicates that code
           should not be executed from that memory region

   •       DEP functions on a per-virtual memory page basis, usually changing a bit in the page table
           entry (PTE) to mark the memory page

   •       The actual hardware implementation of DEP and marking of the virtual memory page varies by
           processor architecture:

       •     The no-execute page-protection (NX) processor feature as defined by AMD

       •     The Execute Disable Bit (XD) feature as defined by Intel.

   •       To use these processor features, the processor must be running in Physical Address Extension
           (PAE) mode.

       •     Windows will automatically enable PAE mode to support DEP.




ORIGINAL SWISS ETHICAL HACKING
                                  ©2011 High-Tech Bridge SA – www.htbridge.ch 
Intel Hardware-enforced                             DEP

   Your texte here ….




ORIGINAL SWISS ETHICAL HACKING
                        ©2011 High-Tech Bridge SA – www.htbridge.ch 
AMD Hardware-enforced DEP

   Your texte here ….




ORIGINAL SWISS ETHICAL HACKING
                        ©2011 High-Tech Bridge SA – www.htbridge.ch 
Software-enforced DEP
   Your texte here ….



     •   Software-enforced DEP runs on any processor that can run Windows XP SP2

     •   By default, software-enforced DEP helps protect only limited system binaries, regardless of
         the hardware-enforced DEP capabilities of the processor

     •   It protects only user-mode processes.

     •   It must be supported by the operating system.

     •   Software-enforced DEP does not protect from execution of code in data pages but instead
         from another type of attack which is called Security Exception Handling (SEH) overwrite




ORIGINAL SWISS ETHICAL HACKING
                                ©2011 High-Tech Bridge SA – www.htbridge.ch 
DEP settings
   Your texte here ….



   •   /NOEXECUTE= OptIn Turn on DEP for necessary Windows programs and services only


   •   /NOEXECUTE= OptOut Turn on DEP for all programs and services except for those that I select


   •   /NOEXECUTE= AlwaysOn permanently enables DEP


   •   /NOEXECUTE= AlwaysOff permanently disables DEP


   •   The default setting on Windows XP SP2 is OptIn, while the default setting on Windows 2003 Server
       SP1 is OptOut




ORIGINAL SWISS ETHICAL HACKING
                                ©2011 High-Tech Bridge SA – www.htbridge.ch 
ASLR
   Your texte here ….


   •   The PaX project first coined the term "ASLR". Implementations of ASLR in July, 2001.

   •   Exploits attacks rely on programmer skills to identify where specific processes or system
       functions live in memory

   •   In order for an attacker to leverage a function, he must first be able to tell the code where to
       find the function

   •   Before ASLR implementation memory locations were easily discovered by attackers and malware
       code

   •   ASLR (Address space layout randomization) involves randomly positioning memory areas, usually
                                                                                      areas
       the base address of the binary file and position of libraries, heap and stack

   •   Without ASLR, a library will always going to be loaded at a predictable address and can be
       leverage by an exploit

   •   Bypassing ASLR means targeting non-ASLR libraries to build a reliable exploit




ORIGINAL SWISS ETHICAL HACKING
                                  ©2011 High-Tech Bridge SA – www.htbridge.ch 
ASLR DEFEATED
   Your texte here ….




ORIGINAL SWISS ETHICAL HACKING
                        ©2011 High-Tech Bridge SA – www.htbridge.ch 
DEP in action                                  (1)


        Your texte here ….




•    The routine
     inject_shellcode_in_stack push the
     payload into the stack

•    Once the shellcode has been
     injected the code jumps to the
     execute routine

•    The CALL ESP instruction fetch the
     beginning of the shellcode




    ORIGINAL SWISS ETHICAL HACKING
                                      ©2011 High-Tech Bridge SA – www.htbridge.ch 
DEP in action                                 (2)


      Your texte here ….



•   Since the page 0x0022e000 size
    00002000 has only Read and Write
    attributes an access violation is
    triggered    at    the    address
    0x0022feb4

•   DEP    has  successfully stop
    shellcode execution from the
    stack




ORIGINAL SWISS ETHICAL HACKING
                                   ©2011 High-Tech Bridge SA – www.htbridge.ch 
Bypassing DEP                                  (1)


   Your texte here ….



   •   When hardware DEP is enabled, we are not able to jump to our shellcode on the stack, because
       this one will not be executed. An access violation will terminate the process. (slide 10)

   •   Different techniques are available to accomplish this task

   •   DEP can be disabled if the later is running in OptIn or OptOut mode

   •   Another approach is to call API functions that are able to change the memory attributes
       (PAGE_READ_EXECUTE) from where the payload lives

   •   Some of the techniques are introduced in the next slides




ORIGINAL SWISS ETHICAL HACKING
                                 ©2011 High-Tech Bridge SA – www.htbridge.ch 
VirtualAlloc technique                                       (2)



      Your texte here ….




  •    We can create a new memory region with executable attributes

  •    We then copy our shellcode to this memory region (WriteProcessMemory or memcpy API’s)

  •    This technique needs at least the use of two different API’s




ORIGINAL SWISS ETHICAL HACKING
                                   ©2011 High-Tech Bridge SA – www.htbridge.ch 
HeapCreate technique (3)

      Your texte here ….




  •    Comparable to VirtualAlloc()




ORIGINAL SWISS ETHICAL HACKING
                                 ©2011 High-Tech Bridge SA – www.htbridge.ch 
SetProcessDEPPolicy technique                                      (4)




      Your texte here ….




  •    This allows to disable the DEP policy for the current process

  •    It will work for Vista SP1, XP SP3, Server 2008, and only when DEP Policy is set to OptIn or OptOut
       modes




ORIGINAL SWISS ETHICAL HACKING
                                   ©2011 High-Tech Bridge SA – www.htbridge.ch 
VirtualProtect technique                                        (5)



      Your texte here ….




  •    This function will change the access protection level of a given memory page

  •    It will allow to mark the location where our shellcode lives as PAGE_READ_EXECUTE




ORIGINAL SWISS ETHICAL HACKING
                                  ©2011 High-Tech Bridge SA – www.htbridge.ch 
WriteProcessMemory technique                                        (6)




      Your texte here ….




  •    This technique will permit us to copy the shellcode to a memory region with EXECUTE attributes

  •    Later we can jump to it

  •    The target location must be Writable and Executable




ORIGINAL SWISS ETHICAL HACKING
                                  ©2011 High-Tech Bridge SA – www.htbridge.ch 
Operating System vs API
   Your texte here ….




                                                                       Thanks to Corelan.be for this awesome information




ORIGINAL SWISS ETHICAL HACKING
                        ©2011 High-Tech Bridge SA – www.htbridge.ch 
VirtualProtect Technique in action


       Your texte here ….

•    The present code will
     first  find kernel32.dll
     base image address in a
     generic way

•    Then it will find the
     offset of VirtualProtect
     API and add it to the base
     address.

•    Later the code will find
     the current bottom of
     stack and calculate the
     size of it

•    VirtualProtect    Api   is
     called to change the
     current    memory   stack
     attributes             to
     PAGE_EXECUTE_READWRITE

•    A    shellcode   will   be
     injected in the stack and
     get executed after the
     RETN 10 instruction from
     VirtualProtect Api




ORIGINAL SWISS ETHICAL HACKING
                                  ©2011 High-Tech Bridge SA – www.htbridge.ch 
HeapCreate in action

      Your texte here ….




•   A new heap of 296 bytes is
    created              with
    PAGE_READ_EXECUTE
    attributes.

•   The    heap base  address
    returned in EAX is then
    passed                to
    WriteProcessMemory

•   The final RET instruction
    execute the shellcode from
    the new heap




ORIGINAL SWISS ETHICAL HACKING
                                 ©2011 High-Tech Bridge SA – www.htbridge.ch 
WriteProcessMemory in action

       Your texte here ….




•    The shellcode is copied
     to a kernel32.dll memory
     address    which     the
     memory   attributes  are
     Read and Execute

•    The example is using a
     memory         harcoded
     address in windows xp
     sp3  which    does   not
     contain   any   relevant
     code

•    It is important to choose
     the     correct    memory
     address, otherwise the
     system could crash after
     copying the shellcode




ORIGINAL SWISS ETHICAL HACKING
                                 ©2011 High-Tech Bridge SA – www.htbridge.ch 
Return to Libc technique

   Your texte here ….
   •   To take advantage of return to Libc technique we need to overwrite the return address with a
       function address for i.e. WinExec or System

   •   We must provide the correct arguments for the function in order to execute it properly

   •   We do not execute code in the stack, but in the memory page where the native function lives

   •   Some of the benefits are:

         •   We can executed a code with small buffer

         •   We do not need to inject code




ORIGINAL SWISS ETHICAL HACKING
                                   ©2011 High-Tech Bridge SA – www.htbridge.ch 
Return oriented programming (ROP)


   Your texte here ….

   •   As a replacement for returning to functions we return to instructions called “gadgets” in
       EXECUTABLE memory pages

   •   It is possible to return in the middle of instructions to create new instructions

   •   The RET instruction will fetch memory addresses from the stack in order to prepare it to
       successfully call an API function

   •   Python libraries like DEPLib from Pablo Solé or pvefindaddr from Corelan.be permit us to quickly
       find ROP gadgets from non-ASLR libraries




ORIGINAL SWISS ETHICAL HACKING
                                 ©2011 High-Tech Bridge SA – www.htbridge.ch 
Practical ROP example in Windows XP SP3 (1)


       Your texte here ….
   •    We are going to exploit a server application in Windows XP SP3 up to date, running DEP in
        mode /NOEXECUTE=OptOut

   •    The goal is to create the exploit using non-ALSR modules in order to bypass randomization

   •    The application was compiled with Visual Studio 10 with NX Compat and DYNAMICBASE flags




ORIGINAL SWISS ETHICAL HACKING
                                   ©2011 High-Tech Bridge SA – www.htbridge.ch 
Practical ROP example in Windows XP SP3 (2)


    •   Your texte here …. the application with a simple <Evil Buffer> + <CALL ESP> <NOP> <SHELLCODE>
         When we try to exploit
         technique it throws an STATUS_ACCESS_VIOLATION (0xC0000005)

    •    DEP is sucessfully preventing code execution from the actual thread stack




 ORIGINAL SWISS ETHICAL HACKING
                                    ©2011 High-Tech Bridge SA – www.htbridge.ch 
Practical ROP example in Windows XP SP3 (3)


       Your texte here ….
   •    To get around this protection we will implement the ROP technique

   •    The first step is to know which modules are loaded in memory when the vulnerable application
        runs. The objective is to use non-relocatable modules, so we can bypass memory randomization

   •    We are going to use python script !pvefindaddr from corelan.be

   •    For this particular exploit development we have 8 non-ASLR modules to search for ROP gadgets,
        This is pretty enough to create our exploit




 ORIGINAL SWISS ETHICAL HACKING
                                   ©2011 High-Tech Bridge SA – www.htbridge.ch 
Practical ROP example in Windows XP SP3 (4)


       Your texte here ….
   •    The next step is to create our ROP gadgets

   •    The “!pvefindaddr rop” command will create a list of all available gadgets from the non-ASLR
        modules




 ORIGINAL SWISS ETHICAL HACKING
                                    ©2011 High-Tech Bridge SA – www.htbridge.ch 
Practical ROP example in Windows XP SP3 (5)


       Your texte here ….
   •    We can now start to use our ROP gadgets to deactivate Data Protection Execution

   •    We are going to use the SetProcessDEPPolicy technique with the flag 0, which means disable DEP
        for the current process

   •    After searching the correct ROP gadgets from the previous list our exploit is finally created

   •    Let’s trace it in our debugger




ORIGINAL SWISS ETHICAL HACKING
                                     ©2011 High-Tech Bridge SA – www.htbridge.ch 
Practical ROP example in Windows XP SP3 (6)


       Your texte here ….
   •    When the buffer overflow occurs we need first to pivot our stack to reach our controlled
        buffer. The XCHG EAX,ESP instruction permits us to point ESP to 0x0013fb68 address which is the
        beginning of our controlled data in the stack




 ORIGINAL SWISS ETHICAL HACKING
                                   ©2011 High-Tech Bridge SA – www.htbridge.ch 
Practical ROP example in Windows XP SP3 (7)


       Your texte here ….
   •    The next instruction will POP the value 0xffffffff into the EBX register, which will be later
        incremented to obtain a null dword




ORIGINAL SWISS ETHICAL HACKING
                                  ©2011 High-Tech Bridge SA – www.htbridge.ch 
Practical ROP example in Windows XP SP3 (8)


       Your texte here ….
   •    The EBX register contains the flag that will be passed as parameter to the SetProcessDEPPolicy
        API




ORIGINAL SWISS ETHICAL HACKING
                                   ©2011 High-Tech Bridge SA – www.htbridge.ch 
Practical ROP example in Windows XP SP3 (9)


       Your texte here ….
   •    We put the address of SetProcessDEPPolicy into EBP register




 ORIGINAL SWISS ETHICAL HACKING
                                   ©2011 High-Tech Bridge SA – www.htbridge.ch 
Practical ROP example in Windows XP SP3 (10)


       Your texte here ….
   •   The two next steps will be to POP into ESI and EDI a pointer to a RET instruction, this will
       simulate a NOP sled




 ORIGINAL SWISS ETHICAL HACKING
                                  ©2011 High-Tech Bridge SA – www.htbridge.ch 
Practical ROP example in Windows XP SP3 (11)


        Your texte here ….
    •    The last step is to execute a PUSHAD instruction. This will prepare our stack to successfully call
         SetProcessDEPPolicy and automatically set the return pointer from SetProcessDEPPolicy to our
         shellcode




 ORIGINAL SWISS ETHICAL HACKING
                                     ©2011 High-Tech Bridge SA – www.htbridge.ch 
Practical ROP example in Windows XP SP3 (12)


        Your texte here ….
    •    Our stack is now ready to call SetProcessDEPPolicy and deactivate DEP




 ORIGINAL SWISS ETHICAL HACKING
                                    ©2011 High-Tech Bridge SA – www.htbridge.ch 
Practical ROP example in Windows XP SP3 (13)


        Your texte here ….
    •    We place a breakpoint at the RETN 4 instruction which is the end of SetProcessDEPPolicy




 ORIGINAL SWISS ETHICAL HACKING
                                    ©2011 High-Tech Bridge SA – www.htbridge.ch 
Practical ROP example in Windows XP SP3 (14)


        Your texte here ….
    •    Now we are able to reach our shellcode and it will successfully get executed without any access
         violation fault




 ORIGINAL SWISS ETHICAL HACKING
                                    ©2011 High-Tech Bridge SA – www.htbridge.ch 
Practical ROP example in Windows XP SP3 (15)


        Your texte here ….
    •    Finally our shellcode is executed without issues. Let’s try the exploit without a debugger




  ORIGINAL SWISS ETHICAL HACKING
                                     ©2011 High-Tech Bridge SA – www.htbridge.ch 
Practical ROP example in Windows XP SP3 (16)


        Your texte here ….
    •    We can effectively execute our shellcode bypassing DEP and ASLR protections




 ORIGINAL SWISS ETHICAL HACKING
                                    ©2011 High-Tech Bridge SA – www.htbridge.ch 
Conclusions

   Your texte here ….



  •DEP and ASLR are designed to increase an attacker's exploit development costs


  •ASLR is easy bypassed if we can count on memory modules which do not have this feature turn on


  •The return oriented programming can be used to with no trouble get around dep protections


  •This techniques can be also used in others windows flavors such as windows Vista or Windows 7




ORIGINAL SWISS ETHICAL HACKING
                                 ©2011 High-Tech Bridge SA – www.htbridge.ch 
References
   Your texte here ….

   http://www.uninformed.org/?v=2&a=4&t=txt

   http://support.microsoft.com/kb/875352

   http://technet.microsoft.com/en-us/library/bb457155.aspx

   http://technet.microsoft.com/en-us/library/cc738483%28WS.10%29.aspx

   http://msdn.microsoft.com/en-us/library/ms633548%28v=vs.85%29.aspx

   http://opc0de.tuxfamily.org/?p=430

   http://www.cs.bham.ac.uk/~covam/blog/binary/

   http://www.corelan.be

   Windows Internals fourth edition

   https://www.blackhat.com/presentations/bh-usa-
   08/Shacham/BH_US_08_Shacham_Return_Oriented_Programming.pdf




ORIGINAL SWISS ETHICAL HACKING
                            ©2011 High-Tech Bridge SA – www.htbridge.ch 
Your texte here ….




                        Your questions are always welcome!

                               Brian.mariani@htbridge.ch




ORIGINAL SWISS ETHICAL HACKING
                        ©2011 High-Tech Bridge SA – www.htbridge.ch 

Más contenido relacionado

La actualidad más candente

Isn't it ironic - managing a bare metal cloud (OSL TES 2015)
Isn't it ironic - managing a bare metal cloud (OSL TES 2015)Isn't it ironic - managing a bare metal cloud (OSL TES 2015)
Isn't it ironic - managing a bare metal cloud (OSL TES 2015)
Devananda Van Der Veen
 
Provisioning Bare Metal with OpenStack
Provisioning Bare Metal with OpenStackProvisioning Bare Metal with OpenStack
Provisioning Bare Metal with OpenStack
Devananda Van Der Veen
 
Ironic - A modern approach to machine deployment
Ironic - A modern approach to machine deploymentIronic - A modern approach to machine deployment
Ironic - A modern approach to machine deployment
Devananda Van Der Veen
 

La actualidad más candente (6)

L4 Microkernel :: Design Overview
L4 Microkernel :: Design OverviewL4 Microkernel :: Design Overview
L4 Microkernel :: Design Overview
 
Isn't it ironic - managing a bare metal cloud (OSL TES 2015)
Isn't it ironic - managing a bare metal cloud (OSL TES 2015)Isn't it ironic - managing a bare metal cloud (OSL TES 2015)
Isn't it ironic - managing a bare metal cloud (OSL TES 2015)
 
Dvm
DvmDvm
Dvm
 
Provisioning Bare Metal with OpenStack
Provisioning Bare Metal with OpenStackProvisioning Bare Metal with OpenStack
Provisioning Bare Metal with OpenStack
 
Ironic - A modern approach to machine deployment
Ironic - A modern approach to machine deploymentIronic - A modern approach to machine deployment
Ironic - A modern approach to machine deployment
 
Dealing with Hardware Heterogeneity Using EmbeddedXEN, a Virtualization Frame...
Dealing with Hardware Heterogeneity Using EmbeddedXEN, a Virtualization Frame...Dealing with Hardware Heterogeneity Using EmbeddedXEN, a Virtualization Frame...
Dealing with Hardware Heterogeneity Using EmbeddedXEN, a Virtualization Frame...
 

Destacado

Eni presentation conciliation process
Eni presentation conciliation processEni presentation conciliation process
Eni presentation conciliation process
consumerenergy
 
личность преподавателя в вузе
личность преподавателя в вузеличность преподавателя в вузе
личность преподавателя в вузе
30041963
 
Locking system for mounting cermaic tiles
Locking system for mounting cermaic tilesLocking system for mounting cermaic tiles
Locking system for mounting cermaic tiles
abhikkgp
 

Destacado (20)

Userland Hooking in Windows
Userland Hooking in WindowsUserland Hooking in Windows
Userland Hooking in Windows
 
Manipulating Memory for Fun & Profit
Manipulating Memory for Fun & ProfitManipulating Memory for Fun & Profit
Manipulating Memory for Fun & Profit
 
Inline Hooking in Windows
Inline Hooking in WindowsInline Hooking in Windows
Inline Hooking in Windows
 
Client-side threats - Anatomy of Reverse Trojan attacks
Client-side threats - Anatomy of Reverse Trojan attacksClient-side threats - Anatomy of Reverse Trojan attacks
Client-side threats - Anatomy of Reverse Trojan attacks
 
Spying Internet Explorer 8.0
Spying Internet Explorer 8.0Spying Internet Explorer 8.0
Spying Internet Explorer 8.0
 
Frontal Attacks - From basic compromise to Advanced Persistent Threat
Frontal Attacks - From basic compromise to Advanced Persistent ThreatFrontal Attacks - From basic compromise to Advanced Persistent Threat
Frontal Attacks - From basic compromise to Advanced Persistent Threat
 
Fuzzing: An introduction to Sulley Framework
Fuzzing: An introduction to Sulley FrameworkFuzzing: An introduction to Sulley Framework
Fuzzing: An introduction to Sulley Framework
 
Cybercrime in nowadays businesses - A real case study of targeted attack
Cybercrime in nowadays businesses - A real case study of targeted attackCybercrime in nowadays businesses - A real case study of targeted attack
Cybercrime in nowadays businesses - A real case study of targeted attack
 
Become fully aware of the potential dangers of ActiveX attacks
Become fully aware of the potential dangers of ActiveX attacksBecome fully aware of the potential dangers of ActiveX attacks
Become fully aware of the potential dangers of ActiveX attacks
 
Pentest trends 2017
Pentest trends 2017Pentest trends 2017
Pentest trends 2017
 
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
 
Process injection - Malware style
Process injection - Malware styleProcess injection - Malware style
Process injection - Malware style
 
Eni presentation conciliation process
Eni presentation conciliation processEni presentation conciliation process
Eni presentation conciliation process
 
Module 7pres
Module 7presModule 7pres
Module 7pres
 
Oracle 11G- PLSQL
Oracle 11G- PLSQLOracle 11G- PLSQL
Oracle 11G- PLSQL
 
Target audience
Target audienceTarget audience
Target audience
 
личность преподавателя в вузе
личность преподавателя в вузеличность преподавателя в вузе
личность преподавателя в вузе
 
Segmentation scale selection
Segmentation scale selectionSegmentation scale selection
Segmentation scale selection
 
Locking system for mounting cermaic tiles
Locking system for mounting cermaic tilesLocking system for mounting cermaic tiles
Locking system for mounting cermaic tiles
 
Mind Your Brain
Mind Your BrainMind Your Brain
Mind Your Brain
 

Similar a Defeating Data Execution Prevention and ASLR in Windows

Hadoop-Automation-Tool_RamkishorTak
Hadoop-Automation-Tool_RamkishorTakHadoop-Automation-Tool_RamkishorTak
Hadoop-Automation-Tool_RamkishorTak
Ram Kishor Tak
 
The HaLVM: A Simple Platform for Simple Platforms
The HaLVM: A Simple Platform for Simple PlatformsThe HaLVM: A Simple Platform for Simple Platforms
The HaLVM: A Simple Platform for Simple Platforms
The Linux Foundation
 

Similar a Defeating Data Execution Prevention and ASLR in Windows (20)

DEF CON 27 - ORANGE TSAI and MEH CHANG - infiltrating corporate intranet like...
DEF CON 27 - ORANGE TSAI and MEH CHANG - infiltrating corporate intranet like...DEF CON 27 - ORANGE TSAI and MEH CHANG - infiltrating corporate intranet like...
DEF CON 27 - ORANGE TSAI and MEH CHANG - infiltrating corporate intranet like...
 
Eusecwest
EusecwestEusecwest
Eusecwest
 
[HES2013] Virtually secure, analysis to remote root 0day on an industry leadi...
[HES2013] Virtually secure, analysis to remote root 0day on an industry leadi...[HES2013] Virtually secure, analysis to remote root 0day on an industry leadi...
[HES2013] Virtually secure, analysis to remote root 0day on an industry leadi...
 
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
 
Recon2016 shooting the_osx_el_capitan_kernel_like_a_sniper_chen_he
Recon2016 shooting the_osx_el_capitan_kernel_like_a_sniper_chen_heRecon2016 shooting the_osx_el_capitan_kernel_like_a_sniper_chen_he
Recon2016 shooting the_osx_el_capitan_kernel_like_a_sniper_chen_he
 
Lamp Introduction 20100419
Lamp Introduction 20100419Lamp Introduction 20100419
Lamp Introduction 20100419
 
LCNA14: Why Use Xen for Large Scale Enterprise Deployments? - Konrad Rzeszute...
LCNA14: Why Use Xen for Large Scale Enterprise Deployments? - Konrad Rzeszute...LCNA14: Why Use Xen for Large Scale Enterprise Deployments? - Konrad Rzeszute...
LCNA14: Why Use Xen for Large Scale Enterprise Deployments? - Konrad Rzeszute...
 
Hadoop-Automation-Tool_RamkishorTak
Hadoop-Automation-Tool_RamkishorTakHadoop-Automation-Tool_RamkishorTak
Hadoop-Automation-Tool_RamkishorTak
 
Experiences with Debugging Data Races
Experiences with Debugging Data RacesExperiences with Debugging Data Races
Experiences with Debugging Data Races
 
In-Ceph-tion: Deploying a Ceph cluster on DreamCompute
In-Ceph-tion: Deploying a Ceph cluster on DreamComputeIn-Ceph-tion: Deploying a Ceph cluster on DreamCompute
In-Ceph-tion: Deploying a Ceph cluster on DreamCompute
 
The HaLVM: A Simple Platform for Simple Platforms
The HaLVM: A Simple Platform for Simple PlatformsThe HaLVM: A Simple Platform for Simple Platforms
The HaLVM: A Simple Platform for Simple Platforms
 
PowerPoint Presentation
PowerPoint PresentationPowerPoint Presentation
PowerPoint Presentation
 
Architecture_Masking_Delphix.pptx
Architecture_Masking_Delphix.pptxArchitecture_Masking_Delphix.pptx
Architecture_Masking_Delphix.pptx
 
One Shellcode to Rule Them All: Cross-Platform Exploitation
One Shellcode to Rule Them All: Cross-Platform ExploitationOne Shellcode to Rule Them All: Cross-Platform Exploitation
One Shellcode to Rule Them All: Cross-Platform Exploitation
 
C:\Alon Tech\New Tech\Embedded Conf Tlv\Prez\Sightsys Embedded Day
C:\Alon Tech\New Tech\Embedded Conf Tlv\Prez\Sightsys Embedded DayC:\Alon Tech\New Tech\Embedded Conf Tlv\Prez\Sightsys Embedded Day
C:\Alon Tech\New Tech\Embedded Conf Tlv\Prez\Sightsys Embedded Day
 
Docker 101
Docker 101 Docker 101
Docker 101
 
Stackato v5
Stackato v5Stackato v5
Stackato v5
 
Denis Baranov - Root via XSS
Denis Baranov - Root via XSSDenis Baranov - Root via XSS
Denis Baranov - Root via XSS
 
PowerShell Defcon for Cybersecurity Topics
PowerShell Defcon for Cybersecurity TopicsPowerShell Defcon for Cybersecurity Topics
PowerShell Defcon for Cybersecurity Topics
 
Deep learning on HDP 2018 Prague
Deep learning on HDP 2018 PragueDeep learning on HDP 2018 Prague
Deep learning on HDP 2018 Prague
 

Más de High-Tech Bridge SA (HTBridge)

Más de High-Tech Bridge SA (HTBridge) (6)

Welcome in the World Wild Web
Welcome in the World Wild WebWelcome in the World Wild Web
Welcome in the World Wild Web
 
Novell GroupWise Multiple Untrusted Pointer Dereferences Exploitation
Novell GroupWise Multiple Untrusted Pointer Dereferences ExploitationNovell GroupWise Multiple Untrusted Pointer Dereferences Exploitation
Novell GroupWise Multiple Untrusted Pointer Dereferences Exploitation
 
In-Memory Fuzzing with Java (Publication from High-Tech Bridge)
In-Memory Fuzzing with Java (Publication from High-Tech Bridge)In-Memory Fuzzing with Java (Publication from High-Tech Bridge)
In-Memory Fuzzing with Java (Publication from High-Tech Bridge)
 
CVE 2012-1889 Microsoft XML core services uninitialized memory vulnerability
CVE 2012-1889 Microsoft XML core services uninitialized memory vulnerabilityCVE 2012-1889 Microsoft XML core services uninitialized memory vulnerability
CVE 2012-1889 Microsoft XML core services uninitialized memory vulnerability
 
Structured Exception Handler Exploitation
Structured Exception Handler ExploitationStructured Exception Handler Exploitation
Structured Exception Handler Exploitation
 
Fake malware and virus scanners
Fake malware and virus scannersFake malware and virus scanners
Fake malware and virus scanners
 

Último

Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Victor Rentea
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Safe Software
 
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Victor Rentea
 

Último (20)

Elevate Developer Efficiency & build GenAI Application with Amazon Q​
Elevate Developer Efficiency & build GenAI Application with Amazon Q​Elevate Developer Efficiency & build GenAI Application with Amazon Q​
Elevate Developer Efficiency & build GenAI Application with Amazon Q​
 
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
 
Mcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Mcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot ModelMcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Mcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot Model
 
WSO2's API Vision: Unifying Control, Empowering Developers
WSO2's API Vision: Unifying Control, Empowering DevelopersWSO2's API Vision: Unifying Control, Empowering Developers
WSO2's API Vision: Unifying Control, Empowering Developers
 
CNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In PakistanCNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In Pakistan
 
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
 
Platformless Horizons for Digital Adaptability
Platformless Horizons for Digital AdaptabilityPlatformless Horizons for Digital Adaptability
Platformless Horizons for Digital Adaptability
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
 
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
 
[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdf[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdf
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
 
Vector Search -An Introduction in Oracle Database 23ai.pptx
Vector Search -An Introduction in Oracle Database 23ai.pptxVector Search -An Introduction in Oracle Database 23ai.pptx
Vector Search -An Introduction in Oracle Database 23ai.pptx
 
Understanding the FAA Part 107 License ..
Understanding the FAA Part 107 License ..Understanding the FAA Part 107 License ..
Understanding the FAA Part 107 License ..
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of Terraform
 
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWEREMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
 
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
 
Six Myths about Ontologies: The Basics of Formal Ontology
Six Myths about Ontologies: The Basics of Formal OntologySix Myths about Ontologies: The Basics of Formal Ontology
Six Myths about Ontologies: The Basics of Formal Ontology
 
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdfRising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century education
 

Defeating Data Execution Prevention and ASLR in Windows

  • 1. Your texte here …. Defeating DEP and ASLR in Windows ORIGINAL SWISS ETHICAL HACKING ©2011 High-Tech Bridge SA – www.htbridge.ch 
  • 2. What is DEP? Your texte here …. • Data Execution Prevention (DEP) is a set of hardware and software technologies • It performs additional checks on memory to help prevent malicious code from running on a system ORIGINAL SWISS ETHICAL HACKING ©2011 High-Tech Bridge SA – www.htbridge.ch 
  • 3. Hardware-enforced DEP Your texte here …. • Hardware-enforced DEP causes an attempt to transfer control to an instruction in a memory page marked as “no execute” to generate an access fault. • Relies on processor hardware to mark memory with an attribute that indicates that code should not be executed from that memory region • DEP functions on a per-virtual memory page basis, usually changing a bit in the page table entry (PTE) to mark the memory page • The actual hardware implementation of DEP and marking of the virtual memory page varies by processor architecture: • The no-execute page-protection (NX) processor feature as defined by AMD • The Execute Disable Bit (XD) feature as defined by Intel. • To use these processor features, the processor must be running in Physical Address Extension (PAE) mode. • Windows will automatically enable PAE mode to support DEP. ORIGINAL SWISS ETHICAL HACKING ©2011 High-Tech Bridge SA – www.htbridge.ch 
  • 4. Intel Hardware-enforced DEP Your texte here …. ORIGINAL SWISS ETHICAL HACKING ©2011 High-Tech Bridge SA – www.htbridge.ch 
  • 5. AMD Hardware-enforced DEP Your texte here …. ORIGINAL SWISS ETHICAL HACKING ©2011 High-Tech Bridge SA – www.htbridge.ch 
  • 6. Software-enforced DEP Your texte here …. • Software-enforced DEP runs on any processor that can run Windows XP SP2 • By default, software-enforced DEP helps protect only limited system binaries, regardless of the hardware-enforced DEP capabilities of the processor • It protects only user-mode processes. • It must be supported by the operating system. • Software-enforced DEP does not protect from execution of code in data pages but instead from another type of attack which is called Security Exception Handling (SEH) overwrite ORIGINAL SWISS ETHICAL HACKING ©2011 High-Tech Bridge SA – www.htbridge.ch 
  • 7. DEP settings Your texte here …. • /NOEXECUTE= OptIn Turn on DEP for necessary Windows programs and services only • /NOEXECUTE= OptOut Turn on DEP for all programs and services except for those that I select • /NOEXECUTE= AlwaysOn permanently enables DEP • /NOEXECUTE= AlwaysOff permanently disables DEP • The default setting on Windows XP SP2 is OptIn, while the default setting on Windows 2003 Server SP1 is OptOut ORIGINAL SWISS ETHICAL HACKING ©2011 High-Tech Bridge SA – www.htbridge.ch 
  • 8. ASLR Your texte here …. • The PaX project first coined the term "ASLR". Implementations of ASLR in July, 2001. • Exploits attacks rely on programmer skills to identify where specific processes or system functions live in memory • In order for an attacker to leverage a function, he must first be able to tell the code where to find the function • Before ASLR implementation memory locations were easily discovered by attackers and malware code • ASLR (Address space layout randomization) involves randomly positioning memory areas, usually areas the base address of the binary file and position of libraries, heap and stack • Without ASLR, a library will always going to be loaded at a predictable address and can be leverage by an exploit • Bypassing ASLR means targeting non-ASLR libraries to build a reliable exploit ORIGINAL SWISS ETHICAL HACKING ©2011 High-Tech Bridge SA – www.htbridge.ch 
  • 9. ASLR DEFEATED Your texte here …. ORIGINAL SWISS ETHICAL HACKING ©2011 High-Tech Bridge SA – www.htbridge.ch 
  • 10. DEP in action (1) Your texte here …. • The routine inject_shellcode_in_stack push the payload into the stack • Once the shellcode has been injected the code jumps to the execute routine • The CALL ESP instruction fetch the beginning of the shellcode ORIGINAL SWISS ETHICAL HACKING ©2011 High-Tech Bridge SA – www.htbridge.ch 
  • 11. DEP in action (2) Your texte here …. • Since the page 0x0022e000 size 00002000 has only Read and Write attributes an access violation is triggered at the address 0x0022feb4 • DEP has successfully stop shellcode execution from the stack ORIGINAL SWISS ETHICAL HACKING ©2011 High-Tech Bridge SA – www.htbridge.ch 
  • 12. Bypassing DEP (1) Your texte here …. • When hardware DEP is enabled, we are not able to jump to our shellcode on the stack, because this one will not be executed. An access violation will terminate the process. (slide 10) • Different techniques are available to accomplish this task • DEP can be disabled if the later is running in OptIn or OptOut mode • Another approach is to call API functions that are able to change the memory attributes (PAGE_READ_EXECUTE) from where the payload lives • Some of the techniques are introduced in the next slides ORIGINAL SWISS ETHICAL HACKING ©2011 High-Tech Bridge SA – www.htbridge.ch 
  • 13. VirtualAlloc technique (2) Your texte here …. • We can create a new memory region with executable attributes • We then copy our shellcode to this memory region (WriteProcessMemory or memcpy API’s) • This technique needs at least the use of two different API’s ORIGINAL SWISS ETHICAL HACKING ©2011 High-Tech Bridge SA – www.htbridge.ch 
  • 14. HeapCreate technique (3) Your texte here …. • Comparable to VirtualAlloc() ORIGINAL SWISS ETHICAL HACKING ©2011 High-Tech Bridge SA – www.htbridge.ch 
  • 15. SetProcessDEPPolicy technique (4) Your texte here …. • This allows to disable the DEP policy for the current process • It will work for Vista SP1, XP SP3, Server 2008, and only when DEP Policy is set to OptIn or OptOut modes ORIGINAL SWISS ETHICAL HACKING ©2011 High-Tech Bridge SA – www.htbridge.ch 
  • 16. VirtualProtect technique (5) Your texte here …. • This function will change the access protection level of a given memory page • It will allow to mark the location where our shellcode lives as PAGE_READ_EXECUTE ORIGINAL SWISS ETHICAL HACKING ©2011 High-Tech Bridge SA – www.htbridge.ch 
  • 17. WriteProcessMemory technique (6) Your texte here …. • This technique will permit us to copy the shellcode to a memory region with EXECUTE attributes • Later we can jump to it • The target location must be Writable and Executable ORIGINAL SWISS ETHICAL HACKING ©2011 High-Tech Bridge SA – www.htbridge.ch 
  • 18. Operating System vs API Your texte here …. Thanks to Corelan.be for this awesome information ORIGINAL SWISS ETHICAL HACKING ©2011 High-Tech Bridge SA – www.htbridge.ch 
  • 19. VirtualProtect Technique in action Your texte here …. • The present code will first find kernel32.dll base image address in a generic way • Then it will find the offset of VirtualProtect API and add it to the base address. • Later the code will find the current bottom of stack and calculate the size of it • VirtualProtect Api is called to change the current memory stack attributes to PAGE_EXECUTE_READWRITE • A shellcode will be injected in the stack and get executed after the RETN 10 instruction from VirtualProtect Api ORIGINAL SWISS ETHICAL HACKING ©2011 High-Tech Bridge SA – www.htbridge.ch 
  • 20. HeapCreate in action Your texte here …. • A new heap of 296 bytes is created with PAGE_READ_EXECUTE attributes. • The heap base address returned in EAX is then passed to WriteProcessMemory • The final RET instruction execute the shellcode from the new heap ORIGINAL SWISS ETHICAL HACKING ©2011 High-Tech Bridge SA – www.htbridge.ch 
  • 21. WriteProcessMemory in action Your texte here …. • The shellcode is copied to a kernel32.dll memory address which the memory attributes are Read and Execute • The example is using a memory harcoded address in windows xp sp3 which does not contain any relevant code • It is important to choose the correct memory address, otherwise the system could crash after copying the shellcode ORIGINAL SWISS ETHICAL HACKING ©2011 High-Tech Bridge SA – www.htbridge.ch 
  • 22. Return to Libc technique Your texte here …. • To take advantage of return to Libc technique we need to overwrite the return address with a function address for i.e. WinExec or System • We must provide the correct arguments for the function in order to execute it properly • We do not execute code in the stack, but in the memory page where the native function lives • Some of the benefits are: • We can executed a code with small buffer • We do not need to inject code ORIGINAL SWISS ETHICAL HACKING ©2011 High-Tech Bridge SA – www.htbridge.ch 
  • 23. Return oriented programming (ROP) Your texte here …. • As a replacement for returning to functions we return to instructions called “gadgets” in EXECUTABLE memory pages • It is possible to return in the middle of instructions to create new instructions • The RET instruction will fetch memory addresses from the stack in order to prepare it to successfully call an API function • Python libraries like DEPLib from Pablo Solé or pvefindaddr from Corelan.be permit us to quickly find ROP gadgets from non-ASLR libraries ORIGINAL SWISS ETHICAL HACKING ©2011 High-Tech Bridge SA – www.htbridge.ch 
  • 24. Practical ROP example in Windows XP SP3 (1) Your texte here …. • We are going to exploit a server application in Windows XP SP3 up to date, running DEP in mode /NOEXECUTE=OptOut • The goal is to create the exploit using non-ALSR modules in order to bypass randomization • The application was compiled with Visual Studio 10 with NX Compat and DYNAMICBASE flags ORIGINAL SWISS ETHICAL HACKING ©2011 High-Tech Bridge SA – www.htbridge.ch 
  • 25. Practical ROP example in Windows XP SP3 (2) • Your texte here …. the application with a simple <Evil Buffer> + <CALL ESP> <NOP> <SHELLCODE> When we try to exploit technique it throws an STATUS_ACCESS_VIOLATION (0xC0000005) • DEP is sucessfully preventing code execution from the actual thread stack ORIGINAL SWISS ETHICAL HACKING ©2011 High-Tech Bridge SA – www.htbridge.ch 
  • 26. Practical ROP example in Windows XP SP3 (3) Your texte here …. • To get around this protection we will implement the ROP technique • The first step is to know which modules are loaded in memory when the vulnerable application runs. The objective is to use non-relocatable modules, so we can bypass memory randomization • We are going to use python script !pvefindaddr from corelan.be • For this particular exploit development we have 8 non-ASLR modules to search for ROP gadgets, This is pretty enough to create our exploit ORIGINAL SWISS ETHICAL HACKING ©2011 High-Tech Bridge SA – www.htbridge.ch 
  • 27. Practical ROP example in Windows XP SP3 (4) Your texte here …. • The next step is to create our ROP gadgets • The “!pvefindaddr rop” command will create a list of all available gadgets from the non-ASLR modules ORIGINAL SWISS ETHICAL HACKING ©2011 High-Tech Bridge SA – www.htbridge.ch 
  • 28. Practical ROP example in Windows XP SP3 (5) Your texte here …. • We can now start to use our ROP gadgets to deactivate Data Protection Execution • We are going to use the SetProcessDEPPolicy technique with the flag 0, which means disable DEP for the current process • After searching the correct ROP gadgets from the previous list our exploit is finally created • Let’s trace it in our debugger ORIGINAL SWISS ETHICAL HACKING ©2011 High-Tech Bridge SA – www.htbridge.ch 
  • 29. Practical ROP example in Windows XP SP3 (6) Your texte here …. • When the buffer overflow occurs we need first to pivot our stack to reach our controlled buffer. The XCHG EAX,ESP instruction permits us to point ESP to 0x0013fb68 address which is the beginning of our controlled data in the stack ORIGINAL SWISS ETHICAL HACKING ©2011 High-Tech Bridge SA – www.htbridge.ch 
  • 30. Practical ROP example in Windows XP SP3 (7) Your texte here …. • The next instruction will POP the value 0xffffffff into the EBX register, which will be later incremented to obtain a null dword ORIGINAL SWISS ETHICAL HACKING ©2011 High-Tech Bridge SA – www.htbridge.ch 
  • 31. Practical ROP example in Windows XP SP3 (8) Your texte here …. • The EBX register contains the flag that will be passed as parameter to the SetProcessDEPPolicy API ORIGINAL SWISS ETHICAL HACKING ©2011 High-Tech Bridge SA – www.htbridge.ch 
  • 32. Practical ROP example in Windows XP SP3 (9) Your texte here …. • We put the address of SetProcessDEPPolicy into EBP register ORIGINAL SWISS ETHICAL HACKING ©2011 High-Tech Bridge SA – www.htbridge.ch 
  • 33. Practical ROP example in Windows XP SP3 (10) Your texte here …. • The two next steps will be to POP into ESI and EDI a pointer to a RET instruction, this will simulate a NOP sled ORIGINAL SWISS ETHICAL HACKING ©2011 High-Tech Bridge SA – www.htbridge.ch 
  • 34. Practical ROP example in Windows XP SP3 (11) Your texte here …. • The last step is to execute a PUSHAD instruction. This will prepare our stack to successfully call SetProcessDEPPolicy and automatically set the return pointer from SetProcessDEPPolicy to our shellcode ORIGINAL SWISS ETHICAL HACKING ©2011 High-Tech Bridge SA – www.htbridge.ch 
  • 35. Practical ROP example in Windows XP SP3 (12) Your texte here …. • Our stack is now ready to call SetProcessDEPPolicy and deactivate DEP ORIGINAL SWISS ETHICAL HACKING ©2011 High-Tech Bridge SA – www.htbridge.ch 
  • 36. Practical ROP example in Windows XP SP3 (13) Your texte here …. • We place a breakpoint at the RETN 4 instruction which is the end of SetProcessDEPPolicy ORIGINAL SWISS ETHICAL HACKING ©2011 High-Tech Bridge SA – www.htbridge.ch 
  • 37. Practical ROP example in Windows XP SP3 (14) Your texte here …. • Now we are able to reach our shellcode and it will successfully get executed without any access violation fault ORIGINAL SWISS ETHICAL HACKING ©2011 High-Tech Bridge SA – www.htbridge.ch 
  • 38. Practical ROP example in Windows XP SP3 (15) Your texte here …. • Finally our shellcode is executed without issues. Let’s try the exploit without a debugger ORIGINAL SWISS ETHICAL HACKING ©2011 High-Tech Bridge SA – www.htbridge.ch 
  • 39. Practical ROP example in Windows XP SP3 (16) Your texte here …. • We can effectively execute our shellcode bypassing DEP and ASLR protections ORIGINAL SWISS ETHICAL HACKING ©2011 High-Tech Bridge SA – www.htbridge.ch 
  • 40. Conclusions Your texte here …. •DEP and ASLR are designed to increase an attacker's exploit development costs •ASLR is easy bypassed if we can count on memory modules which do not have this feature turn on •The return oriented programming can be used to with no trouble get around dep protections •This techniques can be also used in others windows flavors such as windows Vista or Windows 7 ORIGINAL SWISS ETHICAL HACKING ©2011 High-Tech Bridge SA – www.htbridge.ch 
  • 41. References Your texte here …. http://www.uninformed.org/?v=2&a=4&t=txt http://support.microsoft.com/kb/875352 http://technet.microsoft.com/en-us/library/bb457155.aspx http://technet.microsoft.com/en-us/library/cc738483%28WS.10%29.aspx http://msdn.microsoft.com/en-us/library/ms633548%28v=vs.85%29.aspx http://opc0de.tuxfamily.org/?p=430 http://www.cs.bham.ac.uk/~covam/blog/binary/ http://www.corelan.be Windows Internals fourth edition https://www.blackhat.com/presentations/bh-usa- 08/Shacham/BH_US_08_Shacham_Return_Oriented_Programming.pdf ORIGINAL SWISS ETHICAL HACKING ©2011 High-Tech Bridge SA – www.htbridge.ch 
  • 42. Your texte here …. Your questions are always welcome! Brian.mariani@htbridge.ch ORIGINAL SWISS ETHICAL HACKING ©2011 High-Tech Bridge SA – www.htbridge.ch