Bug 1186027 (CVE-2021-32917) - VUL-1: CVE-2021-32917,CVE-2021-32918,CVE-2021-32919,CVE-2021-32920,CVE-2021-32921: Prosody XMPP server advisory 2021-05-12 (multiple vulnerabilities)
Summary: VUL-1: CVE-2021-32917,CVE-2021-32918,CVE-2021-32919,CVE-2021-32920,CVE-2021-3...
Status: RESOLVED FIXED
Alias: CVE-2021-32917
Product: openSUSE Distribution
Classification: openSUSE
Component: Other (show other bugs)
Version: Leap 15.2
Hardware: Other Other
: P4 - Low : Minor (vote)
Target Milestone: ---
Assignee: Michael Vetter
QA Contact: Security Team bot
URL: https://kibla.de
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2021-05-13 15:13 UTC by Gianluca Gabrielli
Modified: 2023-02-05 14:45 UTC (History)
2 users (show)

See Also:
Found By: Security Response Team
Services Priority:
Business Priority:
Blocker: ---
Marketing QA Status: ---
IT Deployment: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Gianluca Gabrielli 2021-05-13 15:13:38 UTC
Prosody security advisory 2021-05-12
====================================

Project
:   Prosody XMPP server

URL
:   https://prosody.im/

Date
:   2021-05-12

This advisory details 5 new security vulnerabilities discovered in the
Prosody.im XMPP server software. All issues are fixed in the 0.11.9 release
default configuration.

**References**

 - Release announcement: https://blog.prosody.im/prosody-0.11.9-released/
 - Advisory (HTML): https://prosody.im/security/advisory_20210512/
 - Advisory (text): https://prosody.im/security/advisory_20210512.txt

1/5: DoS via insufficient memory consumption controls
-----------------------------------------------------

CVE
: CVE-2021-32918

CVSS
: 7.0 (CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H/E:F/RL:O/RC:C)

CWEs
: CWE-400

Affected versions
: All versions prior to 0.11.9

Fixed versions
: 0.11.9, 0.11 nightly build 130, trunk nightly build 1434

**Description**

It was discovered that default settings leave Prosody susceptible to remote
unauthenticated denial-of-service (DoS) attacks via memory exhaustion when
running under Lua 5.2 or Lua 5.3. Lua 5.2 is the default and recommended Lua
version for Prosody 0.11.x series.

**Affected configurations**

The default configuration is susceptible to this issue.

Configurations with stricter settings for stanza size limits, rate limits and
garbage collection parameters are at decreased risk from this attack. For more
details please review the 'Mitigation' section for recommended values.

**Mitigation**

Mitigation is possible through configuration changes (on 0.11.7+). All the
configuration changes described in this section are applied by default in
Prosody 0.11.9.

1) Enable more aggressive garbage collection

   On Lua 5.2 and 5.3, the garbage collector does not free unused memory fast
   enough by default. This allowed Prosody's memory usage to grow excessively
   during certain traffic patterns.

   It is recommended to set a garbage collection speed of at least 500 in the
   global section of your configuration file:

   ```
     gc = {
       speed = 500;
     }
   ```

   Be aware that this setting may increase CPU usage if the other mitigations
   in this section are not applied.

2) Enable stricter stanza size limits

   By default Prosody ships with extremely permissive stanza size limits (up
   to 10MB). This value was introduced as a way to place a limit on memory
   usage without affecting legitimate use of the server. However testing
   demonstrates that the default limit is too high for most deployments.

   Our recommendation (and the default in 0.11.9) is to adopt the same default
   size limits that are already enforced by ejabberd, one of the other major
   XMPP servers on the network.

   To enable the new limits explicitly, add to the global section of your
   configuration file the following options:

     c2s_stanza_size_limit = 256 * 1024
     s2s_stanza_size_limit = 512 * 1024

   Be aware that reducing limits has the potential to introduce
   interoperability issues with deployments that do not enforce the same size
   limits. For example, remote contacts with large avatars.

3) Enable rate limits

   By default Prosody does not enable any rate limits. However we recommend
   enabling them for all production and public deployments to ensure fair
   consumption of resources across all connections.

   First, ensure that mod_limits is enabled by adding "limits" to your
   global modules_enabled configuration option:

   ```
     modules_enabled = {
       ...
       "limits";
       ...
     }
   ```

   Next, configure the limits:

   ```
     limits = {
       c2s = {
         rate = "10kb/s";
       };
       s2sin = {
         rate = "30kb/s";
       }
     }
   ```

**Advice**

All public deployments should upgrade to 0.11.9 or apply the above
configuration changes.

