Back to skill

Security audit

SQL Database Toolkit

Security checks for vulnerabilities and agentic risk

Overview

This is a coherent SQL and reporting toolkit, but it exposes high-impact database, file-loading, and HTML-report behavior with unsafe defaults and weak warnings.

Install only if you trust the data files, SQL prompts, and databases you will use with it. Use read-only, least-privilege database accounts; avoid loading .pkl/.pickle files from untrusted sources; review generated HTML before sharing or hosting it; prefer offline or pinned chart assets if reports contain sensitive data; and avoid the permanent pip mirror configuration unless you intentionally want it and know how to reverse it.

Vulnerability Patterns
  • 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
  • Embedded Malicious CodeShips malicious scripts inside the skill and executes them locally
Findings (3)

T09 · Insecure Skill Coding Practices

Error
Location
scripts/database_connector.py:296
Finding

SQL Injection Through Unvalidated Database Identifiers and LIMIT Values

Content
View full analysis
pd.DataFrame: """获取表结构""" if self.dialect in ("sqlite", "sqlite3"): sql = f"PRAGMA table_info({table})" elif "postgresql" in self.dialect: sql = f""" SELECT column_name, data_type, is_nullable, column_default FROM information_schema.columns WHERE table_name = '{table}' ORDER BY ordinal_position """ elif "mysql" in self.dialect: sql = f"DESCRIBE `{table}`" else: sql = f""" SELECT COLUMN_NAME, DATA_TYPE, IS_NULLABLE, COLUMN_DEFAULT FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = '{table}' """ return self.execute(sql).df def table_preview(self, table: str, limit: int = 5) -> pd.DataFrame: """预览表数据""" sql = f"SELECT * FROM `{table}` LIMIT {limit}" return self.execute(sql).df ``` ### Technical Analysis The `table` argument is interpolated directly into several SQL statements without validation or dialect-aware identifier quoting. The PostgreSQL and generic branches place it inside a string literal, while the SQLite and MySQL branches place it in identifier contexts. The `limit` argument is also interpolated directly, despite its type annotation not enforcing its runtime type. An external caller can pass a string or another object whose string representation contains SQL syntax. Ordinary parameter binding generally cannot be used for table names, but that does not make direct interpolation safe. Identifiers must instead be checked against a strict allowlist or quoted through the active database dialect. Whether stacked statements are accepted depends on the selected database driver, but injection can still modify predicates, access uni ...[truncated 1661 chars]
Remediation
View remediation

T09 · Insecure Skill Coding Practices

Error
Location
scripts/generate_report.py:239
Finding

Stored HTML and Script Injection in Static Report Generation

Content
View full analysis
{kpi['label']}
{kpi['value']}
{kpi['change']}
""" # 章节内容 sections_html = '' for section in sections: section_type = section.get('type', 'chart') if section_type == 'chart': sections_html += f"""
{section.get('title', '')}
{section.get('title', '')} {f'
' + section.get('insight', '') + '
' if section.get('insight') else ''}
""" elif section_type == 'table': sections_html += f"""
{section.get('title', '')}
{section.get('content', '')}
""" elif section_type == 'insight': sections_html += f"""
📌 {section.get('title', '关键洞察')}

{section.get('content', '')}

""" ``` ### Technical Analysis Report fields are inserted into HTML using f-strings without contextual escaping or sanitization. Affected values include KPI labels, KPI values, change text, CSS class fragments, section titles, image alternative text, insight text, and section content. If any of these fields originate from an imported file, database result, template, or untrusted caller, HTML markup can break out of the intended element or attribute. Script execution does not require a literal `
Remediation
View remediation

T09 · Insecure Skill Coding Practices

Error
Location
scripts/interactive_charts.py:551
Finding

Stored HTML and Script Injection in Interactive Dashboard Generation

