Giter Club home page Giter Club logo

hsploit's Introduction

= HEVD Multi-Exploit by m_101

== Introduction

There are many exploits and write-ups for the HEVD training driver, here is another multi-exploit.

There is a lot of documentation as how this driver can be exploited, so I will not expand more on that part.

However, the goal of my release is to have a Rust example of using C calls and that yes you can code Windows kernel exploits without leaving Linux for compilation and not having to install Visual Studio. Another advantage is that the generated binary is self contained, no external dependencies are needed for the exploit but the binary itself.

Other aspects of this multi-exploit compared to the published ones are:

  • A token stealing payload written so it doesn't BSoD the OS since it increases the token reference counter. Yay, infinite successful exploitation.
  • Arbitrary Overwrite : HalDispatchTable+4 original value is restored after privilege escalation. The hardcoded offset used for calculation is specific to the Windows version I developed the exploit for.

Fixing what has been corrupted is extremely important in order to have a crashless exploit. I will detail the "algorithm" to resolve the original value.

== Pre-requisite

== Implemented payloads and techniques

Payloads:

  • Token stealing payload that updates the reference counter of the stolen token

Techniques used:

  • Windows 7
  • Basic kernel pool spraying based on Event objects
  • Kernel pool overflow corrupting the TypeIndex field + NULL page crafting
  • Stack spraying using NtMapUserPhysicalPages() (thanks to @j00ru)

== Dynamically resolving HaliQuerySystemInformation

You can use a PE parser and Capstone to do the job.

HalDispatchTable+4 contains the address of the HaliQuerySystemInformation function. In order to dynamically resolve its address, you can use the following algorithm :

  • Open/Load hal.dll
  • Resolve HalInitSystem
  • Following the proper jmp, this will end up jumping to HalpInitSystem
  • Follow HalpInitSystem code until you stumble upon the HalDispatchTable initialization.

There will be a pattern looking like this: mov dword ptr [eax + 4], HaliQuerySystemInformation

Now you have the RVA you need.

Add the HAL base to that RVA and you got the address of HaliQuerySystemInformation.

I have implemented a PoC of that hunting algorithm using my custom PE parser, I won't be releasing my PE parser code but you can use goblin to do the same.

== That's it

Hope you enjoy reading the code.

Cheers,

m_101

hsploit's People

Contributors

m101 avatar

Watchers

James Cloos avatar vasilevladilie avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.