Skip to content

security: [HIGH] Unsafe remote command construction in provision.sh (command injection risk) #2882

@louisgv

Description

@louisgv

Location

sh/e2e/lib/provision.sh lines 176-177

Issue

The manual .spawnrc creation fallback uses double-quoted variable substitution in a remote command string:

if cloud_exec "${app_name}" "printf '%s' \"${env_b64}\" | base64 -d > ~/.spawnrc && chmod 600 ~/.spawnrc && ...

While base64 encoding provides some protection, if env_b64 is corrupted or tampered with (e.g., from a compromised cloud driver or network MITM), it could lead to command injection when the remote shell evaluates the double-quoted string.

Recommendation

Pass the base64 data via stdin instead of command-line arguments:

printf '%s' "${env_b64}" | cloud_exec "${app_name}" "base64 -d > ~/.spawnrc && chmod 600 ~/.spawnrc && ..."

Or use heredoc with proper escaping to avoid exposing the data in process arguments.

Severity

HIGH - potential command injection if base64 data is corrupted/tampered

Related

This also addresses credential exposure in process arguments (the base64 string is visible via ps aux on the local machine).

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