Back to skill

Security audit

Database Toolkit

Security checks for vulnerabilities and agentic risk

Overview

This database skill is not deceptive, but it gives broad power to read, export, change, and delete database data with weak safeguards and some undeclared database clients.

Install only if you are comfortable giving the agent broad database authority. Use it with test databases or least-privileged accounts first, avoid passing untrusted table names or where clauses, secure any backups or JSON exports, and do not use the Redis/PostgreSQL/MongoDB helpers unless you intentionally need those extra services and can tolerate their destructive operations.

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

T09 · Insecure Skill Coding Practices

Error
Location
database_ops.py:93
Finding

SQL injection through interpolated identifiers and predicates

Content
View full analysis
int: """插入数据""" columns = ', '.join(data.keys()) placeholders = ', '.join(['?' for _ in data]) sql = f'INSERT INTO {table} ({columns}) VALUES ({placeholders})' ``` ```python # database_ops.py:116-130 def update(self, table: str, data: Dict, where: str, params: tuple = None) -> int: """更新数据""" set_clause = ', '.join([f'{k} = ?' for k in data.keys()]) sql = f'UPDATE {table} SET {set_clause} WHERE {where}' values = tuple(data.values()) + (params or ()) with self.get_cursor() as cursor: cursor.execute(sql, values) return cursor.rowcount def delete(self, table: str, where: str, params: tuple = None) -> int: """删除数据""" sql = f'DELETE FROM {table} WHERE {where}' ``` ```python # database_ops.py:244-246 def export_to_json(db_path: str, table: str, output_path: str = None) -> str: """导出表到JSON""" with DatabaseOps(db_path) as db: data = db.execute(f'SELECT * FROM {table}') ``` ```python # mysql_ops.py:128-131 def count(self, table: str, where: str = None) -> int: """统计行数""" sql = f'SELECT COUNT(*) as cnt FROM {table}' if where: sql += f' WHERE {where}' ``` ```python # extra_db.py:48-49 def get_columns(self, table): return [r[0] for r in self.execute(f"SELECT column_name FROM information_schema.columns WHERE table_name='{table}'")] ``` ### Technical Analysis SQL value placeholders protect only bound values. They do not protect table names, column names, or raw SQL predicate fragments. The affected methods interpolate the following caller-controlled inputs directly into SQL statements: - Table names - Dic ...[truncated 1857 chars]
Remediation
View remediation

T09 · Insecure Skill Coding Practices

Error
Location
mysql_ops.py:30
Finding

Remote database clients do not enforce encrypted, authenticated transport

Content
View full analysis
Remediation
View remediation

T08 · Insecure Dependencies

Warning
Location
requirements.txt:1
Finding

Unpinned and unnecessary third-party dependencies create supply-chain exposure

Content
View full analysis
Remediation
View remediation

other

Warning
Location
database_enhanced.py:81
Finding

Undeclared Redis, PostgreSQL, and MongoDB capabilities include destructive Redis operations

Content
View full analysis
Remediation
View remediation
Vulnerability Patterns
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • Supply ChainUnpinned Dependencies, External Script Fetching, Obfuscated Code
  • Excessive AgencyUnrestricted Tool Access, Autonomous Decision Making, Scope Creep
  • MCP Tool PoisoningHidden Instructions, Unicode Deception, Parameter Description Injection
  • Prompt InjectionInstruction Override, Hidden Instructions, Exfiltration Commands
Findings (26)

Missing User Warnings

High
Category
Not specified by scanner
Confidence
97% confidence
Finding

The export function dumps an entire table to a JSON file at a caller-controlled path with no access control, filtering, masking, or safety guardrails. In a skill/tool context, this can easily lead to unintended disclosure of sensitive database contents, especially because it defaults to exporting all columns and rows.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
93% confidence
Finding

This markdown file advertises update, delete, backup, import, and export capabilities, which can affect user data and system integrity. The description does not include any warning or caution about irreversible changes, overwriting data, or validating targets before running these operations.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

The README includes a direct delete example against the users table, but provides no caution that the operation permanently removes records unless separately backed up or wrapped in recovery controls. For markdown files, destructive behaviors should be disclosed to help users understand safety implications before use.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
91% confidence
Finding

These examples show writing backups and exporting/importing JSON data, which can expose sensitive records and overwrite or merge persistent data. The README does not warn users to secure exported files, validate input data, or confirm the destination database before performing these operations.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
88% confidence
Finding

文件名和全文内容表明该技能文档固定为中文呈现,但未说明这是可选语言版本,也未给出语言选择或区域性适用理由。根据规则,强制特定语言而没有用户选择或明确正当说明,属于自然语言层面的语言/地区政策风险。

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
84% confidence
Finding

README 在快速函数示例中直接展示了 DELETE 语句执行,但附近没有针对删除不可逆、应先确认条件或核对目标环境的专门警示。虽然文末有一般性“写操作前备份”提示,但对删除这种高风险行为的用户警告仍不够明确。

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
91% confidence
Finding

The skill explicitly advertises direct update, delete/insert, and backup capabilities for databases, but provides only minimal caution and no visible safety boundaries such as confirmation gates, read-only defaults, or role restrictions. In an agent context, this can enable accidental or induced destructive operations against local databases, causing integrity loss, data corruption, or unauthorized copying of sensitive data.

Content

No source excerpt is available for this finding.

Intent-Code Divergence

Medium
Category
Not specified by scanner
Confidence
84% confidence
Finding

The documentation states that the skill supports both SQLite and MySQL, including a dedicated MySQL section at L028-L033. However, the only implementation reference and code examples at L117-L145 exclusively instantiate a local database file and call sqlite_query, with no visible MySQL connection logic or configuration use, creating an intent-code divergence in the documented capabilities.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
96% confidence
Finding

