🔍 CVE-2026-12045

9.0
CVSS Score
CRITICAL
2026-06-19
2026-07-01 19:26
✅ 완료

🇰🇷 한글 설명

pgAdmin 4 AI Assistant의 읽기 전용 트랜잭션 우회 취약점으로, 공격자가 데이터베이스 콘텐츠를 조작하여 AI가 생성하는 SQL에 다중 문장을 삽입할 수 있습니다. 이를 통해 공격자는 읽기 전용 제한을 무력화하고 사용자 권한으로 임의의 SQL을 실행하거나, 슈퍼유저 권한일 경우 원격 코드 실행(RCE)까지 가능합니다.

💡 쉬운 설명

AI 비서가 데이터베이스를 읽을 때, 데이터 속에 숨겨진 악성 명령어를 읽어 들여 실수로 데이터를 삭제하거나 수정할 수 있는 문제입니다. 특히 관리자 권한을 가진 사용자가 이 기능을 쓰면 해커가 서버 전체를 장악할 수도 있습니다.

🇺🇸 원문 (English)

Read-only transaction bypass in the pgAdmin 4 AI Assistant allows an attacker who can influence database content that the assistant reads to execute arbitrary SQL with the privileges of the pgAdmin user's database role. The AI Assistant's execute_sql_query tool runs LLM-generated SQL inside a BEGIN TRANSACTION READ ONLY wrapper to prevent data modification. The LLM-supplied query was forwarded to the database driver without restriction to a single statement or to read-only verbs, so a multi-statement payload beginning with COMMIT, END, ROLLBACK, or ABORT terminated the read-only transaction and ran subsequent statements in autocommit mode. The trailing ROLLBACK then had no effect. Delivery is via prompt injection: an attacker who can write content into any object the AI Assistant may inspect (a row, a column value, a comment) can cause the LLM to emit the multi-statement payload as a tool call. With ordinary write privileges on the pgAdmin user's role the attacker can perform unauthorised data modification. When the pgAdmin user's role is a PostgreSQL superuser or holds pg_execute_server_program, the chain extends to remote code execution on the database server host via COPY ... TO PROGRAM. Fix validates the LLM-supplied query up front: it must parse to exactly one non-empty / non-comment statement whose leading real token (after stripping whitespace, comments, and punctuation) is one of SELECT, WITH, EXPLAIN, SHOW, VALUES, or TABLE. Transaction-control verbs, DML, DDL, CALL, COPY, DO, SET/RESET, and everything else are rejected before any database work happens. PostgreSQL's READ ONLY mode continues to backstop data-modifying CTEs, EXPLAIN ANALYZE on writes, and volatile side effects. This issue affects pgAdmin 4: from 9.13 before 9.16.

📍 영향받는 시스템

pgAdmin 4: 9.13 버전부터 9.16 미만 버전

⚔️ 공격 벡터

프롬프트 인젝션 (AI가 검사하는 데이터베이스 내 행, 열, 주석 등에 악성 SQL 페이로드 삽입)

🛡️ 대응 방법

pgAdmin 4를 9.16 이상의 최신 버전으로 업데이트하여 SQL 구문 검증 로직을 적용하십시오.

🔧 검증 코드

출력된 버전이 9.16 미만(예: 9.15.x)이면 취약한 상태이며, 9.16 이상이어야 안전합니다.

Shell / Script
pip show pgadmin4 2>/dev/null | grep Version || echo 'Not installed via pip'

📊 CVSS Vector String

CVSS Vector
CVSS:3.1/AV:N/AC:L/PR:L/UI:R/S:C/C:H/I:H/A:H

💻 영향받는 소프트웨어

PostgreSQL