T09 · Insecure Skill Coding Practices
Error
- Location
- apple-notes.md:35
- Finding
- Predictable Shared Temporary File Enables Note Disclosure and Symlink-Based File Overwrite<![CDATA[ ## Vulnerability Details **File Location**: `apple-notes.md:35-50`; the same pattern also appears in `evernote.md:40-54` **Vulnerability Type**: Predictable temporary file, insecure permissions, and symlink following **Risk Level**: High ### Complete Code Snippet ```bash cat > /tmp/note.md << 'EOF' # Pricing: staying at three tiers — 2026-07-26 **Present:** Alice, Bob ## Decisions - Three tiers stay; revisit at 500 customers — @alice, effective 2026-07-26 ## Actions - [ ] @alice: send the pricing deck — 2026-08-04 EOF pbcopy < /tmp/note.md memo notes -a "2026-07-26 Pricing three tiers" ``` ```markdown - **Delete the temp file after pasting.** `/tmp` is world-readable on a shared machine, and a meeting note left there outlives the session. ``` Evernote repeats the vulnerable construction: ```bash cat > /tmp/note.md << 'EOF' # Pricing: staying at three tiers — 2026-07-26 **Present:** Alice, Bob ## Decisions - Three tiers stay; revisit at 500 customers — @alice, effective 2026-07-26 ## Actions - [ ] @alice: send the pricing deck — 2026-08-04 EOF clinote note create --title "2026-07-26 Pricing three tiers" --file /tmp/note.md --notebook "Meetings" ``` ### Technical Analysis The fixed path `/tmp/note.md` is shared across all invocations and users. Shell redirection with `>` follows symbolic links. If an attacker can create `/tmp/note.md` as a symbolic link before the command runs, note creation will truncate and overwrite the linked file with the privileges of the agent process. The resulting file may also inherit a permissive process umask, commonly producing a mode such as `0644`. In that configuration, other local users can read the note before it is deleted. Deleting the file after use narrows the exposure window but does not prevent either pre-creation attacks or concurrent reads. The instructions explicitly acknowledge that `/tmp` is unsafe, but recommend post-operation deletion rather than secure creation. They also do not show an actu ...[truncated 1260 chars]
- Remediation
- <![CDATA[ ## Remediation Suggestions - Avoid temporary files entirely when the destination supports standard input. - Where a file is mandatory, create an unpredictable, owner-only file: ```bash umask 077 tmp_file="$(mktemp "${TMPDIR:-/tmp}/clawic-note.XXXXXXXX")" || exit 1 trap 'rm -f -- "$tmp_file"' EXIT HUP INT TERM cat > "$tmp_file" <<'EOF' ... EOF ``` - Verify that the created object is a regular file and not a symbolic link. - Keep the temporary filename quoted in every command. - Use a per-user private runtime directory where available. - Ensure cleanup runs on both success and failure through a shell trap. - Replace every occurrence of the fixed `/tmp/note.md` path, including the Apple Notes and Evernote workflows. - Document that sensitive content must not be placed on the clipboard unless the user explicitly selected the clipboard-based workflow, because clipboard managers may retain it. ]]>
