CVE-2023-46129: xkeys Seal encryption used fixed key for all encryption
Background
NATS.io is a high performance open source pub-sub distributed communication technology, built for the cloud, on-premise, IoT, and edge computing.
The cryptographic key handling library, nkeys, recently gained support for encryption, not just for signing/authentication. This is used in nats-server 2.10 (Sep 2023) and newer for authentication callouts.
Problem Description
The nkeys library's "xkeys" encryption handling logic mistakenly passed an array by value into an internal function, where the function mutated that buffer to populate the encryption key to use. As a result, all encryption was actually to an all-zeros key.
This affects encryption only, not signing. FIXME: FILL IN IMPACT ON NATS-SERVER AUTH CALLOUT SECURITY.
Affected versions
nkeys Go library: 0.4.0 up to and including 0.4.5 Fixed with nats-io/nkeys: 0.4.6
NATS Server: 2.10.0 up to and including 2.10.3 Fixed with nats-io/nats-server: 2.10.4
Solution
Upgrade the nats-server. For any application handling auth callouts in Go, if using the nkeys library, update the dependency, recompile and deploy that in lockstep.
Credits
Problem reported by Quentin Matillat (GitHub @tinou98).
Other sources
NATS.io is a high performance open source pub-sub distributed communication technology, built for the cloud, on-premise, IoT, and edge computing. The cryptographic key handling library, nkeys, recently gained support for encryption, not just for signing/authentication. This is used in nats-server 2.10 (Sep 2023) and newer for authentication callouts. In nkeys versions 0.4.0 through 0.4.5, corresponding with NATS server versions 2.10.0 through 2.10.3, the nkeys library's xkeys encryption handling logic mistakenly passed an array by value into an internal function, where the function mutated that buffer to populate the encryption key to use. As a result, all encryption was actually to an all-zeros key. This affects encryption only, not signing. FIXME: FILL IN IMPACT ON NATS-SERVER AUTH CALLOUT SECURITY. nkeys Go library 0.4.6, corresponding with NATS Server 2.10.4, has a patch for this issue. No known workarounds are available. For any application handling auth callouts in Go, if using the nkeys library, update the dependency, recompile and deploy that in lockstep.
— NVD
The nkeys library's "xkeys" encryption handling logic mistakenly passed an array by value into an internal function, where the function mutated that buffer to populate the encryption key to use. As a result, all encryption was actually to an all-zeros key. This affects encryption only, not signing.
Within the nats-server, the encryption is used for the Auth Callouts feature, introduced with 2.10.0 (September 2023). The Auth Callout request includes the supplied user password. These messages are sent within NATS, and should typically be in a dedicated NATS Account used for callouts, but this is not required. Thus in scenarios where the Callouts are in an account shared with untrusted users or where the callout responders connect without TLS, this may lead to user credential exposure.
https://advisories.nats.io/CVE/secnote-2023-02.txt https://security-tracker.debian.org/tracker/CVE-2023-46129
— Red Hat
xkeys Seal encryption used fixed key for all encryption
— Microsoft
Affected Software
Remediation
Recommended actions to resolve this vulnerability, in priority order.
- Upgrade
Upgrade
go/github.com/nats-io/nats-server/v2to a version that resolves this vulnerability.Fixed in 2.10.4 - Upgrade
Upgrade
go/github.com/nats-io/nkeysto a version that resolves this vulnerability.Fixed in 0.4.6 - Upgrade
Upgrade
redhat/nats-serverto a version that resolves this vulnerability.Fixed in 2.10.4 - Upgrade
Upgrade
redhat/nkeysto a version that resolves this vulnerability.Fixed in 0.4.6 - Upgrade
Upgrade
debian/golang-github-nats-io-nkeysto a version that resolves this vulnerability.Fixed in 0.0~git20181103.f9a6cff-1.1Fixed in 0.3.0-2Fixed in 0.4.10-1Fixed in 0.4.16-1 - Upgrade
Upgrade
debian/nats-serverto a version that resolves this vulnerability.Fixed in 2.9.10-1Fixed in 2.10.27-1Fixed in 2.14.3-1 - Upgrade
Upgrade
nats-io/nats-serverto a version that resolves this vulnerability.Fixed in 2.10.4 - Upgrade
Upgrade
nats-io/nkeysto a version that resolves this vulnerability.Fixed in 0.4.6 - Compensating control
For application handling auth callouts in Go, update the nkeys dependency and redeploy that change in lockstep with the updated nats-server, since the issue affects the Auth Callouts encryption path.
Event History
Frequently Asked Questions
What is the severity of CVE-2023-46129?
The severity of CVE-2023-46129 is high.
What is the affected software for CVE-2023-46129?
The affected software for CVE-2023-46129 is go/github.com/nats-io/nats-server/v2 (version 2.10.0 to 2.10.3) and go/github.com/nats-io/nkeys (version 0.4.0 to 0.4.5).
How can I fix CVE-2023-46129?
To fix CVE-2023-46129, update your software to nats-server/v2 version 2.10.4, and nkeys version 0.4.6.
What is the Common Weakness Enumeration (CWE) ID for CVE-2023-46129?
The Common Weakness Enumeration (CWE) ID for CVE-2023-46129 is CWE-321 and CWE-325.
Where can I find more information about CVE-2023-46129?
You can find more information about CVE-2023-46129 at the following references: [GitHub Advisory](https://github.com/nats-io/nkeys/security/advisories/GHSA-mr45-rx8q-wcm9), [NVD](https://nvd.nist.gov/vuln/detail/CVE-2023-46129), [Openwall](http://www.openwall.com/lists/oss-security/2023/10/31/1).