Coder Social home page Coder Social logo

corsairlleak's Introduction

CorsairLLeak

Map physical addresses into userspace (RW), read/write MSRs, send/recieve data on I/O ports, and query/set bus configuration data with the Corsair LL Access driver.

How it works

The LL access driver has almost no security permissions. It calls IoCreateDevice() and IoCreateSymbolicLink() with all default parameters , therefore granting everyone all access to the device object. However, IRP_MJ_CREATE is handled and the driver calls SeQueryInformationToken to verify that the caller's integrity level is at least High. Otherwise it returns STATUS_ACCESS_DENIED.

Once a valid handle has been opened to the device, usermode code can communicate with it via DeviceIoControl() using standard buffered I/O.

Many of the IOCTLs that can be sent to the device simply check the input and output buffer sizes then directly call the corresponding kernel function. This basically lets usermode code execute a list of kernelmode functions/operations and get their results. Some of these functions are:

  • MmMapIoSpace
  • MmProbeAndLockPagesSpecifyCache
  • HalSetBusDataByOffset
  • __writemsr
  • __out[byte][[d]word]

So basically you can abuse the heck out of this. (Why is this thing WHCP signed?)

The code

The one C file (main.c) is the source of a sample program that will attempt to open the device, map ten consecutive physical memory ranges starting from 0, each 4KB in size, and then read the kernel GS base MSR register.

Install the driver for your system (x86/x64) using the command sc create CORSAIREXPLOIT binPath= ... type= kernel.

The documented IOCTLs are the ones I've figured out how to use. I've not included ones for I/O in/out operations or bus data operations.

Other notes

  1. __writemsr seems to be surrounded by SEH. Attempting to change kernel GS base results in DeviceIoControl() to return STATUS_PRIVILEGED_INSTRUCTION.
  2. The IOCTL to free mapped physical address is kinda buggy. It'll randomly double free, and cause a BSOD with code PFN_LIST_CORRUPT. It happens the most when trying to free physical addresses near 0x1A0000.
  3. I don't know what the output buffer and its size are when using the IOCTL to write to MSRs. Pretty sure there is no output buffer. Output size seems to be hardcoded to be set to 8.
  4. Additional comments/notes are in the sample code.

corsairlleak's People

Contributors

azagarampur 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.