Back to skill

Security audit

Mongo Db Client Tool

Security checks for vulnerabilities and agentic risk

Overview

This appears to be a legitimate MongoDB helper, but it needs review because it handles database credentials with weak local-file guidance and recommends persistent system service setup.

Install only if you are comfortable giving the skill access to the configured MongoDB account. Prefer environment variables or a secret manager over config.json, use a dedicated least-privilege database user, pin dependencies before setup, and avoid enabling mongod at boot unless you need a persistent local server and have checked local binding, authentication, and firewall settings.

Vulnerability Patterns
  • System PersistenceInstalls backdoors, hooks, services, or scheduled tasks that survive the run
  • 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
Findings (3)

T06 · System Persistence

Warning
Location
INSTALL-UBUNTU.md:40
Finding
MongoDB Is Registered as a Persistent Boot-Time Service<![CDATA[ ## Vulnerability Details **File Location**: `INSTALL-UBUNTU.md`, lines 40–43 **Vulnerability Type**: `T06: System Persistence` **Risk Level**: Medium **Vulnerable Code:** ```bash ## 3. Start and enable the service sudo systemctl start mongod sudo systemctl enable mongod ``` ### Technical Analysis The installation guide instructs users to run `systemctl enable mongod` with root privileges. This creates a persistent system-service registration that causes MongoDB to start automatically on subsequent boots. Running a MongoDB server is necessary when the Skill uses a local database, but automatic boot-time startup is not necessary for its declared CRUD functionality. The instruction therefore exceeds the minimum privilege and persistence requirements for temporary or occasional Skill use. It also leaves a network-facing database process running outside the lifetime of the Skill. This is an explicit and documented service installation rather than a concealed backdoor. Nevertheless, it increases the system's persistent attack surface, particularly if MongoDB is subsequently configured with an unsafe bind address, insufficient authentication, or excessive database privileges. ### Attack Path 1. A user follows the Ubuntu installation instructions with administrative privileges. 2. `sudo systemctl enable mongod` creates the boot-time service registration. 3. MongoDB starts automatically after future system boots, regardless of whether the Skill is in use. 4. If MongoDB has weak authentication or network binding settings, a local or network attacker reaches the continuously available service. 5. The attacker uses the exposed database privileges to read, alter, or delete accessible MongoDB data. ### Impact Assessment The command makes a root-authorized, cross-session system configuration change. It does not itself grant an attacker root access or install attacker-controlled code, but it maintains a continuously running service and expands the duration d ...[truncated 326 chars]
Remediation
<![CDATA[ ## Remediation Suggestions - Make service enablement optional rather than part of the default installation procedure. - Use `sudo systemctl start mongod` as the minimum default required for local operation. - Document `sudo systemctl enable mongod` only for users who explicitly require MongoDB after every reboot. - Provide rollback instructions: ```bash sudo systemctl disable --now mongod ``` - Before recommending persistent operation, require users to verify MongoDB's bind address, authentication configuration, firewall policy, and database-user privileges. - Recommend binding exclusively to loopback for local-only use and using a dedicated, least-privilege MongoDB account. ]]>

T08 · Insecure Dependencies

Warning
Location
scripts/setup.sh:24
Finding
Unpinned Python Dependencies Are Installed from a Mutable Package Index<![CDATA[ ## Vulnerability Details **File Location**: `scripts/setup.sh`, lines 24–26 **Vulnerability Type**: `T08: Insecure Dependencies` **Risk Level**: Medium **Vulnerable Code:** ```bash echo "==> Installing dependencies" "$VENV_DIR/bin/pip" install --quiet --upgrade pip "$VENV_DIR/bin/pip" install --quiet pymongo ``` ### Technical Analysis The setup process upgrades `pip` and installs `pymongo` without pinning reviewed versions or verifying package hashes. Consequently, the actual executable dependency set can change every time setup is run. Although `pymongo` is the legitimate package name and no typosquatting or suspicious package source was identified, resolving the latest available versions from a mutable package index creates a supply-chain risk. A compromised release, index account, mirror, or transitive dependency could introduce code that was not present during this audit. Python packages may execute code during installation, and imported package code executes with the permissions of the user running the MongoDB client. ### Attack Path 1. An attacker compromises a relevant package release, package-index account, distribution path, or dependency. 2. A user runs `scripts/setup.sh`. 3. `pip` resolves the current unpinned versions rather than a previously reviewed dependency set. 4. The compromised package is downloaded and installed into `scripts/.venv`. 5. Malicious installation logic executes immediately, or malicious runtime logic executes when `mongo_client.py` imports `pymongo`. 6. The payload gains the setup or client process's user privileges and can access resources available to that account. ### Impact Assessment Successful exploitation would provide arbitrary code execution with the privileges of the account running setup or the database client. This can expose environment variables, MongoDB connection credentials, readable workspace files, and any database permissions associated with the configured account. The setup script itself ...[truncated 230 chars]
Remediation
<![CDATA[ ## Remediation Suggestions - Pin `pip`, `pymongo`, and relevant transitive dependencies to reviewed versions. - Store dependencies in a committed lock or requirements file. - Require cryptographic hashes, for example: ```bash "$VENV_DIR/bin/pip" install --require-hashes -r requirements.txt ``` - Avoid automatically upgrading `pip` on every setup execution. - Review dependency updates through a controlled update process rather than resolving the latest package dynamically. - Run setup as an unprivileged user and explicitly warn users not to invoke it through `sudo`. - Consider using a trusted internal package mirror or artifact repository for controlled deployments. ]]>

T09 · Insecure Skill Coding Practices

Warning
Location
SKILL.md:45
Finding
Plaintext Credential Configuration Is Recommended Without the Claimed Git Ignore Protection<![CDATA[ ## Vulnerability Details **File Location**: `SKILL.md`, lines 45–59 **Vulnerability Type**: `T09: Insecure Skill Coding Practices` **Risk Level**: Medium **Vulnerable Code:** ```markdown ### Option 2 — config.json (local file, gitignored) Copy the example and fill in your values: ```bash cp skills/mongo-db/config.example.json skills/mongo-db/config.json ``` Edit `skills/mongo-db/config.json`: ```json { "uri": "mongodb://localhost:27017", "database": "mydb", "username": "optional", "password": "optional" } ``` ``` ### Technical Analysis The Skill recommends copying a configuration file and placing database credentials directly into plaintext JSON. It states that `config.json` is gitignored, but no `.gitignore` file is present in the audited project structure to enforce that assertion. The runtime client reads this file directly and does not check whether its permissions prevent access by other local users. A connection URI can also contain credentials, meaning secrets may be stored in either the dedicated password field or the `uri` field. This does not constitute hardcoded credentials in the distributed example—the example contains placeholders only. The vulnerability is the insecure secret-storage workflow and unsupported assurance that source-control exclusion is already configured. ### Attack Path 1. A user follows the documentation and copies `config.example.json` to `config.json`. 2. The user places a MongoDB username, password, or credential-bearing URI in the file. 3. The user relies on the documentation's statement that the file is gitignored. 4. Because the audited project does not provide the claimed ignore rule, the file may be staged and committed to source control, included in an artifact, or shared with the workspace. 5. Alternatively, permissive filesystem permissions allow another local account to read it. 6. An attacker obtains the credential and authenticates to the configured MongoDB deployment. 7. The attacker exerc ...[truncated 684 chars]
Remediation
<![CDATA[ ## Remediation Suggestions - Add an explicit project-level ignore rule and commit it with the Skill: ```gitignore /config.json ``` - Correct the documentation so it does not claim ignore protection unless that protection is shipped and verified. - Prefer environment-based secret injection or a dedicated operating-system or cloud secret manager. - In the client, inspect configuration-file permissions and reject or prominently warn about files readable by group or other users. - Recommend restrictive permissions: ```bash chmod 600 skills/mongo-db/config.json ``` - Use a dedicated MongoDB identity with access only to the databases, collections, and actions required by the Skill. - Add secret scanning to source-control and release workflows. - If a credential is accidentally committed, rotate it immediately and remove it from repository history; deleting only the working-tree file is insufficient. ]]>
Vulnerability Patterns
  • Privilege EscalationExcessive Permissions, Sudo/Root Execution, Credential Access
  • Rogue AgentSelf-Modification, Session Persistence
  • Trigger AbuseOverly Broad Trigger, Shadow Command Trigger, Keyword Baiting Trigger
  • MCP Least PrivilegeUnderdeclared Capability, Wildcard Permission, Missing Permission Declaration
  • Prompt InjectionInstruction Override, Hidden Instructions, Exfiltration Commands
Findings (18)

Credential Access

High
Category
Privilege Escalation
Content
# Import MongoDB public GPG key
curl -fsSL https://www.mongodb.org/static/pgp/server-8.0.asc | \
   sudo gpg -o /usr/share/keyrings/mongodb-server-8.0.gpg --dearmor

# Add MongoDB repo for your Ubuntu version (e.g. 24.04)
echo "deb [ arch=amd64,arm64 signed-by=/usr/share/keyrings/mongodb-server-8.0.gpg ] https://repo.mongodb.org/apt/ubuntu noble/mongodb-org/8.0 multiverse" | \
Confidence
70% confidence
Finding
Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.

Credential Access

High
Category
Privilege Escalation
Content
# Import MongoDB public GPG key
curl -fsSL https://www.mongodb.org/static/pgp/server-8.0.asc | \
   sudo gpg -o /usr/share/keyrings/mongodb-server-8.0.gpg --dearmor

# Add MongoDB repo for your Ubuntu version (e.g. 24.04)
echo "deb [ arch=amd64,arm64 signed-by=/usr/share/keyrings/mongodb-server-8.0.gpg ] https://repo.mongodb.org/apt/ubuntu noble/mongodb-org/8.0 multiverse" | \
Confidence
70% confidence
Finding
Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.

Sudo/Root Execution

Medium
Category
Privilege Escalation
Content
```bash
# Install prerequisites
sudo apt-get install -y gnupg curl

# Import MongoDB public GPG key
curl -fsSL https://www.mongodb.org/static/pgp/server-8.0.asc | \
Confidence
70% confidence
Finding
Commands invoke sudo or root privileges. Verify this elevated access is necessary and justified.

Sudo/Root Execution

Medium
Category
Privilege Escalation
Content
```bash
# Install prerequisites
sudo apt-get install -y gnupg curl

# Import MongoDB public GPG key
curl -fsSL https://www.mongodb.org/static/pgp/server-8.0.asc | \
Confidence
70% confidence
Finding
Commands invoke sudo or root privileges. Verify this elevated access is necessary and justified.

Sudo/Root Execution

Medium
Category
Privilege Escalation
Content
```bash
# Install prerequisites
sudo apt-get install -y gnupg curl

# Import MongoDB public GPG key
curl -fsSL https://www.mongodb.org/static/pgp/server-8.0.asc | \
Confidence
70% confidence
Finding
Commands invoke sudo or root privileges. Verify this elevated access is necessary and justified.

Sudo/Root Execution

Medium
Category
Privilege Escalation
Content
```bash
# Install prerequisites
sudo apt-get install -y gnupg curl

# Import MongoDB public GPG key
curl -fsSL https://www.mongodb.org/static/pgp/server-8.0.asc | \
Confidence
70% confidence
Finding
Commands invoke sudo or root privileges. Verify this elevated access is necessary and justified.

Sudo/Root Execution

Medium
Category
Privilege Escalation
Content
```bash
# Install prerequisites
sudo apt-get install -y gnupg curl

# Import MongoDB public GPG key
curl -fsSL https://www.mongodb.org/static/pgp/server-8.0.asc | \
Confidence
70% confidence
Finding
Commands invoke sudo or root privileges. Verify this elevated access is necessary and justified.

Sudo/Root Execution

Medium
Category
Privilege Escalation
Content
```bash
# Install prerequisites
sudo apt-get install -y gnupg curl

# Import MongoDB public GPG key
curl -fsSL https://www.mongodb.org/static/pgp/server-8.0.asc | \
Confidence
70% confidence
Finding
Commands invoke sudo or root privileges. Verify this elevated access is necessary and justified.

Sudo/Root Execution

Medium
Category
Privilege Escalation
Content
```bash
# Install prerequisites
sudo apt-get install -y gnupg curl

# Import MongoDB public GPG key
curl -fsSL https://www.mongodb.org/static/pgp/server-8.0.asc | \
Confidence
70% confidence
Finding
Commands invoke sudo or root privileges. Verify this elevated access is necessary and justified.

Sudo/Root Execution

Medium
Category
Privilege Escalation
Content
# Import MongoDB public GPG key
curl -fsSL https://www.mongodb.org/static/pgp/server-8.0.asc | \
   sudo gpg -o /usr/share/keyrings/mongodb-server-8.0.gpg --dearmor

# Add MongoDB repo for your Ubuntu version (e.g. 24.04)
echo "deb [ arch=amd64,arm64 signed-by=/usr/share/keyrings/mongodb-server-8.0.gpg ] https://repo.mongodb.org/apt/ubuntu noble/mongodb-org/8.0 multiverse" | \
Confidence
75% confidence
Finding
The command pipes data fetched over the network directly into a privileged gpg process writing to a system keyring path. Although this is a common setup pattern, it creates a supply-chain risk because compromised transport, DNS, or upstream content could result in trusting an attacker-controlled repository signing key.

Session Persistence

Medium
Category
Rogue Agent
Content
```bash
sudo systemctl start mongod
sudo systemctl enable mongod
```

---
Confidence
80% 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.

Sudo/Root Execution

Medium
Category
Privilege Escalation
Content
| Action   | Command                          |
|----------|----------------------------------|
| Start    | `sudo systemctl start mongod`    |
| Stop     | `sudo systemctl stop mongod`     |
| Restart  | `sudo systemctl restart mongod`  |
| Status   | `sudo systemctl status mongod`   |
Confidence
70% confidence
Finding
Commands invoke sudo or root privileges. Verify this elevated access is necessary and justified.

Sudo/Root Execution

Medium
Category
Privilege Escalation
Content
| Action   | Command                          |
|----------|----------------------------------|
| Start    | `sudo systemctl start mongod`    |
| Stop     | `sudo systemctl stop mongod`     |
| Restart  | `sudo systemctl restart mongod`  |
| Status   | `sudo systemctl status mongod`   |
Confidence
70% confidence
Finding
Commands invoke sudo or root privileges. Verify this elevated access is necessary and justified.

Sudo/Root Execution

Medium
Category
Privilege Escalation
Content
| Action   | Command                          |
|----------|----------------------------------|
| Start    | `sudo systemctl start mongod`    |
| Stop     | `sudo systemctl stop mongod`     |
| Restart  | `sudo systemctl restart mongod`  |
| Status   | `sudo systemctl status mongod`   |
Confidence
70% confidence
Finding
Commands invoke sudo or root privileges. Verify this elevated access is necessary and justified.

Sudo/Root Execution

Medium
Category
Privilege Escalation
Content
| Action   | Command                          |
|----------|----------------------------------|
| Start    | `sudo systemctl start mongod`    |
| Stop     | `sudo systemctl stop mongod`     |
| Restart  | `sudo systemctl restart mongod`  |
| Status   | `sudo systemctl status mongod`   |
Confidence
70% confidence
Finding
Commands invoke sudo or root privileges. Verify this elevated access is necessary and justified.

Lp3

Medium
Category
MCP Least Privilege
Confidence
90% confidence
Finding
The skill exposes access to environment-derived database credentials and encourages execution of a Python client, but it declares no explicit tool scope or permission boundary. In an agent ecosystem, that can let the skill be invoked with broader-than-intended access to secrets or runtime capabilities, increasing the chance of unauthorized database actions or credential misuse.

Vague Triggers

Medium
Confidence
90% confidence
Finding
The invocation guidance is broad enough to match generic requests like "save to the database" or persistence across sessions, which may cause an orchestrator to route unrelated or sensitive data into MongoDB without strong user intent. That increases the risk of over-collection, accidental persistence of secrets, or use of this skill when a narrower storage mechanism would be safer.

Session Persistence

Medium
Category
Rogue Agent
Content
## When to use

- User asks to "save to the database", "store this in Mongo", "retrieve from MongoDB"
- An agent needs to persist data across sessions (budgets, transactions, summaries, watchlists)
- An agent needs to query, filter, or aggregate stored records
- A new collection or schema (validator) needs to be set up
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.

Static analysis

No suspicious patterns detected.