VDB
Sign up
LOW3.7

PYSEC-2026-3388

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

Quick fix

PYSEC-2026-3388 — tornado: upgrade to the fixed version with the command below.

pip install --upgrade 'tornado>=6.5.6'

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

Are you affected?

Enter the version of the package you're using.

Affected packages

PyPI/tornado
Introduced in: 0Fixed in: 6.5.6
Fixpip install --upgrade 'tornado>=6.5.6'

References

Check it before you install it

One call answers whether to add this package: known advisories, CISA KEV, and whether the name is a hallucinated or freshly squatted one. No key needed to try it.

curl -s https://vdb.ai.kr/v1/ai/check-packages \
  -H 'Content-Type: application/json' \
  -d '{"packages":["pkg:pypi/tornado"]}'