{"id":"CVE-2022-24968","aliases":["EUVD-2022-1027","GHSA-h289-x5wc-xcv8","GHSA-m658-p24x-p74r","GO-2022-0370"],"status":"published","title":"Improper Validation of Certificate with Host Mismatch in mellium.im/xmpp/websocket","description":"In Mellium mellium.im/xmpp through 0.21.0, an attacker capable of spoofing DNS TXT records can redirect a WebSocket connection request to a server under their control without causing TLS certificate verification to fail. This occurs because the wrong host name is selected during this verification.","severity":{"version":"3.1","score":5.9,"vector":"CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:N/I:H/A:N","level":"medium","assessor":"primary","from":"nvd"},"epss":{"day":"2026-11-09","score":0.00539,"percentile":0.45669,"model":"v2026.06.15"},"facts":{"in_kev":false,"known_exploited":false,"public_exploit":false,"fix_available":true},"cwes":["CWE-295"],"published":"2022-02-11T18:16:54Z","modified":"2026-10-28T02:31:03Z","fixes":[{"ecosystem":"Go","package":"mellium.im/xmpp","fixed_in":["0.21.1"],"sources":["ghsa","osv"]}],"affected":[{"source":"ghsa","ecosystem":"Go","package":"mellium.im/xmpp","ranges":[{"type":"ECOSYSTEM","events":[{"introduced":"0.18.0"},{"fixed":"0.21.1"}]}]},{"source":"osv","ecosystem":"Go","package":"mellium.im/xmpp","ranges":[{"type":"SEMVER","events":[{"introduced":"0.18.0"},{"fixed":"0.21.1"}]}]},{"source":"osv","ecosystem":"Go","package":"mellium.im/xmpp","ranges":[{"type":"SEMVER","events":[{"introduced":"0.18.0"},{"fixed":"0.21.1"}]}]}],"products":[{"vendor":"mellium","product":"xmpp"}],"references":[{"url":"https://mellium.im/xmpp/","tags":["x_refsource_MISC","x_transferred","Product","Vendor Advisory","web"]},{"url":"https://mellium.im/cve/cve-2022-24968/","tags":["x_refsource_MISC","x_transferred","Vendor Advisory","web","advisory"]},{"url":"https://github.com/mellium/xmpp/security/advisories/GHSA-h289-x5wc-xcv8","tags":["web"]},{"url":"https://github.com/mellium/xmpp/pull/260","tags":["web","fix"]},{"url":"https://github.com/mellium/xmpp/commit/0d92aa486da69b71f2f4a30e62aa722c711b98ac","tags":["web","fix"]},{"url":"https://mellium.im/issue/259","tags":["web","report"]},{"url":"https://pkg.go.dev/vuln/GO-2022-0370","tags":["web"]},{"url":"https://nvd.nist.gov/vuln/detail/CVE-2022-24968","tags":["advisory"]},{"url":"https://mellium.im/cve/cve-2022-24968","tags":["web"]},{"url":"https://github.com/advisories/GHSA-h289-x5wc-xcv8"},{"url":"https://mellium.im/xmpp","tags":["web"]},{"url":"https://github.com/advisories/GHSA-m658-p24x-p74r"},{"url":"https://github.com/CVEProject/cvelistV5/tree/main/cves/2022/24xxx/CVE-2022-24968.json","tags":["advisory"]},{"url":"https://github.com/mellium/xmpp","tags":["package"]}],"sources":{"cve":[{"id":"CVE-2022-24968","description":"In Mellium mellium.im/xmpp through 0.21.0, an attacker capable of spoofing DNS TXT records can redirect a WebSocket connection request to a server under their control without causing TLS certificate verification to fail. This occurs because the wrong host name is selected during this verification.","status":"published","published":"2022-02-11T18:16:54Z","modified":"2024-08-03T04:29:01.535Z","updated_at":"2026-11-02T14:34:34.576287Z"}],"euvd":[{"id":"EUVD-2022-1027","description":"In Mellium mellium.im/xmpp through 0.21.0, an attacker capable of spoofing DNS TXT records can redirect a WebSocket connection request to a server under their control without causing TLS certificate verification to fail. This occurs because the wrong host name is selected during this verification.","status":"published","published":"2022-02-11T18:16:54Z","modified":"2024-08-03T04:29:01Z","updated_at":"2026-11-03T03:25:48.512748Z"}],"ghsa":[{"id":"GHSA-h289-x5wc-xcv8","title":"Improper Validation of Certificate with Host Mismatch in mellium.im/xmpp/websocket","description":"### 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","status":"published","published":"2022-02-16T22:56:21Z","modified":"2024-05-20T21:13:35Z","cvss":[{"version":"3.1","score":5.9,"vector":"CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:N/I:H/A:N","level":"medium"}],"cwes":["CWE-295"],"updated_at":"2026-11-02T14:37:50.750599Z"},{"id":"GHSA-m658-p24x-p74r","title":"Duplicate Advisory: TLS certificate validation error in mellium.im/xmpp","description":"## Duplicate Advisory\nThis advisory has been withdrawn because it is a duplicate of GHSA-h289-x5wc-xcv8. This link is maintained to preserve external references.\n\n## Original Description\nIn Mellium mellium.im/xmpp through 0.21.0, an attacker capable of spoofing DNS TXT records can redirect a WebSocket connection request to a server under their control without causing TLS certificate verification to fail. This occurs because the wrong host name is selected during this verification.","status":"withdrawn","published":"2022-02-12T00:00:36Z","modified":"2024-05-20T21:04:25Z","cvss":[{"version":"3.1","score":5.9,"vector":"CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:N/I:H/A:N","level":"medium"}],"cwes":["CWE-295"],"updated_at":"2026-11-02T14:37:50.750599Z"}],"nvd":[{"id":"CVE-2022-24968","description":"In Mellium mellium.im/xmpp through 0.21.0, an attacker capable of spoofing DNS TXT records can redirect a WebSocket connection request to a server under their control without causing TLS certificate verification to fail. This occurs because the wrong host name is selected during this verification.","status":"published","published":"2022-02-11T22:15:07.887Z","modified":"2026-06-17T04:32:52.43Z","cvss":[{"version":"3.1","score":5.9,"vector":"CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:N/I:H/A:N","level":"medium","assessor":"primary"},{"version":"2.0","score":4.3,"vector":"AV:N/AC:M/Au:N/C:N/I:P/A:N","level":"medium","assessor":"primary"}],"cwes":["CWE-295"],"updated_at":"2026-11-02T14:07:12.155838Z"}],"osv":[{"id":"GHSA-h289-x5wc-xcv8","title":"Improper Validation of Certificate with Host Mismatch in mellium.im/xmpp/websocket","description":"### 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","status":"published","published":"2022-02-16T22:56:21Z","modified":"2024-05-20T21:13:34Z","cvss":[{"version":"3.1","score":5.9,"vector":"CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:N/I:H/A:N","level":"medium"}],"cwes":["CWE-295"],"updated_at":"2026-11-02T15:46:48.546324Z"},{"id":"GHSA-m658-p24x-p74r","title":"Duplicate Advisory: TLS certificate validation error in mellium.im/xmpp","description":"## Duplicate Advisory\nThis advisory has been withdrawn because it is a duplicate of GHSA-h289-x5wc-xcv8. This link is maintained to preserve external references.\n\n## Original Description\nIn Mellium mellium.im/xmpp through 0.21.0, an attacker capable of spoofing DNS TXT records can redirect a WebSocket connection request to a server under their control without causing TLS certificate verification to fail. This occurs because the wrong host name is selected during this verification.","status":"withdrawn","published":"2022-02-12T00:00:36Z","modified":"2024-05-20T21:04:24Z","cvss":[{"version":"3.1","score":5.9,"vector":"CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:N/I:H/A:N","level":"medium"}],"cwes":["CWE-295"],"updated_at":"2026-11-02T15:46:51.463834Z"},{"id":"CVE-2022-24968","description":"In Mellium mellium.im/xmpp through 0.21.0, an attacker capable of spoofing DNS TXT records can redirect a WebSocket connection request to a server under their control without causing TLS certificate verification to fail. This occurs because the wrong host name is selected during this verification.","status":"published","published":"2022-02-11T18:16:54Z","modified":"2026-10-28T02:31:03.845837779Z","updated_at":"2026-11-02T15:44:24.428403Z"},{"id":"GO-2022-0370","title":"Man-in-the-middle attack due to improper validation of certificate in mellium.im/xmpp","description":"Websocket client connections are vulnerable to man-in-the-middle attacks via DNS spoofing.\n\nWhen looking up a WSS endpoint using a DNS TXT record, the server TLS certificate is incorrectly validated using the name of the server returned by the TXT record request, not the name of the the server being connected to. This permits any attacker that can spoof a DNS record to redirect the user to a server of their choosing.\n\nProviding a *tls.Config with a ServerName field set to the correct destination hostname will avoid this issue.","status":"published","published":"2022-07-29T20:00:14Z","modified":"2024-05-20T16:03:47Z","updated_at":"2026-11-02T15:47:00.604718Z"}]}}
