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




          Spying on Internet
          Explorer                     (Another inline hooking example)




28 September 2011

Brian MARIANI
Senior Security Consultant
ORIGINAL SWISS ETHICAL HACKING
                  ©2011 High-Tech Bridge SA – www.htbridge.ch
cybercrime key points

   Your textethe major problems that exist today in
     One of here ….
     the    internet   is  a   whole   underground
     marketplace.

   Business    ecosystem                 build         around    online
    cybercrime.

   The online criminals invest too much money                        in
    their targeted attacks.

   They are hiring programmers, testing people and
    their skills to achieved their evil purposes.

   Criminals study security professional's habits,
    to workaround the security defenses put in
    place.
 ORIGINAL SWISS ETHICAL HACKING
                    ©2011 High-Tech Bridge SA – www.htbridge.ch
Is it enought?

   Your texte here ….
     The CCIPS is the Computer                                    Crime   and
     Intellectual Property Section.

   Is  responsible    for   implementing                                 the
    Department's    national    strategies                                 in
    combating computer crimes worldwide.

   They prevents, investigates, and prosecutes
    computer crimes.

   They work with other government agencies,
    private sectors, academic institutions, and
    foreign counterparts.
 ORIGINAL SWISS ETHICAL HACKING
                    ©2011 High-Tech Bridge SA – www.htbridge.ch
But… Today reality remains this

    Your texte here ….




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

    Your texte here ….




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

   Your texte here ….
     Malicious      software  also known    as
     “Malware” can compromise the security and
     functionality of a computer.

   It can disrupt users privacy, damage
    computer files, stealing identities, or
    spontaneously opening unwanted internet
    links.

   It can be also used in what we call “a zombie
    army”, to mount distributed denial of service
    attacks (DDOS).

   Once installed in a computer it monitors the
    user‟s internet browsing habits.
 ORIGINAL SWISS ETHICAL HACKING
                    ©2011 High-Tech Bridge SA – www.htbridge.ch
Exploiting internet capabilities

   Your texte here …. use the global nature of
     Cybercriminals
     internet to take advantage.

   Internet is international, is a global system
    of interconnected computer networks.

   So as soon as a bulletproof webserver is
    taken down, the malware infrastructure
    moves rapidly to another internet location.

   They profit of the non-existence of a well
    organized international cybercrime police
    that could prevent these kind of operations.
 ORIGINAL SWISS ETHICAL HACKING
                    ©2011 High-Tech Bridge SA – www.htbridge.ch
The worst banks enemy

   Your texte here …. the „second bank crisis‟, and
     It‟s been called
     this time the cause is a piece of malcode.

   it can steal millions from online                             bank
    accounts with apparent impunity.

   It‟s name is Zeus or Zbot and it‟s really
    clever.

   A gang of just nineteen persons have stolen
    around 20 millions of pounds using it!



 ORIGINAL SWISS ETHICAL HACKING
                    ©2011 High-Tech Bridge SA – www.htbridge.ch
