CRLF Injection Vulnerability in cpp-httplib: Risk of HTTP Response Splitting and XSS

cpp-httplib Updated 02 Oct 2025

Summary

04/02/2025
N/A
No i
Medium
5.3

CVE-2025-0825: cpp-httplib version v0.17.3 through v0.18.3 fails to filter CRLF characters ("\r\n") when those are prefixed with a null byte. Affects cpp-httplib across 2 version ranges.

< 9c36aae4b73e2b6e493f4133e4173103c9266289 >= 61c418048d8b0e42cc55e908c1c2da1e2f617f86, < 54f8a4d0f34acb3cc508e337d9881296b70201ad

No fix is published. 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 Mobile apps built by Devnack Design, build and launch iOS and Android apps with a senior product team. From idea to store release Start a project

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 developers needing a simple way to handle HTTP communications. However, versions v0.17.3 through v0.18.3 have a critical vulnerability that allows for CRLF injection, which can compromise the integrity of HTTP responses.

Vulnerability Detail

The vulnerability arises from cpp-httplib's failure to properly filter CRLF (Carriage Return Line Feed) characters when they are prefixed with a null byte. This oversight can be exploited by attackers to inject malicious content into HTTP responses, potentially leading to HTTP Response Splitting attacks. Such attacks can facilitate further exploits, including Cross-Site Scripting (XSS), which can compromise user data and application security.

How To Fix

No fixed version is published for this vulnerability.

Tip — Not sure whether your app is affected? Vulert can check the versions your app actually runs. Scan free →

Workaround

As a temporary workaround, developers can implement input validation to filter out CRLF characters in user inputs before processing them. This can be done using the following code snippet: 'if (

input.contains("\r") || input.contains("\n")) { throw new Exception("Invalid input");

}'. This will help mitigate the risk until the package is updated.

Conclusion

The CRLF injection vulnerability in cpp-httplib poses significant risks to applications using affected versions. It is essential to update to the patched version to safeguard against potential exploits. Implementing input validation can serve as a temporary measure until the update is applied.

See every vulnerability recorded for cpp-httplib →

Share this vulnerability

FAQ

CRLF injection is a type of attack where an attacker injects CRLF characters into a response header, allowing them to manipulate the response structure.

You can check if your application is affected by using Vulert, which monitors open-source vulnerabilities in real-time. Visit Vulert Scanner to analyze your manifest file.

Exploiting this vulnerability can lead to HTTP Response Splitting, which may allow attackers to perform XSS attacks, steal user data, or redirect users to malicious sites.

Yes, a patch is available in the form of an updated version of cpp-httplib. Ensure you update to the version that includes the fix.

If immediate updates are not possible, implement input validation as a temporary workaround to mitigate the risk of CRLF injection.

Related vulnerabilities

Recent vulnerabilities recorded for cpp-httplib.

How To Fix

No fixed version is published for this vulnerability.

Tip — Not sure whether your app is affected? Vulert can check the versions your app actually runs. 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