/

CVE-2026-39196

Severity:

CRITICAL RISK

(9.8)

SQL Injection (CWE-89) in Datadog Vector Query Logic

CVE-2026-39196

Deferred

Vulnerability type

Category:

SQL Injection

CWE:

CWE-89

Impact:

Unauthorized Database Access and Data Exposure

Severity:

CRITICAL RISK

(9.8)

CVSS version:

3.1

Catch this CVE while code is being written

Detect vulnerable code directly in pull requests, so CVEs are fixed before merge.

Summary

Datadog Vector v0.54.0 contains a SQL injection vulnerability in how the set_uri_query parameter is handled within the KeyPartitioner::partition function.

By crafting malicious SQL fragments in this parameter, an attacker may gain unauthorized access to sensitive database information when Vector constructs and executes queries.

Affected context

The vulnerability appears in deployments of Datadog Vector v0.54.0 where the KeyPartitioner::partition function is used to build or route SQL queries based on incoming parameters.

Environments that pass user-controlled or externally sourced values into set_uri_query without robust validation or parameterization are more exposed, particularly when Vector is configured to interact directly with relational databases.

Exploit preconditions

  • Attack surface: Interfaces or data pipelines feeding set_uri_query into Vector's KeyPartitioner::partition function.
  • Required access: Ability to influence or control the set_uri_query value (e.g., via upstream services, configuration, or API parameters).
  • Trigger point: Execution of SQL statements composed using the set_uri_query parameter, typically when Vector processes events or routes data involving database operations.
  • Why exploitation is possible: The set_uri_query value is incorporated into SQL statements without proper parameterization or escaping, enabling crafted input to alter query structure and behavior.

Why this happens

This issue arises from constructing SQL queries by concatenating or interpolating raw input from set_uri_query into the query string.

Instead of using prepared statements or query parameterization, the implementation appears to treat the parameter as trusted, allowing attacker-controlled data to become part of the executable SQL.

This pattern maps directly to CWE-89: Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection'), where untrusted input is mishandled in database queries.

Potential impact

  • Access to sensitive database records that the application or service account can read.
  • Extraction of authentication data, configuration details, or telemetry stored in the database.
  • Modification or deletion of database data if the execution context has write permissions.
  • Potential lateral movement through database-linked systems, depending on stored procedures or additional logic.
  • Denial of service by injecting queries that lock tables, exhaust resources, or cause errors.

General mitigation guidance

Effective mitigation focuses on minimizing trust in query inputs and enforcing safe query construction patterns:

  • Employ parameterized queries or prepared statements for all database interactions, ensuring that data values are never concatenated into SQL logic.
  • Introduce strict validation and normalization of URI query parameters, including whitelisting of allowed keys and values.
  • Apply clear separation between query structure and data, avoiding dynamic construction of SQL based on externally sourced parameters whenever possible.
  • Constrain database privileges so that the account used by Vector has only the minimal permissions required (e.g., read-only for logging or metrics pipelines).
  • Centralize query-building utilities or abstractions to enforce consistent, safe patterns across all database-related code paths.

How teams detect issues like this

Detection can leverage a mix of code-level analysis and runtime monitoring:

  • Use static analysis or linters configured with rules to flag direct string concatenation or interpolation involving SQL statements and external inputs such as set_uri_query.
  • During code review, look for any query-building logic in or around KeyPartitioner::partition that does not rely on prepared statements or parameter binding.
  • Implement database query logging and monitoring to identify anomalous or unexpectedly complex queries, particularly those reflecting user-supplied parameters or URI query strings.
  • Enforce security coding guidelines that require defensive patterns for query construction, with automated checks in CI pipelines to prevent regressions.

Sources

SourceLink
gist.github.comgist.github.com/pyuysig/423b15c69e3cd851c1e24c1312a0551a

Frequently asked

questions

It can be, if an attacker can control or influence the set_uri_query parameter via a network-accessible interface or upstream service that feeds Vector. The exploitability depends on how Vector is integrated and where this parameter originates.

An attacker needs the ability to supply or manipulate the data that becomes the set_uri_query value. This might involve access to an API, configuration endpoint, or another system that forwards user-controlled parameters into Vector.

The safest fix is to ensure all database interactions use parameterized queries or prepared statements, never concatenating or interpolating raw input into SQL. Any dynamic elements should be constrained to well-defined, validated choices rather than free-form text.

Establish secure coding standards for database access, mandate parameterized queries, and integrate automated checks to flag unsafe query construction. Combine this with rigorous input validation, minimal database privileges, and regular security-focused code reviews around data ingestion and routing components.

Find out what's already
exploitable in your codebase.