How easy it is to stole private information


    Your texte here …. case of Zeus Trojan, it uses inline
      In the particular
      hooking to take control over key components of
      microsoft windows applications.

      We already covered what inline hooking is in the previous
       article. Previous article

      In today example we are going to intercept and grab
       trivial information from internet explorer.

      The example covers inline hooking without using
       specifically a windows api, but a subroutine of
       InternetConnectW exported from wininet.dll.

      The goal is to demonstrate that possibilities about inline
       hooking are without limits if one take care of all the
       details.

      As a test environment we used an english windows seven
       distribution with internet explorer 8.0 version.


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



   Your texte here ….
     In this example we hook several wininet
     functions without necessarily using them.

   The goal is to show how easy a massive api
    hooking can be.

   The code can be modified to add more apis to
    the ApiName array.

   It exists three main functions:

      –   PatchPreamble
      –   CalculateAndWriteJump
      –   CalculateAndWriteTrampoline


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



   Your texte here ….
     Functions declared with the naked attribute are
     emitted without prolog or epilog code, enabling
     you to write your own custom prolog/epilog
     sequences using the inline assembler.

   since the naked directive is not available in dev-
    cpp x86 the PatchPreamble function will rewrite
    the hook function prolog with no operation (nop)
    opcodes. We can later take care of our own
    prolog if it‟s needed.




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



   Your texte here ….
     CalculateAndWriteJump will compute and
     write the jump code from the hooked api to
     our hook function, using the first 5 bytes.
     We are not disassembling the code first but
     assuming that we are dealing with a mov
     edi,edi – push ebp – mov ebp,esp prolog.




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



      CalculateAndWriteTrampoline will write the trampoline 300 bytes
      Your texte here ….
       later from the patched prolog. since we calculate around 400
       bytes for the hook function code, the gcc standard epilogue (POP
       EBP – RETN) will never be hit.

      It exists an identifier named ToTrampolineBytes that can be
       modified to add more space to inject our C or ASM code, but do
       not forget to add more nops instructions into the hook function,
       otherwise you will write out of borders.




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



   Your texte here ….
     This is the scenario once the Api is hooked. Example of
     InternetConnectW.



                                                                  1




       3                                  2




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



   Your we said before , we are not going to leverage
     As texte here ….
     any    wininet   api   but   a   subroutine    of
     InternetConnectW function.




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



   Your successfully hook this subroutine without
     To texte here ….
     hardcoding any address we:

       Add the number of bytes to reach the CALL Wininet.76845DCD to
        the address of InternetConnectW.




       From this address we take the next four bytes skipping the 0xE8
        opcode.




       Finally we add 5 more bytes.




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



   Your texte here ….
     Once the subroutine address is obtained we can
     follow the aforementioned steps:

       PatchPreamble.

       CalculateAndWriteJump.

       CalculateAndWriteTrampoline.




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



   Your texte here ….
     The hooked subroutine calls IdnToAscii Api
     exported from kernel32 module which
     converts an internationalized domain name
     (IDN) or another internationalized label to a
     Unicode representation of the ASCII string
     that represents the name in the Punycode
     transfer encoding syntax.

   As we are interested in intercepting all
    visited domain names we will grab each and
    every accessed website in ascii format from a
    stack buffer pointer.



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



    Your texte here ….




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



   Your texte here …. browses the Internet, some
     When the user
     websites causes the change of the stack
     ordering.

   This    is    a  normal   behavior   as
    InternetSetOptions API and others inter
    modular calls could change the stack in
    different ways.



   That‟s why it is important to analyse all the
    different behaviours when we start to hook
    windows internals procedures.

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



   Yourour example we will just put a condition
     In texte here ….
     to control a stack value.

   We analyse if from ebp register it exits the
    nServerPort    value   of   the   precedent
    InternetConnectW Api.

   This value can be 0x1BB or 0x50 which
    correspond to SSL or not SSL connection.

   If this value exists we know that two dwords
    upper we can find our pointer to the website
    name.
 ORIGINAL SWISS ETHICAL HACKING
                    ©2011 High-Tech Bridge SA – www.htbridge.ch
Practical example           (13)



   Your texte here ….
     we could implemented the example in other
     “simpler ways”, but doing things always in a
     easier and simpler way it‟s not always good
     to learn.

   Some hook function code was written in ansi
    C.

   other parts of code is injected as raw binary
    code.

   So let‟s see how the code is implemented.


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



    Your texte here ….
                                                 We test if the port connection value is 80 or 443. If
                                                 value is one of both we jump to 0x6ba011EC




                                                 If it‟s not we do nothing and we jump again into the
                                                 hooked subroutine after setting the stack correctly.




                                                We save three pointers that will be overwritten with
                                                fopen, fputs and fclose pointers.




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



    Your texte here ….




                          We search the aforementioned pointers


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



    Your texte here ….                           We push the path and filename, the append fopen
                                                 argument, and a carriage return character.




                                                 We open the file and grab the domain name, followed
                                                 by a carriage return, and we close the file handle.




                                                 We unstack arguments until we reach our saved
                                                 pointers.




                                                 We put the saved pointers at the same place they
                                                 were before.

 ORIGINAL SWISS ETHICAL HACKING
                    ©2011 High-Tech Bridge SA – www.htbridge.ch
Practical example           (17)



    Your texte here ….




                                                We do nothing until we reach the trampoline




                                                We set up the stack and we jump again into the
                                                internetconnectw subroutine.




 ORIGINAL SWISS ETHICAL HACKING
                    ©2011 High-Tech Bridge SA – www.htbridge.ch
