CVE-2026-39972
JSON

7.1high

Mercure has a Topic Selector Cache Key Collision

Severity
7.1high CVSS:4.0 by GitHub_M
Exploit likelihood
0.33% (higher than 28% of CVEs; EPSS, by FIRST)
Published
Last changed
Assigned by
GitHub_M
Also known as
GHSA-hwr4-mq23-wcv5GO-2026-5444

Description

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.

Affected

Product or packageVersionsReported by
dunglas mercure< 0.22.0CVE List
github.com/dunglas/mercure (Go)before 0.22.0GitHub Advisory Database, Go Vulnerability Database

All scores

GitHub_M7.1high CVSS:4.0CVSS:4.0/AV:N/AC:L/AT:N/PR:L/UI:N/VC:H/VI:N/VA:L/SC:N/SI:N/SA:N
GitHubhigh CVSS:4.0CVSS:4.0/AV:N/AC:L/AT:N/PR:L/UI:N/VC:H/VI:N/VA:L/SC:N/SI:N/SA:N

Classification

CWE-1289

SSVC (CISA-ADP): exploitation none, automatable no, technical impact partial.

What each source says

CVE List

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.

GitHub Advisory Database
Impact

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:

k = "m_" + topicSelector + "_" + topic

Because both topic selectors and topics can contain underscores, two distinct pairs can produce the same key:

selector="foo_bar"  topic="baz"     → key: "m_foo_bar_baz"
selector="foo"      topic="bar_baz" → key: "m_foo_bar_baz"

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.

Patches

The vulnerability is fixed by replacing string-encoded cache keys with typed Go struct keys that are inherently collision-free:

type matchCacheKey struct {
    topicSelector string
    topic         string
}

The internal TopicSelectorStoreCache interface and sharded cache abstraction have also been removed in favor of a single typed otter cache.

Users should upgrade to version 0.22.0 or later.

Workarounds

Disable 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.

Go Vulnerability Database

mercure has Topic Selector Cache Key Collision in github.com/dunglas/mercure

NVD (es)

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.

References

Sources

SourceRecordLicence
CVE ListCVE-2026-39972 changed 2026-04-09CVE Terms of Use
GitHub Advisory DatabaseGHSA-hwr4-mq23-wcv5 changed 2026-09-10CC-BY-4.0
Go Vulnerability DatabaseGO-2026-5444 changed 2026-06-25CC-BY-4.0
NVDCVE-2026-39972 changed 2026-10-26Public domain