T09 · Insecure Skill Coding Practices
- Location
scripts/script.sh:6- Finding
Personal Mileage Data Is Created Without Restrictive Filesystem Permissions
- Content
View full analysis
Vulnerability Details
File Location:
scripts/script.sh, lines 6–8
Vulnerability Type: Insecure local data permissions
Risk Level: Mediumbash DATA_DIR="${HOME}/.local/share/mileage" mkdir -p "$DATA_DIR" _log() { echo "$(date '+%m-%d %H:%M') $1: $2" >> "$DATA_DIR/history.log"; }Technical Analysis
The script creates its data directory and log files without setting a restrictive
umaskor explicitly applying secure permission modes. Their effective permissions therefore depend on the invoking user's environment.With a common
umaskof022, the directory can be created with mode0755and files with mode0644. This may allow other local users to traverse the directory and read mileage records, travel history, schedules, maintenance information, costs, and generated exports.The same permission issue affects files subsequently created through shell redirection in the data directory. Existing files are not checked or hardened when the application starts.
Attack Path
- A victim runs the Skill and records mileage, schedules, costs, maintenance details, or other travel information.
- The script creates
~/.local/share/mileageand its files using the victim's defaultumask. - On a multi-user system with permissive resulting modes, another local account traverses the victim's home and application data directories.
- The local account reads
history.log, command-specific logs, or generated export files. - The exposed data is used to infer travel patterns, vehicle usage, expenses, or scheduled activity.
Exploitation requires local access and sufficient traversal permission on the parent directories.
Impact Assessment
This issue does not grant elevated privileges or code execution. Its primary impact is unauthorized disclosure of application data to other local users. The scope is limited to records and exports stored in the Mileage data directory, but those records may ...[truncated 62 chars]
- Remediation
View remediation
Remediation Suggestions
-
Set a restrictive process mask before creating any application data:
bash umask 077 DATA_DIR="${HOME}/.local/share/mileage" mkdir -p -- "$DATA_DIR" chmod 700 -- "$DATA_DIR" -
Create all logs and exports with mode
0600. -
Harden existing installations by checking and correcting the modes of the data directory and files during startup.
-
Reject a data directory that is a symbolic link or is owned by another user.
-
Consider using atomic file creation and replacement when generating exports.
-
