CVE-2022-24968: Mellium.im/xmpp Improper Validation Of Certificate With Vulnerability

MODERATE
Advisory Identifier: GHSA-h289-x5wc-xcv8
CVSS 5.9
CWE-295
Published
Advisory Summary

CVE-2022-24968 is a MODERATE (CVSS 5.9) improper validation of certificate with vulnerability (CWE-295: Improper Certificate Validation) affecting Mellium.im/xmpp libraries in the Go ecosystem. The issue involves improper validation of certificate with host mismatch in mellium.im/xmpp/websocket. Remediation is available by upgrading affected packages to version 0.21.1.

CVE-2022-24968 at a Glance

CVE Identifier CVE-2022-24968
GHSA Identifier GHSA-h289-x5wc-xcv8
Severity MODERATE
CVSS v3.1 Base Score 5.9
CWE Classification CWE-295: Improper Certificate Validation
Affected Product Mellium.im/xmpp
Package Ecosystem Go
Published Date
Last Updated

Security Impact

CVSS: 5.9

The security impact metrics below are parsed directly from the CVSS v3.1 vector string (CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:N/I:H/A:N).

Attack Vector Network (AV:N)
Attack Complexity High (AC:H)
Privileges Required None (PR:N)
User Interaction None (UI:N)
Scope Unchanged (S:U)
Confidentiality None (C:N)
Integrity High (I:H)
Availability None (A:N)

How to Fix CVE-2022-24968

To remediate this vulnerability, upgrade all affected Mellium.im/xmpp dependencies to a patched release. Both direct and transitive dependencies should be checked, as frameworks or security libraries may pull in vulnerable versions transitively.

mellium.im/xmpp fixed: 0.21.1
Upgrade mellium.im/xmpp to 0.21.1
Verify Direct and Transitive Dependencies

Run the following command in your project directory to verify that all resolved dependencies use the patched release:

inspect dependencies for mellium.im/xmpp

How to Check if You Are Affected

To determine whether your application is affected by CVE-2022-24968, inspect your project dependencies for Mellium.im/xmpp:

inspect dependencies for mellium.im/xmpp

Analyze the terminal output to locate any version of Mellium.im/xmpp in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 0.21.1), your application is affected.

Note: Verify declared build manifests and deployed runtime container environments.

Technical Details

Vulnerability Mechanism & Technical Analysis

This vulnerability is classified under CWE-295: Improper Certificate Validation, where the product does not validate, or incorrectly validates, a certificate. In Mellium.im/xmpp, software state validation or input boundaries are circumvented during processing. Review the official source advisory statement below for specific affected components, classes, and reproduction details.

Source Advisory Statement

### Impact If no TLS configuration is provided by the user, the websocket package constructs its own TLS configuration using recommended defaults. When looking up a WSS endpoint using the DNS TXT record method described in [XEP-0156: Discovering Alternative XMPP Connection Methods](https://xmpp.org/extensions/xep-0156.html) the ServerName field was incorrectly being set to the name of the server returned by the TXT record request, not the name of the initial server we were attempting to connect to. This means that any attacker that can spoof a DNS record (ie. in the absence of DNSSEC, DNS-over-TLS, DNS-over-HTTPS, or similar technologies) could redirect the user to a server of their choosing and as long as it had a valid TLS certificate for itself the connection would succeed, resulting in a MITM situation. ### Patches All users should upgrade to v0.21.1. ### Workarounds To work around the issue, manually specify a TLS configuration with the correct hostname. ### References - https://mellium.im/cve/cve-2022-24968/ - https://nvd.nist.gov/vuln/detail/CVE-2022-24968 ### For more information If you have any questions or comments about this advisory: * Reach out on XMPP to [sam@samwhited.com](xmpp:sam@samwhited.com?msg) * Email us at [sam@samwhited.com](mailto:sam@samwhited.com)

CVE-2022-24968 Affected Mellium.im/xmpp Versions

1 component(s)
Fixed Versions:
0.21.1
Product / Package Ecosystem Affected Versions Fixed Version
mellium.im/xmpp
Go
≥ 0.18.0
< 0.21.1
0.21.1

References

Frequently Asked Questions

