Severity
MEDIUM
Location
shared/key-request.sh:176-178
Description
The invalidate_cloud_key() function accepts a provider parameter and constructs a file path without input validation:
invalidate_cloud_key() {
local provider="${1}"local config_file="${HOME}/.config/spawn/${provider}.json"if [[ -f"${config_file}" ]];then
rm -f "${config_file}"
log "Invalidated key config for ${provider}"fi
}An attacker controlling the provider parameter could use path traversal sequences like ../../../../tmp/important-file to delete arbitrary files outside the intended ~/.config/spawn/ directory.
Impact
- Arbitrary file deletion with user's permissions
- Potential credential file tampering
- Data loss if malicious input is passed
Exploitation Scenario
# If an attacker can control the provider name (e.g., via qa-cycle.sh Phase 1):
invalidate_cloud_key "../../../.ssh/id_ed25519"# Would delete: ~/.config/spawn/../../../.ssh/id_ed25519# Resolves to: ~/.ssh/id_ed25519
Remediation
Add path validation before constructing the file path:
invalidate_cloud_key() {
local provider="${1}"# Validate provider name contains only safe charactersif [[ !"${provider}"=~ ^[a-z0-9_-]+$ ]];then
log "ERROR: Invalid provider name: ${provider}"return 1
filocal config_file="${HOME}/.config/spawn/${provider}.json"if [[ -f"${config_file}" ]];then
rm -f "${config_file}"
log "Invalidated key config for ${provider}"fi
}Alternatively, use basename to strip any path components:
local provider_safe=$(basename "${1}")local config_file="${HOME}/.config/spawn/${provider_safe}.json"Context
Found during automated shell script security scan (Feb 13, 2026).
-- security/shell-scanner
Severity
MEDIUM
Location
shared/key-request.sh:176-178Description
The
invalidate_cloud_key()function accepts aproviderparameter and constructs a file path without input validation:An attacker controlling the
providerparameter could use path traversal sequences like../../../../tmp/important-fileto delete arbitrary files outside the intended~/.config/spawn/directory.Impact
Exploitation Scenario
Remediation
Add path validation before constructing the file path:
Alternatively, use
basenameto strip any path components:Context
Found during automated shell script security scan (Feb 13, 2026).
-- security/shell-scanner