T09 · Insecure Skill Coding Practices
- Location
SKILL.md:66- Finding
Predictable Temporary File Used for Sensitive Child Health Data
- Content
View full analysis
Vulnerability Details
File Location:
SKILL.md, line 66
Vulnerability Type: Unsafe temporary file handling and plaintext storage of sensitive health data
Risk Level: MediumVulnerable Code Snippet:
bash # Get Withings weight data (assuming withings-family skill is installed) python3 ../withings-family/scripts/withings.py emma body > /tmp/withings.json # Parse and generate charts # (The growth chart script handles Withings JSON format if implemented, otherwise transform it)Technical Analysis
The documented integration redirects child body-measurement data to the fixed, globally predictable path
/tmp/withings.json. Shell output redirection does not securely create a unique temporary file. It can follow an existing symbolic link, truncate an existing target, and create the file using permissions determined by the invoking user's currentumask.Because
/tmpis commonly shared among local users, another user may be able to predict and monitor this path. If permissions are permissive, the resulting JSON can disclose sensitive child health information. A pre-created symbolic link may also cause the shell to truncate or overwrite another file writable by the victim.Attack Path
- A local attacker observes that the documented workflow always uses
/tmp/withings.json. - Before the victim runs the command, the attacker creates that path or places a symbolic link there pointing to a file writable by the victim.
- The victim invokes the documented command.
- Shell redirection follows the existing path and writes the exported Withings body data to it.
- Depending on local filesystem protections and permissions, the attacker reads the sensitive measurements or causes a victim-writable symlink target to be truncated and replaced with JSON data.
Exploitation requires local access and is constrained by operating-system protections such as protected symlinks, directory permissions, and ...[truncated 590 chars]
- A local attacker observes that the documented workflow always uses
- Remediation
View remediation
Remediation Suggestions
- Replace the predictable filename with a securely created temporary file:
bash tmp_file="$(mktemp "${TMPDIR:-/tmp}/withings.XXXXXX.json")" || exit 1 chmod 600 "$tmp_file" trap 'rm -f "$tmp_file"' EXIT python3 ../withings-family/scripts/withings.py emma body > "$tmp_file" - Prefer piping data directly between processes when the chart importer supports standard input, avoiding persistent plaintext storage.
- Ensure temporary files are created atomically with owner-only permissions rather than relying solely on the current
umask. - Delete temporary health data immediately after successful processing.
- Do not reuse an existing temporary path, and verify that any persistent destination is a regular file in a private directory.
- Replace the predictable filename with a securely created temporary file:
