T03 · Remote Payload Retrieval and Execution
Error
- Location
- install.sh:20
- Finding
- Unverified Remote Installer Is Executed with Root Privileges<![CDATA[ ## Vulnerability Details **File Location**: `install.sh:20-23`, `install.sh:72-102`, and `install.sh:104-124` **Vulnerability Type**: Unverified remote payload retrieval and privileged execution **Risk Level**: High ### Vulnerable Code ```bash TAR_DIR="/root/.openclaw/workspace/1panel-v2.1.4-linux-amd64" TAR_FILE="/root/.openclaw/workspace/1panel-v2.1.4-linux-amd64.tar.gz" ONEDRIVE_URL="https://resource.fit2cloud.com/1panel/package/v2/stable/v2.1.4/release/1panel-v2.1.4-linux-amd64.tar.gz" VERSION="v2.1.4" ``` ```bash download_install_package() { local retry_count=3 local retry_delay=2 if [[ -d "$TAR_DIR" ]]; then log_info "安装包已存在,跳过下载" return 0 fi log_info "正在下载 1Panel $VERSION 安装包..." for i in $(seq 1 $retry_count); do if curl -fSL --retry 3 --retry-delay $retry_delay "$ONEDRIVE_URL" -o "$TAR_FILE"; then log_success "下载完成" break else if [[ $i -lt $retry_count ]]; then log_warning "下载失败,第 $i 次重试..." sleep $retry_delay else log_error "下载失败,请检查网络连接" return 1 fi fi done # 解压 log_info "正在解压安装包..." if tar -xzf "$TAR_FILE" -C /root/.openclaw/workspace/; then log_success "解压完成" return 0 else log_error "解压失败,安装包可能损坏" return 1 fi } ``` ```bash run_install_script() { log_info "开始安装 1Panel..." log_info "安装路径: $INSTALL_DIR (默认)" log_info "是否安装 Docker: 否" log_info "语言: 中文" echo "" cd "$TAR_DIR" # 使用 heredoc 自动输入安装选项 # 选项顺序: # 2 - 选择中文 # (回车) - 使用默认路径 /opt # n - 不安装 Docker if echo -e "2\n\nn" | ./install.sh; then log_success "安装脚本执行完成" return 0 else log_error "安装脚本执行失败" return 1 fi } ``` ### Technical Analysis The Skill requires root privileges and downloads a compressed installation package from an ext ...[truncated 2692 chars]
- Remediation
- <![CDATA[ ## Remediation Suggestions 1. Publish and pin the expected SHA-256 or SHA-512 digest for the exact `v2.1.4` archive. 2. Verify the digest before extraction and terminate with a nonzero status on any mismatch: ```bash EXPECTED_SHA256="vendor-published-digest" printf '%s %s\n' "$EXPECTED_SHA256" "$TAR_FILE" | sha256sum --check --status || { log_error "Package integrity verification failed" rm -f -- "$TAR_FILE" exit 1 } ``` 3. Prefer verification using a vendor-signed release manifest with a pinned, independently obtained public key. 4. Never trust `$TAR_DIR` merely because it exists. Remove it and perform a fresh verified extraction, or verify every cached artifact before reuse. 5. Download to a newly created root-owned temporary directory using `mktemp -d`, restrictive permissions, and an `EXIT` cleanup trap. 6. Validate archive entries before extraction to reject absolute paths, `..` traversal, and unexpected symbolic links. 7. Use `curl` options that explicitly constrain acceptable protocols and TLS behavior, such as `--proto '=https'`. 8. Log the verified version and digest so administrators can audit exactly which artifact was executed. 9. Where supported by the vendor, use a trusted operating-system package repository with package-signature verification rather than directly executing an archive installer. ]]>
