🇰🇷 한글 설명
Langroid 프레임워크의 SQLChatAgent에서 사용하는 SQL 패턴 차단 목록이 불완전하여 발생하는 보안 취약점입니다. 공격자가 특정 PostgreSQL 함수나 SQL Server/SQLite 명령어를 사용하여 데이터베이스 서버의 임의 파일을 읽을 수 있습니다. 이 취약점은 0.64.0 미만 버전에서 발생합니다.
💡 쉬운 설명
AI가 SQL 명령어를 생성할 때 위험한 단어를 걸러내는 필터가 완벽하지 않아 발생하는 문제입니다. 이를 통해 해커가 AI를 속여 서버에 저장된 중요한 파일을 몰래 훔쳐볼 수 있습니다.
🇺🇸 원문 (English)
Langroid is a framework for building large-language-model-powered applications. Prior to version 0.64.0, `SQLChatAgent` in `langroid` ships a `_validate_query` defense-in-depth layer whose `_DANGEROUS_SQL_PATTERNS` regex blocklist enumerates dangerous SQL primitives by specific function name. The list misses the canonical PostgreSQL filesystem-disclosure family `pg_read_file()`, `pg_stat_file()`, `pg_ls_logdir()`, `pg_ls_waldir()`, `pg_current_logfile()` (and similar `SELECT`-shaped functions in the same family). It also leaves SQL Server `OPENDATASOURCE` and SQLite `ATTACH '<file>' AS x` (DATABASE keyword omitted) unblocked. An attacker able to shape the LLM's generated SQL (directly via prompt input or transitively via prompt-injection in data the LLM ingests) can read arbitrary files from the PostgreSQL host through ordinary `SELECT` queries, even with the agent's strict default configuration (`allow_dangerous_operations=False`, `allowed_statement_types=['SELECT']`). The payloads survive the statement-type allowlist (each is a `SELECT`) and pass through the regex blocklist (none of the function names match), then reach the live SQLAlchemy engine via `SQLChatAgent.run_query`. Version 0.64.0 contains a patch for the issue.
📍 영향받는 시스템
Langroid framework version < 0.64.0
⚔️ 공격 벡터
프롬프트 주입(Prompt Injection)을 통해 AI가 특정 파일 읽기 함수가 포함된 SELECT 문을 생성하도록 유도
🛡️ 대응 방법
Langroid 프레임워크를 0.64.0 이상의 최신 버전으로 업데이트하십시오.
🔧 검증 코드
출력된 버전이 0.64.0 미만이면 취약한 상태이며, 0.64.0 이상이면 안전합니다.
pip show langroid | grep Version
💻 영향받는 소프트웨어
IBM WebSphere Application Server