🇰🇷 한글 설명
pg_partman 5.5.0 미만 버전에서 inherit_template_properties() 함수가 컬럼 이름 내의 큰따옴표를 적절히 이스케이프하지 않는 취약점이 발견되었습니다. 이를 통해 권한이 있는 사용자가 조작된 컬럼 이름을 생성하면, 백그라운드 워커가 실행될 때 SQL 인젝션이 발생하여 슈퍼유저 권한으로 데이터베이스 및 운영체제 명령을 실행할 수 있습니다.
💡 쉬운 설명
데이터베이스 관리 도구의 이름 처리 오류를 이용해 해커가 몰래 명령어를 심어두는 취약점입니다. 이 명령어가 실행되면 해커가 데이터베이스 전체를 장악하거나 컴퓨터를 마음대로 조종할 수 있습니다.
🇺🇸 원문 (English)
pg_partman is a PostgreSQL extension that manages partitioned tables by time or ID. Prior to 5.5.0, inherit_template_properties() manually surrounds primary-key column names from pg_attribute.attname with double quotes without escaping embedded double-quote characters. A partman_user who owns a template table can create a crafted column name that breaks out of the generated ALTER TABLE ADD PRIMARY KEY identifier when the background worker applies the key to a child partition. The generated SQL then executes with pg_partman_bgw.role privileges, which default to PostgreSQL superuser, permitting database-wide compromise and operating-system command execution as the PostgreSQL service account. The crafted catalog identifier persists until removed and can trigger again during later partition creation. This issue is fixed in version 5.5.0.
📍 영향받는 시스템
pg_partman version < 5.5.0
⚔️ 공격 벡터
조작된 컬럼 이름을 가진 템플릿 테이블을 생성하여 백그라운드 워커의 SQL 실행 권한을 탈취하는 SQL 인젝션 공격
🛡️ 대응 방법
pg_partman을 5.5.0 버전 이상으로 업데이트하십시오.
🔧 검증 코드
출력된 버전 번호가 5.5.0 미만이면 취약한 상태입니다.
psql -c "SELECT extversion FROM pg_extension WHERE extname = 'pg_partman';" 2>/dev/null