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.
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
| Ecosystem | Package | Fixed in | Advisory |
|---|---|---|---|
| Debian:12 | ruby-secure-headers | 6.3.1-1 | DEBIAN-CVE-2020-5217 |
| Debian:13 | ruby-secure-headers | 6.3.1-1 | DEBIAN-CVE-2020-5217 |
| Debian:14 | ruby-secure-headers | 6.3.1-1 | DEBIAN-CVE-2020-5217 |
| RubyGems | secure_headers | 6.2.0 | GHSA-xq52-rv6w-397c |
| RubyGems | secure_headers | 5.1.0 | GHSA-xq52-rv6w-397c |
| RubyGems | secure_headers | 3.8.0 | GHSA-xq52-rv6w-397c |
Affected products (as reported)
| Vendor | Product | Versions |
|---|---|---|
| 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
- https://github.com/twitter/secure_headers/security/advisories/GHSA-xq52-rv6w-397c x_refsource_CONFIRM
- https://github.com/twitter/secure_headers/issues/418 x_refsource_MISC
- https://github.com/twitter/secure_headers/pull/421 x_refsource_MISC
- https://github.com/twitter/secure_headers/commit/936a160e3e9659737a9f9eafce13eea36b5c9fa3 x_refsource_MISC