Back to skill

Security audit

Backup of conversations to Obsidian

Security checks for vulnerabilities and agentic risk

Overview

This backup skill mostly does what it says, but it handles sensitive chat history, recommends scheduled background execution, can send Telegram alerts, and has an installer flaw that could turn pasted paths into recurring shell execution.

Review before installing. Only run this under a low-privilege account, inspect install.sh first, avoid pasting paths you do not fully trust, and do not enable cron until the scripts are configured safely. Treat the Obsidian vault as sensitive because it will contain conversation transcripts. Disable or remove Telegram alerting unless you intentionally want token-status metadata sent through Telegram, and check for any existing CHAT_ID or Clawdbot Telegram configuration before running the monitor script.

Vulnerability Patterns
  • Insecure Skill Coding PracticesFinds exploitable flaws such as hardcoded secrets or command injection
  • Skill Instruction HijackingAlters the agent's session goals or safety constraints when the skill loads
  • Agent Memory PoisoningWrites attacker-controlled rules into memory that affect later sessions
  • Remote Payload Retrieval and ExecutionFetches external code whose behavior can change after review
  • Embedded Malicious CodeShips malicious scripts inside the skill and executes them locally
Findings (1)

T09 · Insecure Skill Coding Practices

Error
Location
install.sh:8
Finding
Unsanitized installation paths enable persistent shell command injection<![CDATA[ ## Vulnerability Details **File Location**: `install.sh`, lines 8–16 and 37–42 **Vulnerability Type**: Shell command injection through unsafe source-code rewriting **Risk Level**: High ### Vulnerable Code ```bash # Get configuration from user read -p "Obsidian vault path [/root/ObsidianVault/Clawd Markdowns]: " VAULT_PATH VAULT_PATH=${VAULT_PATH:-/root/ObsidianVault/Clawd Markdowns} read -p "Session directory [/root/.clawdbot/agents/main/sessions]: " SESSION_DIR SESSION_DIR=${SESSION_DIR:-/root/.clawdbot/agents/main/sessions} read -p "Tracking directory [/root/clawd]: " TRACKING_DIR TRACKING_DIR=${TRACKING_DIR:-/root/clawd} ``` ```bash # Update paths in scripts for script in scripts/*.sh; do sed -i "s|VAULT_DIR=\".*\"|VAULT_DIR=\"$VAULT_PATH\"|g" "$script" sed -i "s|/root/.clawdbot/agents/main/sessions|$SESSION_DIR|g" "$script" sed -i "s|/root/clawd|$TRACKING_DIR|g" "$script" done ``` ### Technical Analysis The installer accepts three arbitrary path strings and directly inserts them into executable shell scripts using `sed`. It does not validate the input or escape shell syntax, newlines, backslashes, the `sed` delimiter, or replacement-string metacharacters. Although shell syntax introduced through variable expansion is not recursively evaluated by the currently running installer, it is written into the target scripts. It is then interpreted as shell code the next time one of those modified scripts runs. For example, a vault path containing a command substitution expression can cause the installer to generate an assignment structurally equivalent to: ```bash VAULT_DIR="$(attacker-controlled-command)" ``` The command substitution executes when the generated script starts. The same issue affects session and tracking directory input, and the replacement loop modifies every shell script in `scripts/`. This vulnerability is especially significant because the project instructs the user to run `monitor_and_save.sh` hourly through cro ...[truncated 1848 chars]
Remediation
<![CDATA[ ## Remediation Suggestions 1. **Do not rewrite executable source files with configuration values.** Store paths in a dedicated configuration file and have each script load the configuration from a fixed, trusted location. 2. **Avoid evaluating configuration as shell code.** Prefer a data-only format such as JSON and retrieve values with `jq`. If a shell configuration file is retained, create it using safe serialization such as: ```bash { printf 'VAULT_DIR=%q\n' "$VAULT_PATH" printf 'SESSION_DIR=%q\n' "$SESSION_DIR" printf 'TRACKING_DIR=%q\n' "$TRACKING_DIR" } > config ``` 3. **Validate path input.** Reject control characters and newlines, require absolute paths where appropriate, and enforce an explicit policy for allowed characters and locations. 4. **If `sed` remains necessary, escape values separately for the replacement context.** At minimum, escape backslashes, ampersands, and the selected delimiter. This is less robust than separating code from configuration and does not replace shell-safe serialization. 5. **Validate generated scripts before use.** Run `bash -n` on every generated or modified shell script and abort installation if validation fails. 6. **Apply least privilege.** Recommend installation and cron execution under a dedicated unprivileged account with read-only access to the required session directory and write access only to the selected vault and tracking directories. Replace root-oriented defaults with user-scoped paths. 7. **Harden scheduled execution.** Use absolute paths, a restricted `PATH`, restrictive file permissions, and verify that the script and configuration are owned by the scheduling user and are not writable by other accounts. ]]>
Vulnerability Patterns
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • Excessive AgencyUnrestricted Tool Access, Autonomous Decision Making, Scope Creep
  • Tool MisuseTool Parameter Abuse, Chaining Abuse, Unsafe Defaults
  • Rogue AgentSelf-Modification, Session Persistence
  • MCP Least PrivilegeUnderdeclared Capability, Wildcard Permission, Missing Permission Declaration
Findings (22)

Tp4

High
Category
MCP Tool Poisoning
Confidence
97% confidence
Finding
The declared purpose focuses on Obsidian conversation backup, but the content also describes token monitoring and outbound Telegram notifications using separate credentials. That behavioral mismatch is dangerous because reviewers may approve it for local archival while overlooking network egress and monitoring functionality.

Tool Parameter Abuse

High
Category
Tool Misuse
Content
- Delete tracking files and let system reset:
  ```bash
  rm /root/clawd/.last_snapshot_timestamp
  ```

### Empty callout boxes appearing
Confidence
85% confidence
Finding
Tool parameters are crafted to achieve unintended or unsafe behavior. Parameter abuse can bypass intended safety checks (e.g. shell=True, --force, dangerous glob patterns).

Session Persistence

Medium
Category
Rogue Agent
Content
./install.sh

# Add to crontab for automatic hourly backups
crontab -e
# Add: 0 * * * * /path/to/scripts/monitor_and_save.sh
```
Confidence
85% confidence
Finding
Skill establishes unauthorized persistence across sessions via cron jobs, startup scripts, or state files. Session persistence allows an attacker to maintain access beyond the current interaction.

Session Persistence

Medium
Category
Rogue Agent
Content
./install.sh

# Add to crontab for automatic hourly backups
crontab -e
# Add: 0 * * * * /path/to/scripts/monitor_and_save.sh
```
Confidence
85% confidence
Finding
Skill establishes unauthorized persistence across sessions via cron jobs, startup scripts, or state files. Session persistence allows an attacker to maintain access beyond the current interaction.

Lp3

Medium
Category
MCP Least Privilege
Confidence
94% confidence
Finding
The skill documents shell-script installation, chmod, cron setup, and direct command execution, but it does not declare any explicit tool scope or allowed tools. This weakens reviewability and consent because users and platforms are not clearly warned that the skill requires shell access and persistence-related setup.

Missing User Warnings

Medium
Confidence
94% confidence
Finding
The skill is explicitly designed to copy conversation contents into an Obsidian vault and configure recurring backups, but the documentation does not prominently warn that potentially sensitive chats will be persisted to disk on an ongoing schedule. This can lead to accidental retention of secrets, personal data, or regulated content.

Session Persistence

Medium
Category
Rogue Agent
Content
Add to crontab for hourly backups:

```bash
crontab -e

# Add this line (runs every hour at :00)
0 * * * * /path/to/obsidian-conversation-backup/scripts/monitor_and_save.sh
Confidence
86% confidence
Finding
The skill instructs the user to install a cron job that runs automatically every hour, which establishes persistence on the host. While persistence is expected for backup automation, it still carries security risk because compromised or modified scripts would execute repeatedly without further user interaction.

Context-Inappropriate Capability

Medium
Confidence
95% confidence
Finding
Telegram alerting introduces functionality beyond straightforward local backup, creating external communication paths and handling of notification credentials. Even if only token-usage thresholds are sent, this expands attack surface and may leak operational metadata to third-party services.

Missing User Warnings

Medium
Confidence
88% confidence
Finding
The Telegram notification section describes warnings being sent externally but does not clearly disclose that system-state or usage metadata is transmitted to a third-party messaging service. Users may not realize that enabling this feature creates network egress and exposes operational information outside the local machine.

Session Persistence

Medium
Category
Rogue Agent
Content
### No snapshots being created

1. Check cron is running: `crontab -l`
2. Verify script has execute permission: `chmod +x scripts/*.sh`
3. Check logs: Run manually to see errors
Confidence
85% confidence
Finding
Skill establishes unauthorized persistence across sessions via cron jobs, startup scripts, or state files. Session persistence allows an attacker to maintain access beyond the current interaction.

Missing User Warnings

Medium
Confidence
91% confidence
Finding
The script automatically converts and writes conversation content into markdown files in an Obsidian vault without any user-facing confirmation in this code path. Because conversations may contain sensitive prompts, secrets, or personal data, silent persistence increases confidentiality and retention risk.

Description-Behavior Mismatch

Medium
Confidence
97% confidence
Finding
The script is presented as an Obsidian backup utility, but it also sends Telegram notifications and reads bot credentials. That hidden scope expansion creates an unexpected external data flow and increases trust risk, especially because users may not anticipate any network activity from a local archival tool.

Missing User Warnings

Medium
Confidence
93% confidence
Finding
The script sends context-usage status to Telegram without any user-facing notice in the script itself. Even if message contents are minimal, this is still an external disclosure of operational metadata and confirms use of the system to a third party.

Context-Inappropriate Capability

Medium
Confidence
97% confidence
Finding
The code reads a Telegram bot token from a local config and performs external network calls unrelated to the core local backup/archive function. Even though the transmitted message is limited to context status, accessing credentials and initiating outbound traffic creates unnecessary exposure and could violate user expectations or policy boundaries.

External Transmission

Medium
Category
Data Exfiltration
Content
# Send urgent warning via Telegram
        BOT_TOKEN=$(jq -r '.telegram.token' /root/.clawdbot/clawdbot.json 2>/dev/null)
        if [[ -n "$BOT_TOKEN" && -n "$CHAT_ID" ]]; then
            curl -s -X POST "https://api.telegram.org/bot${BOT_TOKEN}/sendMessage" \
                -d "chat_id=${CHAT_ID}" \
                -d "text=🚨 URGENT: Context at ${TOKENS}k/1M (90%+) - Run /new NOW" > /dev/null
        fi
Confidence
88% confidence
Finding
The hardcoded Telegram API endpoint confirms that this script communicates with an external service. In the context of a backup skill, undisclosed remote communication is security-relevant because it changes the trust model from local-only processing to third-party data exchange.

External Transmission

Medium
Category
Data Exfiltration
Content
# Send urgent warning via Telegram
        BOT_TOKEN=$(jq -r '.telegram.token' /root/.clawdbot/clawdbot.json 2>/dev/null)
        if [[ -n "$BOT_TOKEN" && -n "$CHAT_ID" ]]; then
            curl -s -X POST "https://api.telegram.org/bot${BOT_TOKEN}/sendMessage" \
                -d "chat_id=${CHAT_ID}" \
                -d "text=🚨 URGENT: Context at ${TOKENS}k/1M (90%+) - Run /new NOW" > /dev/null
        fi
Confidence
88% confidence
Finding
The hardcoded Telegram API endpoint confirms that this script communicates with an external service. In the context of a backup skill, undisclosed remote communication is security-relevant because it changes the trust model from local-only processing to third-party data exchange.

External Transmission

Medium
Category
Data Exfiltration
Content
if [[ ! -f "$WARNING_SENT_FILE" ]] || [[ $(cat "$WARNING_SENT_FILE") != "800k" ]]; then
        BOT_TOKEN=$(jq -r '.telegram.token' /root/.clawdbot/clawdbot.json 2>/dev/null)
        if [[ -n "$BOT_TOKEN" && -n "$CHAT_ID" ]]; then
            curl -s -X POST "https://api.telegram.org/bot${BOT_TOKEN}/sendMessage" \
                -d "chat_id=${CHAT_ID}" \
                -d "text=⚠️ TOKEN WARNING: Context at ${TOKENS}k/1M (80%+) - Consider /new soon" > /dev/null
        fi
Confidence
88% confidence
Finding
This endpoint usage is another instance of external transmission to Telegram for threshold notifications. Although the payload is not the full transcript, the mere fact of remote status reporting can expose usage patterns and violate assumptions about a self-contained backup tool.

External Transmission

Medium
Category
Data Exfiltration
Content
if [[ ! -f "$WARNING_SENT_FILE" ]] || [[ $(cat "$WARNING_SENT_FILE") != "800k" ]]; then
        BOT_TOKEN=$(jq -r '.telegram.token' /root/.clawdbot/clawdbot.json 2>/dev/null)
        if [[ -n "$BOT_TOKEN" && -n "$CHAT_ID" ]]; then
            curl -s -X POST "https://api.telegram.org/bot${BOT_TOKEN}/sendMessage" \
                -d "chat_id=${CHAT_ID}" \
                -d "text=⚠️ TOKEN WARNING: Context at ${TOKENS}k/1M (80%+) - Consider /new soon" > /dev/null
        fi
Confidence
88% confidence
Finding
This endpoint usage is another instance of external transmission to Telegram for threshold notifications. Although the payload is not the full transcript, the mere fact of remote status reporting can expose usage patterns and violate assumptions about a self-contained backup tool.

Missing User Warnings

Medium
Confidence
91% confidence
Finding
The script automatically reads the most recent session file from a hidden application directory containing conversation records, which may hold sensitive user data. Accessing and exporting these records without any disclosure, scoping checks, or user review increases the chance of unintended data collection and propagation beyond the original application context.

Missing User Warnings

Medium
Confidence
96% confidence
Finding
The script persists the entire conversation history to a markdown file in an Obsidian vault, which can include secrets, personal data, or proprietary content from the session. Even though this appears to be the skill’s intended functionality, writing full transcripts to disk without consent prompts, redaction, retention controls, or access warnings creates a real confidentiality risk if the vault is synced, shared, or improperly protected.

Description-Behavior Mismatch

Low
Confidence
76% confidence
Finding
The README presents the skill as entirely local and shell-based, but the markdown includes an externally hosted image URL. While this is documentation rather than runtime code, it still introduces network access not implied by the local-backup framing.

Natural-Language Policy Violations

Low
Confidence
82% confidence
Finding
The formatter emits a fixed natural-language label, "🦞 Zoidbot," for assistant messages. This is a natural-language policy concern because it forces a specific presentation identity rather than preserving a neutral label or offering a configurable choice.

Static analysis

No suspicious patterns detected.