{"id":"CVE-2022-26652","aliases":["CVE-2022-26652","GHSA-6h3m-36w8-hv68","BIT-NATS-2022-26652","GO-2022-0351"],"related":[],"kind":"vulnerability","state":"published","title":"Arbitrary file write in nats-server","summary":"NATS nats-server before 2.7.4 allows Directory Traversal (with write access) via an element in a ZIP archive for JetStream streams. nats-streaming-server before 0.24.3 is also affected.","summarySource":"cvelist","descriptions":[{"lang":"en","text":"NATS nats-server before 2.7.4 allows Directory Traversal (with write access) via an element in a ZIP archive for JetStream streams. nats-streaming-server before 0.24.3 is also affected.","source":"cvelist"},{"lang":"en","text":"(This document is canonically: <https://advisories.nats.io/CVE/CVE-2022-26652.txt>)\n\n## Background\n\nNATS.io is a high performance open source pub-sub distributed communication technology, built for the cloud, on-premise, IoT, and edge computing.\n\nJetStream is the optional RAFT-based resilient persistent feature of NATS.\n\n\n## Problem Description\n\nThe JetStream streams can be backed up and restored via NATS. The backup format is a tar archive file.  Inadequate checks on the filenames within the archive file permit a so-called \"Zip Slip\" attack in the stream restore.\n\nNATS nats-server through 2022-03-09 (fixed in release 2.7.4) did not correctly sanitize elements of the archive file, thus a user of NATS\ncould cause the NATS server to write arbitrary content to an attacker-controlled filename.\n\n\n## Affected versions\n\nNATS Server:\n * 2.2.0 up to and including 2.7.3.\n   + Introduced with JetStream Restore functionality\n * Fixed with nats-io/nats-server: 2.7.4\n * Docker image:  nats <https://hub.docker.com/_/nats>\n * NB users of OS package files from our releases: a change in goreleaser defaults, discovered late in the release process, moved the install directory from /usr/local/bin to /usr/bin; we are evaluating the correct solution for subsequent releases, but not recutting this release.\n\nNATS Streaming Server\n * 0.15.0 up to and including 0.24.2\n * Fixed with nats-io/nats-streaming-server: 0.24.3\n * Embeds a nats-server, but this server is the old approach which JetStream replaces, so unlikely (but not impossible) to be\n   configured with JS support\n\n\n## Workarounds\n\n * Disable JetStream for untrusted users.\n * If only one NATS account uses JetStream, such that cross-user attacks are not an issue, and any user in that account with access to the JetStream API is fully trusted anyway, then appropriate sandboxing techniques will prevent exploit.\n   + Eg, with systemd, the supplied util/nats-server-hardened.service example configuration demonstrates that NATS runs fine as an unprivileged user under ProtectSystem=strict and PrivateTmp=true restrictions; by only opening a ReadWritePaths hole for the JetStream storage area, the impact of this vulnerability is limited.\n\n\n## Solution\n\nUpgrade the NATS server to at least 2.7.4.\n\nWe fully support the util/nats-server-hardened.service configuration for running a NATS server and encourage this approach.\n\n\n## Credits\n\nThis issue was reported (on 2022-03-07) to the NATS Maintainers by\nYiming Xiang, TIANJI LAB of NSFOCUS.  \nThank you / 谢谢你！","format":"markdown","source":"ghsa"},{"lang":"en","text":"Arbitrary file write in nats-server in github.com/nats-io/nats-server","format":"markdown","source":"go"},{"lang":"es","text":"NATS nats-server versiones anteriores a 2.7.4, permite un Salto de Directorio (con acceso de escritura) por medio de un elemento en un archivo ZIP para flujos JetStream. nats-streaming-server versiones anteriores a 0.24.3 también está afectado","source":"nvd"}],"published":"2022-03-10T03:48:44.000Z","modified":"2026-07-08T06:29:51.186Z","severity":{"scorer":"NVD","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:N/I:H/A:N","score":6.5,"rating":"MEDIUM"},"severities":[{"scorer":"GitHub","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:N/I:H/A:N","score":6.5,"rating":"HIGH"},{"scorer":"NVD","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:N/I:H/A:N","score":6.5,"rating":"MEDIUM"},{"scorer":"NVD","scheme":"CVSS:2.0","vector":"AV:N/AC:L/Au:S/C:N/I:P/A:N","score":4,"rating":"MEDIUM"},{"scorer":"Bitnami Vulnerability Database","scheme":"rating","rating":"MEDIUM"}],"cwes":["CWE-22"],"affected":[{"ranges":[{"version":"n/a","status":"affected"}],"source":"cvelist"},{"ranges":[{"type":"semver","introduced":"2.2.0","status":"affected","fixed":"2.7.4"}],"ecosystem":"Go","package":"github.com/nats-io/nats-server/v2","purl":"pkg:golang/github.com/nats-io/nats-server/v2","source":"ghsa"},{"ranges":[{"type":"semver","introduced":"0.15.0","status":"affected","fixed":"0.24.3"}],"ecosystem":"Go","package":"github.com/nats-io/nats-streaming-server","purl":"pkg:golang/github.com/nats-io/nats-streaming-server","source":"ghsa"},{"ranges":[{"type":"semver","introduced":"0","status":"affected"}],"ecosystem":"Go","package":"github.com/nats-io/nats-server","purl":"pkg:golang/github.com/nats-io/nats-server","source":"go"},{"ranges":[{"type":"semver","introduced":"2.2.0","status":"affected","fixed":"2.7.4"}],"ecosystem":"Go","package":"github.com/nats-io/nats-server/v2","purl":"pkg:golang/github.com/nats-io/nats-server/v2","source":"go"},{"ranges":[{"type":"semver","introduced":"0.15.0","status":"affected","fixed":"0.24.3"}],"ecosystem":"Go","package":"github.com/nats-io/nats-streaming-server","purl":"pkg:golang/github.com/nats-io/nats-streaming-server","source":"go"},{"ranges":[{"status":"affected","introduced":"2.2.0","fixed":"2.7.4"}],"vendor":"linuxfoundation","product":"nats-server","cpe":"cpe:2.3:a:linuxfoundation:nats-server:*:*:*:*:*:*:*:*","source":"nvd"},{"ranges":[{"status":"affected","introduced":"0.15.0","fixed":"0.24.3"}],"vendor":"nats","product":"nats_streaming_server","cpe":"cpe:2.3:a:nats:nats_streaming_server:*:*:*:*:*:*:*:*","source":"nvd"},{"ranges":[{"type":"semver","introduced":"2.2.0","status":"affected","fixed":"2.7.4"}],"ecosystem":"Bitnami","package":"nats","purl":"pkg:bitnami/nats","source":"bitnami"}],"references":[{"url":"https://github.com/nats-io/nats-server/releases","tags":["release-notes","third-party-advisory","web","x-refsource-misc","x-transferred"],"sources":["cvelist","ghsa","go","nvd","bitnami"]},{"url":"https://github.com/nats-io/nats-server/security/advisories/GHSA-6h3m-36w8-hv68","tags":["advisory","third-party-advisory","web","x-refsource-confirm","x-transferred"],"sources":["cvelist","ghsa","go","nvd","bitnami"]},{"url":"https://advisories.nats.io/CVE/CVE-2022-26652.txt","tags":["vendor-advisory","web","x-refsource-confirm","x-transferred"],"sources":["cvelist","ghsa","go","nvd","bitnami"]},{"url":"http://www.openwall.com/lists/oss-security/2022/03/10/1","tags":["mailing-list","third-party-advisory","web","x-refsource-mlist","x-transferred"],"sources":["cvelist","ghsa","go","nvd","bitnami"]},{"url":"https://nvd.nist.gov/vuln/detail/CVE-2022-26652","tags":["advisory","web"],"sources":["ghsa","go","bitnami"]},{"url":"https://github.com/nats-io/nats-server/pull/2917","tags":["fix","web"],"sources":["ghsa","go"]},{"url":"https://github.com/nats-io/nats-server","tags":["package"],"sources":["ghsa"]},{"url":"https://github.com/nats-io/nats-server/releases/tag/v2.7.4","tags":["web"],"sources":["ghsa","go"]},{"url":"https://github.com/nats-io/nats-streaming-server/releases/tag/v0.24.3","tags":["web"],"sources":["ghsa","go"]}],"credits":[],"assigner":"mitre","sources":[{"source":"cvelist","name":"CVE List","id":"CVE-2022-26652","url":"https://www.cve.org/CVERecord?id=CVE-2022-26652","licence":"CVE Terms of Use","modified":"2024-08-03T05:11:44.439Z"},{"source":"ghsa","name":"GitHub Advisory Database","id":"GHSA-6h3m-36w8-hv68","url":"https://github.com/advisories/GHSA-6h3m-36w8-hv68","licence":"CC-BY-4.0","modified":"2026-07-08T06:29:51.186Z"},{"source":"go","name":"Go Vulnerability Database","id":"GO-2022-0351","url":"https://pkg.go.dev/vuln/GO-2022-0351","licence":"CC-BY-4.0","modified":"2026-03-03T04:50:02.887Z"},{"source":"nvd","name":"NVD","id":"CVE-2022-26652","url":"https://nvd.nist.gov/vuln/detail/CVE-2022-26652","licence":"Public domain","modified":"2026-06-17T04:35:35.630Z"},{"source":"bitnami","name":"Bitnami Vulnerability Database","id":"BIT-NATS-2022-26652","url":"https://osv.dev/vulnerability/BIT-NATS-2022-26652","licence":"Apache-2.0","modified":"2025-04-03T14:40:37.652Z"}],"updatedAt":"2026-11-25T22:58:10.027Z","epss":{"score":0.02342,"percentile":0.84109,"date":"2026-12-02T12:00:21.000Z"}}