Tornado: StaticFileHandler follows symlinks outside static root (path traversal)
Summary
StaticFileHandler allows an unauthenticated attacker to read arbitrary files from the server's filesystem by requesting a path that resolves to a symbolic link placed inside the static root directory. Any application that serves user-uploadable content, or whose static directory is populated by a build/deploy pipeline that creates symlinks (e.g. npm link, webpack, Docker volume mounts, CDN sync tools), is affected. An attacker who can trigger the creation of a symlink pointing outside the static root—or exploit one that already exists—can retrieve sensitive files such as /etc/passwd, private keys, configuration files, or application secrets.
Details
The vulnerability is in tornado.web.StaticFileHandler, specifically in the interaction between two methods in tornado/web.py:
- get_absolute_path uses
os.path.abspath()to resolve the requested path: - validate_absolute_path uses the same
os.path.abspath()on the root, then performs a string prefix check:
os.path.abspath() normalises . and .. segments but does not resolve symbolic links. As a result, a path like /var/www/static/link passes the startswith("/var/www/static/") check regardless of where link actually points.
Immediately after, os.path.exists() and os.path.isfile() do follow symlinks, so the file they ultimately open is the symlink's target. The fix would be to replace os.path.abspath() with os.path.realpath() in both methods, so the resolved real path of the symlink target is validated against the root, not just its string representation inside the static directory.
PoC
Complete instructions, including specific configuration details, to reproduce the vulnerability. Prerequisites: Python 3.x, Tornado installed.
- Create the environment
mkdir -p /tmp/static
echo "DB_PASSWORD=s3cr3t" > /tmp/secret.conf
ln -s /tmp/secret.conf /tmp/static/config.conf
- Minimal vulnerable server (server.py):
import tornado.web, tornado.ioloop
app = tornado.web.Application([
(r"/static/(.*)", tornado.web.StaticFileHandler, {"path": "/tmp/static"}),
])
app.listen(8888)
tornado.ioloop.IOLoop.current().start()
- Exploit:
curl http://localhost:8888/static/config.conf
Impact
Any application using StaticFileHandler is potentially affected if:
- the static directory contains symlinks pointing outside it (common with build tooling), or
- the application allows file uploads into the static directory without stripping symlinks.
An unauthenticated remote attacker can read any file readable by the process user: application secrets, private TLS keys, database credentials, /etc/shadow, SSH keys, or source code (depending on the process's filesystem permissions).
Software afectado
Haz clic en una tecnología para ver todas sus vulnerabilidades.
| Plataforma | Paquete | Versiones vulnerables | Corregida en |
|---|---|---|---|
| Python (PyPI) | tornado | < 6.5.9 | 6.5.9 |
Referencias
- https://github.com/tornadoweb/tornado/security/advisories/GHSA-c2m8-h5v5-343r
- https://github.com/tornadoweb/tornado/pull/3719
- https://github.com/tornadoweb/tornado/commit/437ab5f76565403b3403438d2e555d11f8128d32
- https://github.com/tornadoweb/tornado/commit/f9f50b8bab265a2abf9f2415a3d2da6264a5450b
- https://github.com/tornadoweb/tornado
- https://github.com/tornadoweb/tornado/releases/tag/v6.5.9
- Vector CVSS
CVSS:4.0/AV:N/AC:H/AT:P/PR:N/UI:N/VC:H/VI:N/VA:N/SC:N/SI:N/SA:N- Debilidad (CWE)
CWE-59- Plataforma
- Python (PyPI)
- Paquete
tornado- Publicada
- 30.09.2026
- Actualizado
- 11.10.2026 15:18
Fuentes y licencias
OSV / GitHub Advisory Database - GHSA-c2m8-h5v5-343r - CC BY 4.0
Historial de vulnerabilidades: tornado
Todas las vulnerabilidades publicadas de este paquete (Python (PyPI)), de la más reciente a la más antigua. Muestra si es un fallo aislado o un paquete que hay que vigilar.
- Entradas en total
- 23
- Primera → última
- 05.2012 09.2026
- Sin corrección
- 0
- Explotada en ataques
- 0
Distribución por gravedad
- Alta 13
- Media 8
- Baja 2
Divulgaciones por año
- 2017: 0
- 2018: 0
- 2019: 0
- 2020: 1
- 2021: 0
- 2022: 0
- 2023: 2
- 2024: 3
- 2025: 4
- 2026: 12
antes: 1
-
Tornado: StaticFileHandler follows symlinks outside static root (path traversal) esta entrada
Identifica las vulnerabilidades de tu aplicación
Con la integración de DockRay y el inventario de software activado, DockRay compara las versiones notificadas de los componentes con las vulnerabilidades conocidas y avisa de las coincidencias confirmadas. La cobertura depende de la tecnología compatible y de los avisos disponibles.