dbutil_2_3.sys is a dell driver that existed from 2009. It contains a servre vulnerability, since it takes user input as parameters for a memove call later in the driver. The vulnerability was waiting to be exploited for 11 years.
Before we start :
dbutil_2_3.sys is a dell driver that existed from 2009. It contains a servre vulnerability, since it takes user input as parameters for a memmove call later in the driver. The vulnerability was waiting to be exploited for 11 years (that's if it wasn't exploited in the wild).
I used connor's blog here, He also did it for crowdstrike here. So I would obviously recommend reading his blogs too, since he covered alot of stuff compared to this one. I will be covering PTE bit flipping later and explain more about why it used to work. Also covering HCVI, and more stuff to come.
For now, as I mentioned above, the driver just takes user input and takes them as parameters into the the call to memmove, leading to a BSOD if you didn't manage correctly. The main obstacles that you might face are kCFG and SMEP in this blog.
Let's start.
I will be providing the driver in the repo just incase you would like to follow me to understand more (it's always good to do hands on). Feel free to do whatever you want.
opening the driver in IDA, we are welcomed to our beloved interface.
Scrolling down in the "DriverEntry" function, we will see that it calls another function below :
Double clicking on it, we see the following function :
I will be calling this function as "FxDriverEntry", and it's the function that runs right after the driver is called/used. "DriverEntry" is developer supplied, it loads before FxDriverEntry as we can see in this driver.
Looking at the function we are in now, we can find the driver name, which we can use to create a handle to the driver. And this is the first step when it comes to reverse engineering a driver for exploitation or vulnerability research.
Here it is incase it's not clear :
For our next step, we need to find the IOCTL (Input/output control) function, which is the function responsible for managing input and output requests which we can use to send our buffer. Since the driver is not even that long, we could easily find it. Which makes life much easier for us.
After some looking around, we see that the function called "sub_11170", is the function responsible for the IOCTL codes. Let's rename it to DispatchIo for better understanding later.
Looking at the function, we see alot of branches which indicates that it is probably alot of if/switch statements indicating that it is the IOCTL function, looking deeper, we see that the "codes" are 4 bytes, which confirms that this is the IOCTL function :
Looking more into the IOCTLs (they are 17ish IOCTL codes, I won't go through everyone).
The first IOCTL that caught my attention is IOCTL code : 0x9B0C1EC8
Let's now go through the conditions to see how it takes the input from the IOCTL.
The jump under our IOCTL takes us to the next instruction (since our IOCTL will equal the value in eax, the return value will be zero, hence the driver will take the jump) :
We will see later what "edx" is, but as we know from our logic gates, XOR zeros if inputs are the same, so (1 XOR 1) or (0 XOR 0) returns 0, so this zeros our edx.
it jumps directly to the next block without any conditions and it takes us to a the interesting block. It moves the value inside "rdi" into "rcx" which we will see what they are later. Then, the next instruction is a call instruction to another function :
Double clicking on the function being called, we see that later on, it calls memmove, this may indicate that we control what goes into the memmove method :
Now that we have identified the vulnerability, which is a probably just a write primitve, we need to think about how the memmove takes input.
Looking at any resource explaining memmove, we see that it takes 3 parameters (you can take a look at this here) :
void* memmove( void* dest, const void* src, size_t count );
Now, back to our driver, if we really struggle to read the assembly code (which you should learn to be really efficent with), you could press "TAB" and then wait for the decompilation to take place as shown below :
