🇰🇷 한글 설명
Kysely(TypeScript SQL 쿼리 빌더) 0.28.11 이하 버전의 MySQL 및 SQLite 방언에서 SQL 인젝션 취약점이 발견되었습니다. `visitJSONPathLeg()` 함수가 `.key()`와 `.at()` 메서드의 입력값을 적절히 이스케이프 처리하지 않고 JSON 경로 문자열에 직접 삽입하여 임의의 SQL 실행이 가능합니다.
💡 쉬운 설명
데이터베이스에 요청을 보내는 도구의 보안 허점을 이용해 공격자가 가짜 명령어를 삽입할 수 있는 문제입니다. 이를 통해 데이터베이스 내의 민감한 정보가 유출되거나 조작될 위험이 있습니다.
🇺🇸 원문 (English)
Kysely is a type-safe TypeScript SQL query builder. Versions up to and including 0.28.11 has a SQL injection vulnerability in JSON path compilation for MySQL and SQLite dialects. The `visitJSONPathLeg()` function appends user-controlled values from `.key()` and `.at()` directly into single-quoted JSON path string literals (`'$.key'`) without escaping single quotes. An attacker can break out of the JSON path string context and inject arbitrary SQL. This is inconsistent with `sanitizeIdentifier()`, which properly doubles delimiter characters for identifiers — both are non-parameterizable SQL constructs requiring manual escaping, but only identifiers are protected. Version 0.28.12 fixes the issue.
📍 영향받는 시스템
Kysely v0.28.11 및 그 이전 버전 (MySQL 및 SQLite 사용 환경)
⚔️ 공격 벡터
JSON 경로 지정 메서드인 `.key()` 또는 `.at()`에 싱글 쿼테이션(') 등의 특수 문자를 입력하여 SQL 구문을 탈출하고 악의적인 쿼리를 주입함
🛡️ 대응 방법
Kysely 라이브러리를 0.28.12 버전 이상으로 업데이트하십시오.
🔧 검증 코드
출력된 버전 정보가 0.28.12보다 낮은 버전(예: 0.28.11)인 경우 취약한 상태입니다.
npm list kysely | grep -E 'kysely@'