T09 · Insecure Skill Coding Practices
- Location
scripts/healthcheck.sh:9- Finding
Arbitrary Shell Command Execution Through Sourced Environment File
- Content
View full analysis
- Remediation
View remediation
Security audit
Security checks for vulnerabilities and agentic risk
This monitoring skill is mostly transparent about checking and restarting services, but it uses a risky configuration-loading pattern that can execute arbitrary shell code repeatedly when scheduled.
Review before installing. Use a dedicated, locked-down config file instead of ~/.env, do not enable LaunchAgent or cron until the config-loading issue is fixed, and confirm every service label because the script can automatically stop and start live services. Telegram alerts are optional but will send service failure details to Telegram.
scripts/healthcheck.sh:9Arbitrary Shell Command Execution Through Sourced Environment File
scripts/healthcheck.sh:54Telegram Bot Token Exposed in Process Command-Line Arguments
Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.
chmod +x ~/.local/bin/mcp-healthcheck.sh
echo 'TELEGRAM_BOT_TOKEN=your-token' >> ~/.env echo 'TELEGRAM_CHAT_ID=your-chat-id' >> ~/.env
Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.
chmod +x ~/.local/bin/mcp-healthcheck.sh
echo 'TELEGRAM_BOT_TOKEN=your-token' >> ~/.env echo 'TELEGRAM_CHAT_ID=your-chat-id' >> ~/.env
The markdown states that failed services will be restarted via launchctl, which is a system-affecting operation that can change running service state. The README presents this as a feature but does not include a clear user warning about the operational impact or that the skill may stop/start services automatically.
The skill sends failure notifications through Telegram and instructs users to configure Telegram credentials, but the README does not warn that service health information will be transmitted to an external service. For markdown files, omission of warnings about behaviors affecting privacy or system data handling is in scope.
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.
### Scheduled (macOS LaunchAgent)
See `SKILL.md` for a complete LaunchAgent plist example that runs every 5 minutes.
### Scheduled (Linux cron)
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.
### Scheduled (macOS LaunchAgent)
See `SKILL.md` for a complete LaunchAgent plist example that runs every 5 minutes.
### Scheduled (Linux cron)
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.
### Scheduled (macOS LaunchAgent)
See `SKILL.md` for a complete LaunchAgent plist example that runs every 5 minutes.
### Scheduled (Linux cron)
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.
### Scheduled (macOS LaunchAgent)
See `SKILL.md` for a complete LaunchAgent plist example that runs every 5 minutes.
### Scheduled (Linux cron)
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.
### Scheduled (macOS LaunchAgent)
See `SKILL.md` for a complete LaunchAgent plist example that runs every 5 minutes.
### Scheduled (Linux cron)
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.
### Scheduled (macOS LaunchAgent)
See `SKILL.md` for a complete LaunchAgent plist example that runs every 5 minutes.
### Scheduled (Linux cron)
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.
### Scheduled (macOS LaunchAgent)
See `SKILL.md` for a complete LaunchAgent plist example that runs every 5 minutes.
### Scheduled (Linux cron)
The skill clearly instructs users to copy and run a shell script, configure cron/LaunchAgent persistence, and invoke launchctl, yet it declares no tool scope or allowed-tools metadata. This increases the chance an agent or reviewer underestimates the skill's ability to execute host-level actions, including service restarts and scheduled execution.
The description presents health monitoring and auto-restart as routine behavior but does not prominently warn that stop/start operations can interrupt running services or affect availability. In operational environments, this can lead to unintended outages, restarts of the wrong service label, or unsafe execution by an agent without informed user consent.
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.
Create ~/Library/LaunchAgents/com.mcp-health-monitor.plist:
<?xml version="1.0" encoding="UTF-8"?>
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.
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN"
"http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
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.
Load the agent:
launchctl load ~/Library/LaunchAgents/com.mcp-health-monitor.plist
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.
# crontab -e
*/5 * * * * /path/to/mcp-healthcheck.sh
Data is being sent to an external URL. This could be legitimate telemetry or data exfiltration. Manual review is recommended.
local message="$1"
if [[ -n "$BOT_TOKEN" && -n "$CHAT_ID" ]]; then
local http_code
http_code=$(curl -s -o /dev/null -w '%{http_code}' -X POST \
"https://api.telegram.org/bot${BOT_TOKEN}/sendMessage" \
-d chat_id="$CHAT_ID" \
-d text="$message" \
Data is being sent to an external URL. This could be legitimate telemetry or data exfiltration. Manual review is recommended.
if [[ -n "$BOT_TOKEN" && -n "$CHAT_ID" ]]; then
local http_code
http_code=$(curl -s -o /dev/null -w '%{http_code}' -X POST \
"https://api.telegram.org/bot${BOT_TOKEN}/sendMessage" \
-d chat_id="$CHAT_ID" \
-d text="$message" \
-d parse_mode="Markdown" 2>/dev/null || echo "000")