Practical example           (18)



   Your texte here ….
     The implementation of the “raw binary code”
     could be done in many different ways.

   We can always optimize the assembler code.

   It is very important to not overcharged the
    application.

   If we add too much code                                the    program
    performance could suffer.

   Test the application to check if after the
    code injection the program behaviour
    remains the same.
 ORIGINAL SWISS ETHICAL HACKING
                    ©2011 High-Tech Bridge SA – www.htbridge.ch
Conclusions

   Your texte hereinformation
     Stealing       ….         from    well-known
     windows application remains very easy.

   More dangerous scenarios will steal all the
    information that the user send and receive,
    including, passwords, credit card numbers,
    and other sensitive data.

   Users must always protect themselves with
    proactive applications that detect and stop
    program injection on the fly.

   Do not rely only in “security programs” but
    in a proactive audit of your systems.
 ORIGINAL SWISS ETHICAL HACKING
                    ©2011 High-Tech Bridge SA – www.htbridge.ch
Thank-you for reading

    Your texte here ….




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




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

      http://www.bbc.co.uk/news/technology-10865568
      Your texte here ….
      http://www.darkreading.com/advanced-
       threats/167901091/security/attacks-breaches/231500619/worm-
       morphs-attacks-banks-with-zeus-like-features.html
      http://bits.blogs.nytimes.com/2009/08/20/how-hackers-snatch-real-time-
       security-id-numbers
      http://money.cnn.com/2010/09/30/technology/cyber_crime_charges/index
       .htm
      http://voices.washingtonpost.com/securityfix/2009/10/ubiquitous_zeus_
       trojan_targets.html
      http://www.youtube.com/watch?v=cf3zxHuSM2Y
      http://news.techworld.com/security/3241594/police-arrest-gang-
       behind-20-million-online-bank-fraud/
      http://www.cybercrime.gov/hackettPlea.pdf
      http://www.lemonde.fr/technologies/article/2010/10/01/etats-unis-les-
       autorites-inculpent-60-personnes-pour-
       cyberdelinquance_1418641_651865.html
      http://www.20minutos.es/noticia/830501/0/virus/telefonos/moviles/
      http://msdn.microsoft.com/en-us/library/dd318149%28v=vs.85%29.aspx
      http://blogs.techworld.com/war-on-error/2010/09/the-zeus-trojan-is-
       stealing-money-with-impunity-can-it-be-stopped/index.htm
 ORIGINAL SWISS ETHICAL HACKING
                       ©2011 High-Tech Bridge SA – www.htbridge.ch

Más contenido relacionado

Destacado

Web services using sales force.com
Web services using sales force.comWeb services using sales force.com
Web services using sales force.com
Vaishnavi
 
Gasteizko irteera 2D NAE
Gasteizko irteera 2D NAEGasteizko irteera 2D NAE
Gasteizko irteera 2D NAE
arbelar
 
The Spirituality Of Animals
The Spirituality Of AnimalsThe Spirituality Of Animals
The Spirituality Of Animals
docheart
 
賈伯斯與禪
賈伯斯與禪賈伯斯與禪
賈伯斯與禪
rita710
 
Double page construction
Double page constructionDouble page construction
Double page construction
Tyrrell
 

Destacado (16)

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
 
Process injection - Malware style
Process injection - Malware styleProcess injection - Malware style
Process injection - Malware style
 
Smart Lighting in Multipurpose Outdoor Environments: Energy Efficient Solutio...
Smart Lighting in Multipurpose Outdoor Environments: Energy Efficient Solutio...Smart Lighting in Multipurpose Outdoor Environments: Energy Efficient Solutio...
Smart Lighting in Multipurpose Outdoor Environments: Energy Efficient Solutio...
 
Web services using sales force.com
Web services using sales force.comWeb services using sales force.com
Web services using sales force.com
 
Gasteizko irteera 2D NAE
Gasteizko irteera 2D NAEGasteizko irteera 2D NAE
Gasteizko irteera 2D NAE
 
沒有所謂的end user:一個open source project網站的改版計畫
沒有所謂的end user:一個open source project網站的改版計畫沒有所謂的end user:一個open source project網站的改版計畫
沒有所謂的end user:一個open source project網站的改版計畫
 
Monserrat mayen diaz
Monserrat mayen diazMonserrat mayen diaz
Monserrat mayen diaz
 
Harmonizing Data for the Warehouse
Harmonizing Data for the WarehouseHarmonizing Data for the Warehouse
Harmonizing Data for the Warehouse
 
