Back to skill

Security audit

Mcp Health Monitor

Security checks for vulnerabilities and agentic risk

Overview

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.

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 (2)

T09 · Insecure Skill Coding Practices

Error
Location
scripts/healthcheck.sh:9
Finding

Arbitrary Shell Command Execution Through Sourced Environment File

Content
View full analysis
Remediation
View remediation

T09 · Insecure Skill Coding Practices

Warning
Location
scripts/healthcheck.sh:54
Finding

Telegram Bot Token Exposed in Process Command-Line Arguments

Content
View full analysis
/dev/null || echo "000") ``` ### Technical Analysis Telegram's Bot API places the bot token in the URL path. The script expands that URL directly in the `curl` command line. While `curl` is running, the resulting argument may be observable through process inspection, debugging, audit, monitoring, crash-diagnostic, or job-management tools available on the host. The script does not intentionally send the token anywhere other than Telegram, and the use of HTTPS protects it in transit. The issue is local exposure caused by placing the expanded secret in a process argument. The relevant exposure window is short, but the monitor may run repeatedly and invokes this request whenever failures occur, creating recurring opportunities for observation. ### Attack Path 1. The health monitor is configured with a valid `TELEGRAM_BOT_TOKEN` and `TELEGRAM_CHAT_ID`. 2. A monitored service fails, causing `send_telegram` to invoke `curl`. 3. A local attacker or monitoring component with sufficient process-inspection access observes the `curl` command line during execution. 4. The observer extracts the token from the URL path: ```text https://api.telegram.org/bot/sendMessage ``` 5. The attacker uses the recovered token to call Telegram Bot API methods as the compromised bot. Exploitation requires local process visibility or access to tooling that records command-line arguments. Whether other unprivileged users can inspect those arguments depends on the operating system and host configuration. ### Impact Assessment A recovered token allows imp ...[truncated 616 chars]
Remediation
View remediation
Vulnerability Patterns
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • Privilege EscalationExcessive Permissions, Sudo/Root Execution, Credential Access
  • Rogue AgentSelf-Modification, Session Persistence
  • MCP Least PrivilegeUnderdeclared Capability, Wildcard Permission, Missing Permission Declaration
  • Prompt InjectionInstruction Override, Hidden Instructions, Exfiltration Commands
Findings (19)

Credential Access

High
Category
Privilege Escalation
Confidence
60% confidence
Finding

Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.

Content

Scanner excerpt · README.md (reported line 22)May include surrounding context.

chmod +x ~/.local/bin/mcp-healthcheck.sh

Configure (optional — for Telegram alerts)

echo 'TELEGRAM_BOT_TOKEN=your-token' >> ~/.env echo 'TELEGRAM_CHAT_ID=your-chat-id' >> ~/.env

text

Credential Access

High
Category
Privilege Escalation
Confidence
60% confidence
Finding

Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.

Content

Scanner excerpt · README.md (reported line 23)May include surrounding context.

chmod +x ~/.local/bin/mcp-healthcheck.sh

Configure (optional — for Telegram alerts)

echo 'TELEGRAM_BOT_TOKEN=your-token' >> ~/.env echo 'TELEGRAM_CHAT_ID=your-chat-id' >> ~/.env

text

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
90% confidence
Finding

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.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
93% confidence
Finding

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.

Content

No source excerpt is available for this finding.

Session Persistence

Medium
Category
Rogue Agent
Confidence
75% 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.

Content

Scanner excerpt · README.md (reported line 36)May include surrounding context.

md
### Scheduled (macOS LaunchAgent)

See `SKILL.md` for a complete LaunchAgent plist example that runs every 5 minutes.

### Scheduled (Linux cron)

Session Persistence

Medium
Category
Rogue Agent
Confidence
75% 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.

Content

Scanner excerpt · SKILL.md (reported line 75)May include surrounding context.

md
### Scheduled (macOS LaunchAgent)

