T03 · Remote Payload Retrieval and Execution
Error
- Location
- scripts/vn-tools-cli-install.ps1.txt:89
- Finding
- Unverified Remote MSI Is Downloaded and Silently Executed<![CDATA[ ## Vulnerability Details **File Location**: `scripts/vn-tools-cli-install.ps1.txt:16, 89-119`; installation is automatically initiated by `SKILL.md:149-168` **Vulnerability Type**: Remote binary retrieval and execution without integrity or publisher verification **Risk Level**: High ### Vulnerable Code ```powershell $MsiVersion = '0.1.0.0' $MsiFilename = "vn-tools-cli_${MsiVersion}_windows_x64.msi" $MsiUrl = "https://github.com/cawcut/skill-vn/releases/download/0.1.0/${MsiFilename}" ``` ```powershell if (-not (Test-Path -LiteralPath $MsiPath)) { Write-Host "Downloading $MsiFilename ..." try { $curl = Get-Command 'curl.exe' -CommandType Application -ErrorAction SilentlyContinue | Select-Object -First 1 if (-not $curl) { throw 'curl.exe was not found on PATH.' } & $curl.Source '--location' '--fail' '--retry' '3' '--retry-all-errors' '--connect-timeout' $DownloadConnectTimeoutSeconds '--max-time' $DownloadMaxTimeSeconds '--retry-max-time' $DownloadRetryMaxTimeSeconds '--progress-bar' '--output' $MsiPath $MsiUrl if ($LASTEXITCODE -ne 0) { throw "curl.exe failed with exit code $LASTEXITCODE" } Write-Host '' } catch { Remove-Item -LiteralPath $MsiPath -ErrorAction SilentlyContinue Write-Error "Download failed: $_" exit 1 } Write-Host "Download complete." } else { Write-Host "MSI already downloaded: $MsiFilename" } Write-Host '' Write-Host 'Installing MSI (silent) ...' Remove-Item -LiteralPath $MsiLogPath -ErrorAction SilentlyContinue & msiexec.exe '/i' $MsiPath 'ALLUSERS=2' 'MSIINSTALLPERUSER=1' '/qn' '/l*v' $MsiLogPath ``` The corresponding automatic installation instruction is: ```powershell $src = "<skill-dir>\scripts\vn-tools-cli-install.ps1.txt" $dst = Join-Path $env:TEMP "vn-tools-cli-install.ps1" Copy-Item -LiteralPath $src -Destination $dst -Force powershell -NoProfile -ExecutionPolicy Bypass -File $dst ``` ...[truncated 2817 chars]
- Remediation
- <![CDATA[ ## Remediation Suggestions 1. Publish a trusted SHA-256 digest for the exact MSI and embed that expected value in the audited installer script. 2. After download and before execution, calculate the file digest with `Get-FileHash -Algorithm SHA256` and abort if it differs from the pinned value. 3. Validate the MSI's Authenticode signature with `Get-AuthenticodeSignature`. 4. Require a valid signature chain and compare the certificate identity or public-key fingerprint against a pinned expected publisher. 5. Perform both hash and publisher checks even when a previously downloaded MSI is present. 6. Download to a newly created private temporary directory rather than a reusable path. 7. Request explicit user approval before downloading and installing executable dependencies, showing the source, version, signer, and requested installation scope. 8. Avoid `ExecutionPolicy Bypass` unless it is strictly required. Sign the PowerShell installer or execute reviewed commands directly under the environment's normal policy. 9. Fail closed on redirects to unexpected hosts, signature-validation errors, digest mismatches, or unavailable verification services. 10. Consider packaging the reviewed binary with the skill or using a trusted package channel that provides immutable versions and cryptographic provenance. ]]>
