Back to skill

Security audit

Server Watchdog

Security checks for vulnerabilities and agentic risk

Overview

This server watchdog is a real monitoring tool, but it needs Review because it can persistently restart services and may send MongoDB crash details to a hard-coded Telegram chat while documenting unsafe SSH password usage.

Review this carefully before installing. Use only on servers you administer, remove the hard-coded Telegram chat ID and host-specific values, disable or explicitly configure outbound alerts, pin dependencies with a lockfile, use verified SSH host keys and key-based auth, and require explicit approval before restarts or persistent PM2 deployment.

Vulnerability Patterns
  • Insecure DependenciesIntroduces malicious components through unsafe dependency sources
  • 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
Findings (3)

T09 · Insecure Skill Coding Practices

Warning
Location
scripts/mongodb-watchdog.js:42
Finding

Hard-Coded Telegram Recipient May Receive Sensitive Operational Information

Content
View full analysis
0) { const reasons = []; for (const line of fatalLines) { try { const obj = JSON.parse(line); if (obj.msg) reasons.push(obj.msg); if (obj.attr?.message) reasons.push(obj.attr.message.trim()); if (obj.attr?.exceptionString) reasons.push(`Exception: ${obj.attr.exceptionString}`); } catch (_) {} } return reasons.filter(r => r).join(' | ') || 'Fatal error (details unclear)'; } ``` ```javascript sendTelegram( `🚨 MongoDB 掛了!\n\n` + `⏰ 時間: ${state.lastCrashTime.toLocaleString('zh-TW', { timeZone: 'Asia/Taipei' })}\n` + `📋 原因: ${reason}\n` + `🔢 累計 crash: ${state.totalCrashes} 次\n` + `\n⏳ 正在嘗試自動重啟...` ); ``` ### Technical Analysis The Telegram chat identifier defaults to the fixed value `1663667034`, while Telegram notification delivery is enabled by default. If an operator configures only `TELEGRAM_BOT_TOKEN` and does not explicitly set `TELEGRAM_CHAT_ID`, notifications are sent to the hard-coded recipient. Crash reasons are built from raw MongoDB log fields, including `msg`, `attr.message`, and `attr.exceptionString`. These fields may contain internal file paths, host information, database or collection names, application details, or portions of failed operations. The resulting content is transmitted to Telegram through an outbound HTTPS request. The bot token is not hard-coded, so exploitation requires a valid token to be supplied. Nevertheless, the insecure default recipient can cause u ...[truncated 1118 chars]
Remediation
View remediation

T09 · Insecure Skill Coding Practices

Error
Location
SKILL.md:101
Finding

SSH Instructions Disable Server Host-Key Verification

Content
View full analysis
Remediation
View remediation

T08 · Insecure Dependencies

Warning
Location
SKILL.md:91
Finding

Deployment Instructions Install an Unpinned npm Dependency

Content
View full analysis
Remediation
View remediation
``` 3. Commit the generated `package.json` and `package-lock.json` to the project. 4. Deploy with `npm ci` so the reviewed lockfile is enforced. 5. Review dependency integrity hashes and changes before updating the lockfile. 6. Run `npm audit` and appropriate software-composition analysis as part of release validation. 7. Evaluate lifecycle scripts and consider `npm ci --ignore-scripts` where dependencies do not require installation scripts. 8. Run installation and the watchdog under a dedicated least-privilege account rather than an administrator account. ]]>
Vulnerability Patterns
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • Privilege EscalationExcessive Permissions, Sudo/Root Execution, Credential Access
  • Trigger AbuseOverly Broad Trigger, Shadow Command Trigger, Keyword Baiting Trigger
  • MCP Least PrivilegeUnderdeclared Capability, Wildcard Permission, Missing Permission Declaration
  • MCP Tool PoisoningHidden Instructions, Unicode Deception, Parameter Description Injection
Findings (8)

Tp4

High
Category
MCP Tool Poisoning
Confidence
96% confidence
Finding

The declared behavior promises broad remote monitoring over SSH, but the analyzed behavior is materially narrower and different, including local MongoDB watchdog behavior and service restarts. This mismatch is dangerous because it can mislead reviewers and users about what will actually run, reducing informed consent and increasing the chance of unexpected persistent monitoring or system modification.

Content

No source excerpt is available for this finding.

Ae1

High
Category
analysis-evasion
Confidence
100% confidence
Finding

Referenced artifact was not completely inspected

Content

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

md
1. Copy `scripts/mongodb-watchdog.js` to target server

Undeclared Tool Scope

Medium
Category
MCP Least Privilege
Confidence
88% confidence
Finding

The skill describes SSH access, use of expect, and operational actions against remote systems, but it declares no explicit tool or permission scope. That creates an authorization gap where an agent could invoke environment or execution capabilities more broadly than users expect, especially for a skill that touches credentials and remote infrastructure.

Content

No source excerpt is available for this finding.

Vague Triggers

Medium
Category
Not specified by scanner
Confidence
87% confidence
Finding

The invocation wording is broad enough to match many routine admin requests, which increases the chance the skill is selected in contexts where the user only wanted inspection, not remote remediation. In a skill that can restart services and access remote hosts, overbroad triggering raises the risk of unintended operational changes.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
91% confidence
Finding

The skill promotes auto-heal and restart behavior without a clear warning that it will modify remote systems. In server operations, restarts can interrupt services, mask root causes, or worsen incidents, so omitting a user-facing confirmation boundary is unsafe.

Content

No source excerpt is available for this finding.

Sudo/Root Execution

Medium
Category
Privilege Escalation
Confidence
70% confidence
Finding

Commands invoke sudo or root privileges. Verify this elevated access is necessary and justified.

Content

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

MongoDB (Linux)

bash
sudo systemctl restart mongod

Deploy watchdog service

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
98% confidence
Finding

The SSH password example disables host key checking, which removes server identity verification and exposes users to man-in-the-middle attacks and credential theft. This is especially dangerous in a skill centered on remote administration because it normalizes insecure SSH practices in a high-value environment.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
93% confidence
Finding

The file header and later user-facing Telegram messages are written in Traditional Chinese, and the code explicitly formats times using the zh-TW locale and Asia/Taipei timezone. This imposes a specific language/locale on all recipients without offering a choice or documenting that the skill is intentionally region-specific.

Content

No source excerpt is available for this finding.

Static analysis

Detected: suspicious.dangerous_exec

Shell command execution detected (child_process).

Critical
Code
suspicious.dangerous_exec
Location
scripts/mongodb-watchdog.js:89