Back to skill

Security audit

querydb-skill

Security checks for vulnerabilities and agentic risk

Overview

The skill’s database-testing purpose is coherent, but it ships live-looking database credentials and business identifiers and includes unsafe database/file-write paths.

Review before installing. Treat the embedded database password and taxpayer identifier as exposed, rotate the credential, replace examples with environment variables or a secret manager, use a read-only least-privilege account, add parameterized SQL, and avoid exporting real invoice or taxpayer data unless explicitly approved.

Vulnerability Patterns
  • Unauthorized Access and Privilege EscalationObtains permissions beyond the task's legitimate needs
  • 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 (5)

T09 · Insecure Skill Coding Practices

Error
Location
scripts/db_query.py:547
Finding

Hardcoded Database Credentials Expose Sensitive Test Data

Content
View full analysis
Remediation
View remediation

T09 · Insecure Skill Coding Practices

Error
Location
scripts/db_query.py:171
Finding

SQL Injection Through Direct Placeholder Substitution

Content
View full analysis
str: """Replace SQL variable placeholders.""" for var_name, var_value in self.variables.items(): sql = sql.replace("{{" + var_name + "}}", str(var_value)) if self.buyer_tax_no: sql = sql.replace("{{buyer_tax_no}}", self.buyer_tax_no) return sql ``` The resulting text is subsequently passed to database query methods that execute it as SQL. ### Technical Analysis Variable values are inserted directly into SQL text instead of being supplied as bound parameters. No escaping, type enforcement, or allowlist validation is applied. Although `DatabaseClient.query()` and `query_one()` accept a `params` argument, these generation paths do not use it. An attacker who controls `variables`, `buyer_tax_no`, or another value passed into a SQL placeholder can introduce quote characters and SQL operators that alter the original statement. Depending on the SQL template, database driver configuration, and account grants, exploitation can bypass predicates, retrieve unrelated records, perform expensive operations, or invoke database-side functionality. Stacked statements may be restricted by the driver, but exploitation does not require stacked statements to disclose additional rows. ### Attack Path 1. A caller supplies an attacker-controlled placeholder value, such as a crafted taxpayer identifier. 2. `_replace_vars()` or `DbFixture._execute()` inserts the value directly into the SQL statement. 3. The modified SQL is passed to `query()`, `query_one()`, or `count()`. 4. The database parses the injected characters as SQL s ...[truncated 643 chars]
Remediation
View remediation

T05 · Unauthorized Access and Privilege Escalation

Warning
Location
scripts/db_query.py:120
Finding

Write-Capable Database Interface Exceeds the Skill's Read-Only Requirements

Content
View full analysis
int: """Execute INSERT/UPDATE/DELETE and return the affected row count.""" self.cursor.execute(sql, params) self.connection.commit() return self.cursor.rowcount ``` ### Technical Analysis The declared primary functions are database querying, fixture generation, and test-case generation. These workflows only require reading records. Nevertheless, `DatabaseClient` exposes a generic method explicitly designed to execute and commit arbitrary `INSERT`, `UPDATE`, and `DELETE` statements. This unnecessarily expands the authority available to callers and increases the consequences of compromised calling code, malicious inputs, or accidental misuse. Application-level checks would not be sufficient if the configured database principal itself retains write permissions. ### Attack Path 1. A caller imports `DatabaseClient` from the Skill. 2. The caller initializes it with the supplied database connection details. 3. The caller invokes `execute()` with destructive or unauthorized SQL. 4. The method executes the statement and commits the transaction. 5. Database records are modified or deleted according to the account's effective grants. ### Impact Assessment If the configured database account has write grants, an attacker or misbehaving caller can alter or delete all records accessible to that account. Potential consequences include test-data corruption, loss of invoice records, integrity failures, and disruption of systems relying on the database. If the account is strictly read-only, the database should reject these operations, but the repository provides no evidence that such a restriction exists. ]]>
Remediation
View remediation

T09 · Insecure Skill Coding Practices

Warning
Location
scripts/db_query.py:83
Finding

Database Connections Do Not Require Certificate-Validated TLS

Content
View full analysis
Remediation
View remediation

T08 · Insecure Dependencies

Warning
Location
SKILL.md:63
Finding

Third-Party Database Drivers Are Installed Without Version or Integrity Pinning

Content
View full analysis
Remediation
View remediation
Vulnerability Patterns
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • Excessive AgencyUnrestricted Tool Access, Autonomous Decision Making, Scope Creep
  • MCP Least PrivilegeUnderdeclared Capability, Wildcard Permission, Missing Permission Declaration
  • MCP Tool PoisoningHidden Instructions, Unicode Deception, Parameter Description Injection
  • Prompt InjectionInstruction Override, Hidden Instructions, Exfiltration Commands
Findings (15)

Tp4

High
Category
MCP Tool Poisoning
Confidence
95% confidence
Finding

The declared purpose says the skill is for database querying and validation, but the content also supports fixture injection, automated test-case generation, batch export, and includes live credentials. This mismatch materially increases risk because a reviewer or orchestrator may grant broader trust than warranted, while the skill can access and persist production-like data beyond simple querying.

