CRLF Injection Vulnerability in cpp-httplib: A Critical Security Flaw

cpp-httplib Updated 02 Oct 2025

Summary

30/05/2023
N/A
Yes i
High
8.8

CVE-2023-26130: Versions of the package yhirose/cpp-httplib before 0.12.4 are vulnerable to CRLF Injection when untrusted user input is used to set the content-type header in the HTTP .Patch, .Post, .Put and .Delete requests. Affects cpp-httplib across 3 version ranges.

< 0.11.4+ds-1+deb12u1 < 5b397d455d25a391ba346863830c1949627b4d08 < 3409c00e6f5402eb4e300b45e44e11c3bdfe1a5c

Fixed in 0.11.4+ds-1+deb12u1. How to fix ↓

Free scan

Check if this vulnerability affects your application

Upload a manifest or SBOM and we'll show whether you're affected, plus every other risky package in the same scan.

Check my app free

No signup required · Results in about 60 seconds

Upload your dependency manifest or SBOM

Drag & drop your file here or

Java Javascript PHP Python Go Rust Ruby Dart C/C++ Elixir CycloneDX SPDX

Upload a supported dependency manifest or SBOM. No installation or source-code access required.

See supported files and SBOM formats
SBOM sbom.json · bom.json · bom.xml · *.spdx.json · *.cdx.json · *.cdx.xml
Java pom.xml · gradle.lockfile · buildscript-gradle.lockfile
Javascript package-lock.json · yarn.lock · pnpm-lock.yaml
PHP composer.lock
Python poetry.lock · requirements.txt · Pipfile.lock
Go go.mod
Rust Cargo.lock
Ruby Gemfile.lock
Dart pubspec.lock
C/C++ conan.lock
Elixir mix.lock
Enter your work email to receive your report link.

Verify your email to view the full report and start 30 days of continuous monitoring. No credit card required.

Sponsored Devnack Your last release was probably never penetration tested Manual testing by engineers who build software, not an auditor's checklist. Trusted by teams at Swift and Google Talk to Devnack

Background

cpp-httplib is a C++ header-only library designed for HTTP/HTTPS requests. It is lightweight and easy to integrate, making it popular for applications requiring network communication. However, certain versions of cpp-httplib are vulnerable to CRLF injection, which can lead to logical errors and misbehavior when untrusted user input is used to set the content-type header in HTTP requests.

Vulnerability Detail

The vulnerability, identified as CVE-2023-26130, affects versions of cpp-httplib prior to 0.12.4. It arises from an incomplete fix for a previous vulnerability (CVE-2020-11709) and allows attackers to exploit the content-type header in HTTP methods such as Patch, Post, Put, and Delete. This can result in severe consequences, including the potential for unauthorized actions and data manipulation, as the application may misinterpret the headers due to the injection.

How To Fix

Minimum fixed version

0.11.4+ds-1+deb12u1

This is the first release that contains the fix.

sudo apt-get install --only-upgrade cpp-httplib

Tip — Not sure which version your app runs? Vulert can match this fix to it. Scan free →

Workaround

If immediate upgrading is not feasible, consider sanitizing user input to ensure that no CRLF characters are included in the content-type header. This can be done by implementing a validation function that checks for and removes any newline characters from the input before it is processed.

Conclusion

The CRLF injection vulnerability in cpp-httplib poses a significant risk to applications using this library. It is crucial to upgrade to the latest version to protect against potential exploits. Additionally, implementing input validation can serve as a temporary measure to mitigate risks until an upgrade can be performed.

See every vulnerability recorded for cpp-httplib →

Share this vulnerability

FAQ

CRLF injection is a type of attack where an attacker can insert CR (Carriage Return) and LF (Line Feed) characters into HTTP headers, potentially altering the behavior of the application.

You can use the Vulert playground at Vulert Scanner to check if your application is affected by this vulnerability without needing to sign up.

Exploiting this vulnerability can lead to logical errors, unauthorized actions, and data manipulation within the application.

Yes, you should upgrade to cpp-httplib version 0.12.4 or later to mitigate this vulnerability.

Implement input validation to sanitize user input, ensuring that no CRLF characters are included in the content-type header.

Related vulnerabilities

Recent vulnerabilities recorded for cpp-httplib.

How To Fix

Minimum fixed version

0.11.4+ds-1+deb12u1

This is the first release that contains the fix.

sudo apt-get install --only-upgrade cpp-httplib

Tip — Not sure which version your app runs? Vulert can match this fix to it. Scan free →

Subscribe to Vulert on Telegram
Daily digest of new CVEs, critical and high severity, affected packages and fixes — plus a weekly roundup.
Join the channel →
Help improve this record
Report an issue or send feedback