The Spirituality Of Animals
The Spirituality Of AnimalsThe Spirituality Of Animals
The Spirituality Of Animals
 
賈伯斯與禪
賈伯斯與禪賈伯斯與禪
賈伯斯與禪
 
Packaging research
Packaging researchPackaging research
Packaging research
 
Html in a box
Html in a boxHtml in a box
Html in a box
 
Les voyelles orales
Les voyelles oralesLes voyelles orales
Les voyelles orales
 
Double page construction
Double page constructionDouble page construction
Double page construction
 
具体例をいくつ観察すれば見たい対象の全体について理解出来るか
具体例をいくつ観察すれば見たい対象の全体について理解出来るか具体例をいくつ観察すれば見たい対象の全体について理解出来るか
具体例をいくつ観察すれば見たい対象の全体について理解出来るか
 

Similar a Spying Internet Explorer 8.0

20101109 (tech ed) how frameworks kill projects
20101109   (tech ed) how frameworks kill projects20101109   (tech ed) how frameworks kill projects
20101109 (tech ed) how frameworks kill projects
Sander Hoogendoorn
 

Similar a Spying Internet Explorer 8.0 (20)

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
 
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
 
20101109 (tech ed) how frameworks kill projects
20101109   (tech ed) how frameworks kill projects20101109   (tech ed) how frameworks kill projects
20101109 (tech ed) how frameworks kill projects
 
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)
 
News Bytes - May by corrupt
News Bytes - May by corruptNews Bytes - May by corrupt
News Bytes - May by corrupt
 
Threat modeling web application: a case study
Threat modeling web application: a case studyThreat modeling web application: a case study
Threat modeling web application: a case study
 
GeeCON Microservices 2015 scaling micro services at gilt
GeeCON Microservices 2015   scaling micro services at giltGeeCON Microservices 2015   scaling micro services at gilt
GeeCON Microservices 2015 scaling micro services at gilt
 
IoT Workshop in Macao
IoT Workshop in MacaoIoT Workshop in Macao
IoT Workshop in Macao
 
IoT Workshop in Macao
IoT Workshop in MacaoIoT Workshop in Macao
IoT Workshop in Macao
 
Goodbye CLI, hello API: Leveraging network programmability in security incid...
Goodbye CLI, hello API:  Leveraging network programmability in security incid...Goodbye CLI, hello API:  Leveraging network programmability in security incid...
Goodbye CLI, hello API: Leveraging network programmability in security incid...
 
The Internet of Fails - Mark Stanislav, Senior Security Consultant, Rapid7
The Internet of Fails - Mark Stanislav, Senior Security Consultant, Rapid7The Internet of Fails - Mark Stanislav, Senior Security Consultant, Rapid7
The Internet of Fails - Mark Stanislav, Senior Security Consultant, Rapid7
 
Introduction to the Container Networking and Security
Introduction to the Container Networking and SecurityIntroduction to the Container Networking and Security
Introduction to the Container Networking and Security
 
The dangers of black box devices.
The dangers of black box devices.The dangers of black box devices.
The dangers of black box devices.
 
voip_en
voip_envoip_en
voip_en
 
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
 
iOS Bootcamp: learning to create awesome apps on iOS using Swift (Lecture 7)
iOS Bootcamp: learning to create awesome apps on iOS using Swift (Lecture 7)iOS Bootcamp: learning to create awesome apps on iOS using Swift (Lecture 7)
iOS Bootcamp: learning to create awesome apps on iOS using Swift (Lecture 7)
 
maXbox starter30 Web of Things
maXbox starter30 Web of ThingsmaXbox starter30 Web of Things
maXbox starter30 Web of Things
 
Perfecting the Art of Unmasking the Hackers
Perfecting the Art of Unmasking the HackersPerfecting the Art of Unmasking the Hackers
Perfecting the Art of Unmasking the Hackers
 
JS digest. Mid-Summer 2017
JS digest. Mid-Summer 2017JS digest. Mid-Summer 2017
JS digest. Mid-Summer 2017
 
Go real-time with the InternetOfThings
Go real-time with the InternetOfThingsGo real-time with the InternetOfThings
Go real-time with the InternetOfThings
 

Ú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
 
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
 
Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native Applications
WSO2
 
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
 

Último (20)

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
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...
 
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...
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
 
Ransomware_Q4_2023. The report. [EN].pdf
Ransomware_Q4_2023. The report. [EN].pdfRansomware_Q4_2023. The report. [EN].pdf
Ransomware_Q4_2023. The report. [EN].pdf
 
Exploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with MilvusExploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with Milvus
 
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodPolkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
 
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
 
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, ...
 
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
 
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
 
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
 
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
 
Cyberprint. Dark Pink Apt Group [EN].pdf
Cyberprint. Dark Pink Apt Group [EN].pdfCyberprint. Dark Pink Apt Group [EN].pdf
Cyberprint. Dark Pink Apt Group [EN].pdf
 
Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native Applications
 
Artificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyArtificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : Uncertainty
 
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
 
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
 
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
 

Spying Internet Explorer 8.0

  • 1. Your texte here …. Spying on Internet Explorer (Another inline hooking example) 28 September 2011 Brian MARIANI Senior Security Consultant ORIGINAL SWISS ETHICAL HACKING ©2011 High-Tech Bridge SA – www.htbridge.ch
  • 2. cybercrime key points  Your textethe major problems that exist today in One of here …. the internet is a whole underground marketplace.  Business ecosystem build around online cybercrime.  The online criminals invest too much money in their targeted attacks.  They are hiring programmers, testing people and their skills to achieved their evil purposes.  Criminals study security professional's habits, to workaround the security defenses put in place. ORIGINAL SWISS ETHICAL HACKING ©2011 High-Tech Bridge SA – www.htbridge.ch
  • 3. Is it enought?  Your texte here …. The CCIPS is the Computer Crime and Intellectual Property Section.  Is responsible for implementing the Department's national strategies in combating computer crimes worldwide.  They prevents, investigates, and prosecutes computer crimes.  They work with other government agencies, private sectors, academic institutions, and foreign counterparts. ORIGINAL SWISS ETHICAL HACKING ©2011 High-Tech Bridge SA – www.htbridge.ch
  • 4. But… Today reality remains this Your texte here …. ORIGINAL SWISS ETHICAL HACKING ©2011 High-Tech Bridge SA – www.htbridge.ch
  • 5. A recent cybercrime case Your texte here …. ORIGINAL SWISS ETHICAL HACKING ©2011 High-Tech Bridge SA – www.htbridge.ch
  • 6. The threats  Your texte here …. Malicious software also known as “Malware” can compromise the security and functionality of a computer.  It can disrupt users privacy, damage computer files, stealing identities, or spontaneously opening unwanted internet links.  It can be also used in what we call “a zombie army”, to mount distributed denial of service attacks (DDOS).  Once installed in a computer it monitors the user‟s internet browsing habits. ORIGINAL SWISS ETHICAL HACKING ©2011 High-Tech Bridge SA – www.htbridge.ch
  • 7. Exploiting internet capabilities  Your texte here …. use the global nature of Cybercriminals internet to take advantage.  Internet is international, is a global system of interconnected computer networks.  So as soon as a bulletproof webserver is taken down, the malware infrastructure moves rapidly to another internet location.  They profit of the non-existence of a well organized international cybercrime police that could prevent these kind of operations. ORIGINAL SWISS ETHICAL HACKING ©2011 High-Tech Bridge SA – www.htbridge.ch
  • 8. The worst banks enemy  Your texte here …. the „second bank crisis‟, and It‟s been called this time the cause is a piece of malcode.  it can steal millions from online bank accounts with apparent impunity.  It‟s name is Zeus or Zbot and it‟s really clever.  A gang of just nineteen persons have stolen around 20 millions of pounds using it! ORIGINAL SWISS ETHICAL HACKING ©2011 High-Tech Bridge SA – www.htbridge.ch
  • 9. How easy it is to stole private information  Your texte here …. case of Zeus Trojan, it uses inline In the particular hooking to take control over key components of microsoft windows applications.  We already covered what inline hooking is in the previous article. Previous article  In today example we are going to intercept and grab trivial information from internet explorer.  The example covers inline hooking without using specifically a windows api, but a subroutine of InternetConnectW exported from wininet.dll.  The goal is to demonstrate that possibilities about inline hooking are without limits if one take care of all the details.  As a test environment we used an english windows seven distribution with internet explorer 8.0 version. ORIGINAL SWISS ETHICAL HACKING ©2011 High-Tech Bridge SA – www.htbridge.ch
  • 10. Practical example (1)  Your texte here …. In this example we hook several wininet functions without necessarily using them.  The goal is to show how easy a massive api hooking can be.  The code can be modified to add more apis to the ApiName array.  It exists three main functions: – PatchPreamble – CalculateAndWriteJump – CalculateAndWriteTrampoline ORIGINAL SWISS ETHICAL HACKING ©2011 High-Tech Bridge SA – www.htbridge.ch
  • 11. Practical example (2)  Your texte here …. Functions declared with the naked attribute are emitted without prolog or epilog code, enabling you to write your own custom prolog/epilog sequences using the inline assembler.  since the naked directive is not available in dev- cpp x86 the PatchPreamble function will rewrite the hook function prolog with no operation (nop) opcodes. We can later take care of our own prolog if it‟s needed. ORIGINAL SWISS ETHICAL HACKING ©2011 High-Tech Bridge SA – www.htbridge.ch
  • 12. Practical example (3)  Your texte here …. CalculateAndWriteJump will compute and write the jump code from the hooked api to our hook function, using the first 5 bytes. We are not disassembling the code first but assuming that we are dealing with a mov edi,edi – push ebp – mov ebp,esp prolog. ORIGINAL SWISS ETHICAL HACKING ©2011 High-Tech Bridge SA – www.htbridge.ch
  • 13. Practical example (4)  CalculateAndWriteTrampoline will write the trampoline 300 bytes Your texte here …. later from the patched prolog. since we calculate around 400 bytes for the hook function code, the gcc standard epilogue (POP EBP – RETN) will never be hit.  It exists an identifier named ToTrampolineBytes that can be modified to add more space to inject our C or ASM code, but do not forget to add more nops instructions into the hook function, otherwise you will write out of borders. ORIGINAL SWISS ETHICAL HACKING ©2011 High-Tech Bridge SA – www.htbridge.ch
  • 14. Practical example (5)  Your texte here …. This is the scenario once the Api is hooked. Example of InternetConnectW. 1 3 2 ORIGINAL SWISS ETHICAL HACKING ©2011 High-Tech Bridge SA – www.htbridge.ch
  • 15. Practical example (6)  Your we said before , we are not going to leverage As texte here …. any wininet api but a subroutine of InternetConnectW function. ORIGINAL SWISS ETHICAL HACKING ©2011 High-Tech Bridge SA – www.htbridge.ch
  • 16. Practical example (7)  Your successfully hook this subroutine without To texte here …. hardcoding any address we:  Add the number of bytes to reach the CALL Wininet.76845DCD to the address of InternetConnectW.  From this address we take the next four bytes skipping the 0xE8 opcode.  Finally we add 5 more bytes. ORIGINAL SWISS ETHICAL HACKING ©2011 High-Tech Bridge SA – www.htbridge.ch
  • 17. Practical example (8)  Your texte here …. Once the subroutine address is obtained we can follow the aforementioned steps:  PatchPreamble.  CalculateAndWriteJump.  CalculateAndWriteTrampoline. ORIGINAL SWISS ETHICAL HACKING ©2011 High-Tech Bridge SA – www.htbridge.ch
  • 18. Practical example (9)  Your texte here …. The hooked subroutine calls IdnToAscii Api exported from kernel32 module which converts an internationalized domain name (IDN) or another internationalized label to a Unicode representation of the ASCII string that represents the name in the Punycode transfer encoding syntax.  As we are interested in intercepting all visited domain names we will grab each and every accessed website in ascii format from a stack buffer pointer. ORIGINAL SWISS ETHICAL HACKING ©2011 High-Tech Bridge SA – www.htbridge.ch
  • 19. Practical example (10) Your texte here …. ORIGINAL SWISS ETHICAL HACKING ©2011 High-Tech Bridge SA – www.htbridge.ch
  • 20. Practical example (11)  Your texte here …. browses the Internet, some When the user websites causes the change of the stack ordering.  This is a normal behavior as InternetSetOptions API and others inter modular calls could change the stack in different ways.  That‟s why it is important to analyse all the different behaviours when we start to hook windows internals procedures. ORIGINAL SWISS ETHICAL HACKING ©2011 High-Tech Bridge SA – www.htbridge.ch
  • 21. Practical example (12)  Yourour example we will just put a condition In texte here …. to control a stack value.  We analyse if from ebp register it exits the nServerPort value of the precedent InternetConnectW Api.  This value can be 0x1BB or 0x50 which correspond to SSL or not SSL connection.  If this value exists we know that two dwords upper we can find our pointer to the website name. ORIGINAL SWISS ETHICAL HACKING ©2011 High-Tech Bridge SA – www.htbridge.ch
  • 22. Practical example (13)  Your texte here …. we could implemented the example in other “simpler ways”, but doing things always in a easier and simpler way it‟s not always good to learn.  Some hook function code was written in ansi C.  other parts of code is injected as raw binary code.  So let‟s see how the code is implemented. ORIGINAL SWISS ETHICAL HACKING ©2011 High-Tech Bridge SA – www.htbridge.ch
  • 23. Practical example (14) Your texte here …. We test if the port connection value is 80 or 443. If value is one of both we jump to 0x6ba011EC If it‟s not we do nothing and we jump again into the hooked subroutine after setting the stack correctly. We save three pointers that will be overwritten with fopen, fputs and fclose pointers. ORIGINAL SWISS ETHICAL HACKING ©2011 High-Tech Bridge SA – www.htbridge.ch
  • 24. Practical example (15) Your texte here …. We search the aforementioned pointers ORIGINAL SWISS ETHICAL HACKING ©2011 High-Tech Bridge SA – www.htbridge.ch
  • 25. Practical example (16) Your texte here …. We push the path and filename, the append fopen argument, and a carriage return character. We open the file and grab the domain name, followed by a carriage return, and we close the file handle. We unstack arguments until we reach our saved pointers. We put the saved pointers at the same place they were before. ORIGINAL SWISS ETHICAL HACKING ©2011 High-Tech Bridge SA – www.htbridge.ch
  • 26. Practical example (17) Your texte here …. We do nothing until we reach the trampoline We set up the stack and we jump again into the internetconnectw subroutine. ORIGINAL SWISS ETHICAL HACKING ©2011 High-Tech Bridge SA – www.htbridge.ch
  • 27. Practical example (18)  Your texte here …. The implementation of the “raw binary code” could be done in many different ways.  We can always optimize the assembler code.  It is very important to not overcharged the application.  If we add too much code the program performance could suffer.  Test the application to check if after the code injection the program behaviour remains the same. ORIGINAL SWISS ETHICAL HACKING ©2011 High-Tech Bridge SA – www.htbridge.ch
  • 28. Conclusions  Your texte hereinformation Stealing …. from well-known windows application remains very easy.  More dangerous scenarios will steal all the information that the user send and receive, including, passwords, credit card numbers, and other sensitive data.  Users must always protect themselves with proactive applications that detect and stop program injection on the fly.  Do not rely only in “security programs” but in a proactive audit of your systems. ORIGINAL SWISS ETHICAL HACKING ©2011 High-Tech Bridge SA – www.htbridge.ch
  • 29. Thank-you for reading Your texte here …. Thank-you for reading Your questions are always welcome! brian.mariani[at]htbridge.ch ORIGINAL SWISS ETHICAL HACKING ©2011 High-Tech Bridge SA – www.htbridge.ch
  • 30. References  http://www.bbc.co.uk/news/technology-10865568 Your texte here ….  http://www.darkreading.com/advanced- threats/167901091/security/attacks-breaches/231500619/worm- morphs-attacks-banks-with-zeus-like-features.html  http://bits.blogs.nytimes.com/2009/08/20/how-hackers-snatch-real-time- security-id-numbers  http://money.cnn.com/2010/09/30/technology/cyber_crime_charges/index .htm  http://voices.washingtonpost.com/securityfix/2009/10/ubiquitous_zeus_ trojan_targets.html  http://www.youtube.com/watch?v=cf3zxHuSM2Y  http://news.techworld.com/security/3241594/police-arrest-gang- behind-20-million-online-bank-fraud/  http://www.cybercrime.gov/hackettPlea.pdf  http://www.lemonde.fr/technologies/article/2010/10/01/etats-unis-les- autorites-inculpent-60-personnes-pour- cyberdelinquance_1418641_651865.html  http://www.20minutos.es/noticia/830501/0/virus/telefonos/moviles/  http://msdn.microsoft.com/en-us/library/dd318149%28v=vs.85%29.aspx  http://blogs.techworld.com/war-on-error/2010/09/the-zeus-trojan-is- stealing-money-with-impunity-can-it-be-stopped/index.htm ORIGINAL SWISS ETHICAL HACKING ©2011 High-Tech Bridge SA – www.htbridge.ch