🇰🇷 한글 설명
pgAdmin 4에서 PostgreSQL의 식별자에 포함될 수 있는 작은따옴표(')를 적절히 처리하지 못해 발생하는 SQL 인젝션 취약점입니다. 권한이 낮은 사용자가 특수 문자가 포함된 객체 이름을 생성하면, 관리자가 해당 객체의 통계나 종속성을 조회할 때 임의의 SQL 명령이 실행될 수 있습니다.
💡 쉬운 설명
공격자가 이름에 특수 기호를 넣은 테이블을 만들면, 관리자가 그 테이블 정보를 클릭하는 순간 공격자가 숨겨둔 악성 명령이 실행될 수 있습니다. 이는 관리자의 권한을 탈취하거나 데이터베이스를 조작하는 데 악용될 수 있습니다.
🇺🇸 원문 (English)
The fix for CVE-2026-12044 in pgAdmin 4 9.16 hardened qtLiteral and switched sixteen COMMENT ON / pgstattuple / pgstatindex templates to it, but missed several sinks that had been placed in test_sql_string_literal_lint.py's ALLOWLIST on the incorrect assumption that schema, table, publication, and subscription names sourced from pg_catalog via the browser tree could never contain an apostrophe. PostgreSQL permits arbitrary characters in quoted identifiers, so a low-privileged user able to CREATE TABLE, CREATE PUBLICATION, or CREATE SUBSCRIPTION can plant an apostrophe'd object name that breaks out of the unescaped '{{ name }}' template interpolation the moment any user (including a higher-privileged one) opens that object's Statistics or Dependencies tab, allowing arbitrary SQL statement injection in the viewing user's database session.
Affected sinks: the Index Statistics query for all-indexes listing (coll_stats.sql, both the 16_plus and default PostgreSQL-version template variants -- distinct from the single-index stats.sql path already fixed in CVE-2026-12044), and the publication and subscription dependencies.sql / get_position.sql templates (both the pg and ppas/EPAS dialect variants for publications).
Fix switches all of these templates to qtLiteral(conn) for name interpolation, and updates publications/__init__.py and subscriptions/__init__.py to pass conn=self.conn into the dependencies.sql render_template call so the qtLiteral filter has a connection to quote against. The corresponding ALLOWLIST entries in test_sql_string_literal_lint.py are removed now that these sinks are properly escaped rather than merely assumed safe. A behavioral regression test renders each fixed template with a stacked-statement apostrophe payload and asserts both that the object name appears exactly as qtLiteral-escaped and that the rendered SQL parses as exactly one statement, verifying the assertion genuinely fails against the pre-patch raw-interpolation form.
This issue affects pgAdmin 4: the Index Statistics sink from 1.0, and the Publications/Subscriptions sinks from 5.0, both before 9.17.
📍 영향받는 시스템
pgAdmin 4: Index Statistics (1.0 이상), Publications/Subscriptions (5.0 이상) 버전 중 9.17 미만 버전
⚔️ 공격 벡터
저권한 사용자가 작은따옴표가 포함된 이름의 테이블, 발행(Publication) 또는 구독(Subscription)을 생성하여 관리자의 조회 동작을 유도함
🛡️ 대응 방법
pgAdmin 4를 최신 버전인 9.17 이상으로 업데이트하여 모든 템플릿에 qtLiteral 필터가 적용되도록 조치해야 합니다.
🔧 검증 코드
출력된 버전이 9.17 미만(예: 9.16 이하)인 경우 해당 취약점에 노출된 상태입니다.
pip show pgadmin4 2>/dev/null | grep Version || python3 -c 'import pgadmin4; print(pgadmin4.__version__)' 2>/dev/null | grep -E '^([0-9]+\.[0-9]+)?(9\.[0-1][0-6])$'