Content
View full analysis
{c['title']}
{c['value']}
{change}
""" sections_html += f'
{cards_html}
' elif sec["type"] == "chart": width_class = "col-full" if sec["cols"] >= 2 else "col-half" title_html = f'
{sec["title"]}
' if sec["title"] else "" sections_html += f"""
{title_html}
{sec["div"]}
""" elif sec["type"] == "markdown": md = sec["text"] md = md.replace("\n## ", "\n

").replace("\n# ", "\n

") md = md.replace("\n- ", "\n
  • ").replace("\n", "
    ") sections_html += f'
    {md}
    ' elif sec["type"] == "insights": sections_html += f'
    {sec["html"]}
    ' ``` ### Technical Analysis The dashboard builder treats KPI fields, section titles, chart fragments, Markdown text, and insight content as trusted HTML. None of these values are escaped or sanitized before being concatenated into the final document. The Markdown implementation is especially unsafe because it performs simple string replacements without first escaping HTML. Consequently, existing tags and attributes supplied in Markdown remain active. The `a ...[truncated 1920 chars]
  • Remediation
    View remediation
    Vulnerability Patterns
    • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
    • Privilege EscalationExcessive Permissions, Sudo/Root Execution, Credential Access
    • Tool MisuseTool Parameter Abuse, Chaining Abuse, Unsafe Defaults
    • Rogue AgentSelf-Modification, Session Persistence
    • Trigger AbuseOverly Broad Trigger, Shadow Command Trigger, Keyword Baiting Trigger
    Findings (143)

    Ae1

    High
    Category
    analysis-evasion
    Confidence
    100% confidence
    Finding

    Referenced artifact was not completely inspected

    Content

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

    md
    | `pipeline.py` | SQL Pipeline 编排器 |
    

    Ae1

    High
    Category
    analysis-evasion
    Confidence
    100% confidence
    Finding

    Referenced artifact was not completely inspected

    Content

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

    md
    - `requirements.txt` - Python 依赖
    

    Tool Parameter Abuse

    High
    Category
    Tool Misuse
    Confidence
    96% confidence
    Finding

    The Python example builds a shell command with untrusted SQL interpolated into a string and executes it with shell=True. If any part of the SQL, table name, key column, or date becomes attacker-controlled, this can lead to shell command injection and arbitrary command execution on the host running the monitoring script; in a production data platform, that could expose data or compromise orchestration infrastructure.

    Content

    Scanner excerpt · references/hive-skew-advanced.md (reported line 465)May include surrounding context.

    md
    ]
    
    def run_hive_query(sql):
        result = subprocess.run(
            f'{HIVE_CMD} "{sql}"',
            shell=True, capture_output=True, text=True
        )
    

    Credential Access

    High
    Category
    Privilege Escalation
    Confidence
    60% confidence
    Finding

    Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.

    Content

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

    text
    # ── 文件数据获取层 ────────────────────────────────────────────────────
    openpyxl>=3.0.0            # Excel (xlsx/xlsm) 读写
    xlrd>=2.0.0                # Excel (xls) 读取
    python-dotenv>=0.21.0      # .env 环境变量配置
    
    # ── 静态图表(matplotlib 生态)───────────────────────────────────────
    matplotlib>=3.5.0
    

    Missing User Warnings

    High
    Category
    Not specified by scanner
    Confidence
    99% confidence
    Finding

    Beyond the absence of a warning, the code exposes unsafe pickle deserialization through a generic file-loading interface, making dangerous behavior easy to invoke accidentally. In a skill intended to load local files of many formats, treating .pkl like ordinary data significantly increases the chance that an untrusted file triggers arbitrary code execution.

    Content

    No source excerpt is available for this finding.

    Missing User Warnings

    Medium
    Category
    Not specified by scanner
    Confidence
    95% confidence
    Finding

    The skill advertises database connectivity, local file handling, report generation, and CDN-backed interactive charts without prominent user-facing safety warnings. Users may not realize that using the skill can access databases, read local data, write HTML files, or load external resources, which creates confidentiality, integrity, and privacy risks in a data-analysis context.

    Content

    No source excerpt is available for this finding.

    Vague Triggers

    Medium
    Category
    Not specified by scanner
    Confidence
    96% confidence
    Finding

    The trigger conditions are extremely broad and cover common requests like SQL queries, visualization, reporting, and file processing. In an agent environment, this can cause the skill to activate for routine user prompts and perform database/file operations with little user awareness, increasing the chance of unintended access or side effects.

    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 · references/INSTALLATION.md (reported line 40)May include surrounding context.

    如果命令不存在,请先安装 Python

    Windows: https://www.python.org/downloads/

    Linux: sudo apt-get install python3 python3-pip

    macOS: brew install python3

    text

    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 · references/INSTALLATION.md (reported line 176)May include surrounding context.

    如果命令不存在,请先安装 Python

    Windows: https://www.python.org/downloads/

    Linux: sudo apt-get install python3 python3-pip

    macOS: brew install python3

    text

    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 · references/INSTALLATION.md (reported line 177)May include surrounding context.

    如果命令不存在,请先安装 Python

    Windows: https://www.python.org/downloads/

    Linux: sudo apt-get install python3 python3-pip

    macOS: brew install python3

    text

    Missing User Warnings

    Medium
    Category
    Not specified by scanner
    Confidence
    89% confidence
    Finding

    The guide writes directly to ~/.pip/pip.conf, creating persistent configuration changes that affect future package installs, but it does not clearly warn users that this modifies their default package source. Persistent mirror changes can redirect later installs to a less trusted or differently managed index, increasing supply-chain risk if the mirror is compromised or serves stale packages.

    Content

    No source excerpt is available for this finding.

    Session Persistence

    Medium
    Category
    Rogue Agent
    Confidence
    90% confidence
    Finding

    The command sequence creates and writes ~/.pip/pip.conf, causing session-independent persistence in the user's environment. Persistent configuration changes are risky because they silently alter future package installation behavior beyond the immediate task, which can enable long-lived supply-chain exposure if the configured mirror is unavailable, tampered with, or not equally trusted.

    Content

    Scanner excerpt · references/INSTALLATION.md (reported line 143)May include surrounding context.

    bash
    # 编辑 ~/.pip/pip.conf
    mkdir -p ~/.pip
    cat > ~/.pip/pip.conf << 'EOF'
    [global]
    index-url = https://mirrors.aliyun.com/pypi/simple/
    

    Rp1

    Medium
    Category
    MCP Rug Pull
    Confidence
    75% confidence
    Finding

    Docker image references without a specific tag (:latest is implicit) or digest (@sha256:...) can be silently replaced by a malicious image.

    Content

    No source excerpt is available for this finding.

    Natural-Language Policy Violations

    Medium
    Category
    Not specified by scanner
    Confidence
    97% confidence
    Finding

    This file forces a specific language/locale for all user-facing instructions and examples, which matches the policy category for language or locale constraints without user opt-in. There is no indication that the skill is region-specific or that alternative language support is intentionally documented.

    Content

    No source excerpt is available for this finding.

    Natural-Language Policy Violations

    Medium
    Category
    Not specified by scanner
    Confidence
    90% confidence
    Finding

    The file title and all instructional content are written only in Chinese, which imposes a single language choice on users without indicating any opt-in or alternative locale support. The policy explicitly flags language or locale constraints when they are forced rather than offered as a choice.

    Content

    No source excerpt is available for this finding.

    Natural-Language Policy Violations

    Medium
    Category
    Not specified by scanner
    Confidence
    96% confidence
    Finding

    The entire skill documentation is written in Chinese and presents the behavior and examples only in that language, with no indication that users may choose another language or that the skill is restricted to a Chinese-language audience. Under the stated policy, forcing a specific language without opt-in is a natural-language policy violation.

    Content

    No source excerpt is available for this finding.

    Natural-Language Policy Violations

    Medium
    Category
    Not specified by scanner
    Confidence
    86% confidence
    Finding

    This markdown file contains user-facing guidance exclusively in Chinese, and there is no indication that the skill is region-specific or that users can opt into another language. Under the language/locale policy, forcing a specific language without user choice can be a natural-language policy violation.

    Content

    No source excerpt is available for this finding.

    Missing User Warnings

    Medium
    Category
    Not specified by scanner
    Confidence
    92% confidence
    Finding

    This markdown file provides pg_terminate_backend(pid) as a ready-to-run example for ending active PostgreSQL queries, but does not warn that terminating sessions can interrupt user work, abort transactions, or affect production availability. Under the markdown criteria for missing user warnings, destructive or service-impacting behaviors should be disclosed when they could affect system integrity.

    Content

    No source excerpt is available for this finding.

    Missing User Warnings

    Medium
    Category
    Not specified by scanner
    Confidence
    93% confidence
    Finding

    KILL QUERY <pid>; is a disruptive administrative action that can stop in-flight work, yet the surrounding markdown does not include any caution about verifying the process ID, user impact, or production risk. For markdown files, behaviors that can affect system integrity or user data should be accompanied by an explicit warning.

    Content

    No source excerpt is available for this finding.

    Natural-Language Policy Violations

    Medium
    Category
    Not specified by scanner
    Confidence
    93% confidence
    Finding

    The entire skill is written in Chinese and configures Chinese fonts in the examples, which indicates an implicit language/locale constraint. There is no note that the skill is region-specific or that users may request another language, so this can violate language/locale policy requiring opt-in or justified constraints.

    Content

    No source excerpt is available for this finding.

    Natural-Language Policy Violations

    Medium
    Category
    Not specified by scanner
    Confidence
    82% confidence
    Finding

    该技能文档标题与整体说明均固定为中文,且示例代码在 L027-L028 强制设置中文字体,体现出默认锁定特定语言/区域呈现方式。文件中没有说明这是面向中文区域的专用技能,也没有向用户提供语言或 locale 选择,符合语言/locale 政策违规的特征。

    Content

    No source excerpt is available for this finding.

    Natural-Language Policy Violations

    Medium
    Category
    Not specified by scanner
    Confidence
    95% confidence
    Finding

    The entire markdown file is written in Chinese, including headings, instructions, and comments, with no indication that users may choose another language or locale. Under the stated policy, forcing a specific language without user opt-in is a natural-language policy violation.

    Content

    No source excerpt is available for this finding.

    Natural-Language Policy Violations

    Medium
    Category
    Not specified by scanner
    Confidence
    94% confidence
    Finding

    This markdown file contains user-facing instructional content only in Chinese, starting from the title and continuing throughout the file. Under the policy, forcing a specific language without user opt-in is a natural-language policy violation unless the locale restriction is explicitly justified, which is not present here.

    Content

    No source excerpt is available for this finding.

    Natural-Language Policy Violations

    Medium
    Category
    Not specified by scanner
    Confidence
    95% confidence
    Finding

    The document title and all instructional content are written in Chinese, which imposes a specific language/locale on users. There is no indication that Chinese is optional, nor any justification that this skill is intended only for a Chinese-speaking or region-specific audience.

    Content

    No source excerpt is available for this finding.

    Natural-Language Policy Violations

    Medium
    Category
    Not specified by scanner
    Confidence
    95% confidence
    Finding

    The file title and all instructional content are written exclusively in Chinese, and there is no indication that users may choose another language or that the skill is intentionally limited to a Chinese-speaking or region-specific audience. Under the policy, forcing a specific language without user opt-in is a natural-language policy violation.

    Content

    No source excerpt is available for this finding.

    Static analysis

    No suspicious patterns detected.