🇰🇷 한글 설명
Pydantic AI 웹 UI에서 경로 추적 취약점이 존재하여 공격자가任意의 자바스크립트를 서비스할 수 있는 취약점이 발견되었습니다. 이는 1.34.0부터 1.51.0 이전 버전에서 발생하며, CDN URL 생성 시 버전 쿼리 파라미터를 검증하지 않아 공격자가任意의 HTML/자바스크립트를 서비스할 수 있습니다.
💡 쉬운 설명
Pydantic AI의 웹 인터페이스에서 취약점이 발견되어 공격자가任意의 자바스크립트를 실행할 수 있습니다. 이는 사용자의 채팅 기록 및 클라이언트 측 데이터를 탈취할 수 있습니다. 이 취약점은 Agent.to_web 또는 clai web을 사용하여 채팅 인터페이스를 서비스하는 경우에만 영향을 미칩니다.
🇺🇸 원문 (English)
Pydantic AI is a Python agent framework for building applications and workflows with Generative AI. From 1.34.0 to before 1.51.0, a path traversal vulnerability in the Pydantic AI web UI allows an attacker to serve arbitrary JavaScript in the context of the application by crafting a malicious URL. In affected versions, the CDN URL is constructed using a version query parameter from the request URL. This parameter is not validated, allowing path traversal sequences that cause the server to fetch and serve attacker-controlled HTML/JavaScript from an arbitrary source on the same CDN, instead of the legitimate chat UI package. If a victim clicks the link or visits it via an iframe, attacker-controlled code executes in their browser, enabling theft of chat history and other client-side data. This vulnerability only affects applications that use Agent.to_web to serve a chat interface and clai web to serve a chat interface from the CLI. These are typically run locally (on localhost), but may also be deployed on a remote server. This vulnerability is fixed in 1.51.0.
📍 영향받는 시스템
Pydantic AI 1.34.0부터 1.51.0 이전 버전
⚔️ 공격 벡터
공격자는 악의적인 URL을 생성하여 사용자가 방문하거나 iframe을 통해 공격할 수 있습니다.
🛡️ 대응 방법
1.51.0 버전으로 업데이트하거나, CDN URL 생성 시 버전 쿼리 파라미터를 검증하여 취약점을 해결할 수 있습니다.
🔧 검증 코드
이 코드는 로컬 시스템의 Pydantic AI 버전을 확인하여 취약점 여부를 판단합니다. Python 3.x 환경에서 실행해야 하며, pkg_resources 모듈이 필요합니다.
import pkg_resources
version = pkg_resources.get_distribution('pydantic_ai').version
if version >= '1.51.0':
print({"result": "양호", "reason": "최신 버전입니다."})
else:
print({"result": "취약", "reason": "업데이트가 필요합니다."})