CVE-2026-43871
Infinite loop in Apache Thrift language bindings can cause a Denial of Service.
- CVSS 8.7
- 835
- Resource Management
- Remote
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.
- CWE
- 835
- CVSS base score
- 8.7
- Published
- 2026-07-27
- OWASP
- A04 Insecure Design
- Orthogonal defect classification
- Algorithm
- Code defect classification
- Incorrect Algorithm
- Category
- Resource Management
- Subcategory
- Resource Exhaustion
- Accessibility scope
- Remote
- Impact
- Denial of Service (DoS)
- Affected component
- Apache Thrif
- Fixed by upgrading
- Yes
Solution
Upgrade to Apache Thrift version 0.24.0 or later.
Vulnerable code sample
from thrift.protocol.TProtocol import TProtocolException
from thrift.transport import TTransport
# Simplified protocol implementation for demonstration of a logical flaw.
class TExampleProtocol:
def __init__(self, trans: TTransport.TTransportBase):
self.trans = trans
def readI32(self) -> int:
# In a real scenario, this reads a signed 32-bit integer
# from the transport. We simulate receiving a negative value
# from a malicious or malformed payload.
# val, = struct.unpack('!i', self.trans.readAll(4))
# return val
return -1
def skip_element(self):
# In a real scenario, this would skip one element of a given type.
pass
def read_list_data(self):
"""
Reads a list by first reading its size, then processing elements.
"""
list_size = self.readI32()
# VULNERABLE: A negative 'size' causes an infinite loop because
# the counter is decremented and will never reach the '== 0' break condition.
while True:
if list_size == 0:
break
self.skip_element()
list_size -= 1Patched code sample
from thrift.protocol.TProtocol import TProtocolException
from thrift.transport import TTransport
# Simplified protocol implementation for demonstration of a logical flaw.
class TExampleProtocol:
def __init__(self, trans: TTransport.TTransportBase):
self.trans = trans
def readI32(self) -> int:
# In a real scenario, this reads a signed 32-bit integer
# from the transport. We simulate receiving a negative value
# from a malicious or malformed payload.
# val, = struct.unpack('!i', self.trans.readAll(4))
# return val
return -1
def skip_element(self):
# In a real scenario, this would skip one element of a given type.
pass
def read_list_data(self):
"""
Reads a list by first reading its size, then processing elements.
"""
list_size = self.readI32()
# FIX: Validate container sizes to prevent negative values before looping.
if list_size < 0:
raise TProtocolException(
TProtocolException.NEGATIVE_SIZE,
"Negative size: %d" % list_size)
while True:
if list_size == 0:
break
self.skip_element()
list_size -= 1Cite this entry
@misc{vaitp:cve202643871,
title = {{Infinite loop in Apache Thrift language bindings can cause a Denial of Service.}},
author = {Bogaerts, Fr\'ed\'eric and Ivaki, Naghmeh and Fonseca, Jos\'e},
year = {2026},
note = {VAITP Python Vulnerability Dataset, entry CVE-2026-43871},
howpublished = {\url{https://netpack.pt/vaitp/vulnerability/CVE-2026-43871/}}
}
Introducing the "VAITP dataset": a specialized repository of Python vulnerabilities and patches, meticulously compiled for the use of the security research community. As Python's prominence grows, understanding and addressing potential security vulnerabilities become crucial. Crafted by and for the cybersecurity community, this dataset offers a valuable resource for researchers, analysts, and developers to analyze and mitigate the security risks associated with Python. Through the comprehensive exploration of vulnerabilities and corresponding patches, the VAITP dataset fosters a safer and more resilient Python ecosystem, encouraging collaborative advancements in programming security.
The supreme art of war is to subdue the enemy without fighting.
Sun Tzu – “The Art of War”
:: Shaping the future through research and ingenuity ::
