GHSA-hwr4-mq23-wcv5

Suggest an improvement
Source
https://github.com/advisories/GHSA-hwr4-mq23-wcv5
Import Source
https://github.com/github/advisory-database/blob/main/advisories/github-reviewed/2026/04/GHSA-hwr4-mq23-wcv5/GHSA-hwr4-mq23-wcv5.json
JSON Data
https://api.osv.dev/v1/vulns/GHSA-hwr4-mq23-wcv5
Aliases
  • CVE-2026-39972
Related
Published
2026-04-08T19:53:20Z
Modified
2026-04-10T20:14:16.900035644Z
Severity
  • 7.1 (High) CVSS_V4 - 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 CVSS Calculator
Summary
mercure has Topic Selector Cache Key Collision
Details

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.

Database specific
{
    "github_reviewed_at": "2026-04-08T19:53:20Z",
    "severity": "HIGH",
    "github_reviewed": true,
    "nvd_published_at": "2026-04-09T17:16:30Z",
    "cwe_ids": [
        "CWE-1289"
    ]
}
References

Affected packages

Go / github.com/dunglas/mercure

Package

Name
github.com/dunglas/mercure
View open source insights on deps.dev
Purl
pkg:golang/github.com/dunglas/mercure

Affected ranges

Type
SEMVER
Events
Introduced
0Unknown introduced version / All previous versions are affected
Fixed
0.22.0

Database specific

source
"https://github.com/github/advisory-database/blob/main/advisories/github-reviewed/2026/04/GHSA-hwr4-mq23-wcv5/GHSA-hwr4-mq23-wcv5.json"