🇰🇷 한글 설명
pgAdmin 4의 FileBackedSessionManager가 HMAC 무결성 검증 전에 세션 파일의 신뢰할 수 없는 데이터를 역직렬화하여 발생하는 취약점입니다. 인증된 사용자가 세션 디렉토리에 접근 가능하면 악의적인 직렬화 객체를 심어 pgAdmin 프로세스 권한으로 원격 코드 실행이 가능합니다. 수정은 역직렬화 전에 SHA-256 HMAC 검증을 추가하여 무결성을 보장합니다.
💡 쉬운 설명
pgAdmin 서버가 세션 파일을 확인 없이 자동 실행하므로, 누군가가 악의적인 코드를 세션 파일에 몰래 심으면 서버에서 실행됩니다. 파일 검증이 없는 것이 문제입니다.
🇺🇸 원문 (English)
Deserialization of untrusted data (CWE-502) in pgAdmin 4 FileBackedSessionManager.
The session manager performed unsafe deserialization of session-file contents (using Python's standard object-serialization module) before performing any HMAC integrity check. Any file dropped into the sessions directory was deserialized unconditionally. An authenticated user with write access to the sessions directory (whether by misconfiguration or in combination with another path-traversal flaw) could plant a crafted serialized payload to achieve operating-system level remote code execution under the pgAdmin process identity.
Fix prepends a 64-byte hex SHA-256 HMAC over the session body, computed with SECRET_KEY, and verifies it via hmac.compare_digest before any deserialization. The check is raised (rather than asserted) on empty SECRET_KEY so it is not stripped under -O.
This issue affects pgAdmin 4: before 9.15.
📍 영향받는 시스템
pgAdmin 4 버전 9.15 이전
⚔️ 공격 벡터
세션 디렉토리 쓰기 접근 권한을 가진 인증된 사용자가 Python pickle 직렬화 객체 삽입으로 RCE 달성
🛡️ 대응 방법
pgAdmin 4를 9.15 이상으로 업그레이드하여 HMAC 검증이 추가된 버전 설치
🔧 검증 코드
설치된 pgAdmin4 버전이 9.15 이상이면 패치됨, 그 이전 버전이면 취약
dpkg -l pgadmin4 2>/dev/null | awk '/pgadmin4/{print $3}' || pip show pgadmin4 2>/dev/null | grep Version