🛡️ CVE-2021-41281 — matrix-synapse
Description
Path traversal in Matrix Synapse
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.
How this vulnerability can be exploited
This issue can be reached over the network, attack complexity is low, an attacker needs no privileges on the target. No user interaction is required. Rated impact: confidentiality none, integrity high, availability none.
Weakness class
CVE-2021-41281 is classified as CWE-22: Path Traversal. A file path built from user input is not confined to the intended directory, letting an attacker reach files elsewhere on the filesystem.
Affected software
CVE-2021-41281 is recorded against 1 package.
- matrix-synapse (fixed in 1.47.1)
Timeline and source
Published on 23 November 2021 and last revised on 8 July 2026. No public exploit is currently recorded for this entry. A vendor advisory or fix has been published. Record sourced from OSV.
References
github.com (Web)
nvd.nist.gov (Advisory)
github.com (Web)
github.com (Package)
github.com (Web)
github.com (Web)
lists.fedoraproject.org (Web)
lists.fedoraproject.org (Web)
CVE-2021-41281 on other distributions
Each distribution ships its own build and its own fixed version. Pick the one you run:
Details
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
Affected Packages
| Software | From version | Fixed in |
|---|---|---|
| matrix-synapse | — | 1.47.1 |
References
Similar Threats
- Low CVE-2023-41335
- Low CVE-2023-42453
- Medium CVE-2023-32682
- Low CVE-2023-32683
- High CVE-2022-39335
More CVE 2021 advisories
Browse all of CVE 2021 in the advisory index.
Site Security Check
Is matrix-synapse part of your stack?
CVE-2021-41281 is rated CVSS 8.0 High. BotEraser scans your installation against known CVE records and tells you whether this vulnerability applies to the versions you actually run.
Scan My Site Free →No credit card required · Results in minutes
ⓘ Data Notice: The information presented above has been compiled from publicly available internet sources. Boteraser aggregates this data solely for informational purposes and does not independently classify, evaluate, or endorse any findings about the vulnerabilities listed. The accuracy and completeness of this information is the sole responsibility of the original publishers. Boteraser and its operators accept no liability for any decisions made based on this data.