Deployments using nightly builds should upgrade to the latest available
builds.

**Credits**

Many thanks to Travis Burtrum (moparisthebest) for discovering and reporting
this issue, and providing a test case.

**Commits**

- https://hg.prosody.im/trunk/rev/db8e41eb6eff
- https://hg.prosody.im/trunk/rev/b0d8920ed5e5
- https://hg.prosody.im/trunk/rev/929de6ade6b6
- https://hg.prosody.im/trunk/rev/63fd4c8465fb
- https://hg.prosody.im/trunk/rev/1937b3c3efb5
- https://hg.prosody.im/trunk/rev/3413fea9e6db

----------------------------------------------------------------------------

2/5: DoS via repeated TLS renegotiation causing excessive CPU consumption
----------------------------------------------------------------------------

CVE
: CVE-2021-32920

CVSS
: 5.1 (CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:L/E:H/RL:O/RC:C)

CWEs
: CWE-400

Affected versions
: All versions prior to 0.11.9

Fixed versions
: 0.11.9, 0.11 nightly build 130, trunk nightly build 1434

**Description**

It was discovered that Prosody does not disable SSL/TLS renegotiation, even
though this is not used in XMPP. A malicious client may flood a connection
with renegotiation requests to consume excessive CPU resources on the server.

Support for disabling renegotiation depends on OpenSSL 1.1.1+ and LuaSec 0.7+.

**Affected configurations**

The default configuration is susceptible to this issue.

**Temporary mitigation**

Ensure you have OpenSSL 1.1.1 or higher and LuaSec 0.7 or higher, and set the
following ssl option (or add to your existing one if you have one):

```
  ssl = {
    options = {
      no_renegotiation = true;
    }
  }
```

This configuration is applied by default in 0.11.9.

**Advice**

All public deployments should upgrade to 0.11.9 or apply the above
configuration changes.

Deployments using nightly builds should upgrade to the latest available
builds.

**Credits**

This flaw was discovered by Kim Alvefur, a member of the Prosody team.

**Commits**

- https://hg.prosody.im/trunk/rev/55ef50d6cf65
- https://hg.prosody.im/trunk/rev/5a484bd050a7
- https://hg.prosody.im/trunk/rev/aaf9c6b6d18d

-----------------------------------------------------------------------

3/5: Use of timing-dependent string comparison with sensitive values
-----------------------------------------------------------------------

CVE
: CVE-2021-32921

CVSS
: 4.7 (CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:H/I:N/A:N/E:U/RL:O/RC:U)

CWEs
: CWE-1254

Affected versions
: All versions prior to 0.11.9

Fixed versions
: 0.11.9, 0.11 nightly build 130, trunk nightly build 1434

**Description**

It was discovered that Prosody does not use a constant-time algorithm for
comparing certain secret strings when running under Lua 5.2 or later. This can
potentially be used in a timing attack to reveal the contents of secret
strings to an attacker.

Lua 5.1 utilizes a technique called "string interning", which protected string
comparisons from timing attacks. In Lua 5.2 and later versions, strings over
40 bytes in length are excluded from interning.

With Prosody running under Lua 5.2, this makes any secret string over 40 bytes
in length vulnerable to potential discovery via timing attacks.

