CVE-2021-41281

Path traversal in Matrix Synapse

7.5 high EPSS 1.58%

Published 23 Nov 2021 Updated 4 Aug 2024 CNA: GitHub_M

Check your servers for CVE-2021-41281

The Vulnpocalypse collector sends the package list of each Linux server and of its container images once a day. Vulnpocalypse shows every server where CVE-2021-41281 affects synapse, with the command that installs the fix. The free plan covers one server and one domain and does not need a credit card.

Check my servers

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.

Severity (CVSS)

7.5 high CVSS 3.1 from GitHub_M (CNA)
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:H/A:N
Attack vector
network: an attacker can reach the vulnerable part over the network, often from the internet
Attack complexity
low: an attack works without special conditions
Privileges required
none: the attacker does not need an account
User interaction
none: nobody has to click or open anything
Scope
unchanged: the damage stays inside the vulnerable component
Impact
confidentiality none, integrity high, availability none: what an attacker can read (confidentiality), change (integrity) or stop (availability)

Exploitation

EPSS 1.58%: the probability of exploitation activity in the next 30 days, from the EPSS model of FIRST. The score is higher than 76.2% of all scored CVEs. Scores of 1 Dec 2026.

Weakness

  • CWE-22 Improper Limitation of a Pathname to a Restricted Directory

Affected products

As the CNA lists them.

ProductVersions
synapse
affected < 1.47.1

Is my server affected?

Find the installed version of synapse and compare it with the fixed version of your distribution. Distributions often fix a CVE in a package version of their own, so the version number of the upstream project can mislead.

Debian, Ubuntu

dpkg -l | grep -i synapse
# packages whose changelog names the CVE (fixed in the installed version)
zgrep -l CVE-2021-41281 /usr/share/doc/*/changelog.Debian.gz
# Ubuntu
pro fix CVE-2021-41281

RHEL, Rocky, Alma, Fedora

rpm -q synapse
# lists the advisory while the fix is not installed
dnf updateinfo list --cve CVE-2021-41281

Alpine

apk list --installed | grep -i synapse

With Trivy, on the host and for a container image. When a package is affected, it prints the installed and the fixed version:

trivy rootfs --scanners vuln / | grep CVE-2021-41281
trivy image --scanners vuln IMAGE | grep CVE-2021-41281

Vulnpocalypse makes this comparison every day for the package lists of your servers and container images, including language packages (npm, PyPI, Go, Maven and others), and sends the command that installs the fix. Start free with one server and one domain or read how to install the collector.

References

Advisories

Other references

Source: the record CVE-2021-41281 of the CVE List (CVE Program), CVE Terms of Use; EPSS of FIRST; the CWE catalog of MITRE, CWE Terms of Use. The text of the record is shown as published. Data sources and licences.