koutto / ioctlbf Goto Github PK
View Code? Open in Web Editor NEWWindows Kernel Drivers fuzzer
Windows Kernel Drivers fuzzer
cont = TRUE;
if(SetConsoleCtrlHandler((PHANDLER_ROUTINE) CtrlHandler, TRUE)) {
// Fill the buffer with data from FuzzConstants (1 DWORD after 1)
memset(bufInput, 0x00, MAX_BUFSIZE);
for(i=0; cont && i<posListIoctls->maxBufferLength; i=i+4) {
printf("Fuzzing DWORD %d/%d\n",
i/4+1, posListIoctls->maxBufferLength/4);
// Fill the whole buffer with random data...
for(j=0; cont && j<posListIoctls->maxBufferLength; j++) {
bufInput[j] = (BYTE)getrand(0x00, 0xff);
}
// ...and put a DWORD from FuzzConstants at the i_th position
for(j=0; cont && j<(sizeof(FuzzConstants)/4); j++) {
fuzzData = FuzzConstants[j];
/*
printf("Fuzzing DWORD %d/%d with 0x%08x (%d/%d)\n",
i/4+1, posListIoctls->maxBufferLength/4,
fuzzData, j+1, sizeof(FuzzConstants)/4);
*/
// Choose a random element into FuzzConstants
bufInput[i] = fuzzData & 0x000000ff;
bufInput[i+1] = (fuzzData & 0x0000ff00) >> 8;
bufInput[i+2] = (fuzzData & 0x00ff0000) >> 16;
bufInput[i+3] = (fuzzData & 0xff000000) >> 24;
if(!quietflg) {
Hexdump(bufInput, posListIoctls->maxBufferLength);
printf("Fuzzing DWORD %d/%d with 0x%08x (%d/%d)\n",
i/4+1, posListIoctls->maxBufferLength/4,
fuzzData, j+1, sizeof(FuzzConstants)/4);
printf("Input buffer: %d (0x%x) bytes \n",
posListIoctls->maxBufferLength,
posListIoctls->maxBufferLength);
}
status = DeviceIoControl(deviceHandle,
posListIoctls->IOCTL,
&bufInput,
posListIoctls->maxBufferLength,
&bufOutput,
posListIoctls->maxBufferLength,
&nbBytes,
NULL);
if(!quietflg) {
if(status == 0)
printf("Error %d: %s\n\n", GetLastError(),
errorCode2String(GetLastError()));
printf("-------------------------------------------------------------------\n\n");
}
Sleep(SLEEP_TIME);
}
}
printf("Filling the whole buffer with predetermined DWORDs\n");
while(cont) {
// Choose a random length for the buffer
randomLength = getrand(posListIoctls->minBufferLength,
posListIoctls->maxBufferLength);
// Fill the whole buffer with data from FuzzConstants
memset(bufInput, 0x00, MAX_BUFSIZE);
for(i=0; i<randomLength; i=i+4) {
fuzzData = FuzzConstants[getrand(0, (sizeof(FuzzConstants)/4)-1)];
// Choose a random element into FuzzConstants
bufInput[i] = fuzzData & 0x000000ff;
bufInput[i+1] = (fuzzData & 0x0000ff00) >> 8;
bufInput[i+2] = (fuzzData & 0x00ff0000) >> 16;
bufInput[i+3] = (fuzzData & 0xff000000) >> 24;
}
if(!quietflg) {
Hexdump(bufInput, randomLength);
printf("Filling the whole buffer with predetermined DWORDs\n");
printf("Input buffer: %d (0x%x) bytes \n", randomLength,
randomLength);
}
status = DeviceIoControl(deviceHandle,
posListIoctls->IOCTL,
&bufInput,
randomLength,
&bufOutput,
randomLength,
&nbBytes,
NULL);
if(!quietflg) {
if(status == 0)
printf("Error %d: %s\n\n", GetLastError(), errorCode2String(GetLastError()));
printf("-------------------------------------------------------------------\n\n");
}
Sleep(SLEEP_TIME);
}
Since cont never change in this piece of code,how could while(cont) break out?
I'm confused because the way the tool is shown to run is like "hey simple just -d and name the device" But its not, you can't just name any simple directory and its going to find it. Clearly there is a method to "\." and I've been trying to figure it out for almost 3 hours on how to run this binary. It's super frustrating.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.