What is CVE-2022-24968?
CVE-2022-24968 is a security vulnerability in Mellium.im/xmpp involving Improper Validation of Certificate with Host Mismatch in mellium.im/xmpp/websocket under CWE-295: Improper Certificate Validation.
Which Mellium.im/xmpp versions are affected?
Affected versions include releases prior to 0.21.1 across affected packages: mellium.im/xmpp.
What version fixes CVE-2022-24968?
Upgrading to 0.21.1 (or the latest patched release for your respective branch) resolves the vulnerability.
Is mellium.im/xmpp affected?
Yes, mellium.im/xmpp is affected in releases prior to 0.21.1. Upgrade your dependency to 0.21.1 or later.
What is the CVSS score of CVE-2022-24968?
CVE-2022-24968 has a CVSS v3.1 base score of 5.9 (MODERATE) with vector string CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:N/I:H/A:N.
What CWE is associated with CVE-2022-24968?
CVE-2022-24968 is classified under CWE-295: Improper Certificate Validation (The product does not validate, or incorrectly validates, a certificate.).
How can I check Go dependencies for CVE-2022-24968?
Run the dependency tree command: 'inspect dependencies for mellium.im/xmpp'. This command lists direct and transitive dependencies in your build configuration so you can verify if a vulnerable version is resolved.
Machine-readable OSV JSON OSV v1.5 Schema
Normalized schema output
{
  "schema_version" : "1.4.0",
  "id" : "GHSA-h289-x5wc-xcv8",
  "modified" : "2024-05-20T21:13:34Z",
  "published" : "2022-02-16T22:56:21Z",
  "aliases" : [ "CVE-2022-24968" ],
  "summary" : "Improper Validation of Certificate with Host Mismatch in mellium.im/xmpp/websocket",
  "details" : "### Impact\n\nIf no TLS configuration is provided by the user, the websocket package constructs its own TLS configuration using recommended defaults. When looking up a WSS endpoint using the DNS TXT record method described in [XEP-0156: Discovering Alternative XMPP Connection Methods](https://xmpp.org/extensions/xep-0156.html) the ServerName field was incorrectly being set to the name of the server returned by the TXT record request, not the name of the initial server we were attempting to connect to. This means that any attacker that can spoof a DNS record (ie. in the absence of DNSSEC, DNS-over-TLS, DNS-over-HTTPS, or similar technologies) could redirect the user to a server of their choosing and as long as it had a valid TLS certificate for itself the connection would succeed, resulting in a MITM situation.\n\n### Patches\n\nAll users should upgrade to v0.21.1.\n\n### Workarounds\n\nTo work around the issue, manually specify a TLS configuration with the correct hostname.\n\n### References\n\n- https://mellium.im/cve/cve-2022-24968/\n- https://nvd.nist.gov/vuln/detail/CVE-2022-24968\n\n### For more information\n\nIf you have any questions or comments about this advisory:\n* Reach out on XMPP to [sam@samwhited.com](xmpp:sam@samwhited.com?msg)\n* Email us at [sam@samwhited.com](mailto:sam@samwhited.com)\n",
  "severity" : [ {
    "type" : "CVSS_V3",
    "score" : "CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:N/I:H/A:N"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "Go",
      "name" : "mellium.im/xmpp"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0.18.0"
      }, {
        "fixed" : "0.21.1"
      } ]
    } ]
  } ],
  "references" : [ {
    "type" : "WEB",
    "url" : "https://github.com/mellium/xmpp/security/advisories/GHSA-h289-x5wc-xcv8"
  }, {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2022-24968"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/mellium/xmpp/pull/260"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/mellium/xmpp/commit/0d92aa486da69b71f2f4a30e62aa722c711b98ac"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/mellium/xmpp"
  }, {
    "type" : "WEB",
    "url" : "https://mellium.im/cve/cve-2022-24968"
  }, {
    "type" : "WEB",
    "url" : "https://mellium.im/issue/259"
  }, {
    "type" : "WEB",
    "url" : "https://pkg.go.dev/vuln/GO-2022-0370"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-295" ],
    "severity" : "MODERATE",
    "github_reviewed" : true,
    "github_reviewed_at" : "2022-02-16T22:56:21Z",
    "nvd_published_at" : null
  }
}