{"exploit":{"id":"EDB-97","name":"Microsoft Windows - 'RPC DCOM' Scanner (MS03-039)","description":"Microsoft Windows - 'RPC DCOM' Scanner (MS03-039)","cves":["CVE-2003-0605"],"author":"Doke Scott","published":"2003-09-12","platform":"windows","type":"remote","language":"C","source":"exploit-db","sourceUrl":"https://www.exploit-db.com/exploits/97","path":"exploits/windows/remote/97.c","revision":"8a926a9b85beb3bccd6e8016211fdb73e904b52b","filename":"EDB-97.c","vulnerabilities":[{"id":"CVE-2003-0605","state":"PUBLISHED","title":null,"titleSource":null,"description":"The RPC DCOM interface in Windows 2000 SP3 and SP4 allows remote attackers to cause a denial of service (crash), and local attackers to use the DoS to hijack the epmapper pipe to gain privileges, via certain messages to the __RemoteGetClassObject interface that cause a NULL pointer to be passed to the PerformScmStage function.","descriptionSource":"CVE Program","descriptionUrl":"https://www.cve.org/CVERecord?id=CVE-2003-0605","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-0605"},"updatedAt":"2024-08-08T01:58:11.105Z","retrievedAt":"2026-11-26T11:43:39.593Z","stale":false,"error":null}],"imageUrl":"https://exploitbin.com/social/exploits/EDB-97.png?v=2","url":"https://exploitbin.com/exploits/EDB-97","downloadUrl":"https://exploitbin.com/api/v1/exploits/EDB-97/download","codeUrl":"https://exploitbin.com/api/v1/exploits/EDB-97/code","licenseUrl":"https://exploitbin.com/sources#exploit-db"},"code":"/*\ndcom2_scanner.c\n\nscan for second dcom vulnerability (MS03-039)\n\nby Doke Scott, doke at udel.edu, 10 Sep 2003\n\nbased on work by:\n *  buildtheb0x presents : dcom/rpc scanner\n *  ---------------------------------------\n *  by: kid and farp\n\n and on packet sniffs of MS's dcom2 scanner\n\n*/\n\n#define d_dcom_scan_timeout 5  // max seconds for individual dcom scan\n\n#include <stdio.h>\n#include <stdlib.h>\n#include <sys/types.h>\n#include <sys/socket.h>\n#include <netinet/in.h>\n#include <arpa/inet.h>\n#include <unistd.h>\n#include <netdb.h>\n#include <fcntl.h>\n#include <unistd.h>\n#include <signal.h>\n#include <errno.h>\n\n#define null NULL\n\n\n// for sun spro cc wierdness?  seg faults without this\n#define my_inet_ntoa(ip) inet_ntoa( *( (struct in_addr *) &ip ) )\n\n\n\nstatic char *program_name;\nstatic int verbose = 0;\nint dcom_scan_timeout = d_dcom_scan_timeout;\nvolatile int timed_out = 0;\nvolatile int dcomsockfd = 0;\n\nextern char *optarg;\nextern int optind, opterr, optopt;\n\n\n\n\n\nvoid\nprint_hex( unsigned char *data, int len ) {\n    int i, j;\n    char alphastr[ 17 ];\n\n    for ( i = 0, j = 0; i < len; i++, j++ ) {\n\tif ( j == 0 ) {\n\t    alphastr[ j ] = isprint( data[i] ) ? data[i] : '.';\n\t    printf( \"%04x  %02x\", i, data[ i ] & 0xff );\n\t    }\n\telse if ( j == 15 ) {\n\t    alphastr[ j ] = isprint( data[i] ) ? data[i] : '.';\n\t    alphastr[ j + 1 ] = 0;\n\t    printf( \" %02x   %s\\n\", data[ i ] & 0xff, alphastr );\n\t    j = -1;\n\t    }\n\telse {\n\t    alphastr[ j ] = isprint( data[i] ) ? data[i] : '.';\n\t    printf( \" %02x\", data[ i ] & 0xff );\n\t    }\n\t}\n    if ( j )  {\n\talphastr[ j + 1 ] = 0;\n\tfor ( ; j < 16; j++ )\n\t    printf( \"   \" );\n\tprintf( \"   %s\\n\", alphastr );\n\t}\n    }\n\n\n\n\n/*\n * based on:\n *\n *  buildtheb0x presents : dcom/rpc scanner\n *  ---------------------------------------\n *\n *\n *  by: kid and farp\n *\n *  greets: kajun, phr_, dvdman, Sam, flatline, #nanog, synD, and to all danny'\ns waitress's\n *\n */\n\n#define DEST_PORT 135\n\n///////////////////////////\n// first request packet, bind request\n\n// from dcom1 exploit code\nunsigned char bindstr[]={\n    0x05, 0x00, 0x0B, 0x03, 0x10, 0x00, 0x00, 0x00, 0x48, 0x00, 0x00, 0x00,\n    0x7F, 0x00, 0x00, 0x00, 0xD0, 0x16, 0xD0, 0x16, 0x00, 0x00, 0x00, 0x00,\n    0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x01, 0x00, 0xa0, 0x01, 0x00, 0x00,\n    0x00, 0x00, 0x00, 0x00, 0xC0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46,\n    0x00, 0x00, 0x00, 0x00, 0x04, 0x5D, 0x88, 0x8A, 0xEB, 0x1C, 0xC9, 0x11,\n    0x9F, 0xE8, 0x08, 0x00, 0x2B, 0x10, 0x48, 0x60, 0x02, 0x00, 0x00, 0x00\n    };\n\n// from dcom1 dcom_scanz\nunsigned char fear1[] = {\n    0x05, 0x00, 0x0b, 0x03, 0x10, 0x00, 0x00, 0x00, 0x48, 0x00, 0x00, 0x00,\n    0x09, 0x00, 0x00, 0x00, 0xd0, 0x16, 0xd0, 0x16, 0x00, 0x00, 0x00, 0x00,\n    0x01, 0x00, 0x00, 0x00, 0x02, 0x00, 0x01, 0x00, 0xb8, 0x4a, 0x9f, 0x4d,\n    0x1c, 0x7d, 0xcf, 0x11, 0x86, 0x1e, 0x00, 0x20, 0xaf, 0x6e, 0x7c, 0x57,\n    0x00, 0x00, 0x00, 0x00, 0x04, 0x5d, 0x88, 0x8a, 0xeb, 0x1c, 0xc9, 0x11,\n    0x9f, 0xe8, 0x08, 0x00, 0x2b, 0x10, 0x48, 0x60, 0x02, 0x00, 0x00, 0x00\n    };\n\n// sniffed from dcom2 scanner, when scanning patched machine\nunsigned char request1[] = {\n    0x05, 0x00, 0x0b, 0x03, 0x10, 0x00, 0x00, 0x00, 0x48, 0x00, 0x00, 0x00,\n    0x01, 0x00, 0x00, 0x00, 0xd0, 0x16, 0xd0, 0x16, 0x00, 0x00, 0x00, 0x00,\n    0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0xa0, 0x01, 0x00, 0x00,\n    0x00, 0x00, 0x00, 0x00, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46,\n    0x00, 0x00, 0x00, 0x00, 0x04, 0x5d, 0x88, 0x8a, 0xeb, 0x1c, 0xc9, 0x11,\n    0x9f, 0xe8, 0x08, 0x00, 0x2b, 0x10, 0x48, 0x60, 0x02, 0x00, 0x00, 0x00\n    };\n\nunsigned char expected1[] = {\n    0x05, 0x00, 0x0c, 0x03, 0x10, 0x00, 0x00, 0x00, 0x3c, 0x00, 0x00, 0x00,\n    0x01, 0x00, 0x00, 0x00, 0xd0, 0x16, 0xd0, 0x16, 0x28, 0x57, 0x00, 0x00,\n    0x04, 0x00, 0x31, 0x33, 0x35, 0x00, 0x02, 0x00, 0x01, 0x00, 0x00, 0x00,\n    0x00, 0x00, 0x00, 0x00, 0x04, 0x5d, 0x88, 0x8a, 0xeb, 0x1c, 0xc9, 0x11,\n    0x9f, 0xe8, 0x08, 0x00, 0x2b, 0x10, 0x48, 0x60, 0x02, 0x00, 0x00, 0x00,\n    };\n\n\n///////////////////////////\n// second request packet\n\n// from dcom1 exploit code\nunsigned char exploit_request1[]={\n    0x05, 0x00, 0x00, 0x03, 0x10, 0x00, 0x00, 0x00, 0x7e, 0x00, 0x00, 0x00,\n    0x09, 0x00, 0x00, 0x00, 0x66, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,\n    0x05, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\n    0x6b, 0xac, 0xd8, 0x08, 0x2f, 0x2e, 0x03, 0x48, 0xaa, 0xdc, 0xc1, 0x6a,\n    0x62, 0xfb, 0xeb, 0x98, 0x00, 0x00, 0x00, 0x00, 0xf8, 0x91, 0x7b, 0x5a,\n    0x00, 0xff, 0xd0, 0x11, 0xa9, 0xb2, 0x00, 0xc0, 0x4f, 0xb6, 0xe6, 0xfc,\n    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,\n    0xff, 0xff, 0xff, 0xff, 0x01, 0x00, 0x00, 0x00, 0x38, 0xff, 0x0a, 0x00,\n    0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\n    0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46, 0x01, 0x00, 0x00, 0x00,\n    0x01, 0x00, 0x00, 0x00, 0x07, 0x00\n    };\n\n\n// from dcom1 dcom_scanz\nunsigned char fear2[] = {\n    0x05, 0x00, 0x00, 0x03, 0x10, 0x00, 0x00, 0x00, 0x7e, 0x00, 0x00, 0x00,\n    0x09, 0x00, 0x00, 0x00, 0x66, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,\n    0x05, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\n    0x6b, 0xac, 0xd8, 0x08, 0x2f, 0x2e, 0x03, 0x48, 0xaa, 0xdc, 0xc1, 0x6a,\n    0x62, 0xfb, 0xeb, 0x98, 0x00, 0x00, 0x00, 0x00, 0xf8, 0x91, 0x7b, 0x5a,\n    0x00, 0xff, 0xd0, 0x11, 0xa9, 0xb2, 0x00, 0xc0, 0x4f, 0xb6, 0xe6, 0xfc,\n    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,\n    0xff, 0xff, 0xff, 0xff, 0x01, 0x00, 0x00, 0x00, 0x38, 0xff, 0x0a, 0x00,\n    0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\n    0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46, 0x01, 0x00, 0x00, 0x00,\n    0x01, 0x00, 0x00, 0x00, 0x07, 0x00\n    };\n\n// sniffed from dcom2 scanner, when scanning unpatched machine\nunsigned char request2[] = {\n    0x05, 0x00, 0x00, 0x03, 0x10, 0x00, 0x00, 0x00, 0xb0, 0x03, 0x00, 0x00,\n    0x01, 0x00, 0x00, 0x00, 0x98, 0x03, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00,\n    0x05, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\n    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\n    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\n    0xe0, 0xab, 0x14, 0x00, 0x68, 0x03, 0x00, 0x00, 0x68, 0x03, 0x00, 0x00,\n    0x4d, 0x45, 0x4f, 0x57, 0x04, 0x00, 0x00, 0x00, 0xa2, 0x01, 0x00, 0x00,\n    0x00, 0x00, 0x00, 0x00, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46,\n    0x38, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0x00, 0x00, 0x00,\n    0x00, 0x00, 0x00, 0x46, 0x00, 0x00, 0x00, 0x00, 0x38, 0x03, 0x00, 0x00,\n    0x30, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x10, 0x08, 0x00,\n    0xcc, 0xcc, 0xcc, 0xcc, 0xc8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\n    0x30, 0x03, 0x00, 0x00, 0xd8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\n    0x02, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\n    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\n    0x18, 0x01, 0x8d, 0x00, 0xb8, 0x01, 0x8d, 0x00, 0x00, 0x00, 0x00, 0x00,\n    0x07, 0x00, 0x00, 0x00, 0xb9, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\n    0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46, 0xab, 0x01, 0x00, 0x00,\n    0x00, 0x00, 0x00, 0x00, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46,\n    0xa5, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0x00, 0x00, 0x00,\n    0x00, 0x00, 0x00, 0x46, 0xa6, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\n    0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46, 0xa4, 0x01, 0x00, 0x00,\n    0x00, 0x00, 0x00, 0x00, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46,\n    0xad, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0x00, 0x00, 0x00,\n    0x00, 0x00, 0x00, 0x46, 0xaa, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\n    0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46, 0x07, 0x00, 0x00, 0x00,\n    0x60, 0x00, 0x00, 0x00, 0x58, 0x00, 0x00, 0x00, 0x90, 0x00, 0x00, 0x00,\n    0x58, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x68, 0x00, 0x00, 0x00,\n    0x30, 0x00, 0x00, 0x00, 0xc0, 0x00, 0x00, 0x00, 0x01, 0x10, 0x08, 0x00,\n    0xcc, 0xcc, 0xcc, 0xcc, 0x50, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\n    0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\n    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\n    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\n    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\n    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\n    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\n    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x10, 0x08, 0x00,\n    0xcc, 0xcc, 0xcc, 0xcc, 0x48, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\n    0x00, 0x5d, 0x88, 0x9a, 0xeb, 0x1c, 0xc9, 0x11, 0x9f, 0xe8, 0x08, 0x00,\n    0x2b, 0x10, 0x48, 0x60, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\n    0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\n    0xb8, 0x47, 0x0a, 0x00, 0x58, 0x00, 0x00, 0x00, 0x05, 0x00, 0x06, 0x00,\n    0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\n    0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46, 0xcc, 0xcc, 0xcc, 0xcc,\n    0x01, 0x10, 0x08, 0x00, 0xcc, 0xcc, 0xcc, 0xcc, 0x80, 0x00, 0x00, 0x00,\n    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\n    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0xba, 0x09, 0x00,\n    0x00, 0x00, 0x00, 0x00, 0x60, 0x00, 0x00, 0x00, 0x60, 0x00, 0x00, 0x00,\n    0x4d, 0x45, 0x4f, 0x57, 0x04, 0x00, 0x00, 0x00, 0xc0, 0x01, 0x00, 0x00,\n    0x00, 0x00, 0x00, 0x00, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46,\n    0x3b, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0x00, 0x00, 0x00,\n    0x00, 0x00, 0x00, 0x46, 0x00, 0x00, 0x00, 0x00, 0x30, 0x00, 0x00, 0x00,\n    0x01, 0x00, 0x01, 0x00, 0x67, 0x3c, 0x70, 0x94, 0x13, 0x33, 0xfd, 0x46,\n    0x87, 0x24, 0x4d, 0x09, 0x39, 0x88, 0x93, 0x9d, 0x02, 0x00, 0x00, 0x00,\n    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\n    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,\n    0x01, 0x10, 0x08, 0x00, 0xcc, 0xcc, 0xcc, 0xcc, 0x48, 0x00, 0x00, 0x00,\n    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xb0, 0x7e, 0x09, 0x00,\n    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf0, 0x89, 0x0a, 0x00,\n    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0d, 0x00, 0x00, 0x00,\n    0x00, 0x00, 0x00, 0x00, 0x0d, 0x00, 0x00, 0x00, 0x73, 0x00, 0x61, 0x00,\n    0x6a, 0x00, 0x69, 0x00, 0x61, 0x00, 0x64, 0x00, 0x65, 0x00, 0x76, 0x00,\n    0x5f, 0x00, 0x78, 0x00, 0x38, 0x00, 0x36, 0x00, 0x00, 0x00, 0x08, 0x00,\n    0xcc, 0xcc, 0xcc, 0xcc, 0x01, 0x10, 0x08, 0x00, 0xcc, 0xcc, 0xcc, 0xcc,\n    0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\n    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\n    0x01, 0x10, 0x08, 0x00, 0xcc, 0xcc, 0xcc, 0xcc, 0x58, 0x00, 0x00, 0x00,\n    0x00, 0x00, 0x00, 0x00, 0xc0, 0x5e, 0x0a, 0x00, 0x00, 0x00, 0x00, 0x00,\n    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1b, 0x00, 0x00, 0x00,\n    0x00, 0x00, 0x00, 0x00, 0x1b, 0x00, 0x00, 0x00, 0x5c, 0x00, 0x5c, 0x00,\n    0x00, 0x00, 0x5c, 0x00, 0x6a, 0x00, 0x69, 0x00, 0x61, 0x00, 0x64, 0x00,\n    0x65, 0x00, 0x76, 0x00, 0x5f, 0x00, 0x78, 0x00, 0x00, 0x00, 0x36, 0x00,\n    0x5c, 0x00, 0x70, 0x00, 0x75, 0x00, 0x62, 0x00, 0x6c, 0x00, 0x69, 0x00,\n    0x63, 0x00, 0x5c, 0x00, 0x41, 0x00, 0x41, 0x00, 0x41, 0x00, 0x41, 0x00,\n    0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x15, 0x00, 0x01, 0x10, 0x08, 0x00,\n    0xcc, 0xcc, 0xcc, 0xcc, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\n    0x00, 0x00, 0x00, 0x00, 0x90, 0x5b, 0x09, 0x00, 0x02, 0x00, 0x00, 0x00,\n    0x01, 0x00, 0x6c, 0x00, 0xc0, 0xdf, 0x08, 0x00, 0x01, 0x00, 0x00, 0x00,\n    0x07, 0x00, 0x55, 0x00, 0x00, 0x00, 0x00, 0x00\n    };\n\n// sniffed from dcom2 scanner, when scanning unpatched machine\nunsigned char expected2_vulnerable[] = {\n    0x05, 0x00, 0x02, 0x03, 0x10, 0x00, 0x00, 0x00, 0x28, 0x00, 0x00, 0x00,\n    0x01, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\n    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\n    0x04, 0x00, 0x08, 0x80,\n    };\n\n// sniffed from dcom2 scanner, when scanning patched machine\n// you also get this on a machine that doesn't have either dcom patch\nunsigned char expected2_patched[] = {\n    0x05, 0x00, 0x02, 0x03, 0x10, 0x00, 0x00, 0x00, 0x28, 0x00, 0x00, 0x00,\n    0x01, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\n    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\n    0x54, 0x01, 0x04, 0x80,\n    };\n\n\n// this came out of one machine, 128.175.214.151\n// 0000  05 00 03 23 10 00 00 00 20 00 00 00 01 00 00 00   ...#.... .......\n// 0010  00 00 00 00 00 00 00 00 03 00 01 1c 00 00 00 00   ................\n// ethereal says it's a dce fault response\n// nmap says the system is Me, Win 2000, or WinXP\n// all the following packets were unanswered, or zero length.\n\nunsigned char expected2_dce_fault[] = {\n    0x05, 0x00, 0x03\n    };\n\n\n\n///////////////////////////\n// third request packet\n\n\n// from dcom1 dcom_scanz\nunsigned char fear3[] = {\n    0x05, 0x00, 0x0b, 0x03, 0x10, 0x00, 0x00, 0x00, 0x48, 0x00, 0x00, 0x00,\n    0x65, 0x45, 0x79, 0x65, 0xd0, 0x16, 0xd0, 0x16, 0x00, 0x00, 0x00, 0x00,\n    0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0xb8, 0x4a, 0x9f, 0x4d,\n    0x1c, 0x7d, 0xcf, 0x11, 0x86, 0x1e, 0x00, 0x20, 0xaf, 0x6e, 0x7c, 0x57,\n    0x00, 0x00, 0x00, 0x00, 0x04, 0x5d, 0x88, 0x8a, 0xeb, 0x1c, 0xc9, 0x11,\n    0x9f, 0xe8, 0x08, 0x00, 0x2b, 0x10, 0x48, 0x60, 0x02, 0x00, 0x00, 0x00\n    };\n\n// sniffed from dcom2 scanner, when scanning patched machine\nunsigned char request3[] = {\n    0x05, 0x00, 0x00, 0x03, 0x10, 0x00, 0x00, 0x00, 0xb0, 0x03, 0x00, 0x00,\n    0x02, 0x00, 0x00, 0x00, 0x98, 0x03, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00,\n    0x05, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\n    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\n    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\n    0x98, 0xe5, 0x14, 0x00, 0x68, 0x03, 0x00, 0x00, 0x68, 0x03, 0x00, 0x00,\n    0x4d, 0x45, 0x4f, 0x57, 0x04, 0x00, 0x00, 0x00, 0xa2, 0x01, 0x00, 0x00,\n    0x00, 0x00, 0x00, 0x00, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46,\n    0x38, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0x00, 0x00, 0x00,\n    0x00, 0x00, 0x00, 0x46, 0x00, 0x00, 0x00, 0x00, 0x38, 0x03, 0x00, 0x00,\n    0x30, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x10, 0x08, 0x00,\n    0xcc, 0xcc, 0xcc, 0xcc, 0xc8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\n    0x30, 0x03, 0x00, 0x00, 0xd8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\n    0x02, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\n    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\n    0x18, 0x01, 0x8d, 0x00, 0xb8, 0x01, 0x8d, 0x00, 0x00, 0x00, 0x00, 0x00,\n    0x07, 0x00, 0x00, 0x00, 0xb9, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\n    0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46, 0xab, 0x01, 0x00, 0x00,\n    0x00, 0x00, 0x00, 0x00, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46,\n    0xa5, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0x00, 0x00, 0x00,\n    0x00, 0x00, 0x00, 0x46, 0xf6, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\n    0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46, 0xff, 0x01, 0x00, 0x00,\n    0x00, 0x00, 0x00, 0x00, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46,\n    0xad, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0x00, 0x00, 0x00,\n    0x00, 0x00, 0x00, 0x46, 0xaa, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\n    0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46, 0x07, 0x00, 0x00, 0x00,\n    0x60, 0x00, 0x00, 0x00, 0x58, 0x00, 0x00, 0x00, 0x90, 0x00, 0x00, 0x00,\n    0x58, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x68, 0x00, 0x00, 0x00,\n    0x30, 0x00, 0x00, 0x00, 0xc0, 0x00, 0x00, 0x00, 0x01, 0x10, 0x08, 0x00,\n    0xcc, 0xcc, 0xcc, 0xcc, 0x50, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\n    0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\n    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\n    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\n    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\n    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\n    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\n    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x10, 0x08, 0x00,\n    0xcc, 0xcc, 0xcc, 0xcc, 0x48, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\n    0x00, 0x5d, 0x88, 0x9a, 0xeb, 0x1c, 0xc9, 0x11, 0x9f, 0xe8, 0x08, 0x00,\n    0x2b, 0x10, 0x48, 0x60, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\n    0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\n    0xb8, 0x47, 0x0a, 0x00, 0x58, 0x00, 0x00, 0x00, 0x05, 0x00, 0x06, 0x00,\n    0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\n    0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46, 0xcc, 0xcc, 0xcc, 0xcc,\n    0x01, 0x10, 0x08, 0x00, 0xcc, 0xcc, 0xcc, 0xcc, 0x80, 0x00, 0x00, 0x00,\n    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\n    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0xba, 0x09, 0x00,\n    0x00, 0x00, 0x00, 0x00, 0x60, 0x00, 0x00, 0x00, 0x60, 0x00, 0x00, 0x00,\n    0x4d, 0x45, 0x4f, 0x57, 0x04, 0x00, 0x00, 0x00, 0xc0, 0x01, 0x00, 0x00,\n    0x00, 0x00, 0x00, 0x00, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46,\n    0x3b, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0x00, 0x00, 0x00,\n    0x00, 0x00, 0x00, 0x46, 0x00, 0x00, 0x00, 0x00, 0x30, 0x00, 0x00, 0x00,\n    0x01, 0x00, 0x01, 0x00, 0x67, 0x3c, 0x70, 0x94, 0x13, 0x33, 0xfd, 0x46,\n    0x87, 0x24, 0x4d, 0x09, 0x39, 0x88, 0x93, 0x9d, 0x02, 0x00, 0x00, 0x00,\n    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\n    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,\n    0x01, 0x10, 0x08, 0x00, 0xcc, 0xcc, 0xcc, 0xcc, 0x48, 0x00, 0x00, 0x00,\n    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xb0, 0x7e, 0x09, 0x00,\n    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf0, 0x89, 0x0a, 0x00,\n    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0d, 0x00, 0x00, 0x00,\n    0x00, 0x00, 0x00, 0x00, 0x0d, 0x00, 0x00, 0x00, 0x73, 0x00, 0x61, 0x00,\n    0x6a, 0x00, 0x69, 0x00, 0x61, 0x00, 0x64, 0x00, 0x65, 0x00, 0x76, 0x00,\n    0x5f, 0x00, 0x78, 0x00, 0x38, 0x00, 0x36, 0x00, 0x00, 0x00, 0x08, 0x00,\n    0xcc, 0xcc, 0xcc, 0xcc, 0x01, 0x10, 0x08, 0x00, 0xcc, 0xcc, 0xcc, 0xcc,\n    0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\n    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\n    0x01, 0x10, 0x08, 0x00, 0xcc, 0xcc, 0xcc, 0xcc, 0x58, 0x00, 0x00, 0x00,\n    0x00, 0x00, 0x00, 0x00, 0xc0, 0x5e, 0x0a, 0x00, 0x00, 0x00, 0x00, 0x00,\n    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1b, 0x00, 0x00, 0x00,\n    0x00, 0x00, 0x00, 0x00, 0x1b, 0x00, 0x00, 0x00, 0x5c, 0x00, 0x5c, 0x00,\n    0x00, 0x00, 0x5c, 0x00, 0x6a, 0x00, 0x69, 0x00, 0x61, 0x00, 0x64, 0x00,\n    0x65, 0x00, 0x76, 0x00, 0x5f, 0x00, 0x78, 0x00, 0x00, 0x00, 0x36, 0x00,\n    0x5c, 0x00, 0x70, 0x00, 0x75, 0x00, 0x62, 0x00, 0x6c, 0x00, 0x69, 0x00,\n    0x63, 0x00, 0x5c, 0x00, 0x41, 0x00, 0x41, 0x00, 0x41, 0x00, 0x41, 0x00,\n    0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x15, 0x00, 0x01, 0x10, 0x08, 0x00,\n    0xcc, 0xcc, 0xcc, 0xcc, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\n    0x00, 0x00, 0x00, 0x00, 0x90, 0x5b, 0x09, 0x00, 0x02, 0x00, 0x00, 0x00,\n    0x01, 0x00, 0x6c, 0x00, 0xc0, 0xdf, 0x08, 0x00, 0x01, 0x00, 0x00, 0x00,\n    0x07, 0x00, 0x55, 0x00, 0x00, 0x00, 0x00, 0x00\n    };\n\n// this is what you get when it's doesn't have either patch\nunsigned char expected3_vulnerable[] = {\n    0x05, 0x00, 0x02, 0x03, 0x10, 0x00, 0x00, 0x00, 0x28, 0x00, 0x00, 0x00,\n    0x02, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\n    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\n    0x54, 0x01, 0x04, 0x80,\n    };\n\n// this is what you get when it's got the first dcom patch\nunsigned char expected3_patched1[] = {\n    0x05, 0x00, 0x02, 0x03, 0x10, 0x00, 0x00, 0x00, 0x28, 0x00, 0x00, 0x00,\n    0x02, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\n    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\n    0x04, 0x00, 0x08, 0x80,\n    };\n\n// this is what you get when it's got the second dcom patch\nunsigned char expected3_patched2[] = {\n    0x05, 0x00, 0x02, 0x03, 0x10, 0x00, 0x00, 0x00, 0x28, 0x00, 0x00, 0x00,\n    0x02, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\n    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\n    0x02, 0x40, 0x00, 0x80,\n    };\n\n\n\n///////////////////////////\n// fourth request packet\n\n// from dcom1 dcom_scanz\nunsigned char fear4[] = {\n    0x05, 0x00, 0x00, 0x03, 0x10, 0x00, 0x00, 0x00, 0xc6, 0x00, 0x00, 0x00,\n    0x00, 0x00, 0x00, 0x00, 0xae, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\n    0x05, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\n    0x5b, 0x52, 0x65, 0x74, 0x69, 0x6e, 0x61, 0x5d, 0x5b, 0x52, 0x65, 0x74,\n    0x69, 0x6e, 0x61, 0x5d, 0x00, 0x00, 0x00, 0x00, 0x65, 0x45, 0x79, 0x65,\n    0x32, 0x30, 0x30, 0x33, 0x65, 0x45, 0x79, 0x65, 0x32, 0x30, 0x30, 0x33,\n    0x68, 0x0f, 0x0b, 0x00, 0x1e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\n    0x1e, 0x00, 0x00, 0x00, 0x5c, 0x00, 0x5c, 0x00, 0x41, 0x00, 0x00, 0x00,\n    0x5c, 0x00, 0x00, 0x00, 0x63, 0x00, 0x24, 0x00, 0x5c, 0x00, 0x65, 0x00,\n    0x45, 0x00, 0x79, 0x00, 0x65, 0x00, 0x5f, 0x00, 0x32, 0x00, 0x30, 0x00,\n    0x30, 0x00, 0x33, 0x00, 0x5f, 0x00, 0x52, 0x00, 0x65, 0x00, 0x74, 0x00,\n    0x69, 0x00, 0x6e, 0x00, 0x61, 0x00, 0x2e, 0x00, 0x74, 0x00, 0x78, 0x00,\n    0x74, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,\n    0x02, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0xb8, 0xeb, 0x0b, 0x00,\n    0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\n    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,\n    0x01, 0x00, 0x00, 0x00, 0x07, 0x00\n    };\n\n\n// sniffed from dcom2 scanner, when scanning vulnerable machine\n// only issued at vulnerable machine\n// no fourth packet when scanning patched machine\n// etheral says it's an \"alter context\"\nunsigned char request4[] = {\n    0x05, 0x00, 0x0e, 0x03, 0x10, 0x00, 0x00, 0x00, 0x48, 0x00, 0x00, 0x00,\n    0x03, 0x00, 0x00, 0x00, 0xd0, 0x16, 0xd0, 0x16, 0x28, 0x57, 0x00, 0x00,\n    0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x01, 0x00, 0xb8, 0x4a, 0x9f, 0x4d,\n    0x1c, 0x7d, 0xcf, 0x11, 0x86, 0x1e, 0x00, 0x20, 0xaf, 0x6e, 0x7c, 0x57,\n    0x00, 0x00, 0x00, 0x00, 0x04, 0x5d, 0x88, 0x8a, 0xeb, 0x1c, 0xc9, 0x11,\n    0x9f, 0xe8, 0x08, 0x00, 0x2b, 0x10, 0x48, 0x60, 0x02, 0x00, 0x00, 0x00,\n    };\n\nunsigned char expected4[] = {\n    0x05, 0x00, 0x0f, 0x03, 0x10, 0x00, 0x00, 0x00, 0x38, 0x00, 0x00, 0x00,\n    0x03, 0x00, 0x00, 0x00, 0xd0, 0x16, 0xd0, 0x16, 0x28, 0x57, 0x00, 0x00,\n    0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\n    0x04, 0x5d, 0x88, 0x8a, 0xeb, 0x1c, 0xc9, 0x11, 0x9f, 0xe8, 0x08, 0x00,\n    0x2b, 0x10, 0x48, 0x60, 0x02, 0x00, 0x00, 0x00,\n    };\n\n\n\n///////////////////////////\n// fifth request packet\n\n// sniffed from dcom2 scanner, when scanning vulnerable machine\nunsigned char request5[] = {\n    0x05, 0x00, 0x00, 0x03, 0x10, 0x00, 0x00, 0x00, 0x9a, 0x00, 0x00, 0x00,\n    0x03, 0x00, 0x00, 0x00, 0x82, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,\n    0x05, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\n    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\n    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x95, 0x96, 0x95, 0x2a,\n    0x8c, 0xda, 0x6d, 0x4a, 0xb2, 0x36, 0x19, 0xbc, 0xaf, 0x2c, 0x2d, 0xea,\n    0x34, 0xeb, 0x98, 0x00, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\n    0x07, 0x00, 0x00, 0x00, 0x5c, 0x00, 0x5c, 0x00, 0x4d, 0x00, 0x45, 0x00,\n    0x4f, 0x00, 0x57, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\n    0x5c, 0x00, 0x48, 0x00, 0x5c, 0x00, 0x48, 0x00, 0x01, 0x00, 0x00, 0x00,\n    0x58, 0xe9, 0x98, 0x00, 0x01, 0x00, 0x00, 0x00, 0x95, 0x96, 0x95, 0x2a,\n    0x8c, 0xda, 0x6d, 0x4a, 0xb2, 0x36, 0x19, 0xbc, 0xaf, 0x2c, 0x2d, 0xea,\n    0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x5c, 0x00,\n    };\n\n// this is what you get with no dcom patches,\n// unfortunately it's also what you get with the dcom 2 patch\nunsigned char expected5_vulnerable_or_patched2[] = {\n    0x05, 0x00, 0x02, 0x03, 0x10, 0x00, 0x00, 0x00, 0x5c, 0x00, 0x00, 0x00,\n    0x03, 0x00, 0x00, 0x00, 0x44, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,\n    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\n    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\n    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\n    0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x02, 0x00, 0x54, 0x01, 0x04, 0x80,\n    0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,\n    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\n    };\n\n// this is what you get from dcom patch 1\nunsigned char expected5_patched1[] = {\n    0x05, 0x00, 0x02, 0x03, 0x10, 0x00, 0x00, 0x00, 0x5c, 0x00, 0x00, 0x00,\n    0x03, 0x00, 0x00, 0x00, 0x44, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,\n    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\n    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\n    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\n    0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x02, 0x00, 0x04, 0x00, 0x08, 0x80,\n    0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,\n    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\n    };\n\n\n\n\n\n\nvoid\ntimeout_handler( int info ) {\n    //fprintf( stderr, \"timed out\\n\" );\n    if ( dcomsockfd )\n\tclose( dcomsockfd );   // have to close it here to abort the connect\n    timed_out = 1;\n    }\n\n\n// send a packet, and get response\n// return length of received data, or -1 on error\nint\nexchange_packets( int pktnum, uint32_t ip, int fd, unsigned char *req,\n\tint reqlen, unsigned char *resp, int resplen ) {\n    int len;\n\n    if ( verbose > 1 )\n\tprintf( \"Sending packet %d\\n\", pktnum );\n\n    if(send(dcomsockfd, req, reqlen, 0) < 0) {\n\tclose( dcomsockfd );\n\talarm( 0 );\n\tif ( timed_out )\n\t    printf( \"timed out while sending packet %d to %s\\n\",\n\t\tpktnum, my_inet_ntoa( ip ) );\n\telse\n\t    fprintf( stderr, \"error sending packet %d to %s\\n\",\n\t\tpktnum, my_inet_ntoa( ip ) );\n\treturn -1;\n\t}\n\n    if ( ( len = recv( dcomsockfd, resp, resplen, 0 ) ) < 0 ) {\n\tclose( dcomsockfd );\n\talarm( 0 );\n\tif ( timed_out )\n\t    printf( \"timed out while receiving packet %d from %s\\n\",\n\t\tpktnum, my_inet_ntoa( ip ) );\n\telse\n\t    fprintf( stderr, \"error receiving packet %d from %s\\n\",\n\t\tpktnum, my_inet_ntoa( ip ) );\n\treturn -1;\n\t}\n\n    return len;\n    }\n\n\n\n\n\n// scan remote ip for dcom vulnerability\n// normally doesn't print anything, just errors\n// verbose = 1 for basic scan result printfs\n// verbose > 1 for more verbose stuff\n// return 0 if ok, 1 if vulnerable, -1 if can't connect or can't tell\n//     0 not vulnerable\n//     1 does not accept DCE RPC protocol (connection refused)\n//     2 no response (filtering DCOM port, or not there)\n//     3 vulnerable to dcom 1 and dcom2\n//     4 vulnerable to dcom 2 (but patched for dcom1)\n//     255 can't tell for some other reason\nint\ndcom2_scan( uint32_t ip ) {\n    struct sockaddr_in dest_addr;   /* hold dest addy */\n    unsigned char resp1[1024];\n    unsigned char resp2[1024];\n    unsigned char resp3[1024];\n    unsigned char resp4[1024];\n    unsigned char resp5[1024];\n    unsigned char assoc_group[4];\n    int len1, len2, len3, len4, len5;\n    int vun3 = 0;\n    int i;\n\n    if ( verbose > 1 )\n\tprintf( \"scanning %s\\n\", my_inet_ntoa( ip ) );\n\n    timed_out = 0;\n    signal( SIGALRM, timeout_handler );\n    alarm( dcom_scan_timeout );\n\n    dcomsockfd = 0;\n    if((dcomsockfd = socket(AF_INET, SOCK_STREAM, 0)) < 0) {\n\talarm( 0 );\n\tif ( timed_out ) {\n\t    if ( verbose )\n\t\tprintf( \"%s timed out while getting socket\\n\",\n\t\t    my_inet_ntoa( ip ) );\n\t    }\n\telse\n\t    fprintf( stderr, \"error getting socket: %s\\n\", strerror( errno ) );\n        return 255;\n        }\n\n    bzero( &dest_addr, sizeof( struct sockaddr_in ) );\n    dest_addr.sin_family = AF_INET;\n    dest_addr.sin_port = htons(DEST_PORT);\n    dest_addr.sin_addr.s_addr = ip;\n\n    if ( verbose > 1 )\n\tprintf(\"Connecting to %s\\n\", my_inet_ntoa( ip ) );\n    if( connect( dcomsockfd, (struct sockaddr *) &dest_addr,\n\t    sizeof(struct sockaddr) ) < 0 ) {\n\tclose( dcomsockfd );\n\talarm( 0 );\n\tif ( timed_out || errno == ETIMEDOUT ) {\n\t    if ( verbose )\n\t\tprintf( \"%s timed out while connecting\\n\",\n\t\t    my_inet_ntoa( ip ) );\n\t    return 2;\n\t    }\n\telse if ( errno == ECONNREFUSED ) {\n\t    if ( verbose )\n\t\tprintf(\"%s does not accept DCERPC protocol -- good\\n\",\n\t\t    my_inet_ntoa( ip ) );\n\t    return 1;   // good, port not open, it's not vulnerable\n\t    }\n\tif ( verbose )\n\t    printf( \"%s connect failed: %s\\n\", my_inet_ntoa( ip ),\n\t\tstrerror( errno ) );\n\treturn 255;\n\t}\n\n#if 0\n    // the ms scanner opens a tcp connections, resets it, then opens a second\n    // but it just refused the second connection for me.\n\n    close( dcomsockfd );\n\n    if ( verbose > 1 )\n\tprintf(\"opening second connection to %s\\n\", my_inet_ntoa( ip ) );\n    if( connect( dcomsockfd, (struct sockaddr *) &dest_addr,\n\t    sizeof(struct sockaddr) ) < 0 ) {\n\tclose( dcomsockfd );\n\talarm( 0 );\n\tif ( timed_out ) {\n\t    if ( verbose )\n\t\tprintf( \"%s timed out while connecting\\n\",\n\t\t    my_inet_ntoa( ip ) );\n\t    return 2;\n\t    }\n\telse if ( errno == ECONNREFUSED ) {\n\t    if ( verbose )\n\t\tprintf(\"%s does not accept DCERPC protocol -- good\\n\",\n\t\t    my_inet_ntoa( ip ) );\n\t    return 1;   // good, it's not vulnerable\n\tif ( verbose )\n\t    printf( \"%s connect failed: %s\\n\", my_inet_ntoa( ip ),\n\t\tstrerror( errno ) );\n\treturn 255;\n\t}\n#endif\n\n\n    // the bind request\n    len1 = exchange_packets( 1, ip, dcomsockfd, request1, sizeof(request1),\n\tresp1, sizeof( resp1 ) );\n    if ( len1 < 0 )\n\treturn 255;\n    memcpy( assoc_group, resp1 + 20, 4 );  // need this for packet 4\n    //printf( \"association group:\\n\" );\n    //print_hex( assoc_group, 4 );\n\n\n\n\n    // packet exchange 2, call_id: 1 opnum: 4 ctx_id: 0\n    len2 = exchange_packets( 2, ip, dcomsockfd, request2, sizeof(request2),\n\tresp2, sizeof( resp2 ) );\n    if ( len2 < 0 )\n\treturn 255;\n    if ( ! memcmp( resp2, expected2_patched,\n\t    sizeof( expected2_patched ) ) ) {\n\t// it's probably either patched for dcom 2, or neigther\n\tif ( verbose > 1 )\n\t    printf( \"response 2 matches expected patched\\n\" );\n\t}\n    else if ( ! memcmp( resp2, expected2_vulnerable,\n\t    sizeof( expected2_vulnerable ) ) ) {\n\t// it's probably patched for dcom 1\n\tif ( verbose > 1 )\n\t    printf( \"response 2 matches expected vulnerable\\n\" );\n\t}\n    else if ( ! memcmp( resp2, expected2_dce_fault,\n\t    sizeof( expected2_dce_fault ) ) ) {\n\t// It's a DCE fault response.  I don't know what causes this,\n\t// but it seems to ignore any other packets.  So I can't continue.\n\tclose( dcomsockfd );\n\tif ( verbose > 1 )\n\t    printf( \"response 2 matches dce fault\\n\" );\n\tif ( verbose )\n\t    printf( \"%s returns DCE Fault code -- wierd\\n\",\n\t\tmy_inet_ntoa( ip ) );\n\treturn 255;\n\t}\n    else if ( verbose > 1 ) {\n\tprintf( \"Response 2 expected vunerable contents:\\n\" );\n\tprint_hex( expected2_vulnerable, sizeof( expected2_vulnerable ) );\n\tprintf( \"Response 2 expected patched contents:\\n\" );\n\tprint_hex( expected2_patched, sizeof( expected2_patched ) );\n\tprintf( \"Response 2 received contents:\\n\" );\n\tprint_hex( resp2, len2 );\n\tfor ( i = 0; i < sizeof( expected2_vulnerable ); i++ ) {\n\t    if ( resp2[ i ] != expected2_vulnerable[ i ] )\n\t\tprintf( \"    %04x %02x != %02x\\n\", i, resp2[ i ],\n\t\t    expected2_vulnerable[ i ] );\n\t    }\n\t}\n\n\n\n    // packet exchange 3, call_id: 2 opnum: 4 ctx_id: 0\n    len3 = exchange_packets( 3, ip, dcomsockfd, request3, sizeof(request3),\n\tresp3, sizeof( resp3 ) );\n    if ( len3 < 0 )\n\treturn 255;\n    if ( ! memcmp( resp3, expected3_vulnerable,\n\t    sizeof( expected3_vulnerable ) ) ) {\n\tif ( verbose > 1 )\n\t    printf( \"response 3 matches no dcom patches\\n\" );\n\tvun3 = 1;\n\t}\n    else if ( ! memcmp( resp3, expected3_patched1,\n\t    sizeof( expected3_patched1 ) ) ) {\n\tif ( verbose > 1 )\n\t    printf( \"response 3 matches patched for dcom 1\\n\" );\n\tvun3 = 1;\n\t}\n    else if ( ! memcmp( resp3, expected3_patched2,\n\t    sizeof( expected3_patched2 ) ) ) {\n\tif ( verbose > 1 )\n\t    printf( \"response 3 matches patched for dcom 2\\n\" );\n\n\t// MS scanner stops here\n\t// but I don't really understand these packets\n\n\t//if ( verbose )\n\t//    printf( \"%s has both dcom patchs -- good\\n\", my_inet_ntoa( ip ) );\n\t//close( dcomsockfd );\n\t//return 0;\n\t}\n    else if ( verbose > 1 ) {\n\tprintf( \"response 3 does not match any expected packet\\n\" );\n\tprintf( \"Response 3 received contents:\\n\" );\n\tprint_hex( resp3, len3 );\n\tfor ( i = 0; i < sizeof( expected3_vulnerable ); i++ ) {\n\t    if ( resp3[ i ] != expected3_vulnerable[ i ] )\n\t\tprintf( \"    %04x %02x != %02x\\n\", i, resp3[ i ],\n\t\t    expected3_vulnerable[ i ] );\n\t    }\n\t}\n\n\n\n    // packet exchange 4, Alter context\n    memcpy( request4 + 20, assoc_group, 4 );\n    memcpy( expected4 + 20, assoc_group, 4 );\n    len4 = exchange_packets( 4, ip, dcomsockfd, request4, sizeof(request4),\n\tresp4, sizeof( resp4 ) );\n    if ( len4 < 0 )\n\treturn 255;\n    else if ( verbose > 1 ) {\n\tif ( memcmp( resp4, expected4, sizeof( expected4 ) ) ) {\n\t    printf( \"Response 4 expected contents:\\n\" );\n\t    print_hex( expected4, sizeof( expected4 ) );\n\t    printf( \"Response 4 received contents:\\n\" );\n\t    print_hex( resp4, len4 );\n\t    for ( i = 0; i < sizeof( expected4 ); i++ ) {\n\t\tif ( resp4[ i ] != expected4[ i ] )\n\t\t    printf( \"    %04x %02x != %02x\\n\", i, resp4[ i ],\n\t\t\texpected4[ i ] );\n\t\t}\n\t    }\n\t}\n\n\n\n    // packet exchange 5, RemoteActivation\n    len5 = exchange_packets( 5, ip, dcomsockfd, request5, sizeof(request5),\n\tresp5, sizeof( resp5 ) );\n    if ( len5 < 0 )\n\treturn 255;\n    close(dcomsockfd);\n    if ( ! memcmp( resp5, expected5_patched1,\n\t    sizeof( expected5_patched1 ) ) ) {\n\tif ( verbose > 1 )\n\t    printf( \"response 5 matches patched for dcom1 -- BAD\\n\" );\n\tif ( verbose )\n\t    printf( \"** %s only has 1st dcom patch -- BAD **\\n\",\n\t\tmy_inet_ntoa( ip ) );\n\treturn 4;\n\t}\n    else if ( ! memcmp( resp5, expected5_vulnerable_or_patched2,\n\t    sizeof( expected5_vulnerable_or_patched2 ) ) ) {\n\tif ( verbose > 1 )\n\t    printf( \"response 5 matches either no dcom patches or patched for dcom2\\n\" );\n\tif ( vun3 ) {\n\t    if ( verbose )\n\t\tprintf( \"** %s has neither dcom patch -- BAD **\\n\",\n\t\t    my_inet_ntoa( ip ) );\n\t    return 3;\n\t    }\n\tif ( verbose )\n\t    printf( \"%s has both dcom patchs -- good\\n\", my_inet_ntoa( ip ) );\n\treturn 0;\n\t}\n    else if ( verbose > 1 ) {\n\tprintf( \"Response 5 expected contents:\\n\" );\n\tprint_hex( expected5_vulnerable_or_patched2,\n\t    sizeof( expected5_vulnerable_or_patched2 ) );\n\tprintf( \"Response 5 received contents:\\n\" );\n\tprint_hex( resp5, len5 );\n\tfor ( i = 0; i < sizeof( expected5_vulnerable_or_patched2 ); i++ ) {\n\t    if ( resp5[ i ] != expected5_vulnerable_or_patched2[ i ] )\n\t\tprintf( \"    %04x %02x != %02x\\n\", i, resp5[ i ],\n\t\t    expected5_vulnerable_or_patched2[ i ] );\n\t    }\n\t}\n\n\n    else if ( verbose > 1 ) {\n\tprintf( \"%s contains unidentified signature,\\n\",\n\t    my_inet_ntoa( ip ) );\n\tprintf( \"Please report if vulnerable.\\n\" );\n\t}\n    return 255;\n    }\n\n\n\n\n\nvoid\nusage( int rc ) {\n    fprintf( stderr, \"Usage: %s [-vqh] [ -t timeout ] <ip address>\\n\"\n\t\"       %s [-vqh] [ -t timeout ] <ip address>/<cidr-bits>\\n\"\n\t\"    -v    increase verbosity\\n\"\n\t\"    -q    quiet, no output, just exit status\\n\"\n\t\"    -t n  set scan timeout to n seconds, default %d\\n\"\n\t\"    -h    this help\\n\"\n\t\"    when scanning one ip, exits with:\\n\"\n\t\"        0 not vulnerable\\n\"\n\t\"        1 does not accept DCE RPC protocol (connection refused)\\n\"\n\t\"        2 no response (filtering DCOM port, or not there)\\n\"\n\t\"        3 vulnerable to dcom 1 and dcom2\\n\"\n\t\"        4 vulnerable to dcom 2 (but patched for dcom1)\\n\"\n\t\"        255 can't tell for some other reason\\n\"\n\t\"    when scanning an ip range, exits with:\\n\"\n\t\"        0 nothing was vulnerable\\n\"\n\t\"        4 one or more were vunerable\\n\",\n\tprogram_name, program_name, d_dcom_scan_timeout );\n    exit( rc );\n    }\n\n\n\n\n\nint\nmain( int argc, char **argv )  {\n    int a, b, c, d, bits;\n    unsigned int mask, low, high, ip, netip;\n    int rc = 0, r;\n\n    program_name = argv[0];\n\n    verbose = 1;  // turn on basic prints in scan function\n    dcom_scan_timeout = d_dcom_scan_timeout;\n\n    while ( ( c = getopt( argc, argv, \"vqt:h\" ) ) >= 0 ) {\n\tswitch ( c ) {\n\t    case 'v':\n\t\tverbose++;\n\t\tbreak;\n\t    case 'q':\n\t\tverbose = 0;\n\t\tbreak;\n\t    case 't':\n\t\tdcom_scan_timeout = atoi( optarg );\n\t\tbreak;\n\t    case 'h':\n\t\tusage( 0 );\n\t\tbreak;\n\t    default:\n\t\tusage( -1 );\n\t\tbreak;\n\t    }\n\t}\n\n    if ( optind >= argc || ! argv[ optind ] )\n\tusage( -1 );\n\n    rc = sscanf( argv[ optind ], \"%d.%d.%d.%d/%d\", &a, &b, &c, &d, &bits );\n    if ( rc == 5 )  {\n\t// scan range\n\tif ( bits < 0 || 32 < bits )\n\t    usage( -1 );\n\trc = 0;\n\tmask = 0xffffffff << ( 32 - bits );\n\tlow = ( a << 24 | b << 16 | c << 8 | d ) & mask;\n\thigh = low | ~ mask;\n\tfor ( ip = low + 1; ip < high; ip++ ) {\n\t    netip = htonl( ip );\n\t    r = dcom2_scan( netip );\n\t    if ( r == 3 || r == 4 )\n\t\trc = 4;\n\t    }\n\t}\n    else if ( rc == 4 ) {\n\t// scan 1 ip\n\tinet_pton( AF_INET, argv[ optind ], (struct in_addr *) &netip );\n\trc = dcom2_scan( netip );\n\t}\n    else\n\tusage( -1 );\n\n    return rc;\n    }\n\n// milw0rm.com [2003-09-12]","sha256":"b0c7cc1a2aa21cddd555170481c7e814fdeffae401c8fd315b9ee31d751380c2","bytes":37747,"fetchedAt":"2026-11-26T12:05:56.624Z","encoding":"utf-8 (display only; download retains original bytes)"}