T09 · Insecure Skill Coding Practices
- Location
scripts/jojo.sh:6- Finding
Arbitrary Shell Code Execution Through Sourced Configuration Files
- Content
View full analysis
Vulnerability Details
File Location:
scripts/jojo.sh:6-10andscripts/refresh_room_aliases.sh:6-10
Vulnerability Type: Executable configuration file / arbitrary shell code execution
Risk Level: HighVulnerable Code
scripts/jojo.sh:6-10:bash CONFIG_FILE="${JOJO_CONFIG_FILE:-$SKILL_DIR/jojo.env}" if [[ -f "$CONFIG_FILE" ]]; then # shellcheck disable=SC1090 source "$CONFIG_FILE" fiscripts/refresh_room_aliases.sh:6-10:bash CONFIG_FILE="${JOJO_CONFIG_FILE:-$SKILL_DIR/jojo.env}" if [[ -f "$CONFIG_FILE" ]]; then # shellcheck disable=SC1090 source "$CONFIG_FILE" fiTechnical Analysis
Both executable entry points load the selected configuration file with Bash's
sourcecommand. This does not treat the file as inert key-value data. Instead, Bash evaluates every statement in the file in the current process, including command substitutions, function definitions, redirections, external commands, and other shell syntax.The
JOJO_CONFIG_FILEenvironment variable can also redirect configuration loading to an arbitrary path accessible to the running user. Consequently, control over either the normaljojo.envfile or the environment selecting another configuration file is equivalent to control over shell code executed by the skill.For example, a malicious configuration could contain:
bash JOJO_DEVICE_ID="$(malicious-command)"The command would execute immediately when the file is sourced, before the requested Roborock operation is processed. Configuration can also set
ROBOROCK_BIN, allowing a malicious executable to be selected for subsequent operations.Attack Path
- An attacker, compromised local process, or unsafe deployment mechanism obtains write access to
jojo.env, or influences theJOJO_CONFIG_FILEenvironment variable. - The attacker inserts shell syntax or command substitution into the selected file.
- A user or ...[truncated 1246 chars]
- An attacker, compromised local process, or unsafe deployment mechanism obtains write access to
- Remediation
View remediation
Remediation Suggestions
- Do not use
sourceto read a data-only configuration file. - Implement a strict parser that accepts only explicitly supported keys:
JOJO_DEVICE_IDJOJO_DEVICE_NAMEROOM_[A-Z0-9_]+
- Treat values as inert strings and reject command substitutions, shell operators, redirections, control characters, and unexpected multiline content.
- Validate room segment values as a narrowly defined numeric format, including comma-separated numeric lists only where explicitly supported.
- Remove the
JOJO_CONFIG_FILEoverride if it is unnecessary. If it is required, constrain it to an approved directory and canonicalize the path before opening it. - Require the configuration to be a regular, non-symlink file owned by the expected user and not writable by group or other users.
- Validate
ROBOROCK_BINseparately or remove it from user-editable configuration. Prefer a trusted absolute executable path and verify file ownership and permissions. - Apply restrictive permissions such as mode
0600to configuration files that contain device identifiers or other sensitive values.
- Do not use
