CVE-2026-54163: GitHub secure_headers CSP directive injection in sandbox and report_to

CVE-2026-54163 · Severity: medium · CVSS 4.7 · Published 2026-07-17

The secure_headers library, used to protect web applications by managing security headers, contains a flaw in how it handles certain Content Security Policy (CSP) settings. If an application allows user-provided input to influence specific CSP directives (like sandbox or reporting endpoints), an attacker can bypass the security policy. This could allow an attacker to execute malicious scripts (XSS) or intercept security reports, potentially leading to unauthorized access to user data or session hijacking.

Technologies: secure_headers (RubyGems). Vendors: RubyGems.

Quick answers

Is CVE-2026-54163 exploited in the wild?
No. Junglewise Threat Intelligence has no report of CVE-2026-54163 being exploited in the wild.
How severe is CVE-2026-54163?
Medium severity, with a CVSS score of 4.7, published 17 July 2026.
Which products and versions are affected?
secure_headers (RubyGems) < 7.3.0, ECOSYSTEM:introduced=0,fixed=7.3.0.
Is there a fix for CVE-2026-54163?
Yes. secure_headers (RubyGems): upgrade to 7.3.0 or later. Junglewise finds every place you run it, drafts the upgrade and applies it once you approve.
How is CVE-2026-54163 attacked?
It is attacked over the network, in a software library.
Am I affected by CVE-2026-54163?
Check whether you run secure_headers (RubyGems) at an affected version. Junglewise does that check for you around the clock: connect your code, cloud and domains, and it matches new vulnerabilities like this one against what you actually run and tells you when one reaches you.

How to fix

  • secure_headers (RubyGems): upgrade to 7.3.0 or later
    bundle update secure_headers

Technical details

The secure_headers gem (prior to version 7.3.0) fails to sanitize semicolons (;), carriage returns (\r), and newlines (\n) in the build_sandbox_list_directive, build_media_type_list_directive, and build_report_to_directive builders. When an application uses SecureHeaders.override_content_security_policy_directives or similar append APIs with untrusted input for these specific directives, an attacker can inject a semicolon followed by a new script-src directive. Because these directives are processed alphabetically before the legitimate script-src, the injected 'unsafe-inline' policy takes precedence due to the CSP first-occurrence rule. This effectively disables the application's intended script protections and can also be used to redirect CSP violation reports to attacker-controlled infrastructure.

Affected products

  • GitHub secure_headers <= 7.2.0

Identifiers

  • CVE-2026-54163
  • GHSA-rqq5-2gf9-4w4q

Timeline

  • 2026-06-03: patched: Fix committed and version 7.3.0 released.
  • 2026-07-17: disclosed: CVE-2026-54163 published.

References

This page as Markdown. Free to reuse under CC BY 4.0 with a link back.