SlideShare une entreprise Scribd logo
1  sur  33
Télécharger pour lire hors ligne
Your texte here ….




    Userland Hooking in Windows




03 August 2011

Brian MARIANI
Senior Security Consultant
ORIGINAL SWISS ETHICAL HACKING
                  ©2011 High-Tech Bridge SA – www.htbridge.ch
SOME IMPORTANT POINTS

   Your texte here ….




    This document is the first of a series of five
    articles relating to the art of hooking.

    As a test environment we will use an english
    Windows    Seven   SP1   operating    system
    distribution.




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

   Your texte here ….
    In the sphere of computer security, the term
    hooking enclose a range of different
    techniques.

    These methods are used to alter the
    behavior   of  an   operating system   by
    intercepting function calls, messages or
    events     passed     between    software
    components.

    A piece of code that handles intercepted
    function calls, is called a hook.

ORIGINAL SWISS ETHICAL HACKING
                   ©2011 High-Tech Bridge SA – www.htbridge.ch
THE WHITE SIDE OF HOOKING TECHNIQUES?


     The control of
    Your texte here ….   an Application programming
     interface (API) call is very useful and enables
     programmers to track invisible actions that
     occur during the applications calls.

     It contributes to comprehensive validation of
     parameters.

     Reports issues that frequently remain unnoticed.

     API hooking has merited a reputation for being
     one   of    the most    widespread   debugging
     techniques.

     Hooking is also quite advantageous technique
     for interpreting poorly documented APIs.
 ORIGINAL SWISS ETHICAL HACKING
                    ©2011 High-Tech Bridge SA – www.htbridge.ch
THE BLACK SIDE OF HOOKING TECHNIQUES?



     Hooking      can
    Your texte here ….       alter the  normal  code
     execution       of     Windows APIs by injecting
     hooks.

     This technique is often used to change the
     behavior of well known Windows APIs.

     This practice is implemented in a set of
     programs and code that allows a permanent,
     consistent or undetectable presence in a
     previously attacked system.

     This set of programs used to control a
     system while hiding his presence is know as a
     ROOTKIT.
 ORIGINAL SWISS ETHICAL HACKING
                    ©2011 High-Tech Bridge SA – www.htbridge.ch
WHY DO ROOTKITS EXIST?

   Your texte here …. human beings characteristics is
    One of the most
    curiosity,
    curiosity remember Adam and Eve story.

    People want to see or control what other people
    are doing and computers are a perfect target.

    A rootkit is convenient if and attacker desires to
    maintain access to a system.

    They often provide two main primary functions:

     – Remote Command and Control.
     – Software eavesdropping.



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

    In computing, hierarchical protection domains, often called
   Your texte here ….
    protection rings, are a mechanism to protect data and
                rings
    functionality from faults and malicious behavior.

    Userland rootkits run in (Ring 3) privilege mode. They use a
                              Ring
    variety of methods to hide themselves, such as:
                                    Least privileged             Ring 3
                                                                 Ring 2
                                                                 Ring 1
     – Hide their processes
     – Hide registry keys
     – Hide files, windows and handles.                        Ring 0
                                                            Kernel System




                                                             Device Drivers
                                                             Device Drivers
                                                             Applications
                                    Most privileged

    For example a userland rootkit who wants to hide registry
    information from a windows application which uses libraries
    such as user32.dll, kernel32.dll, or Advapi32.dll.
ORIGINAL SWISS ETHICAL HACKING
                   ©2011 High-Tech Bridge SA – www.htbridge.ch
KERNEL-
KERNEL-LAND ROOTKITS

   Your texte rootkits
    Kernel     here …. run with the most                         highest
    operating system privileges (Ring 0).
                                 Ring

    They add or replace pieces of code of the operating
    system to modify kernel behavior.

    Operating systems support kernel mode drivers,
    they run with the same privileges as the operating
    system itself.

    This class of rootkit has unrestricted security
    access.

    Kernel rootkits can be especially difficult to
    detect and remove because they operate at the same
    security level as the operating system itself.

    They are able to intercept or subvert the most
    trusted operating system.
ORIGINAL SWISS ETHICAL HACKING
                   ©2011 High-Tech Bridge SA – www.htbridge.ch
AN AMUSING ROOTKIT STORY

   Your texte here ….




                                                                 More..




ORIGINAL SWISS ETHICAL HACKING
                   ©2011 High-Tech Bridge SA – www.htbridge.ch
WHAT IS THE IMPORT ADDRESS TABLE

     Inside a Windows Portable Executable (PE) file, there is an
    Your texte here ….
     array of data structures, one for every imported Dynamic
     Link Library (DLL)

     These structures gives the name of the imported DLL and
     points to an array of function pointers.

     This said array is known as the import address table (IAT).

     Each imported API has its own reserved spot in the IAT where
     the address of the imported function is written by the
     Windows PE loader.

     This last point is particularly important: once a module is
     loaded, the IAT contains the address that is invoked when
     calling imported APIs.

     We encourage you to read the Portable Executable File
     article from Matt Pietrek at http://msdn.microsoft.com/en-
 ORIGINAL SWISS ETHICAL HACKING
     us/magazine/cc301805.aspx
                    ©2011 High-Tech Bridge SA – www.htbridge.ch
FINDING THE IMPORT ADDRESS TABLE               (1)




  . Your texte here ….




 ORIGINAL SWISS ETHICAL HACKING                            From Matt Pietrek Portable Executable Article


                    ©2011 High-Tech Bridge SA – www.htbridge.ch
FROM THE IAT TO THE API CODE

                                                                API pointer in little endian
    Your texte here ….




                                                             CALL DWORD PTR DS:[10010F4]




  Immunity Debugger
  – All Intermodular
         calls




 ORIGINAL SWISS ETHICAL HACKING
                       ©2011 High-Tech Bridge SA – www.htbridge.ch
