T05 · Unauthorized Access and Privilege Escalation
- Location
scripts/capture_note.py:62- Finding
Installation-Dependent Vault Root Can Cause Writes Outside the Intended Storage Scope
- Content
View full analysis
tuple[Path, str]: vault_root = Path(__file__).resolve().parents[4] year = now.strftime("%Y") month = now.strftime("%Y-%m") date_stamp = now.strftime("%Y-%m-%d") journal_path = vault_root / "Journal" / year / month / f"{date_stamp}.md" journal_path.parent.mkdir(parents=True, exist_ok=True) ``` ```python def create_inbox_note(content: str, title: str, source_url: str, tags: list[str], now: datetime) -> tuple[Path, str]: vault_root = Path(__file__).resolve().parents[4] year = now.strftime("%Y") month = now.strftime("%Y-%m") date_stamp = now.strftime("%Y-%m-%d") clock_stamp = now.strftime("%H%M%S") note_title = title.strip() or derive_title_from_content(content) file_name = f"{date_stamp}--{clock_stamp}--{sanitize_path_segment(note_title)}.md" note_path = vault_root / "Inbox" / year / month / file_name note_path.parent.mkdir(parents=True, exist_ok=True) ``` ### Technical Analysis The script derives the note vault from a fixed ancestor index: ```python Path(__file__).resolve().parents[4] ``` This assumes that the Skill is always installed at one specific directory depth. There is no trusted configuration value, canonical allowed-root check, or validation that the resulting directory is the intended note vault. At the audited location: ```text /tmp/clawhub-codex-scan-v578qaprrnb6cdgd4hb7b7kgqs8eftnh-su1ZUq/artifact/scripts/capture_note.py ``` `parents[4]` resolves to the filesystem root, `/`. Consequently, the calculated destinations become `/Journal/...` and `/Inbox/...`, rather than directories inside the project or a clearly configured vault. The calls to `mkdir()` ...[truncated 1913 chars]- Remediation
View remediation
