{"id":"CVE-2026-39972","aliases":["GHSA-hwr4-mq23-wcv5","GO-2026-5444"],"url":"https://o3.security/vulnerability/CVE-2026-39972","summary":"Mercure has a Topic Selector Cache Key Collision","details":"### Impact\n\nA cache key collision vulnerability in `TopicSelectorStore` allows an attacker to poison the match result cache, potentially causing private updates to be delivered to unauthorized subscribers or blocking delivery to authorized ones.\n\nThe cache key was constructed by concatenating the topic selector and topic with an underscore separator:\n\n```go\nk = \"m_\" + topicSelector + \"_\" + topic\n```\n\nBecause both topic selectors and topics can contain underscores, two distinct pairs can produce the same key:\n\n```\nselector=\"foo_bar\"  topic=\"baz\"     → key: \"m_foo_bar_baz\"\nselector=\"foo\"      topic=\"bar_baz\" → key: \"m_foo_bar_baz\"\n```\n\nAn attacker who can subscribe to the hub or publish updates with crafted topic names can exploit this to bypass authorization checks on private updates.\n\n### Patches\n\nThe vulnerability is fixed by replacing string-encoded cache keys with typed Go struct keys that are inherently collision-free:\n\n```go\ntype matchCacheKey struct {\n    topicSelector string\n    topic         string\n}\n```\n\nThe internal `TopicSelectorStoreCache` interface and sharded cache abstraction have also been removed in favor of a single typed otter cache.\n\nUsers should upgrade to version **0.22.0** or later.\n\n### Workarounds\n\nDisable the topic selector cache by setting `topic_selector_cache` to `-1` in the Caddyfile, or by passing a cache size of `0` when using the library directly. This eliminates the vulnerability at the cost of reduced performance.","published":"2026-04-09T16:42:22.903Z","modified":"2026-08-12T03:51:46.726938170Z","cvss":null,"epss":{"score":0.00341,"percentile":0.26866,"asOf":"2026-09-03"},"cisaKev":null,"exploitsKnown":0,"affectedPackages":[{"ecosystem":"Go","name":"github.com/dunglas/mercure","fixedVersion":"0.22.0"}],"fix":{"url":"https://github.com/dunglas/mercure/commit/4964a69be904fd61e35b5f1e691271663b6fdd64","label":"dunglas/mercure@4964a69"},"references":[{"type":"ADVISORY","url":"https://github.com/CVEProject/cvelistV5/tree/main/cves/2026/39xxx/CVE-2026-39972.json"},{"type":"ADVISORY","url":"https://github.com/dunglas/mercure/security/advisories/GHSA-hwr4-mq23-wcv5"},{"type":"ADVISORY","url":"https://nvd.nist.gov/vuln/detail/CVE-2026-39972"},{"type":"FIX","url":"https://github.com/dunglas/mercure/commit/4964a69be904fd61e35b5f1e691271663b6fdd64"},{"type":"PACKAGE","url":"https://github.com/dunglas/mercure"},{"type":"WEB","url":"https://github.com/dunglas/mercure/releases/tag/v0.22.0"}],"provenance":{"sources":["OSV.dev","FIRST.org (EPSS)"],"lastVerified":"2026-08-12T03:51:46.726938170Z"}}