T09 · Insecure Skill Coding Practices
- Location
SKILL.md:26- Finding
Plaintext Capture and Storage of Sensitive Clipboard Data
- Content
View full analysis
Vulnerability Details
File Location:
SKILL.md, lines 26–61 and 125–140
Vulnerability Type: Plaintext storage and indiscriminate collection of potentially sensitive clipboard data
Risk Level: MediumThe skill stores up to 50 clipboard records in a local plaintext JSON file. Its optional monitoring mode polls the system clipboard and automatically saves new content without filtering sensitive values.
Vulnerable Code
python CLIPBOARD_FILE = os.path.join(os.path.dirname(__file__), "clipboard_history.json") class ClipboardHistory: MAX_ITEMS = 50 def __init__(self): os.makedirs(os.path.dirname(CLIPBOARD_FILE), exist_ok=True) self.history = self._load() def _load(self): if os.path.exists(CLIPBOARD_FILE): try: with open(CLIPBOARD_FILE, encoding="utf-8") as f: return json.load(f) except (json.JSONDecodeError, ValueError): return [] return [] def _save(self): with open(CLIPBOARD_FILE, "w", encoding="utf-8") as f: json.dump(self.history, f, ensure_ascii=False, indent=2) def save(self, text: str) -> dict: """Save a clipboard record with deduplication.""" if not text or not text.strip(): return {"saved": False, "reason": "empty"} if self.history and self.history[0]["text"] == text.strip()[:200]: return {"saved": False, "reason": "duplicate"} entry = { "text": text.strip()[:200], "length": len(text.strip()), "time": datetime.now().isoformat(), "timestamp": time.time() } self.history.insert(0, entry) if len(self.history) > self.MAX_ITEMS: self.history = self.history[:self.MAX_ITEMS] self._save()python def auto_watch(interval: float = 1.0): """Poll the clipboard and automatically save new content.""" ch = ...[truncated 3104 chars]- Remediation
View remediation
Remediation Suggestions
- Require explicit, informed opt-in before starting clipboard monitoring and clearly warn that credentials and other sensitive values may be retained.
- Store records in an operating-system-specific, per-user application-data directory rather than beside the skill.
- Create storage with owner-only permissions and verify permissions before reading or writing it.
- Encrypt clipboard records at rest using an OS-backed credential or key-protection facility; do not store the encryption key beside the data.
- Add configurable filters for common secrets, including passwords, API keys, bearer tokens, private keys, authentication cookies, and connection strings.
- Support application-level exclusions so clipboard values copied from password managers, terminals, and other sensitive applications are not recorded.
- Remove clipboard previews from console output, or make previews disabled by default with automatic redaction.
- Implement short, configurable expiration periods in addition to the 50-item limit.
- Provide clear controls to inspect, selectively delete, and clear retained records.
- Document the storage location, retention policy, security limitations, and cleanup procedure.
- Avoid silently swallowing all monitoring exceptions; report sanitized errors so permission and storage failures can be identified without revealing clipboard content.