LOOKING BEYOND YOUR BORDERS – DLL INJECTION



     DLL injection is a technique used to run
    Your texte here ….
     code within the address space of another
     process by forcing it to load a dynamic-link
     library.

     It is often used by third-party developers.

     Usually to influence the behavior of a
     program in a way its authors did not expect
     it.

     For example, the injected code could trap
     system function calls, or read the contents
     of password textboxes, which cannot be
     done the usual way.
 ORIGINAL SWISS ETHICAL HACKING
                    ©2011 High-Tech Bridge SA – www.htbridge.ch
HOW-
DLL INJECTION HOW-TO                    (1)




    In Windows 7 as
   Your texte here ….in other flavours, there are
    three different techniques to inject a DLL
    into the user space of another process.

     – Using the registry.

     – A handy API named SetWindowsHookEx.
                         SetWindowsHookEx


     – Creating a remote thread.




ORIGINAL SWISS ETHICAL HACKING
                   ©2011 High-Tech Bridge SA – www.htbridge.ch
USING THE WINDOWS REGISTRY                          (2)
                                                    (2)




     In the RegistryKey:
    Your texte here ….
     HKEY_LOCAL_MACHINESoftwareMicrosoft
     Windows NTCurrentVersionWindows exist
     two entries named AppInit_DLLs and
     LoadAppInit_DLLs.
     LoadAppInit_DLLs

     When an application using the module
     user32
     user32.dll is loaded, the DLL contain in
         32.
     AppInit_DLLs entry will be loaded into the
     address space of the application.

     The job is done using LoadLibrary function.


 ORIGINAL SWISS ETHICAL HACKING
                    ©2011 High-Tech Bridge SA – www.htbridge.ch
USING THE WINDOWS REGISTRY                          (3)




    Your texte here ….




 ORIGINAL SWISS ETHICAL HACKING
                    ©2011 High-Tech Bridge SA – www.htbridge.ch
USING SETWINDOWSHOOKEX FUNCTION                                (4)




    Your texte here …. events messages for many events in the computer
     Windows programs receive
     that related to the application.

     For example, a program could receive event messages when a mouse button
     is pushed.

     SetWindowsHookEx is a function that makes possible to hook window
     messages in other processes.
                       processes

      –   The type of hook procedure to be installed. (idHook
                                                       idHook)
                                                       idHook
      –   A pointer to the hook procedure. (lpfn
                                            lpfn)
                                            lpfn
      –   A handle to the DLL containing the hook procedure pointed to by the lpfn parameter. (hMod
                                                                                               hMod)
                                                                                               hMod
      –   The identifier of the thread with which the hook procedure is to be associated. If zero, the
          hook procedure is associated with all existing threads running in the same desktop.
          (dwThreadId
           dwThreadId)
           dwThreadId




     This function will load efficiently the DLL into another application address
     space.




 ORIGINAL SWISS ETHICAL HACKING
                            ©2011 High-Tech Bridge SA – www.htbridge.ch
USING SETWINDOWSHOOKEX FUNCTION                   (5)




    Your texte here ….




 ORIGINAL SWISS ETHICAL HACKING
                    ©2011 High-Tech Bridge SA – www.htbridge.ch
