Back to skill

Security audit

Flowchart Exam Generator

Security checks for vulnerabilities and agentic risk

Overview

This skill is a coherent flowchart-to-Excel exam generator, with a real spreadsheet-safety caveat but no evidence of hidden access, persistence, or malicious behavior.

Install only if you want a Chinese-language workflow for generating exam-question spreadsheets from flowcharts. Treat generated spreadsheets as untrusted when source content may come from other people, and open them with external links and active content disabled until formula-like input is sanitized.

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

T09 · Insecure Skill Coding Practices

Warning
Location
scripts/generate_exam.py:57
Finding

Excel Formula Injection Through Untrusted Question Data

Content
View full analysis

Vulnerability Details

File Location: scripts/generate_exam.py, lines 57–65
Vulnerability Type: Excel formula injection
Risk Level: Medium

Vulnerable Code

python
ws.cell(row=row, column=1, value=question.get('题型', '')).border = thin_border
ws.cell(row=row, column=2, value=question.get('题目', '')).border = thin_border
ws.cell(row=row, column=3, value=question.get('选项1', '')).border = thin_border
ws.cell(row=row, column=4, value=question.get('选项2', '')).border = thin_border
ws.cell(row=row, column=5, value=question.get('选项3', '')).border = thin_border
ws.cell(row=row, column=6, value=question.get('选项4', '')).border = thin_border
ws.cell(row=row, column=7, value=question.get('正确答案', '')).border = thin_border
ws.cell(row=row, column=8, value=question.get('解析', '')).border = thin_border
ws.cell(row=row, column=9, value=question.get('出处', '')).border = thin_border

Technical Analysis

The script writes question data directly into XLSX cells without distinguishing trusted content from attacker-controlled text. The data can originate from the command-line JSON argument or from text derived from an uploaded flowchart.

In particular, openpyxl treats a string beginning with = as a spreadsheet formula. Consequently, an attacker can place a formula in any exported field, including the question, options, explanation, source, or question type. The generated workbook then contains executable spreadsheet formula content rather than inert text.

Depending on the spreadsheet application and its security settings, malicious formulas may initiate external requests, expose workbook content through attacker-controlled URLs, manipulate displayed data, or invoke other application-specific formula behavior. External-link warnings or protected-view controls may reduce exploitability, but they do not remove the unsafe data flow.

Attack Path

  1. An attacker supplies crafted flowchart content or a JSON ques ...[truncated 1291 chars]
Remediation
View remediation

Remediation Suggestions

  1. Introduce one centralized function that converts all untrusted cell values to safe text before writing them.
  2. Neutralize values beginning with = by prefixing an apostrophe or otherwise forcing the cell to be stored as a literal string. For defense in depth and compatibility with spreadsheet import behavior, also reject or neutralize leading +, -, and @ characters.
  3. Apply the sanitization function to every user-controlled field, including question type, question text, all options, answer, explanation, and source.
  4. Normalize leading whitespace and control characters before checking the first meaningful character, since they can be used to bypass simplistic validation.
  5. Validate the input schema: require a list of dictionaries, enforce string and length constraints, restrict question types and answers to approved values, and reject unexpected fields or nested objects.
  6. Add automated tests confirming that formula-like input is exported as visible literal text and that the resulting XLSX cell is not marked as a formula.
  7. Document that generated workbooks should be opened with external links and active content disabled.

Example hardening approach:

python
def safe_excel_text(value):
    if value is None:
        return ''
    text = str(value)
    normalized = text.lstrip()
    if normalized.startswith(('=', '+', '-', '@')):
        return "'" + text
    return text

Use safe_excel_text() for every untrusted value supplied to ws.cell().

Vulnerability Patterns
  • 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
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • Privilege EscalationExcessive Permissions, Sudo/Root Execution, Credential Access
Findings (4)

Tp4

High
Category
MCP Tool Poisoning
Confidence
99% confidence
Finding

A strong mismatch between the declared purpose and actual behavior is security-relevant because it can conceal unexpected file access and cause operators to grant trust or invoke the skill under false assumptions. If the implementation reads local paths or validates skill files instead of processing user-supplied flowcharts, it creates a deceptive capability surface that can lead to unauthorized data access or abuse of the agent environment.

Content

No source excerpt is available for this finding.

Undeclared Tool Scope

Medium
Category
MCP Least Privilege
Confidence
70% confidence
Finding

Without declared permissions the skill's intent is opaque and cannot be validated.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
92% confidence
Finding

The manifest description and the entire skill instructions are written to operate in Chinese and describe Chinese-formatted exam generation, but they do not state that language selection is optional or limited to a region-specific context. This creates a natural-language locale policy issue because the skill appears to impose a specific language by default without user opt-in.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
96% confidence
Finding

This Python file contains all user-facing documentation and console messages in Chinese, including the module docstring and runtime usage/output text. Because the file provides no opt-in, language selection, or justification that the tool is region-specific, it appears to impose a specific language/locale in a way that violates the stated natural-language policy rule.

Content

No source excerpt is available for this finding.

Static analysis

No suspicious patterns detected.