🇰🇷 한글 설명
Go용 PostgreSQL 드라이버인 pgx의 4.18.2 이전 버전에서 비기본 simple 프로토콜 사용 시 SQL injection이 발생할 수 있습니다. 마이너스 기호 다음 숫자 자리 표시자와 문자열 자리 표시자가 같은 라인에 있으면서 모두 사용자 제어 값일 때 공격 가능합니다.
💡 쉬운 설명
Go 애플리케이션의 데이터베이스 드라이버인 pgx에서 공격자가 SQL 쿼리를 조작하여 데이터베이스 접근을 제어할 수 있는 취약점입니다. 특정 조건에서만 발생하지만 발생하면 심각한 데이터 유출이나 조작이 가능합니다.
🇺🇸 원문 (English)
pgx is a PostgreSQL driver and toolkit for Go. Prior to version 4.18.2, SQL injection can occur when all of the following conditions are met: the non-default simple protocol is used; a placeholder for a numeric value must be immediately preceded by a minus; there must be a second placeholder for a string value after the first placeholder; both must be on the same line; and both parameter values must be user-controlled. The problem is resolved in v4.18.2. As a workaround, do not use the simple protocol or do not place a minus directly before a placeholder.
📍 영향받는 시스템
pgx < 4.18.2 (Go PostgreSQL driver)
⚔️ 공격 벡터
simple protocol 활성화 상태에서 특정 형식의 쿼리 문법을 이용한 SQL injection
🛡️ 대응 방법
pgx를 4.18.2 이상으로 업그레이드하거나 simple protocol 사용 비활성화
🔧 검증 코드
pgx 버전이 4.18.2 이상이면 안전, 미만이면 즉시 업그레이드 필요
go list -m all 2>/dev/null | grep pgx || cat go.mod 2>/dev/null | grep pgx