🇰🇷 한글 설명
pgAdmin 4의 Import/Export Data 도구에서 사용자 쿼리 내 큰따옴표 식별자를 잘못 파싱하여 검사를 우회할 수 있는 취약점이 발견되었습니다. 이를 통해 psql이 pgAdmin 호스트에서 운영체제 명령(TO PROGRAM)을 실행할 수 있으며, 이는 CVE-2026-17566 수정의 우회입니다.
💡 쉬운 설명
데이터 내보내기 기능의 입력 검사를 교묘하게 피해서 pgAdmin이 실행 중인 서버에서 명령을 실행할 수 있습니다. 일반 데이터베이스 사용자도 공격할 수 있어 위험도가 매우 높습니다.
🇺🇸 원문 (English)
pgAdmin 4's Import/Export Data tool wraps a user's query export in a psql \copy (...) TO command and checks that the query's parentheses are balanced so that nothing can escape the wrapper. The check rejected a backslash inside a single-quoted string, but not inside a double-quoted identifier, where it treated the next double quote as closing the identifier. psql's \copy parser applies the connection's escape character to whichever quote opened a token, so with standard_conforming_strings off a backslash-escaped double quote does not close the identifier. pgAdmin's and psql's view of the quoting then diverged, a closing parenthesis hidden from the check ended the \copy (...) wrapper, and a following TO PROGRAM clause was executed by psql on the pgAdmin host, as the operating-system account running pgAdmin, before the server rejected the statement. An ordinary database role can turn standard_conforming_strings off for itself, and the Import/Export Data permission is granted to non-administrators by default.
This is a bypass of the fix for CVE-2026-17566. The fix rejects any backslash inside a double-quoted identifier, as was already done for single-quoted strings, since its meaning depends on a server setting that cannot be known reliably when the query is validated.
This issue affects pgAdmin 4: before 9.19.
📍 영향받는 시스템
pgAdmin 4 9.19 미만 버전
⚔️ 공격 벡터
일반 DB 권한을 가진 사용자가 standard_conforming_strings를 끄고 큰따옴표 식별자에 백슬래시 이스케이프를 넣어 검사를 우회한 뒤 TO PROGRAM 구문으로 pgAdmin 호스트에서 OS 명령을 실행
🛡️ 대응 방법
pgAdmin 4를 9.19 이상으로 업데이트
🔧 검증 코드
출력된 버전이 9.19 미만이면 취약하므로 9.19 이상으로 업데이트해야 하며, 9.19 이상이면 패치가 적용된 것입니다.
pgadmin4 --version 2>/dev/null || dpkg -l pgadmin4 2>/dev/null | grep pgadmin4 || rpm -q pgadmin4 2>/dev/null