{"id":"CVE-2026-39972","aliases":["CVE-2026-39972","GHSA-hwr4-mq23-wcv5","GO-2026-5444"],"related":[],"kind":"vulnerability","state":"published","title":"Mercure has a Topic Selector Cache Key Collision","summary":"Mercure is a protocol for pushing data updates to web browsers and other HTTP clients in a battery-efficient way. Prior to 0.22.0, a 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. The cache key was constructed by concatenating the topic selector and topic with an underscore separator. Because both topic selectors and topics can contain underscores, two distinct pairs can produce the same key. An attacker who can subscribe to the hub or publish updates with crafted topic names can exploit this to bypass authorization checks on private updates. This vulnerability is fixed in 0.22.0.","summarySource":"cvelist","descriptions":[{"lang":"en","text":"Mercure is a protocol for pushing data updates to web browsers and other HTTP clients in a battery-efficient way. Prior to 0.22.0, a 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. The cache key was constructed by concatenating the topic selector and topic with an underscore separator. Because both topic selectors and topics can contain underscores, two distinct pairs can produce the same key. An attacker who can subscribe to the hub or publish updates with crafted topic names can exploit this to bypass authorization checks on private updates. This vulnerability is fixed in 0.22.0.","source":"cvelist"},{"lang":"en","text":"### 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.","format":"markdown","source":"ghsa"},{"lang":"en","text":"mercure has Topic Selector Cache Key Collision in github.com/dunglas/mercure","format":"markdown","source":"go"},{"lang":"es","text":"Mercure es un protocolo para enviar actualizaciones de datos a navegadores web y otros clientes HTTP de una manera eficiente en el uso de la batería. Antes de la versión 0.22.0, una vulnerabilidad de colisión de clave de caché en TopicSelectorStore permite a un atacante envenenar la caché de resultados de coincidencia, lo que podría causar que actualizaciones privadas se entreguen a suscriptores no autorizados o bloquear la entrega a los autorizados. La clave de caché se construía concatenando el selector de tema y el tema con un separador de guion bajo. Debido a que tanto los selectores de tema como los temas pueden contener guiones bajos, dos pares distintos pueden producir la misma clave. Un atacante que puede suscribirse al hub o publicar actualizaciones con nombres de tema manipulados puede explotar esto para eludir las comprobaciones de autorización en actualizaciones privadas. Esta vulnerabilidad está corregida en la versión 0.22.0.","source":"nvd"}],"published":"2026-04-08T19:53:20.000Z","modified":"2026-10-26T21:10:00.170Z","severity":{"scorer":"GitHub_M","scheme":"CVSS:4.0","vector":"CVSS:4.0/AV:N/AC:L/AT:N/PR:L/UI:N/VC:H/VI:N/VA:L/SC:N/SI:N/SA:N","score":7.1,"rating":"HIGH"},"severities":[{"scorer":"GitHub_M","scheme":"CVSS:4.0","vector":"CVSS:4.0/AV:N/AC:L/AT:N/PR:L/UI:N/VC:H/VI:N/VA:L/SC:N/SI:N/SA:N","score":7.1,"rating":"HIGH"},{"scorer":"GitHub","scheme":"CVSS:4.0","vector":"CVSS:4.0/AV:N/AC:L/AT:N/PR:L/UI:N/VC:H/VI:N/VA:L/SC:N/SI:N/SA:N","rating":"HIGH"}],"cwes":["CWE-1289"],"affected":[{"ranges":[{"version":"< 0.22.0","status":"affected"}],"vendor":"dunglas","product":"mercure","source":"cvelist"},{"ranges":[{"type":"semver","introduced":"0","status":"affected","fixed":"0.22.0"}],"ecosystem":"Go","package":"github.com/dunglas/mercure","purl":"pkg:golang/github.com/dunglas/mercure","source":"ghsa"},{"ranges":[{"type":"semver","introduced":"0","status":"affected","fixed":"0.22.0"}],"ecosystem":"Go","package":"github.com/dunglas/mercure","purl":"pkg:golang/github.com/dunglas/mercure","source":"go"}],"references":[{"url":"https://github.com/dunglas/mercure/security/advisories/GHSA-hwr4-mq23-wcv5","tags":["advisory","web","x-refsource-confirm"],"sources":["cvelist","ghsa","go","nvd"]},{"url":"https://github.com/dunglas/mercure/commit/4964a69be904fd61e35b5f1e691271663b6fdd64","tags":["fix","web","x-refsource-misc"],"sources":["cvelist","ghsa","go","nvd"]},{"url":"https://nvd.nist.gov/vuln/detail/CVE-2026-39972","tags":["advisory"],"sources":["ghsa","go"]},{"url":"https://github.com/dunglas/mercure","tags":["package"],"sources":["ghsa"]},{"url":"https://github.com/dunglas/mercure/releases/tag/v0.22.0","tags":["web"],"sources":["ghsa","go"]}],"credits":[],"assigner":"GitHub_M","ssvc":{"scorer":"CISA-ADP","exploitation":"none","automatable":"no","technicalImpact":"partial","date":"2026-04-09T18:59:15.857Z"},"sources":[{"source":"cvelist","name":"CVE List","id":"CVE-2026-39972","url":"https://www.cve.org/CVERecord?id=CVE-2026-39972","licence":"CVE Terms of Use","modified":"2026-04-09T18:59:49.306Z"},{"source":"ghsa","name":"GitHub Advisory Database","id":"GHSA-hwr4-mq23-wcv5","url":"https://github.com/advisories/GHSA-hwr4-mq23-wcv5","licence":"CC-BY-4.0","modified":"2026-09-10T03:51:02.104Z"},{"source":"go","name":"Go Vulnerability Database","id":"GO-2026-5444","url":"https://pkg.go.dev/vuln/GO-2026-5444","licence":"CC-BY-4.0","modified":"2026-06-25T23:01:10.139Z"},{"source":"nvd","name":"NVD","id":"CVE-2026-39972","url":"https://nvd.nist.gov/vuln/detail/CVE-2026-39972","licence":"Public domain","modified":"2026-10-26T21:10:00.170Z"}],"updatedAt":"2026-11-25T22:59:18.386Z","epss":{"score":0.00331,"percentile":0.28327,"date":"2026-12-01T12:00:22.000Z"}}