#1998·apex

CWE-22/CWE-73 在排列缓存路径中: APEX_ASP_CACHE_DIR 控制写入目标

作者: BeforeGodKnows创建于 2026年4月27日更新于 2026年4月27日

受影响的位置:

  • apex/apex/contrib/sparsity/permutation_search_kernels/exhaustive_search.py:77
  • apex/apex/contrib/sparsity/permutation_search_kernels/exhaustive_search.py:91

漏洞详情:

  • generate_all_unique_combinations()中,缓存目录从APEX_ASP_CACHE_DIR中读取,然后直接在np.save(cache_file_path, ...)中使用。
  • 在写入之前没有对基目录进行约束或规范化路径验证,因此由外部控制的输入可能会影响写入目标(CWE-22/CWE-73)。

基于仓库的重现步骤:

首先,在poc第55行中修改apex的本地路径,repo_apex = Path("apex")。然后,运行poc。