Back to skill

Security audit

pdf字体乱码修复神器

Security checks for vulnerabilities and agentic risk

Overview

ClawScan marks this skill suspicious with high confidence because scanners report automatic installation of unpinned packages, execution and delivery checks that can fail open, and repairs that may exceed their stated scope or lose document features.

Treat this as a review item and consider the reported risks before installing. In particular, account for automatic dependency downloads, unreliable delivery checks, repair behavior that may exceed requested limits, and possible loss of accessibility structure. Scanner coverage was partial because some local references could not be resolved, so the evidence is incomplete; no malicious intent is established.

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
  • Privilege EscalationExcessive Permissions, Sudo/Root Execution, Credential Access
  • Excessive AgencyUnrestricted Tool Access, Autonomous Decision Making, Scope Creep
  • Output HandlingUnvalidated Output Injection, Cross-Context Output, Unbounded Output
  • Behavioral ASTexec() Call, eval() Call, Dynamic Import
  • Taint TrackingDirect Taint Flow, Variable-Mediated Taint Flow, Credential Exfiltration Chain
Findings (29)

JSON mode reports success even when the PDF fails its audits.

High
Category
Excessive Agency
Confidence
100% confidence
Finding

JSON mode collects audit results but bypasses the branch that updates the failure exit status, so an existing PDF can fail its audits while the command exits zero. Because this tool is intended as a delivery gate, automation trusting the exit code can release defective PDFs; the JSON verdict fields only help callers that inspect them explicitly.

Content

No source excerpt is available for this finding.

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.

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 · SKILL.md (reported line 123)May include surrounding context.

ghostscript 官方获取(脚本检测不到时会自动打印这段,且不会擅自安装):

text
Debian/Ubuntu : sudo apt-get install ghostscript
Fedora        : sudo dnf install ghostscript
macOS         : brew install ghostscript
Windows       : winget install ArtifexSoftware.GhostScript

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 · SKILL.md (reported line 124)May include surrounding context.

text
Debian/Ubuntu : sudo apt-get install ghostscript
Fedora        : sudo dnf install ghostscript
macOS         : brew install ghostscript
Windows       : winget install ArtifexSoftware.GhostScript
官方下载页     : https://ghostscript.com/releases/gsdnld.html

The “lossless” repair removes PDF accessibility structure without warning users about that loss.

Medium
Category
Output Handling
Confidence
97% confidence
Finding

The documented repair deletes tagged-PDF accessibility structure while describing the result as lossless. Preserving visible text and copying does not preserve reading order or assistive-technology semantics, so users can unknowingly deliver an accessibility-degraded document.

Content

No source excerpt is available for this finding.

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/_deps.py (reported line 64)May include surrounding context.

python
def _importable(mod):
    try:
        __import__(mod)
        return True
    except Exception:
        return False

The PDF inspection/repair skill automatically installs packages from a package index into a persistent executable dependency directory.

Medium
Category
Excessive Agency
Confidence
97% confidence
Finding

Running the skill can silently download executable dependencies into a persistent directory that activation places first on sys.path. A compromised dependency or an attacker able to modify that directory can consequently affect later executions, extending the risk beyond a single PDF operation.

Content

No source excerpt is available for this finding.

subprocess module call

Medium
Category
Dangerous Code Execution
Confidence
95% confidence
Finding

The subprocess automatically installs unpinned packages and transitive dependencies during ordinary skill activation, creating a supply-chain execution path beyond PDF processing. Argument-list execution avoids shell injection, but it does not protect against compromised distributions or package sources configured in the environment.

Content

Scanner excerpt · scripts/_deps.py (reported line 79)May include surrounding context.

python
def _install(base, pkg):
    try:
        subprocess.run(
            [sys.executable, '-m', 'pip', 'install', '--quiet',
             '--target', base, pkg],
            timeout=600, capture_output=True)

Tainted flow: 'base' from os.environ (line 46, credential/environment) → subprocess.run (code execution)

Medium
Category
Data Flow
Confidence
65% confidence
Finding

Data from a source is assigned to a variable that is later passed to a sink, creating a variable-mediated taint flow.

Content

Scanner excerpt · scripts/_deps.py (reported line 79)May include surrounding context.

python
def _install(base, pkg):
    try:
        subprocess.run(
            [sys.executable, '-m', 'pip', 'install', '--quiet',
             '--target', base, pkg],
            timeout=600, capture_output=True)

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/common.py (reported line 62)May include surrounding context.

python
未检测到 ghostscript(把文字转成矢量轮廓时需要它)。
请从**官方**渠道安装(以下均为官方源,任选其一):

  Debian/Ubuntu : sudo apt-get install ghostscript
  Fedora        : sudo dnf install ghostscript
  macOS         : brew install ghostscript
  Windows       : winget install ArtifexSoftware.GhostScript

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/common.py (reported line 63)May include surrounding context.

python
请从**官方**渠道安装(以下均为官方源,任选其一):

  Debian/Ubuntu : sudo apt-get install ghostscript
  Fedora        : sudo dnf install ghostscript
  macOS         : brew install ghostscript
  Windows       : winget install ArtifexSoftware.GhostScript
  官方下载页     : https://ghostscript.com/releases/gsdnld.html

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/discover.py (reported line 162)May include surrounding context.

