🇰🇷 한글 설명
NiceGUI는 Python 기반의 UI 프레임워크입니다. 3.7.0 이전 버전의 NiceGUI에서 FileUpload.name 속성이 클라이언트에서 제공한 파일 이름 메타데이터를 제한 없이 노출하여, 개발자가 UPLOAD_DIR / file.name 패턴을 사용할 때 경로 조작이 가능합니다. 악의적인 파일 이름에 ../ 시퀀스가 포함되어 있으면 공격자가 의도하지 않은 디렉토리에 파일을 작성할 수 있으며, 취약한 배포 패턴에서는 원격 코드 실행이 가능할 수 있습니다.
💡 쉬운 설명
NiceGUI에서 파일 업로드 시 파일 이름을 제한 없이 사용하여 경로 조작이 가능해집니다. 이는 원격 코드 실행 등의 심각한 공격으로 이어질 수 있습니다. 파일 이름에 대한 제한이 없으면 공격자가 시스템의 다른 부분에 파일을 작성할 수 있습니다.
🇺🇸 원문 (English)
NiceGUI is a Python-based UI framework. Prior to 3.7.0, NiceGUI's FileUpload.name property exposes client-supplied filename metadata without sanitization, enabling path traversal when developers use the pattern UPLOAD_DIR / file.name. Malicious filenames containing ../ sequences allow attackers to write files outside intended directories, with potential for remote code execution through application file overwrites in vulnerable deployment patterns. This design creates a prevalent security footgun affecting applications following common community patterns. Note: Exploitation requires application code incorporating file.name into filesystem paths without sanitization. Applications using fixed paths, generated filenames, or explicit sanitization are not affected. This vulnerability is fixed in 3.7.0.
📍 영향받는 시스템
NiceGUI 3.7.0 이전 버전
⚔️ 공격 벡터
파일 업로드 시 악의적인 파일 이름을 사용하여 경로 조작
🛡️ 대응 방법
NiceGUI 3.7.0 이상 버전으로 업데이트하거나, 파일 이름에 대한 제한과 검증을 추가합니다.
🔧 검증 코드
이 코드는 로컬 시스템에 NiceGUI가 설치되어 있는지 확인하고, 설치된 버전을 확인하여 취약점 여부를 판단합니다. Python이 설치되어 있고, nicegui 패키지를 설치한 후에 이 코드를 실행할 수 있습니다.
import pkg_resources
try:
version = pkg_resources.get_distribution('nicegui').version
if version < '3.7.0':
print({"result": "취약", "reason": "NiceGUI 버전이 3.7.0 미만"})
else:
print({"result": "양호", "reason": "NiceGUI 버전이 3.7.0 이상"})
except pkg_resources.DistributionNotFound:
print({"result": "미설치", "reason": "NiceGUI가 설치되지 않음"})