/

CVE-2026-15747

Severity:

CRITICAL RISK

(9.1)

BREACH Exposure of CSRF Token (CWE-204) in Mojolicious

CVE-2026-15747

Deferred

Vulnerability type

Category:

Information Exposure via Compression Side Channel

CWE:

CWE-204, CWE-352

Impact:

CSRF Protection Bypass and Session Compromise

Severity:

CRITICAL RISK

(9.1)

CVSS version:

3.1

Catch this CVE while code is being written

Detect vulnerable code directly in pull requests, so CVEs are fixed before merge.

Summary

Mojolicious leaks a stable CSRF session token through a BREACH-style compression oracle when attacker-controlled input is reflected into gzip-compressed responses containing the token.

By repeatedly querying such responses and observing compressed lengths, an attacker can recover the CSRF token and bypass csrf_protect validation under certain deployment conditions.

Affected context

This vulnerability arises in Mojolicious applications that:

  • Use versions 4.59 through 9.47
  • Enable gzip or similar HTTP response compression
  • Embed the CSRF token in hidden form fields using _csrf_field
  • Reflect attacker-controlled input in the same compressed response as the CSRF token

Under these conditions, the CSRF token becomes observable via a compression side channel rather than direct output disclosure.

Exploit preconditions

  • Attack surface: Web application endpoints that:
  • Return gzip-compressed responses
  • Include a hidden csrf_token field generated by _csrf_token / _csrf_field
  • Echo user-supplied data (query params, form input, headers) in the response body
  • Required access: Ability to send repeated HTTP requests and influence reflected content; typically no authentication is required beyond normal user access.
  • Trigger point: The attacker crafts inputs so that the reflected data aligns with the token in the compressed response, then observes compressed length variations across many requests.
  • Why exploitation is possible: The CSRF token is stable per session and reused verbatim in multiple responses. Compression algorithms reduce redundancy between attacker-chosen text and the token, creating a measurable side channel that reveals the secret value.

Why this happens

The core issue is a design that combines a stable, long-lived CSRF token with compression of mixed secret and attacker-controlled data.

_csrf_token generates and caches a single token per session, and _csrf_field consistently embeds this unchanging token into forms.

When gzip compression is applied to responses that also reflect user input, the application unintentionally implements a BREACH-style compression oracle, falling under CWE-204: Observable Response Discrepancy.

This pattern also undermines CWE-352: Cross-Site Request Forgery (CSRF) defenses, because the secrecy of the token is assumed but eroded by the side-channel exposure.

Potential impact

  • An attacker may recover CSRF tokens for targeted user sessions.
  • An attacker can bypass CSRF protection and submit forged state-changing requests.
  • Session integrity could be weakened, enabling unauthorized actions in the user's context.
  • Sensitive application functionality (account changes, transactions, configuration updates) could be manipulated without the user's intent.

General mitigation guidance

Effective mitigations focus on reducing or eliminating compression side channels and strengthening CSRF token handling:

  • Avoid mixing secret tokens and attacker-controlled data in the same compressed response whenever practical.
  • Prefer per-request or per-form CSRF tokens instead of a single stable token per session, reducing oracle usefulness.
  • Consider disabling HTTP compression on responses containing secrets or CSRF tokens, or selectively skipping compression for sensitive endpoints.
  • Normalize or limit reflection of user input in responses, especially around areas containing hidden fields or secrets.
  • Reinforce CSRF defenses with additional mechanisms (same-site cookies, double-submit cookies, or origin checks) to lessen dependence on a single token.

How teams detect issues like this

Detection typically involves architectural and code-level review:

  • Examine view templates and controllers for patterns where hidden CSRF fields are emitted together with reflected user input in compressed responses.
  • Use static analysis or linters to flag stable, long-lived CSRF tokens reused across multiple requests and mixed with user-controlled data.
  • Review web server and framework configuration for blanket gzip/deflate compression applied to sensitive endpoints.
  • Employ security testing tools or custom scripts to simulate BREACH-style probing and observe response size correlations, confirming whether a practical oracle exists.

Automated code review systems and security scanners can assist by highlighting compression of secrets alongside attacker-controlled content and by enforcing policies on CSRF token lifecycle.

Sources

SourceLink
github.comgithub.com/mojolicious/mojo/commit/01921fbbbbeca2d1397e082d4a647f9b84c24e27.patch
metacpan.orgmetacpan.org/release/SRI/Mojolicious-9.48/changes
openwall.comopenwall.com/lists/oss-security/2026/07/14/16

Frequently asked

questions

Exploitability depends on deployment details. The application must compress responses that contain both the CSRF token and attacker-controlled input, and the attacker must be able to make many requests and measure response sizes. In such setups, exploitation can be highly feasible.

Typically, only the ability to interact with the web application as a normal user is needed. The attacker sends crafted requests from their own browser or tooling; the affected victim's browser processes forged requests using the recovered CSRF token.

The most robust pattern is to avoid combining secrets and attacker-controlled data in compressed responses, rotate CSRF tokens more frequently (per-request or per-form), and consider disabling compression on sensitive endpoints. Layering CSRF defenses (same-site cookies, origin checks) further reduces risk.

During design and review, treat response compression as a potential side channel. Avoid stable secret tokens that are reused across many requests, implement token rotation strategies, minimize reflection of user input near secret fields, and enforce security architecture reviews that consider compression and CSRF together.

Find out what's already
exploitable in your codebase.