{"id":2166,"cve":"CVE-2026-43871","cve_url":"https:\/\/www.cvedetails.com\/cve\/CVE-2026-43871\/","cwe":"CWE-835","cwe_number":835,"cwe_url":"https:\/\/cwe.mitre.org\/data\/definitions\/835","cvss_score":8.7,"published":"2026-07-27","owasp":"A04 Insecure Design","odc":"Algorithm","cdc":"Incorrect Algorithm","category":"Resource Management","subcategory":"Resource Exhaustion","scope":"Remote","impact":"Denial of Service (DoS)","summary":"Infinite loop in Apache Thrift language bindings can cause a Denial of Service.","permalink":"https:\/\/netpack.pt\/vaitp\/vulnerability\/CVE-2026-43871\/","description":"Loop with Unreachable Exit Condition ('Infinite Loop') vulnerability in Apache Thrift Python, Go, PHP and Java bindings.This issue affects Apache Thrift: before 0.24.0.  Users are recommended to upgrade to version 0.24.0, which fixes the issue.","solution":"Upgrade to Apache Thrift version 0.24.0 or later.","affected_component":"Apache Thrift","fixed_by_upgrading":true,"vulnerable_code":"from thrift.protocol.TProtocol import TProtocolException\nfrom thrift.transport import TTransport\n\n# Simplified protocol implementation for demonstration of a logical flaw.\nclass TExampleProtocol:\n    def __init__(self, trans: TTransport.TTransportBase):\n        self.trans = trans\n\n    def readI32(self) -> int:\n        # In a real scenario, this reads a signed 32-bit integer\n        # from the transport. We simulate receiving a negative value\n        # from a malicious or malformed payload.\n        # val, = struct.unpack('!i', self.trans.readAll(4))\n        # return val\n        return -1\n\n    def skip_element(self):\n        # In a real scenario, this would skip one element of a given type.\n        pass\n\n    def read_list_data(self):\n        \"\"\"\n        Reads a list by first reading its size, then processing elements.\n        \"\"\"\n        list_size = self.readI32()\n\n        # VULNERABLE: A negative 'size' causes an infinite loop because\n        # the counter is decremented and will never reach the '== 0' break condition.\n        while True:\n            if list_size == 0:\n                break\n            self.skip_element()\n            list_size -= 1\n","patched_code":"from thrift.protocol.TProtocol import TProtocolException\nfrom thrift.transport import TTransport\n\n# Simplified protocol implementation for demonstration of a logical flaw.\nclass TExampleProtocol:\n    def __init__(self, trans: TTransport.TTransportBase):\n        self.trans = trans\n\n    def readI32(self) -> int:\n        # In a real scenario, this reads a signed 32-bit integer\n        # from the transport. We simulate receiving a negative value\n        # from a malicious or malformed payload.\n        # val, = struct.unpack('!i', self.trans.readAll(4))\n        # return val\n        return -1\n\n    def skip_element(self):\n        # In a real scenario, this would skip one element of a given type.\n        pass\n\n    def read_list_data(self):\n        \"\"\"\n        Reads a list by first reading its size, then processing elements.\n        \"\"\"\n        list_size = self.readI32()\n\n        # FIX: Validate container sizes to prevent negative values before looping.\n        if list_size < 0:\n            raise TProtocolException(\n                TProtocolException.NEGATIVE_SIZE,\n                \"Negative size: %d\" % list_size)\n\n        while True:\n            if list_size == 0:\n                break\n            self.skip_element()\n            list_size -= 1\n","payload_needed":true,"payload":null,"payload_status":"model_refused","published_fix":[],"references":null}