# GHSA-PWM3-WVJF-P5RJ: A PEM public key after an OpenSSL preamble is used as an HMAC secret

- Database: GitHub
- Severity: medium (stated by ghsa, no CVSS score)
- Published: 2026-09-25
- Modified: 2026-09-25

## Affected versions

- github.com/dunglas/mercure/caddy (Go): through 1.0.0
- github.com/dunglas/mercure (Go): through 1.0.0

## Description

### Impact

A verification key given without an explicit algorithm defaults to HS256 unless it is PEM-encoded, and a PEM key paired with an HMAC algorithm is refused. Both checks only looked for `-----BEGIN` at the start of the key. OpenSSL writes a preamble before the PEM block when exporting from PKCS#12 (`Bag Attributes`, `subject=`, `issuer=` lines), so such a public key or certificate was taken for a raw shared secret: the hub verified HS256 tokens using the public key text as the HMAC secret.

Anyone holding the public key, which is public by design, can then mint tokens the hub accepts, with attacker-chosen grants: publish and subscribe on every topic, private updates included.

The issue reveals itself: the issuer's real RS256 or ES256 tokens stop verifying as soon as the key is deployed, which limits how long a deployment stays in this state unnoticed.

**Affected deployments.** Hubs configured with a PEM public key or certificate that carries a preamble and no explicit algorithm (`alg` in the verifier block), and Go library users passing such a key to `mercure.Static` with an `HS*` algorithm.

### Patches

A key containing a PEM block anywhere is treated as PEM: without an algorithm it is refused at startup, and with an `HS*` algorithm the verifier refuses it (`ErrPEMKeyHMACAlgorithm`).

The 0.x branch is no longer maintained and won't receive a fix: upgrade to 1.x.

### Workarounds

Strip everything before `-----BEGIN` from the key, or set the algorithm explicitly (for example `alg RS256`).

## References

- https://github.com/dunglas/mercure/security/advisories/GHSA-pwm3-wvjf-p5rj

Page: https://cve.now/GHSA-PWM3-WVJF-P5RJ

Wrong or missing data? Send feedback: POST https://cve.now/api/v1/feedback (see https://cve.now/agents#feedback).
