Back to skill

Security audit

图片文字识别

Security checks for vulnerabilities and agentic risk

Overview

ClawScan’s verdict is benign with medium confidence: it found no AIG issues and rated most dimensions OK, while noting a reported mismatch between the declared OCR purpose and a source-code portability checker; coverage was partial.

The verdict is benign, but confidence is medium and the scan is incomplete: 34 of 36 components were scanned, with tool-misuse analysis partial for two files. Before installing, consider whether the reported source-code checker belongs in an OCR skill and whether you are comfortable with the undeclared environment, file, and shell capabilities.

Vulnerability Patterns
  • 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
  • Unauthorized Access and Privilege EscalationObtains permissions beyond the task's legitimate needs
Vulnerability Patterns
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • Privilege EscalationExcessive Permissions, Sudo/Root Execution, Credential Access
  • Supply ChainUnpinned Dependencies, External Script Fetching, Obfuscated Code
  • Output HandlingUnvalidated Output Injection, Cross-Context Output, Unbounded Output
  • Tool MisuseTool Parameter Abuse, Chaining Abuse, Unsafe Defaults
Findings (17)

Description-Behavior Mismatch

High
Category
MCP Tool Poisoning
Confidence
98% confidence
Finding

The supplied script's primary function is source-code portability auditing, not OCR. It contains no image/PDF processing, recognition, or table-extraction functionality, and no OCR-specific integration establishes it as a supporting implementation detail. Its header identifies it as tooling for cad-file-reader. No network access, uploads, or execution of the printed fix suggestions is shown; the mismatch concerns its materially different purpose and resources accessed, not demonstrated data exfiltration.

Content

No source excerpt is available for this finding.

Obfuscated Code

High
Category
Supply Chain
Confidence
50% confidence
Finding

Code contains obfuscation (base64, hex encoding with execution). This is often used to hide malicious functionality.

Content

Scanner excerpt · scripts/ocr_image.js (reported line 907)May include surrounding context.

js
}


const DOCTOR_PNG_B64 = "iVBORw0KGgoAAAANSUhEUgAAAjAAAACWCAIAAABPSSXiAAAaB0lEQVR4nO3de1QU1+EH8F12WUUQWVAU8EkkisaQoyaKGo0NIhE5Ek0bPb5NokSTmCaYpkpPakyatmrFmIRqDBFsItUYjVYiKa9YFa1GCMjTIK/AylMeC7LLsvM7v+758bvnzrLM7uzj7un385ezzNy54N75zsy9c0fKcZwEAADA0VwcXQEAAID/hUACAAAmIJAAAIAJCCQAAGACAgkAAJiAQAIAACYgkAAAgAkIJAAAYAICCQAAmIBAAgAAJiCQAACACQgkAABgAgIJAACYgEACAAAmIJAAAIAJCCQAAGACAgkAAJiAQAIAACYgkAAAgAkIJAAAYAICCQAAmIBAAgAAJiCQAACACQgkAABgAgIJAACYgEACAAAmIJAAAIAJCCQAAGACAgkAAJiAQAIAACYgkAAAgAkIJAAAYAICCQAAmIBAAgAAJiCQAACACQgkAABggtzRFZBotdqrV69mZGQUFBSUlpY2NTV1dHTo9Xp3d3dPT8/x48dPnDhx9uzZCxYsePjhh624X7VanZ6enp2dXVBQUF5e3tLS0tXV5e7u7v0fQUFB8/4jJCREKpVacb8ArLUFAFZwjlNVVRUbG+vt7S2wqiEhIQcOHOjs7BS539LS0o0bN7q7uwvZaXBw8Kefftrd3S2w8EOHDlnwv6BQKLy8vCZNmhQREREXF5eZmdnb28vZWG1t7ccff7xixYrg4GAvLy+5XO7p6RkYGBgaGhobG5uWlib8tyY1NDTs27cvMjJyzJgxQ4YMUSgUvr6+c+bM+fWvf33p0iXWamuo8IEDB6KjoydMmDB06FCFQjFq1KipU6c+99xzn3zySVVVFef8beHBgwfk5gEBARZU8uDBg/ya7Nixw4KiAIxyTCB1d3fHxcUNHjzYgmP3yJEjDx8+bNl+Ozs7X331VZlMZu5O