Note that if a secret string contains non-ASCII (unicode) characters, it may
be longer than 40 bytes when encoded as UTF-8 (Prosody's internal encoding)
even if it is fewer than 40 characters long.

It should be noted that to successfully perform a timing attack, a significant
number of failed attempts must typically be made to "guess" at the contents of
the secret string.

We are not aware of any attempts to exploit this vulnerability (which would
likely be noticeable), and no known proof-of-concept exploit exists.

**Affected configurations**

This flaw affects the following modules:

  - mod_auth_internal_plain (disabled by default)

    mod_auth_internal_plain performs a timing-dependent comparison to the
    user's password if the user's password is longer than 40 bytes. This may
    allow an attacker to discover a user's password via a timing attack.

    We do not generally recommend mod_auth_internal_plain for new deployments,
    and mod_auth_internal_hashed has been the default for Prosody 0.11.x.

  - mod_muc (disabled by default)

    mod_muc supports password-protection of MUCs. The password validity check
    is performed using a timing-dependent comparison, which may allow an
    attacker to discover the MUC password via a timing attack if the password
    is longer than 40 bytes.

    We do not generally recommend using password-protected MUCs. Instead use
    affiliations to directly grant access to specific JIDs whenever possible.

  - mod_auth_internal_hashed (enabled by default but not typically vulnerable)

    mod_auth_internal_hashed has been updated for safety, but it is
    not vulnerable in the default configuration of Lua 5.2 as the password
    hashes it compares do not exceed 40 bytes.

  - mod_dialback (enabled by default but not typically vulnerable)

    mod_dialback has been updated for safety, but due to the single-use nature
    of s2s dialback verification strings a timing attack on this module is not
    believed to be possible, or to grant an attacker any advantage if it were.

**Temporary mitigation**

mod_auth_internal_plain: we recommend that people upgrade to
mod_auth_internal_hashed due to this and also to benefit from its other
security properties.

mod_muc: use affiliations to grant access to a MUC instead of passwords. If
passwords must be used, ensure they are shorter than 40 bytes.

Rate limits can greatly lengthen the amount of time required to successfully
complete a timing attack. Enable and configure mod_limits.

**Advice**

All deployments should upgrade to 0.11.9.

Deployments using nightly builds should upgrade to the latest available
builds.

**Credits**

This flaw was discovered by Matthew Wild, a member of the Prosody team. The
issue with MUC passwords was also previously identified by Robert Grösser.

**Commits**

- https://hg.prosody.im/trunk/rev/c98aebe601f9
- https://hg.prosody.im/trunk/rev/13b84682518e
- https://hg.prosody.im/trunk/rev/6f56170ea986

-------------------------------------------------------------------

4/5: Use of mod_proxy65 is unrestricted in default configuration
-------------------------------------------------------------------

CVE
: CVE-2021-32917

CVSS
: 5.1 (CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:L/E:H/RL:O/RC:C)

CWEs
: CWE-862, CWE-400

Affected versions
: All versions prior to 0.11.9

Fixed versions
: 0.11.9, 0.11 nightly build 130, trunk nightly build 1434

**Description**

mod_proxy65 is a file transfer proxy provided with Prosody to facilitate the
transfer of files and other data between XMPP clients.

It was discovered that the proxy65 component of Prosody allows open access
by default, even if neither of the users have an XMPP account on the local
server, allowing unrestricted use of the server's bandwidth.

**Affected configurations**

The default configuration does not enable mod_proxy65 and is not affected.

With mod_proxy65 enabled, all configurations without a 'proxy65_acl' setting
configured are affected.

**Temporary mitigation**

Configure 'proxy65_acl' to a list of XMPP domains that should be allowed
to use the file transfer proxy.

**Advice**

All deployments should upgrade to 0.11.9 and/or configure a 'proxy65_acl' as
desired.

Deployments using nightly builds should upgrade to the latest available
builds.

The default behaviour in 0.11.9 allows all local clients to initiate a data
stream through the proxy if proxy65_acl is unconfigured.

**Credits**

This flaw was discovered by the Prosody team.

**Commits**

- https://hg.prosody.im/trunk/rev/65dcc175ef5b

--------------------------------------------------------------

5/5: Undocumented dialback-without-dialback option insecure
--------------------------------------------------------------

CVE
: CVE-2021-32919

Affected versions
: Prosody 0.10.x, Prosody 0.11.x prior to 0.11.9

Fixed versions
: 0.11.9, 0.11 nightly build 130, trunk nightly build 1434

**Description**

The undocumented option 'dialback_without_dialback' enabled an experimental
feature for server-to-server authentication. A flaw in this feature meant it
did not correctly authenticate remote servers, allowing a remote server to
impersonate another server when this option is enabled.

**Affected configurations**

The default configuration is not affected.

Configurations with the setting 'dialback_without_dialback' set to true are
affected.

**Temporary mitigation**

Remove or disable the 'dialback_without_dialback' option.

**Advice**

All deployments should upgrade to 0.11.9 or disable this feature.

Deployments using nightly builds should upgrade to the latest available
builds.

The affected feature has been removed in 0.11.9.

**Credits**

This flaw was discovered by the Prosody team.

**Commits**

- https://hg.prosody.im/trunk/rev/6be890ca492e
- https://hg.prosody.im/trunk/rev/d0e9ffccdef9
Comment 1 Gianluca Gabrielli 2021-05-13 15:16:38 UTC
All issues are fixed in the 0.11.9 release. Please submit updates for the following packages:

openSUSE:Factory/prosody
openSUSE:Leap:15.2/prosody
openSUSE:Backports:SLE-15-SP1/prosody
openSUSE:Backports:SLE-15-SP2/prosody
openSUSE:Backports:SLE-15-SP3/prosody

Thanks
Comment 2 Michael Vetter 2021-05-14 08:21:52 UTC
Issue was fixed in devel repo with: SR#892942

SR#893045 to Factory
SR#893049 to openSUSE:Leap:15.2:Update
SR#893050 to openSUSE:Leap:15.3:Update
Comment 3 OBSbugzilla Bot 2021-05-14 08:50:03 UTC
This is an autogenerated message for OBS integration:
This bug (1186027) was mentioned in
https://build.opensuse.org/request/show/893045 Factory / prosody
https://build.opensuse.org/request/show/893049 15.2 / prosody
https://build.opensuse.org/request/show/893050 15.3 / prosody
Comment 4 Swamp Workflow Management 2021-05-15 01:15:27 UTC
openSUSE-SU-2021:0728-1: An update that fixes four vulnerabilities is now available.

Category: security (important)
Bug References: 1186027
CVE References: CVE-2021-32917,CVE-2021-32918,CVE-2021-32919,CVE-2021-32920
JIRA References: 
Sources used:
openSUSE Leap 15.2 (src):    prosody-0.11.9-lp152.2.3.1
Comment 5 Swamp Workflow Management 2021-05-18 07:15:25 UTC
openSUSE-SU-2021:0751-1: An update that fixes four vulnerabilities is now available.

Category: security (important)
Bug References: 1186027
CVE References: CVE-2021-32917,CVE-2021-32918,CVE-2021-32919,CVE-2021-32920
JIRA References: 
Sources used:
openSUSE Backports SLE-15-SP2 (src):    prosody-0.11.9-bp152.2.3.1
Comment 6 Michael Vetter 2021-06-02 08:33:30 UTC
SRs accepted.
Comment 7 Swamp Workflow Management 2021-07-08 19:18:12 UTC
openSUSE-SU-2021:0991-1: An update that fixes four vulnerabilities is now available.

Category: security (moderate)
Bug References: 1186027
CVE References: CVE-2021-32917,CVE-2021-32918,CVE-2021-32919,CVE-2021-32920
JIRA References: 
Sources used:
openSUSE Backports SLE-15-SP3 (src):    prosody-0.11.9-bp153.2.3.1
Comment 8 Ahmed Sayeed 2021-10-13 16:54:51 UTC
gdb: fix value_subscript when array upper bound is not known http://www-look-4.com/category/health/
    
    Since commit 7c6f27129631 ("gdb: make get_discrete_bounds check for https://komiya-dental.com/category/crypto/ 
    non-constant range bounds"), subscripting  flexible array member fails:
    http://www.iu-bloomington.com/category/health/
        struct no_size
        { https://waytowhatsnext.com/category/health/
          int n;
          int items[];
        };
     http://www.wearelondonmade.com/category/health/
        (gdb) p *ns
        $1 = {n = 3, items = 0x5555555592a4}
        (gdb) p ns->items[0] http://www.jopspeech.com/category/health/
        Cannot access memory at address 0xfffe555b733a0164
        (gdb) p *((int *) 0x5555555592a4)
        $2 = 101  <--- we would expect that http://joerg.li/category/health/
        (gdb) p &ns->items[0]
        $3 = (int *) 0xfffe5559ee829a24  <--- wrong address http://connstr.net/category/health/
    
    Since the flexible array member (items) has an unspecified size, the array type
    created for it in the DWARF doesn't have dimensions (this is with gcc 9.3.0, http://embermanchester.uk/category/health/
    Ubuntu 20.04):
    http://www.slipstone.co.uk/category/health/
        0x000000a4:   DW_TAG_array_type
                        DW_AT_type [DW_FORM_ref4]       (0x00000038 "int")
                        DW_AT_sibling [DW_FORM_ref4]    (0x000000b3) http://www.logoarts.co.uk/category/health/
    
        0x000000ad:     DW_TAG_subrange_type
                          DW_AT_type [DW_FORM_ref4]     (0x00000031 "long unsigned int")
    http://www.acpirateradio.co.uk/category/health/
    This causes GDB to create a range type (TYPE_CODE_RANGE) with a defined
    constant low bound (dynamic _prop with kind PROP_CONST) and an undefined
    high bound (dynamic_prop with kind PROP_UNDEFINED). http://www.compilatori.com/category/health/
    
    value_subscript gets both bounds of that range using
    get_discrete_bounds.  Before commit 7c6f27129631, get_discrete_bounds
    didn't check the kind of the dynamic_props and would just blindly read
    them as if they were PROP_CONST. https://www.webb-dev.co.uk/category/health/  It would return 0 for the high bound,
    because we zero-initialize the range_bounds structure.  And it didn't
    really matter in this case, because the returned high bound wasn't used
    in the end.