Back to skill

Security audit

Local QR Code Generation And Recognition Not Require An API_KEY - 本地二维码生成与识别

Security checks for vulnerabilities and agentic risk

Overview

This is a coherent local QR-code tool, but it needs review because its file path handling and input limits can let it read or overwrite more than users would expect.

Install only in a contained environment and use a dedicated output directory. Avoid running it on untrusted paths or workspaces containing symlinks, and do not pass very large QR rendering parameters until path handling, overwrite behavior, duplicate code, and input limits are fixed.

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

T09 · Insecure Skill Coding Practices

Error
Location
qrcode.py:10
Finding

Symlink-Based Escape from the Intended Filesystem Boundary

Content
View full analysis
Dict[str, Any]: """ 规范化并限制本地文件路径,只允许在当前工作目录及其子目录内读写。 禁止绝对路径和目录穿越(包含 ..)。 """ if not user_path: return { "error": "invalid_param", "message": f"field '{field}' is empty", } # 禁止绝对路径 if os.path.isabs(user_path): return { "error": "invalid_path", "message": f"Absolute path is not allowed for '{field}'", } # 规范化并检查目录穿越 norm = os.path.normpath(user_path) if norm.startswith("..") or norm == "..": return { "error": "invalid_path", "message": f"Path traversal is not allowed for '{field}'", } base = os.getcwd() full = os.path.join(base, norm) return {"error": None, "path": full, "relative": norm} ``` The resulting path is used for output as follows: ```python safe = _normalize_local_path(out_raw, "out") if safe["error"]: return safe out = safe["path"] out_dir = os.path.dirname(out) if out_dir: os.makedirs(out_dir, exist_ok=True) try: img.save(out) except Exception as e: return {"error": "save_failed", "message": str(e), "path": out} ``` It is also used for input as follows: ```python safe = _normalize_local_path(path_raw, "path") if safe["error"]: return safe path = safe["path"] if not os.path.isfile(path): return {"error": "file_not_found", "message": f"File not found: {safe['relative']}"} img = cv2.imread(path) ``` ### Technical Analysis The path validation is lexical. It rejects absolute paths and normalized strings beginning with `..`, but it does not resolve symbolic links before deciding whether a path remains inside the current working directory. ...[truncated 2133 chars]
Remediation
View remediation

T09 · Insecure Skill Coding Practices

Warning
Location
qrcode.py:58
Finding

Unbounded QR Rendering Parameters Permit Resource Exhaustion

Content
View full analysis
Remediation
View remediation

T08 · Insecure Dependencies

Note
Location
SKILL.md:25
Finding

Unpinned Third-Party Dependency Installation

Content
View full analysis
Remediation
View remediation
Vulnerability Patterns
  • Trigger AbuseOverly Broad Trigger, Shadow Command Trigger, Keyword Baiting Trigger
  • 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)

Tp2

High
Category
MCP Tool Poisoning
Confidence
85% confidence
Finding

Mixing characters from multiple Unicode scripts in a single identifier is a common technique to create visually ambiguous tool names.

Content

No source excerpt is available for this finding.

Vague Triggers

Medium
Category
Not specified by scanner
Confidence
94% confidence
Finding

The trigger phrase includes broad wording like 'or similar local QR code problems', which can cause the agent to invoke this skill outside a narrowly intended scope. Over-broad routing increases the chance of inappropriate file processing or local image handling when another tool or a clarification step would be safer.

Content

No source excerpt is available for this finding.

Missing User Warnings

Low
Category
Not specified by scanner
Confidence
87% confidence
Finding

The skill documents writing generated QR images to local paths but does not prominently warn that it performs filesystem writes. In agent environments, insufficient disclosure about local file creation can lead to unexpected persistence, accidental overwrites, or user confusion about where data is stored.

Content

No source excerpt is available for this finding.

Intent-Code Divergence

Low
Category
Not specified by scanner
Confidence
95% confidence
Finding

The file is qrcode.py, but the first main() usage string tells users to invoke qrcode2.py. This inline documentation contradicts the actual file identity and could mislead operators about how to use the skill.

Content

No source excerpt is available for this finding.

Static analysis

No suspicious patterns detected.