CVE-2026-54163
secure_headers: CSP directive injection via sandbox, plugin_types, and report_to when given untrusted input
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.
Attack profile
How easy it is to exploit
- Attack vector
- Network
- Complexity
- High
- Privileges needed
- None
- User interaction
- Required
What an attacker can affect
- Confidentiality
- Low
- Integrity
- Low
- Availability
- None
Exploit likelihood
What each source reports
CVE List Score used
4.7
secure_headers: CSP directive injection via sandbox, plugin_types, and report_to when given untrusted input
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.
- Record
CVE-2026-54163- CVSS 3.1
- 4.7 Medium
CVSS:3.1/AV:N/AC:H/PR:N/UI:R/S:C/C:L/I:L/A:N - Weakness
- CWE-79, CWE-113
- Updated
- 2026-11-02
EUVDEUVD-2026-45317
4.7
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.
- Record
EUVD-2026-45317- CVSS 3.1
- 4.7 Medium
CVSS:3.1/AV:N/AC:H/PR:N/UI:R/S:C/C:L/I:L/A:N - Updated
- 2026-11-02
GitHub AdvisoriesGHSA-rqq5-2gf9-4w4q
4.7
Secure Headers: CSP directive injection via sandbox, plugin_types, and report_to when given untrusted input
Summary
secure_headers builds the Content-Security-Policy value by stitching every configured directive together with ; separators. Three directive builders (build_sandbox_list_directive, build_media_type_list_directive, build_report_to_directive) interpolate caller-supplied strings into that value without scrubbing ;, \r, or \n.
When an application forwards untrusted input into SecureHeaders.override_content_security_policy_directives (or append_…) for :sandbox, :plugin_types, or :report_to, an attacker can embed a literal ; and inject an arbitrary CSP directive into the header value. Because :sandbox and :plugin_types both sort alphabetically before :script_src in BODY_DIRECTIVES, the injected script-src lands earlier in the header and wins under the CSP first-occurrence rule, defeating the application's real script-src. End result: an 'unsafe-inline' * policy is forced for inline <script> despite the configured strict CSP, giving full XSS reachability anywhere reflected or stored content meets one of these three sinks.
An existing ;/\n scrub is already present in the source-list builder (build_source_list_directive), but the three sibling builders here never received the same treatment and still emit caller bytes verbatim into the CSP value.
Impact
Although piping untrusted input into CSP directives is generally discouraged, applications that do so for one of the three uncovered directives turn that endpoint into an XSS sink with an effective * 'unsafe-inline' script-src, even though the global config says script_src: %w('self'). The same primitive can also be used to point report-to / report-uri at attacker infrastructure to silently siphon CSP violation reports — which include the violated URL, blocked-uri, source-file, line-number and a sample-snippet, useful for fingerprinting and for harvesting victim-internal URLs.
The global default CSP set in Configuration.default is supposed to be a backstop: even if a controller appends a single risky value, the strict script-src should remain the first match. This bug breaks that property by letting the appended value redefine the policy header upstream of the legitimate script-src.
Affected
- Package:
secure_headers(RubyGems) - Vulnerable versions:
<= 7.2.0 - Patched version:
7.3.0
Applications that set :sandbox, :plugin_types, or :report_to only from static configuration (no per-request or per-tenant input) are not exploitable and need only the version bump. Applications that pipe any user-controlled value into one of those three directives via the per-controller override APIs are exploitable and should both upgrade and audit those code paths.
Mitigations / Workarounds
Until upgrading to 7.3.0, sanitize any user-controlled input before passing it to:
SecureHeaders.override_content_security_policy_directivesSecureHeaders.append_content_security_policy_directivesSecureHeaders.use_content_security_policy_named_append
for :sandbox, :plugin_types, or :report_to. Reject or strip ;, \r, and \n from values destined for these directives before they reach the gem.
Vulnerable code
Three sibling builders all join an attacker-controllable value into the CSP header value with no ; / \r / \n scrubbing.
content_security_policy.rb#L72-L93—build_sandbox_list_directive:
elsif sandbox_list && sandbox_list.any?
[
symbol_to_hyphen_case(directive),
sandbox_list.uniq
].join(" ")
end
- Record
GHSA-rqq5-2gf9-4w4q- CVSS 3.1
- 4.7 Medium
CVSS:3.1/AV:N/AC:H/PR:N/UI:R/S:C/C:L/I:L/A:N - Weakness
- CWE-79, CWE-113
- Updated
- 2026-11-02
NVD
4.7
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.
- Record
CVE-2026-54163- CVSS 3.1
- 4.7 Medium
CVSS:3.1/AV:N/AC:H/PR:N/UI:R/S:C/C:L/I:L/A:N - Weakness
- CWE-79, CWE-113
- Updated
- 2026-11-02
OSV
4.7
secure_headers: CSP directive injection via sandbox, plugin_types, and report_to when given untrusted input
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.
- Record
CVE-2026-54163- CVSS 3.1
- 4.7 Medium
CVSS:3.1/AV:N/AC:H/PR:N/UI:R/S:C/C:L/I:L/A:N - Weakness
- CWE-113, CWE-79
- Updated
- 2026-11-02
OSVDEBIAN-CVE-2026-54163
4.7
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.
- Record
DEBIAN-CVE-2026-54163- CVSS 3.1
- 4.7 Medium
CVSS:3.1/AV:N/AC:H/PR:N/UI:R/S:C/C:L/I:L/A:N - Updated
- 2026-11-02
OSVGHSA-rqq5-2gf9-4w4q
4.7
Secure Headers: CSP directive injection via sandbox, plugin_types, and report_to when given untrusted input
Summary
secure_headers builds the Content-Security-Policy value by stitching every configured directive together with ; separators. Three directive builders (build_sandbox_list_directive, build_media_type_list_directive, build_report_to_directive) interpolate caller-supplied strings into that value without scrubbing ;, \r, or \n.
When an application forwards untrusted input into SecureHeaders.override_content_security_policy_directives (or append_…) for :sandbox, :plugin_types, or :report_to, an attacker can embed a literal ; and inject an arbitrary CSP directive into the header value. Because :sandbox and :plugin_types both sort alphabetically before :script_src in BODY_DIRECTIVES, the injected script-src lands earlier in the header and wins under the CSP first-occurrence rule, defeating the application's real script-src. End result: an 'unsafe-inline' * policy is forced for inline <script> despite the configured strict CSP, giving full XSS reachability anywhere reflected or stored content meets one of these three sinks.
An existing ;/\n scrub is already present in the source-list builder (build_source_list_directive), but the three sibling builders here never received the same treatment and still emit caller bytes verbatim into the CSP value.
Impact
Although piping untrusted input into CSP directives is generally discouraged, applications that do so for one of the three uncovered directives turn that endpoint into an XSS sink with an effective * 'unsafe-inline' script-src, even though the global config says script_src: %w('self'). The same primitive can also be used to point report-to / report-uri at attacker infrastructure to silently siphon CSP violation reports — which include the violated URL, blocked-uri, source-file, line-number and a sample-snippet, useful for fingerprinting and for harvesting victim-internal URLs.
The global default CSP set in Configuration.default is supposed to be a backstop: even if a controller appends a single risky value, the strict script-src should remain the first match. This bug breaks that property by letting the appended value redefine the policy header upstream of the legitimate script-src.
Affected
- Package:
secure_headers(RubyGems) - Vulnerable versions:
<= 7.2.0 - Patched version:
7.3.0
Applications that set :sandbox, :plugin_types, or :report_to only from static configuration (no per-request or per-tenant input) are not exploitable and need only the version bump. Applications that pipe any user-controlled value into one of those three directives via the per-controller override APIs are exploitable and should both upgrade and audit those code paths.
Mitigations / Workarounds
Until upgrading to 7.3.0, sanitize any user-controlled input before passing it to:
SecureHeaders.override_content_security_policy_directivesSecureHeaders.append_content_security_policy_directivesSecureHeaders.use_content_security_policy_named_append
for :sandbox, :plugin_types, or :report_to. Reject or strip ;, \r, and \n from values destined for these directives before they reach the gem.
Vulnerable code
Three sibling builders all join an attacker-controllable value into the CSP header value with no ; / \r / \n scrubbing.
content_security_policy.rb#L72-L93—build_sandbox_list_directive:
elsif sandbox_list && sandbox_list.any?
[
symbol_to_hyphen_case(directive),
sandbox_list.uniq
].join(" ")
end
- Record
GHSA-rqq5-2gf9-4w4q- CVSS 3.1
- 4.7 Medium
CVSS:3.1/AV:N/AC:H/PR:N/UI:R/S:C/C:L/I:L/A:N - Weakness
- CWE-113, CWE-79
- Updated
- 2026-11-02
OSVUBUNTU-CVE-2026-54163
4.7
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.
- Record
UBUNTU-CVE-2026-54163- CVSS 3.1
- 4.7 Medium
CVSS:3.1/AV:N/AC:H/PR:N/UI:R/S:C/C:L/I:L/A:N - Updated
- 2026-11-02
Affected products
Affected packages
| Package | Affected | Fixed |
|---|---|---|
secure_headersRubyGems |
before 7.3.0 | 7.3.0 |
ruby-secure-headersDebian:12 |
All versions, plus listed versions 6.3.2-16.3.2-27.1.0-17.2.0-17.3.0-1 |
None known |
ruby-secure-headersDebian:13 |
All versions, plus listed versions 6.3.2-27.1.0-17.2.0-17.3.0-1 |
None known |
ruby-secure-headersDebian:14 |
before 7.3.0-1, plus listed versions 6.3.2-27.1.0-17.2.0-1 |
7.3.0-1 |
secure_headersRubyGems |
before 7.3.0, plus listed versions 0.1.00.1.10.2.00.2.10.3.0 Show 45 moreShow less0.4.00.4.10.4.20.4.30.5.01.0.01.1.01.1.11.2.01.3.01.3.11.3.21.3.31.3.41.4.01.4.12.0.02.0.0.pre2.0.0.pre22.0.12.0.22.1.02.2.02.2.12.2.22.2.32.2.42.3.02.4.02.4.12.4.22.4.32.4.42.5.02.5.12.5.22.5.33.0.03.0.0.pre3.0.0.pre13.0.0.pre23.0.0.pre33.0.0.rc13.0.13.0.2 |
7.3.0 |
ruby-secure-headersUbuntu:18.04:LTS |
All versions, plus listed versions 3.7.1-1 |
None known |
ruby-secure-headersUbuntu:20.04:LTS |
All versions, plus listed versions 6.0.0-16.1.1-1 |
None known |
ruby-secure-headersUbuntu:22.04:LTS |
All versions, plus listed versions 6.3.2-1 |
None known |
ruby-secure-headersUbuntu:24.04:LTS |
All versions, plus listed versions 6.3.2-16.3.2-2 |
None known |
ruby-secure-headersUbuntu:26.10 |
All versions, plus listed versions 7.1.0-17.2.0-17.3.0-1 |
None known |
ruby-secure-headersUbuntu:26.04:LTS |
All versions, plus listed versions 6.3.2-27.1.0-1 |
None known |
History
| Recorded | Changed | Sources |
|---|---|---|
| first indexed | CVE List, EUVD, GitHub Advisories, NVD, OSV |
Dates are when Every CVE recorded each change. Upstream dates may differ.
In short
CVE-2026-54163 is a medium vulnerability (CVSS 4.7) in Github Secure Headers, published July 10, 2026. No source lists public exploit code. EPSS puts the chance of exploitation in the next 30 days at 0.21%, the 11th percentile. Fixed in secure_headers 7.3.0.
References
github.com/github/secure_headers/security/advisories/GHSA-rqq5-2gf9-4w4q
github.com/github/secure_headers/commit/286a79dea80c6a9be4ca93e0f284c923cf77e539
github.com/github/secure_headers/releases/tag/v7.3.0
github.com/rubysec/ruby-advisory-db/blob/master/gems/secure_headers/CVE-2026-54163.yml
cve.org/CVERecord/SearchResults?query=CVE-2026-54163
github.com/advisories/GHSA-rqq5-2gf9-4w4q
Left out here: 63 versions and the rest of 2 source descriptions. The JSON record has them.