7.5high
Path traversal in Matrix Synapse
- Severity
- 7.5high CVSS:3.1 by GitHub_M
- Exploit likelihood
- 1.58% (higher than 76% of CVEs; EPSS, by FIRST)
- Published
- Last changed
- Assigned by
- GitHub_M
- Also known as
- GHSA-3hfw-x7gx-437cPYSEC-2021-436
Description
Synapse is a package for Matrix homeservers written in Python 3/Twisted. Prior to version 1.47.1, Synapse instances with the media repository enabled can be tricked into downloading a file from a remote server into an arbitrary directory. No authentication is required for the affected endpoint. The last 2 directories and file name of the path are chosen randomly by Synapse and cannot be controlled by an attacker, which limits the impact. Homeservers with the media repository disabled are unaffected. Homeservers with a federation whitelist are also unaffected, since Synapse will check the remote hostname, including the trailing `../`s, against the whitelist. Server administrators should upgrade to 1.47.1 or later. Server administrators using a reverse proxy could, at the expense of losing media functionality, may block the certain endpoints as a workaround. Alternatively, non-containerized deployments can be adapted to use the hardened systemd config.
Affected
| Product or package | Versions | Reported by |
|---|---|---|
| matrix-org synapse | < 1.47.1 | CVE List |
| matrix-synapse (PyPI) | before 1.47.1, before 91f2bd0907f1d05af67166846988e49644eb650c | GitHub Advisory Database, PyPA Advisory Database |
| matrix synapse | before 1.47.1 | NVD |
| fedoraproject fedora | 34, 35 | NVD |
All scores
| GitHub_M | 7.5high CVSS:3.1 | CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:H/A:N |
| GitHub | 7.5high CVSS:3.1 | CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:H/A:N |
| GitHub | high CVSS:4.0 | CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:N/VC:N/VI:H/VA:N/SC:N/SI:N/SA:N |
| NVD | 4.3medium CVSS:2.0 | AV:N/AC:M/Au:N/C:N/I:P/A:N |
Classification
What each source says
CVE List
Synapse is a package for Matrix homeservers written in Python 3/Twisted. Prior to version 1.47.1, Synapse instances with the media repository enabled can be tricked into downloading a file from a remote server into an arbitrary directory. No authentication is required for the affected endpoint. The last 2 directories and file name of the path are chosen randomly by Synapse and cannot be controlled by an attacker, which limits the impact. Homeservers with the media repository disabled are unaffected. Homeservers with a federation whitelist are also unaffected, since Synapse will check the remote hostname, including the trailing `../`s, against the whitelist. Server administrators should upgrade to 1.47.1 or later. Server administrators using a reverse proxy could, at the expense of losing media functionality, may block the certain endpoints as a workaround. Alternatively, non-containerized deployments can be adapted to use the hardened systemd config.
GitHub Advisory Database
Impact
Synapse instances with the media repository enabled can be tricked into downloading a file from a remote server into an arbitrary directory, potentially outside the media store directory.
The last two directories and file name of the path are chosen randomly by Synapse and cannot be controlled by an attacker, which limits the impact.
Homeservers with the media repository disabled are unaffected. Homeservers configured with a federation whitelist are also unaffected.
Patches
Server administrators should upgrade to 1.47.1 or later.
Workarounds
Server administrators using a reverse proxy could, at the expense of losing media functionality, block the following endpoints:
/_matrix/media/r0/download/{serverName}/{mediaId}/_matrix/media/r0/download/{serverName}/{mediaId}/{fileName}/_matrix/media/r0/thumbnail/{serverName}/{mediaId}
Alternatively, non-containerized deployments can be adapted to use the hardened systemd config, located at contrib/systemd/override-hardened.conf.
References
n/a
For more information
If you have any questions or comments about this advisory, e-mail us at security@matrix.org.
NVD (es)
Synapse es un paquete para servidores domésticos Matrix escrito en Python 3/Twisted. En versiones anteriores a 1.47.1, las instancias de Synapse con el repositorio de medios habilitado pueden ser engañadas para descargar un archivo de un servidor remoto en un directorio arbitrario. No es requerida autenticación para el endpoint afectado. Los dos últimos directorios y el nombre del archivo de la ruta son elegidos al azar por Synapse y no pueden ser controlados por un atacante, lo que limita el impacto. Los servidores domésticos con el repositorio de medios deshabilitado no están afectados. Los servidores domésticos con una lista blanca de la federación tampoco están afectados, ya que Synapse comprobará el nombre de host remoto, incluyendo el final "../", con la lista blanca. Los administradores de servidores deben actualizar a la versión 1.47.1 o posterior. Los administradores de servidores que usen un proxy inverso podrían, a costa de perder la funcionalidad de los medios de comunicación, bloquear ciertos endpoints como solución. Como alternativa, los despliegues sin contenedores pueden adaptarse para usar la configuración systemd endurecida
References
Sources
| Source | Record | Licence |
|---|---|---|
| CVE List | CVE-2021-41281 changed 2024-08-04 | CVE Terms of Use |
| GitHub Advisory Database | GHSA-3hfw-x7gx-437c changed 2026-07-08 | CC-BY-4.0 |
| NVD | CVE-2021-41281 changed 2026-06-17 | Public domain |
| PyPA Advisory Database | PYSEC-2021-436 changed 2026-02-26 | CC-BY-4.0 |