CVE-2026-115776
Unauthenticated IRC buffer overflow causing memory exhaustion in Twisted.
- CVSS 7.5
- CWE-400
- Resource Management
- Remote
Twisted is an event-based framework for internet applications, supporting Python 3.6+. Prior to 26.10.0rc1, twisted.words.protocols.irc.IRC.dataReceived retains all bytes received without a line feed in its per-connection buffer and applies no maximum line length. The twisted.words.service.IRCUser server subclass inherits this behavior, and buffering occurs before PASS, NICK, or USER authentication commands. An unauthenticated connection can continuously grow the buffer until the shared server process runs out of memory and drops all users. This issue is fixed in version 26.10.0rc1.
- CWE
- CWE-400
- CVSS base score
- 7.5
- Published
- 2026-10-23
- OWASP
- A04 Insecure Design
- Orthogonal defect classification
- Checking
- Code defect classification
- Missing Check
- Category
- Resource Management
- Subcategory
- Resource Exhaustion
- Accessibility scope
- Remote
- Impact
- Denial of Service (DoS)
- Affected component
- Twisted
- Fixed by upgrading
- Yes
Solution
Upgrade Twisted to version 26.10.0rc1 or newer.
Vulnerable code sample
from twisted.words.protocols import irc
from twisted.internet import protocol, reactor
class MyIRCUser(irc.IRCUser):
def dataReceived(self, data):
# VULNERABLE: unbounded per-connection buffer before authentication
self.buffer += data # buffer grows without limit
while b'\n' in self.buffer:
line, self.buffer = self.buffer.split(b'\n', 1)
self.handleLine(line)
def handleLine(self, line):
# simple command handling (authentication omitted for brevity)
pass
class MyIRCFactory(protocol.ServerFactory):
protocol = MyIRCUser
reactor.listenTCP(6667, MyIRCFactory())
reactor.run()Patched code sample
from twisted.words.protocols import irc
from twisted.internet import protocol, reactor
MAX_LINE_LEN = 512 # FIX: impose reasonable line length limit
class MyIRCUser(irc.IRCUser):
def dataReceived(self, data):
# FIX: enforce max line length to prevent unbounded buffer growth
self.buffer += data
while b'\n' in self.buffer:
line, self.buffer = self.buffer.split(b'\n', 1)
if len(line) > MAX_LINE_LEN:
self.transport.loseConnection()
return
self.handleLine(line)
def handleLine(self, line):
# simple command handling (authentication omitted for brevity)
pass
class MyIRCFactory(protocol.ServerFactory):
protocol = MyIRCUser
reactor.listenTCP(6667, MyIRCFactory())
reactor.run()Published fix
Public sources link this CVE to the changes below. The code samples above were generated to illustrate the defect; these links lead to the code the project actually changed.
- bound the IRC server line length (twisted/twisted)
src/twisted/words/protocols/irc.py,src/twisted/words/protocols/irc.py · IRC.dataReceived,src/twisted/words/protocols/irc.py · IRC.lineLengthExceeded - words: bound the IRC server line buffer (Fixes #12770) (twisted/twisted)
src/twisted/words/protocols/irc.py,src/twisted/words/protocols/irc.py · IRC.dataReceived
Cite this entry
@misc{vaitp:cve2026115776,
title = {{Unauthenticated IRC buffer overflow causing memory exhaustion in Twisted.}},
author = {Bogaerts, Fr\'ed\'eric and Ivaki, Naghmeh and Fonseca, Jos\'e},
year = {2026},
note = {VAITP Python Vulnerability Dataset, entry CVE-2026-115776},
howpublished = {\url{https://netpack.pt/vaitp/vulnerability/CVE-2026-115776/}}
}
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 ::
