CVE-2026-49854
JSON

5.3medium

Tornado: Out-of-bounds memory access in C extension

Severity
5.3medium CVSS:3.1 by GitHub_M
Exploit likelihood
0.34% (higher than 29% of CVEs; EPSS, by FIRST)
Published
Last changed
Assigned by
GitHub_M
Also known as
GHSA-cx3h-4qpv-8hc9PYSEC-2026-3388

Description

Tornado is a Python web framework and asynchronous networking library. Prior to 6.5.6, the optional native extension tornado.speedups implemented websocket_mask without validating that the mask argument is exactly four bytes, allowing the C function to read up to three bytes beyond the provided buffer when reached through Tornado XSRF token decoding with the native extension active. This issue is fixed in version 6.5.6.

Affected

Product or packageVersionsReported by
tornadoweb tornado< 6.5.6CVE List
tornado (PyPI)before 6.5.6GitHub Advisory Database, PyPA Advisory Database

All scores

GitHub_M5.3medium CVSS:3.1CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:L/I:N/A:N
GitHub3.7low CVSS:3.1CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:L/I:N/A:N
PyPA Advisory Database3.7low CVSS:3.1CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:L/I:N/A:N

Classification

CWE-126

SSVC (CISA-ADP): exploitation none, automatable yes, technical impact partial.

What each source says

CVE List

Tornado is a Python web framework and asynchronous networking library. Prior to 6.5.6, the optional native extension tornado.speedups implemented websocket_mask without validating that the mask argument is exactly four bytes, allowing the C function to read up to three bytes beyond the provided buffer when reached through Tornado XSRF token decoding with the native extension active. This issue is fixed in version 6.5.6.

GitHub Advisory Database
Summary

Tornado's optional native extension tornado.speedups implements websocket_mask without validating that the mask argument is exactly four bytes long. The C function reads four bytes from mask unconditionally, even when Python passes a shorter byte string. This can read beyond the provided buffer, exposing up to 3 bytes of uninitialized memory.

The behavior is reachable from Tornado's XSRF token decoder when xsrf_cookies=True and the native extension is active.

Mitigations

This bug is fixed in Tornado 6.5.6. Prior to upgrading to this version, setting the environment variable TORNADO_EXTENSION=0 will disable the vulnerable code (at the expense of reducing websocket performance).

NVD (es)

Tornado es un framework web de Python y una biblioteca de red asíncrona. Antes de la 6.5.6, la extensión nativa opcional tornado.speedups implementaba websocket_mask sin validar que el argumento mask fuera exactamente de cuatro bytes, permitiendo que la función C leyera hasta tres bytes más allá del búfer proporcionado cuando se accedía a ella a través de la decodificación de tokens XSRF de Tornado con la extensión nativa activa. Este problema se solucionó en la versión 6.5.6.

References

Sources

SourceRecordLicence
CVE ListCVE-2026-49854 changed 2026-07-15CVE Terms of Use
GitHub Advisory DatabaseGHSA-cx3h-4qpv-8hc9 changed 2026-09-10CC-BY-4.0
NVDCVE-2026-49854 changed 2026-10-24Public domain
PyPA Advisory DatabasePYSEC-2026-3388 changed 2026-07-13CC-BY-4.0