T09 · Insecure Skill Coding Practices
- Location
lib/config.sh:12- Finding
Executable Workspace Environment File Enables Arbitrary Code Execution
- Content
View full analysis
- Remediation
View remediation
Security audit
Security checks for vulnerabilities and agentic risk
The skill matches its learning-memory purpose, but it handles workspace memory and credentials with under-scoped network and persistence controls that users should review carefully.
Install only if you trust the workspace .env file and the MeiliSearch endpoint. Prefer a localhost-only MeiliSearch instance with a scoped key, review extracted entries before using --apply, avoid storing secrets or personal data in learnings, and treat retrieved learnings as advisory notes rather than instructions that can override current user or safety requirements.
lib/config.sh:12Executable Workspace Environment File Enables Arbitrary Code Execution
lib/config.sh:20Unrestricted MeiliSearch Destination Can Expose Credentials and Workspace Memory
scripts/auto_extract.sh:103Untrusted Note Content Can Poison Persistent Agent Learnings
scripts/auto_extract.sh:154Non-Atomic Temporary File Handling Enables Race Conditions and Extraction Failure
The declared description presents a functional skill that continuously learns from mistakes, stores corrections, and manages its own MeiliSearch index. The supplied code does not implement any of that behavior. It only loads environment configuration for MeiliSearch access and exports credentials for other scripts. While configuration loading could support such a skill, this chunk’s actual purpose is materially different from the declared primary purpose, so this is a mismatch.
The description presents a capability centered on continuous learning: logging mistakes, preventing repetition, and learning rules/preferences/behavioral corrections using its own MeiliSearch index. The supplied code only retrieves existing records from the learnings MeiliSearch index, prints summary statistics, and optionally generates a markdown document (LEARNINGS.md). There is no logic to capture new failures, store corrections, adapt behavior, infer rules, or prevent repetition. While use of a MeiliSearch index is consistent, the primary implemented behavior is distillation/reporting, not continuous learning or logging, so this is a material description-behavior mismatch.
Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.
WORKSPACE="/root/.openclaw/workspace"
fi
# Load .env if it exists
ENV_FILE="${WORKSPACE}/.env"
if [ -f "$ENV_FILE" ]; then
set -a
This script sources ${WORKSPACE}/.env directly into the shell, which executes any shell code contained in that file rather than safely parsing key-value pairs. If an attacker can modify WORKSPACE or the .env file, they can achieve arbitrary command execution in the context of any script that sources this config, and the learning skill's persistent/shared workspace makes that especially dangerous.
fi
# Load .env if it exists
ENV_FILE="${WORKSPACE}/.env"
if [ -f "$ENV_FILE" ]; then
set -a
source "$ENV_FILE"
Remote code is downloaded and executed. This bypasses code review and could introduce malicious code.
sleep 1
# Configure settings
curl -s -X PATCH "${MEILI_HOST}/indexes/${INDEX}/settings" \
-H "Authorization: Bearer ${MEILI_KEY}" \
-H "Content-Type: application/json" \
-d '{
The README explicitly promotes continuous logging of failures, corrections, patterns, and user preferences, but provides no warning, consent model, retention limits, or guidance on avoiding sensitive data collection. In an agent skill context, these logs can easily capture secrets, personal data, operational history, and behavioral profiles, creating a privacy and data-handling risk if the information is stored, indexed, or later queried without controls.
The skill declares executable, read, and write capabilities in prose but does not define an explicit tool scope such as permissions or allowed-tools. That creates an authorization ambiguity where an agent runtime may grant broader access than reviewers expect, especially since the skill reads local notes, loads secrets from ~/.openclaw/workspace/.env, writes files, and invokes shell commands.
Commands invoke sudo or root privileges. Verify this elevated access is necessary and justified.
- **Credentials**: MeiliSearch key is loaded from `~/.openclaw/workspace/.env` — never hardcoded in scripts
- **Sensitive data filtering**: Auto-extraction skips content containing tokens, passwords, API keys, and credentials
- **Safe defaults**: Distillation and auto-extract default to `--dry-run`; use `--apply` to write
- **Secure temp files**: All temp files use `mktemp` with `chmod 600` and are cleaned up on exit
## Capabilities (declared)
Commands invoke sudo or root privileges. Verify this elevated access is necessary and justified.
- **Credentials**: MeiliSearch key is loaded from `~/.openclaw/workspace/.env` — never hardcoded in scripts
- **Sensitive data filtering**: Auto-extraction skips content containing tokens, passwords, API keys, and credentials
- **Safe defaults**: Distillation and auto-extract default to `--dry-run`; use `--apply` to write
- **Secure temp files**: All temp files use `mktemp` with `chmod 600` and are cleaned up on exit
## Capabilities (declared)
Commands invoke sudo or root privileges. Verify this elevated access is necessary and justified.
- **Credentials**: MeiliSearch key is loaded from `~/.openclaw/workspace/.env` — never hardcoded in scripts
- **Sensitive data filtering**: Auto-extraction skips content containing tokens, passwords, API keys, and credentials
- **Safe defaults**: Distillation and auto-extract default to `--dry-run`; use `--apply` to write
- **Secure temp files**: All temp files use `mktemp` with `chmod 600` and are cleaned up on exit
## Capabilities (declared)
Commands invoke sudo or root privileges. Verify this elevated access is necessary and justified.
- **Credentials**: MeiliSearch key is loaded from `~/.openclaw/workspace/.env` — never hardcoded in scripts
- **Sensitive data filtering**: Auto-extraction skips content containing tokens, passwords, API keys, and credentials
- **Safe defaults**: Distillation and auto-extract default to `--dry-run`; use `--apply` to write
- **Secure temp files**: All temp files use `mktemp` with `chmod 600` and are cleaned up on exit
## Capabilities (declared)
This script collects text from local daily notes and, when run with --apply, posts the extracted content to a MeiliSearch service without any explicit confirmation at send time or clear disclosure that note contents may leave the local context. The built-in sensitive-data filter is heuristic and incomplete, so private or regulated information in notes could still be exfiltrated to a remote index, especially given this skill’s purpose is to mine behavioral corrections and past mistakes from personal workspace memory.
Data is being sent to an external URL. This could be legitimate telemetry or data exfiltration. Manual review is recommended.
# Wait for MeiliSearch
for i in $(seq 1 10); do
if curl -s "${MEILI_HOST}/health" > /dev/null 2>&1; then break; fi
sleep 1
done
Data is being sent to an external URL. This could be legitimate telemetry or data exfiltration. Manual review is recommended.
sleep 1
# Configure settings
curl -s -X PATCH "${MEILI_HOST}/indexes/${INDEX}/settings" \
-H "Authorization: Bearer ${MEILI_KEY}" \
-H "Content-Type: application/json" \
-d '{
No suspicious patterns detected.