🇰🇷 한글 설명
pg_partman 5.5.0 미만 버전에서 pg_jobmon이 설치된 경우, 예외 처리 과정 중 SQL 인젝션 취약점이 발생합니다. 공격자가 테이블 이름에 싱글 쿼테이션을 포함시켜 악성 SQL을 주입하면, pg_partman_bgw의 슈퍼유저 권한으로 데이터베이스 전체 장악 및 운영체제 명령 실행이 가능합니다.
💡 쉬운 설명
데이터베이스 관리 도구의 허점을 이용해 악성 코드를 심는 공격입니다. 공격자가 특수하게 만든 테이블 이름을 만들면, 시스템이 이를 실행하는 과정에서 관리자 권한을 탈취당할 수 있습니다.
🇺🇸 원문 (English)
pg_partman is a PostgreSQL extension that manages partitioned tables by time or ID. Prior to 5.5.0, when pg_jobmon is installed and part_config.jobmon is true, exception handlers in multiple pg_partman functions place p_parent_table verbatim inside a SQL string literal used to call pg_jobmon.add_job(). A partman_user can create a parent-table name containing a single quote that terminates the literal and injects SQL when an affected exception path runs. If pg_partman_bgw reaches that path, the injected SQL 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 persistent part_config row can trigger the escalation again on later maintenance ticks. This issue is fixed in version 5.5.0.
📍 영향받는 시스템
pg_partman 5.5.0 미만 버전 (pg_jobmon 설치 및 part_config.jobmon이 true인 경우)
⚔️ 공격 벡터
싱글 쿼테이션을 포함한 악성 테이블 이름을 생성하여 예외 처리 경로를 통한 SQL 인젝션 수행
🛡️ 대응 방법
pg_partman을 5.5.0 버전 이상으로 업데이트하십시오.
🔧 검증 코드
출력된 버전 번호가 5.5.0 미만이면 취약한 상태입니다.
psql -c "SELECT extversion FROM pg_extension WHERE extname = 'pg_partman';" 2>/dev/null