T09 · Insecure Skill Coding Practices
- Location
scripts/bc.sh:53- Finding
Arbitrary Shell Execution Through Dotenv Configuration
- Content
View full analysis
- Remediation
View remediation
Security audit
Security checks for vulnerabilities and agentic risk
This skill mostly matches its Binance coaching purpose, but it has serious disclosure and implementation risks around secrets, persistent financial data, background tasks, and third-party AI data sharing.
Review carefully before installing. Use only read-only, IP-restricted Binance keys; check .env permissions; avoid enabling crons, watch-bg, Telegram, Anthropic coaching, or USER.md default handling unless you want those persistent behaviors. Treat AI coaching as sending portfolio and behavior details to Anthropic, and consider fixing the .env sourcing/eval/dependency issues before routine use.
scripts/bc.sh:53Arbitrary Shell Execution Through Dotenv Configuration
scripts/setup.sh:57Credential File Is Written Without Safe Serialization or Explicit Permissions
scripts/daily-analysis.sh:34Remote-Influenced Analysis Output Is Executed With eval
src/requirements.txt:1Unpinned Dependencies Are Installed Into the System Python Environment
src/modules/ai_coach.py:130Sensitive Portfolio and Behavioral Data Is Sent to Anthropic Without Adequate Disclosure
src/modules/journal.py:295Trading Journal Entries Are Automatically Written Into Persistent Agent Memory
scripts/daily_analysis.py:143Telegram Bot Token May Be Exposed in Exception Output
YARA rule matched a known malware signature (reverse shell, backdoor, ransomware, C2 framework, or info stealer).
ot
from modules.market import MarketData
from modules.portfolio import Portfolio
from modules.dca import DCAAdvisor
from modules.coach_db import CoachDB
# ── Setup ─────────────────────────────────────────────────────────────────────
api_key = os.getenv("BINANCE_API_KEY", "")
api_secret = os.getenv("BINANCE_API_SECRET", "")
tg_token = os.getenv("TELEGRAM_BOT_TOKEN", "")
tg_chat = os.getenv("TELEGRAM_USER_ID", "")
budget = float(os.getenv("DCA_BUDGET_MONTHLY", "400"))
risk = os.getenv("RISK_PROFILE", "moderate")
client = Spot(api_key=api_key, api_secret=api_secret)
market = MarketData(client)
portfolio = Portfolio(client, market)
dca = DCAAdvisor(market, monthly_budget=budget, risk_profile=risk)
db = CoachDB()
hour = datetime.now().hour
session = "🌅 Morning" if hour < 15 else "🌆 Evening"
d
Credentials or environment variables flow to a network sink. This is a high-confidence indicator of credential exfiltration.
if tg_token:
try:
requests.post(
f"https://api.telegram.org/bot{tg_token}/sendMessage",
json={"chat_id": tg_chat, "text": msg, "parse_mode": "HTML"},
timeout=10,
YARA rule matched a known malware signature (reverse shell, backdoor, ransomware, C2 framework, or info stealer).
es, "🌾 Launchpool & HODLer Airdrops")
# ── Watcher daemon ───────────────────────────────────────────────────────────
def _is_openclaw_mode() -> bool:
"""Detect if running under OpenClaw (no bot token, but openclaw CLI available)."""
import shutil
token = os.getenv("TELEGRAM_BOT_TOKEN", "")
if token:
return False # Has bot token, use direct Telegram API
return shutil.which("openclaw") is not None
def _send_openclaw(chat_id: str, text: str) -> bool:
"""Send message via OpenClaw CLI. Returns True on success."""
import subprocess
try:
# Use openclaw message send with Telegram target
result = subprocess.run(
["openclaw", "message", "send",
"--channel", "telegram",
"--to", f"telegram:{chat_id}",
"--message", text],
capture_output=True,
Credentials or environment variables flow to a network sink. This is a high-confidence indicator of credential exfiltration.
return
try:
requests.post(
f"https://api.telegram.org/bot{token}/sendMessage",
json={"chat_id": chat_id, "text": text, "parse_mode": "HTML"},
timeout=10,
If the skill performs persistent journaling, local database storage, P&L tracking, and writes to memory files without clearly disclosing this in the main purpose, it creates hidden data-retention and privacy risks. Users may share trading data expecting transient coaching, while the skill silently creates durable local records that could expose sensitive financial history.
If the skill performs persistent journaling, local database storage, P&L tracking, and writes to memory files without clearly disclosing this in the main purpose, it creates hidden data-retention and privacy risks. Users may share trading data expecting transient coaching, while the skill silently creates durable local records that could expose sensitive financial history.
If the skill performs persistent journaling, local database storage, P&L tracking, and writes to memory files without clearly disclosing this in the main purpose, it creates hidden data-retention and privacy risks. Users may share trading data expecting transient coaching, while the skill silently creates durable local records that could expose sensitive financial history.
If the skill performs persistent journaling, local database storage, P&L tracking, and writes to memory files without clearly disclosing this in the main purpose, it creates hidden data-retention and privacy risks. Users may share trading data expecting transient coaching, while the skill silently creates durable local records that could expose sensitive financial history.
If the skill performs persistent journaling, local database storage, P&L tracking, and writes to memory files without clearly disclosing this in the main purpose, it creates hidden data-retention and privacy risks. Users may share trading data expecting transient coaching, while the skill silently creates durable local records that could expose sensitive financial history.
If the skill performs persistent journaling, local database storage, P&L tracking, and writes to memory files without clearly disclosing this in the main purpose, it creates hidden data-retention and privacy risks. Users may share trading data expecting transient coaching, while the skill silently creates durable local records that could expose sensitive financial history.
If the skill performs persistent journaling, local database storage, P&L tracking, and writes to memory files without clearly disclosing this in the main purpose, it creates hidden data-retention and privacy risks. Users may share trading data expecting transient coaching, while the skill silently creates durable local records that could expose sensitive financial history.
If the skill performs persistent journaling, local database storage, P&L tracking, and writes to memory files without clearly disclosing this in the main purpose, it creates hidden data-retention and privacy risks. Users may share trading data expecting transient coaching, while the skill silently creates durable local records that could expose sensitive financial history.
The hidden HTML comment contains agent-directed instructions pointing to an external dispatch guide, which is a classic prompt injection and transparency problem. Hidden control text can influence orchestration behavior in ways users cannot see, and externalized instructions may expand actions or routing beyond what is disclosed in the visible manifest.
---
<!-- AGENT INSTRUCTIONS — read references/agent-guide.md for full dispatch table -->
Advertising an 'Update skill' command in the dispatch table normalizes agent-triggered self-modification and runtime code replacement. In context, the skill is supposed to coach users about Binance activity, so embedding self-update capability broadens trust and increases supply-chain risk.
| Watcher running? | `bc.sh watch-status` |
| Start Telegram bot | `bc.sh telegram` |
| Demo mode | `bc.sh demo` |
| Update skill | `bc.sh update` |
Available learn topics: `rsi_oversold`, `rsi_overbought`, `fear_greed`, `dca`, `sma_200`, `concentration_risk`, `panic_selling`
source "$PROJECT/.env" executes the contents of the .env file as shell code, not merely as data. If an attacker can modify that file, they can achieve arbitrary command execution in the user's context whenever the wrapper runs, and exported secrets also become available to child processes.
ARGS=("$@")
# ── Load .env ────────────────────────────────────────────────────────────────
if [[ -f "$PROJECT/.env" ]]; then
set -o allexport; source "$PROJECT/.env"; set +o allexport
fi
The update path explicitly modifies the installed skill by pulling new content and replacing local source files. In a security context this is dangerous because it introduces self-modification and trust in remote update infrastructure; compromise of the registry, repository, or dependency supply chain can lead to execution of attacker-controlled code.
[[ "$confirm" =~ ^[Yy]$ ]] || { echo "Update cancelled."; exit 0; }
echo ""
echo "🔄 Updating BinanceCoach skill..."
# Step 1: Update skill files via ClaWHub
if command -v clawhub &>/dev/null; then
clawhub update binance-coach && echo "✅ Skill updated from ClaWHub"
else
Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.
TMP_ENV=$(mktemp)
cp "$PROJECT/.env" "$TMP_ENV" 2>/dev/null || true
# Copy new source (excludes .env and data/)
rsync -a --exclude='.env' --exclude='data/' "$SRC_DIR/" "$PROJECT/" 2>/dev/null || \
cp -r "$SRC_DIR/." "$PROJECT/"
# Restore .env
[[ -f "$TMP_ENV" ]] && cp "$TMP_ENV" "$PROJECT/.env"
Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.
# Auto-detect skill location
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
BC="bash ${SCRIPT_DIR}/bc.sh"
ENV_FILE="$HOME/workspace/binance-coach/.env"
PYTHON="/opt/homebrew/bin/python3"
if [ -f "$ENV_FILE" ]; then
Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.
# Auto-detect skill location
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
BC="bash ${SCRIPT_DIR}/bc.sh"
ENV_FILE="$HOME/workspace/binance-coach/.env"
PYTHON="/opt/homebrew/bin/python3"
if [ -f "$ENV_FILE" ]; then
Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.
# Auto-detect skill location
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
BC="bash ${SCRIPT_DIR}/bc.sh"
ENV_FILE="$HOME/workspace/binance-coach/.env"
PYTHON="/opt/homebrew/bin/python3"
if [ -f "$ENV_FILE" ]; then
Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.
# Auto-detect skill location
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
BC="bash ${SCRIPT_DIR}/bc.sh"
ENV_FILE="$HOME/workspace/binance-coach/.env"
PYTHON="/opt/homebrew/bin/python3"
if [ -f "$ENV_FILE" ]; then
Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.
# Auto-detect skill location
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
BC="bash ${SCRIPT_DIR}/bc.sh"
ENV_FILE="$HOME/workspace/binance-coach/.env"
PYTHON="/opt/homebrew/bin/python3"
if [ -f "$ENV_FILE" ]; then
Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.
# Auto-detect skill location
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
BC="bash ${SCRIPT_DIR}/bc.sh"
ENV_FILE="$HOME/workspace/binance-coach/.env"
PYTHON="/opt/homebrew/bin/python3"
if [ -f "$ENV_FILE" ]; then
Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.
# Auto-detect skill location
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
BC="bash ${SCRIPT_DIR}/bc.sh"
ENV_FILE="$HOME/workspace/binance-coach/.env"
PYTHON="/opt/homebrew/bin/python3"
if [ -f "$ENV_FILE" ]; then
Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.
# Auto-detect skill location
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
BC="bash ${SCRIPT_DIR}/bc.sh"
ENV_FILE="$HOME/workspace/binance-coach/.env"
PYTHON="/opt/homebrew/bin/python3"
if [ -f "$ENV_FILE" ]; then
No suspicious patterns detected.