Back to skill

Security audit

database-semantic-generator

Security checks for vulnerabilities and agentic risk

Overview

The skill can generate semantic YAML, but its generation path sends database samples or spreadsheet contents to AskSQL without enough disclosure or controls.

Install only if you are comfortable with selected database metadata, sampled values, enum values, and Excel sheet contents being sent to AskSQL or a configured Excel API endpoint. Use read-only, least-privileged, non-production credentials; avoid sensitive spreadsheets; choose narrow table selections; use a safe output directory and simple topic name; and review generated YAML before giving it to another AI workflow.

Vulnerability Patterns
  • Skill Instruction HijackingAlters the agent's session goals or safety constraints when the skill loads
  • Unauthorized Access and Privilege EscalationObtains permissions beyond the task's legitimate needs
  • Insecure Skill Coding PracticesFinds exploitable flaws such as hardcoded secrets or command injection
  • 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)

T01 · Skill Instruction Hijacking

Error
Location
SKILL.md:68
Finding

Mandatory Promotional Instructions Hijack Agent Responses

Content
View full analysis
Remediation
View remediation

T05 · Unauthorized Access and Privilege Escalation

Error
Location
scripts/read_table.py:842
Finding

Database Samples and Excel Contents Are Disclosed to an External Service

Content
View full analysis
Dict[str, Any]: engine = create_engine(db_url) db_type = _detect_db_type(db_url) schema = _extract_schema_name(db_url, schema_name_override=schema_name) inspector = inspect(engine) if not table_list: if db_type in ("postgresql", "sqlserver", "oracle"): short_tables = inspector.get_table_names(schema=schema) else: short_tables = inspector.get_table_names() else: short_tables = table_list tables: Dict[str, Any] = {} try: for table_name in short_tables: if "." in table_name: full_name = table_name current_schema = table_name.split(".")[-2] short_table_name = table_name.split(".")[-1] else: short_table_name = table_name current_schema = schema full_name = f"{current_schema}.{short_table_name}" columns_raw = inspector.get_columns( short_table_name, schema=current_schema if db_type != "mysql" else None, ) columns: List[Dict[str, Any]] = [] column_comments = _get_column_comments(engine, db_type, current_schema, short_table_name) table_comment = _get_table_comment(engine, db_type, current_schema, short_table_name) for col in columns_raw: col_name = col["name"] if db_type == "oracle": column_co ...[truncated 6100 chars]
Remediation
View remediation

T01 · Skill Instruction Hijacking

Error
Location
scripts/generate_yaml.py:207
Finding

Untrusted Remote AI Instructions Are Persisted in Generated Semantic YAML

Content
View full analysis
Dict[str, Any]: if response.status_code != 200: raise RuntimeError(f"Upstream error status={response.status_code}, body={response.text[:400]}") payload = response.json() if not isinstance(payload, dict): raise RuntimeError("Invalid upstream payload: expected dict") if not payload.get("success"): raise RuntimeError(f"Upstream returned success=false, message={payload.get('message', '')}") content = payload.get("content", {}) if isinstance(content, str): try: content = json.loads(content) except json.JSONDecodeError as exc: raise RuntimeError(f"Failed to parse upstream content JSON: {exc}") from exc if not isinstance(content, dict): raise RuntimeError("Invalid upstream content: expected dict") # print(content) return {"raw": payload, "content_data": content} ``` Remote instruction fields are copied directly into generated YAML: ```python instructions = ( root_ai_ctx.get("instructions") or top_ai_ctx.get("instructions") or f"Use this semantic model to handle data queries and analysis related to {topic_name}." ) semantic_model = { "name": model_name, "description": model_desc, "ai_context": { "instructions": instructions }, "datasets": [all_datasets[source] for source in target_sources], } ``` ### Technical Analysis The external knowledge API controls `content_data`. The parser verifies only broad JSON types and the remote `success` flag. It does not enforce a strict schema, reject behavioral fields, validate ins ...[truncated 2213 chars]
Remediation
View remediation

