Skip to content

Malformed unicode header values may throw uncaught exception

Moderate
bm1549 published GHSA-rf3p-mg22-qv6w Jun 27, 2024

Package

dd-trace-cpp

Affected versions

v0.1.12, v0.2.0, v0.2.1

Patched versions

v0.2.2

Description

Summary

When the dd-trace-cpp library fails to extract trace context due to malformed unicode, the library attempts to log the list of audited headers and their values using the nlohmann JSON library. This attempted logging may throw an uncaught exception.

Details

The code that introduced this logging was added in pull request #72 and has been present in versions v0.1.12, v0.2.0, and v0.2.1.

For each key and value in the list of audited headers, a nlohmann::json instance is created as follows:

stream << nlohmann::json(it->first + ": " + it->second);

Here, it->first is the header name and it->second is the value. This code is problematic for several reasons:

  • An exception can be thrown by the JSON library while parsing the input.
  • An exception can be thrown by the implicit call to dump().

Impact

This impacts any downstream applications that rely on dd-trace-cpp for tracing.

Patches

This vulnerability has been patched in dd-trace-cpp version v0.2.2 (#132)

Workarounds

  • Filter out header values that are not valid UTF-8 strings

Severity

Moderate

CVSS overall score

This score calculates overall vulnerability severity from 0 to 10 and is based on the Common Vulnerability Scoring System (CVSS).
/ 10

CVSS v3 base metrics

Attack vector
Local
Attack complexity
Low
Privileges required
None
User interaction
None
Scope
Unchanged
Confidentiality
None
Integrity
None
Availability
High

CVSS v3 base metrics

Attack vector: More severe the more the remote (logically and physically) an attacker can be in order to exploit the vulnerability.
Attack complexity: More severe for the least complex attacks.
Privileges required: More severe if no privileges are required.
User interaction: More severe when no user interaction is required.
Scope: More severe when a scope change occurs, e.g. one vulnerable component impacts resources in components beyond its security scope.
Confidentiality: More severe when loss of data confidentiality is highest, measuring the level of data access available to an unauthorized user.
Integrity: More severe when loss of data integrity is the highest, measuring the consequence of data modification possible by an unauthorized user.
Availability: More severe when the loss of impacted component availability is highest.
CVSS:3.1/AV:L/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H

CVE ID

CVE-2024-38525

Weaknesses

No CWEs

Credits