🇰🇷 한글 설명
SQLBot 1.9.0 미만 버전에서 발생하는 취약점으로, 인증된 사용자가 데이터소스 설정 시 조작된 table_name 값을 입력하여 SQL 인젝션을 수행할 수 있습니다. 이를 통해 PostgreSQL의 특수 함수를 호출하여 서버의 /etc/passwd와 같은 민감한 파일 내용을 탈취할 수 있으며, 내부 연결 시 슈퍼유저 권한으로 실행되는 결함이 있습니다.
💡 쉬운 설명
SQLBot이라는 프로그램의 설정 오류를 이용해 해커가 데이터베이스를 통해 서버 내부의 중요한 파일들을 몰래 읽어갈 수 있는 보안 약점입니다. 공격자는 이를 통해 시스템의 비밀번호나 설정 파일 등을 훔쳐볼 수 있습니다.
🇺🇸 원문 (English)
SQLBot is an intelligent Text-to-SQL system based on large language models and RAG. Prior to 1.9.0, the POST /api/v1/datasource/previewData endpoint in backend/apps/datasource/crud/datasource.py incorporates the client-controlled table_name value into generated SQL without safe identifier handling. An authenticated user can configure a datasource for SQLBot's internal PostgreSQL service and submit a crafted table_name that remains a SELECT operation under the read-only policy while invoking pg_read_file(), pg_read_binary_file(), or pg_ls_dir(). In the default tested trusted loopback authentication configuration, the internal connection accepts invalid credentials and executes with PostgreSQL superuser privileges, allowing filesystem content such as /etc/hosts and /etc/passwd to be returned in the previewData API response and potentially exposing configuration, credentials, authentication secrets, and source code. This issue is fixed in version 1.9.0.
📍 영향받는 시스템
SQLBot versions prior to 1.9.0
⚔️ 공격 벡터
인증된 사용자가 POST /api/v1/datasource/previewData 엔드포인트에 조작된 table_name 값을 전송하여 파일 읽기 함수 호출
🛡️ 대응 방법
SQLBot을 최신 버전인 1.9.0 이상으로 업데이트하십시오.
🔧 검증 코드
출력된 버전 번호가 1.9.0보다 낮으면 취약한 상태이며, 1.9.0 이상이면 안전합니다.
python3 -c 'import pkg_resources; print(pkg_resources.get_distribution("sqlbot").version)' 2>/dev/null || echo "not installed"