T09 · Insecure Skill Coding Practices
- Location
scripts/script.sh:6- Finding
Sensitive Medication Records Are Stored Without Enforced Access Restrictions
- Content
View full analysis
> $DATA_DIR/meds.jsonl ``` ```bash echo '{"med":"'$2'","taken":"'$(date +%Y-%m-%d_%H:%M)'"}' >> $DATA_DIR/intake.jsonl ``` ### Technical Analysis The Skill stores medication names, doses, schedules, and intake timestamps. This information constitutes sensitive health-related data. Neither the storage directory nor the resulting JSONL files are assigned explicit restrictive permissions. The effective permissions therefore depend entirely on the invoking process's `umask`. Under a commonly used `022` umask, the directory may be created with mode `755` and files with mode `644`, potentially making the records readable by other accounts on the same system where parent-directory traversal is permitted. The destination path expansions are also unquoted. Although the fixed directory name contains no spaces, quoting remains necessary to handle unusual values of `$HOME` safely and consistently. ### Attack Path 1. A user invokes the Skill to add a medication or log an intake event. 2. The script creates the data directory and JSONL files according to the caller's current `umask`. 3. On a multi-user system with permissive effective modes, another local account traverses the user's accessible home-directory path. 4. The account reads `meds.jsonl` or `intake.jsonl`. 5. Medication names, doses, frequencies, and intake timestamps are disclosed. This path requires local filesystem access and sufficiently permissive parent-directory permissions. The script does not itself ...[truncated 416 chars]- Remediation
View remediation
> "$DATA_DIR/meds.jsonl" ``` 4. Explicitly set existing and newly created record files to mode `600`. 5. Refuse to use the storage directory if it is a symbolic link or is owned by a different user. 6. Consider encrypting the records at rest if the intended threat model includes privileged backup systems or offline disk access. ]]>
