🇰🇷 한글 설명
LangChain의 f-string 프롬프트 템플릿 검증 로직이 불완전하여 발생하는 취약점입니다. DictPromptTemplate 및 ImagePromptTemplate에서 속성 접근이나 인덱싱 표현식을 제한 없이 평가할 수 있으며, 포맷 지정자 내의 중첩된 교체 필드 검증이 누락되어 의도하지 않은 표현식이 실행될 수 있습니다.
💡 쉬운 설명
사용자가 입력한 템플릿 문구 속에 숨겨진 특수 명령어가 시스템에서 실행될 수 있는 문제입니다. 이를 통해 공격자가 내부 데이터에 접근하거나 비정상적인 동작을 유발할 수 있습니다.
🇺🇸 원문 (English)
LangChain is a framework for building agents and LLM-powered applications. Prior to 0.3.84 and 1.2.28, LangChain's f-string prompt-template validation was incomplete in two respects. First, some prompt template classes accepted f-string templates and formatted them without enforcing the same attribute-access validation as PromptTemplate. In particular, DictPromptTemplate and ImagePromptTemplate could accept templates containing attribute access or indexing expressions and subsequently evaluate those expressions during formatting. Second, f-string validation based on parsed top-level field names did not reject nested replacement fields inside format specifiers. In this pattern, the nested replacement field appears in the format specifier rather than in the top-level field name. As a result, earlier validation based on parsed field names did not reject the template even though Python formatting would still attempt to resolve the nested expression at runtime. This vulnerability is fixed in 0.3.84 and 1.2.28.
📍 영향받는 시스템
LangChain 0.3.84 미만 및 1.2.28 미만 버전
⚔️ 공격 벡터
조작된 f-string 템플릿을 주입하여 속성 접근이나 중첩된 표현식을 실행하도록 유도
🛡️ 대응 방법
LangChain 패키지를 0.3.84 또는 1.2.28 이상의 최신 버전으로 업데이트
🔧 검증 코드
출력된 버전이 0.3.84 미만 또는 1.2.28 미만일 경우 업데이트가 필요합니다.
pip show langchain | grep -E 'Version: [0-9.]+'