Giter VIP home page Giter VIP logo

poolsprayer's Introduction

PoolSprayer

PoolSprayer is a basic library to spray the Windows Kernel Pool. The code currently handles the spraying of NonPagedPool (NonPagedPoolNx for windows >=8 ) and PagedPool, but might support other types of pool.

The methods used to spray the pool are explained in details in this paper: https://www.gatewatcher.com/en/news/blog/windows-kernel-pool-spraying

The method used to spray the PagedPool is a bit different since there is by default severals pools used as PagedPools, making the previous methods obsolete.

This library only works on x64 architectures, but can be easyly converted for x32 architectures. Tested and approved on Windows 7 x64 and Windows 10 x64.

How to use

You can find some code snippets in example/. Also, there is one default spraying for each pool type.

Quick notes on the objects: The first thing to do before spraying is to chose an object. You have to chose the object following those criterias:

  • The PoolType where the object is allocated
  • The size of the chunk allocated when creating the object

For example, on x64 architectures, the IoCompleReservedObject is allocated in the NonPagedPool (NonPagedPoolNx for windows >=8) and the size of its chunk is 0xC0. The RegistryKey is allocated in the PagedPool and the size of its chunk is 0x100.

You can easily find these informations by allocating an object and debugging your kernel. The size of the object is really important because it's directly related to the size of the holes you're going to create. With an object of size 0x100, you can create holes of 0x100, 0x200, 0x300, 0x400...

Once you chose your object, you can just allocate a sprayer and start having fun !

Quick note on the weird offset

If you read the source code you're going to see multiple variables / macros about a weird offset.

This offset is the offset between the object's address leaked by the function NtQuerySystemInformation() and the address of the beginning of the actual chunk containing the object. I don't know why but this offset is changing between objects, so I call it weird. For example, for most object, this offset is ALWAYS 0x60, but for the Registry Key object (Allocated by RegOpenKeyEx()) this offset is 0x70.

So when spraying, I suggest you to let this offset at 0x60 by default, but if the spraying doesn't work (the function PlanHole() isn't finding any valid hole), you should check the offset for the object you chose.

Thanks

Those researchs and library were made during my internship at Armature Technologies.

Contact

Twitter

poolsprayer's People

Contributors

cbayet avatar cbayet-synacktiv 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.