🇰🇷 한글 설명
pg_partman 5.5.0 미만 버전에서 특정 함수들이 part_config.time_dncoder 값을 식별자 인용 없이 동적 SQL에 삽입하여 발생하는 SQL 인젝션 취약점입니다. partman_user 권한을 가진 역할이 악성 SQL을 저장하면, 이후 유지보수 작업 시 슈퍼유저 권한으로 실행되어 데이터베이스 전체 장악 및 운영체제 명령 실행이 가능합니다.
💡 쉬운 설명
데이터베이스 관리 도구의 허점을 이용해 공격자가 몰래 악성 명령어를 심어둘 수 있는 보안 약점입니다. 이 명령어가 실행되면 해커가 데이터베이스의 모든 권한을 얻거나 컴퓨터를 직접 조종할 수도 있습니다.
🇺🇸 원문 (English)
pg_partman is a PostgreSQL extension that manages partitioned tables by time or ID. Prior to 5.5.0, run_maintenance(), show_partitions(), show_partition_info(), undo_partition(), and partition_data_time() interpolate the writable part_config.time_dncoder text value without identifier quoting into dynamic SQL. A role with the documented partman_user privileges can store SQL rather than a decoder function name. When an affected operation later uses the poisoned value, including pg_partman_bgw maintenance for a text- or UUID-keyed set, the SQL executes with the operation's privileges, which can be the default PostgreSQL superuser background-worker role. The persistent row can restore elevated access on later ticks, and successful exploitation can permit database-wide compromise and operating-system command execution as the PostgreSQL service account. This issue is fixed in version 5.5.0.
📍 영향받는 시스템
pg_partman version < 5.5.0
⚔️ 공격 벡터
partman_user 권한을 이용한 part_config.time_dncoder 테이블 내 악성 SQL 삽입 및 자동 유지보수 프로세스 유도
🛡️ 대응 방법
pg_partman를 최신 버전인 5.5.0 이상으로 업데이트하십시오.
🔧 검증 코드
출력된 버전 번호가 5.5.0 미만이면 취약한 상태이며, 5.5.0 이상이면 안전합니다.
psql -c "SELECT extversion FROM pg_extension WHERE extname = 'pg_partman';" 2>/dev/null