The db查询 [SQL] interface accepts arbitrary SQL text while being described as a query command, but it does not state that submitted SQL could include destructive statements such as DROP, DELETE, UPDATE, ATTACH, or PRAGMA operations. In practice, this broad SQL execution surface can be abused by prompt-influenced users or unsafe agent flows to modify schema/data or exfiltrate information from accessible databases.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
90% confidence
Finding

The code exposes a destructive flushdb() operation that can irreversibly delete all data in the selected Redis database. There is no confirmation prompt, logging, comment, or docstring warning users about this destructive behavior in the method itself.

Content

No source excerpt is available for this finding.

Unbounded Resource Access

Medium
Category
Excessive Agency
Confidence
77% confidence
Finding

RedisQueue.pop() allows blocking polling with timeout=0, which results in an unbounded loop that sleeps and retries forever when the queue is empty. In a service context, attackers or faulty callers can trigger threads/workers to remain occupied indefinitely, causing resource exhaustion and degraded availability.

Content

Scanner excerpt · database_enhanced.py (reported line 249)May include surrounding context.

python
message = json.dumps(message)
        return self.redis.lpush(self.queue_name, message)
    
    def pop(self, blocking=False, timeout=0):
        if blocking:
            import time
            start = time.time()

Intent-Code Divergence

Medium
Category
Not specified by scanner
Confidence
96% confidence
Finding

The module docstring says "SQLite/MySQL数据库操作: 查询/更新/备份", implying both SQLite and MySQL database operations are supported. In code, connect() only handles sqlite3 and explicitly says MySQL support can be added later, so the documentation overstates current behavior rather than merely omitting details.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
89% confidence
Finding

The module description presents the tool in Chinese ('SQLite/MySQL数据库操作: 查询/更新/备份') without indicating that language selection is optional or that the skill is intentionally region-specific. This can violate language/locale policy when a skill implicitly fixes a language without user opt-in.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
93% confidence
Finding

The backup method performs a filesystem copy of the database to a new path, which creates a duplicate of potentially sensitive user data. Although the docstring says it backs up the database, there is no confirmation prompt, visible disclosure, or explicit warning that data will be written to disk at another location.

Content

No source excerpt is available for this finding.

Intent-Code Divergence

Medium
Category
Not specified by scanner
Confidence
92% confidence
Finding

The helper functions and example code document and demonstrate a supported usage pattern via a with-statement, which implies DatabaseOps can be used as a context manager. However, the class defines neither enter nor exit, so this documented usage contradicts the actual implementation and would fail at runtime.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
91% confidence
Finding

The import_from_json function reads external data from disk and inserts it into the target table, modifying the database state in bulk. There is no confirmation prompt, visible warning, or disclosure that this operation will change user data.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
90% confidence
Finding

This code file provides safety-relevant data modification operations including inserts, updates, deletes, and transactional SQL execution/commit, but there is no confirmation prompt, user-facing log, or warning in nearby comments/docstrings. These operations can alter or remove user data, so the lack of disclosure makes the behavior easy to invoke without clear notice.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
94% confidence
Finding

This code performs safety-relevant state-changing operations including bulk writes, inserts, updates, and deletes, and immediately commits them to the database. While there are brief docstrings, they do not disclose the risk or irreversible impact to users, and there are no confirmation prompts or user-visible logs around these actions.

Content

No source excerpt is available for this finding.

Intent-Code Divergence

Medium
Category
Not specified by scanner
Confidence
96% confidence
Finding

The method is documented as '备份(导出SQL)' and accepts a backup_path parameter, which implies exporting a backup to that location. Instead, it only builds in-memory return data and does not reference backup_path at all, so the documented intent contradicts the actual behavior.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
78% confidence
Finding

The natural-language instructions, command descriptions, and warnings are all presented in Chinese, which may force a specific language experience without user opt-in. The policy allows locale-specific behavior when documented and justified, but no such opt-in or justification appears here.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
83% confidence
Finding

The file's docstring and many class section comments are written in Chinese, which effectively imposes a specific language on maintainers or users reading the skill source. The file does not indicate that the language choice is optional, user-selected, or justified as a region-specific tool.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
77% confidence
Finding

The file includes user-facing natural-language strings and docstrings in Chinese while other text is in English, but there is no indication that the skill is intentionally locale-specific or that users can choose their preferred language. This may violate language/locale policy expectations when a skill implicitly forces one language without opt-in.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
86% confidence
Finding

The file includes user-visible natural-language content such as the module docstring, class/method docstrings, and comments in Chinese, which can impose a language expectation without opt-in. Under the language policy rule, user-facing instructional text should not force a specific language unless the skill explicitly offers a choice or is clearly documented as language-specific.

Content

No source excerpt is available for this finding.

Missing User Warnings

Low
Category
Not specified by scanner
Confidence
82% confidence
Finding

The connect method establishes a network connection using host, user, password, and database parameters, which involves transmitting credentials and accessing external infrastructure. The file lacks any user-facing warning, logging, or explanatory comment about this network behavior or credential use beyond naming the parameters.

Content

No source excerpt is available for this finding.

Unpinned Dependencies

Low
Category
Supply Chain
Confidence
95% confidence
Finding

The dependency list specifies pandas without a version constraint, making builds non-reproducible and allowing different environments to install different releases. This can unintentionally pull in a vulnerable or incompatible version and weakens supply-chain control, even though the file itself does not prove exploitation.

Content

Scanner excerpt · requirements.txt (reported line 1)May include surrounding context.

text
pandas
# MySQL (optional): pymysql sqlalchemy