Closed
[Roadmap|里程碑]: 下载阶段禁用 TLS 校验且缺少完整性验证,可能导致供应链投毒(CWE-295 / CWE-494) #1377
P1GGYiiAdd on  Apr 22Closed at  Jul 2
P1GGYii
P1GGYii
Apr 22 Create

Thanks for sending an issue! Please fill in the following template to help quickly solve your problem.

Describe the current behavior / 问题描述 (Mandatory / 必填)

文件:tools/prepare_env.sh

# tools/prepare_env.sh: download_single_cann_package()
wget --no-check-certificate --progress=bar:force -O "$target_file" "$resource_url"

# Sink (line 623):
if curl --insecure -L -# -o "$target_file" "$resource_url"; then

# Source (line 66):
CANN_TOOLKIT_URL_X86="https://ascend-cann.obs.cn-north-4.myhuaweicloud.com/pypto/cann/8.5.0_release/x86_64/Ascend-cann-toolkit_8.5.0_linux-x86_64.run"

# Sink (line 739):
if curl --insecure -L -O "$var_value"; then

# Source (lines 63-64):
JSON_URL="https://gitcode.com/cann-src-third-party/json/releases/download/v3.11.3/json-3.11.3.tar.gz"
SECUREC_URL="https://gitcode.com/cann-src-third-party/libboundscheck/releases/download/v1.1.16/libboundscheck-v1.1.16.tar.gz"

  1. 脚本在下载阶段禁用 TLS 证书校验(允许自签/伪造证书)。
  2. 攻击者在构建机与 OBS 之间具备网络干预能力(恶意 Wi‑Fi、代理劫持、DNS 污染、企业网关被攻陷等)。
  3. 攻击者替换返回的 .run 包内容。
  4. 脚本对下载产物执行 chmod +x 并在后续安装阶段直接运行该 .run(且可能伴随 sudo 写入系统路径/安装依赖)。
  5. 结果:构建/安装期间执行攻击者代码。

所以这个部分加上一些完整性校验较为合适。

Environment / 环境信息 (Mandatory / 必填)

无

Steps to reproduce the issue / 重现步骤 (Mandatory / 必填)

无

Describe the expected behavior / 预期结果 (Mandatory / 必填)

缺乏完整性校验

无

Special notes for this issue/备注 (Optional / 选填)

likedislike
杨旭
杨旭Collaborators
Jun 4 Comments:

@songle1 我们一起分析一下

likedislike
杨旭杨旭Collaborators
Jun 4 Assign songle1 as responsible person
杨旭杨旭Collaborators
Jun 4 Assign DCGDDD as responsible person
杨旭
杨旭Collaborators
Jun 8 Comments:

原来是 prepare_env.sh 相关脚本,请 @songle1 代为跟踪处理,我原以为是 cmake 内的处理。

likedislike
杨旭杨旭Collaborators
Jun 8 Removed responsible person DCGDDD
wangzheng97wangzheng97Collaborators
Jun 30 Associated pull request
wangzheng97wangzheng97Collaborators
Jul 1 Associated pull request
wangzheng97
wangzheng97Collaborators
Jul 2 Comments:

已移除 CANN 与第三方下载路径上的 --no-check-certificate(wget)与 --insecure(curl),恢复服务器证书校验,相关修改见关联PR

likedislike
wangzheng97wangzheng97Collaborators
Jul 2 changed custom state from 进行中 to 已完成
wangzheng97wangzheng97Collaborators
Jul 2 Close issue
CANN-robotCANN-robotCollaborators
Jul 2 Added label: resolved
杨旭杨旭Collaborators
Jul 13 Change title to "[Roadmap|里程碑]: 下载阶段禁用 TLS 校验且缺少完整性验证,可能导致供应链投毒(CWE-295 / CWE-494)", originally titled "[Bug-Report|缺陷反馈]: 下载阶段禁用 TLS 校验且缺少完整性验证,可能导致供应链投毒(CWE-295 / CWE-494)".