Content

No source excerpt is available for this finding.

Context-Inappropriate Capability

High
Category
Not specified by scanner
Confidence
99% confidence
Finding

The documentation contains plaintext database host, username, password, database name, and a business tax identifier. Exposing live credentials and business identifiers can directly enable unauthorized database access, data theft, tampering, or lateral movement, especially because the skill's context is specifically to connect and query that database.

Content

No source excerpt is available for this finding.

Missing User Warnings

High
Category
Not specified by scanner
Confidence
99% confidence
Finding

The skill exposes live database access details and sensitive test data context without any warning about privacy, authorization, or system access risks. In a database-query skill, this omission is especially dangerous because users may treat the examples as safe defaults and access or disclose regulated business data without proper controls.

Content

No source excerpt is available for this finding.

Context-Inappropriate Capability

High
Category
Not specified by scanner
Confidence
99% confidence
Finding

The usage example repeats the same live plaintext credentials in runnable sample code, making accidental reuse and credential scraping even more likely. Because these examples are designed to be copied verbatim, they increase the chance of direct unauthorized access and normalize insecure secret handling.

Content

No source excerpt is available for this finding.

Context-Inappropriate Capability

High
Category
Not specified by scanner
Confidence
99% confidence
Finding

The fixture example propagates the same hardcoded credentials into a workflow that injects real database data into tests. This expands the blast radius from simple disclosure to automated extraction and reuse of sensitive records in downstream test artifacts and systems.

Content

No source excerpt is available for this finding.

Context-Inappropriate Capability

High
Category
Not specified by scanner
Confidence
99% confidence
Finding

The later generator example again exposes real credentials and also hardcodes a real-looking tax number, tying secret access to identifiable business data. In this context, the skill is not merely generic documentation; it provides enough information to authenticate and query a specific dataset, which significantly heightens exploitation risk.

Content

No source excerpt is available for this finding.

Description-Behavior Mismatch

High
Category
Not specified by scanner
Confidence
97% confidence
Finding

The skill is presented as query-oriented, but DatabaseClient exposes a generic execute() method that can run INSERT/UPDATE/DELETE and commit changes. In an agent skill context, this expands the trust boundary from read-only data access to destructive database modification, increasing the risk of unintended or unauthorized writes if other components invoke it.

Content

No source excerpt is available for this finding.

Context-Inappropriate Capability

High
Category
Not specified by scanner
Confidence
99% confidence
Finding

The standalone example embeds what appear to be real database host, username, password, database name, and a real-looking tax identifier directly in source code. Hardcoded credentials can be harvested from the repository or package and used to access live systems and sensitive data, especially dangerous here because the skill connects to external databases and generates artifacts from real records.

Content

No source excerpt is available for this finding.

Missing User Warnings

High
Category
Not specified by scanner
Confidence
99% confidence
Finding

These lines contain hard-coded database connection secrets without any disclosure or protection mechanism. Anyone with access to the code can recover the credentials and potentially query or modify a live database, leading to data exposure, compliance violations, or downstream compromise.

Content

No source excerpt is available for this finding.

Undeclared Tool Scope

Medium
Category
MCP Least Privilege
Confidence
82% confidence
Finding

The skill demonstrates file-writing capability via gen.export_as_json("generated_cases.json") but does not declare any tool scope or permissions. Undeclared capabilities make the skill harder to sandbox and review, and can lead users or agents to persist sensitive database-derived data unexpectedly.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
86% confidence
Finding

The example exports generated cases to JSON without warning that the file may contain database-derived sensitive data or may overwrite existing files. Because the generated test cases include mapped real invoice and tax data, silent persistence can create secondary data leaks on disk, in source control, or in shared workspaces.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
90% confidence
Finding

Natural-language content throughout the file, including module documentation and later user-visible log strings, is written in Chinese only. There is no indication that the skill is region-specific or that users can opt into this locale, which conflicts with the policy against forcing a specific language without user choice or justification.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
86% confidence
Finding

The DatabaseClient automatically connects to MySQL or PostgreSQL during initialization and later executes queries against the configured database. While the module describes its purpose, it does not clearly warn users that running the code will establish external database connections and may access real production-like invoice and tax data.

Content

No source excerpt is available for this finding.

Description-Behavior Mismatch

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

The manifest describes this as a database query skill for connecting to databases, executing SQL, retrieving test data, and validating interface responses. However, the code goes beyond query-oriented behavior by implementing a full TestCaseGenerator that constructs API test-case objects and can write them out as JSON files, which is a broader testing/fixture-generation function than the manifest states.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
83% confidence
Finding

The export function writes generated cases, which may include sensitive fields derived from production-like database records, to an arbitrary file path without safeguards. In a testing skill context, this can cause inadvertent local persistence of tax numbers, invoice identifiers, or other business data where filesystem access is broader or retention is uncontrolled.

Content

No source excerpt is available for this finding.