VAITP Dataset

← Back to the dataset

CVE-2026-53554

File write via crafted upload leads to code execution on SQLBot startup.

  • CVSS 7.3
  • 22
  • Input Validation and Sanitization
  • Remote

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.

CWE
22
CVSS base score
7.3
Published
2026-09-17
OWASP
A08 Software and Data Integrity Failures
Orthogonal defect classification
Checking
Code defect classification
Missing Check
Category
Input Validation and Sanitization
Subcategory
Path Traversal
Accessibility scope
Remote
Impact
Arbitrary Code Execution
Affected component
SQLBot

Solution

Upgrade SQLBot to version 1.9.0 or newer.

Vulnerable code sample

import os
from fastapi import APIRouter, UploadFile, HTTPException

router = APIRouter()
UPLOAD_ROOT = "/opt/sqlbot/tmp/uploads"

@router.post("/api/v1/datasource/parseExcel")
async def parse_excel(file: UploadFile):
    # VULNERABLE: uses attacker-controlled filename for storage path
    dest_path = os.path.join(UPLOAD_ROOT, file.filename)
    try:
        with open(dest_path, "wb") as out_file:
            while content := await file.read(1024):
                out_file.write(content)
    except Exception as e:
        raise HTTPException(status_code=500, detail="Failed to store file")
    return {"status": "uploaded"}

Patched code sample

import os
from fastapi import APIRouter, UploadFile, HTTPException

router = APIRouter()
UPLOAD_ROOT = "/opt/sqlbot/tmp/uploads"
ALLOWED_EXT = ".xlsx"

@router.post("/api/v1/datasource/parseExcel")
async def parse_excel(file: UploadFile):
    # FIX: sanitize filename and enforce allowed extension
    safe_name = os.path.basename(file.filename)
    if not safe_name.lower().endswith(ALLOWED_EXT):
        raise HTTPException(status_code=400, detail="Invalid file type")
    dest_path = os.path.join(UPLOAD_ROOT, safe_name)
    try:
        with open(dest_path, "wb") as out_file:
            while content := await file.read(1024):
                out_file.write(content)
    except Exception as e:
        raise HTTPException(status_code=500, detail="Failed to store file")
    return {"status": "uploaded"}

Payload

__VAITP_MODEL_REFUSED__

Cite this entry

@misc{vaitp:cve202653554,
  title        = {{File write via crafted upload leads to code execution on SQLBot startup.}},
  author       = {Bogaerts, Fr\'ed\'eric and Ivaki, Naghmeh and Fonseca, Jos\'e},
  year         = {2026},
  note         = {VAITP Python Vulnerability Dataset, entry CVE-2026-53554},
  howpublished = {\url{https://netpack.pt/vaitp/vulnerability/CVE-2026-53554/}}
}
Introducing the "VAITP dataset": a specialized repository of Python vulnerabilities and patches, meticulously compiled for the use of the security research community. As Python's prominence grows, understanding and addressing potential security vulnerabilities become crucial. Crafted by and for the cybersecurity community, this dataset offers a valuable resource for researchers, analysts, and developers to analyze and mitigate the security risks associated with Python. Through the comprehensive exploration of vulnerabilities and corresponding patches, the VAITP dataset fosters a safer and more resilient Python ecosystem, encouraging collaborative advancements in programming security.

The supreme art of war is to subdue the enemy without fighting.

Sun Tzu – “The Art of War”

:: Shaping the future through research and ingenuity ::