Heap-buffer-overflow in pcapplusplus: pcpp::GREv1Layer::computeCalculateFields

pcapplusplus Updated 02 Oct 2025

Summary

13/11/2023
HIGH
Yes i
High
Not published

OSV-2023-1145: Heap-buffer-overflow in pcpp::GREv1Layer::computeCalculateFields. Affects pcapplusplus versions >= 6a67cab6914074841ed81116ac72219ca070a44d, < a0ecc6dad71f445c95936697c7ee15997d5761b2. Fixed in a0ecc6dad71f445c95936697c7ee15997d5761b2. 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

pcapplusplus is an open-source library that provides a high-level interface for capturing, parsing, and analyzing network packets. It is commonly used in network monitoring and analysis tools. The library allows users to work with various network protocols and provides functionality for packet manipulation and analysis. However, a vulnerability has been discovered in the library that can lead to a heap-buffer-overflow when processing GREv1 packets.

Vulnerability Detail

The vulnerability in pcapplusplus arises from a heap-buffer-overflow in the computeCalculateFields function of the GREv1Layer class. This function is responsible for calculating and updating the fields of a GREv1 packet. Due to insufficient bounds checking, an attacker can craft a malicious packet that triggers a write overflow, potentially leading to arbitrary code execution or a denial-of-service condition. The vulnerability has been assigned a severity rating of HIGH.

How To Fix

Minimum fixed version

a0ecc6dad71f445c95936697c7ee15997d5761b2

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, users can implement additional input validation and bounds checking when processing GREv1 packets using pcapplusplus. By carefully validating the packet data and ensuring that it does not exceed the expected bounds, the risk of triggering the heap-buffer-overflow can be mitigated. Here is an example of how to perform input validation for GREv1 packets:

void processGREv1Packet(pcpp::Packet& packet) {
  pcpp::GREv1Layer* greLayer = packet.getLayerOfType<pcpp::GREv1Layer>();
  if (greLayer) {
    size_t expectedSize = sizeof(pcpp::gre_basic_header) + greLayer->getHeaderLen();
    if (packet.getRawPacket()->getRawDataLen() >= expectedSize) {
      // Process the packet
    }
  }
}

Conclusion

In conclusion, the vulnerability in pcapplusplus poses a significant risk to systems that utilize the library for network packet analysis. It is crucial for users to update to a fixed version of pcapplusplus and implement appropriate input validation to mitigate the risk. For further assistance and support in addressing this vulnerability, please contact DevNack.com.

See every vulnerability recorded for pcapplusplus →

Share this vulnerability

FAQ

pcapplusplus is an open-source library for capturing, parsing, and analyzing network packets. It provides a high-level interface for working with various network protocols.

A heap-buffer-overflow is a type of memory corruption vulnerability where a program writes data beyond the bounds of a heap-allocated buffer. This can lead to various security issues, including arbitrary code execution or denial-of-service.

The vulnerability in pcapplusplus can be exploited by an attacker to execute arbitrary code or cause a denial-of-service condition. This can potentially lead to unauthorized access, data breaches, or disruption of network services.

Yes, the vulnerability has been fixed in a commit with the hash a0ecc6dad71f445c95936697c7ee15997d5761b2 on the GitHub repository. Users should update their pcapplusplus dependency to a version that includes this fix.

Yes, users can implement additional input validation and bounds checking when processing GREv1 packets using pcapplusplus. By carefully validating the packet data, the risk of triggering the heap-buffer-overflow can be mitigated.

Related vulnerabilities

Recent vulnerabilities recorded for pcapplusplus.

How To Fix

Minimum fixed version

a0ecc6dad71f445c95936697c7ee15997d5761b2

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