🇰🇷 한글 설명
SQLBot 1.9.0 미만 버전에서 발생하는 취약점으로, 파일 업로드 시 조작된 파일명을 통해 임의의 파이썬 파일을 특정 디렉토리에 생성할 수 있습니다. 공격자가 악성 코드가 담긴 파일을 업로드하면, 시스템 재시작 또는 마이그레이션 과정에서 Alembic이 해당 파일을 실행하여 원격 코드 실행(RCE)이 가능해집니다.
💡 쉬운 설명
파일을 올릴 때 이름만 잘 속이면 서버에 몰래 악성 프로그램을 심을 수 있는 결함입니다. 서버가 다시 켜질 때 이 몰래 심은 프로그램이 자동으로 실행되어 해커가 서버를 장악할 수 있습니다.
🇺🇸 원문 (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/parseExcel endpoint in backend/apps/datasource/api/datasource.py uses attacker-controlled multipart filename data when selecting where uploaded content is stored, writes the content before spreadsheet parsing and validation finish, and can transform a double-extension filename into a Python source file. An attacker able to submit a crafted multipart upload can use these behaviors to place attacker-controlled content in /opt/sqlbot/app/alembic/versions/ even when a spreadsheet parsing failure after the file write causes the endpoint to return an error. The planted file remains on disk, and subsequent SQLBot startup or migration processing causes Alembic to import the module and execute its module-level statements in the SQLBot application runtime. This issue is fixed in version 1.9.0.
📍 영향받는 시스템
SQLBot 1.9.0 미만 모든 버전
⚔️ 공격 벡터
조작된 multipart 파일명을 이용한 /api/v1/datasource/parseExcel 엔드포인트 공격
🛡️ 대응 방법
SQLBot을 1.9.0 버전 이상으로 업데이트하십시오.
🔧 검증 코드
출력된 버전이 1.9.0 미만이면 취약한 상태이며, 1.9.0 이상이면 안전합니다.
python3 -c 'import sqlbot; print(sqlbot.__version__)' 2>/dev/null || echo 'version not found'