Env Variable Harvesting

High
Category
Data Exfiltration
Confidence
60% confidence
Finding

Code enumerates, copies, or searches environment variables for secrets. Bulk environment access can collect credentials unrelated to the skill's stated purpose.

Content

Scanner excerpt · scripts/self_test.py (reported line 65)May include surrounding context.

python
def run(cmd: list[str], cwd: Path) -> tuple[int, str]:
    import os as _os
    env = dict(_os.environ)
    env["PYTHONIOENCODING"] = "ascii"
    env["PYTHONUTF8"] = "1"
    r = subprocess.run(cmd, cwd=str(cwd), env=env, capture_output=True, text=True)

Env Variable Harvesting

High
Category
Data Exfiltration
Confidence
60% confidence
Finding

Code enumerates, copies, or searches environment variables for secrets. Bulk environment access can collect credentials unrelated to the skill's stated purpose.

Content

Scanner excerpt · scripts/self_test.py (reported line 75)May include surrounding context.

python
def run_shell(args: list[str], timeout: int = 180) -> tuple[int, str, str]:
    """运行 ocr_image.sh,返回 (rc, stdout, stderr)。"""
    import os as _os
    env = dict(_os.environ)
    env["PYTHONIOENCODING"] = "utf-8"
    env["PYTHONUTF8"] = "1"
    r = subprocess.run(["bash", str(HERE / "ocr_image.sh"), *args], cwd=str(HERE),

Chaining Abuse

High
Category
Tool Misuse
Confidence
75% confidence
Finding

Tool calls are chained to bypass individual safety checks or escalate capabilities beyond what any single tool call would allow.

Content

Scanner excerpt · scripts/self_test.sh (reported line 52)May include surrounding context.

sh
local o e rc
  o="$(mktemp)"; e="$(mktemp)"
  "$OCR" --no-cache --quiet "$img" >"$o" 2>"$e"; rc=$?
  if [ "$rc" != 0 ]; then echo "❌ $name OCR 运行失败 rc=$rc"; fail=1; rm -f "$o" "$e"; steps=$((steps+1)); return; fi
  if [ "$expect_text" = "1" ]; then
    if [ -s "$o" ] || grep -qiE "置信度|需人工核对|warn" "$e"; then
      echo "   输出 $(wc -c <"$o" | tr -d ' ') 字节(含告警通道)——通过"

Skill declares no tool scope ('permissions' or 'allowed-tools') but code capabilities were detected: env, file_read, file_write, shell.

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.

subprocess module call

Medium
Category
Dangerous Code Execution
Confidence
70% confidence
Finding

subprocess module calls execute external commands. Without careful input validation, this enables command injection.

Content

Scanner excerpt · scripts/image_info.py (reported line 39)May include surrounding context.

python
if sys.platform != "darwin":
        return None
    try:
        r = subprocess.run(["sips", "-g", "pixelWidth", "-g", "pixelHeight", path],
                           capture_output=True, text=True, timeout=15)
        if r.returncode != 0:
            return None

subprocess module call

Medium
Category
Dangerous Code Execution
Confidence
70% confidence
Finding

subprocess module calls execute external commands. Without careful input validation, this enables command injection.

Content

Scanner excerpt · scripts/image_info.py (reported line 60)May include surrounding context.

python
def _identify_size(path: str):
    for cmd in ("magick", "identify"):
        try:
            r = subprocess.run([cmd, "-format", "%w %h", path + "[0]"],
                               capture_output=True, text=True, timeout=15)
            if r.returncode == 0:
                parts = r.stdout.strip().split()

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 · scripts/lint_cross_platform.py (reported line 67)May include surrounding context.

python
"SIGKILL 仅 POSIX。fix: 平台分支外避免直接 kill;Windows 用 terminate()"),
    ("NATIVE_DYLIB",
     re.compile(r"\b[\w.-]+\.dylib\b"),
     "dylib 是 macOS 原生库格式。fix: 仓库内 sudo 二进制请走 platform 分支;Windows/Linux 由 pip wheel 提供"),
    ("DARWIN_SO",
     re.compile(r"\.cpython-\d+[^-]*-darwin\.so\b"),
     "darwin 专有扩展名出现在业务脚本里通常是误引用。fix: vendor 由各平台 setup/pip 重建,不应在脚本里硬依赖"),

