CVE-2020-11709:CRLF Injection Vulnerability in cpp-httplib through 0.5.8

splash
Back

Description Preview

cpp-httplib through version 0.5.8 contains a CRLF injection vulnerability. The library does not properly filter carriage return (\r) and line feed (\n) characters in parameters passed to the set_redirect and set_header functions. This vulnerability could allow attackers to inject new HTTP headers or split HTTP responses, potentially leading to various security issues including session fixation, cache poisoning, or cross-site scripting (XSS) in specific contexts.

Overview

The vulnerability (CVE-2020-11709) affects cpp-httplib, a C++ HTTP/HTTPS server and client library, in versions through 0.5.8. The issue stems from insufficient input validation where the library fails to sanitize or escape CRLF sequences (\r\n) in user-controlled input that is later used in HTTP headers. When an application uses the affected set_redirect or set_header functions with unsanitized user input, attackers can manipulate HTTP responses by injecting additional headers or splitting the response into multiple parts. This type of vulnerability falls under CWE-74 (Improper Neutralization of Special Elements in Output Used by a Downstream Component), commonly known as injection flaws.

Remediation

To remediate this vulnerability, the following actions are recommended:

  1. Upgrade cpp-httplib to a version newer than 0.5.8 that contains the fix for this vulnerability.
  2. If upgrading is not immediately possible, implement additional validation for any user-supplied input that is passed to the set_redirect or set_header functions to ensure CRLF sequences are properly escaped or removed.
  3. Consider implementing a middleware or wrapper function that sanitizes inputs before they are passed to these vulnerable functions.
  4. Review application code for instances where user-controlled data is used in HTTP header construction and ensure proper validation is in place.
  5. Implement HTTP response headers like Content-Security-Policy to mitigate potential impacts of successful exploitation.

References

  1. Vulnerability details and proof of concept: https://gist.github.com/shouc/a9330df817128bc4c4132abf3de09495
  2. Issue report on GitHub: https://github.com/yhirose/cpp-httplib/issues/425
  3. CWE-74: Improper Neutralization of Special Elements in Output Used by a Downstream Component: https://cwe.mitre.org/data/definitions/74.html
  4. OWASP HTTP Response Splitting: https://owasp.org/www-community/attacks/HTTP_Response_Splitting

Industry ExposureMost to least
This section illustrates the prevalence of a specific Common Vulnerabilities and Exposures (CVE) across various industries based on customer reports. The ranking displays industries from the most to least affected by this particular vulnerability, offering valuable insight into where this CVE has been most frequently observed. This information can help organizations within these sectors prioritize their security efforts, understand their relative risk exposure compared to their peers, and focus remediation strategies where they are most needed. By understanding the industry-specific impact, organizations can make more informed decisions regarding patching, resource allocation, and overall risk management related to this CVE.

  1. Accommodation & Food Services
    Accommodation & Food Services
  2. Administrative, Support, Waste Management & Remediation Services
    Administrative, Support, Waste Management & Remediation Services
  3. Agriculture, Forestry Fishing & Hunting
    Agriculture, Forestry Fishing & Hunting
  4. Arts, Entertainment & Recreation
    Arts, Entertainment & Recreation
  5. Construction
    Construction
  6. Educational Services
    Educational Services
  7. Finance and Insurance
    Finance and Insurance
  8. Health Care & Social Assistance
    Health Care & Social Assistance
  9. Information
    Information
  10. Management of Companies & Enterprises
    Management of Companies & Enterprises
  11. Manufacturing
    Manufacturing
  12. Mining
    Mining
  13. Other Services (except Public Administration)
    Other Services (except Public Administration)
  14. Professional, Scientific, & Technical Services
    Professional, Scientific, & Technical Services
  15. Public Administration
    Public Administration
  16. Real Estate Rental & Leasing
    Real Estate Rental & Leasing
  17. Retail Trade
    Retail Trade
  18. Transportation & Warehousing
    Transportation & Warehousing
  19. Utilities
    Utilities
  20. Wholesale Trade
    Wholesale Trade

Focus on What Matters

  1. See Everything.
  2. Identify True Risk.
  3. Proactively Mitigate Threats.

Let's talk!

background
Armis Vulnerability Intelligence Database