T09 · Insecure Skill Coding Practices

Warning
Location
scripts/generate_yaml.py:244
Finding

Unsanitized Topic Name Allows Writes Outside the Output Directory

Content
View full analysis
Dict[str, Any]: """Generate yaml file and return metadata.""" yaml_content = generate_yaml_content(topic_name, tables_data, selected_tables, db_type=db_type) os.makedirs(output_path, exist_ok=True) yaml_file = os.path.join(output_path, f"{topic_name}.yaml") with open(yaml_file, "w", encoding="utf-8") as f: f.write(yaml_content) return { "success": True, "yaml_path": os.path.abspath(yaml_file), "topic_name": topic_name, "selected_tables": selected_tables, } ``` ### Technical Analysis `topic_name` is accepted from the command-line `--topic-name` argument and is used directly as part of a filesystem path. No validation rejects absolute paths, path separators, `..` components, or platform-specific traversal syntax. `os.path.join` does not guarantee that the resulting path remains under `output_path`. A value such as `../../target` produces a path equivalent to `/../../target.yaml`. Opening the path in write mode creates the file if absent and truncates it if it already exists. The generated content must still pass the earlier YAML-generation logic, but once that succeeds, the attacker controls the destination of the resulting `.yaml` file within the privileges of the process. ### Attack Path 1. An attacker or untrusted caller controls the `--topic-name` argument. 2. The caller supplies a traversal value, for example: ```text --output-path ./output --topic-name ../../target ``` 3. The script builds: ```text ./output/../../target.yaml ``` 4. The operating system resolves the traversal outside the i ...[truncated 930 chars]
Remediation
View remediation
Vulnerability Patterns
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • Excessive AgencyUnrestricted Tool Access, Autonomous Decision Making, Scope Creep
  • 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 (17)

Description-Behavior Mismatch

High
Category
Not specified by scanner
Confidence
98% confidence
Finding

The code sends discovered database schema, foreign keys, comments, and sampled column values to an external asksql.ai endpoint via upload_database_for_knowledge. For a skill presented as generating semantic YAML from local databases, this is a material data exfiltration path and can expose sensitive metadata or real records without clear in-file consent, minimization, or redaction.

Content

No source excerpt is available for this finding.

Description-Behavior Mismatch

High
Category
Not specified by scanner
Confidence
98% confidence
Finding

The Excel path uploads workbook-derived content to a remote API using upload_excel_for_knowledge instead of performing only local analysis. Excel files commonly contain regulated or proprietary business data, so this behavior creates a direct confidentiality risk inconsistent with a user's likely expectation from the skill description.

Content

No source excerpt is available for this finding.

Undeclared Tool Scope

Medium
Category
MCP Least Privilege
Confidence
94% confidence
Finding

The skill advertises behaviors that involve network access and file creation, but it does not declare any explicit tool scope such as allowed-tools or permissions. That creates a least-privilege failure: an agent may execute networked database/API operations and write YAML files without clear policy boundaries or user-visible authorization expectations.

Content

No source excerpt is available for this finding.

Vague Triggers

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

The trigger conditions are framed broadly enough that the skill could be invoked for many database or Excel-related requests, even when the user did not clearly intend schema discovery or YAML generation. Over-broad activation increases the chance of unnecessary access to databases, files, or external services, which is risky in a skill that handles credentials and writes outputs.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
96% confidence
Finding

The skill instructs users to provide database connection strings that embed usernames and passwords, but it gives no safety guidance on secret handling, redaction, storage, or logging. In practice this can lead to credential exposure in chat transcripts, agent logs, shell history, process listings, or downstream telemetry.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
85% confidence
Finding

The specification states that field descriptions are 'typically written in the local language for the target domain,' which imposes a locale expectation in the natural-language guidance. Because the document does not provide an opt-in choice or a clear region-specific justification, this can conflict with organizational language/locale policy requirements.

Content

No source excerpt is available for this finding.

Description-Behavior Mismatch

Medium
Category
Not specified by scanner
Confidence
98% confidence
Finding

This code transmits full Excel files and database metadata to a third-party asksql.ai endpoint, which creates a clear data exfiltration path for potentially sensitive business data, schema details, and embedded secrets. In the context of a skill framed as local semantic generation/export, this is more dangerous because users may reasonably expect local processing and not external transfer of their source data.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
97% confidence
Finding

This function uploads an Excel file to an external API without any visible consent, warning, or local-only fallback in this file. Excel workbooks often contain proprietary data, credentials, financials, or PII, so silent transmission to a remote service materially increases confidentiality and compliance risk.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
97% confidence
Finding

The database metadata payload is sent to a remote endpoint without adequate disclosure, which can reveal internal schema design, table names, column names, and potentially sensitive descriptive content. In a database tooling skill, schema metadata is often security-relevant because it helps attackers map internal systems and identify high-value targets.

Content

No source excerpt is available for this finding.

Context-Inappropriate Capability

Medium
Category
Not specified by scanner
Confidence
99% confidence
Finding

The function prints the entire database table payload before uploading it, which can expose schema details, sample values, or other sensitive metadata in logs, terminals, CI output, or centralized logging systems. Even if intended for debugging, indiscriminate logging increases data exposure and can compound the risk from the external transmission already present in this skill.

Content

No source excerpt is available for this finding.

External Transmission

Medium
Category
Data Exfiltration
Confidence
93% confidence
Finding

The outbound requests.post call is a real external transmission sink for database-derived content. By itself, network access can be legitimate, but here it becomes risky because the transmitted payload contains potentially sensitive metadata and the skill description does not make the remote data flow obvious.

Content

Scanner excerpt · scripts/excel_utils.py (reported line 95)May include surrounding context.

python
Upload database table payload to generate_database_knowledge API.
    """
    print(table_data)
    response = requests.post(
        api_url,
        json={"data": table_data, "format": "json"},
        timeout=timeout,

Context-Inappropriate Capability

Medium
Category
Not specified by scanner
Confidence
89% confidence
Finding

The enum enrichment routine issues SELECT DISTINCT queries against live user tables and collects all distinct non-null values for columns inferred as enums. This expands the skill from schema inspection into content harvesting, which can reveal sensitive categorical values, internal codes, names, or statuses beyond what is necessary to generate a semantic model.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

The file transmits database-derived content to a third-party service without any visible confirmation, approval step, or warning at the call site. Even if remote processing is intended, silent transmission undermines informed consent and increases the chance of accidental exposure of confidential enterprise data.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

The Excel upload path sends user-provided workbook content to an external API without an explicit warning or confirmation step in this script. Because spreadsheets frequently contain sensitive operational or customer data, silent upload materially increases the risk of unintentional disclosure.

Content

No source excerpt is available for this finding.

Missing User Warnings

Low
Category
Not specified by scanner
Confidence
84% confidence
Finding

The skill writes generated YAML to a user-supplied output path without warning about file creation, overwrite, or location safety. While not inherently dangerous, this can cause accidental overwrites, placement in sensitive directories, or unintended persistence of schema metadata derived from internal systems.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
76% confidence
Finding

The instructions say the agent 'MUST' introduce AskSQL, encourage feedback to the author, and strongly recommend another skill after successful generation. This is an organizational-policy style natural-language issue because it forces unsolicited promotional communication rather than making it optional or user-driven.

Content

No source excerpt is available for this finding.

Missing User Warnings

Low
Category
Not specified by scanner
Confidence
86% confidence
Finding

This code writes a YAML file to disk, which is a safety-relevant filesystem operation under the audit criteria. While the function docstring says it generates a yaml file, there is no confirmation prompt, user-facing log/print, or explicit warning in the code about creating or overwriting output files at the computed path.

Content

No source excerpt is available for this finding.

Static analysis

No suspicious patterns detected.