Advisory

PYSEC-2026-3388

Also known as: CVE-2026-49854, GHSA-cx3h-4qpv-8hc9

Summary

Tornado has out-of-bounds memory access via C extension

Details

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).

Severity

Low Basis: CVSS v3 score 3.7, vector CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:L/I:N/A:N

Dates

Published
2026-07-13 15:46 UTC
Modified
2026-07-13 16:33 UTC

Affected packages and fixes

tornado

PyPI · All systems

Affected

  • introduced 0, fixed 6.5.6 (ecosystem)

Fixed versions

6.5.6

Fix

  • Fixed version 6.5.6
    pip install --upgrade tornado==6.5.6

Fix commands are the export's own generic commands. Ojuju never runs them. Check them against your setup first.

Check your own computer: guard packages check

View this record on OSV.dev

Source

Source: PyPA Advisory Database · CC BY 4.0

Sources & licences