🇰🇷 한글 설명
PostgreSQL의 libpq 함수(PQescapeLiteral, PQescapeIdentifier 등)에서 따옴표 구문이 제대로 무효화되지 않아 SQL injection이 발생합니다. 특히 함수 결과를 psql에 입력으로 사용하거나 BIG5/EUC_TW 인코딩 조합에서 취약합니다. PostgreSQL 13.19, 14.16, 15.11, 16.7, 17.3 미만 버전이 영향받습니다.
💡 쉬운 설명
PostgreSQL 프로그램의 특수문자 처리 함수가 안전하지 않아 악의적인 데이터베이스 명령어 실행이 가능합니다. 특정 문자 인코딩 환경에서 더 위험합니다.
🇺🇸 원문 (English)
Improper neutralization of quoting syntax in PostgreSQL libpq functions PQescapeLiteral(), PQescapeIdentifier(), PQescapeString(), and PQescapeStringConn() allows a database input provider to achieve SQL injection in certain usage patterns. Specifically, SQL injection requires the application to use the function result to construct input to psql, the PostgreSQL interactive terminal. Similarly, improper neutralization of quoting syntax in PostgreSQL command line utility programs allows a source of command line arguments to achieve SQL injection when client_encoding is BIG5 and server_encoding is one of EUC_TW or MULE_INTERNAL. Versions before PostgreSQL 17.3, 16.7, 15.11, 14.16, and 13.19 are affected.
📍 영향받는 시스템
PostgreSQL 13.x(~13.18), 14.x(~14.15), 15.x(~15.10), 16.x(~16.6), 17.x(~17.2)
⚔️ 공격 벡터
데이터베이스 입력 제공자가 libpq 함수 출력을 psql에 입력으로 전달하거나 BIG5/EUC_TW 환경에서 명령행 인자 조작으로 SQL injection 실행
🛡️ 대응 방법
PostgreSQL을 13.19, 14.16, 15.11, 16.7 또는 17.3 이상으로 업그레이드
🔧 검증 코드
반환된 버전 번호가 각 주 버전의 최소 요구 버전 이상인지 확인하세요(13.19+, 14.16+, 15.11+, 16.7+, 17.3+).
psql --version | grep -oE '[0-9]+\.[0-9]+' || postgres --version