🇰🇷 한글 설명
SQLBot 1.9.0 미만 버전에서 인증된 사용자가 데이터소스 설정 시 악의적인 테이블 이름을 입력하여 2차 SQL 인젝션을 유발할 수 있습니다. 데이터소스 삭제 시 입력된 값이 SQL 쿼리에 삽입되어 실행되며, 이를 통해 PostgreSQL의 COPY TO PROGRAM 기능을 악용하여 컨테이너 내 OS 명령어를 실행할 수 있습니다.
💡 쉬운 설명
공격자가 데이터베이스 설정값에 특수 코드를 숨겨두었다가, 나중에 해당 설정을 삭제할 때 숨겨둔 코드가 실행되게 만드는 공격입니다. 이 공격이 성공하면 해커가 서버의 운영체제 명령어를 마음대로 실행할 수 있어 매우 위험합니다.
🇺🇸 원문 (English)
SQLBot is an intelligent Text-to-SQL system based on large language models and RAG. Prior to 1.9.0, an authenticated user can supply a crafted sheet["tableName"] value in the Excel datasource configuration submitted through POST /api/v1/datasource/, and SQLBot stores that value without safe identifier handling. When the same datasource is later removed through DELETE /api/v1/datasource/{id}, the stored value is interpolated into datasource cleanup SQL and executed by PostgreSQL. This second-order SQL injection can invoke PostgreSQL COPY TO PROGRAM and execute arbitrary operating-system commands with the privileges of the postgres process inside the SQLBot container. This issue is fixed in version 1.9.0.
📍 영향받는 시스템
SQLBot 1.9.0 미만 모든 버전
⚔️ 공격 벡터
인증된 사용자가 POST /api/v1/datasource/를 통해 악성 tableName 값을 입력한 후, DELETE /api/v1/datasource/{id}를 호출하여 2차 SQL 인젝션 유발
🛡️ 대응 방법
SQLBot을 1.9.0 이상의 최신 버전으로 업데이트하십시오.
🔧 검증 코드
출력 결과가 'Vulnerable'이면 취약한 버전이며, 아무것도 출력되지 않으면 안전한 버전입니다.
python3 -c 'import requests; r = requests.get("http://<target>/api/version"); print(r.json().get("version"))' 2>/dev/null | grep -E '^([0-9]+\.[0-9]+(\.[0-9]+)?)$' | awk -F. '{$1 < 1 || ($2 < 9) {print "Vulnerable"}}'