Skip to content

SQL sanitizer exposes string literals after quotes in block comments or backslash-escaped quotes

Moderate
trask published GHSA-9pmw-7q9q-j3jc Oct 28, 2026

Package

maven io.opentelemetry.instrumentation:opentelemetry-instrumentation-api-incubator (Maven)

Affected versions

< 2.33.0-alpha

Patched versions

2.33.0-alpha
maven io.opentelemetry.javaagent:opentelemetry-javaagent (Maven)
< 2.33.0
2.33.0

Description

Summary

The SQL sanitizer that produces db.statement and db.query.text can misread block comments and backslash-escaped quotes. When it does, later string literals appear unsanitized in span attributes. Passwords or other secrets written directly into SQL can then reach observability backends even with query sanitization enabled.

Impact

Affected: the Java agent, and SQL client library instrumentations (including JDBC) that use the shared SQL analyzer in io.opentelemetry.instrumentation:opentelemetry-instrumentation-api-incubator. Both the default and the database stable semantic convention modes are affected.

This is the same class of information disclosure as GHSA-rwqx-fvqh-6wm4.

Patches

Upgrade the Java agent to 2.33.0 or later. For library instrumentation, upgrade to a release that uses opentelemetry-instrumentation-api-incubator 2.33.0-alpha or later.

With the fix, quotes and -- markers inside block comments no longer hide where the comment ends. Quoted values that open and close inside a comment are still sanitized. When nested comments or backslash escaping make the boundaries ambiguous, the sanitizer replaces the rest of the query with ? and skips extracting the query summary and target.

The fix was merged in #20818 and backported to the 2.x release line in #20864.

Details

Quotes and comment markers inside block comments

SELECT name FROM users /* don't cache */ WHERE password = 'hunter2'
  • Vulnerable db.query.text: SELECT name FROM users /* don?hunter2'
  • Patched db.query.text: SELECT name FROM users /* don't cache */ WHERE password = ?

The vulnerable sanitizer treats the apostrophe in don't as the start of a string literal that ends at the opening quote of 'hunter2'. It replaces that span with ? and leaves hunter2 in the output. Other quote characters, -- markers, and nested block comments inside a block comment can expose later literals the same way.

Backslash-escaped quotes

SELECT name FROM users WHERE name = 'O\'Brien' AND password = 'hunter2'
  • Vulnerable db.query.text: SELECT name FROM users WHERE name = ?Brien?hunter2'
  • Patched db.query.text: SELECT name FROM users WHERE name = ?

The vulnerable sanitizer recognizes doubled single quotes ('') as escapes, but not backslash-escaped quotes (\'). MySQL and MariaDB accept \' under their default sql_mode, and PostgreSQL accepts it in E'...' strings. Whether \' is an escape depends on the database and its settings, so the patched sanitizer replaces everything from that literal onward with ?.

Mitigation and previously exported data

Use parameterized SQL with bound values instead of writing secrets directly into query text. Don't rely on query sanitization alone to protect secrets.

Upgrading does not remove values that were already exported. Check retained telemetry for exposed values, restrict access to it or delete it as needed, and rotate any exposed credentials.

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
Network
Attack complexity
Low
Privileges required
Low
User interaction
None
Scope
Unchanged
Confidentiality
High
Integrity
None
Availability
None

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:N/AC:L/PR:L/UI:N/S:U/C:H/I:N/A:N

CVE ID

No known CVE

Weaknesses

Insertion of Sensitive Information into Log File

The product writes sensitive information to a log file. Learn more on MITRE.

Credits