VYPR
Moderate severityNVD Advisory· Published Apr 15, 2021· Updated Aug 3, 2024

Denial of service (via resource exhaustion) due to improper input validation

CVE-2021-29433

Description

Sydent is a reference Matrix identity server. In Sydent versions 2.2.0 and prior, sissing input validation of some parameters on the endpoints used to confirm third-party identifiers could cause excessive use of disk space and memory leading to resource exhaustion. A patch for the vulnerability is in version 2.3.0. No workarounds are known to exist.

Affected packages

Versions sourced from the GitHub Security Advisory.

PackageAffected versionsPatched versions
matrix-sydentPyPI
< 2.3.02.3.0

Affected products

1

Patches

1
3175fd358ebc

Validation improvements

https://github.com/matrix-org/sydentRichard van der HoffApr 12, 2021via ghsa
3 files changed · +31 3
  • sydent/http/servlets/emailservlet.py+8 1 modified
    @@ -17,7 +17,7 @@
     
     from twisted.web.resource import Resource
     
    -from sydent.util.stringutils import is_valid_client_secret
    +from sydent.util.stringutils import is_valid_client_secret, MAX_EMAIL_ADDRESS_LENGTH
     from sydent.util.emailutils import EmailAddressException, EmailSendException
     from sydent.validators import (
         IncorrectClientSecretException,
    @@ -58,6 +58,13 @@ def render_POST(self, request):
                     'error': 'Invalid client_secret provided'
                 }
     
    +        if not (0 < len(email) <= MAX_EMAIL_ADDRESS_LENGTH):
    +            request.setResponseCode(400)
    +            return {
    +                'errcode': 'M_INVALID_PARAM',
    +                'error': 'Invalid email provided'
    +            }
    +
             ipaddress = self.sydent.ip_from_request(request)
             brand = self.sydent.brand_from_request(request)
     
    
  • sydent/http/servlets/store_invite_servlet.py+9 0 modified
    @@ -30,6 +30,8 @@
     from sydent.http.servlets import get_args, send_cors, jsonwrap, MatrixRestError
     from sydent.http.auth import authV2
     from sydent.util.emailutils import sendEmail
    +from sydent.util.stringutils import MAX_EMAIL_ADDRESS_LENGTH
    +
     
     class StoreInviteServlet(Resource):
         def __init__(self, syd, require_auth=False):
    @@ -71,6 +73,13 @@ def render_POST(self, request):
                     "error": "Didn't understand medium '%s'" % (medium,),
                 }
     
    +        if not (0 < len(address) <= MAX_EMAIL_ADDRESS_LENGTH):
    +            request.setResponseCode(400)
    +            return {
    +                'errcode': 'M_INVALID_PARAM',
    +                'error': 'Invalid email provided'
    +            }
    +
             token = self._randomString(128)
     
             tokenStore = JoinTokenStore(self.sydent)
    
  • sydent/util/stringutils.py+14 2 modified
    @@ -18,14 +18,23 @@
     from twisted.internet.abstract import isIPAddress, isIPv6Address
     
     # https://matrix.org/docs/spec/client_server/r0.6.0#post-matrix-client-r0-register-email-requesttoken
    -client_secret_regex = re.compile(r"^[0-9a-zA-Z\.\=\_\-]+$")
    +CLIENT_SECRET_REGEX = re.compile(r"^[0-9a-zA-Z\.=_\-]+$")
     
     # hostname/domain name
     # https://regex101.com/r/OyN1lg/2
     hostname_regex = re.compile(
         r"^(?:[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?)(?:\.[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?)*$",
         flags=re.IGNORECASE)
     
    +# it's unclear what the maximum length of an email address is. RFC3696 (as corrected
    +# by errata) says:
    +#    the upper limit on address lengths should normally be considered to be 254.
    +#
    +# In practice, mail servers appear to be more tolerant and allow 400 characters
    +# or so. Let's allow 500, which should be plenty for everyone.
    +#
    +MAX_EMAIL_ADDRESS_LENGTH = 500
    +
     
     def is_valid_client_secret(client_secret):
         """Validate that a given string matches the client_secret regex defined by the spec
    @@ -36,7 +45,10 @@ def is_valid_client_secret(client_secret):
         :return: Whether the client_secret is valid
         :rtype: bool
         """
    -    return client_secret_regex.match(client_secret) is not None
    +    return (
    +        0 < len(client_secret) <= 255
    +        and CLIENT_SECRET_REGEX.match(client_secret) is not None
    +    )
     
     
     def is_valid_hostname(string: str) -> bool:
    

Vulnerability mechanics

Generated by null/stub on May 9, 2026. Inputs: CWE entries + fix-commit diffs from this CVE's patches. Citations validated against bundle.

References

6

News mentions

0

No linked articles in our index yet.