Dynamic import via __import__()

Medium
Category
Dangerous Code Execution
Confidence
75% confidence
Finding

Dynamic import() can load arbitrary modules at runtime, bypassing static analysis and potentially importing malicious code.

Content

Scanner excerpt · scripts/pyboot.py (reported line 85)May include surrounding context.

python
manifest = root / "manifest.json"
    if manifest.is_file():
        try:
            data = __import__("json").loads(manifest.read_text(encoding="utf-8"))
            version = data.get("version")
            if isinstance(version, str) and version.strip():
                return version.strip()

subprocess module call

Medium
Category
Dangerous Code Execution
Confidence
70% confidence
Finding

subprocess module calls execute external commands. Without careful input validation, this enables command injection.

Content

Scanner excerpt · scripts/self_test.py (reported line 68)May include surrounding context.

python
env = dict(_os.environ)
    env["PYTHONIOENCODING"] = "ascii"
    env["PYTHONUTF8"] = "1"
    r = subprocess.run(cmd, cwd=str(cwd), env=env, capture_output=True, text=True)
    return r.returncode, (r.stdout or "") + (r.stderr or "")

subprocess module call

Medium
Category
Dangerous Code Execution
Confidence
70% confidence
Finding

subprocess module calls execute external commands. Without careful input validation, this enables command injection.

Content

Scanner excerpt · scripts/self_test.py (reported line 78)May include surrounding context.

python
env = dict(_os.environ)
    env["PYTHONIOENCODING"] = "utf-8"
    env["PYTHONUTF8"] = "1"
    r = subprocess.run(["bash", str(HERE / "ocr_image.sh"), *args], cwd=str(HERE),
                       env=env, capture_output=True, text=True, timeout=timeout)
    return r.returncode, r.stdout or "", r.stderr or ""

HEIC conversion failure messages are required to be in Chinese without a language choice.

Low
Category
Output Handling
Confidence
85% confidence
Finding

L8 specifies that missing HEIC conversion dependencies produce Chinese prompts. This fixes the language of user-facing diagnostics without offering a locale choice or explaining a region-specific necessity.

Content

No source excerpt is available for this finding.

The troubleshooting workflow specifies Chinese error output without user opt-in.

Low
Category
Output Handling
Confidence
87% confidence
Finding

L10 directs that missing-file or unsupported-format errors list supported formats in Chinese. The instruction does not offer a language choice or justify restricting these diagnostics to Chinese.

Content

No source excerpt is available for this finding.

scripts/ocr_image.js L0995–L1004 claims --workers reuses one worker in a single process, but actually launches a new Node process for each chunk.

Low
Category
Excessive Agency
Confidence
99% confidence
Finding

The comment at L0995–L0997 explicitly says subprocess model reloads are avoided by processing serially within one process using the same worker. However, L1002–L1004 synchronously launches a separate Node invocation for each chunk, preventing worker reuse across chunks; the help text at L0116 and L0168 also incorrectly advertises parallel processing.

Content

No source excerpt is available for this finding.

Dynamic attribute access via getattr()

Low
Category
Dangerous Code Execution
Confidence
50% confidence
Finding

Dynamic getattr() with a non-literal attribute name can access arbitrary object attributes, potentially bypassing access controls.

Content

Scanner excerpt · scripts/pyboot.py (reported line 44)May include surrounding context.

python
os.environ.setdefault("PYTHONIOENCODING", "utf-8")
    os.environ.setdefault("PYTHONUTF8", "1")
    for _name in ("stdout", "stderr"):
        _stream = getattr(sys, _name, None)
        _reconf = getattr(_stream, "reconfigure", None)
        if callable(_reconf):
            try:

Setup mandates Chinese prompts throughout without a language option.

Low
Category
Output Handling
Confidence
96% confidence
Finding

The header explicitly specifies Chinese prompts throughout the dependency-check and repair process. This file provides no language-selection mechanism or documented regional justification for that restriction.

Content

No source excerpt is available for this finding.