See `SKILL.md` for a complete LaunchAgent plist example that runs every 5 minutes.

### Scheduled (Linux cron)

Session Persistence

Medium
Category
Rogue Agent
Confidence
75% 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.

Content

Scanner excerpt · SKILL.md (reported line 79)May include surrounding context.

md
### Scheduled (macOS LaunchAgent)

See `SKILL.md` for a complete LaunchAgent plist example that runs every 5 minutes.

### Scheduled (Linux cron)

Session Persistence

Medium
Category
Rogue Agent
Confidence
75% 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.

Content

Scanner excerpt · SKILL.md (reported line 81)May include surrounding context.

md
### Scheduled (macOS LaunchAgent)

See `SKILL.md` for a complete LaunchAgent plist example that runs every 5 minutes.

### Scheduled (Linux cron)

Session Persistence

Medium
Category
Rogue Agent
Confidence
75% 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.

Content

Scanner excerpt · SKILL.md (reported line 99)May include surrounding context.

md
### Scheduled (macOS LaunchAgent)

See `SKILL.md` for a complete LaunchAgent plist example that runs every 5 minutes.

### Scheduled (Linux cron)

Session Persistence

Medium
Category
Rogue Agent
Confidence
75% 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.

Content

Scanner excerpt · SKILL.md (reported line 105)May include surrounding context.

md
### Scheduled (macOS LaunchAgent)

See `SKILL.md` for a complete LaunchAgent plist example that runs every 5 minutes.

### Scheduled (Linux cron)

Session Persistence

Medium
Category
Rogue Agent
Confidence
75% 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.

Content

Scanner excerpt · SKILL.md (reported line 186)May include surrounding context.

md
### Scheduled (macOS LaunchAgent)

See `SKILL.md` for a complete LaunchAgent plist example that runs every 5 minutes.

### Scheduled (Linux cron)

Undeclared Tool Scope

Medium
Category
MCP Least Privilege
Confidence
95% confidence
Finding

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.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
92% confidence
Finding

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.

Content

No source excerpt is available for this finding.

Session Persistence

Medium
Category
Rogue Agent
Confidence
60% 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.

Content

Scanner excerpt · SKILL.md (reported line 75)May include surrounding context.

4. Set up automated scheduling (macOS LaunchAgent)

Create ~/Library/LaunchAgents/com.mcp-health-monitor.plist:

xml
<?xml version="1.0" encoding="UTF-8"?>

Session Persistence

Medium
Category
Rogue Agent
Confidence
75% 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.

Content

Scanner excerpt · SKILL.md (reported line 79)May include surrounding context.

xml
<?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>

Session Persistence

Medium
Category
Rogue Agent
Confidence
75% 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.

Content

Scanner excerpt · SKILL.md (reported line 105)May include surrounding context.

Load the agent:

bash
launchctl load ~/Library/LaunchAgents/com.mcp-health-monitor.plist

5. Linux alternative (systemd timer or cron)

Session Persistence

Medium
Category
Rogue Agent
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.

Content

Scanner excerpt · SKILL.md (reported line 111)May include surrounding context.

5. Linux alternative (systemd timer or cron)

bash
# crontab -e
*/5 * * * * /path/to/mcp-healthcheck.sh

External Transmission

Medium
Category
Data Exfiltration
Confidence
70% confidence
Finding

Data is being sent to an external URL. This could be legitimate telemetry or data exfiltration. Manual review is recommended.

Content

Scanner excerpt · scripts/healthcheck.sh (reported line 54)May include surrounding context.

sh
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" \

External Transmission

Medium
Category
Data Exfiltration
Confidence
60% confidence
Finding

Data is being sent to an external URL. This could be legitimate telemetry or data exfiltration. Manual review is recommended.

Content

Scanner excerpt · scripts/healthcheck.sh (reported line 55)May include surrounding context.

sh
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")