Although this piece of code is wrapped with exception handler,
input and output pointers are not checked with ProbeForRead/Write.
This will cause BSOD when input/output will point to kernel mode
memory (above 0x80000000).
This code can be reached by sending IoControlCode = 0x222003 to
device \\.\\easdrv (see POC). In order to exploit this, we need
to take a look at
These are wrappers for hooked syscalls. First one is NtClose, so
there aren't many possible values that this API returns in eax.
We will use:
C0000008 STATUS_INVALID_HANDLE An invalid HANDLE was specified.
Because it's the simplest status to get.
Attack scenario:
1. Get address of some rarely used syscall, like NtShutdownSystem.
I will refer to this address as X :p
2. Send signal to easdrv, with output buffer = X-1. This will result
in overwriting two highest bytes with zeros and will damage 1 byte
at X-1 :p.
3. Send signal with output buffer = X 2. This will set two lower bytes
to 0x0800.
4. Allocate memory at 0x80000 and copy shellcode there
5. Call NtShutdownSystem to jump to shellcode in r0 mode.
See POC for details. There is no cleanup, you will get BSOD at address
0x80000 :).
It's possible to get required addresses by downloading symbols for
given kernel build or use technique presented in [1]. In POC code this
address is hardcoded.
[1] - Exploiting Windows Device Drivers, Piotr Bania
http://www.piotrbania.com/all/articles/ewdd.pdf
- - PGP -
All advisories from Orange Bat are signed. You can find our public
key here: http://www.orange-bat.com/g_.asc
- - Disclaimer -
This document and all the information it contains is provided "as is",
without any warranty. Orange Bat is not responsible for the
misuse of the information provided in this advisory. The advisory is
provided for educational purposes only.
Permission is hereby granted to redistribute this advisory, providing
that no changes are made and that the copyright notices and
disclaimers remain intact.
printf("NtShutdownSystem now points to 0x80000 :)");
printf("Jump to hyperspace in 2 seconds..");
Sleep(2*1000);
NtShutdownSystem(0);
}
else{
printf("Failed to open device");
}