Synapse · Synapse · CVE-2021-41281
**Name of the Vulnerable Software and Affected Versions**
Synapse versions prior to 1.47.1
**Description**
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 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 with a federation whitelist are also unaffected, since Synapse will check the remote hostname against the whitelist.
**Recommendations**
For versions prior to 1.47.1, upgrade to 1.47.1 or later.
As a temporary workaround, server administrators using a reverse proxy can block the following endpoints: `/ matrix/media/r0/download/{serverName}/{mediaId}`, `/ matrix/media/r0/download/{serverName}/{mediaId}/{fileName}`, and `/ matrix/media/r0/thumbnail/{serverName}/{mediaId}`, but this will result in lost media functionality.
Alternatively, non-containerized deployments can be adapted to use the hardened systemd config, located at `contrib/systemd/override-hardened.conf`.