python
Linux:
      Noto Sans SC(TrueType 版):https://fonts.google.com/noto/specimen/Noto+Sans+SC
      文泉驿微米黑:https://wenq.org/wqy2/index.cgi?ZenHei=
      Debian/Ubuntu:sudo apt-get install fonts-wqy-microhei fonts-noto-cjk(⚠️ noto-cjk 是 CFF,装了也用不上)
  通用(Google 官方字体站,选 Noto Sans SC 的 .ttf 而不是 .otf):
      https://github.com/notofonts/noto-cjk/releases
"""

The command runner executes subprocesses without any user disclosure.

Medium
Category
Output Handling
Confidence
90% confidence
Finding

The run() helper executes the supplied command without a confirmation prompt, user-facing log, or explanatory docstring/comment. Captured output is returned rather than displayed, so it does not itself disclose execution to the user.

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/common.py (reported line 88)May include surrounding context.

python
def run(cmd, timeout=300):
    try:
        r = subprocess.run(cmd, capture_output=True, text=True, timeout=timeout)
        return r.returncode, (r.stdout or '') + (r.stderr or '')
    except Exception as e:
        return 1, str(e)

The delivery-gate CLI exits successfully when structural validation is incomplete.

Medium
Category
Excessive Agency
Confidence
99% confidence
Finding

inspect_pdf explicitly returns an incomplete verdict when structural validation cannot run, but main only changes the exit status for fail. Consequently, an incomplete inspection can exit zero and bypass downstream delivery workflows that rely on the documented exit-code contract.

Content

No source excerpt is available for this finding.

The --charset-only option can fall through to outlining or rasterization instead of limiting changes to charset repair.

Medium
Category
Excessive Agency
Confidence
99% confidence
Finding

The --charset-only restriction is enforced only after a successful charset repair within a conditional branch. If no eligible repair exists or the repair fails, execution can continue into outlining or rasterization, producing a text-destructive result contrary to the requested scope.

Content

No source excerpt is available for this finding.

The documented --keep-copy guarantee is bypassed when outline conversion succeeds.

Medium
Category
Excessive Agency
Confidence
100% confidence
Finding

When outlining succeeds and passes the checks, the code publishes the outlined document and returns zero before enforcing --keep-copy. This violates an explicit preservation constraint and can cause downstream delivery of a document without searchable or copyable text, although the ordinary path retains the original.

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/fontkit.py (reported line 37)May include surrounding context.

python
def list_zh_ttf():
    """返回 [(path, family)],只列 fontformat=TrueType 的中文字体。"""
    try:
        r = subprocess.run(['fc-list', ':lang=zh', 'file', 'family', 'fontformat'],
                           capture_output=True, text=True, timeout=25)
    except Exception:
        return []

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/fontkit.py (reported line 55)May include surrounding context.

python
def find_family(family):
    rows = []
    try:
        r = subprocess.run(['fc-list', ':', 'file', 'family', 'fontformat'],
                           capture_output=True, text=True, timeout=25)
    except Exception:
        return rows

Successful repair of a later PDF clears earlier delivery-gate failures.

Medium
Category
Excessive Agency
Confidence
100% confidence
Finding

A successful auto-fix assigns zero to the batch-wide worst status, clearing failures or incomplete checks recorded for earlier PDFs. A batch can therefore be reported as successful even though an earlier document remains unsuitable for delivery.

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/gate.py (reported line 132)May include surrounding context.

python
if a.auto_fix:
                    print('\n[auto-fix] 自动修复中(交付版写回原路径,原件另存为 xxx_原生.pdf)…')
                    fixpy = os.path.join(HERE, 'fix.py')
                    rc = subprocess.call([sys.executable, fixpy, p, '--replace'])
                    if rc == 0:
                        print('[auto-fix] 原路径已是可打印的交付版;需要复制文字时用 xxx_原生.pdf。')
                        # 原路径已换成可用产物,允许流程继续

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/gate_hook.py (reported line 86)May include surrounding context.

python
cmd.append("--quiet")
    if args.auto_fix:
        cmd.append("--auto-fix")
    return subprocess.call(cmd)


if __name__ == "__main__":

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/locate.py (reported line 174)May include surrounding context.

python
for mod, use in (('pymupdf', '读字体/渲染'), ('fontTools', 'CFF 解析/OTF→TTF'),
                     ('pikepdf', 'charset 修复')):
        try:
            __import__(mod)
            print('   ✅ %s(%s)' % (mod, use))
        except ImportError:
            print('   ⚠️ %s 缺失(%s 不可用)' % (mod, use))

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/pptx.py (reported line 76)May include surrounding context.

python
def fc_lookup(family):
    """返回该 family 在本机的所有记录 [(path, format)]。"""
    try:
        r = subprocess.run(['fc-list', ':', 'file', 'family', 'fontformat'],
                           capture_output=True, text=True, timeout=20)
    except Exception:
        return []

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/pptx.py (reported line 186)May include surrounding context.

python
if a.stage <= 2:
            print('\n[第 2 步] 转矢量轮廓(显示保真,失去复制)...')
            ol = os.path.join(work, 'outline.pdf')
            okk, msg = __import__('fix').to_outline(keep, ol)
            if okk:
                res = inspect_pdf(ol)
                if not res['bad']: