🇰🇷 한글 설명
ProxySQL 3.0.0부터 3.0.8 버전의 GenAI/MCP `run_sql_readonly` 도구가 읽기 전용 계약을 위반하는 취약점이 발견되었습니다. 공격자는 검증 로직의 허점을 이용해 읽기 전용 명령 뒤에 데이터 변경 명령을 결합하여 백엔드 데이터베이스에 쓰기 작업을 수행할 수 있습니다. 이로 인해 설정된 계정 권한 범위 내에서 데이터베이스 구조 변경이나 관리 명령 실행이 가능해집니다.
💡 쉬운 설명
읽기 전용 명령만 실행되어야 하는 기능에 몰래 수정 명령을 끼워 넣어 데이터베이스를 조작할 수 있는 보안 결함입니다. 마치 '읽기 전용'이라고 적힌 서류에 몰래 '삭제' 명령을 적어 넣어도 시스템이 그대로 실행해 버리는 것과 같습니다.
🇺🇸 원문 (English)
ProxySQL is a proxy for MySQL and its forks, as well as PostgreSQL. In versions 3.0.0 through 3.0.8, ProxySQL's GenAI/MCP `run_sql_readonly` tool violates its documented read-only contract for MySQL targets. The tool validates only the full input string with a substring blacklist and first-keyword allowlist, but then executes the entire SQL string on a backend connection created with `CLIENT_MULTI_STATEMENTS`. As a result, a caller can submit a read-only first statement followed by a side-effecting second statement, such as `SELECT 1; RENAME TABLE ...`. The validator accepts the payload because it starts with `SELECT` and because side-effecting MySQL statements such as `RENAME TABLE`, `SET`, `RESET`, `LOCK TABLES`, and `KILL` are not rejected by the blacklist. In a live MCP runtime test, the `/mcp/query` endpoint accepted a `run_sql_readonly` request. The MCP response reported success for the first `SELECT`, and direct backend verification showed that the table had actually been renamed. This violates the endpoint's read-only security contract and lets an MCP caller perform backend writes or administrative SQL, limited by the configured MCP target account's database privileges. Version 3.0.9 contains a fix. Other operator mitigations include: keeping MCP disabled unless required; setting a non-empty `mcp-query_endpoint_auth` token before exposing `/mcp/query`; restricting MCP listener network exposure; configuring MCP backend target credentials as database-level read-only users; and adding temporary MCP query rules to block obvious multi-statement patterns.
📍 영향받는 시스템
ProxySQL versions 3.0.0 through 3.0.8
⚔️ 공격 벡터
다중 문 SQL 주입(Multi-statement SQL Injection)을 통해 읽기 명령 뒤에 데이터 변경 명령을 결합하여 전송
🛡️ 대응 방법
ProxySQL을 3.0.9 버전 이상으로 업데이트하거나, MCP 기능을 비활성화하고 백엔드 계정을 읽기 전용으로 제한하십시오.
🔧 검증 코드
명령어 결과에 3.0.0에서 3.0.8 사이의 버전이 출력되면 취약한 버전이 설치된 상태입니다.
dpkg -l | grep proxysql 2>/dev/null | awk '{print $3}' | grep -E '^3\.0\.[0-8]$'