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

- Severity: Medium 4.4 (CVSS:3.1, scored by GitHub_M) `CVSS:3.1/AV:N/AC:H/PR:L/UI:R/S:C/C:L/I:L/A:N`
- Known to be exploited: not in CISA's catalogue, which lists only what CISA has confirmed
- Likelihood of exploitation in the next 30 days (EPSS): 1.21%, higher than 69% of CVEs (2026-12-01)
- Public exploit code or proof of concept: one link below, marked "exploit"
- Published: 2020-01-23T02:27:53.000Z
- Modified: 2026-07-08T05:59:41.636Z
- Also known as: GHSA-w978-rmpf-qmwg
- Weaknesses: CWE-74, CWE-113
- Assigned by: GitHub_M

## 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.

(As written by CVE List.)

## Affected

- Twitter secure_headers: < 3.9.0; >= 5.0.0, < 5.2.0; >= 6.0.0, < 6.3.0; before 3.9.0; from 5.0.0 before 5.2.0; from 6.0.0 before 6.3.0
- secure_headers (RubyGems): from 6.0.0 before 6.3.0; from 5.0.0 before 5.2.0; before 3.9.0

## Every score

- GitHub_M: CVSS:3.1 4.4 Medium `CVSS:3.1/AV:N/AC:H/PR:L/UI:R/S:C/C:L/I:L/A:N`
- GitHub: CVSS:3.1 4.4 Medium `CVSS:3.1/AV:N/AC:H/PR:L/UI:R/S:C/C:L/I:L/A:N`
- NVD: CVSS:3.1 5.8 Medium `CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:C/C:N/I:L/A:N`
- NVD: CVSS:2.0 5.0 Medium `AV:N/AC:L/Au:N/C:N/I:P/A:N`

## References

- <https://github.com/twitter/secure_headers/security/advisories/GHSA-w978-rmpf-qmwg> (exploit, mitigation, third-party-advisory, web)
- <https://github.com/twitter/secure_headers/commit/301695706f6a70517c2a90c6ef9b32178440a2d0> (patch, web)
- <https://nvd.nist.gov/vuln/detail/CVE-2020-5216> (advisory)
- <https://github.com/rubysec/ruby-advisory-db/blob/master/gems/secure_headers/CVE-2020-5216.yml> (web)
- <https://github.com/twitter/secure_headers> (package)

## Sources

- CVE List: [CVE-2020-5216](https://www.cve.org/CVERecord?id=CVE-2020-5216), CVE Terms of Use, modified 2024-08-04
- GitHub Advisory Database: [GHSA-w978-rmpf-qmwg](https://github.com/advisories/GHSA-w978-rmpf-qmwg), CC-BY-4.0, modified 2026-07-08
- NVD: [CVE-2020-5216](https://nvd.nist.gov/vuln/detail/CVE-2020-5216), Public domain, modified 2026-06-17

---

Page: https://cve.day/CVE-2020-5216 · Whole record: https://cve.day/CVE-2020-5216.json · Rebuilt by cve.day 2026-11-25T22:57:50.660Z
