CVE-2026-54163

secure_headers: CSP directive injection via sandbox, plugin_types, and report_to when given untrusted input

Published Jul 17, 2026 CVSS 3.1 · 4.7 Medium EPSS < 1% KEV · Not listed
Description
secure_headers manages application of security headers with many safe defaults. Prior to 7.3.0, secure_headers builds the Content-Security-Policy value by stitching directives with ; separators, and build_sandbox_list_directive, build_media_type_list_directive, and build_report_to_directive interpolate caller-supplied strings without scrubbing ;, \r, or \n. When untrusted input reaches SecureHeaders.override_content_security_policy_directives or append APIs for :sandbox, :plugin_types, or :report_to, an attacker can inject a CSP directive such as script-src 'unsafe-inline' * before the legitimate script-src, enabling XSS reachability through these sinks or CSP report exfiltration. This issue is fixed in version 7.3.0.

Analysis

AI-generated

Technical impact

secure_headers builds the CSP header by concatenating directive strings. Prior to 7.3.0, the functions that generate sandbox, plugin_types, and report_to directives interpolate caller‑supplied input without sanitizing characters such as ';', carriage returns or newlines. Because of this, an attacker can inject an entire new CSP rule, for example a script-src 'unsafe-inline' *, positioned before the legitimate rule. This injected rule effectively bypasses the intended policy, allowing cross‑site scripting or exfiltration through CSP report URLs. The vulnerability is fixed in secure_headers 7.3.0.

Affected Systems

The product affected is the secure_headers Ruby gem distributed by GitHub. All versions before 7.3.0 are vulnerable. Version 7.3.0 and later contain the fix that sanitizes directive strings.

Risk and Exploitability

The CVSS score of 4.7 indicates moderate severity. The EPSS score is below 1%, implying a low likelihood of exploitation. The vulnerability is not listed in CISA’s KEV catalog. Exploitation requires the threat actor to provide crafted input to SecureHeaders.override_content_security_policy_directives or to the append methods for the sandbox, plugin_types, or report_to directives. Based on the description, it is inferred that the attack vector would involve remote delivery of malicious data to the application code that calls these APIs, though the vulnerability can only be leveraged when such data propagates to the gem. Once exploited, the attacker can execute arbitrary scripts within the context of the protected application or exfiltrate data via CSP report mechanisms.

Remediation

No solution or workaround provided in the CVE record.

OpenCVE Recommended Actions

  • Upgrade the secure_headers gem to version 7.3.0 or newer.
  • Validate or sanitize any data passed to SecureHeaders.override_content_security_policy_directives or the append APIs, removing characters such as ';', '\r', and '\n'.
  • Review the application configuration to ensure that only trusted values are supplied to CSP directive APIs, or hard‑code CSP rules where dynamic input is unnecessary.

Generated by OpenCVE AI on July 30, 2026 at 23:30 UTC.

Tracking

Sign in to view the affected projects.

Advisories

Source ID Title
Github GHSA Github GHSA GHSA-rqq5-2gf9-4w4q Secure Headers: CSP directive injection via sandbox, plugin_types, and report_to when given untrusted input
History
Type Values Removed Values Added
First Time appeared Github
Github secure Headers
Vendors & Products Github
Github secure Headers
Type Values Removed Values Added
Metrics ssvc

{'options': {'Automatable': 'no', 'Exploitation': 'poc', 'Technical Impact': 'partial'}, 'version': '2.0.3'}

Type Values Removed Values Added
Description secure_headers manages application of security headers with many safe defaults. Prior to 7.3.0, secure_headers builds the Content-Security-Policy value by stitching directives with ; separators, and build_sandbox_list_directive, build_media_type_list_directive, and build_report_to_directive interpolate caller-supplied strings without scrubbing ;, \r, or \n. When untrusted input reaches SecureHeaders.override_content_security_policy_directives or append APIs for :sandbox, :plugin_types, or :report_to, an attacker can inject a CSP directive such as script-src 'unsafe-inline' * before the legitimate script-src, enabling XSS reachability through these sinks or CSP report exfiltration. This issue is fixed in version 7.3.0.
Title secure_headers: CSP directive injection via sandbox, plugin_types, and report_to when given untrusted input
Weaknesses CWE-113
CWE-79
References
Metrics cvssV3_1

{'score': 4.7, 'vector': 'CVSS:3.1/AV:N/AC:H/PR:N/UI:R/S:C/C:L/I:L/A:N'}

Weaknesses
  • CWE-113

    Improper Neutralization of CRLF Sequences in HTTP Headers ('HTTP Request/Response Splitting')

  • CWE-79

    Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting')

Sources

Status
PUBLISHED
Assigner
GitHub_M
Published
Updated
Jul 20, 2026, 5:45 PM
Reserved
Jun 11, 2026, 9:46 PM
Status
Deferred
Published
Jul 17, 2026, 9:17 PM
Modified
Oct 24, 2026, 8:10 PM