Vulnerability · Published Jan 23, 2020 · Assigned by GitHub_M

CVE-2020-5217Directive injection when using dynamic overrides with user input in RubyGems secure_headers

Medium 4.4

In plain English

A medium-severity security flaw in secure_headers from Twitter. There are no confirmed reports of exploitation so far. The chance it is exploited in the next 30 days is estimated at 1.8% (higher than 79% of all known vulnerabilities). Fixed versions are available - upgrade the affected package.

Severity (CVSS 3.1)4.4Medium
Exploit odds (30 days)1.8%top 21.0% of all CVEs
Exploited in the wildNo reportsnot in CISA KEV
Attack toolingNoneno public tooling known

Official 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 packages & fixed versions

EcosystemPackageFixed inAdvisory
Debian:12ruby-secure-headers6.3.1-1DEBIAN-CVE-2020-5217
Debian:13ruby-secure-headers6.3.1-1DEBIAN-CVE-2020-5217
Debian:14ruby-secure-headers6.3.1-1DEBIAN-CVE-2020-5217
RubyGemssecure_headers6.2.0GHSA-xq52-rv6w-397c
RubyGemssecure_headers5.1.0GHSA-xq52-rv6w-397c
RubyGemssecure_headers3.8.0GHSA-xq52-rv6w-397c

Affected products (as reported)

VendorProductVersions
Twitter secure_headers < 3.8.0>= 5.0.0, < 5.1.0>= 6.0.0, < 6.2.0

Weakness: CWE-95 · Vector: CVSS:3.1/AV:N/AC:H/PR:L/UI:R/S:C/C:L/I:L/A:N

References