T09 · Insecure Skill Coding Practices
- Location
scripts/script.sh:6- Finding
Potentially Sensitive Development Data Is Persisted Without Explicit Access Controls
- Content
View full analysis
Vulnerability Details
File Location:
scripts/script.sh:6-9
Vulnerability Type: Insecure plaintext storage and insufficient file permission hardening
Risk Level: MediumVulnerable Code
bash DATA_DIR="${HOME}/.local/share/ai-code-helper" mkdir -p "$DATA_DIR" _log() { echo "$(date '+%m-%d %H:%M') $1: $2" >> "$DATA_DIR/history.log"; }User input is also written to category-specific logs throughout the command handlers. For example,
scripts/script.sh:146-152contains:bash local input="$*" local ts=$(date '+%Y-%m-%d %H:%M') echo "$ts|$input" >> "$DATA_DIR/check.log" local total=$(wc -l < "$DATA_DIR/check.log") echo " [Ai Code Helper] check: $input" echo " Saved. Total check entries: $total" _log "check" "$input"Technical Analysis
The Skill records user-supplied code review findings, source fragments, generated code, file names, and related development information in plaintext under a predictable directory. It does not establish a restrictive
umask, assign mode0700to the data directory, or assign mode0600to generated log files.Consequently, the effective permissions depend on the caller's environment. Under a permissive configuration such as
umask 022, newly created directories and files may be readable by other local accounts, subject to the permissions of parent directories. The same input is also duplicated in both a category log andhistory.log, increasing its exposure and retention footprint.This issue does not independently grant remote access or elevated privileges. Exploitation requires a local account or process that can traverse the affected user's home-directory hierarchy and read the generated files.
Attack Path
- A user invokes a command such as
check,lint,generate,diff, orfixwith text containing sensitive source code, internal paths, vulnerability details, tokens, or other confidential information. - The scrip ...[truncated 908 chars]
- A user invokes a command such as
- Remediation
View remediation
Remediation Suggestions
-
Set a restrictive process mask before creating any storage:
bash umask 077 -
Create and verify the data directory with owner-only permissions:
bash mkdir -p -m 700 -- "$DATA_DIR" chmod 700 -- "$DATA_DIR" -
Create log and export files with mode
0600, and reject symbolic links where practical. -
Warn users not to submit credentials, private keys, access tokens, or unnecessary source code.
-
Avoid duplicating full user input in
history.log; record only metadata when possible. -
Add commands for secure deletion, retention limits, and automatic expiration.
-
Document that data is persistently stored in plaintext and identify its exact location.
-
