CVE-2020-5217

Directive injection when using dynamic overrides with user input in RubyGems secure_headers

MEDIUM
5.8
CVSS Score
Published: January 23, 2020 at 02:15 AM UTC
Updated: June 17, 2026 at 03:21 AM UTC
1 product affected across 1 vendorSecure Headers

Using secure_headers by Twitter?

Get instant alerts when new vulnerabilities affect secure_headers - before attackers find them.

Real-time alertsTrack your software stackFree plan available
Severity
MEDIUM5.8
Exploit prediction
EPSS 2%

Description

In Secure Headers (RubyGem secure_headers), a directive injection vulnerability is present in versions before 3.8.0, 5.1.0, and 6.2.0. If user-supplied input was passed into append/override_content_security_policy_directives, a semicolon could be injected leading to directive injection. This could be used to e.g. override a script-src directive. Duplicate directives are ignored and the first one wins. The directives in secure_headers are sorted alphabetically so they pretty much all come before script-src. A previously undefined directive would receive a value even if SecureHeaders::OPT_OUT was supplied. The fixed versions will silently convert the semicolons to spaces and emit a deprecation warning when this happens. This will result in innocuous browser console messages if being exploited/accidentally used. In future releases, we will raise application errors resulting in 500s. Depending on what major version you are using, the fixed versions are 6.2.0, 5.1.0, 3.8.0.

Affected

Our own answer: ranges merged, affected separated from platform-only, with confidence and review flags.

v < 3.8.0v < 5.1.0v < 6.2.05.0.0 ≤ v < 5.1.06.0.0 ≤ v < 6.2.0
Affected range stops below 3.8.0, so it looks safe — our inference, not a vendor statement
Affected range stops below 5.1.0, so it looks safe — our inference, not a vendor statement
Affected range stops below 6.2.0, so it looks safe — our inference, not a vendor statement

Remediation

No guide yet

No remediation guidance has been written for this CVE yet. What the record does show:

CVSS

Attack Vector
NETWORK
Complexity
LOW
Privileges
NONE
User Interaction
NONE
Scope
CHANGED
Confidentiality
NONE
Integrity
LOW
Availability
NONE
Vector?

Quick Info

StatusMODIFIED
CWE
CWE-95CWE-74

Get alerted

Stop reading CVE feeds looking for your own stack

Track the products you run and VulnTracker tells you when a new CVE affects them — with what is known about fixing it, and nothing about the rest.

Free plan, no card