# GHSA-JJ2R-4MGJ-F964: Non-constant-time credential comparison enables timing attacks

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

## Affected versions

- github.com/bluenviron/mediamtx (Go): from 1.5.0, fixed in 1.19.3

## Description

`Credential.Check` in `internal/conf/credential.go` compared a SHA256-hashed credential and a plaintext credential against the caller-supplied guess using Go's built-in `==` string comparison operator. This operator short-circuits on the first mismatched byte, so the time taken to reject a guess depends on how many leading bytes it shares with the stored secret. Since an attacker fully controls one operand of the comparison, repeated measurements of response time can in principle be used to recover the secret byte by byte, particularly for the plaintext credential path where the comparison is made directly against the raw secret.

The issue was fixed by replacing both `==` comparisons with `subtle.ConstantTimeCompare`, which runs in time independent of where (or whether) the two inputs differ. The fix was merged in PR #5961.

## References

- https://github.com/bluenviron/mediamtx/security/advisories/GHSA-jj2r-4mgj-f964

Page: https://cve.now/GHSA-JJ2R-4MGJ-F964

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