GHSA-mr45-rx8q-wcm9 BIT-nats-2023-46129 CVE-2023-46129 GO-2023-2163
xkeys seal encryption used fixed key for all encryption
- Severity
- 7.5 / 10
- High · CVSS 3.1
- Exploit chance (EPSS)
- 0.45%
- Chance of exploitation in the next 30 days. Higher than 38.78% of scored vulnerabilities.
- Known exploited
- No
- Not in CISA's catalog
- Fix
- Available
- 2 packages have a fixed version
Description
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).
Affected versions
Go
| Package | Vulnerable | Fixed in |
|---|---|---|
| github.com/nats-io/nats-server/v2 | >= 2.10.0, < 2.10.4 |
2.10.4 |
| github.com/nats-io/nkeys | >= 0.4.0, < 0.4.6 |
0.4.6 |
How to fix
Move to the fixed version or later with your package manager, update the lockfile, and run your tests. If the package only arrives through another dependency, upgrade that dependency first. If none of its releases pulls a fixed version yet, force the version with your package manager's override.
github.com/nats-io/nats-server/v2 Go → 2.10.4
- go
go get github.com/nats-io/nats-server/v2@v2.10.4 && go mod tidy
github.com/nats-io/nkeys Go → 0.4.6
- go
go get github.com/nats-io/nkeys@v0.4.6 && go mod tidy
Severity breakdown
CVSS 3.1 7.5
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:N/A:N
- Attack vector
- Network
- Attack complexity
- Low
- Privileges required
- None
- User interaction
- None
- Scope
- Unchanged
- Confidentiality
- High
- Integrity
- None
- Availability
- None
Weakness
CWE-321: Use of Hard-coded Cryptographic Key
The product uses a hard-coded, unchangeable cryptographic key.
How to prevent it
- Architecture and Design: Prevention schemes mirror that of hard-coded password storage.
CWE-325: Missing Cryptographic Step
The product does not implement a required step in a cryptographic algorithm, resulting in weaker encryption than advertised by the algorithm.
References
Advisories
Packages
Other links
- github.com/nats-io/nkeys/security/advisories/GHSA-mr45-rx8q-wcm9
- github.com/nats-io/nkeys/commit/58fb9d69f42ea73fffad1d14e5914dc666f3daa1
- lists.fedoraproject.org/archives/list/package-announce@lists.fedoraproject.org/message/R3UET…
- lists.fedoraproject.org/archives/list/package-announce@lists.fedoraproject.org/message/ULQQO…
- openwall.com/lists/oss-security/2023/10/31/1
- lists.fedoraproject.org/archives/list/package-announce@lists.fedoraproject.org/message/R3UET…
- lists.fedoraproject.org/archives/list/package-announce@lists.fedoraproject.org/message/ULQQO…
Timeline
- Published
- Last updated by the source
- Latest EPSS score
Related advisories
| Advisory | Severity | Why it's related |
|---|---|---|
| GHSA-pq2q-rcw4-3hr6 NATS: Pre-auth remote server crash via WebSocket frame length overflow in wsRead | High | Also affects github.com/nats-io/nats-server/v2 |
| GHSA-3f24-pcvm-5jqc NATS has mTLS verify_and_map authentication bypass via incorrect Subject DN matching | Medium | Also affects github.com/nats-io/nats-server/v2 |
| GHSA-55h8-8g96-x4hj NATS: Leafnode connections allow spoofing of Nats-Request-Info identity headers | Medium | Also affects github.com/nats-io/nats-server/v2 |
| GHSA-pwx7-fx9r-hr4h NATS Server: Incomplete Stripping of Nats-Request-Info Header Allows Identity Spoofing | Medium | Also affects github.com/nats-io/nats-server/v2 |
| GHSA-9983-vrx2-fg9c NATS JetStream has an authorization bypass through its Management API | Medium | Also affects github.com/nats-io/nats-server/v2 |
| GHSA-8r68-gvr4-jh7j NATS is vulnerable to pre-auth DoS through WebSockets client service | Medium | Also affects github.com/nats-io/nats-server/v2 |
| GHSA-vprv-35vv-q339 NATS has pre-auth server panic via leafnode handling | High | Also affects github.com/nats-io/nats-server/v2 |
| GHSA-jxxm-27vp-c3m5 NATS allows MQTT clients to bypass ACL checks | Medium | Also affects github.com/nats-io/nats-server/v2 |
Credits: Quentin Matillat (GitHub @tinou98)
MergeHarbor checks every repository's dependencies against this database, ranks what matters by exploitability and reachability, routes it to the owning team and opens the fix pull request.
Check your repos with MergeHarbor