CVE-2026-54163: CWE-79: Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting') in github secure_headers
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.
AI Analysis
Technical Summary
secure_headers builds the Content-Security-Policy header by concatenating directives. Three directive builders (for :sandbox, :plugin_types, and :report_to) interpolate caller-supplied strings without sanitizing ';', '\r', or '\n'. This allows attackers who can influence these directives to inject arbitrary CSP directives, including a 'script-src' directive with 'unsafe-inline', which takes precedence due to CSP's first-occurrence rule. This breaks the intended strict CSP policy and enables cross-site scripting (XSS). The vulnerability affects versions prior to 7.3.0. Applications that only use static values for these directives are not exploitable. The issue is patched in version 7.3.0.
Potential Impact
Applications using secure_headers <= 7.2.0 that pass untrusted input into the :sandbox, :plugin_types, or :report_to CSP directives can have their CSP header manipulated to allow unsafe inline scripts, effectively enabling XSS attacks despite strict global CSP configurations. Additionally, attackers can redirect CSP violation reports to attacker-controlled infrastructure, leaking sensitive information about the victim's environment. This undermines the security guarantees of CSP and can lead to client-side code execution and information disclosure.
Mitigation Recommendations
Upgrade secure_headers to version 7.3.0 or later, where this vulnerability is fixed. Until upgrading, sanitize any user-controlled input passed to SecureHeaders.override_content_security_policy_directives, append_content_security_policy_directives, or use_content_security_policy_named_append for the :sandbox, :plugin_types, or :report_to directives by rejecting or stripping ';', '\r', and '\n' characters. Applications that only use static values for these directives do not require additional mitigation beyond upgrading.
CVE-2026-54163: CWE-79: Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting') in github secure_headers
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.
CVSS v3.1
Score 4.7medium
Affected software
Run on your own infrastructure? Check whether these packages are installed with threat-finder — our free open-source scanner.
AI-Powered Analysis
Machine-generated threat intelligence
Technical Analysis
secure_headers builds the Content-Security-Policy header by concatenating directives. Three directive builders (for :sandbox, :plugin_types, and :report_to) interpolate caller-supplied strings without sanitizing ';', '\r', or '\n'. This allows attackers who can influence these directives to inject arbitrary CSP directives, including a 'script-src' directive with 'unsafe-inline', which takes precedence due to CSP's first-occurrence rule. This breaks the intended strict CSP policy and enables cross-site scripting (XSS). The vulnerability affects versions prior to 7.3.0. Applications that only use static values for these directives are not exploitable. The issue is patched in version 7.3.0.
Potential Impact
Applications using secure_headers <= 7.2.0 that pass untrusted input into the :sandbox, :plugin_types, or :report_to CSP directives can have their CSP header manipulated to allow unsafe inline scripts, effectively enabling XSS attacks despite strict global CSP configurations. Additionally, attackers can redirect CSP violation reports to attacker-controlled infrastructure, leaking sensitive information about the victim's environment. This undermines the security guarantees of CSP and can lead to client-side code execution and information disclosure.
Mitigation Recommendations
Upgrade secure_headers to version 7.3.0 or later, where this vulnerability is fixed. Until upgrading, sanitize any user-controlled input passed to SecureHeaders.override_content_security_policy_directives, append_content_security_policy_directives, or use_content_security_policy_named_append for the :sandbox, :plugin_types, or :report_to directives by rejecting or stripping ';', '\r', and '\n' characters. Applications that only use static values for these directives do not require additional mitigation beyond upgrading.
Technical Details
- Gcve Source
- db.gcve.eu
- Osv Id
- GHSA-rqq5-2gf9-4w4q
- Osv Schema Version
- 1.4.0
- Aliases
- ["CVE-2026-54163"]
- Ecosystems
- ["RubyGems"]
- Database Specific Severity
- MODERATE
- Cvss Version
- 3.1
Threat ID: 6a520eb168715ace438f4ff7
Added to database: 07/11/2026, 09:36:49 UTC
Last enriched: 07/18/2026, 11:18:39 UTC
Last updated: 07/21/2026, 06:10:19 UTC
Views: 52
Community Reviews
0 reviewsCrowdsource mitigation strategies, share intel context, and vote on the most helpful responses. Sign in to add your voice and help keep defenders ahead.
Want to contribute mitigation steps or threat intel context? Sign in or create an account to join the community discussion.
Actions
Updates to AI analysis require Pro Console access. Upgrade inside Console → Billing.
Need more coverage?
Upgrade to Pro Console for AI refresh and higher limits.
For incident response and remediation, OffSeq services can help resolve threats faster.
Latest Threats
Check if your credentials are on the dark web
Instant breach scanning across billions of leaked records. Free tier available.