T09 · Insecure Skill Coding Practices
- Location
SKILL.md:48- Finding
Health Records Stored in a Plaintext File Without Explicit Access Restrictions
- Content
View full analysis
Vulnerability Details
File Location:
SKILL.md, lines 48-60
Vulnerability Type: Plaintext storage of sensitive health data
Risk Level: Mediumpython class HealthTracker: def __init__(self, data_file: str = "health_data.json"): self.data_file = data_file self.data = self._load() def _load(self) -> dict: if Path(self.data_file).exists(): with open(self.data_file, 'r') as f: return json.load(f) return {'water': [], 'sleep': [], 'steps': []} def _save(self): with open(self.data_file, 'w') as f: json.dump(self.data, f, indent=2)Technical Analysis
The implementation stores personal health records as unencrypted JSON at a relative, caller-selectable filesystem path. The file is opened without explicitly enforcing owner-only permissions, so its effective permissions depend on the process umask and the security of the working directory.
On systems with permissive default permissions, shared directories, backup agents, synchronization services, or multiple local users, unauthorized principals may be able to read the recorded water, sleep, and step information. Allowing the caller to select
data_filealso increases the chance that sensitive records will be placed in an unintended or publicly accessible location.This finding does not provide an attacker with code execution or elevated system privileges. Exploitation requires an existing ability to access the directory, file, backup, or synchronized copy containing the records.
Attack Path
- A user invokes
HealthTrackerand records personal health information. _save()creates or overwriteshealth_data.jsonusing ambient filesystem permissions.- The file is stored in the current working directory or another caller-selected location without encryption or an explicit owner-only permission mode.
- Another local user, pr ...[truncated 659 chars]
- A user invokes
- Remediation
View remediation
Remediation Suggestions
- Store the database in a dedicated per-user application-data directory rather than the current working directory.
- Create the data file with owner-only permissions, such as mode
0600, and ensure its parent directory is restricted to the owning user. - Validate or constrain caller-supplied paths to prevent accidental storage in shared, public, or otherwise unsafe locations.
- Consider authenticated encryption for health records when confidentiality must be maintained against filesystem readers, backup operators, or synchronization providers.
- Write updates atomically through a securely created temporary file in the same protected directory, then replace the destination file.
- Detect existing files with unsafe ownership, symbolic-link behavior, or overly broad permissions before reading or overwriting them.
- Document the sensitivity, retention policy, backup behavior, and deletion procedure for the stored health data.
