Tracy McDowell
Tracy McDowell

Reputation: 23

What could be the possible reasons of "Access denied" error while attempting to open a handle to a Windows device?

ioctlbf is an IOCTL fuzzer for Windows. Given a target devicem it opens up a handle to it like this:

deviceHandle = CreateFile((HANDLE) deviceName,
  GENERIC_READ,
  0,
  NULL,
  OPEN_EXISTING,
  0,
  NULL);
if (deviceHandle == INVALID_HANDLE_VALUE) {
  printf("FAILED, error code: %d\n%s\n", GetLastError(),
    errorCode2String(GetLastError()));
  exit(1);
}

The device is created like this:

drvObj->MajorFunction[IRP_MJ_CREATE] = ...;
drvObj->MajorFunction[IRP_MJ_CLOSE] = ...;
drvObj->MajorFunction[IRP_MJ_INTERNAL_DEVICE_CONTROL] = ...;
drvObj->DriverExtension->AddDevice = ...;
drvObj->DriverUnload = NULL;

IoCreateDevice(drvObj, 0, &dName, FILE_DEVICE_UNKNOWN, FILE_DEVICE_SECURE_OPEN, TRUE, &devObj);

The problem is, even when I am running the tool from administrator console, I am getting "Access is denied, Error code 5". I am not familiar with Windows driver programming. Where should I be looking at to investigate this? Could it anyway be related to protected process / ACL / Exclusive bit in IoDeviceCreate?

Upvotes: 1

Views: 50

Answers (0)

Related Questions