Heap-buffer-overflow in ndpi_search_http_tcp

ndpi Updated 02 Oct 2025

Summary

01/06/2022
MEDIUM
Yes i
Medium
Not published

OSV-2022-447: Heap-buffer-overflow in ndpi_search_http_tcp. Affects ndpi versions >= f25deeccb1ccbebd6346271828762fdd8326c32b, < c4f50b2cdac989cc89930564a88a5caab85c7214. Fixed in c4f50b2cdac989cc89930564a88a5caab85c7214. 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 MarkAI Find prospects already talking about the problem you solve AI watches the communities your customers use to find qualified prospects, then alerts you when a conversation is worth joining. See MarkAI

Background

The ndpi package is an open-source library used for deep packet inspection (DPI) of network traffic. It provides functionality to analyze network packets and identify various protocols and applications. This vulnerability affects the ndpi package and specifically the ndpi_search_http_tcp function. The function is responsible for searching and processing HTTP traffic over TCP connections. The vulnerability allows for a heap-buffer-overflow read of 11 bytes, which can lead to a crash of the application or potentially be exploited for remote code execution.

Vulnerability Detail

The vulnerability originates from a heap-buffer-overflow read in the ndpi_search_http_tcp function. When processing HTTP traffic over TCP connections, the function fails to properly validate the size of the buffer being read, leading to the overflow. An attacker could potentially craft a malicious packet that triggers this vulnerability, causing the application to crash or executing arbitrary code. The vulnerability has a medium severity rating.

How To Fix

Minimum fixed version

c4f50b2cdac989cc89930564a88a5caab85c7214

This is the first release that contains the fix.

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

Workaround

As a workaround, developers can implement input validation and boundary checks in their own code when using the ndpi library. By ensuring that the size of the buffer being read is within the expected limits, the vulnerability can be mitigated. Here is an example of how to perform input validation in C:

size_t buffer_size = /* size of the buffer */;

if (buffer_size <= 11) {
  // Handle error or reject the packet
}

// Continue processing the packet

Conclusion

The ndpi package is vulnerable to a heap-buffer-overflow read in the ndpi_search_http_tcp function. This can lead to application crashes or potential remote code execution. To mitigate the vulnerability, it is recommended to update the ndpi package to the latest version. Developers can also implement input validation and boundary checks in their own code as a workaround. For further support on vulnerability remediation, you can reach out to DevNack.com.

See every vulnerability recorded for ndpi →

Share this vulnerability

FAQ

The ndpi package is an open-source library used for deep packet inspection (DPI) of network traffic. It provides functionality to analyze network packets and identify various protocols and applications.

The vulnerability can lead to a crash of the application or potentially be exploited for remote code execution. It is important to update the ndpi package to prevent these risks.

To fix the vulnerability, update the ndpi package to the latest version. The fix can be found in commit c4f50b2cdac989cc89930564a88a5caab85c7214 of the nDPI repository.

Yes, developers can implement input validation and boundary checks in their own code when using the ndpi library. This can help mitigate the vulnerability.

You can find more information about this vulnerability in the OSS-Fuzz report: https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=47734

Related vulnerabilities

Recent vulnerabilities recorded for ndpi.

How To Fix

Minimum fixed version

c4f50b2cdac989cc89930564a88a5caab85c7214

This is the first release that contains the fix.

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