USING CREATEREMOTETHREAD FUNCTION                          (6)




    Your API takes the….
     The texte here following parameters:

      –   A handle to the process in which the thread is to be created. (hProcess
                                                                           hProcess)
                                                                           hProcess
      –   A pointer to a SECURITY_ATTRIBUTES structure that specifies a security
          descriptor for the new thread.(lpThreadAttributes
                                             lpThreadAttributes)
                                             lpThreadAttributes
      –   The initial size of the stack, in bytes. (dwStackSize
                                                    dwStackSize)
                                                    dwStackSize
      –   A     pointer      to     the     application-defined    function     of    type
          LPTHREAD_START_ROUTINE to be executed by the thread. (lpStartAddress
                                                                       lpStartAddress)
                                                                       lpStartAddress
      –   A pointer to a variable to be passed to the thread function. (lpParameter
                                                                          lpParameter)
                                                                          lpParameter
      –                                                          dwCreationFlags)
          The flags that control the creation of the thread. (dwCreationFlags
                                                                 dwCreationFlags
      –   A pointer to a variable that receives the thread identifier. (lpThreadId
                                                                        lpThreadId)
                                                                        lpThreadId




     To   accomplish  the   task   of   injecting  a                      DLL      using
     CreateRemoteThread we need to follow four steps:

      –   Open the target process.
      –   Allocate memory in the target process.
      –   Write the name of our DLL in the target process.
      –   Create the thread.
 ORIGINAL SWISS ETHICAL HACKING
                         ©2011 High-Tech Bridge SA – www.htbridge.ch
USING CREATEREMOTETHREAD FUNCTION                    (7)




    Your texte here ….




                                                           We inject our DLL into the
                                                                cmd.exe process


 ORIGINAL SWISS ETHICAL HACKING
                    ©2011 High-Tech Bridge SA – www.htbridge.ch
HOOKING THE IAT PRACTICAL EXAMPLE


    Your texte here ….
     In this practical example                              our   target
     application is cmd.exe

     We want to hide a file from a dir command.

     To accomplish this we will hook the function
     FindNextFileW     API      imported    from
     kernel32
     kernel32.dll module to skip our secret file
           32.
     from the listing.


     This is just a basic example as Userland
                          example,
     hooks are not the best choice to hide files.
 ORIGINAL SWISS ETHICAL HACKING
                    ©2011 High-Tech Bridge SA – www.htbridge.ch
MODIFYING THE IMPORT ADDRESS TABLE                 (1)




    Your texte here …. the API pointer of FindNextFileW
     Before hooking
     we attach our debugger to cmd.exe process and
     we find the address of the target API:




 ORIGINAL SWISS ETHICAL HACKING
                    ©2011 High-Tech Bridge SA – www.htbridge.ch
MODIFYING THE IMPORT ADDRESS TABLE                 (2)




    Your texte heremode
     The initial ….   of the .text section is in
     Read Executable mode.




 ORIGINAL SWISS ETHICAL HACKING
                    ©2011 High-Tech Bridge SA – www.htbridge.ch
MODIFYING THE IMPORT ADDRESS TABLE                 (3)




     When we list    the files from the Test
    Your texte here ….
     subdirectory we obtain the following listing:




 ORIGINAL SWISS ETHICAL HACKING
                    ©2011 High-Tech Bridge SA – www.htbridge.ch
MODIFYING THE IMPORT ADDRESS TABLE                 (4)




     After hooking  the function we can see
    Your texte here ….
     that the IAT pointer to FindNextFileW Api
     has changed.




 ORIGINAL SWISS ETHICAL HACKING
                    ©2011 High-Tech Bridge SA – www.htbridge.ch
MODIFYING THE IMPORT ADDRESS TABLE                 (5)




    Your texte here ….
     The initial mode of the .text section was in
     Read Executable mode, now it is in Read
     Write Executable.

     We can see that our DLL was injected at
     0x613C0000 base address.
       613C




 ORIGINAL SWISS ETHICAL HACKING
                    ©2011 High-Tech Bridge SA – www.htbridge.ch
MODIFYING THE IMPORT ADDRESS TABLE                 (6)




    Your this time ….
     At texte here when we list the files from the
     Test subdirectory we do not see any more
     the “secret.txt” file.
         “secret.




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

   Your texte here ….
    Very easy to discover.

    With     late-demand      binding,   function
    addresses are not resolved until the
    function is called. As the function will no
    have an entry in the IAT, the hook will not be
    possible.

    If the application uses LoadLibrary and
    GetProcAddress to find addresses during
    runtime, the IAT hook will not work.


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

   Your texte here ….
    We can detect it manually, by attaching the
    target process to our debugger, or
    automatically, with tools like HookExplorer
    from Idefense
         Idefense.




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

    IAT hooking has
   Your texte here ….some drawbacks, but it is a
    powerful technique yet rather simple.
    Furthermore, this type of hooking is also
    used by the OS. One trying to determine
    what hook is benign and malicious could be a
    tedious task.

    Detection is very easy.

    This is not          a     method          used        in    powerful
    rootkits.

    We want definitively to go forward and hook
    functions into the kernel-land.
ORIGINAL SWISS ETHICAL HACKING
                   ©2011 High-Tech Bridge SA – www.htbridge.ch
TO BE CONTINUED

   Your texte here ….




    In future documents we will discuss Inline
    Hooking,
    Hooking and an introduction to Kernel
    Hooking.
    Hooking




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

    Your texte here ….Windows Kernel (Greg Hoglund &
     Subverting the
     James Butler)
     Professional Rootkits (Ric Vieler)
     http://en.wikipedia.org/wiki/Ring_%28computer_securi
     ty%29#Interoperation_between_CPU_and_OS_levels_
     of_abstraction
     http://www.wheaty.net/
     Programming application for Microsoft Windows
     fourth edition (Jeffrey Ritchter)
     http://msdn.microsoft.com/en-
     us/magazine/cc301805.aspx
     Programming Windows Security (Keith Brown)
     http://en.wikipedia.org/wiki/Ring_%28computer_securi
     ty%29
     http://www.nytimes.com/2005/11/19/business/media/19
     online.html
     http://en.wikipedia.org/wiki/DLL_injection
     http://support.microsoft.com/kb/197571

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

    Your texte here ….




                Thank-you for reading.
          Your questions are always welcome!
                          brian.mariani@htbridge.ch




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

Contenu connexe

Tendances

Taking Hunting to the Next Level: Hunting in Memory
Taking Hunting to the Next Level: Hunting in MemoryTaking Hunting to the Next Level: Hunting in Memory
Taking Hunting to the Next Level: Hunting in MemoryJoe Desimone
 
Securité des applications web
Securité des applications webSecurité des applications web
Securité des applications webMarcel TCHOULEGHEU
 
Sécurité des applications web: attaque et défense
Sécurité des applications web: attaque et défenseSécurité des applications web: attaque et défense
Sécurité des applications web: attaque et défenseAntonio Fontes
 
Hacking With Nmap - Scanning Techniques
Hacking With Nmap - Scanning TechniquesHacking With Nmap - Scanning Techniques
Hacking With Nmap - Scanning Techniquesamiable_indian
 
Process injection - Malware style
Process injection - Malware styleProcess injection - Malware style
Process injection - Malware styleSander Demeester
 
Make static instrumentation great again, High performance fuzzing for Windows...
Make static instrumentation great again, High performance fuzzing for Windows...Make static instrumentation great again, High performance fuzzing for Windows...
Make static instrumentation great again, High performance fuzzing for Windows...Lucas Leong
 
Practical Malware Analysis: Ch 11: Malware Behavior
Practical Malware Analysis: Ch 11: Malware BehaviorPractical Malware Analysis: Ch 11: Malware Behavior
Practical Malware Analysis: Ch 11: Malware BehaviorSam Bowne
 
SGX Trusted Execution Environment
SGX Trusted Execution EnvironmentSGX Trusted Execution Environment
SGX Trusted Execution EnvironmentKernel TLV
 
Insecure coding in C (and C++)
Insecure coding in C (and C++)Insecure coding in C (and C++)
Insecure coding in C (and C++)Olve Maudal
 
SSH - Secure Shell
SSH - Secure ShellSSH - Secure Shell
SSH - Secure ShellSouhaib El
 
Social Engineering the Windows Kernel by James Forshaw
Social Engineering the Windows Kernel by James ForshawSocial Engineering the Windows Kernel by James Forshaw
Social Engineering the Windows Kernel by James ForshawShakacon
 
Java - programmation concurrente
Java - programmation concurrenteJava - programmation concurrente
Java - programmation concurrenteFranck SIMON
 
Windows Threat Hunting
Windows Threat HuntingWindows Threat Hunting
Windows Threat HuntingGIBIN JOHN
 
Windows Operating System Archaeology
Windows Operating System ArchaeologyWindows Operating System Archaeology
Windows Operating System Archaeologyenigma0x3
 
Detection Rules Coverage
Detection Rules CoverageDetection Rules Coverage
Detection Rules CoverageSunny Neo
 
Mohamed youssfi support architectures logicielles distribuées basées sue les ...
Mohamed youssfi support architectures logicielles distribuées basées sue les ...Mohamed youssfi support architectures logicielles distribuées basées sue les ...
Mohamed youssfi support architectures logicielles distribuées basées sue les ...ENSET, Université Hassan II Casablanca
 
Attacker's Perspective of Active Directory
Attacker's Perspective of Active DirectoryAttacker's Perspective of Active Directory
Attacker's Perspective of Active DirectorySunny Neo
 

Tendances (20)

Taking Hunting to the Next Level: Hunting in Memory
Taking Hunting to the Next Level: Hunting in MemoryTaking Hunting to the Next Level: Hunting in Memory
Taking Hunting to the Next Level: Hunting in Memory
 
Pare feu
Pare feuPare feu
Pare feu
 
Securité des applications web
Securité des applications webSecurité des applications web
Securité des applications web
 
Sécurité des applications web: attaque et défense
Sécurité des applications web: attaque et défenseSécurité des applications web: attaque et défense
Sécurité des applications web: attaque et défense
 
Ch5 array nota
Ch5 array notaCh5 array nota
Ch5 array nota
 
Hacking With Nmap - Scanning Techniques
Hacking With Nmap - Scanning TechniquesHacking With Nmap - Scanning Techniques
Hacking With Nmap - Scanning Techniques
 
Process injection - Malware style
Process injection - Malware styleProcess injection - Malware style
Process injection - Malware style
 
Make static instrumentation great again, High performance fuzzing for Windows...
Make static instrumentation great again, High performance fuzzing for Windows...Make static instrumentation great again, High performance fuzzing for Windows...
Make static instrumentation great again, High performance fuzzing for Windows...
 
Session hijacking
Session hijackingSession hijacking
Session hijacking
 
Practical Malware Analysis: Ch 11: Malware Behavior
Practical Malware Analysis: Ch 11: Malware BehaviorPractical Malware Analysis: Ch 11: Malware Behavior
Practical Malware Analysis: Ch 11: Malware Behavior
 
SGX Trusted Execution Environment
SGX Trusted Execution EnvironmentSGX Trusted Execution Environment
SGX Trusted Execution Environment
 
Insecure coding in C (and C++)
Insecure coding in C (and C++)Insecure coding in C (and C++)
Insecure coding in C (and C++)
 
SSH - Secure Shell
SSH - Secure ShellSSH - Secure Shell
SSH - Secure Shell
 
Social Engineering the Windows Kernel by James Forshaw
Social Engineering the Windows Kernel by James ForshawSocial Engineering the Windows Kernel by James Forshaw
Social Engineering the Windows Kernel by James Forshaw
 
Java - programmation concurrente
Java - programmation concurrenteJava - programmation concurrente
Java - programmation concurrente
 
Windows Threat Hunting
Windows Threat HuntingWindows Threat Hunting
Windows Threat Hunting
 
Windows Operating System Archaeology
Windows Operating System ArchaeologyWindows Operating System Archaeology
Windows Operating System Archaeology
 
Detection Rules Coverage
Detection Rules CoverageDetection Rules Coverage
Detection Rules Coverage
 
Mohamed youssfi support architectures logicielles distribuées basées sue les ...
Mohamed youssfi support architectures logicielles distribuées basées sue les ...Mohamed youssfi support architectures logicielles distribuées basées sue les ...
Mohamed youssfi support architectures logicielles distribuées basées sue les ...
 
Attacker's Perspective of Active Directory
Attacker's Perspective of Active DirectoryAttacker's Perspective of Active Directory
Attacker's Perspective of Active Directory
 

En vedette

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 attacksHigh-Tech Bridge SA (HTBridge)
 
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 ThreatHigh-Tech Bridge SA (HTBridge)
 
Defeating Data Execution Prevention and ASLR in Windows
Defeating Data Execution Prevention and ASLR in WindowsDefeating Data Execution Prevention and ASLR in Windows
Defeating Data Execution Prevention and ASLR in WindowsHigh-Tech Bridge SA (HTBridge)
 
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 attackHigh-Tech Bridge SA (HTBridge)
 
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 attacksHigh-Tech Bridge SA (HTBridge)
 
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 techniquesenSilo
 
Ma oun special education presntation10
Ma oun special education presntation10Ma oun special education presntation10
Ma oun special education presntation10Maha Khan
 
Presupuesto de publicidad brisa
Presupuesto de publicidad brisaPresupuesto de publicidad brisa
Presupuesto de publicidad brisaJavier Banda
 
Михайлова Е.В. Особенности PR-сопровождения вывода на рынок ТИКО
Михайлова Е.В. Особенности PR-сопровождения вывода на рынок  ТИКОМихайлова Е.В. Особенности PR-сопровождения вывода на рынок  ТИКО
Михайлова Е.В. Особенности PR-сопровождения вывода на рынок ТИКОprasu1995
 
Roll out summary dealer caring project 2013
Roll out summary dealer caring project 2013Roll out summary dealer caring project 2013
Roll out summary dealer caring project 2013Jumanto Jmt
 
エンタングルメントコストの解析とホレボ容量の計算
エンタングルメントコストの解析とホレボ容量の計算エンタングルメントコストの解析とホレボ容量の計算
エンタングルメントコストの解析とホレボ容量の計算Toshiyuki Shimono
 
信息技术作业
信息技术作业信息技术作业
信息技术作业wangqian1990
 
Lap trinh php va my sql
Lap trinh php va my sqlLap trinh php va my sql
Lap trinh php va my sqlhieusy
 

En vedette (20)

Inline Hooking in Windows
Inline Hooking in WindowsInline Hooking in Windows
Inline Hooking in Windows
 
Spying Internet Explorer 8.0
Spying Internet Explorer 8.0Spying Internet Explorer 8.0
Spying Internet Explorer 8.0
 
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
 
Manipulating Memory for Fun & Profit
Manipulating Memory for Fun & ProfitManipulating Memory for Fun & Profit
Manipulating Memory for Fun & Profit
 
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
 
Defeating Data Execution Prevention and ASLR in Windows
Defeating Data Execution Prevention and ASLR in WindowsDefeating Data Execution Prevention and ASLR in Windows
Defeating Data Execution Prevention and ASLR in Windows
 
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
 
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
 
Ma oun special education presntation10
Ma oun special education presntation10Ma oun special education presntation10
Ma oun special education presntation10
 
Presupuesto de publicidad brisa
Presupuesto de publicidad brisaPresupuesto de publicidad brisa
Presupuesto de publicidad brisa
 
Михайлова Е.В. Особенности PR-сопровождения вывода на рынок ТИКО
Михайлова Е.В. Особенности PR-сопровождения вывода на рынок  ТИКОМихайлова Е.В. Особенности PR-сопровождения вывода на рынок  ТИКО
Михайлова Е.В. Особенности PR-сопровождения вывода на рынок ТИКО
 
test
testtest
test
 
Roll out summary dealer caring project 2013
Roll out summary dealer caring project 2013Roll out summary dealer caring project 2013
Roll out summary dealer caring project 2013
 
Caja parrafo
Caja parrafoCaja parrafo
Caja parrafo
 
エンタングルメントコストの解析とホレボ容量の計算
エンタングルメントコストの解析とホレボ容量の計算エンタングルメントコストの解析とホレボ容量の計算
エンタングルメントコストの解析とホレボ容量の計算
 
信息技术作业
信息技术作业信息技术作业
信息技术作业
 
4 pemusatan data
4 pemusatan data4 pemusatan data
4 pemusatan data
 
Lap trinh php va my sql
Lap trinh php va my sqlLap trinh php va my sql
Lap trinh php va my sql
 

Similaire à Userland Hooking in Windows

The Role of Standards in IoT Security
The Role of Standards in IoT SecurityThe Role of Standards in IoT Security
The Role of Standards in IoT SecurityHannes Tschofenig
 
Stage 1 Tradecraft
Stage 1 TradecraftStage 1 Tradecraft
Stage 1 Tradecraftmatt806068
 
Addressing New Challenges in Software Protection for .NET
Addressing New Challenges in Software Protection for .NETAddressing New Challenges in Software Protection for .NET
Addressing New Challenges in Software Protection for .NETLicensingLive! - SafeNet
 
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 DayArik Weinstein
 
How to design Programs using VHDL
How to design Programs using VHDLHow to design Programs using VHDL
How to design Programs using VHDLEutectics
 
iOS (Vulner)ability
iOS (Vulner)abilityiOS (Vulner)ability
iOS (Vulner)abilitySubho Halder
 
Captain Hook: Pirating AVs to Bypass Exploit Mitigations
Captain Hook: Pirating AVs to Bypass Exploit MitigationsCaptain Hook: Pirating AVs to Bypass Exploit Mitigations
Captain Hook: Pirating AVs to Bypass Exploit MitigationsenSilo
 
Piratng Avs to bypass exploit mitigation
Piratng Avs to bypass exploit mitigationPiratng Avs to bypass exploit mitigation
Piratng Avs to bypass exploit mitigationPriyanka Aash
 
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 vulnerabilityHigh-Tech Bridge SA (HTBridge)
 
Introduction to Networking | Linux-Unix and System Administration | Docker an...
Introduction to Networking | Linux-Unix and System Administration | Docker an...Introduction to Networking | Linux-Unix and System Administration | Docker an...
Introduction to Networking | Linux-Unix and System Administration | Docker an...andega
 
CoreOS and cloud provider integration: simple cloud-init example at Exoscale
CoreOS and cloud provider integration: simple cloud-init example at ExoscaleCoreOS and cloud provider integration: simple cloud-init example at Exoscale
CoreOS and cloud provider integration: simple cloud-init example at ExoscaleAntoine COETSIER
 
Raspberry pi Part 1
 Raspberry pi Part 1 Raspberry pi Part 1
Raspberry pi Part 1Techvilla
 
01_Metasploit - The Elixir of Network Security
01_Metasploit - The Elixir of Network Security01_Metasploit - The Elixir of Network Security
01_Metasploit - The Elixir of Network SecurityHarish Chaudhary
 

Similaire à Userland Hooking in Windows (20)

The Role of Standards in IoT Security
The Role of Standards in IoT SecurityThe Role of Standards in IoT Security
The Role of Standards in IoT Security
 
Stage 1 Tradecraft
Stage 1 TradecraftStage 1 Tradecraft
Stage 1 Tradecraft
 
Addressing New Challenges in Software Protection for .NET
Addressing New Challenges in Software Protection for .NETAddressing New Challenges in Software Protection for .NET
Addressing New Challenges in Software Protection for .NET
 
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
 
How to design Programs using VHDL
How to design Programs using VHDLHow to design Programs using VHDL
How to design Programs using VHDL
 
Ceh v5 module 18 linux hacking
Ceh v5 module 18 linux hackingCeh v5 module 18 linux hacking
Ceh v5 module 18 linux hacking
 
iOS (Vulner)ability
iOS (Vulner)abilityiOS (Vulner)ability
iOS (Vulner)ability
 
Captain Hook: Pirating AVs to Bypass Exploit Mitigations
Captain Hook: Pirating AVs to Bypass Exploit MitigationsCaptain Hook: Pirating AVs to Bypass Exploit Mitigations
Captain Hook: Pirating AVs to Bypass Exploit Mitigations
 
Piratng Avs to bypass exploit mitigation
Piratng Avs to bypass exploit mitigationPiratng Avs to bypass exploit mitigation
Piratng Avs to bypass exploit mitigation
 
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
 
kali linux.pptx
kali linux.pptxkali linux.pptx
kali linux.pptx
 
Introduction to Networking | Linux-Unix and System Administration | Docker an...
Introduction to Networking | Linux-Unix and System Administration | Docker an...Introduction to Networking | Linux-Unix and System Administration | Docker an...
Introduction to Networking | Linux-Unix and System Administration | Docker an...
 
Operating system
Operating systemOperating system
Operating system
 
kali linux.pptx
kali linux.pptxkali linux.pptx
kali linux.pptx
 
Sectools
SectoolsSectools
Sectools
 
aaa
aaaaaa
aaa
 
CoreOS and cloud provider integration: simple cloud-init example at Exoscale
CoreOS and cloud provider integration: simple cloud-init example at ExoscaleCoreOS and cloud provider integration: simple cloud-init example at Exoscale
CoreOS and cloud provider integration: simple cloud-init example at Exoscale
 
Raspberry pi Part 1
 Raspberry pi Part 1 Raspberry pi Part 1
Raspberry pi Part 1
 
Dot net Introduction and their usabilities
Dot net Introduction and  their usabilitiesDot net Introduction and  their usabilities
Dot net Introduction and their usabilities
 
01_Metasploit - The Elixir of Network Security
01_Metasploit - The Elixir of Network Security01_Metasploit - The Elixir of Network Security
01_Metasploit - The Elixir of Network Security
 

Dernier

DevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsDevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsSergiu Bodiu
 
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek SchlawackFwdays
 
Connect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationConnect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationSlibray Presentation
 
Commit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyCommit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyAlfredo García Lavilla
 
Scanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsScanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsRizwan Syed
 
The Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsThe Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsPixlogix Infotech
 
How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.Curtis Poe
 
DSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine TuningDSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine TuningLars Bell
 
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024BookNet Canada
 
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Mark Simos
 
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdf
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdfHyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdf
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdfPrecisely
 
Take control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test SuiteTake control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test SuiteDianaGray10
 
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage CostLeverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage CostZilliz
 
Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!Manik S Magar
 
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc
 
SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024Lorenzo Miniero
 
Gen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfGen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfAddepto
 
Streamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupStreamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupFlorian Wilhelm
 
Developer Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLDeveloper Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLScyllaDB
 

Dernier (20)

DevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsDevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platforms
 
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
 
Connect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationConnect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck Presentation
 
Commit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyCommit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easy
 
Scanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsScanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL Certs
 
The Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsThe Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and Cons
 
How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.
 
DSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine TuningDSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine Tuning
 
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
 
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
 
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdf
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdfHyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdf
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdf
 
Take control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test SuiteTake control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test Suite
 
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage CostLeverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
 
Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!
 
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
 
DMCC Future of Trade Web3 - Special Edition
DMCC Future of Trade Web3 - Special EditionDMCC Future of Trade Web3 - Special Edition
DMCC Future of Trade Web3 - Special Edition
 
SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024
 
Gen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfGen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdf
 
Streamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupStreamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project Setup
 
Developer Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLDeveloper Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQL
 

Userland Hooking in Windows

  • 1. Your texte here …. Userland Hooking in Windows 03 August 2011 Brian MARIANI Senior Security Consultant ORIGINAL SWISS ETHICAL HACKING ©2011 High-Tech Bridge SA – www.htbridge.ch
  • 2. SOME IMPORTANT POINTS Your texte here …. This document is the first of a series of five articles relating to the art of hooking. As a test environment we will use an english Windows Seven SP1 operating system distribution. ORIGINAL SWISS ETHICAL HACKING ©2011 High-Tech Bridge SA – www.htbridge.ch
  • 3. WHAT IS HOOKING? Your texte here …. In the sphere of computer security, the term hooking enclose a range of different techniques. These methods are used to alter the behavior of an operating system by intercepting function calls, messages or events passed between software components. A piece of code that handles intercepted function calls, is called a hook. ORIGINAL SWISS ETHICAL HACKING ©2011 High-Tech Bridge SA – www.htbridge.ch
  • 4. THE WHITE SIDE OF HOOKING TECHNIQUES? The control of Your texte here …. an Application programming interface (API) call is very useful and enables programmers to track invisible actions that occur during the applications calls. It contributes to comprehensive validation of parameters. Reports issues that frequently remain unnoticed. API hooking has merited a reputation for being one of the most widespread debugging techniques. Hooking is also quite advantageous technique for interpreting poorly documented APIs. ORIGINAL SWISS ETHICAL HACKING ©2011 High-Tech Bridge SA – www.htbridge.ch
  • 5. THE BLACK SIDE OF HOOKING TECHNIQUES? Hooking can Your texte here …. alter the normal code execution of Windows APIs by injecting hooks. This technique is often used to change the behavior of well known Windows APIs. This practice is implemented in a set of programs and code that allows a permanent, consistent or undetectable presence in a previously attacked system. This set of programs used to control a system while hiding his presence is know as a ROOTKIT. ORIGINAL SWISS ETHICAL HACKING ©2011 High-Tech Bridge SA – www.htbridge.ch
  • 6. WHY DO ROOTKITS EXIST? Your texte here …. human beings characteristics is One of the most curiosity, curiosity remember Adam and Eve story. People want to see or control what other people are doing and computers are a perfect target. A rootkit is convenient if and attacker desires to maintain access to a system. They often provide two main primary functions: – Remote Command and Control. – Software eavesdropping. ORIGINAL SWISS ETHICAL HACKING ©2011 High-Tech Bridge SA – www.htbridge.ch
  • 7. USERLAND ROOTKITS In computing, hierarchical protection domains, often called Your texte here …. protection rings, are a mechanism to protect data and rings functionality from faults and malicious behavior. Userland rootkits run in (Ring 3) privilege mode. They use a Ring variety of methods to hide themselves, such as: Least privileged Ring 3 Ring 2 Ring 1 – Hide their processes – Hide registry keys – Hide files, windows and handles. Ring 0 Kernel System Device Drivers Device Drivers Applications Most privileged For example a userland rootkit who wants to hide registry information from a windows application which uses libraries such as user32.dll, kernel32.dll, or Advapi32.dll. ORIGINAL SWISS ETHICAL HACKING ©2011 High-Tech Bridge SA – www.htbridge.ch
  • 8. KERNEL- KERNEL-LAND ROOTKITS Your texte rootkits Kernel here …. run with the most highest operating system privileges (Ring 0). Ring They add or replace pieces of code of the operating system to modify kernel behavior. Operating systems support kernel mode drivers, they run with the same privileges as the operating system itself. This class of rootkit has unrestricted security access. Kernel rootkits can be especially difficult to detect and remove because they operate at the same security level as the operating system itself. They are able to intercept or subvert the most trusted operating system. ORIGINAL SWISS ETHICAL HACKING ©2011 High-Tech Bridge SA – www.htbridge.ch
  • 9. AN AMUSING ROOTKIT STORY Your texte here …. More.. ORIGINAL SWISS ETHICAL HACKING ©2011 High-Tech Bridge SA – www.htbridge.ch
  • 10. WHAT IS THE IMPORT ADDRESS TABLE Inside a Windows Portable Executable (PE) file, there is an Your texte here …. array of data structures, one for every imported Dynamic Link Library (DLL) These structures gives the name of the imported DLL and points to an array of function pointers. This said array is known as the import address table (IAT). Each imported API has its own reserved spot in the IAT where the address of the imported function is written by the Windows PE loader. This last point is particularly important: once a module is loaded, the IAT contains the address that is invoked when calling imported APIs. We encourage you to read the Portable Executable File article from Matt Pietrek at http://msdn.microsoft.com/en- ORIGINAL SWISS ETHICAL HACKING us/magazine/cc301805.aspx ©2011 High-Tech Bridge SA – www.htbridge.ch
  • 11. FINDING THE IMPORT ADDRESS TABLE (1) . Your texte here …. ORIGINAL SWISS ETHICAL HACKING From Matt Pietrek Portable Executable Article ©2011 High-Tech Bridge SA – www.htbridge.ch
  • 12. FROM THE IAT TO THE API CODE API pointer in little endian Your texte here …. CALL DWORD PTR DS:[10010F4] Immunity Debugger – All Intermodular calls ORIGINAL SWISS ETHICAL HACKING ©2011 High-Tech Bridge SA – www.htbridge.ch
  • 13. LOOKING BEYOND YOUR BORDERS – DLL INJECTION DLL injection is a technique used to run Your texte here …. code within the address space of another process by forcing it to load a dynamic-link library. It is often used by third-party developers. Usually to influence the behavior of a program in a way its authors did not expect it. For example, the injected code could trap system function calls, or read the contents of password textboxes, which cannot be done the usual way. ORIGINAL SWISS ETHICAL HACKING ©2011 High-Tech Bridge SA – www.htbridge.ch
  • 14. HOW- DLL INJECTION HOW-TO (1) In Windows 7 as Your texte here ….in other flavours, there are three different techniques to inject a DLL into the user space of another process. – Using the registry. – A handy API named SetWindowsHookEx. SetWindowsHookEx – Creating a remote thread. ORIGINAL SWISS ETHICAL HACKING ©2011 High-Tech Bridge SA – www.htbridge.ch
  • 15. USING THE WINDOWS REGISTRY (2) (2) In the RegistryKey: Your texte here …. HKEY_LOCAL_MACHINESoftwareMicrosoft Windows NTCurrentVersionWindows exist two entries named AppInit_DLLs and LoadAppInit_DLLs. LoadAppInit_DLLs When an application using the module user32 user32.dll is loaded, the DLL contain in 32. AppInit_DLLs entry will be loaded into the address space of the application. The job is done using LoadLibrary function. ORIGINAL SWISS ETHICAL HACKING ©2011 High-Tech Bridge SA – www.htbridge.ch
  • 16. USING THE WINDOWS REGISTRY (3) Your texte here …. ORIGINAL SWISS ETHICAL HACKING ©2011 High-Tech Bridge SA – www.htbridge.ch
  • 17. USING SETWINDOWSHOOKEX FUNCTION (4) Your texte here …. events messages for many events in the computer Windows programs receive that related to the application. For example, a program could receive event messages when a mouse button is pushed. SetWindowsHookEx is a function that makes possible to hook window messages in other processes. processes – The type of hook procedure to be installed. (idHook idHook) idHook – A pointer to the hook procedure. (lpfn lpfn) lpfn – A handle to the DLL containing the hook procedure pointed to by the lpfn parameter. (hMod hMod) hMod – The identifier of the thread with which the hook procedure is to be associated. If zero, the hook procedure is associated with all existing threads running in the same desktop. (dwThreadId dwThreadId) dwThreadId This function will load efficiently the DLL into another application address space. ORIGINAL SWISS ETHICAL HACKING ©2011 High-Tech Bridge SA – www.htbridge.ch
  • 18. USING SETWINDOWSHOOKEX FUNCTION (5) Your texte here …. ORIGINAL SWISS ETHICAL HACKING ©2011 High-Tech Bridge SA – www.htbridge.ch
  • 19. USING CREATEREMOTETHREAD FUNCTION (6) Your API takes the…. The texte here following parameters: – A handle to the process in which the thread is to be created. (hProcess hProcess) hProcess – A pointer to a SECURITY_ATTRIBUTES structure that specifies a security descriptor for the new thread.(lpThreadAttributes lpThreadAttributes) lpThreadAttributes – The initial size of the stack, in bytes. (dwStackSize dwStackSize) dwStackSize – A pointer to the application-defined function of type LPTHREAD_START_ROUTINE to be executed by the thread. (lpStartAddress lpStartAddress) lpStartAddress – A pointer to a variable to be passed to the thread function. (lpParameter lpParameter) lpParameter – dwCreationFlags) The flags that control the creation of the thread. (dwCreationFlags dwCreationFlags – A pointer to a variable that receives the thread identifier. (lpThreadId lpThreadId) lpThreadId To accomplish the task of injecting a DLL using CreateRemoteThread we need to follow four steps: – Open the target process. – Allocate memory in the target process. – Write the name of our DLL in the target process. – Create the thread. ORIGINAL SWISS ETHICAL HACKING ©2011 High-Tech Bridge SA – www.htbridge.ch
  • 20. USING CREATEREMOTETHREAD FUNCTION (7) Your texte here …. We inject our DLL into the cmd.exe process ORIGINAL SWISS ETHICAL HACKING ©2011 High-Tech Bridge SA – www.htbridge.ch
  • 21. HOOKING THE IAT PRACTICAL EXAMPLE Your texte here …. In this practical example our target application is cmd.exe We want to hide a file from a dir command. To accomplish this we will hook the function FindNextFileW API imported from kernel32 kernel32.dll module to skip our secret file 32. from the listing. This is just a basic example as Userland example, hooks are not the best choice to hide files. ORIGINAL SWISS ETHICAL HACKING ©2011 High-Tech Bridge SA – www.htbridge.ch
  • 22. MODIFYING THE IMPORT ADDRESS TABLE (1) Your texte here …. the API pointer of FindNextFileW Before hooking we attach our debugger to cmd.exe process and we find the address of the target API: ORIGINAL SWISS ETHICAL HACKING ©2011 High-Tech Bridge SA – www.htbridge.ch
  • 23. MODIFYING THE IMPORT ADDRESS TABLE (2) Your texte heremode The initial …. of the .text section is in Read Executable mode. ORIGINAL SWISS ETHICAL HACKING ©2011 High-Tech Bridge SA – www.htbridge.ch
  • 24. MODIFYING THE IMPORT ADDRESS TABLE (3) When we list the files from the Test Your texte here …. subdirectory we obtain the following listing: ORIGINAL SWISS ETHICAL HACKING ©2011 High-Tech Bridge SA – www.htbridge.ch
  • 25. MODIFYING THE IMPORT ADDRESS TABLE (4) After hooking the function we can see Your texte here …. that the IAT pointer to FindNextFileW Api has changed. ORIGINAL SWISS ETHICAL HACKING ©2011 High-Tech Bridge SA – www.htbridge.ch
  • 26. MODIFYING THE IMPORT ADDRESS TABLE (5) Your texte here …. The initial mode of the .text section was in Read Executable mode, now it is in Read Write Executable. We can see that our DLL was injected at 0x613C0000 base address. 613C ORIGINAL SWISS ETHICAL HACKING ©2011 High-Tech Bridge SA – www.htbridge.ch
  • 27. MODIFYING THE IMPORT ADDRESS TABLE (6) Your this time …. At texte here when we list the files from the Test subdirectory we do not see any more the “secret.txt” file. “secret. ORIGINAL SWISS ETHICAL HACKING ©2011 High-Tech Bridge SA – www.htbridge.ch
  • 28. DRAWBACKS OF IAT HOOKING Your texte here …. Very easy to discover. With late-demand binding, function addresses are not resolved until the function is called. As the function will no have an entry in the IAT, the hook will not be possible. If the application uses LoadLibrary and GetProcAddress to find addresses during runtime, the IAT hook will not work. ORIGINAL SWISS ETHICAL HACKING ©2011 High-Tech Bridge SA – www.htbridge.ch
  • 29. DETECTING IAT HOOKING Your texte here …. We can detect it manually, by attaching the target process to our debugger, or automatically, with tools like HookExplorer from Idefense Idefense. ORIGINAL SWISS ETHICAL HACKING ©2011 High-Tech Bridge SA – www.htbridge.ch
  • 30. CONCLUSION IAT hooking has Your texte here ….some drawbacks, but it is a powerful technique yet rather simple. Furthermore, this type of hooking is also used by the OS. One trying to determine what hook is benign and malicious could be a tedious task. Detection is very easy. This is not a method used in powerful rootkits. We want definitively to go forward and hook functions into the kernel-land. ORIGINAL SWISS ETHICAL HACKING ©2011 High-Tech Bridge SA – www.htbridge.ch
  • 31. TO BE CONTINUED Your texte here …. In future documents we will discuss Inline Hooking, Hooking and an introduction to Kernel Hooking. Hooking ORIGINAL SWISS ETHICAL HACKING ©2011 High-Tech Bridge SA – www.htbridge.ch
  • 32. References Your texte here ….Windows Kernel (Greg Hoglund & Subverting the James Butler) Professional Rootkits (Ric Vieler) http://en.wikipedia.org/wiki/Ring_%28computer_securi ty%29#Interoperation_between_CPU_and_OS_levels_ of_abstraction http://www.wheaty.net/ Programming application for Microsoft Windows fourth edition (Jeffrey Ritchter) http://msdn.microsoft.com/en- us/magazine/cc301805.aspx Programming Windows Security (Keith Brown) http://en.wikipedia.org/wiki/Ring_%28computer_securi ty%29 http://www.nytimes.com/2005/11/19/business/media/19 online.html http://en.wikipedia.org/wiki/DLL_injection http://support.microsoft.com/kb/197571 ORIGINAL SWISS ETHICAL HACKING ©2011 High-Tech Bridge SA – www.htbridge.ch
  • 33. Thank- Thank-you for reading Your texte here …. Thank-you for reading. Your questions are always welcome! brian.mariani@htbridge.ch ORIGINAL SWISS ETHICAL HACKING ©2011 High-Tech Bridge SA – www.htbridge.ch