GHSA-x345-32rc-8h85 CVE-2021-29471 PYSEC-2021-135
Denial of service attack via push rule patterns in matrix-synapse
- Severity
- 0.0 / 10
- Low · CVSS 4.0
- Exploit chance (EPSS)
- 1.65%
- Chance of exploitation in the next 30 days. Higher than 76.47% of scored vulnerabilities.
- Known exploited
- No
- Not in CISA's catalog
- Fix
1.33.2- Upgrade matrix-synapse to this version or later
Description
Impact
"Push rules" can specify conditions under which they will match, including event_match, which matches event content against a pattern including wildcards.
Certain patterns can cause very poor performance in the matching engine, leading to a denial-of-service when processing moderate length events.
Patches
The issue is patched by https://github.com/matrix-org/synapse/commit/03318a766cac9f8b053db2214d9c332a977d226c.
Workarounds
A potential workaround might be to prevent users from making custom push rules, by blocking such requests at a reverse-proxy.
For more information
If you have any questions or comments about this advisory, email us at security@matrix.org.
Affected versions
PyPI
| Package | Vulnerable | Fixed in |
|---|---|---|
| matrix-synapse | < 1.33.2 |
1.33.2 |
| matrix-synapse | < 1.33.2 |
1.33.2 |
How to fix
Move to the fixed version or later with your package manager, update the lockfile, and run your tests. If the package only arrives through another dependency, upgrade that dependency first. If none of its releases pulls a fixed version yet, force the version with your package manager's override.
matrix-synapse PyPI → 1.33.2
- pip
pip install --upgrade "matrix-synapse>=1.33.2"- poetry
poetry add "matrix-synapse>=1.33.2"- uv
uv add "matrix-synapse>=1.33.2"
Severity breakdown
CVSS 4.0 0.0
CVSS:4.0/AV:N/AC:L/AT:P/PR:N/UI:N/VC:N/VI:N/VA:L/SC:N/SI:N/SA:N
- Attack vector
- Network
- Attack complexity
- Low
- Attack requirements
- Present
- Privileges required
- None
- User interaction
- None
- Confidentiality (vulnerable system)
- None
- Integrity (vulnerable system)
- None
- Availability (vulnerable system)
- Low
- Confidentiality (subsequent systems)
- None
- Integrity (subsequent systems)
- None
- Availability (subsequent systems)
- None
CVSS 3.1 3.7
CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:N/I:N/A:L
- Attack vector
- Network
- Attack complexity
- High
- Privileges required
- None
- User interaction
- None
- Scope
- Unchanged
- Confidentiality
- None
- Integrity
- None
- Availability
- Low
Weakness
CWE-331: Insufficient Entropy
The product uses an algorithm or scheme that produces insufficient entropy, leaving patterns or clusters of values that are more likely to occur than others.
How to prevent it
- Implementation: Determine the necessary entropy to adequately provide for randomness and predictability. This can be achieved by increasing the number of bits of objects such as keys and seeds.
CWE-400: Uncontrolled Resource Consumption
The product does not properly control the allocation and maintenance of a limited resource.
How to prevent it
- Architecture and Design: Design throttling mechanisms into the system architecture. The best protection is to limit the amount of resources that an unauthorized user can cause to be expended. A strong authentication and access control model will help prevent such attacks from occurring in the first place. The login application should be protected against DoS attacks as much as possible. Limiting the database access, perhaps by caching result sets, can help minimize the resources expended. To further limit the potential for a DoS attack, consider tracking the rate of requests received from users and blocking requests that exceed a defined rate threshold.
- Architecture and Design: Mitigation of resource exhaustion attacks requires that the target system either: recognizes the attack and denies that user further access for a given amount of time, or uniformly throttles all requests in order to make it more difficult to consume resources more quickly than they can again be freed. The first of these solutions is an issue in itself though, since it may allow attackers to prevent the use of the system by a particular valid user. If the attacker impersonates the valid user, they may be able to prevent the user from accessing the server in question. The second solution is simply difficult to effectively institute -- and even when properly done, it does not provide a full solution. It simply makes the attack require more resources on the part of the attacker.
- Architecture and Design: Ensure that protocols have specific limits of scale placed on them.
- Implementation: Ensure that all failures in resource allocation place the system into a safe posture.
References
Advisories
Packages
Other links
- github.com/matrix-org/synapse/security/advisories/GHSA-x345-32rc-8h85
- github.com/matrix-org/synapse/commit/03318a766cac9f8b053db2214d9c332a977d226c
- github.com/matrix-org/synapse/releases/tag/v1.33.2
- github.com/pypa/advisory-database/tree/main/vulns/matrix-synapse/PYSEC-2021-135…
- lists.fedoraproject.org/archives/list/package-announce@lists.fedoraproject.org/message/TNNAJ…
Timeline
- Published
- Last updated by the source
- Latest EPSS score
Related advisories
| Advisory | Severity | Why it's related |
|---|---|---|
| GHSA-6qf2-7x63-mm6v Synapse pagination Denial of Service | Low | Also affects matrix-synapse |
| GHSA-8q93-326v-3m7g Synapse CPU starvation (Denial of Service) | Medium | Also affects matrix-synapse |
| GHSA-fh66-fcv5-jjfr Synapse's invalid device keys degrade federation functionality | Medium | Also affects matrix-synapse |
| GHSA-v56r-hwv5-mxg6 Synapse vulnerable to federation denial of service via malformed events | High | Also affects matrix-synapse |
| GHSA-56w4-5538-8v8h Synapse Matrix has a partial room state leak via Sliding Sync | Medium | Also affects matrix-synapse |
| GHSA-vp6v-whfm-rv3g Synapse can be forced to thumbnail unexpected file formats, invoking external, potentially untrustworthy decoders | Critical | Also affects matrix-synapse |
| GHSA-f3r3-h2mq-hx2h Synapse allows a a malformed invite to break the invitee's `/sync` | Medium | Also affects matrix-synapse |
| GHSA-rfq8-j7rh-8hf2 Synapse allows unsupported content types to lead to memory exhaustion | High | Also affects matrix-synapse |
MergeHarbor checks every repository's dependencies against this database, ranks what matters by exploitability and reachability, routes it to the owning team and opens the fix pull request.
Check your repos with MergeHarbor